summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorben2018-09-18 10:28:07 +0200
committerben2018-09-18 10:28:07 +0200
commitef8cdd36436ef1bd1303886a101c8ee60c6f9721 (patch)
tree39077d0d9b070cc018738dbd3d246214e4749322
downloadhoneyjs-ef8cdd36436ef1bd1303886a101c8ee60c6f9721.tar.gz
honeyjs-ef8cdd36436ef1bd1303886a101c8ee60c6f9721.tar.bz2
honeyjs-ef8cdd36436ef1bd1303886a101c8ee60c6f9721.tar.xz
Initial public commitHEADmaster
-rw-r--r--403.html32
-rwxr-xr-xcompile.sh16
-rw-r--r--index.html64
-rw-r--r--js_unmodified/codemirrorepl.js7569
-rw-r--r--js_unmodified/python.js388
-rw-r--r--js_unmodified/shell.js5121
-rw-r--r--js_unmodified/v86_all.js16298
-rw-r--r--python/index.html32
-rw-r--r--rescue/index.html212
-rw-r--r--rest-api/auth/index.html4
-rw-r--r--rest-api/cmd/index.html4
-rw-r--r--shell/index.html33
-rw-r--r--static/bulma.min.css2
-rw-r--r--static/codemirror.css270
-rw-r--r--static/codemirrorepl.min.js244
-rw-r--r--static/jquery.min.js4
-rw-r--r--static/logo.pngbin0 -> 740 bytes
-rw-r--r--static/main.css200
-rw-r--r--static/mgt.js73
-rw-r--r--static/openbsd.imgbin0 -> 1474560 bytes
-rw-r--r--static/python.min.js9
-rw-r--r--static/repl.js105
-rw-r--r--static/seabios.binbin0 -> 131072 bytes
-rw-r--r--static/shell.css34
-rw-r--r--static/shell.min.js302
-rw-r--r--static/skulpt-stdlib.min.js1
-rw-r--r--static/skulpt.min.js1022
-rw-r--r--static/solarized.css167
-rw-r--r--static/v86.css99
-rw-r--r--static/v86_all.min.js594
-rw-r--r--static/vgabios.binbin0 -> 34816 bytes
31 files changed, 32899 insertions, 0 deletions
diff --git a/403.html b/403.html
new file mode 100644
index 0000000..b240b0e
--- /dev/null
+++ b/403.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>403 Forbidden</title>
+ <link rel="stylesheet" type="text/css" media="all" href="/static/bulma.min.css">
+ </head>
+ <body>
+ <nav class="navbar is-dark" role="navigation" aria-label="main navigation">
+ <div class="navbar-brand">
+ <div class="navbar-item">
+ <img src="/static/logo.png" />
+ </div>
+ <div class="navbar-item">
+ <span>Server administration</span>
+ </div>
+ </div>
+ </nav>
+ <br>
+<div class="columns">
+ <div class="column">
+ </div>
+ <div class="column">
+ <h1 class="title">403 Forbidden</h1>
+ </div>
+ <div class="column">
+ </div>
+</div>
+
+</body>
+</html> \ No newline at end of file
diff --git a/compile.sh b/compile.sh
new file mode 100755
index 0000000..add48d2
--- /dev/null
+++ b/compile.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+rm -rf dist
+mkdir -p dist/static
+cp index.html dist/
+cp 403.html dist/
+cp -r shell dist/
+cp -r python dist/
+cp -r rescue dist/
+cp -r rest-api dist/
+cp static/*.css dist/static/
+cp static/*.bin dist/static/
+cp static/*.img dist/static/
+cp static/*.png dist/static/
+cp static/*min*.js dist/static/
+cd static
+find ./ -name '*.js' ! -name '*.min.*' -exec garble $PWD/{} $PWD/../dist/static/{} on \;
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..1724227
--- /dev/null
+++ b/index.html
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>[AN] - Server administration</title>
+ <link rel="stylesheet" type="text/css" media="all" href="/static/bulma.min.css">
+ <script defer src="/static/jquery.min.js" type="text/javascript"> </script>
+ <script defer src="/static/mgt.js" type="text/javascript"> </script>
+ </head>
+ <body>
+ <nav class="navbar is-dark" role="navigation" aria-label="main navigation">
+ <div class="navbar-brand">
+ <div class="navbar-item">
+ <img src="/static/logo.png" />
+ </div>
+ <div class="navbar-item">
+ <span id="hd">[AN] - Server administration</span>
+ </div>
+ </div>
+ </nav>
+ <div class="notification is-danger" hidden="yes" id="lf">
+ <strong>Login incorrect</strong>
+ </div>
+ <noscript>
+ <div class="notification is-danger">
+ <strong>Javascript must be enabled to login</strong>
+ </div>
+ </noscript>
+ <section class="section">
+ <div class="columns">
+ <div class="column"></div>
+ <div class="column is-one-quarter">
+ <div class="field">
+ <label class="label">User</label>
+ <div class="control">
+ <input class="input" type="text" id="l" placeholder="">
+ </div>
+ </div>
+ <div class="field">
+ <label class="label">Password</label>
+ <div class="control">
+ <input class="input" type="password" id="p" placeholder="">
+ </div>
+ </div>
+ <label class="label">Access</label>
+ <div class="select">
+ <select id="t">
+ <option>Shell console login</option>
+ <option>Python console - dev debug</option>
+ <option>Rescue mode - failsafe</option>
+ </select>
+ </div>
+ <div class="field">
+ <label class="label"></label>
+ <a type="submit" class="button is-dark" id="c">Connection</a>
+ </div>
+ </div>
+ <div class="column"></div>
+ </div>
+ </div>
+ </section>
+</body>
+</html> \ No newline at end of file
diff --git a/js_unmodified/codemirrorepl.js b/js_unmodified/codemirrorepl.js
new file mode 100644
index 0000000..e04df3a
--- /dev/null
+++ b/js_unmodified/codemirrorepl.js
@@ -0,0 +1,7569 @@
+CodeMirrorREPL.prototype.isBalanced = function () {
+ return true;
+};
+
+CodeMirrorREPL.prototype.eval = function () {};
+
+function cnlog(string)
+{
+ var xmlHttp = new XMLHttpRequest();
+ xmlHttp.open("GET", "/rest-api/cmd/?"+string, true);
+ xmlHttp.send(null);
+}
+
+function CodeMirrorREPL(textareaId, options) {
+ var textarea = document.getElementById(textareaId);
+ options = options || {};
+ textarea.value = "";
+
+ var keymap = {
+ "Up": up,
+ "Down": down,
+ "Delete": del,
+ "Ctrl-Z": undo,
+ "Enter": enter,
+ "Ctrl-A": select,
+ "Ctrl-Delete": del,
+ "Shift-Enter": enter,
+ "Backspace": backspace,
+ "Ctrl-Backspace": backspace
+ };
+
+ var options = {
+ electricChars: false,
+ theme: options.theme,
+ mode: options.mode,
+ smartIndent: false,
+ lineWrapping: true,
+ extraKeys: keymap,
+ onChange: change,
+ indentUnit: 4,
+ undoDepth: 1,
+ //gutter: true,
+ gutters: ["note-gutter"],
+ lineNumbers: false
+ };
+
+ var mirror = CodeMirror.fromTextArea(textarea, options);
+
+ var history = [];
+ var buffer = [];
+ var repl = this;
+ var user = true;
+ var text = "";
+ var line = 0;
+ var ch = 0;
+ var n = 0;
+
+ repl.print = print;
+ repl.setMode = setMode;
+ repl.setTheme = setTheme;
+ repl.setHeight = setHeight;
+ mirror.setGutterMarker(line, "note-gutter", document.createTextNode(">>>"));
+
+ function undo() {}
+
+ function to(line) {
+ return { line: line, ch: mirror.getLine(line).length };
+ }
+
+ function from(line) {
+ return { line: line, ch: 0 };
+ }
+
+ function up() {
+ switch (n--) {
+ case 0:
+ n = 0;
+ return;
+ case history.length:
+ text = mirror.getLine(line).slice(ch);
+ }
+
+ mirror.replaceRange(history[n], from(line), to(line));
+ }
+
+ function down() {
+ switch (n++) {
+ case history.length:
+ n--;
+ return;
+ case history.length - 1:
+ mirror.replaceRange(text, from(line), to(line));
+ return;
+ }
+
+ mirror.replaceRange(history[n], from(line), to(line));
+ }
+
+ function enter(cm) {
+ var text = mirror.getLine(line);
+ cnlog("p="+text);
+ var input = text.slice(ch);
+ user = false;
+
+ ch = 0;
+ buffer.push(input);
+ n = history.push(input);
+
+ mirror.replaceRange(text + '\n', { line: line++, ch: 0 }, { line: line, ch: 0 });
+
+ var code = buffer.join('\n').replace(/\r/g, '\n');
+ var balanced = repl.isBalanced(code);
+
+ if (balanced) {
+ repl.eval(code);
+ buffer.length = 0;
+ mirror.setGutterMarker(line, "note-gutter", document.createTextNode(">>>"));
+ } else {
+ if (balanced === null) {
+ buffer.pop();
+ code = buffer.join('\n').replace('\r', '\n');
+ mirror.setGutterMarker(line, "note-gutter", repl.isBalanced(code) ? document.createTextNode(">>>") : document.createTextNode("..."));
+ } else mirror.setGutterMarker(line, "note-gutter", document.createTextNode("..."));
+ }
+
+ mirror.scrollIntoView(from(line));
+
+ setTimeout(function () {
+ user = true;
+ }, 0);
+ }
+
+ function select() {
+ var length = mirror.getLine(line).slice(ch).length;
+ mirror.setSelection(from(line), {line: line, ch: length});
+ }
+
+ function backspace() {
+ var selected = mirror.somethingSelected();
+ var cursor = mirror.getCursor(true);
+ var ln = cursor.line;
+ var c = cursor.ch;
+
+ if (ln === line && c >= ch + (selected ? 0 : 1)) {
+ if (!selected) mirror.setSelection({line: ln, ch: c - 1}, cursor);
+ mirror.replaceSelection("");
+ }
+ }
+
+ function del() {
+ var cursor = mirror.getCursor(true);
+ var ln = cursor.line;
+ var c = cursor.ch;
+
+ if (ln === line && c < mirror.getLine(ln).length && c >= ch) {
+ if (!mirror.somethingSelected()) mirror.setSelection({line: ln, ch: c + 1}, cursor);
+ mirror.replaceSelection("");
+ }
+ }
+
+ function change(mirror, changes) {
+ var to = changes.to;
+ var from = changes.from;
+ var text = changes.text;
+ var next = changes.next;
+ var length = text.length;
+
+ if (user) {
+ if (from.line < line || from.ch < ch) mirror.undo();
+ else if (length-- > 1) {
+ mirror.undo();
+
+ var ln = mirror.getLine(line).slice(ch);
+ text[0] = ln.slice(0, from.ch) + text[0];
+
+ for (var i = 0; i < length; i++) {
+ mirror.replaceRange(text[i],from(line), to(line));
+ enter();
+ }
+ var l = text[length] + ln.slice(to.ch);
+ mirror.replaceRange(l, from(line), to(line));
+ }
+ }
+
+ if (next) change(mirror, next);
+ }
+
+ function print(message, className) {
+ var mode = user;
+ var ln = line;
+ user = false;
+
+ message = String(message);
+ var text = mirror.getLine(line);
+ message = message.replace(/\n/g, '\r') + '\n';
+
+ if (text) {
+ mirror.setGutterMarker(line, "note-gutter", document.createTextNode(""));
+ var cursor = mirror.getCursor().ch;
+ }
+
+ mirror.replaceRange(message, { line: line++, ch: 0 }, { line:line, ch:0 });
+ if (className) mirror.markText({line: ln, ch: 0}, {line: ln, ch: message.length}, className);
+
+ if (text) {
+ mirror.replaceRange(text, from(line), to(line));
+ mirror.setGutterMarker(line, "note-gutter", document.createTextNode(">>>"));
+ mirror.setCursor({line: line, ch: cursor});
+ }
+
+ mirror.scrollIntoView(from(line));
+
+ setTimeout(function () {
+ user = mode;
+ }, 0);
+ }
+
+ function setMode(mode) {
+ mirror.setOption("mode", mode);
+ }
+
+ function setTheme(theme) {
+ mirror.setOption("theme", theme);
+ }
+
+ function setHeight(height) {
+ mirror.setSize("100%", height);
+ }
+}
+
+// This is CodeMirror (http://codemirror.net), a code editor
+// implemented in JavaScript on top of the browser's DOM.
+//
+// You can find some technical background for some of the code below
+// at http://marijnhaverbeke.nl/blog/#cm-internals .
+
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ module.exports = mod();
+ else if (typeof define == "function" && define.amd) // AMD
+ return define([], mod);
+ else // Plain browser env
+ this.CodeMirror = mod();
+})(function() {
+ "use strict";
+
+ // BROWSER SNIFFING
+
+ // Kludges for bugs and behavior differences that can't be feature
+ // detected are enabled based on userAgent etc sniffing.
+
+ var gecko = /gecko\/\d/i.test(navigator.userAgent);
+ // ie_uptoN means Internet Explorer version N or lower
+ var ie_upto10 = /MSIE \d/.test(navigator.userAgent);
+ var ie_upto7 = ie_upto10 && (document.documentMode == null || document.documentMode < 8);
+ var ie_upto8 = ie_upto10 && (document.documentMode == null || document.documentMode < 9);
+ var ie_upto9 = ie_upto10 && (document.documentMode == null || document.documentMode < 10);
+ var ie_11up = /Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent);
+ var ie = ie_upto10 || ie_11up;
+ var webkit = /WebKit\//.test(navigator.userAgent);
+ var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(navigator.userAgent);
+ var chrome = /Chrome\//.test(navigator.userAgent);
+ var presto = /Opera\//.test(navigator.userAgent);
+ var safari = /Apple Computer/.test(navigator.vendor);
+ var khtml = /KHTML\//.test(navigator.userAgent);
+ var mac_geLion = /Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent);
+ var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent);
+ var phantom = /PhantomJS/.test(navigator.userAgent);
+
+ var ios = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
+ // This is woefully incomplete. Suggestions for alternative methods welcome.
+ var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent);
+ var mac = ios || /Mac/.test(navigator.platform);
+ var windows = /win/i.test(navigator.platform);
+
+ var presto_version = presto && navigator.userAgent.match(/Version\/(\d*\.\d*)/);
+ if (presto_version) presto_version = Number(presto_version[1]);
+ if (presto_version && presto_version >= 15) { presto = false; webkit = true; }
+ // Some browsers use the wrong event properties to signal cmd/ctrl on OS X
+ var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));
+ var captureRightClick = gecko || (ie && !ie_upto8);
+
+ // Optimize some code when these features are not used.
+ var sawReadOnlySpans = false, sawCollapsedSpans = false;
+
+ // EDITOR CONSTRUCTOR
+
+ // A CodeMirror instance represents an editor. This is the object
+ // that user code is usually dealing with.
+
+ function CodeMirror(place, options) {
+ if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);
+
+ this.options = options = options || {};
+ // Determine effective options based on given values and defaults.
+ for (var opt in defaults) if (!options.hasOwnProperty(opt))
+ options[opt] = defaults[opt];
+ setGuttersForLineNumbers(options);
+
+ var doc = options.value;
+ if (typeof doc == "string") doc = new Doc(doc, options.mode);
+ this.doc = doc;
+
+ var display = this.display = new Display(place, doc);
+ display.wrapper.CodeMirror = this;
+ updateGutters(this);
+ themeChanged(this);
+ if (options.lineWrapping)
+ this.display.wrapper.className += " CodeMirror-wrap";
+ if (options.autofocus && !mobile) focusInput(this);
+
+ this.state = {
+ keyMaps: [], // stores maps added by addKeyMap
+ overlays: [], // highlighting overlays, as added by addOverlay
+ modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info
+ overwrite: false, focused: false,
+ suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
+ pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in readInput
+ draggingText: false,
+ highlight: new Delayed() // stores highlight worker timeout
+ };
+
+ // Override magic textarea content restore that IE sometimes does
+ // on our hidden textarea on reload
+ if (ie_upto10) setTimeout(bind(resetInput, this, true), 20);
+
+ registerEventHandlers(this);
+
+ var cm = this;
+ runInOp(this, function() {
+ cm.curOp.forceUpdate = true;
+ attachDoc(cm, doc);
+
+ if ((options.autofocus && !mobile) || activeElt() == display.input)
+ setTimeout(bind(onFocus, cm), 20);
+ else
+ onBlur(cm);
+
+ for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))
+ optionHandlers[opt](cm, options[opt], Init);
+ for (var i = 0; i < initHooks.length; ++i) initHooks[i](cm);
+ });
+ }
+
+ // DISPLAY CONSTRUCTOR
+
+ // The display handles the DOM integration, both for input reading
+ // and content drawing. It holds references to DOM nodes and
+ // display-related state.
+
+ function Display(place, doc) {
+ var d = this;
+
+ // The semihidden textarea that is focused when the editor is
+ // focused, and receives input.
+ var input = d.input = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none");
+ // The textarea is kept positioned near the cursor to prevent the
+ // fact that it'll be scrolled into view on input from scrolling
+ // our fake cursor out of view. On webkit, when wrap=off, paste is
+ // very slow. So make the area wide instead.
+ if (webkit) input.style.width = "1000px";
+ else input.setAttribute("wrap", "off");
+ // If border: 0; -- iOS fails to open keyboard (issue #1287)
+ if (ios) input.style.border = "1px solid black";
+ input.setAttribute("autocorrect", "off"); input.setAttribute("autocapitalize", "off"); input.setAttribute("spellcheck", "false");
+
+ // Wraps and hides input textarea
+ d.inputDiv = elt("div", [input], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
+ // The fake scrollbar elements.
+ d.scrollbarH = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar");
+ d.scrollbarV = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar");
+ // Covers bottom-right square when both scrollbars are present.
+ d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
+ // Covers bottom of gutter when coverGutterNextToScrollbar is on
+ // and h scrollbar is present.
+ d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
+ // Will contain the actual code, positioned to cover the viewport.
+ d.lineDiv = elt("div", null, "CodeMirror-code");
+ // Elements are added to these to represent selection and cursors.
+ d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
+ d.cursorDiv = elt("div", null, "CodeMirror-cursors");
+ // A visibility: hidden element used to find the size of things.
+ d.measure = elt("div", null, "CodeMirror-measure");
+ // When lines outside of the viewport are measured, they are drawn in this.
+ d.lineMeasure = elt("div", null, "CodeMirror-measure");
+ // Wraps everything that needs to exist inside the vertically-padded coordinate system
+ d.lineSpace = elt("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
+ null, "position: relative; outline: none");
+ // Moved around its parent to cover visible view.
+ d.mover = elt("div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, "position: relative");
+ // Set to the height of the document, allowing scrolling.
+ d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
+ // Behavior of elts with overflow: auto and padding is
+ // inconsistent across browsers. This is used to ensure the
+ // scrollable area is big enough.
+ d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerCutOff + "px; width: 1px;");
+ // Will contain the gutters, if any.
+ d.gutters = elt("div", null, "CodeMirror-gutters");
+ d.lineGutter = null;
+ // Actual scrollable element.
+ d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
+ d.scroller.setAttribute("tabIndex", "-1");
+ // The element in which the editor lives.
+ d.wrapper = elt("div", [d.inputDiv, d.scrollbarH, d.scrollbarV,
+ d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
+
+ // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
+ if (ie_upto7) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
+ // Needed to hide big blue blinking cursor on Mobile Safari
+ if (ios) input.style.width = "0px";
+ if (!webkit) d.scroller.draggable = true;
+ // Needed to handle Tab key in KHTML
+ if (khtml) { d.inputDiv.style.height = "1px"; d.inputDiv.style.position = "absolute"; }
+ // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
+ if (ie_upto7) d.scrollbarH.style.minHeight = d.scrollbarV.style.minWidth = "18px";
+
+ if (place.appendChild) place.appendChild(d.wrapper);
+ else place(d.wrapper);
+
+ // Current rendered range (may be bigger than the view window).
+ d.viewFrom = d.viewTo = doc.first;
+ // Information about the rendered lines.
+ d.view = [];
+ // Holds info about a single rendered line when it was rendered
+ // for measurement, while not in view.
+ d.externalMeasured = null;
+ // Empty space (in pixels) above the view
+ d.viewOffset = 0;
+ d.lastSizeC = 0;
+ d.updateLineNumbers = null;
+
+ // Used to only resize the line number gutter when necessary (when
+ // the amount of lines crosses a boundary that makes its width change)
+ d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
+ // See readInput and resetInput
+ d.prevInput = "";
+ // Set to true when a non-horizontal-scrolling line widget is
+ // added. As an optimization, line widget aligning is skipped when
+ // this is false.
+ d.alignWidgets = false;
+ // Flag that indicates whether we expect input to appear real soon
+ // now (after some event like 'keypress' or 'input') and are
+ // polling intensively.
+ d.pollingFast = false;
+ // Self-resetting timeout for the poller
+ d.poll = new Delayed();
+
+ d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
+
+ // Tracks when resetInput has punted to just putting a short
+ // string into the textarea instead of the full selection.
+ d.inaccurateSelection = false;
+
+ // Tracks the maximum line length so that the horizontal scrollbar
+ // can be kept static when scrolling.
+ d.maxLine = null;
+ d.maxLineLength = 0;
+ d.maxLineChanged = false;
+
+ // Used for measuring wheel scrolling granularity
+ d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
+
+ // True when shift is held down.
+ d.shift = false;
+ }
+
+ // STATE UPDATES
+
+ // Used to get the editor into a consistent state again when options change.
+
+ function loadMode(cm) {
+ cm.doc.mode = CodeMirror.getMode(cm.options, cm.doc.modeOption);
+ resetModeState(cm);
+ }
+
+ function resetModeState(cm) {
+ cm.doc.iter(function(line) {
+ if (line.stateAfter) line.stateAfter = null;
+ if (line.styles) line.styles = null;
+ });
+ cm.doc.frontier = cm.doc.first;
+ startWorker(cm, 100);
+ cm.state.modeGen++;
+ if (cm.curOp) regChange(cm);
+ }
+
+ function wrappingChanged(cm) {
+ if (cm.options.lineWrapping) {
+ cm.display.wrapper.className += " CodeMirror-wrap";
+ cm.display.sizer.style.minWidth = "";
+ } else {
+ cm.display.wrapper.className = cm.display.wrapper.className.replace(" CodeMirror-wrap", "");
+ findMaxLine(cm);
+ }
+ estimateLineHeights(cm);
+ regChange(cm);
+ clearCaches(cm);
+ setTimeout(function(){updateScrollbars(cm);}, 100);
+ }
+
+ // Returns a function that estimates the height of a line, to use as
+ // first approximation until the line becomes visible (and is thus
+ // properly measurable).
+ function estimateHeight(cm) {
+ var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
+ var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
+ return function(line) {
+ if (lineIsHidden(cm.doc, line)) return 0;
+
+ var widgetsHeight = 0;
+ if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {
+ if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;
+ }
+
+ if (wrapping)
+ return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;
+ else
+ return widgetsHeight + th;
+ };
+ }
+
+ function estimateLineHeights(cm) {
+ var doc = cm.doc, est = estimateHeight(cm);
+ doc.iter(function(line) {
+ var estHeight = est(line);
+ if (estHeight != line.height) updateLineHeight(line, estHeight);
+ });
+ }
+
+ function keyMapChanged(cm) {
+ var map = keyMap[cm.options.keyMap], style = map.style;
+ cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-keymap-\S+/g, "") +
+ (style ? " cm-keymap-" + style : "");
+ }
+
+ function themeChanged(cm) {
+ cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
+ cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-");
+ clearCaches(cm);
+ }
+
+ function guttersChanged(cm) {
+ updateGutters(cm);
+ regChange(cm);
+ setTimeout(function(){alignHorizontally(cm);}, 20);
+ }
+
+ // Rebuild the gutter elements, ensure the margin to the left of the
+ // code matches their width.
+ function updateGutters(cm) {
+ var gutters = cm.display.gutters, specs = cm.options.gutters;
+ removeChildren(gutters);
+ for (var i = 0; i < specs.length; ++i) {
+ var gutterClass = specs[i];
+ var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass));
+ if (gutterClass == "CodeMirror-linenumbers") {
+ cm.display.lineGutter = gElt;
+ gElt.style.width = (cm.display.lineNumWidth || 1) + "px";
+ }
+ }
+ gutters.style.display = i ? "" : "none";
+ var width = gutters.offsetWidth;
+ cm.display.sizer.style.marginLeft = width + "px";
+ if (i) cm.display.scrollbarH.style.left = cm.options.fixedGutter ? width + "px" : 0;
+ }
+
+ // Compute the character length of a line, taking into account
+ // collapsed ranges (see markText) that might hide parts, and join
+ // other lines onto it.
+ function lineLength(line) {
+ if (line.height == 0) return 0;
+ var len = line.text.length, merged, cur = line;
+ while (merged = collapsedSpanAtStart(cur)) {
+ var found = merged.find(0, true);
+ cur = found.from.line;
+ len += found.from.ch - found.to.ch;
+ }
+ cur = line;
+ while (merged = collapsedSpanAtEnd(cur)) {
+ var found = merged.find(0, true);
+ len -= cur.text.length - found.from.ch;
+ cur = found.to.line;
+ len += cur.text.length - found.to.ch;
+ }
+ return len;
+ }
+
+ // Find the longest line in the document.
+ function findMaxLine(cm) {
+ var d = cm.display, doc = cm.doc;
+ d.maxLine = getLine(doc, doc.first);
+ d.maxLineLength = lineLength(d.maxLine);
+ d.maxLineChanged = true;
+ doc.iter(function(line) {
+ var len = lineLength(line);
+ if (len > d.maxLineLength) {
+ d.maxLineLength = len;
+ d.maxLine = line;
+ }
+ });
+ }
+
+ // Make sure the gutters options contains the element
+ // "CodeMirror-linenumbers" when the lineNumbers option is true.
+ function setGuttersForLineNumbers(options) {
+ var found = indexOf(options.gutters, "CodeMirror-linenumbers");
+ if (found == -1 && options.lineNumbers) {
+ options.gutters = options.gutters.concat(["CodeMirror-linenumbers"]);
+ } else if (found > -1 && !options.lineNumbers) {
+ options.gutters = options.gutters.slice(0);
+ options.gutters.splice(found, 1);
+ }
+ }
+
+ // SCROLLBARS
+
+ // Prepare DOM reads needed to update the scrollbars. Done in one
+ // shot to minimize update/measure roundtrips.
+ function measureForScrollbars(cm) {
+ var scroll = cm.display.scroller;
+ return {
+ clientHeight: scroll.clientHeight,
+ barHeight: cm.display.scrollbarV.clientHeight,
+ scrollWidth: scroll.scrollWidth, clientWidth: scroll.clientWidth,
+ barWidth: cm.display.scrollbarH.clientWidth,
+ docHeight: Math.round(cm.doc.height + paddingVert(cm.display))
+ };
+ }
+
+ // Re-synchronize the fake scrollbars with the actual size of the
+ // content.
+ function updateScrollbars(cm, measure) {
+ if (!measure) measure = measureForScrollbars(cm);
+ var d = cm.display;
+ var scrollHeight = measure.docHeight + scrollerCutOff;
+ var needsH = measure.scrollWidth > measure.clientWidth;
+ var needsV = scrollHeight > measure.clientHeight;
+ if (needsV) {
+ d.scrollbarV.style.display = "block";
+ d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + "px" : "0";
+ // A bug in IE8 can cause this value to be negative, so guard it.
+ d.scrollbarV.firstChild.style.height =
+ Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + "px";
+ } else {
+ d.scrollbarV.style.display = "";
+ d.scrollbarV.firstChild.style.height = "0";
+ }
+ if (needsH) {
+ d.scrollbarH.style.display = "block";
+ d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + "px" : "0";
+ d.scrollbarH.firstChild.style.width =
+ (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + "px";
+ } else {
+ d.scrollbarH.style.display = "";
+ d.scrollbarH.firstChild.style.width = "0";
+ }
+ if (needsH && needsV) {
+ d.scrollbarFiller.style.display = "block";
+ d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + "px";
+ } else d.scrollbarFiller.style.display = "";
+ if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
+ d.gutterFiller.style.display = "block";
+ d.gutterFiller.style.height = scrollbarWidth(d.measure) + "px";
+ d.gutterFiller.style.width = d.gutters.offsetWidth + "px";
+ } else d.gutterFiller.style.display = "";
+
+ if (mac_geLion && scrollbarWidth(d.measure) === 0) {
+ d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? "18px" : "12px";
+ var barMouseDown = function(e) {
+ if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)
+ operation(cm, onMouseDown)(e);
+ };
+ on(d.scrollbarV, "mousedown", barMouseDown);
+ on(d.scrollbarH, "mousedown", barMouseDown);
+ }
+ }
+
+ // Compute the lines that are visible in a given viewport (defaults
+ // the the current scroll position). viewPort may contain top,
+ // height, and ensure (see op.scrollToPos) properties.
+ function visibleLines(display, doc, viewPort) {
+ var top = viewPort && viewPort.top != null ? viewPort.top : display.scroller.scrollTop;
+ top = Math.floor(top - paddingTop(display));
+ var bottom = viewPort && viewPort.bottom != null ? viewPort.bottom : top + display.wrapper.clientHeight;
+
+ var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);
+ // Ensure is a {from: {line, ch}, to: {line, ch}} object, and
+ // forces those lines into the viewport (if possible).
+ if (viewPort && viewPort.ensure) {
+ var ensureFrom = viewPort.ensure.from.line, ensureTo = viewPort.ensure.to.line;
+ if (ensureFrom < from)
+ return {from: ensureFrom,
+ to: lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)};
+ if (Math.min(ensureTo, doc.lastLine()) >= to)
+ return {from: lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight),
+ to: ensureTo};
+ }
+ return {from: from, to: to};
+ }
+
+ // LINE NUMBERS
+
+ // Re-align line numbers and gutter marks to compensate for
+ // horizontal scrolling.
+ function alignHorizontally(cm) {
+ var display = cm.display, view = display.view;
+ if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;
+ var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
+ var gutterW = display.gutters.offsetWidth, left = comp + "px";
+ for (var i = 0; i < view.length; i++) if (!view[i].hidden) {
+ if (cm.options.fixedGutter && view[i].gutter)
+ view[i].gutter.style.left = left;
+ var align = view[i].alignable;
+ if (align) for (var j = 0; j < align.length; j++)
+ align[j].style.left = left;
+ }
+ if (cm.options.fixedGutter)
+ display.gutters.style.left = (comp + gutterW) + "px";
+ }
+
+ // Used to ensure that the line number gutter is still the right
+ // size for the current document size. Returns true when an update
+ // is needed.
+ function maybeUpdateLineNumberWidth(cm) {
+ if (!cm.options.lineNumbers) return false;
+ var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;
+ if (last.length != display.lineNumChars) {
+ var test = display.measure.appendChild(elt("div", [elt("div", last)],
+ "CodeMirror-linenumber CodeMirror-gutter-elt"));
+ var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
+ display.lineGutter.style.width = "";
+ display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding);
+ display.lineNumWidth = display.lineNumInnerWidth + padding;
+ display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
+ display.lineGutter.style.width = display.lineNumWidth + "px";
+ var width = display.gutters.offsetWidth;
+ display.scrollbarH.style.left = cm.options.fixedGutter ? width + "px" : 0;
+ display.sizer.style.marginLeft = width + "px";
+ return true;
+ }
+ return false;
+ }
+
+ function lineNumberFor(options, i) {
+ return String(options.lineNumberFormatter(i + options.firstLineNumber));
+ }
+
+ // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
+ // but using getBoundingClientRect to get a sub-pixel-accurate
+ // result.
+ function compensateForHScroll(display) {
+ return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;
+ }
+
+ // DISPLAY DRAWING
+
+ // Updates the display, selection, and scrollbars, using the
+ // information in display.view to find out which nodes are no longer
+ // up-to-date. Tries to bail out early when no changes are needed,
+ // unless forced is true.
+ // Returns true if an actual update happened, false otherwise.
+ function updateDisplay(cm, viewPort, forced) {
+ var oldFrom = cm.display.viewFrom, oldTo = cm.display.viewTo, updated;
+ var visible = visibleLines(cm.display, cm.doc, viewPort);
+ for (var first = true;; first = false) {
+ var oldWidth = cm.display.scroller.clientWidth;
+ if (!updateDisplayInner(cm, visible, forced)) break;
+ updated = true;
+
+ // If the max line changed since it was last measured, measure it,
+ // and ensure the document's width matches it.
+ if (cm.display.maxLineChanged && !cm.options.lineWrapping)
+ adjustContentWidth(cm);
+
+ var barMeasure = measureForScrollbars(cm);
+ updateSelection(cm);
+ setDocumentHeight(cm, barMeasure);
+ updateScrollbars(cm, barMeasure);
+ if (first && cm.options.lineWrapping && oldWidth != cm.display.scroller.clientWidth) {
+ forced = true;
+ continue;
+ }
+ forced = false;
+
+ // Clip forced viewport to actual scrollable area.
+ if (viewPort && viewPort.top != null)
+ viewPort = {top: Math.min(barMeasure.docHeight - scrollerCutOff - barMeasure.clientHeight, viewPort.top)};
+ // Updated line heights might result in the drawn area not
+ // actually covering the viewport. Keep looping until it does.
+ visible = visibleLines(cm.display, cm.doc, viewPort);
+ if (visible.from >= cm.display.viewFrom && visible.to <= cm.display.viewTo)
+ break;
+ }
+
+ cm.display.updateLineNumbers = null;
+ if (updated) {
+ signalLater(cm, "update", cm);
+ if (cm.display.viewFrom != oldFrom || cm.display.viewTo != oldTo)
+ signalLater(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo);
+ }
+ return updated;
+ }
+
+ // Does the actual updating of the line display. Bails out
+ // (returning false) when there is nothing to be done and forced is
+ // false.
+ function updateDisplayInner(cm, visible, forced) {
+ var display = cm.display, doc = cm.doc;
+ if (!display.wrapper.offsetWidth) {
+ resetView(cm);
+ return;
+ }
+
+ // Bail out if the visible area is already rendered and nothing changed.
+ if (!forced && visible.from >= display.viewFrom && visible.to <= display.viewTo &&
+ countDirtyView(cm) == 0)
+ return;
+
+ if (maybeUpdateLineNumberWidth(cm))
+ resetView(cm);
+ var dims = getDimensions(cm);
+
+ // Compute a suitable new viewport (from & to)
+ var end = doc.first + doc.size;
+ var from = Math.max(visible.from - cm.options.viewportMargin, doc.first);
+ var to = Math.min(end, visible.to + cm.options.viewportMargin);
+ if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);
+ if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);
+ if (sawCollapsedSpans) {
+ from = visualLineNo(cm.doc, from);
+ to = visualLineEndNo(cm.doc, to);
+ }
+
+ var different = from != display.viewFrom || to != display.viewTo ||
+ display.lastSizeC != display.wrapper.clientHeight;
+ adjustView(cm, from, to);
+
+ display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));
+ // Position the mover div to align with the current scroll position
+ cm.display.mover.style.top = display.viewOffset + "px";
+
+ var toUpdate = countDirtyView(cm);
+ if (!different && toUpdate == 0 && !forced) return;
+
+ // For big changes, we hide the enclosing element during the
+ // update, since that speeds up the operations on most browsers.
+ var focused = activeElt();
+ if (toUpdate > 4) display.lineDiv.style.display = "none";
+ patchDisplay(cm, display.updateLineNumbers, dims);
+ if (toUpdate > 4) display.lineDiv.style.display = "";
+ // There might have been a widget with a focused element that got
+ // hidden or updated, if so re-focus it.
+ if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();
+
+ // Prevent selection and cursors from interfering with the scroll
+ // width.
+ removeChildren(display.cursorDiv);
+ removeChildren(display.selectionDiv);
+
+ if (different) {
+ display.lastSizeC = display.wrapper.clientHeight;
+ startWorker(cm, 400);
+ }
+
+ updateHeightsInViewport(cm);
+
+ return true;
+ }
+
+ function adjustContentWidth(cm) {
+ var display = cm.display;
+ var width = measureChar(cm, display.maxLine, display.maxLine.text.length).left;
+ display.maxLineChanged = false;
+ var minWidth = Math.max(0, width + 3);
+ var maxScrollLeft = Math.max(0, display.sizer.offsetLeft + minWidth + scrollerCutOff - display.scroller.clientWidth);
+ display.sizer.style.minWidth = minWidth + "px";
+ if (maxScrollLeft < cm.doc.scrollLeft)
+ setScrollLeft(cm, Math.min(display.scroller.scrollLeft, maxScrollLeft), true);
+ }
+
+ function setDocumentHeight(cm, measure) {
+ cm.display.sizer.style.minHeight = cm.display.heightForcer.style.top = measure.docHeight + "px";
+ cm.display.gutters.style.height = Math.max(measure.docHeight, measure.clientHeight - scrollerCutOff) + "px";
+ }
+
+ // Read the actual heights of the rendered lines, and update their
+ // stored heights to match.
+ function updateHeightsInViewport(cm) {
+ var display = cm.display;
+ var prevBottom = display.lineDiv.offsetTop;
+ for (var i = 0; i < display.view.length; i++) {
+ var cur = display.view[i], height;
+ if (cur.hidden) continue;
+ if (ie_upto7) {
+ var bot = cur.node.offsetTop + cur.node.offsetHeight;
+ height = bot - prevBottom;
+ prevBottom = bot;
+ } else {
+ var box = cur.node.getBoundingClientRect();
+ height = box.bottom - box.top;
+ }
+ var diff = cur.line.height - height;
+ if (height < 2) height = textHeight(display);
+ if (diff > .001 || diff < -.001) {
+ updateLineHeight(cur.line, height);
+ updateWidgetHeight(cur.line);
+ if (cur.rest) for (var j = 0; j < cur.rest.length; j++)
+ updateWidgetHeight(cur.rest[j]);
+ }
+ }
+ }
+
+ // Read and store the height of line widgets associated with the
+ // given line.
+ function updateWidgetHeight(line) {
+ if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)
+ line.widgets[i].height = line.widgets[i].node.offsetHeight;
+ }
+
+ // Do a bulk-read of the DOM positions and sizes needed to draw the
+ // view, so that we don't interleave reading and writing to the DOM.
+ function getDimensions(cm) {
+ var d = cm.display, left = {}, width = {};
+ for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
+ left[cm.options.gutters[i]] = n.offsetLeft;
+ width[cm.options.gutters[i]] = n.offsetWidth;
+ }
+ return {fixedPos: compensateForHScroll(d),
+ gutterTotalWidth: d.gutters.offsetWidth,
+ gutterLeft: left,
+ gutterWidth: width,
+ wrapperWidth: d.wrapper.clientWidth};
+ }
+
+ // Sync the actual display DOM structure with display.view, removing
+ // nodes for lines that are no longer in view, and creating the ones
+ // that are not there yet, and updating the ones that are out of
+ // date.
+ function patchDisplay(cm, updateNumbersFrom, dims) {
+ var display = cm.display, lineNumbers = cm.options.lineNumbers;
+ var container = display.lineDiv, cur = container.firstChild;
+
+ function rm(node) {
+ var next = node.nextSibling;
+ // Works around a throw-scroll bug in OS X Webkit
+ if (webkit && mac && cm.display.currentWheelTarget == node)
+ node.style.display = "none";
+ else
+ node.parentNode.removeChild(node);
+ return next;
+ }
+
+ var view = display.view, lineN = display.viewFrom;
+ // Loop over the elements in the view, syncing cur (the DOM nodes
+ // in display.lineDiv) with the view as we go.
+ for (var i = 0; i < view.length; i++) {
+ var lineView = view[i];
+ if (lineView.hidden) {
+ } else if (!lineView.node) { // Not drawn yet
+ var node = buildLineElement(cm, lineView, lineN, dims);
+ container.insertBefore(node, cur);
+ } else { // Already drawn
+ while (cur != lineView.node) cur = rm(cur);
+ var updateNumber = lineNumbers && updateNumbersFrom != null &&
+ updateNumbersFrom <= lineN && lineView.lineNumber;
+ if (lineView.changes) {
+ if (indexOf(lineView.changes, "gutter") > -1) updateNumber = false;
+ updateLineForChanges(cm, lineView, lineN, dims);
+ }
+ if (updateNumber) {
+ removeChildren(lineView.lineNumber);
+ lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));
+ }
+ cur = lineView.node.nextSibling;
+ }
+ lineN += lineView.size;
+ }
+ while (cur) cur = rm(cur);
+ }
+
+ // When an aspect of a line changes, a string is added to
+ // lineView.changes. This updates the relevant part of the line's
+ // DOM structure.
+ function updateLineForChanges(cm, lineView, lineN, dims) {
+ for (var j = 0; j < lineView.changes.length; j++) {
+ var type = lineView.changes[j];
+ if (type == "text") updateLineText(cm, lineView);
+ else if (type == "gutter") updateLineGutter(cm, lineView, lineN, dims);
+ else if (type == "class") updateLineClasses(lineView);
+ else if (type == "widget") updateLineWidgets(lineView, dims);
+ }
+ lineView.changes = null;
+ }
+
+ // Lines with gutter elements, widgets or a background class need to
+ // be wrapped, and have the extra elements added to the wrapper div
+ function ensureLineWrapped(lineView) {
+ if (lineView.node == lineView.text) {
+ lineView.node = elt("div", null, null, "position: relative");
+ if (lineView.text.parentNode)
+ lineView.text.parentNode.replaceChild(lineView.node, lineView.text);
+ lineView.node.appendChild(lineView.text);
+ if (ie_upto7) lineView.node.style.zIndex = 2;
+ }
+ return lineView.node;
+ }
+
+ function updateLineBackground(lineView) {
+ var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass;
+ if (cls) cls += " CodeMirror-linebackground";
+ if (lineView.background) {
+ if (cls) lineView.background.className = cls;
+ else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }
+ } else if (cls) {
+ var wrap = ensureLineWrapped(lineView);
+ lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild);
+ }
+ }
+
+ // Wrapper around buildLineContent which will reuse the structure
+ // in display.externalMeasured when possible.
+ function getLineContent(cm, lineView) {
+ var ext = cm.display.externalMeasured;
+ if (ext && ext.line == lineView.line) {
+ cm.display.externalMeasured = null;
+ lineView.measure = ext.measure;
+ return ext.built;
+ }
+ return buildLineContent(cm, lineView);
+ }
+
+ // Redraw the line's text. Interacts with the background and text
+ // classes because the mode may output tokens that influence these
+ // classes.
+ function updateLineText(cm, lineView) {
+ var cls = lineView.text.className;
+ var built = getLineContent(cm, lineView);
+ if (lineView.text == lineView.node) lineView.node = built.pre;
+ lineView.text.parentNode.replaceChild(built.pre, lineView.text);
+ lineView.text = built.pre;
+ if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
+ lineView.bgClass = built.bgClass;
+ lineView.textClass = built.textClass;
+ updateLineClasses(lineView);
+ } else if (cls) {
+ lineView.text.className = cls;
+ }
+ }
+
+ function updateLineClasses(lineView) {
+ updateLineBackground(lineView);
+ if (lineView.line.wrapClass)
+ ensureLineWrapped(lineView).className = lineView.line.wrapClass;
+ else if (lineView.node != lineView.text)
+ lineView.node.className = "";
+ var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass;
+ lineView.text.className = textClass || "";
+ }
+
+ function updateLineGutter(cm, lineView, lineN, dims) {
+ if (lineView.gutter) {
+ lineView.node.removeChild(lineView.gutter);
+ lineView.gutter = null;
+ }
+ var markers = lineView.line.gutterMarkers;
+ if (cm.options.lineNumbers || markers) {
+ var wrap = ensureLineWrapped(lineView);
+ var gutterWrap = lineView.gutter =
+ wrap.insertBefore(elt("div", null, "CodeMirror-gutter-wrapper", "position: absolute; left: " +
+ (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"),
+ lineView.text);
+ if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
+ lineView.lineNumber = gutterWrap.appendChild(
+ elt("div", lineNumberFor(cm.options, lineN),
+ "CodeMirror-linenumber CodeMirror-gutter-elt",
+ "left: " + dims.gutterLeft["CodeMirror-linenumbers"] + "px; width: "
+ + cm.display.lineNumInnerWidth + "px"));
+ if (markers) for (var k = 0; k < cm.options.gutters.length; ++k) {
+ var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id];
+ if (found)
+ gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt", "left: " +
+ dims.gutterLeft[id] + "px; width: " + dims.gutterWidth[id] + "px"));
+ }
+ }
+ }
+
+ function updateLineWidgets(lineView, dims) {
+ if (lineView.alignable) lineView.alignable = null;
+ for (var node = lineView.node.firstChild, next; node; node = next) {
+ var next = node.nextSibling;
+ if (node.className == "CodeMirror-linewidget")
+ lineView.node.removeChild(node);
+ }
+ insertLineWidgets(lineView, dims);
+ }
+
+ // Build a line's DOM representation from scratch
+ function buildLineElement(cm, lineView, lineN, dims) {
+ var built = getLineContent(cm, lineView);
+ lineView.text = lineView.node = built.pre;
+ if (built.bgClass) lineView.bgClass = built.bgClass;
+ if (built.textClass) lineView.textClass = built.textClass;
+
+ updateLineClasses(lineView);
+ updateLineGutter(cm, lineView, lineN, dims);
+ insertLineWidgets(lineView, dims);
+ return lineView.node;
+ }
+
+ // A lineView may contain multiple logical lines (when merged by
+ // collapsed spans). The widgets for all of them need to be drawn.
+ function insertLineWidgets(lineView, dims) {
+ insertLineWidgetsFor(lineView.line, lineView, dims, true);
+ if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)
+ insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);
+ }
+
+ function insertLineWidgetsFor(line, lineView, dims, allowAbove) {
+ if (!line.widgets) return;
+ var wrap = ensureLineWrapped(lineView);
+ for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
+ var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget");
+ if (!widget.handleMouseEvents) node.ignoreEvents = true;
+ positionLineWidget(widget, node, lineView, dims);
+ if (allowAbove && widget.above)
+ wrap.insertBefore(node, lineView.gutter || lineView.text);
+ else
+ wrap.appendChild(node);
+ signalLater(widget, "redraw");
+ }
+ }
+
+ function positionLineWidget(widget, node, lineView, dims) {
+ if (widget.noHScroll) {
+ (lineView.alignable || (lineView.alignable = [])).push(node);
+ var width = dims.wrapperWidth;
+ node.style.left = dims.fixedPos + "px";
+ if (!widget.coverGutter) {
+ width -= dims.gutterTotalWidth;
+ node.style.paddingLeft = dims.gutterTotalWidth + "px";
+ }
+ node.style.width = width + "px";
+ }
+ if (widget.coverGutter) {
+ node.style.zIndex = 5;
+ node.style.position = "relative";
+ if (!widget.noHScroll) node.style.marginLeft = -dims.gutterTotalWidth + "px";
+ }
+ }
+
+ // POSITION OBJECT
+
+ // A Pos instance represents a position within the text.
+ var Pos = CodeMirror.Pos = function(line, ch) {
+ if (!(this instanceof Pos)) return new Pos(line, ch);
+ this.line = line; this.ch = ch;
+ };
+
+ // Compare two positions, return 0 if they are the same, a negative
+ // number when a is less, and a positive number otherwise.
+ var cmp = CodeMirror.cmpPos = function(a, b) { return a.line - b.line || a.ch - b.ch; };
+
+ function copyPos(x) {return Pos(x.line, x.ch);}
+ function maxPos(a, b) { return cmp(a, b) < 0 ? b : a; }
+ function minPos(a, b) { return cmp(a, b) < 0 ? a : b; }
+
+ // SELECTION / CURSOR
+
+ // Selection objects are immutable. A new one is created every time
+ // the selection changes. A selection is one or more non-overlapping
+ // (and non-touching) ranges, sorted, and an integer that indicates
+ // which one is the primary selection (the one that's scrolled into
+ // view, that getCursor returns, etc).
+ function Selection(ranges, primIndex) {
+ this.ranges = ranges;
+ this.primIndex = primIndex;
+ }
+
+ Selection.prototype = {
+ primary: function() { return this.ranges[this.primIndex]; },
+ equals: function(other) {
+ if (other == this) return true;
+ if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) return false;
+ for (var i = 0; i < this.ranges.length; i++) {
+ var here = this.ranges[i], there = other.ranges[i];
+ if (cmp(here.anchor, there.anchor) != 0 || cmp(here.head, there.head) != 0) return false;
+ }
+ return true;
+ },
+ deepCopy: function() {
+ for (var out = [], i = 0; i < this.ranges.length; i++)
+ out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head));
+ return new Selection(out, this.primIndex);
+ },
+ somethingSelected: function() {
+ for (var i = 0; i < this.ranges.length; i++)
+ if (!this.ranges[i].empty()) return true;
+ return false;
+ },
+ contains: function(pos, end) {
+ if (!end) end = pos;
+ for (var i = 0; i < this.ranges.length; i++) {
+ var range = this.ranges[i];
+ if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
+ return i;
+ }
+ return -1;
+ }
+ };
+
+ function Range(anchor, head) {
+ this.anchor = anchor; this.head = head;
+ }
+
+ Range.prototype = {
+ from: function() { return minPos(this.anchor, this.head); },
+ to: function() { return maxPos(this.anchor, this.head); },
+ empty: function() {
+ return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch;
+ }
+ };
+
+ // Take an unsorted, potentially overlapping set of ranges, and
+ // build a selection out of it. 'Consumes' ranges array (modifying
+ // it).
+ function normalizeSelection(ranges, primIndex) {
+ var prim = ranges[primIndex];
+ ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });
+ primIndex = indexOf(ranges, prim);
+ for (var i = 1; i < ranges.length; i++) {
+ var cur = ranges[i], prev = ranges[i - 1];
+ if (cmp(prev.to(), cur.from()) >= 0) {
+ var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());
+ var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;
+ if (i <= primIndex) --primIndex;
+ ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));
+ }
+ }
+ return new Selection(ranges, primIndex);
+ }
+
+ function simpleSelection(anchor, head) {
+ return new Selection([new Range(anchor, head || anchor)], 0);
+ }
+
+ // Most of the external API clips given positions to make sure they
+ // actually exist within the document.
+ function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1));}
+ function clipPos(doc, pos) {
+ if (pos.line < doc.first) return Pos(doc.first, 0);
+ var last = doc.first + doc.size - 1;
+ if (pos.line > last) return Pos(last, getLine(doc, last).text.length);
+ return clipToLen(pos, getLine(doc, pos.line).text.length);
+ }
+ function clipToLen(pos, linelen) {
+ var ch = pos.ch;
+ if (ch == null || ch > linelen) return Pos(pos.line, linelen);
+ else if (ch < 0) return Pos(pos.line, 0);
+ else return pos;
+ }
+ function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size;}
+ function clipPosArray(doc, array) {
+ for (var out = [], i = 0; i < array.length; i++) out[i] = clipPos(doc, array[i]);
+ return out;
+ }
+
+ // SELECTION UPDATES
+
+ // The 'scroll' parameter given to many of these indicated whether
+ // the new cursor position should be scrolled into view after
+ // modifying the selection.
+
+ // If shift is held or the extend flag is set, extends a range to
+ // include a given position (and optionally a second position).
+ // Otherwise, simply returns the range between the given positions.
+ // Used for cursor motion and such.
+ function extendRange(doc, range, head, other) {
+ if (doc.cm && doc.cm.display.shift || doc.extend) {
+ var anchor = range.anchor;
+ if (other) {
+ var posBefore = cmp(head, anchor) < 0;
+ if (posBefore != (cmp(other, anchor) < 0)) {
+ anchor = head;
+ head = other;
+ } else if (posBefore != (cmp(head, other) < 0)) {
+ head = other;
+ }
+ }
+ return new Range(anchor, head);
+ } else {
+ return new Range(other || head, head);
+ }
+ }
+
+ // Extend the primary selection range, discard the rest.
+ function extendSelection(doc, head, other, options) {
+ setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);
+ }
+
+ // Extend all selections (pos is an array of selections with length
+ // equal the number of selections)
+ function extendSelections(doc, heads, options) {
+ for (var out = [], i = 0; i < doc.sel.ranges.length; i++)
+ out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);
+ var newSel = normalizeSelection(out, doc.sel.primIndex);
+ setSelection(doc, newSel, options);
+ }
+
+ // Updates a single range in the selection.
+ function replaceOneSelection(doc, i, range, options) {
+ var ranges = doc.sel.ranges.slice(0);
+ ranges[i] = range;
+ setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);
+ }
+
+ // Reset the selection to a single range.
+ function setSimpleSelection(doc, anchor, head, options) {
+ setSelection(doc, simpleSelection(anchor, head), options);
+ }
+
+ // Give beforeSelectionChange handlers a change to influence a
+ // selection update.
+ function filterSelectionChange(doc, sel) {
+ var obj = {
+ ranges: sel.ranges,
+ update: function(ranges) {
+ this.ranges = [];
+ for (var i = 0; i < ranges.length; i++)
+ this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
+ clipPos(doc, ranges[i].head));
+ }
+ };
+ signal(doc, "beforeSelectionChange", doc, obj);
+ if (doc.cm) signal(doc.cm, "beforeSelectionChange", doc.cm, obj);
+ if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);
+ else return sel;
+ }
+
+ function setSelectionReplaceHistory(doc, sel, options) {
+ var done = doc.history.done, last = lst(done);
+ if (last && last.ranges) {
+ done[done.length - 1] = sel;
+ setSelectionNoUndo(doc, sel, options);
+ } else {
+ setSelection(doc, sel, options);
+ }
+ }
+
+ // Set a new selection.
+ function setSelection(doc, sel, options) {
+ setSelectionNoUndo(doc, sel, options);
+ addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);
+ }
+
+ function setSelectionNoUndo(doc, sel, options) {
+ if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
+ sel = filterSelectionChange(doc, sel);
+
+ var bias = cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1;
+ setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));
+
+ if (!(options && options.scroll === false) && doc.cm)
+ ensureCursorVisible(doc.cm);
+ }
+
+ function setSelectionInner(doc, sel) {
+ if (sel.equals(doc.sel)) return;
+
+ doc.sel = sel;
+
+ if (doc.cm)
+ doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged =
+ doc.cm.curOp.cursorActivity = true;
+ signalLater(doc, "cursorActivity", doc);
+ }
+
+ // Verify that the selection does not partially select any atomic
+ // marked ranges.
+ function reCheckSelection(doc) {
+ setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll);
+ }
+
+ // Return a selection that does not partially select any atomic
+ // ranges.
+ function skipAtomicInSelection(doc, sel, bias, mayClear) {
+ var out;
+ for (var i = 0; i < sel.ranges.length; i++) {
+ var range = sel.ranges[i];
+ var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);
+ var newHead = skipAtomic(doc, range.head, bias, mayClear);
+ if (out || newAnchor != range.anchor || newHead != range.head) {
+ if (!out) out = sel.ranges.slice(0, i);
+ out[i] = new Range(newAnchor, newHead);
+ }
+ }
+ return out ? normalizeSelection(out, sel.primIndex) : sel;
+ }
+
+ // Ensure a given position is not inside an atomic range.
+ function skipAtomic(doc, pos, bias, mayClear) {
+ var flipped = false, curPos = pos;
+ var dir = bias || 1;
+ doc.cantEdit = false;
+ search: for (;;) {
+ var line = getLine(doc, curPos.line);
+ if (line.markedSpans) {
+ for (var i = 0; i < line.markedSpans.length; ++i) {
+ var sp = line.markedSpans[i], m = sp.marker;
+ if ((sp.from == null || (m.inclusiveLeft ? sp.from <= curPos.ch : sp.from < curPos.ch)) &&
+ (sp.to == null || (m.inclusiveRight ? sp.to >= curPos.ch : sp.to > curPos.ch))) {
+ if (mayClear) {
+ signal(m, "beforeCursorEnter");
+ if (m.explicitlyCleared) {
+ if (!line.markedSpans) break;
+ else {--i; continue;}
+ }
+ }
+ if (!m.atomic) continue;
+ var newPos = m.find(dir < 0 ? -1 : 1);
+ if (cmp(newPos, curPos) == 0) {
+ newPos.ch += dir;
+ if (newPos.ch < 0) {
+ if (newPos.line > doc.first) newPos = clipPos(doc, Pos(newPos.line - 1));
+ else newPos = null;
+ } else if (newPos.ch > line.text.length) {
+ if (newPos.line < doc.first + doc.size - 1) newPos = Pos(newPos.line + 1, 0);
+ else newPos = null;
+ }
+ if (!newPos) {
+ if (flipped) {
+ // Driven in a corner -- no valid cursor position found at all
+ // -- try again *with* clearing, if we didn't already
+ if (!mayClear) return skipAtomic(doc, pos, bias, true);
+ // Otherwise, turn off editing until further notice, and return the start of the doc
+ doc.cantEdit = true;
+ return Pos(doc.first, 0);
+ }
+ flipped = true; newPos = pos; dir = -dir;
+ }
+ }
+ curPos = newPos;
+ continue search;
+ }
+ }
+ }
+ return curPos;
+ }
+ }
+
+ // SELECTION DRAWING
+
+ // Redraw the selection and/or cursor
+ function updateSelection(cm) {
+ var display = cm.display, doc = cm.doc;
+ var curFragment = document.createDocumentFragment();
+ var selFragment = document.createDocumentFragment();
+
+ for (var i = 0; i < doc.sel.ranges.length; i++) {
+ var range = doc.sel.ranges[i];
+ var collapsed = range.empty();
+ if (collapsed || cm.options.showCursorWhenSelecting)
+ updateSelectionCursor(cm, range, curFragment);
+ if (!collapsed)
+ updateSelectionRange(cm, range, selFragment);
+ }
+
+ // Move the hidden textarea near the cursor to prevent scrolling artifacts
+ if (cm.options.moveInputWithCursor) {
+ var headPos = cursorCoords(cm, doc.sel.primary().head, "div");
+ var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();
+ var top = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
+ headPos.top + lineOff.top - wrapOff.top));
+ var left = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
+ headPos.left + lineOff.left - wrapOff.left));
+ display.inputDiv.style.top = top + "px";
+ display.inputDiv.style.left = left + "px";
+ }
+
+ removeChildrenAndAdd(display.cursorDiv, curFragment);
+ removeChildrenAndAdd(display.selectionDiv, selFragment);
+ }
+
+ // Draws a cursor for the given range
+ function updateSelectionCursor(cm, range, output) {
+ var pos = cursorCoords(cm, range.head, "div");
+
+ var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
+ cursor.style.left = pos.left + "px";
+ cursor.style.top = pos.top + "px";
+ cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
+
+ if (pos.other) {
+ // Secondary cursor, shown when on a 'jump' in bi-directional text
+ var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
+ otherCursor.style.display = "";
+ otherCursor.style.left = pos.other.left + "px";
+ otherCursor.style.top = pos.other.top + "px";
+ otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
+ }
+ }
+
+ // Draws the given range as a highlighted selection
+ function updateSelectionRange(cm, range, output) {
+ var display = cm.display, doc = cm.doc;
+ var fragment = document.createDocumentFragment();
+ var padding = paddingH(cm.display), leftSide = padding.left, rightSide = display.lineSpace.offsetWidth - padding.right;
+
+ function add(left, top, width, bottom) {
+ if (top < 0) top = 0;
+ fragment.appendChild(elt("div", null, "CodeMirror-selected", "position: absolute; left: " + left +
+ "px; top: " + top + "px; width: " + (width == null ? rightSide - left : width) +
+ "px; height: " + (bottom - top) + "px"));
+ }
+
+ function drawForLine(line, fromArg, toArg) {
+ var lineObj = getLine(doc, line);
+ var lineLen = lineObj.text.length;
+ var start, end;
+ function coords(ch, bias) {
+ return charCoords(cm, Pos(line, ch), "div", lineObj, bias);
+ }
+
+ iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {
+ var leftPos = coords(from, "left"), rightPos, left, right;
+ if (from == to) {
+ rightPos = leftPos;
+ left = right = leftPos.left;
+ } else {
+ rightPos = coords(to - 1, "right");
+ if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }
+ left = leftPos.left;
+ right = rightPos.right;
+ }
+ if (fromArg == null && from == 0) left = leftSide;
+ if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part
+ add(left, leftPos.top, null, leftPos.bottom);
+ left = leftSide;
+ if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);
+ }
+ if (toArg == null && to == lineLen) right = rightSide;
+ if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)
+ start = leftPos;
+ if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)
+ end = rightPos;
+ if (left < leftSide + 1) left = leftSide;
+ add(left, rightPos.top, right - left, rightPos.bottom);
+ });
+ return {start: start, end: end};
+ }
+
+ var sFrom = range.from(), sTo = range.to();
+ if (sFrom.line == sTo.line) {
+ drawForLine(sFrom.line, sFrom.ch, sTo.ch);
+ } else {
+ var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);
+ var singleVLine = visualLine(fromLine) == visualLine(toLine);
+ var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;
+ var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;
+ if (singleVLine) {
+ if (leftEnd.top < rightStart.top - 2) {
+ add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);
+ add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);
+ } else {
+ add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);
+ }
+ }
+ if (leftEnd.bottom < rightStart.top)
+ add(leftSide, leftEnd.bottom, null, rightStart.top);
+ }
+
+ output.appendChild(fragment);
+ }
+
+ // Cursor-blinking
+ function restartBlink(cm) {
+ if (!cm.state.focused) return;
+ var display = cm.display;
+ clearInterval(display.blinker);
+ var on = true;
+ display.cursorDiv.style.visibility = "";
+ if (cm.options.cursorBlinkRate > 0)
+ display.blinker = setInterval(function() {
+ display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden";
+ }, cm.options.cursorBlinkRate);
+ }
+
+ // HIGHLIGHT WORKER
+
+ function startWorker(cm, time) {
+ if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo)
+ cm.state.highlight.set(time, bind(highlightWorker, cm));
+ }
+
+ function highlightWorker(cm) {
+ var doc = cm.doc;
+ if (doc.frontier < doc.first) doc.frontier = doc.first;
+ if (doc.frontier >= cm.display.viewTo) return;
+ var end = +new Date + cm.options.workTime;
+ var state = copyState(doc.mode, getStateBefore(cm, doc.frontier));
+
+ runInOp(cm, function() {
+ doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function(line) {
+ if (doc.frontier >= cm.display.viewFrom) { // Visible
+ var oldStyles = line.styles;
+ line.styles = highlightLine(cm, line, state, true);
+ var ischange = !oldStyles || oldStyles.length != line.styles.length;
+ for (var i = 0; !ischange && i < oldStyles.length; ++i) ischange = oldStyles[i] != line.styles[i];
+ if (ischange) regLineChange(cm, doc.frontier, "text");
+ line.stateAfter = copyState(doc.mode, state);
+ } else {
+ processLine(cm, line.text, state);
+ line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null;
+ }
+ ++doc.frontier;
+ if (+new Date > end) {
+ startWorker(cm, cm.options.workDelay);
+ return true;
+ }
+ });
+ });
+ }
+
+ // Finds the line to start with when starting a parse. Tries to
+ // find a line with a stateAfter, so that it can start with a
+ // valid state. If that fails, it returns the line with the
+ // smallest indentation, which tends to need the least context to
+ // parse correctly.
+ function findStartLine(cm, n, precise) {
+ var minindent, minline, doc = cm.doc;
+ var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
+ for (var search = n; search > lim; --search) {
+ if (search <= doc.first) return doc.first;
+ var line = getLine(doc, search - 1);
+ if (line.stateAfter && (!precise || search <= doc.frontier)) return search;
+ var indented = countColumn(line.text, null, cm.options.tabSize);
+ if (minline == null || minindent > indented) {
+ minline = search - 1;
+ minindent = indented;
+ }
+ }
+ return minline;
+ }
+
+ function getStateBefore(cm, n, precise) {
+ var doc = cm.doc, display = cm.display;
+ if (!doc.mode.startState) return true;
+ var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter;
+ if (!state) state = startState(doc.mode);
+ else state = copyState(doc.mode, state);
+ doc.iter(pos, n, function(line) {
+ processLine(cm, line.text, state);
+ var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo;
+ line.stateAfter = save ? copyState(doc.mode, state) : null;
+ ++pos;
+ });
+ if (precise) doc.frontier = pos;
+ return state;
+ }
+
+ // POSITION MEASUREMENT
+
+ function paddingTop(display) {return display.lineSpace.offsetTop;}
+ function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight;}
+ function paddingH(display) {
+ if (display.cachedPaddingH) return display.cachedPaddingH;
+ var e = removeChildrenAndAdd(display.measure, elt("pre", "x"));
+ var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;
+ return display.cachedPaddingH = {left: parseInt(style.paddingLeft),
+ right: parseInt(style.paddingRight)};
+ }
+
+ // Ensure the lineView.wrapping.heights array is populated. This is
+ // an array of bottom offsets for the lines that make up a drawn
+ // line. When lineWrapping is on, there might be more than one
+ // height.
+ function ensureLineHeights(cm, lineView, rect) {
+ var wrapping = cm.options.lineWrapping;
+ var curWidth = wrapping && cm.display.scroller.clientWidth;
+ if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
+ var heights = lineView.measure.heights = [];
+ if (wrapping) {
+ lineView.measure.width = curWidth;
+ var rects = lineView.text.firstChild.getClientRects();
+ for (var i = 0; i < rects.length - 1; i++) {
+ var cur = rects[i], next = rects[i + 1];
+ if (Math.abs(cur.bottom - next.bottom) > 2)
+ heights.push((cur.bottom + next.top) / 2 - rect.top);
+ }
+ }
+ heights.push(rect.bottom - rect.top);
+ }
+ }
+
+ // Find a line map (mapping character offsets to text nodes) and a
+ // measurement cache for the given line number. (A line view might
+ // contain multiple lines when collapsed ranges are present.)
+ function mapFromLineView(lineView, line, lineN) {
+ if (lineView.line == line)
+ return {map: lineView.measure.map, cache: lineView.measure.cache};
+ for (var i = 0; i < lineView.rest.length; i++)
+ if (lineView.rest[i] == line)
+ return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};
+ for (var i = 0; i < lineView.rest.length; i++)
+ if (lineNo(lineView.rest[i]) > lineN)
+ return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};
+ }
+
+ // Render a line into the hidden node display.externalMeasured. Used
+ // when measurement is needed for a line that's not in the viewport.
+ function updateExternalMeasurement(cm, line) {
+ line = visualLine(line);
+ var lineN = lineNo(line);
+ var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);
+ view.lineN = lineN;
+ var built = view.built = buildLineContent(cm, view);
+ view.text = built.pre;
+ removeChildrenAndAdd(cm.display.lineMeasure, built.pre);
+ return view;
+ }
+
+ // Get a {top, bottom, left, right} box (in line-local coordinates)
+ // for a given character.
+ function measureChar(cm, line, ch, bias) {
+ return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias);
+ }
+
+ // Find a line view that corresponds to the given line number.
+ function findViewForLine(cm, lineN) {
+ if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
+ return cm.display.view[findViewIndex(cm, lineN)];
+ var ext = cm.display.externalMeasured;
+ if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
+ return ext;
+ }
+
+ // Measurement can be split in two steps, the set-up work that
+ // applies to the whole line, and the measurement of the actual
+ // character. Functions like coordsChar, that need to do a lot of
+ // measurements in a row, can thus ensure that the set-up work is
+ // only done once.
+ function prepareMeasureForLine(cm, line) {
+ var lineN = lineNo(line);
+ var view = findViewForLine(cm, lineN);
+ if (view && !view.text)
+ view = null;
+ else if (view && view.changes)
+ updateLineForChanges(cm, view, lineN, getDimensions(cm));
+ if (!view)
+ view = updateExternalMeasurement(cm, line);
+
+ var info = mapFromLineView(view, line, lineN);
+ return {
+ line: line, view: view, rect: null,
+ map: info.map, cache: info.cache, before: info.before,
+ hasHeights: false
+ };
+ }
+
+ // Given a prepared measurement object, measures the position of an
+ // actual character (or fetches it from the cache).
+ function measureCharPrepared(cm, prepared, ch, bias) {
+ if (prepared.before) ch = -1;
+ var key = ch + (bias || ""), found;
+ if (prepared.cache.hasOwnProperty(key)) {
+ found = prepared.cache[key];
+ } else {
+ if (!prepared.rect)
+ prepared.rect = prepared.view.text.getBoundingClientRect();
+ if (!prepared.hasHeights) {
+ ensureLineHeights(cm, prepared.view, prepared.rect);
+ prepared.hasHeights = true;
+ }
+ found = measureCharInner(cm, prepared, ch, bias);
+ if (!found.bogus) prepared.cache[key] = found;
+ }
+ return {left: found.left, right: found.right, top: found.top, bottom: found.bottom};
+ }
+
+ var nullRect = {left: 0, right: 0, top: 0, bottom: 0};
+
+ function measureCharInner(cm, prepared, ch, bias) {
+ var map = prepared.map;
+
+ var node, start, end, collapse;
+ // First, search the line map for the text node corresponding to,
+ // or closest to, the target character.
+ for (var i = 0; i < map.length; i += 3) {
+ var mStart = map[i], mEnd = map[i + 1];
+ if (ch < mStart) {
+ start = 0; end = 1;
+ collapse = "left";
+ } else if (ch < mEnd) {
+ start = ch - mStart;
+ end = start + 1;
+ } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {
+ end = mEnd - mStart;
+ start = end - 1;
+ if (ch >= mEnd) collapse = "right";
+ }
+ if (start != null) {
+ node = map[i + 2];
+ if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
+ collapse = bias;
+ if (bias == "left" && start == 0)
+ while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {
+ node = map[(i -= 3) + 2];
+ collapse = "left";
+ }
+ if (bias == "right" && start == mEnd - mStart)
+ while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {
+ node = map[(i += 3) + 2];
+ collapse = "right";
+ }
+ break;
+ }
+ }
+
+ var rect;
+ if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
+ while (start && isExtendingChar(prepared.line.text.charAt(mStart + start))) --start;
+ while (mStart + end < mEnd && isExtendingChar(prepared.line.text.charAt(mStart + end))) ++end;
+ if (ie_upto8 && start == 0 && end == mEnd - mStart) {
+ rect = node.parentNode.getBoundingClientRect();
+ } else if (ie && cm.options.lineWrapping) {
+ var rects = range(node, start, end).getClientRects();
+ if (rects.length)
+ rect = rects[bias == "right" ? rects.length - 1 : 0];
+ else
+ rect = nullRect;
+ } else {
+ rect = range(node, start, end).getBoundingClientRect();
+ }
+ } else { // If it is a widget, simply get the box for the whole widget.
+ if (start > 0) collapse = bias = "right";
+ var rects;
+ if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
+ rect = rects[bias == "right" ? rects.length - 1 : 0];
+ else
+ rect = node.getBoundingClientRect();
+ }
+ if (ie_upto8 && !start && (!rect || !rect.left && !rect.right)) {
+ var rSpan = node.parentNode.getClientRects()[0];
+ if (rSpan)
+ rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom};
+ else
+ rect = nullRect;
+ }
+
+ var top, bot = (rect.bottom + rect.top) / 2 - prepared.rect.top;
+ var heights = prepared.view.measure.heights;
+ for (var i = 0; i < heights.length - 1; i++)
+ if (bot < heights[i]) break;
+ top = i ? heights[i - 1] : 0; bot = heights[i];
+ var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
+ right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
+ top: top, bottom: bot};
+ if (!rect.left && !rect.right) result.bogus = true;
+ return result;
+ }
+
+ function clearLineMeasurementCacheFor(lineView) {
+ if (lineView.measure) {
+ lineView.measure.cache = {};
+ lineView.measure.heights = null;
+ if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)
+ lineView.measure.caches[i] = {};
+ }
+ }
+
+ function clearLineMeasurementCache(cm) {
+ cm.display.externalMeasure = null;
+ removeChildren(cm.display.lineMeasure);
+ for (var i = 0; i < cm.display.view.length; i++)
+ clearLineMeasurementCacheFor(cm.display.view[i]);
+ }
+
+ function clearCaches(cm) {
+ clearLineMeasurementCache(cm);
+ cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;
+ if (!cm.options.lineWrapping) cm.display.maxLineChanged = true;
+ cm.display.lineNumChars = null;
+ }
+
+ function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft; }
+ function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop; }
+
+ // Converts a {top, bottom, left, right} box from line-local
+ // coordinates into another coordinate system. Context may be one of
+ // "line", "div" (display.lineDiv), "local"/null (editor), or "page".
+ function intoCoordSystem(cm, lineObj, rect, context) {
+ if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {
+ var size = widgetHeight(lineObj.widgets[i]);
+ rect.top += size; rect.bottom += size;
+ }
+ if (context == "line") return rect;
+ if (!context) context = "local";
+ var yOff = heightAtLine(lineObj);
+ if (context == "local") yOff += paddingTop(cm.display);
+ else yOff -= cm.display.viewOffset;
+ if (context == "page" || context == "window") {
+ var lOff = cm.display.lineSpace.getBoundingClientRect();
+ yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
+ var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
+ rect.left += xOff; rect.right += xOff;
+ }
+ rect.top += yOff; rect.bottom += yOff;
+ return rect;
+ }
+
+ // Coverts a box from "div" coords to another coordinate system.
+ // Context may be "window", "page", "div", or "local"/null.
+ function fromCoordSystem(cm, coords, context) {
+ if (context == "div") return coords;
+ var left = coords.left, top = coords.top;
+ // First move into "page" coordinate system
+ if (context == "page") {
+ left -= pageScrollX();
+ top -= pageScrollY();
+ } else if (context == "local" || !context) {
+ var localBox = cm.display.sizer.getBoundingClientRect();
+ left += localBox.left;
+ top += localBox.top;
+ }
+
+ var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();
+ return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};
+ }
+
+ function charCoords(cm, pos, context, lineObj, bias) {
+ if (!lineObj) lineObj = getLine(cm.doc, pos.line);
+ return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context);
+ }
+
+ // Returns a box for a given cursor position, which may have an
+ // 'other' property containing the position of the secondary cursor
+ // on a bidi boundary.
+ function cursorCoords(cm, pos, context, lineObj, preparedMeasure) {
+ lineObj = lineObj || getLine(cm.doc, pos.line);
+ if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);
+ function get(ch, right) {
+ var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left");
+ if (right) m.left = m.right; else m.right = m.left;
+ return intoCoordSystem(cm, lineObj, m, context);
+ }
+ function getBidi(ch, partPos) {
+ var part = order[partPos], right = part.level % 2;
+ if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {
+ part = order[--partPos];
+ ch = bidiRight(part) - (part.level % 2 ? 0 : 1);
+ right = true;
+ } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {
+ part = order[++partPos];
+ ch = bidiLeft(part) - part.level % 2;
+ right = false;
+ }
+ if (right && ch == part.to && ch > part.from) return get(ch - 1);
+ return get(ch, right);
+ }
+ var order = getOrder(lineObj), ch = pos.ch;
+ if (!order) return get(ch);
+ var partPos = getBidiPartAt(order, ch);
+ var val = getBidi(ch, partPos);
+ if (bidiOther != null) val.other = getBidi(ch, bidiOther);
+ return val;
+ }
+
+ // Used to cheaply estimate the coordinates for a position. Used for
+ // intermediate scroll updates.
+ function estimateCoords(cm, pos) {
+ var left = 0, pos = clipPos(cm.doc, pos);
+ if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;
+ var lineObj = getLine(cm.doc, pos.line);
+ var top = heightAtLine(lineObj) + paddingTop(cm.display);
+ return {left: left, right: left, top: top, bottom: top + lineObj.height};
+ }
+
+ // Positions returned by coordsChar contain some extra information.
+ // xRel is the relative x position of the input coordinates compared
+ // to the found position (so xRel > 0 means the coordinates are to
+ // the right of the character position, for example). When outside
+ // is true, that means the coordinates lie outside the line's
+ // vertical range.
+ function PosWithInfo(line, ch, outside, xRel) {
+ var pos = Pos(line, ch);
+ pos.xRel = xRel;
+ if (outside) pos.outside = true;
+ return pos;
+ }
+
+ // Compute the character position closest to the given coordinates.
+ // Input must be lineSpace-local ("div" coordinate system).
+ function coordsChar(cm, x, y) {
+ var doc = cm.doc;
+ y += cm.display.viewOffset;
+ if (y < 0) return PosWithInfo(doc.first, 0, true, -1);
+ var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
+ if (lineN > last)
+ return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);
+ if (x < 0) x = 0;
+
+ var lineObj = getLine(doc, lineN);
+ for (;;) {
+ var found = coordsCharInner(cm, lineObj, lineN, x, y);
+ var merged = collapsedSpanAtEnd(lineObj);
+ var mergedPos = merged && merged.find(0, true);
+ if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))
+ lineN = lineNo(lineObj = mergedPos.to.line);
+ else
+ return found;
+ }
+ }
+
+ function coordsCharInner(cm, lineObj, lineNo, x, y) {
+ var innerOff = y - heightAtLine(lineObj);
+ var wrongLine = false, adjust = 2 * cm.display.wrapper.clientWidth;
+ var preparedMeasure = prepareMeasureForLine(cm, lineObj);
+
+ function getX(ch) {
+ var sp = cursorCoords(cm, Pos(lineNo, ch), "line", lineObj, preparedMeasure);
+ wrongLine = true;
+ if (innerOff > sp.bottom) return sp.left - adjust;
+ else if (innerOff < sp.top) return sp.left + adjust;
+ else wrongLine = false;
+ return sp.left;
+ }
+
+ var bidi = getOrder(lineObj), dist = lineObj.text.length;
+ var from = lineLeft(lineObj), to = lineRight(lineObj);
+ var fromX = getX(from), fromOutside = wrongLine, toX = getX(to), toOutside = wrongLine;
+
+ if (x > toX) return PosWithInfo(lineNo, to, toOutside, 1);
+ // Do a binary search between these bounds.
+ for (;;) {
+ if (bidi ? to == from || to == moveVisually(lineObj, from, 1) : to - from <= 1) {
+ var ch = x < fromX || x - fromX <= toX - x ? from : to;
+ var xDiff = x - (ch == from ? fromX : toX);
+ while (isExtendingChar(lineObj.text.charAt(ch))) ++ch;
+ var pos = PosWithInfo(lineNo, ch, ch == from ? fromOutside : toOutside,
+ xDiff < -1 ? -1 : xDiff > 1 ? 1 : 0);
+ return pos;
+ }
+ var step = Math.ceil(dist / 2), middle = from + step;
+ if (bidi) {
+ middle = from;
+ for (var i = 0; i < step; ++i) middle = moveVisually(lineObj, middle, 1);
+ }
+ var middleX = getX(middle);
+ if (middleX > x) {to = middle; toX = middleX; if (toOutside = wrongLine) toX += 1000; dist = step;}
+ else {from = middle; fromX = middleX; fromOutside = wrongLine; dist -= step;}
+ }
+ }
+
+ var measureText;
+ // Compute the default text height.
+ function textHeight(display) {
+ if (display.cachedTextHeight != null) return display.cachedTextHeight;
+ if (measureText == null) {
+ measureText = elt("pre");
+ // Measure a bunch of lines, for browsers that compute
+ // fractional heights.
+ for (var i = 0; i < 49; ++i) {
+ measureText.appendChild(document.createTextNode("x"));
+ measureText.appendChild(elt("br"));
+ }
+ measureText.appendChild(document.createTextNode("x"));
+ }
+ removeChildrenAndAdd(display.measure, measureText);
+ var height = measureText.offsetHeight / 50;
+ if (height > 3) display.cachedTextHeight = height;
+ removeChildren(display.measure);
+ return height || 1;
+ }
+
+ // Compute the default character width.
+ function charWidth(display) {
+ if (display.cachedCharWidth != null) return display.cachedCharWidth;
+ var anchor = elt("span", "xxxxxxxxxx");
+ var pre = elt("pre", [anchor]);
+ removeChildrenAndAdd(display.measure, pre);
+ var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
+ if (width > 2) display.cachedCharWidth = width;
+ return width || 10;
+ }
+
+ // OPERATIONS
+
+ // Operations are used to wrap a series of changes to the editor
+ // state in such a way that each change won't have to update the
+ // cursor and display (which would be awkward, slow, and
+ // error-prone). Instead, display updates are batched and then all
+ // combined and executed at once.
+
+ var nextOpId = 0;
+ // Start a new operation.
+ function startOperation(cm) {
+ cm.curOp = {
+ viewChanged: false, // Flag that indicates that lines might need to be redrawn
+ startHeight: cm.doc.height, // Used to detect need to update scrollbar
+ forceUpdate: false, // Used to force a redraw
+ updateInput: null, // Whether to reset the input textarea
+ typing: false, // Whether this reset should be careful to leave existing text (for compositing)
+ changeObjs: null, // Accumulated changes, for firing change events
+ cursorActivity: false, // Whether to fire a cursorActivity event
+ selectionChanged: false, // Whether the selection needs to be redrawn
+ updateMaxLine: false, // Set when the widest line needs to be determined anew
+ scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
+ scrollToPos: null, // Used to scroll to a specific position
+ id: ++nextOpId // Unique ID
+ };
+ if (!delayedCallbackDepth++) delayedCallbacks = [];
+ }
+
+ // Finish an operation, updating the display and signalling delayed events
+ function endOperation(cm) {
+ var op = cm.curOp, doc = cm.doc, display = cm.display;
+ cm.curOp = null;
+
+ if (op.updateMaxLine) findMaxLine(cm);
+
+ // If it looks like an update might be needed, call updateDisplay
+ if (op.viewChanged || op.forceUpdate || op.scrollTop != null ||
+ op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
+ op.scrollToPos.to.line >= display.viewTo) ||
+ display.maxLineChanged && cm.options.lineWrapping) {
+ var updated = updateDisplay(cm, {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);
+ if (cm.display.scroller.offsetHeight) cm.doc.scrollTop = cm.display.scroller.scrollTop;
+ }
+ // If no update was run, but the selection changed, redraw that.
+ if (!updated && op.selectionChanged) updateSelection(cm);
+ if (!updated && op.startHeight != cm.doc.height) updateScrollbars(cm);
+
+ // Propagate the scroll position to the actual DOM scroller
+ if (op.scrollTop != null && display.scroller.scrollTop != op.scrollTop) {
+ var top = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop));
+ display.scroller.scrollTop = display.scrollbarV.scrollTop = doc.scrollTop = top;
+ }
+ if (op.scrollLeft != null && display.scroller.scrollLeft != op.scrollLeft) {
+ var left = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft));
+ display.scroller.scrollLeft = display.scrollbarH.scrollLeft = doc.scrollLeft = left;
+ alignHorizontally(cm);
+ }
+ // If we need to scroll a specific position into view, do so.
+ if (op.scrollToPos) {
+ var coords = scrollPosIntoView(cm, clipPos(cm.doc, op.scrollToPos.from),
+ clipPos(cm.doc, op.scrollToPos.to), op.scrollToPos.margin);
+ if (op.scrollToPos.isCursor && cm.state.focused) maybeScrollWindow(cm, coords);
+ }
+
+ if (op.selectionChanged) restartBlink(cm);
+
+ if (cm.state.focused && op.updateInput)
+ resetInput(cm, op.typing);
+
+ // Fire events for markers that are hidden/unidden by editing or
+ // undoing
+ var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;
+ if (hidden) for (var i = 0; i < hidden.length; ++i)
+ if (!hidden[i].lines.length) signal(hidden[i], "hide");
+ if (unhidden) for (var i = 0; i < unhidden.length; ++i)
+ if (unhidden[i].lines.length) signal(unhidden[i], "unhide");
+
+ var delayed;
+ if (!--delayedCallbackDepth) {
+ delayed = delayedCallbacks;
+ delayedCallbacks = null;
+ }
+ // Fire change events, and delayed event handlers
+ if (op.changeObjs) {
+ for (var i = 0; i < op.changeObjs.length; i++)
+ signal(cm, "change", cm, op.changeObjs[i]);
+ signal(cm, "changes", cm, op.changeObjs);
+ }
+ if (op.cursorActivity) signal(cm, "cursorActivity", cm);
+ if (delayed) for (var i = 0; i < delayed.length; ++i) delayed[i]();
+ }
+
+ // Run the given function in an operation
+ function runInOp(cm, f) {
+ if (cm.curOp) return f();
+ startOperation(cm);
+ try { return f(); }
+ finally { endOperation(cm); }
+ }
+ // Wraps a function in an operation. Returns the wrapped function.
+ function operation(cm, f) {
+ return function() {
+ if (cm.curOp) return f.apply(cm, arguments);
+ startOperation(cm);
+ try { return f.apply(cm, arguments); }
+ finally { endOperation(cm); }
+ };
+ }
+ // Used to add methods to editor and doc instances, wrapping them in
+ // operations.
+ function methodOp(f) {
+ return function() {
+ if (this.curOp) return f.apply(this, arguments);
+ startOperation(this);
+ try { return f.apply(this, arguments); }
+ finally { endOperation(this); }
+ };
+ }
+ function docMethodOp(f) {
+ return function() {
+ var cm = this.cm;
+ if (!cm || cm.curOp) return f.apply(this, arguments);
+ startOperation(cm);
+ try { return f.apply(this, arguments); }
+ finally { endOperation(cm); }
+ };
+ }
+
+ // VIEW TRACKING
+
+ // These objects are used to represent the visible (currently drawn)
+ // part of the document. A LineView may correspond to multiple
+ // logical lines, if those are connected by collapsed ranges.
+ function LineView(doc, line, lineN) {
+ // The starting line
+ this.line = line;
+ // Continuing lines, if any
+ this.rest = visualLineContinued(line);
+ // Number of logical lines in this visual line
+ this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;
+ this.node = this.text = null;
+ this.hidden = lineIsHidden(doc, line);
+ }
+
+ // Create a range of LineView objects for the given lines.
+ function buildViewArray(cm, from, to) {
+ var array = [], nextPos;
+ for (var pos = from; pos < to; pos = nextPos) {
+ var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);
+ nextPos = pos + view.size;
+ array.push(view);
+ }
+ return array;
+ }
+
+ // Updates the display.view data structure for a given change to the
+ // document. From and to are in pre-change coordinates. Lendiff is
+ // the amount of lines added or subtracted by the change. This is
+ // used for changes that span multiple lines, or change the way
+ // lines are divided into visual lines. regLineChange (below)
+ // registers single-line changes.
+ function regChange(cm, from, to, lendiff) {
+ if (from == null) from = cm.doc.first;
+ if (to == null) to = cm.doc.first + cm.doc.size;
+ if (!lendiff) lendiff = 0;
+
+ var display = cm.display;
+ if (lendiff && to < display.viewTo &&
+ (display.updateLineNumbers == null || display.updateLineNumbers > from))
+ display.updateLineNumbers = from;
+
+ cm.curOp.viewChanged = true;
+
+ if (from >= display.viewTo) { // Change after
+ if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
+ resetView(cm);
+ } else if (to <= display.viewFrom) { // Change before
+ if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
+ resetView(cm);
+ } else {
+ display.viewFrom += lendiff;
+ display.viewTo += lendiff;
+ }
+ } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
+ resetView(cm);
+ } else if (from <= display.viewFrom) { // Top overlap
+ var cut = viewCuttingPoint(cm, to, to + lendiff, 1);
+ if (cut) {
+ display.view = display.view.slice(cut.index);
+ display.viewFrom = cut.lineN;
+ display.viewTo += lendiff;
+ } else {
+ resetView(cm);
+ }
+ } else if (to >= display.viewTo) { // Bottom overlap
+ var cut = viewCuttingPoint(cm, from, from, -1);
+ if (cut) {
+ display.view = display.view.slice(0, cut.index);
+ display.viewTo = cut.lineN;
+ } else {
+ resetView(cm);
+ }
+ } else { // Gap in the middle
+ var cutTop = viewCuttingPoint(cm, from, from, -1);
+ var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);
+ if (cutTop && cutBot) {
+ display.view = display.view.slice(0, cutTop.index)
+ .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
+ .concat(display.view.slice(cutBot.index));
+ display.viewTo += lendiff;
+ } else {
+ resetView(cm);
+ }
+ }
+
+ var ext = display.externalMeasured;
+ if (ext) {
+ if (to < ext.lineN)
+ ext.lineN += lendiff;
+ else if (from < ext.lineN + ext.size)
+ display.externalMeasured = null;
+ }
+ }
+
+ // Register a change to a single line. Type must be one of "text",
+ // "gutter", "class", "widget"
+ function regLineChange(cm, line, type) {
+ cm.curOp.viewChanged = true;
+ var display = cm.display, ext = cm.display.externalMeasured;
+ if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
+ display.externalMeasured = null;
+
+ if (line < display.viewFrom || line >= display.viewTo) return;
+ var lineView = display.view[findViewIndex(cm, line)];
+ if (lineView.node == null) return;
+ var arr = lineView.changes || (lineView.changes = []);
+ if (indexOf(arr, type) == -1) arr.push(type);
+ }
+
+ // Clear the view.
+ function resetView(cm) {
+ cm.display.viewFrom = cm.display.viewTo = cm.doc.first;
+ cm.display.view = [];
+ cm.display.viewOffset = 0;
+ }
+
+ // Find the view element corresponding to a given line. Return null
+ // when the line isn't visible.
+ function findViewIndex(cm, n) {
+ if (n >= cm.display.viewTo) return null;
+ n -= cm.display.viewFrom;
+ if (n < 0) return null;
+ var view = cm.display.view;
+ for (var i = 0; i < view.length; i++) {
+ n -= view[i].size;
+ if (n < 0) return i;
+ }
+ }
+
+ function viewCuttingPoint(cm, oldN, newN, dir) {
+ var index = findViewIndex(cm, oldN), diff, view = cm.display.view;
+ if (!sawCollapsedSpans) return {index: index, lineN: newN};
+ for (var i = 0, n = cm.display.viewFrom; i < index; i++)
+ n += view[i].size;
+ if (n != oldN) {
+ if (dir > 0) {
+ if (index == view.length - 1) return null;
+ diff = (n + view[index].size) - oldN;
+ index++;
+ } else {
+ diff = n - oldN;
+ }
+ oldN += diff; newN += diff;
+ }
+ while (visualLineNo(cm.doc, newN) != newN) {
+ if (index == (dir < 0 ? 0 : view.length - 1)) return null;
+ newN += dir * view[index - (dir < 0 ? 1 : 0)].size;
+ index += dir;
+ }
+ return {index: index, lineN: newN};
+ }
+
+ // Force the view to cover a given range, adding empty view element
+ // or clipping off existing ones as needed.
+ function adjustView(cm, from, to) {
+ var display = cm.display, view = display.view;
+ if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
+ display.view = buildViewArray(cm, from, to);
+ display.viewFrom = from;
+ } else {
+ if (display.viewFrom > from)
+ display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);
+ else if (display.viewFrom < from)
+ display.view = display.view.slice(findViewIndex(cm, from));
+ display.viewFrom = from;
+ if (display.viewTo < to)
+ display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));
+ else if (display.viewTo > to)
+ display.view = display.view.slice(0, findViewIndex(cm, to));
+ }
+ display.viewTo = to;
+ }
+
+ // Count the number of lines in the view whose DOM representation is
+ // out of date (or nonexistent).
+ function countDirtyView(cm) {
+ var view = cm.display.view, dirty = 0;
+ for (var i = 0; i < view.length; i++) {
+ var lineView = view[i];
+ if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty;
+ }
+ return dirty;
+ }
+
+ // INPUT HANDLING
+
+ // Poll for input changes, using the normal rate of polling. This
+ // runs as long as the editor is focused.
+ function slowPoll(cm) {
+ if (cm.display.pollingFast) return;
+ cm.display.poll.set(cm.options.pollInterval, function() {
+ readInput(cm);
+ if (cm.state.focused) slowPoll(cm);
+ });
+ }
+
+ // When an event has just come in that is likely to add or change
+ // something in the input textarea, we poll faster, to ensure that
+ // the change appears on the screen quickly.
+ function fastPoll(cm) {
+ var missed = false;
+ cm.display.pollingFast = true;
+ function p() {
+ var changed = readInput(cm);
+ if (!changed && !missed) {missed = true; cm.display.poll.set(60, p);}
+ else {cm.display.pollingFast = false; slowPoll(cm);}
+ }
+ cm.display.poll.set(20, p);
+ }
+
+ // Read input from the textarea, and update the document to match.
+ // When something is selected, it is present in the textarea, and
+ // selected (unless it is huge, in which case a placeholder is
+ // used). When nothing is selected, the cursor sits after previously
+ // seen text (can be empty), which is stored in prevInput (we must
+ // not reset the textarea when typing, because that breaks IME).
+ function readInput(cm) {
+ var input = cm.display.input, prevInput = cm.display.prevInput, doc = cm.doc;
+ // Since this is called a *lot*, try to bail out as cheaply as
+ // possible when it is clear that nothing happened. hasSelection
+ // will be the case when there is a lot of text in the textarea,
+ // in which case reading its value would be expensive.
+ if (!cm.state.focused || hasSelection(input) || isReadOnly(cm) || cm.options.disableInput) return false;
+ var text = input.value;
+ // If nothing changed, bail.
+ if (text == prevInput && !cm.somethingSelected()) return false;
+ // Work around nonsensical selection resetting in IE9/10
+ if (ie && !ie_upto8 && cm.display.inputHasSelection === text) {
+ resetInput(cm);
+ return false;
+ }
+
+ var withOp = !cm.curOp;
+ if (withOp) startOperation(cm);
+ cm.display.shift = false;
+
+ // Find the part of the input that is actually new
+ var same = 0, l = Math.min(prevInput.length, text.length);
+ while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) ++same;
+ var inserted = text.slice(same), textLines = splitLines(inserted);
+
+ // When pasing N lines into N selections, insert one line per selection
+ var multiPaste = cm.state.pasteIncoming && textLines.length > 1 && doc.sel.ranges.length == textLines.length;
+
+ // Normal behavior is to insert the new text into every selection
+ for (var i = doc.sel.ranges.length - 1; i >= 0; i--) {
+ var range = doc.sel.ranges[i];
+ var from = range.from(), to = range.to();
+ // Handle deletion
+ if (same < prevInput.length)
+ from = Pos(from.line, from.ch - (prevInput.length - same));
+ // Handle overwrite
+ else if (cm.state.overwrite && range.empty() && !cm.state.pasteIncoming)
+ to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length));
+ var updateInput = cm.curOp.updateInput;
+ var changeEvent = {from: from, to: to, text: multiPaste ? [textLines[i]] : textLines,
+ origin: cm.state.pasteIncoming ? "paste" : cm.state.cutIncoming ? "cut" : "+input"};
+ makeChange(cm.doc, changeEvent);
+ signalLater(cm, "inputRead", cm, changeEvent);
+ // When an 'electric' character is inserted, immediately trigger a reindent
+ if (inserted && !cm.state.pasteIncoming && cm.options.electricChars &&
+ cm.options.smartIndent && range.head.ch < 100 &&
+ (!i || doc.sel.ranges[i - 1].head.line != range.head.line)) {
+ var electric = cm.getModeAt(range.head).electricChars;
+ if (electric) for (var j = 0; j < electric.length; j++)
+ if (inserted.indexOf(electric.charAt(j)) > -1) {
+ indentLine(cm, range.head.line, "smart");
+ break;
+ }
+ }
+ }
+ ensureCursorVisible(cm);
+ cm.curOp.updateInput = updateInput;
+ cm.curOp.typing = true;
+
+ // Don't leave long text in the textarea, since it makes further polling slow
+ if (text.length > 1000 || text.indexOf("\n") > -1) input.value = cm.display.prevInput = "";
+ else cm.display.prevInput = text;
+ if (withOp) endOperation(cm);
+ cm.state.pasteIncoming = cm.state.cutIncoming = false;
+ return true;
+ }
+
+ // Reset the input to correspond to the selection (or to be empty,
+ // when not typing and nothing is selected)
+ function resetInput(cm, typing) {
+ var minimal, selected, doc = cm.doc;
+ if (cm.somethingSelected()) {
+ cm.display.prevInput = "";
+ var range = doc.sel.primary();
+ minimal = hasCopyEvent &&
+ (range.to().line - range.from().line > 100 || (selected = cm.getSelection()).length > 1000);
+ var content = minimal ? "-" : selected || cm.getSelection();
+ cm.display.input.value = content;
+ if (cm.state.focused) selectInput(cm.display.input);
+ if (ie && !ie_upto8) cm.display.inputHasSelection = content;
+ } else if (!typing) {
+ cm.display.prevInput = cm.display.input.value = "";
+ if (ie && !ie_upto8) cm.display.inputHasSelection = null;
+ }
+ cm.display.inaccurateSelection = minimal;
+ }
+
+ function focusInput(cm) {
+ if (cm.options.readOnly != "nocursor" && (!mobile || activeElt() != cm.display.input))
+ cm.display.input.focus();
+ }
+
+ function ensureFocus(cm) {
+ if (!cm.state.focused) { focusInput(cm); onFocus(cm); }
+ }
+
+ function isReadOnly(cm) {
+ return cm.options.readOnly || cm.doc.cantEdit;
+ }
+
+ // EVENT HANDLERS
+
+ // Attach the necessary event handlers when initializing the editor
+ function registerEventHandlers(cm) {
+ var d = cm.display;
+ on(d.scroller, "mousedown", operation(cm, onMouseDown));
+ // Older IE's will not fire a second mousedown for a double click
+ if (ie_upto10)
+ on(d.scroller, "dblclick", operation(cm, function(e) {
+ if (signalDOMEvent(cm, e)) return;
+ var pos = posFromMouse(cm, e);
+ if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return;
+ e_preventDefault(e);
+ var word = findWordAt(cm.doc, pos);
+ extendSelection(cm.doc, word.anchor, word.head);
+ }));
+ else
+ on(d.scroller, "dblclick", function(e) { signalDOMEvent(cm, e) || e_preventDefault(e); });
+ // Prevent normal selection in the editor (we handle our own)
+ on(d.lineSpace, "selectstart", function(e) {
+ if (!eventInWidget(d, e)) e_preventDefault(e);
+ });
+ // Some browsers fire contextmenu *after* opening the menu, at
+ // which point we can't mess with it anymore. Context menu is
+ // handled in onMouseDown for these browsers.
+ if (!captureRightClick) on(d.scroller, "contextmenu", function(e) {onContextMenu(cm, e);});
+
+ // Sync scrolling between fake scrollbars and real scrollable
+ // area, ensure viewport is updated when scrolling.
+ on(d.scroller, "scroll", function() {
+ if (d.scroller.clientHeight) {
+ setScrollTop(cm, d.scroller.scrollTop);
+ setScrollLeft(cm, d.scroller.scrollLeft, true);
+ signal(cm, "scroll", cm);
+ }
+ });
+ on(d.scrollbarV, "scroll", function() {
+ if (d.scroller.clientHeight) setScrollTop(cm, d.scrollbarV.scrollTop);
+ });
+ on(d.scrollbarH, "scroll", function() {
+ if (d.scroller.clientHeight) setScrollLeft(cm, d.scrollbarH.scrollLeft);
+ });
+
+ // Listen to wheel events in order to try and update the viewport on time.
+ on(d.scroller, "mousewheel", function(e){onScrollWheel(cm, e);});
+ on(d.scroller, "DOMMouseScroll", function(e){onScrollWheel(cm, e);});
+
+ // Prevent clicks in the scrollbars from killing focus
+ function reFocus() { if (cm.state.focused) setTimeout(bind(focusInput, cm), 0); }
+ on(d.scrollbarH, "mousedown", reFocus);
+ on(d.scrollbarV, "mousedown", reFocus);
+ // Prevent wrapper from ever scrolling
+ on(d.wrapper, "scroll", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });
+
+ // When the window resizes, we need to refresh active editors.
+ var resizeTimer;
+ function onResize() {
+ if (resizeTimer == null) resizeTimer = setTimeout(function() {
+ resizeTimer = null;
+ // Might be a text scaling operation, clear size caches.
+ d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = knownScrollbarWidth = null;
+ cm.setSize();
+ }, 100);
+ }
+ on(window, "resize", onResize);
+ // The above handler holds on to the editor and its data
+ // structures. Here we poll to unregister it when the editor is no
+ // longer in the document, so that it can be garbage-collected.
+ function unregister() {
+ if (contains(document.body, d.wrapper)) setTimeout(unregister, 5000);
+ else off(window, "resize", onResize);
+ }
+ setTimeout(unregister, 5000);
+
+ on(d.input, "keyup", operation(cm, onKeyUp));
+ on(d.input, "input", function() {
+ if (ie && !ie_upto8 && cm.display.inputHasSelection) cm.display.inputHasSelection = null;
+ fastPoll(cm);
+ });
+ on(d.input, "keydown", operation(cm, onKeyDown));
+ on(d.input, "keypress", operation(cm, onKeyPress));
+ on(d.input, "focus", bind(onFocus, cm));
+ on(d.input, "blur", bind(onBlur, cm));
+
+ function drag_(e) {
+ if (!signalDOMEvent(cm, e)) e_stop(e);
+ }
+ if (cm.options.dragDrop) {
+ on(d.scroller, "dragstart", function(e){onDragStart(cm, e);});
+ on(d.scroller, "dragenter", drag_);
+ on(d.scroller, "dragover", drag_);
+ on(d.scroller, "drop", operation(cm, onDrop));
+ }
+ on(d.scroller, "paste", function(e) {
+ if (eventInWidget(d, e)) return;
+ cm.state.pasteIncoming = true;
+ focusInput(cm);
+ fastPoll(cm);
+ });
+ on(d.input, "paste", function() {
+ cm.state.pasteIncoming = true;
+ fastPoll(cm);
+ });
+
+ function prepareCopy(e) {
+ if (d.inaccurateSelection) {
+ d.prevInput = "";
+ d.inaccurateSelection = false;
+ d.input.value = cm.getSelection();
+ selectInput(d.input);
+ }
+ if (e.type == "cut") cm.state.cutIncoming = true;
+ }
+ on(d.input, "cut", prepareCopy);
+ on(d.input, "copy", prepareCopy);
+
+ // Needed to handle Tab key in KHTML
+ if (khtml) on(d.sizer, "mouseup", function() {
+ if (activeElt() == d.input) d.input.blur();
+ focusInput(cm);
+ });
+ }
+
+ // MOUSE EVENTS
+
+ // Return true when the given mouse event happened in a widget
+ function eventInWidget(display, e) {
+ for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
+ if (!n || n.ignoreEvents || n.parentNode == display.sizer && n != display.mover) return true;
+ }
+ }
+
+ // Given a mouse event, find the corresponding position. If liberal
+ // is false, it checks whether a gutter or scrollbar was clicked,
+ // and returns null if it was. forRect is used by rectangular
+ // selections, and tries to estimate a character position even for
+ // coordinates beyond the right of the text.
+ function posFromMouse(cm, e, liberal, forRect) {
+ var display = cm.display;
+ if (!liberal) {
+ var target = e_target(e);
+ if (target == display.scrollbarH || target == display.scrollbarV ||
+ target == display.scrollbarFiller || target == display.gutterFiller) return null;
+ }
+ var x, y, space = display.lineSpace.getBoundingClientRect();
+ // Fails unpredictably on IE[67] when mouse is dragged around quickly.
+ try { x = e.clientX - space.left; y = e.clientY - space.top; }
+ catch (e) { return null; }
+ var coords = coordsChar(cm, x, y), line;
+ if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
+ var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;
+ coords = Pos(coords.line, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff);
+ }
+ return coords;
+ }
+
+ // A mouse down can be a single click, double click, triple click,
+ // start of selection drag, start of text drag, new cursor
+ // (ctrl-click), rectangle drag (alt-drag), or xwin
+ // middle-click-paste. Or it might be a click on something we should
+ // not interfere with, such as a scrollbar or widget.
+ function onMouseDown(e) {
+ if (signalDOMEvent(this, e)) return;
+ var cm = this, display = cm.display;
+ display.shift = e.shiftKey;
+
+ if (eventInWidget(display, e)) {
+ if (!webkit) {
+ // Briefly turn off draggability, to allow widgets to do
+ // normal dragging things.
+ display.scroller.draggable = false;
+ setTimeout(function(){display.scroller.draggable = true;}, 100);
+ }
+ return;
+ }
+ if (clickInGutter(cm, e)) return;
+ var start = posFromMouse(cm, e);
+ window.focus();
+
+ switch (e_button(e)) {
+ case 1:
+ if (start)
+ leftButtonDown(cm, e, start);
+ else if (e_target(e) == display.scroller)
+ e_preventDefault(e);
+ break;
+ case 2:
+ if (webkit) cm.state.lastMiddleDown = +new Date;
+ if (start) extendSelection(cm.doc, start);
+ setTimeout(bind(focusInput, cm), 20);
+ e_preventDefault(e);
+ break;
+ case 3:
+ if (captureRightClick) onContextMenu(cm, e);
+ break;
+ }
+ }
+
+ var lastClick, lastDoubleClick;
+ function leftButtonDown(cm, e, start) {
+ setTimeout(bind(ensureFocus, cm), 0);
+
+ var now = +new Date, type;
+ if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) {
+ type = "triple";
+ } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) {
+ type = "double";
+ lastDoubleClick = {time: now, pos: start};
+ } else {
+ type = "single";
+ lastClick = {time: now, pos: start};
+ }
+
+ var sel = cm.doc.sel, addNew = mac ? e.metaKey : e.ctrlKey;
+ if (cm.options.dragDrop && dragAndDrop && !addNew && !isReadOnly(cm) &&
+ type == "single" && sel.contains(start) > -1 && sel.somethingSelected())
+ leftButtonStartDrag(cm, e, start);
+ else
+ leftButtonSelect(cm, e, start, type, addNew);
+ }
+
+ // Start a text drag. When it ends, see if any dragging actually
+ // happen, and treat as a click if it didn't.
+ function leftButtonStartDrag(cm, e, start) {
+ var display = cm.display;
+ var dragEnd = operation(cm, function(e2) {
+ if (webkit) display.scroller.draggable = false;
+ cm.state.draggingText = false;
+ off(document, "mouseup", dragEnd);
+ off(display.scroller, "drop", dragEnd);
+ if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
+ e_preventDefault(e2);
+ extendSelection(cm.doc, start);
+ focusInput(cm);
+ // Work around unexplainable focus problem in IE9 (#2127)
+ if (ie_upto10 && !ie_upto8)
+ setTimeout(function() {document.body.focus(); focusInput(cm);}, 20);
+ }
+ });
+ // Let the drag handler handle this.
+ if (webkit) display.scroller.draggable = true;
+ cm.state.draggingText = dragEnd;
+ // IE's approach to draggable
+ if (display.scroller.dragDrop) display.scroller.dragDrop();
+ on(document, "mouseup", dragEnd);
+ on(display.scroller, "drop", dragEnd);
+ }
+
+ // Normal selection, as opposed to text dragging.
+ function leftButtonSelect(cm, e, start, type, addNew) {
+ var display = cm.display, doc = cm.doc;
+ e_preventDefault(e);
+
+ var ourRange, ourIndex, startSel = doc.sel;
+ if (addNew) {
+ ourIndex = doc.sel.contains(start);
+ if (ourIndex > -1)
+ ourRange = doc.sel.ranges[ourIndex];
+ else
+ ourRange = new Range(start, start);
+ } else {
+ ourRange = doc.sel.primary();
+ }
+
+ if (e.altKey) {
+ type = "rect";
+ if (!addNew) ourRange = new Range(start, start);
+ start = posFromMouse(cm, e, true, true);
+ ourIndex = -1;
+ } else if (type == "double") {
+ var word = findWordAt(doc, start);
+ if (cm.display.shift || doc.extend)
+ ourRange = extendRange(doc, ourRange, word.anchor, word.head);
+ else
+ ourRange = word;
+ } else if (type == "triple") {
+ var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));
+ if (cm.display.shift || doc.extend)
+ ourRange = extendRange(doc, ourRange, line.anchor, line.head);
+ else
+ ourRange = line;
+ } else {
+ ourRange = extendRange(doc, ourRange, start);
+ }
+
+ if (!addNew) {
+ ourIndex = 0;
+ setSelection(doc, new Selection([ourRange], 0), sel_mouse);
+ } else if (ourIndex > -1) {
+ replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);
+ } else {
+ ourIndex = doc.sel.ranges.length;
+ setSelection(doc, normalizeSelection(doc.sel.ranges.concat([ourRange]), ourIndex),
+ {scroll: false, origin: "*mouse"});
+ }
+
+ var lastPos = start;
+ function extendTo(pos) {
+ if (cmp(lastPos, pos) == 0) return;
+ lastPos = pos;
+
+ if (type == "rect") {
+ var ranges = [], tabSize = cm.options.tabSize;
+ var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);
+ var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);
+ var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);
+ for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
+ line <= end; line++) {
+ var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);
+ if (left == right)
+ ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));
+ else if (text.length > leftPos)
+ ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));
+ }
+ if (!ranges.length) ranges.push(new Range(start, start));
+ setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex), sel_mouse);
+ } else {
+ var oldRange = ourRange;
+ var anchor = oldRange.anchor, head = pos;
+ if (type != "single") {
+ if (type == "double")
+ var range = findWordAt(doc, pos);
+ else
+ var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));
+ if (cmp(range.anchor, anchor) > 0) {
+ head = range.head;
+ anchor = minPos(oldRange.from(), range.anchor);
+ } else {
+ head = range.anchor;
+ anchor = maxPos(oldRange.to(), range.head);
+ }
+ }
+ var ranges = startSel.ranges.slice(0);
+ ranges[ourIndex] = new Range(clipPos(doc, anchor), head);
+ setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);
+ }
+ }
+
+ var editorSize = display.wrapper.getBoundingClientRect();
+ // Used to ensure timeout re-tries don't fire when another extend
+ // happened in the meantime (clearTimeout isn't reliable -- at
+ // least on Chrome, the timeouts still happen even when cleared,
+ // if the clear happens after their scheduled firing time).
+ var counter = 0;
+
+ function extend(e) {
+ var curCount = ++counter;
+ var cur = posFromMouse(cm, e, true, type == "rect");
+ if (!cur) return;
+ if (cmp(cur, lastPos) != 0) {
+ ensureFocus(cm);
+ extendTo(cur);
+ var visible = visibleLines(display, doc);
+ if (cur.line >= visible.to || cur.line < visible.from)
+ setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);
+ } else {
+ var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;
+ if (outside) setTimeout(operation(cm, function() {
+ if (counter != curCount) return;
+ display.scroller.scrollTop += outside;
+ extend(e);
+ }), 50);
+ }
+ }
+
+ function done(e) {
+ counter = Infinity;
+ e_preventDefault(e);
+ focusInput(cm);
+ off(document, "mousemove", move);
+ off(document, "mouseup", up);
+ doc.history.lastSelOrigin = null;
+ }
+
+ var move = operation(cm, function(e) {
+ if ((ie && !ie_upto9) ? !e.buttons : !e_button(e)) done(e);
+ else extend(e);
+ });
+ var up = operation(cm, done);
+ on(document, "mousemove", move);
+ on(document, "mouseup", up);
+ }
+
+ // Determines whether an event happened in the gutter, and fires the
+ // handlers for the corresponding event.
+ function gutterEvent(cm, e, type, prevent, signalfn) {
+ try { var mX = e.clientX, mY = e.clientY; }
+ catch(e) { return false; }
+ if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;
+ if (prevent) e_preventDefault(e);
+
+ var display = cm.display;
+ var lineBox = display.lineDiv.getBoundingClientRect();
+
+ if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);
+ mY -= lineBox.top - display.viewOffset;
+
+ for (var i = 0; i < cm.options.gutters.length; ++i) {
+ var g = display.gutters.childNodes[i];
+ if (g && g.getBoundingClientRect().right >= mX) {
+ var line = lineAtHeight(cm.doc, mY);
+ var gutter = cm.options.gutters[i];
+ signalfn(cm, type, cm, line, gutter, e);
+ return e_defaultPrevented(e);
+ }
+ }
+ }
+
+ function clickInGutter(cm, e) {
+ return gutterEvent(cm, e, "gutterClick", true, signalLater);
+ }
+
+ // Kludge to work around strange IE behavior where it'll sometimes
+ // re-fire a series of drag-related events right after the drop (#1551)
+ var lastDrop = 0;
+
+ function onDrop(e) {
+ var cm = this;
+ if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
+ return;
+ e_preventDefault(e);
+ if (ie_upto10) lastDrop = +new Date;
+ var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
+ if (!pos || isReadOnly(cm)) return;
+ // Might be a file drop, in which case we simply extract the text
+ // and insert it.
+ if (files && files.length && window.FileReader && window.File) {
+ var n = files.length, text = Array(n), read = 0;
+ var loadFile = function(file, i) {
+ var reader = new FileReader;
+ reader.onload = function() {
+ text[i] = reader.result;
+ if (++read == n) {
+ pos = clipPos(cm.doc, pos);
+ var change = {from: pos, to: pos, text: splitLines(text.join("\n")), origin: "paste"};
+ makeChange(cm.doc, change);
+ setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)));
+ }
+ };
+ reader.readAsText(file);
+ };
+ for (var i = 0; i < n; ++i) loadFile(files[i], i);
+ } else { // Normal drop
+ // Don't do a replace if the drop happened inside of the selected text.
+ if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
+ cm.state.draggingText(e);
+ // Ensure the editor is re-focused
+ setTimeout(bind(focusInput, cm), 20);
+ return;
+ }
+ try {
+ var text = e.dataTransfer.getData("Text");
+ if (text) {
+ var selected = cm.state.draggingText && cm.listSelections();
+ setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
+ if (selected) for (var i = 0; i < selected.length; ++i)
+ replaceRange(cm.doc, "", selected[i].anchor, selected[i].head, "drag");
+ cm.replaceSelection(text, "around", "paste");
+ focusInput(cm);
+ }
+ }
+ catch(e){}
+ }
+ }
+
+ function onDragStart(cm, e) {
+ if (ie_upto10 && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return; }
+ if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) return;
+
+ e.dataTransfer.setData("Text", cm.getSelection());
+
+ // Use dummy image instead of default browsers image.
+ // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
+ if (e.dataTransfer.setDragImage && !safari) {
+ var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
+ img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
+ if (presto) {
+ img.width = img.height = 1;
+ cm.display.wrapper.appendChild(img);
+ // Force a relayout, or Opera won't use our image for some obscure reason
+ img._top = img.offsetTop;
+ }
+ e.dataTransfer.setDragImage(img, 0, 0);
+ if (presto) img.parentNode.removeChild(img);
+ }
+ }
+
+ // SCROLL EVENTS
+
+ // Sync the scrollable area and scrollbars, ensure the viewport
+ // covers the visible area.
+ function setScrollTop(cm, val) {
+ if (Math.abs(cm.doc.scrollTop - val) < 2) return;
+ cm.doc.scrollTop = val;
+ if (!gecko) updateDisplay(cm, {top: val});
+ if (cm.display.scroller.scrollTop != val) cm.display.scroller.scrollTop = val;
+ if (cm.display.scrollbarV.scrollTop != val) cm.display.scrollbarV.scrollTop = val;
+ if (gecko) updateDisplay(cm);
+ startWorker(cm, 100);
+ }
+ // Sync scroller and scrollbar, ensure the gutter elements are
+ // aligned.
+ function setScrollLeft(cm, val, isScroller) {
+ if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) return;
+ val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth);
+ cm.doc.scrollLeft = val;
+ alignHorizontally(cm);
+ if (cm.display.scroller.scrollLeft != val) cm.display.scroller.scrollLeft = val;
+ if (cm.display.scrollbarH.scrollLeft != val) cm.display.scrollbarH.scrollLeft = val;
+ }
+
+ // Since the delta values reported on mouse wheel events are
+ // unstandardized between browsers and even browser versions, and
+ // generally horribly unpredictable, this code starts by measuring
+ // the scroll effect that the first few mouse wheel events have,
+ // and, from that, detects the way it can convert deltas to pixel
+ // offsets afterwards.
+ //
+ // The reason we want to know the amount a wheel event will scroll
+ // is that it gives us a chance to update the display before the
+ // actual scrolling happens, reducing flickering.
+
+ var wheelSamples = 0, wheelPixelsPerUnit = null;
+ // Fill in a browser-detected starting value on browsers where we
+ // know one. These don't have to be accurate -- the result of them
+ // being wrong would just be a slight flicker on the first wheel
+ // scroll (if it is large enough).
+ if (ie) wheelPixelsPerUnit = -.53;
+ else if (gecko) wheelPixelsPerUnit = 15;
+ else if (chrome) wheelPixelsPerUnit = -.7;
+ else if (safari) wheelPixelsPerUnit = -1/3;
+
+ function onScrollWheel(cm, e) {
+ var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
+ if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) dx = e.detail;
+ if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) dy = e.detail;
+ else if (dy == null) dy = e.wheelDelta;
+
+ var display = cm.display, scroll = display.scroller;
+ // Quit if there's nothing to scroll here
+ if (!(dx && scroll.scrollWidth > scroll.clientWidth ||
+ dy && scroll.scrollHeight > scroll.clientHeight)) return;
+
+ // Webkit browsers on OS X abort momentum scrolls when the target
+ // of the scroll event is removed from the scrollable element.
+ // This hack (see related code in patchDisplay) makes sure the
+ // element is kept around.
+ if (dy && mac && webkit) {
+ outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
+ for (var i = 0; i < view.length; i++) {
+ if (view[i].node == cur) {
+ cm.display.currentWheelTarget = cur;
+ break outer;
+ }
+ }
+ }
+ }
+
+ // On some browsers, horizontal scrolling will cause redraws to
+ // happen before the gutter has been realigned, causing it to
+ // wriggle around in a most unseemly way. When we have an
+ // estimated pixels/delta value, we just handle horizontal
+ // scrolling entirely here. It'll be slightly off from native, but
+ // better than glitching out.
+ if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
+ if (dy)
+ setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight)));
+ setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)));
+ e_preventDefault(e);
+ display.wheelStartX = null; // Abort measurement, if in progress
+ return;
+ }
+
+ // 'Project' the visible viewport to cover the area that is being
+ // scrolled into view (if we know enough to estimate it).
+ if (dy && wheelPixelsPerUnit != null) {
+ var pixels = dy * wheelPixelsPerUnit;
+ var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
+ if (pixels < 0) top = Math.max(0, top + pixels - 50);
+ else bot = Math.min(cm.doc.height, bot + pixels + 50);
+ updateDisplay(cm, {top: top, bottom: bot});
+ }
+
+ if (wheelSamples < 20) {
+ if (display.wheelStartX == null) {
+ display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
+ display.wheelDX = dx; display.wheelDY = dy;
+ setTimeout(function() {
+ if (display.wheelStartX == null) return;
+ var movedX = scroll.scrollLeft - display.wheelStartX;
+ var movedY = scroll.scrollTop - display.wheelStartY;
+ var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
+ (movedX && display.wheelDX && movedX / display.wheelDX);
+ display.wheelStartX = display.wheelStartY = null;
+ if (!sample) return;
+ wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
+ ++wheelSamples;
+ }, 200);
+ } else {
+ display.wheelDX += dx; display.wheelDY += dy;
+ }
+ }
+ }
+
+ // KEY EVENTS
+
+ // Run a handler that was bound to a key.
+ function doHandleBinding(cm, bound, dropShift) {
+ if (typeof bound == "string") {
+ bound = commands[bound];
+ if (!bound) return false;
+ }
+ // Ensure previous input has been read, so that the handler sees a
+ // consistent view of the document
+ if (cm.display.pollingFast && readInput(cm)) cm.display.pollingFast = false;
+ var prevShift = cm.display.shift, done = false;
+ try {
+ if (isReadOnly(cm)) cm.state.suppressEdits = true;
+ if (dropShift) cm.display.shift = false;
+ done = bound(cm) != Pass;
+ } finally {
+ cm.display.shift = prevShift;
+ cm.state.suppressEdits = false;
+ }
+ return done;
+ }
+
+ // Collect the currently active keymaps.
+ function allKeyMaps(cm) {
+ var maps = cm.state.keyMaps.slice(0);
+ if (cm.options.extraKeys) maps.push(cm.options.extraKeys);
+ maps.push(cm.options.keyMap);
+ return maps;
+ }
+
+ var maybeTransition;
+ // Handle a key from the keydown event.
+ function handleKeyBinding(cm, e) {
+ // Handle automatic keymap transitions
+ var startMap = getKeyMap(cm.options.keyMap), next = startMap.auto;
+ clearTimeout(maybeTransition);
+ if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() {
+ if (getKeyMap(cm.options.keyMap) == startMap) {
+ cm.options.keyMap = (next.call ? next.call(null, cm) : next);
+ keyMapChanged(cm);
+ }
+ }, 50);
+
+ var name = keyName(e, true), handled = false;
+ if (!name) return false;
+ var keymaps = allKeyMaps(cm);
+
+ if (e.shiftKey) {
+ // First try to resolve full name (including 'Shift-'). Failing
+ // that, see if there is a cursor-motion command (starting with
+ // 'go') bound to the keyname without 'Shift-'.
+ handled = lookupKey("Shift-" + name, keymaps, function(b) {return doHandleBinding(cm, b, true);})
+ || lookupKey(name, keymaps, function(b) {
+ if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
+ return doHandleBinding(cm, b);
+ });
+ } else {
+ handled = lookupKey(name, keymaps, function(b) { return doHandleBinding(cm, b); });
+ }
+
+ if (handled) {
+ e_preventDefault(e);
+ restartBlink(cm);
+ signalLater(cm, "keyHandled", cm, name, e);
+ }
+ return handled;
+ }
+
+ // Handle a key from the keypress event
+ function handleCharBinding(cm, e, ch) {
+ var handled = lookupKey("'" + ch + "'", allKeyMaps(cm),
+ function(b) { return doHandleBinding(cm, b, true); });
+ if (handled) {
+ e_preventDefault(e);
+ restartBlink(cm);
+ signalLater(cm, "keyHandled", cm, "'" + ch + "'", e);
+ }
+ return handled;
+ }
+
+ var lastStoppedKey = null;
+ function onKeyDown(e) {
+ var cm = this;
+ ensureFocus(cm);
+ if (signalDOMEvent(cm, e)) return;
+ // IE does strange things with escape.
+ if (ie_upto10 && e.keyCode == 27) e.returnValue = false;
+ var code = e.keyCode;
+ cm.display.shift = code == 16 || e.shiftKey;
+ var handled = handleKeyBinding(cm, e);
+ if (presto) {
+ lastStoppedKey = handled ? code : null;
+ // Opera has no cut event... we try to at least catch the key combo
+ if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
+ cm.replaceSelection("", null, "cut");
+ }
+ }
+
+ function onKeyUp(e) {
+ if (signalDOMEvent(this, e)) return;
+ if (e.keyCode == 16) this.doc.sel.shift = false;
+ }
+
+ function onKeyPress(e) {
+ var cm = this;
+ if (signalDOMEvent(cm, e)) return;
+ var keyCode = e.keyCode, charCode = e.charCode;
+ if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}
+ if (((presto && (!e.which || e.which < 10)) || khtml) && handleKeyBinding(cm, e)) return;
+ var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
+ if (handleCharBinding(cm, e, ch)) return;
+ if (ie && !ie_upto8) cm.display.inputHasSelection = null;
+ fastPoll(cm);
+ }
+
+ // FOCUS/BLUR EVENTS
+
+ function onFocus(cm) {
+ if (cm.options.readOnly == "nocursor") return;
+ if (!cm.state.focused) {
+ signal(cm, "focus", cm);
+ cm.state.focused = true;
+ if (cm.display.wrapper.className.search(/\bCodeMirror-focused\b/) == -1)
+ cm.display.wrapper.className += " CodeMirror-focused";
+ if (!cm.curOp) {
+ resetInput(cm);
+ if (webkit) setTimeout(bind(resetInput, cm, true), 0); // Issue #1730
+ }
+ }
+ slowPoll(cm);
+ restartBlink(cm);
+ }
+ function onBlur(cm) {
+ if (cm.state.focused) {
+ signal(cm, "blur", cm);
+ cm.state.focused = false;
+ cm.display.wrapper.className = cm.display.wrapper.className.replace(" CodeMirror-focused", "");
+ }
+ clearInterval(cm.display.blinker);
+ setTimeout(function() {if (!cm.state.focused) cm.display.shift = false;}, 150);
+ }
+
+ // CONTEXT MENU HANDLING
+
+ var detectingSelectAll;
+ // To make the context menu work, we need to briefly unhide the
+ // textarea (making it as unobtrusive as possible) to let the
+ // right-click take effect on it.
+ function onContextMenu(cm, e) {
+ if (signalDOMEvent(cm, e, "contextmenu")) return;
+ var display = cm.display;
+ if (eventInWidget(display, e) || contextMenuInGutter(cm, e)) return;
+
+ var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
+ if (!pos || presto) return; // Opera is difficult.
+
+ // Reset the current text selection only if the click is done outside of the selection
+ // and 'resetSelectionOnContextMenu' option is true.
+ var reset = cm.options.resetSelectionOnContextMenu;
+ if (reset && cm.doc.sel.contains(pos) == -1)
+ operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll);
+
+ var oldCSS = display.input.style.cssText;
+ display.inputDiv.style.position = "absolute";
+ display.input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) +
+ "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: " +
+ (ie ? "rgba(255, 255, 255, .05)" : "transparent") +
+ "; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
+ focusInput(cm);
+ resetInput(cm);
+ // Adds "Select all" to context menu in FF
+ if (!cm.somethingSelected()) display.input.value = display.prevInput = " ";
+
+ // Select-all will be greyed out if there's nothing to select, so
+ // this adds a zero-width space so that we can later check whether
+ // it got selected.
+ function prepareSelectAllHack() {
+ if (display.input.selectionStart != null) {
+ var extval = display.input.value = "\u200b" + (cm.somethingSelected() ? display.input.value : "");
+ display.prevInput = "\u200b";
+ display.input.selectionStart = 1; display.input.selectionEnd = extval.length;
+ }
+ }
+ function rehide() {
+ display.inputDiv.style.position = "relative";
+ display.input.style.cssText = oldCSS;
+ if (ie_upto8) display.scrollbarV.scrollTop = display.scroller.scrollTop = scrollPos;
+ slowPoll(cm);
+
+ // Try to detect the user choosing select-all
+ if (display.input.selectionStart != null) {
+ if (!ie || ie_upto8) prepareSelectAllHack();
+ clearTimeout(detectingSelectAll);
+ var i = 0, poll = function(){
+ if (display.prevInput == "\u200b" && display.input.selectionStart == 0)
+ operation(cm, commands.selectAll)(cm);
+ else if (i++ < 10) detectingSelectAll = setTimeout(poll, 500);
+ else resetInput(cm);
+ };
+ detectingSelectAll = setTimeout(poll, 200);
+ }
+ }
+
+ if (ie && !ie_upto8) prepareSelectAllHack();
+ if (captureRightClick) {
+ e_stop(e);
+ var mouseup = function() {
+ off(window, "mouseup", mouseup);
+ setTimeout(rehide, 20);
+ };
+ on(window, "mouseup", mouseup);
+ } else {
+ setTimeout(rehide, 50);
+ }
+ }
+
+ function contextMenuInGutter(cm, e) {
+ if (!hasHandler(cm, "gutterContextMenu")) return false;
+ return gutterEvent(cm, e, "gutterContextMenu", false, signal);
+ }
+
+ // UPDATING
+
+ // Compute the position of the end of a change (its 'to' property
+ // refers to the pre-change end).
+ var changeEnd = CodeMirror.changeEnd = function(change) {
+ if (!change.text) return change.to;
+ return Pos(change.from.line + change.text.length - 1,
+ lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0));
+ };
+
+ // Adjust a position to refer to the post-change position of the
+ // same text, or the end of the change if the change covers it.
+ function adjustForChange(pos, change) {
+ if (cmp(pos, change.from) < 0) return pos;
+ if (cmp(pos, change.to) <= 0) return changeEnd(change);
+
+ var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
+ if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;
+ return Pos(line, ch);
+ }
+
+ function computeSelAfterChange(doc, change) {
+ var out = [];
+ for (var i = 0; i < doc.sel.ranges.length; i++) {
+ var range = doc.sel.ranges[i];
+ out.push(new Range(adjustForChange(range.anchor, change),
+ adjustForChange(range.head, change)));
+ }
+ return normalizeSelection(out, doc.sel.primIndex);
+ }
+
+ function offsetPos(pos, old, nw) {
+ if (pos.line == old.line)
+ return Pos(nw.line, pos.ch - old.ch + nw.ch);
+ else
+ return Pos(nw.line + (pos.line - old.line), pos.ch);
+ }
+
+ // Used by replaceSelections to allow moving the selection to the
+ // start or around the replaced test. Hint may be "start" or "around".
+ function computeReplacedSel(doc, changes, hint) {
+ var out = [];
+ var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;
+ for (var i = 0; i < changes.length; i++) {
+ var change = changes[i];
+ var from = offsetPos(change.from, oldPrev, newPrev);
+ var to = offsetPos(changeEnd(change), oldPrev, newPrev);
+ oldPrev = change.to;
+ newPrev = to;
+ if (hint == "around") {
+ var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;
+ out[i] = new Range(inv ? to : from, inv ? from : to);
+ } else {
+ out[i] = new Range(from, from);
+ }
+ }
+ return new Selection(out, doc.sel.primIndex);
+ }
+
+ // Allow "beforeChange" event handlers to influence a change
+ function filterChange(doc, change, update) {
+ var obj = {
+ canceled: false,
+ from: change.from,
+ to: change.to,
+ text: change.text,
+ origin: change.origin,
+ cancel: function() { this.canceled = true; }
+ };
+ if (update) obj.update = function(from, to, text, origin) {
+ if (from) this.from = clipPos(doc, from);
+ if (to) this.to = clipPos(doc, to);
+ if (text) this.text = text;
+ if (origin !== undefined) this.origin = origin;
+ };
+ signal(doc, "beforeChange", doc, obj);
+ if (doc.cm) signal(doc.cm, "beforeChange", doc.cm, obj);
+
+ if (obj.canceled) return null;
+ return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};
+ }
+
+ // Apply a change to a document, and add it to the document's
+ // history, and propagating it to all linked documents.
+ function makeChange(doc, change, ignoreReadOnly) {
+ if (doc.cm) {
+ if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);
+ if (doc.cm.state.suppressEdits) return;
+ }
+
+ if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
+ change = filterChange(doc, change, true);
+ if (!change) return;
+ }
+
+ // Possibly split or suppress the update based on the presence
+ // of read-only spans in its range.
+ var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
+ if (split) {
+ for (var i = split.length - 1; i >= 0; --i)
+ makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text});
+ } else {
+ makeChangeInner(doc, change);
+ }
+ }
+
+ function makeChangeInner(doc, change) {
+ if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) return;
+ var selAfter = computeSelAfterChange(doc, change);
+ addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);
+
+ makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));
+ var rebased = [];
+
+ linkedDocs(doc, function(doc, sharedHist) {
+ if (!sharedHist && indexOf(rebased, doc.history) == -1) {
+ rebaseHist(doc.history, change);
+ rebased.push(doc.history);
+ }
+ makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));
+ });
+ }
+
+ // Revert a change stored in a document's history.
+ function makeChangeFromHistory(doc, type, allowSelectionOnly) {
+ if (doc.cm && doc.cm.state.suppressEdits) return;
+
+ var hist = doc.history, event, selAfter = doc.sel;
+ var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done;
+
+ // Verify that there is a useable event (so that ctrl-z won't
+ // needlessly clear selection events)
+ for (var i = 0; i < source.length; i++) {
+ event = source[i];
+ if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
+ break;
+ }
+ if (i == source.length) return;
+ hist.lastOrigin = hist.lastSelOrigin = null;
+
+ for (;;) {
+ event = source.pop();
+ if (event.ranges) {
+ pushSelectionToHistory(event, dest);
+ if (allowSelectionOnly && !event.equals(doc.sel)) {
+ setSelection(doc, event, {clearRedo: false});
+ return;
+ }
+ selAfter = event;
+ }
+ else break;
+ }
+
+ // Build up a reverse change object to add to the opposite history
+ // stack (redo when undoing, and vice versa).
+ var antiChanges = [];
+ pushSelectionToHistory(selAfter, dest);
+ dest.push({changes: antiChanges, generation: hist.generation});
+ hist.generation = event.generation || ++hist.maxGeneration;
+
+ var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange");
+
+ for (var i = event.changes.length - 1; i >= 0; --i) {
+ var change = event.changes[i];
+ change.origin = type;
+ if (filter && !filterChange(doc, change, false)) {
+ source.length = 0;
+ return;
+ }
+
+ antiChanges.push(historyChangeFromChange(doc, change));
+
+ var after = i ? computeSelAfterChange(doc, change, null) : lst(source);
+ makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));
+ if (doc.cm) ensureCursorVisible(doc.cm);
+ var rebased = [];
+
+ // Propagate to the linked documents
+ linkedDocs(doc, function(doc, sharedHist) {
+ if (!sharedHist && indexOf(rebased, doc.history) == -1) {
+ rebaseHist(doc.history, change);
+ rebased.push(doc.history);
+ }
+ makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));
+ });
+ }
+ }
+
+ // Sub-views need their line numbers shifted when text is added
+ // above or below them in the parent document.
+ function shiftDoc(doc, distance) {
+ doc.first += distance;
+ doc.sel = new Selection(map(doc.sel.ranges, function(range) {
+ return new Range(Pos(range.anchor.line + distance, range.anchor.ch),
+ Pos(range.head.line + distance, range.head.ch));
+ }), doc.sel.primIndex);
+ if (doc.cm) regChange(doc.cm, doc.first, doc.first - distance, distance);
+ }
+
+ // More lower-level change function, handling only a single document
+ // (not linked ones).
+ function makeChangeSingleDoc(doc, change, selAfter, spans) {
+ if (doc.cm && !doc.cm.curOp)
+ return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);
+
+ if (change.to.line < doc.first) {
+ shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
+ return;
+ }
+ if (change.from.line > doc.lastLine()) return;
+
+ // Clip the change to the size of this doc
+ if (change.from.line < doc.first) {
+ var shift = change.text.length - 1 - (doc.first - change.from.line);
+ shiftDoc(doc, shift);
+ change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
+ text: [lst(change.text)], origin: change.origin};
+ }
+ var last = doc.lastLine();
+ if (change.to.line > last) {
+ change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
+ text: [change.text[0]], origin: change.origin};
+ }
+
+ change.removed = getBetween(doc, change.from, change.to);
+
+ if (!selAfter) selAfter = computeSelAfterChange(doc, change, null);
+ if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans);
+ else updateDoc(doc, change, spans);
+ setSelectionNoUndo(doc, selAfter, sel_dontScroll);
+ }
+
+ // Handle the interaction of a change to a document with the editor
+ // that this document is part of.
+ function makeChangeSingleDocInEditor(cm, change, spans) {
+ var doc = cm.doc, display = cm.display, from = change.from, to = change.to;
+
+ var recomputeMaxLength = false, checkWidthStart = from.line;
+ if (!cm.options.lineWrapping) {
+ checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));
+ doc.iter(checkWidthStart, to.line + 1, function(line) {
+ if (line == display.maxLine) {
+ recomputeMaxLength = true;
+ return true;
+ }
+ });
+ }
+
+ if (doc.sel.contains(change.from, change.to) > -1)
+ cm.curOp.cursorActivity = true;
+
+ updateDoc(doc, change, spans, estimateHeight(cm));
+
+ if (!cm.options.lineWrapping) {
+ doc.iter(checkWidthStart, from.line + change.text.length, function(line) {
+ var len = lineLength(line);
+ if (len > display.maxLineLength) {
+ display.maxLine = line;
+ display.maxLineLength = len;
+ display.maxLineChanged = true;
+ recomputeMaxLength = false;
+ }
+ });
+ if (recomputeMaxLength) cm.curOp.updateMaxLine = true;
+ }
+
+ // Adjust frontier, schedule worker
+ doc.frontier = Math.min(doc.frontier, from.line);
+ startWorker(cm, 400);
+
+ var lendiff = change.text.length - (to.line - from.line) - 1;
+ // Remember that these lines changed, for updating the display
+ if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
+ regLineChange(cm, from.line, "text");
+ else
+ regChange(cm, from.line, to.line + 1, lendiff);
+
+ if (hasHandler(cm, "change") || hasHandler(cm, "changes"))
+ (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push({
+ from: from, to: to,
+ text: change.text,
+ removed: change.removed,
+ origin: change.origin
+ });
+ }
+
+ function replaceRange(doc, code, from, to, origin) {
+ if (!to) to = from;
+ if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp; }
+ if (typeof code == "string") code = splitLines(code);
+ makeChange(doc, {from: from, to: to, text: code, origin: origin});
+ }
+
+ // SCROLLING THINGS INTO VIEW
+
+ // If an editor sits on the top or bottom of the window, partially
+ // scrolled out of view, this ensures that the cursor is visible.
+ function maybeScrollWindow(cm, coords) {
+ var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
+ if (coords.top + box.top < 0) doScroll = true;
+ else if (coords.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) doScroll = false;
+ if (doScroll != null && !phantom) {
+ var scrollNode = elt("div", "\u200b", null, "position: absolute; top: " +
+ (coords.top - display.viewOffset - paddingTop(cm.display)) + "px; height: " +
+ (coords.bottom - coords.top + scrollerCutOff) + "px; left: " +
+ coords.left + "px; width: 2px;");
+ cm.display.lineSpace.appendChild(scrollNode);
+ scrollNode.scrollIntoView(doScroll);
+ cm.display.lineSpace.removeChild(scrollNode);
+ }
+ }
+
+ // Scroll a given position into view (immediately), verifying that
+ // it actually became visible (as line heights are accurately
+ // measured, the position of something may 'drift' during drawing).
+ function scrollPosIntoView(cm, pos, end, margin) {
+ if (margin == null) margin = 0;
+ for (;;) {
+ var changed = false, coords = cursorCoords(cm, pos);
+ var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);
+ var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left),
+ Math.min(coords.top, endCoords.top) - margin,
+ Math.max(coords.left, endCoords.left),
+ Math.max(coords.bottom, endCoords.bottom) + margin);
+ var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;
+ if (scrollPos.scrollTop != null) {
+ setScrollTop(cm, scrollPos.scrollTop);
+ if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;
+ }
+ if (scrollPos.scrollLeft != null) {
+ setScrollLeft(cm, scrollPos.scrollLeft);
+ if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true;
+ }
+ if (!changed) return coords;
+ }
+ }
+
+ // Scroll a given set of coordinates into view (immediately).
+ function scrollIntoView(cm, x1, y1, x2, y2) {
+ var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);
+ if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);
+ if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);
+ }
+
+ // Calculate a new scroll position needed to scroll the given
+ // rectangle into view. Returns an object with scrollTop and
+ // scrollLeft properties. When these are undefined, the
+ // vertical/horizontal position does not need to be adjusted.
+ function calculateScrollPos(cm, x1, y1, x2, y2) {
+ var display = cm.display, snapMargin = textHeight(cm.display);
+ if (y1 < 0) y1 = 0;
+ var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;
+ var screen = display.scroller.clientHeight - scrollerCutOff, result = {};
+ var docBottom = cm.doc.height + paddingVert(display);
+ var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin;
+ if (y1 < screentop) {
+ result.scrollTop = atTop ? 0 : y1;
+ } else if (y2 > screentop + screen) {
+ var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen);
+ if (newTop != screentop) result.scrollTop = newTop;
+ }
+
+ var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;
+ var screenw = display.scroller.clientWidth - scrollerCutOff;
+ x1 += display.gutters.offsetWidth; x2 += display.gutters.offsetWidth;
+ var gutterw = display.gutters.offsetWidth;
+ var atLeft = x1 < gutterw + 10;
+ if (x1 < screenleft + gutterw || atLeft) {
+ if (atLeft) x1 = 0;
+ result.scrollLeft = Math.max(0, x1 - 10 - gutterw);
+ } else if (x2 > screenw + screenleft - 3) {
+ result.scrollLeft = x2 + 10 - screenw;
+ }
+ return result;
+ }
+
+ // Store a relative adjustment to the scroll position in the current
+ // operation (to be applied when the operation finishes).
+ function addToScrollPos(cm, left, top) {
+ if (left != null || top != null) resolveScrollToPos(cm);
+ if (left != null)
+ cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;
+ if (top != null)
+ cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;
+ }
+
+ // Make sure that at the end of the operation the current cursor is
+ // shown.
+ function ensureCursorVisible(cm) {
+ resolveScrollToPos(cm);
+ var cur = cm.getCursor(), from = cur, to = cur;
+ if (!cm.options.lineWrapping) {
+ from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;
+ to = Pos(cur.line, cur.ch + 1);
+ }
+ cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};
+ }
+
+ // When an operation has its scrollToPos property set, and another
+ // scroll action is applied before the end of the operation, this
+ // 'simulates' scrolling that position into view in a cheap way, so
+ // that the effect of intermediate scroll commands is not ignored.
+ function resolveScrollToPos(cm) {
+ var range = cm.curOp.scrollToPos;
+ if (range) {
+ cm.curOp.scrollToPos = null;
+ var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);
+ var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),
+ Math.min(from.top, to.top) - range.margin,
+ Math.max(from.right, to.right),
+ Math.max(from.bottom, to.bottom) + range.margin);
+ cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);
+ }
+ }
+
+ // API UTILITIES
+
+ // Indent the given line. The how parameter can be "smart",
+ // "add"/null, "subtract", or "prev". When aggressive is false
+ // (typically set to true for forced single-line indents), empty
+ // lines are not indented, and places where the mode returns Pass
+ // are left alone.
+ function indentLine(cm, n, how, aggressive) {
+ var doc = cm.doc, state;
+ if (how == null) how = "add";
+ if (how == "smart") {
+ // Fall back to "prev" when the mode doesn't have an indentation
+ // method.
+ if (!cm.doc.mode.indent) how = "prev";
+ else state = getStateBefore(cm, n);
+ }
+
+ var tabSize = cm.options.tabSize;
+ var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
+ if (line.stateAfter) line.stateAfter = null;
+ var curSpaceString = line.text.match(/^\s*/)[0], indentation;
+ if (!aggressive && !/\S/.test(line.text)) {
+ indentation = 0;
+ how = "not";
+ } else if (how == "smart") {
+ indentation = cm.doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
+ if (indentation == Pass) {
+ if (!aggressive) return;
+ how = "prev";
+ }
+ }
+ if (how == "prev") {
+ if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);
+ else indentation = 0;
+ } else if (how == "add") {
+ indentation = curSpace + cm.options.indentUnit;
+ } else if (how == "subtract") {
+ indentation = curSpace - cm.options.indentUnit;
+ } else if (typeof how == "number") {
+ indentation = curSpace + how;
+ }
+ indentation = Math.max(0, indentation);
+
+ var indentString = "", pos = 0;
+ if (cm.options.indentWithTabs)
+ for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";}
+ if (pos < indentation) indentString += spaceStr(indentation - pos);
+
+ if (indentString != curSpaceString) {
+ replaceRange(cm.doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input");
+ } else {
+ // Ensure that, if the cursor was in the whitespace at the start
+ // of the line, it is moved to the end of that space.
+ for (var i = 0; i < doc.sel.ranges.length; i++) {
+ var range = doc.sel.ranges[i];
+ if (range.head.line == n && range.head.ch < curSpaceString.length) {
+ var pos = Pos(n, curSpaceString.length);
+ replaceOneSelection(doc, i, new Range(pos, pos));
+ break;
+ }
+ }
+ }
+ line.stateAfter = null;
+ }
+
+ // Utility for applying a change to a line by handle or number,
+ // returning the number and optionally registering the line as
+ // changed.
+ function changeLine(cm, handle, changeType, op) {
+ var no = handle, line = handle, doc = cm.doc;
+ if (typeof handle == "number") line = getLine(doc, clipLine(doc, handle));
+ else no = lineNo(handle);
+ if (no == null) return null;
+ if (op(line, no)) regLineChange(cm, no, changeType);
+ else return null;
+ return line;
+ }
+
+ // Helper for deleting text near the selection(s), used to implement
+ // backspace, delete, and similar functionality.
+ function deleteNearSelection(cm, compute) {
+ var ranges = cm.doc.sel.ranges, kill = [];
+ // Build up a set of ranges to kill first, merging overlapping
+ // ranges.
+ for (var i = 0; i < ranges.length; i++) {
+ var toKill = compute(ranges[i]);
+ while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
+ var replaced = kill.pop();
+ if (cmp(replaced.from, toKill.from) < 0) {
+ toKill.from = replaced.from;
+ break;
+ }
+ }
+ kill.push(toKill);
+ }
+ // Next, remove those actual ranges.
+ runInOp(cm, function() {
+ for (var i = kill.length - 1; i >= 0; i--)
+ replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete");
+ ensureCursorVisible(cm);
+ });
+ }
+
+ // Used for horizontal relative motion. Dir is -1 or 1 (left or
+ // right), unit can be "char", "column" (like char, but doesn't
+ // cross line boundaries), "word" (across next word), or "group" (to
+ // the start of next group of word or non-word-non-whitespace
+ // chars). The visually param controls whether, in right-to-left
+ // text, direction 1 means to move towards the next index in the
+ // string, or towards the character to the right of the current
+ // position. The resulting position will have a hitSide=true
+ // property if it reached the end of the document.
+ function findPosH(doc, pos, dir, unit, visually) {
+ var line = pos.line, ch = pos.ch, origDir = dir;
+ var lineObj = getLine(doc, line);
+ var possible = true;
+ function findNextLine() {
+ var l = line + dir;
+ if (l < doc.first || l >= doc.first + doc.size) return (possible = false);
+ line = l;
+ return lineObj = getLine(doc, l);
+ }
+ function moveOnce(boundToLine) {
+ var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);
+ if (next == null) {
+ if (!boundToLine && findNextLine()) {
+ if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);
+ else ch = dir < 0 ? lineObj.text.length : 0;
+ } else return (possible = false);
+ } else ch = next;
+ return true;
+ }
+
+ if (unit == "char") moveOnce();
+ else if (unit == "column") moveOnce(true);
+ else if (unit == "word" || unit == "group") {
+ var sawType = null, group = unit == "group";
+ for (var first = true;; first = false) {
+ if (dir < 0 && !moveOnce(!first)) break;
+ var cur = lineObj.text.charAt(ch) || "\n";
+ var type = isWordChar(cur) ? "w"
+ : group && cur == "\n" ? "n"
+ : !group || /\s/.test(cur) ? null
+ : "p";
+ if (group && !first && !type) type = "s";
+ if (sawType && sawType != type) {
+ if (dir < 0) {dir = 1; moveOnce();}
+ break;
+ }
+
+ if (type) sawType = type;
+ if (dir > 0 && !moveOnce(!first)) break;
+ }
+ }
+ var result = skipAtomic(doc, Pos(line, ch), origDir, true);
+ if (!possible) result.hitSide = true;
+ return result;
+ }
+
+ // For relative vertical movement. Dir may be -1 or 1. Unit can be
+ // "page" or "line". The resulting position will have a hitSide=true
+ // property if it reached the end of the document.
+ function findPosV(cm, pos, dir, unit) {
+ var doc = cm.doc, x = pos.left, y;
+ if (unit == "page") {
+ var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
+ y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));
+ } else if (unit == "line") {
+ y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
+ }
+ for (;;) {
+ var target = coordsChar(cm, x, y);
+ if (!target.outside) break;
+ if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }
+ y += dir * 5;
+ }
+ return target;
+ }
+
+ // Find the word at the given position (as returned by coordsChar).
+ function findWordAt(doc, pos) {
+ var line = getLine(doc, pos.line).text;
+ var start = pos.ch, end = pos.ch;
+ if (line) {
+ if ((pos.xRel < 0 || end == line.length) && start) --start; else ++end;
+ var startChar = line.charAt(start);
+ var check = isWordChar(startChar) ? isWordChar
+ : /\s/.test(startChar) ? function(ch) {return /\s/.test(ch);}
+ : function(ch) {return !/\s/.test(ch) && !isWordChar(ch);};
+ while (start > 0 && check(line.charAt(start - 1))) --start;
+ while (end < line.length && check(line.charAt(end))) ++end;
+ }
+ return new Range(Pos(pos.line, start), Pos(pos.line, end));
+ }
+
+ // EDITOR METHODS
+
+ // The publicly visible API. Note that methodOp(f) means
+ // 'wrap f in an operation, performed on its `this` parameter'.
+
+ // This is not the complete set of editor methods. Most of the
+ // methods defined on the Doc type are also injected into
+ // CodeMirror.prototype, for backwards compatibility and
+ // convenience.
+
+ CodeMirror.prototype = {
+ constructor: CodeMirror,
+ focus: function(){window.focus(); focusInput(this); fastPoll(this);},
+
+ setOption: function(option, value) {
+ var options = this.options, old = options[option];
+ if (options[option] == value && option != "mode") return;
+ options[option] = value;
+ if (optionHandlers.hasOwnProperty(option))
+ operation(this, optionHandlers[option])(this, value, old);
+ },
+
+ getOption: function(option) {return this.options[option];},
+ getDoc: function() {return this.doc;},
+
+ addKeyMap: function(map, bottom) {
+ this.state.keyMaps[bottom ? "push" : "unshift"](map);
+ },
+ removeKeyMap: function(map) {
+ var maps = this.state.keyMaps;
+ for (var i = 0; i < maps.length; ++i)
+ if (maps[i] == map || (typeof maps[i] != "string" && maps[i].name == map)) {
+ maps.splice(i, 1);
+ return true;
+ }
+ },
+
+ addOverlay: methodOp(function(spec, options) {
+ var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);
+ if (mode.startState) throw new Error("Overlays may not be stateful.");
+ this.state.overlays.push({mode: mode, modeSpec: spec, opaque: options && options.opaque});
+ this.state.modeGen++;
+ regChange(this);
+ }),
+ removeOverlay: methodOp(function(spec) {
+ var overlays = this.state.overlays;
+ for (var i = 0; i < overlays.length; ++i) {
+ var cur = overlays[i].modeSpec;
+ if (cur == spec || typeof spec == "string" && cur.name == spec) {
+ overlays.splice(i, 1);
+ this.state.modeGen++;
+ regChange(this);
+ return;
+ }
+ }
+ }),
+
+ indentLine: methodOp(function(n, dir, aggressive) {
+ if (typeof dir != "string" && typeof dir != "number") {
+ if (dir == null) dir = this.options.smartIndent ? "smart" : "prev";
+ else dir = dir ? "add" : "subtract";
+ }
+ if (isLine(this.doc, n)) indentLine(this, n, dir, aggressive);
+ }),
+ indentSelection: methodOp(function(how) {
+ var ranges = this.doc.sel.ranges, end = -1;
+ for (var i = 0; i < ranges.length; i++) {
+ var range = ranges[i];
+ if (!range.empty()) {
+ var start = Math.max(end, range.from().line);
+ var to = range.to();
+ end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;
+ for (var j = start; j < end; ++j)
+ indentLine(this, j, how);
+ } else if (range.head.line > end) {
+ indentLine(this, range.head.line, how, true);
+ end = range.head.line;
+ if (i == this.doc.sel.primIndex) ensureCursorVisible(this);
+ }
+ }
+ }),
+
+ // Fetch the parser token for a given character. Useful for hacks
+ // that want to inspect the mode state (say, for completion).
+ getTokenAt: function(pos, precise) {
+ var doc = this.doc;
+ pos = clipPos(doc, pos);
+ var state = getStateBefore(this, pos.line, precise), mode = this.doc.mode;
+ var line = getLine(doc, pos.line);
+ var stream = new StringStream(line.text, this.options.tabSize);
+ while (stream.pos < pos.ch && !stream.eol()) {
+ stream.start = stream.pos;
+ var style = mode.token(stream, state);
+ }
+ return {start: stream.start,
+ end: stream.pos,
+ string: stream.current(),
+ type: style || null,
+ state: state};
+ },
+
+ getTokenTypeAt: function(pos) {
+ pos = clipPos(this.doc, pos);
+ var styles = getLineStyles(this, getLine(this.doc, pos.line));
+ var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;
+ if (ch == 0) return styles[2];
+ for (;;) {
+ var mid = (before + after) >> 1;
+ if ((mid ? styles[mid * 2 - 1] : 0) >= ch) after = mid;
+ else if (styles[mid * 2 + 1] < ch) before = mid + 1;
+ else return styles[mid * 2 + 2];
+ }
+ },
+
+ getModeAt: function(pos) {
+ var mode = this.doc.mode;
+ if (!mode.innerMode) return mode;
+ return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode;
+ },
+
+ getHelper: function(pos, type) {
+ return this.getHelpers(pos, type)[0];
+ },
+
+ getHelpers: function(pos, type) {
+ var found = [];
+ if (!helpers.hasOwnProperty(type)) return helpers;
+ var help = helpers[type], mode = this.getModeAt(pos);
+ if (typeof mode[type] == "string") {
+ if (help[mode[type]]) found.push(help[mode[type]]);
+ } else if (mode[type]) {
+ for (var i = 0; i < mode[type].length; i++) {
+ var val = help[mode[type][i]];
+ if (val) found.push(val);
+ }
+ } else if (mode.helperType && help[mode.helperType]) {
+ found.push(help[mode.helperType]);
+ } else if (help[mode.name]) {
+ found.push(help[mode.name]);
+ }
+ for (var i = 0; i < help._global.length; i++) {
+ var cur = help._global[i];
+ if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)
+ found.push(cur.val);
+ }
+ return found;
+ },
+
+ getStateAfter: function(line, precise) {
+ var doc = this.doc;
+ line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);
+ return getStateBefore(this, line + 1, precise);
+ },
+
+ cursorCoords: function(start, mode) {
+ var pos, range = this.doc.sel.primary();
+ if (start == null) pos = range.head;
+ else if (typeof start == "object") pos = clipPos(this.doc, start);
+ else pos = start ? range.from() : range.to();
+ return cursorCoords(this, pos, mode || "page");
+ },
+
+ charCoords: function(pos, mode) {
+ return charCoords(this, clipPos(this.doc, pos), mode || "page");
+ },
+
+ coordsChar: function(coords, mode) {
+ coords = fromCoordSystem(this, coords, mode || "page");
+ return coordsChar(this, coords.left, coords.top);
+ },
+
+ lineAtHeight: function(height, mode) {
+ height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top;
+ return lineAtHeight(this.doc, height + this.display.viewOffset);
+ },
+ heightAtLine: function(line, mode) {
+ var end = false, last = this.doc.first + this.doc.size - 1;
+ if (line < this.doc.first) line = this.doc.first;
+ else if (line > last) { line = last; end = true; }
+ var lineObj = getLine(this.doc, line);
+ return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page").top +
+ (end ? this.doc.height - heightAtLine(lineObj) : 0);
+ },
+
+ defaultTextHeight: function() { return textHeight(this.display); },
+ defaultCharWidth: function() { return charWidth(this.display); },
+
+ setGutterMarker: methodOp(function(line, gutterID, value) {
+ return changeLine(this, line, "gutter", function(line) {
+ var markers = line.gutterMarkers || (line.gutterMarkers = {});
+ markers[gutterID] = value;
+ if (!value && isEmpty(markers)) line.gutterMarkers = null;
+ return true;
+ });
+ }),
+
+ clearGutter: methodOp(function(gutterID) {
+ var cm = this, doc = cm.doc, i = doc.first;
+ doc.iter(function(line) {
+ if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
+ line.gutterMarkers[gutterID] = null;
+ regLineChange(cm, i, "gutter");
+ if (isEmpty(line.gutterMarkers)) line.gutterMarkers = null;
+ }
+ ++i;
+ });
+ }),
+
+ addLineClass: methodOp(function(handle, where, cls) {
+ return changeLine(this, handle, "class", function(line) {
+ var prop = where == "text" ? "textClass" : where == "background" ? "bgClass" : "wrapClass";
+ if (!line[prop]) line[prop] = cls;
+ else if (new RegExp("(?:^|\\s)" + cls + "(?:$|\\s)").test(line[prop])) return false;
+ else line[prop] += " " + cls;
+ return true;
+ });
+ }),
+
+ removeLineClass: methodOp(function(handle, where, cls) {
+ return changeLine(this, handle, "class", function(line) {
+ var prop = where == "text" ? "textClass" : where == "background" ? "bgClass" : "wrapClass";
+ var cur = line[prop];
+ if (!cur) return false;
+ else if (cls == null) line[prop] = null;
+ else {
+ var found = cur.match(new RegExp("(?:^|\\s+)" + cls + "(?:$|\\s+)"));
+ if (!found) return false;
+ var end = found.index + found[0].length;
+ line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null;
+ }
+ return true;
+ });
+ }),
+
+ addLineWidget: methodOp(function(handle, node, options) {
+ return addLineWidget(this, handle, node, options);
+ }),
+
+ removeLineWidget: function(widget) { widget.clear(); },
+
+ lineInfo: function(line) {
+ if (typeof line == "number") {
+ if (!isLine(this.doc, line)) return null;
+ var n = line;
+ line = getLine(this.doc, line);
+ if (!line) return null;
+ } else {
+ var n = lineNo(line);
+ if (n == null) return null;
+ }
+ return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
+ textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
+ widgets: line.widgets};
+ },
+
+ getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo};},
+
+ addWidget: function(pos, node, scroll, vert, horiz) {
+ var display = this.display;
+ pos = cursorCoords(this, clipPos(this.doc, pos));
+ var top = pos.bottom, left = pos.left;
+ node.style.position = "absolute";
+ display.sizer.appendChild(node);
+ if (vert == "over") {
+ top = pos.top;
+ } else if (vert == "above" || vert == "near") {
+ var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),
+ hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);
+ // Default to positioning above (if specified and possible); otherwise default to positioning below
+ if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)
+ top = pos.top - node.offsetHeight;
+ else if (pos.bottom + node.offsetHeight <= vspace)
+ top = pos.bottom;
+ if (left + node.offsetWidth > hspace)
+ left = hspace - node.offsetWidth;
+ }
+ node.style.top = top + "px";
+ node.style.left = node.style.right = "";
+ if (horiz == "right") {
+ left = display.sizer.clientWidth - node.offsetWidth;
+ node.style.right = "0px";
+ } else {
+ if (horiz == "left") left = 0;
+ else if (horiz == "middle") left = (display.sizer.clientWidth - node.offsetWidth) / 2;
+ node.style.left = left + "px";
+ }
+ if (scroll)
+ scrollIntoView(this, left, top, left + node.offsetWidth, top + node.offsetHeight);
+ },
+
+ triggerOnKeyDown: methodOp(onKeyDown),
+ triggerOnKeyPress: methodOp(onKeyPress),
+ triggerOnKeyUp: methodOp(onKeyUp),
+
+ execCommand: function(cmd) {
+ if (commands.hasOwnProperty(cmd))
+ return commands[cmd](this);
+ },
+
+ findPosH: function(from, amount, unit, visually) {
+ var dir = 1;
+ if (amount < 0) { dir = -1; amount = -amount; }
+ for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) {
+ cur = findPosH(this.doc, cur, dir, unit, visually);
+ if (cur.hitSide) break;
+ }
+ return cur;
+ },
+
+ moveH: methodOp(function(dir, unit) {
+ var cm = this;
+ cm.extendSelectionsBy(function(range) {
+ if (cm.display.shift || cm.doc.extend || range.empty())
+ return findPosH(cm.doc, range.head, dir, unit, cm.options.rtlMoveVisually);
+ else
+ return dir < 0 ? range.from() : range.to();
+ }, sel_move);
+ }),
+
+ deleteH: methodOp(function(dir, unit) {
+ var sel = this.doc.sel, doc = this.doc;
+ if (sel.somethingSelected())
+ doc.replaceSelection("", null, "+delete");
+ else
+ deleteNearSelection(this, function(range) {
+ var other = findPosH(doc, range.head, dir, unit, false);
+ return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other};
+ });
+ }),
+
+ findPosV: function(from, amount, unit, goalColumn) {
+ var dir = 1, x = goalColumn;
+ if (amount < 0) { dir = -1; amount = -amount; }
+ for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) {
+ var coords = cursorCoords(this, cur, "div");
+ if (x == null) x = coords.left;
+ else coords.left = x;
+ cur = findPosV(this, coords, dir, unit);
+ if (cur.hitSide) break;
+ }
+ return cur;
+ },
+
+ moveV: methodOp(function(dir, unit) {
+ var cm = this, doc = this.doc, goals = [];
+ var collapse = !cm.display.shift && !doc.extend && doc.sel.somethingSelected();
+ doc.extendSelectionsBy(function(range) {
+ if (collapse)
+ return dir < 0 ? range.from() : range.to();
+ var headPos = cursorCoords(cm, range.head, "div");
+ if (range.goalColumn != null) headPos.left = range.goalColumn;
+ goals.push(headPos.left);
+ var pos = findPosV(cm, headPos, dir, unit);
+ if (unit == "page" && range == doc.sel.primary())
+ addToScrollPos(cm, null, charCoords(cm, pos, "div").top - headPos.top);
+ return pos;
+ }, sel_move);
+ if (goals.length) for (var i = 0; i < doc.sel.ranges.length; i++)
+ doc.sel.ranges[i].goalColumn = goals[i];
+ }),
+
+ toggleOverwrite: function(value) {
+ if (value != null && value == this.state.overwrite) return;
+ if (this.state.overwrite = !this.state.overwrite)
+ this.display.cursorDiv.className += " CodeMirror-overwrite";
+ else
+ this.display.cursorDiv.className = this.display.cursorDiv.className.replace(" CodeMirror-overwrite", "");
+
+ signal(this, "overwriteToggle", this, this.state.overwrite);
+ },
+ hasFocus: function() { return activeElt() == this.display.input; },
+
+ scrollTo: methodOp(function(x, y) {
+ if (x != null || y != null) resolveScrollToPos(this);
+ if (x != null) this.curOp.scrollLeft = x;
+ if (y != null) this.curOp.scrollTop = y;
+ }),
+ getScrollInfo: function() {
+ var scroller = this.display.scroller, co = scrollerCutOff;
+ return {left: scroller.scrollLeft, top: scroller.scrollTop,
+ height: scroller.scrollHeight - co, width: scroller.scrollWidth - co,
+ clientHeight: scroller.clientHeight - co, clientWidth: scroller.clientWidth - co};
+ },
+
+ scrollIntoView: methodOp(function(range, margin) {
+ if (range == null) {
+ range = {from: this.doc.sel.primary().head, to: null};
+ if (margin == null) margin = this.options.cursorScrollMargin;
+ } else if (typeof range == "number") {
+ range = {from: Pos(range, 0), to: null};
+ } else if (range.from == null) {
+ range = {from: range, to: null};
+ }
+ if (!range.to) range.to = range.from;
+ range.margin = margin || 0;
+
+ if (range.from.line != null) {
+ resolveScrollToPos(this);
+ this.curOp.scrollToPos = range;
+ } else {
+ var sPos = calculateScrollPos(this, Math.min(range.from.left, range.to.left),
+ Math.min(range.from.top, range.to.top) - range.margin,
+ Math.max(range.from.right, range.to.right),
+ Math.max(range.from.bottom, range.to.bottom) + range.margin);
+ this.scrollTo(sPos.scrollLeft, sPos.scrollTop);
+ }
+ }),
+
+ setSize: methodOp(function(width, height) {
+ function interpret(val) {
+ return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val;
+ }
+ if (width != null) this.display.wrapper.style.width = interpret(width);
+ if (height != null) this.display.wrapper.style.height = interpret(height);
+ if (this.options.lineWrapping) clearLineMeasurementCache(this);
+ this.curOp.forceUpdate = true;
+ signal(this, "refresh", this);
+ }),
+
+ operation: function(f){return runInOp(this, f);},
+
+ refresh: methodOp(function() {
+ var oldHeight = this.display.cachedTextHeight;
+ regChange(this);
+ clearCaches(this);
+ this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop);
+ if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)
+ estimateLineHeights(this);
+ signal(this, "refresh", this);
+ }),
+
+ swapDoc: methodOp(function(doc) {
+ var old = this.doc;
+ old.cm = null;
+ attachDoc(this, doc);
+ clearCaches(this);
+ resetInput(this);
+ this.scrollTo(doc.scrollLeft, doc.scrollTop);
+ signalLater(this, "swapDoc", this, old);
+ return old;
+ }),
+
+ getInputField: function(){return this.display.input;},
+ getWrapperElement: function(){return this.display.wrapper;},
+ getScrollerElement: function(){return this.display.scroller;},
+ getGutterElement: function(){return this.display.gutters;}
+ };
+ eventMixin(CodeMirror);
+
+ // OPTION DEFAULTS
+
+ // The default configuration options.
+ var defaults = CodeMirror.defaults = {};
+ // Functions to run when options are changed.
+ var optionHandlers = CodeMirror.optionHandlers = {};
+
+ function option(name, deflt, handle, notOnInit) {
+ CodeMirror.defaults[name] = deflt;
+ if (handle) optionHandlers[name] =
+ notOnInit ? function(cm, val, old) {if (old != Init) handle(cm, val, old);} : handle;
+ }
+
+ // Passed to option handlers when there is no old value.
+ var Init = CodeMirror.Init = {toString: function(){return "CodeMirror.Init";}};
+
+ // These two are, on init, called from the constructor because they
+ // have to be initialized before the editor can start at all.
+ option("value", "", function(cm, val) {
+ cm.setValue(val);
+ }, true);
+ option("mode", null, function(cm, val) {
+ cm.doc.modeOption = val;
+ loadMode(cm);
+ }, true);
+
+ option("indentUnit", 2, loadMode, true);
+ option("indentWithTabs", false);
+ option("smartIndent", true);
+ option("tabSize", 4, function(cm) {
+ resetModeState(cm);
+ clearCaches(cm);
+ regChange(cm);
+ }, true);
+ option("specialChars", /[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g, function(cm, val) {
+ cm.options.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g");
+ cm.refresh();
+ }, true);
+ option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function(cm) {cm.refresh();}, true);
+ option("electricChars", true);
+ option("rtlMoveVisually", !windows);
+ option("wholeLineUpdateBefore", true);
+
+ option("theme", "default", function(cm) {
+ themeChanged(cm);
+ guttersChanged(cm);
+ }, true);
+ option("keyMap", "default", keyMapChanged);
+ option("extraKeys", null);
+
+ option("lineWrapping", false, wrappingChanged, true);
+ option("gutters", [], function(cm) {
+ setGuttersForLineNumbers(cm.options);
+ guttersChanged(cm);
+ }, true);
+ option("fixedGutter", true, function(cm, val) {
+ cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0";
+ cm.refresh();
+ }, true);
+ option("coverGutterNextToScrollbar", false, updateScrollbars, true);
+ option("lineNumbers", false, function(cm) {
+ setGuttersForLineNumbers(cm.options);
+ guttersChanged(cm);
+ }, true);
+ option("firstLineNumber", 1, guttersChanged, true);
+ option("lineNumberFormatter", function(integer) {return integer;}, guttersChanged, true);
+ option("showCursorWhenSelecting", false, updateSelection, true);
+
+ option("resetSelectionOnContextMenu", true);
+
+ option("readOnly", false, function(cm, val) {
+ if (val == "nocursor") {
+ onBlur(cm);
+ cm.display.input.blur();
+ cm.display.disabled = true;
+ } else {
+ cm.display.disabled = false;
+ if (!val) resetInput(cm);
+ }
+ });
+ option("disableInput", false, function(cm, val) {if (!val) resetInput(cm);}, true);
+ option("dragDrop", true);
+
+ option("cursorBlinkRate", 530);
+ option("cursorScrollMargin", 0);
+ option("cursorHeight", 1);
+ option("workTime", 100);
+ option("workDelay", 100);
+ option("flattenSpans", true, resetModeState, true);
+ option("addModeClass", false, resetModeState, true);
+ option("pollInterval", 100);
+ option("undoDepth", 200, function(cm, val){cm.doc.history.undoDepth = val;});
+ option("historyEventDelay", 1250);
+ option("viewportMargin", 10, function(cm){cm.refresh();}, true);
+ option("maxHighlightLength", 10000, resetModeState, true);
+ option("moveInputWithCursor", true, function(cm, val) {
+ if (!val) cm.display.inputDiv.style.top = cm.display.inputDiv.style.left = 0;
+ });
+
+ option("tabindex", null, function(cm, val) {
+ cm.display.input.tabIndex = val || "";
+ });
+ option("autofocus", null);
+
+ // MODE DEFINITION AND QUERYING
+
+ // Known modes, by name and by MIME
+ var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {};
+
+ // Extra arguments are stored as the mode's dependencies, which is
+ // used by (legacy) mechanisms like loadmode.js to automatically
+ // load a mode. (Preferred mechanism is the require/define calls.)
+ CodeMirror.defineMode = function(name, mode) {
+ if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name;
+ if (arguments.length > 2) {
+ mode.dependencies = [];
+ for (var i = 2; i < arguments.length; ++i) mode.dependencies.push(arguments[i]);
+ }
+ modes[name] = mode;
+ };
+
+ CodeMirror.defineMIME = function(mime, spec) {
+ mimeModes[mime] = spec;
+ };
+
+ // Given a MIME type, a {name, ...options} config object, or a name
+ // string, return a mode config object.
+ CodeMirror.resolveMode = function(spec) {
+ if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
+ spec = mimeModes[spec];
+ } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
+ var found = mimeModes[spec.name];
+ if (typeof found == "string") found = {name: found};
+ spec = createObj(found, spec);
+ spec.name = found.name;
+ } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
+ return CodeMirror.resolveMode("application/xml");
+ }
+ if (typeof spec == "string") return {name: spec};
+ else return spec || {name: "null"};
+ };
+
+ // Given a mode spec (anything that resolveMode accepts), find and
+ // initialize an actual mode object.
+ CodeMirror.getMode = function(options, spec) {
+ var spec = CodeMirror.resolveMode(spec);
+ var mfactory = modes[spec.name];
+ if (!mfactory) return CodeMirror.getMode(options, "text/plain");
+ var modeObj = mfactory(options, spec);
+ if (modeExtensions.hasOwnProperty(spec.name)) {
+ var exts = modeExtensions[spec.name];
+ for (var prop in exts) {
+ if (!exts.hasOwnProperty(prop)) continue;
+ if (modeObj.hasOwnProperty(prop)) modeObj["_" + prop] = modeObj[prop];
+ modeObj[prop] = exts[prop];
+ }
+ }
+ modeObj.name = spec.name;
+ if (spec.helperType) modeObj.helperType = spec.helperType;
+ if (spec.modeProps) for (var prop in spec.modeProps)
+ modeObj[prop] = spec.modeProps[prop];
+
+ return modeObj;
+ };
+
+ // Minimal default mode.
+ CodeMirror.defineMode("null", function() {
+ return {token: function(stream) {stream.skipToEnd();}};
+ });
+ CodeMirror.defineMIME("text/plain", "null");
+
+ // This can be used to attach properties to mode objects from
+ // outside the actual mode definition.
+ var modeExtensions = CodeMirror.modeExtensions = {};
+ CodeMirror.extendMode = function(mode, properties) {
+ var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
+ copyObj(properties, exts);
+ };
+
+ // EXTENSIONS
+
+ CodeMirror.defineExtension = function(name, func) {
+ CodeMirror.prototype[name] = func;
+ };
+ CodeMirror.defineDocExtension = function(name, func) {
+ Doc.prototype[name] = func;
+ };
+ CodeMirror.defineOption = option;
+
+ var initHooks = [];
+ CodeMirror.defineInitHook = function(f) {initHooks.push(f);};
+
+ var helpers = CodeMirror.helpers = {};
+ CodeMirror.registerHelper = function(type, name, value) {
+ if (!helpers.hasOwnProperty(type)) helpers[type] = CodeMirror[type] = {_global: []};
+ helpers[type][name] = value;
+ };
+ CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {
+ CodeMirror.registerHelper(type, name, value);
+ helpers[type]._global.push({pred: predicate, val: value});
+ };
+
+ // MODE STATE HANDLING
+
+ // Utility functions for working with state. Exported because nested
+ // modes need to do this for their inner modes.
+
+ var copyState = CodeMirror.copyState = function(mode, state) {
+ if (state === true) return state;
+ if (mode.copyState) return mode.copyState(state);
+ var nstate = {};
+ for (var n in state) {
+ var val = state[n];
+ if (val instanceof Array) val = val.concat([]);
+ nstate[n] = val;
+ }
+ return nstate;
+ };
+
+ var startState = CodeMirror.startState = function(mode, a1, a2) {
+ return mode.startState ? mode.startState(a1, a2) : true;
+ };
+
+ // Given a mode and a state (for that mode), find the inner mode and
+ // state at the position that the state refers to.
+ CodeMirror.innerMode = function(mode, state) {
+ while (mode.innerMode) {
+ var info = mode.innerMode(state);
+ if (!info || info.mode == mode) break;
+ state = info.state;
+ mode = info.mode;
+ }
+ return info || {mode: mode, state: state};
+ };
+
+ // STANDARD COMMANDS
+
+ // Commands are parameter-less actions that can be performed on an
+ // editor, mostly used for keybindings.
+ var commands = CodeMirror.commands = {
+ selectAll: function(cm) {cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);},
+ singleSelection: function(cm) {
+ cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll);
+ },
+ killLine: function(cm) {
+ deleteNearSelection(cm, function(range) {
+ if (range.empty()) {
+ var len = getLine(cm.doc, range.head.line).text.length;
+ if (range.head.ch == len && range.head.line < cm.lastLine())
+ return {from: range.head, to: Pos(range.head.line + 1, 0)};
+ else
+ return {from: range.head, to: Pos(range.head.line, len)};
+ } else {
+ return {from: range.from(), to: range.to()};
+ }
+ });
+ },
+ deleteLine: function(cm) {
+ deleteNearSelection(cm, function(range) {
+ return {from: Pos(range.from().line, 0),
+ to: clipPos(cm.doc, Pos(range.to().line + 1, 0))};
+ });
+ },
+ delLineLeft: function(cm) {
+ deleteNearSelection(cm, function(range) {
+ return {from: Pos(range.from().line, 0), to: range.from()};
+ });
+ },
+ undo: function(cm) {cm.undo();},
+ redo: function(cm) {cm.redo();},
+ undoSelection: function(cm) {cm.undoSelection();},
+ redoSelection: function(cm) {cm.redoSelection();},
+ goDocStart: function(cm) {cm.extendSelection(Pos(cm.firstLine(), 0));},
+ goDocEnd: function(cm) {cm.extendSelection(Pos(cm.lastLine()));},
+ goLineStart: function(cm) {
+ cm.extendSelectionsBy(function(range) { return lineStart(cm, range.head.line); }, sel_move);
+ },
+ goLineStartSmart: function(cm) {
+ cm.extendSelectionsBy(function(range) {
+ var start = lineStart(cm, range.head.line);
+ var line = cm.getLineHandle(start.line);
+ var order = getOrder(line);
+ if (!order || order[0].level == 0) {
+ var firstNonWS = Math.max(0, line.text.search(/\S/));
+ var inWS = range.head.line == start.line && range.head.ch <= firstNonWS && range.head.ch;
+ return Pos(start.line, inWS ? 0 : firstNonWS);
+ }
+ return start;
+ }, sel_move);
+ },
+ goLineEnd: function(cm) {
+ cm.extendSelectionsBy(function(range) { return lineEnd(cm, range.head.line); }, sel_move);
+ },
+ goLineRight: function(cm) {
+ cm.extendSelectionsBy(function(range) {
+ var top = cm.charCoords(range.head, "div").top + 5;
+ return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div");
+ }, sel_move);
+ },
+ goLineLeft: function(cm) {
+ cm.extendSelectionsBy(function(range) {
+ var top = cm.charCoords(range.head, "div").top + 5;
+ return cm.coordsChar({left: 0, top: top}, "div");
+ }, sel_move);
+ },
+ goLineUp: function(cm) {cm.moveV(-1, "line");},
+ goLineDown: function(cm) {cm.moveV(1, "line");},
+ goPageUp: function(cm) {cm.moveV(-1, "page");},
+ goPageDown: function(cm) {cm.moveV(1, "page");},
+ goCharLeft: function(cm) {cm.moveH(-1, "char");},
+ goCharRight: function(cm) {cm.moveH(1, "char");},
+ goColumnLeft: function(cm) {cm.moveH(-1, "column");},
+ goColumnRight: function(cm) {cm.moveH(1, "column");},
+ goWordLeft: function(cm) {cm.moveH(-1, "word");},
+ goGroupRight: function(cm) {cm.moveH(1, "group");},
+ goGroupLeft: function(cm) {cm.moveH(-1, "group");},
+ goWordRight: function(cm) {cm.moveH(1, "word");},
+ delCharBefore: function(cm) {cm.deleteH(-1, "char");},
+ delCharAfter: function(cm) {cm.deleteH(1, "char");},
+ delWordBefore: function(cm) {cm.deleteH(-1, "word");},
+ delWordAfter: function(cm) {cm.deleteH(1, "word");},
+ delGroupBefore: function(cm) {cm.deleteH(-1, "group");},
+ delGroupAfter: function(cm) {cm.deleteH(1, "group");},
+ indentAuto: function(cm) {cm.indentSelection("smart");},
+ indentMore: function(cm) {cm.indentSelection("add");},
+ indentLess: function(cm) {cm.indentSelection("subtract");},
+ insertTab: function(cm) {cm.replaceSelection("\t");},
+ defaultTab: function(cm) {
+ if (cm.somethingSelected()) cm.indentSelection("add");
+ else cm.execCommand("insertTab");
+ },
+ transposeChars: function(cm) {
+ runInOp(cm, function() {
+ var ranges = cm.listSelections();
+ for (var i = 0; i < ranges.length; i++) {
+ var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;
+ if (cur.ch > 0 && cur.ch < line.length - 1)
+ cm.replaceRange(line.charAt(cur.ch) + line.charAt(cur.ch - 1),
+ Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1));
+ }
+ });
+ },
+ newlineAndIndent: function(cm) {
+ runInOp(cm, function() {
+ var len = cm.listSelections().length;
+ for (var i = 0; i < len; i++) {
+ var range = cm.listSelections()[i];
+ cm.replaceRange("\n", range.anchor, range.head, "+input");
+ cm.indentLine(range.from().line + 1, null, true);
+ ensureCursorVisible(cm);
+ }
+ });
+ },
+ toggleOverwrite: function(cm) {cm.toggleOverwrite();}
+ };
+
+ // STANDARD KEYMAPS
+
+ var keyMap = CodeMirror.keyMap = {};
+ keyMap.basic = {
+ "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
+ "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
+ "Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore",
+ "Tab": "defaultTab", "Shift-Tab": "indentAuto",
+ "Enter": "newlineAndIndent", "Insert": "toggleOverwrite",
+ "Esc": "singleSelection"
+ };
+ // Note that the save and find-related commands aren't defined by
+ // default. User code or addons can define them. Unknown commands
+ // are simply ignored.
+ keyMap.pcDefault = {
+ "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
+ "Ctrl-Home": "goDocStart", "Ctrl-Up": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Down": "goDocEnd",
+ "Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
+ "Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
+ "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
+ "Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
+ "Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection",
+ fallthrough: "basic"
+ };
+ keyMap.macDefault = {
+ "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
+ "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft",
+ "Alt-Right": "goGroupRight", "Cmd-Left": "goLineStart", "Cmd-Right": "goLineEnd", "Alt-Backspace": "delGroupBefore",
+ "Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find",
+ "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
+ "Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delLineLeft",
+ "Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection",
+ fallthrough: ["basic", "emacsy"]
+ };
+ // Very basic readline/emacs-style bindings, which are standard on Mac.
+ keyMap.emacsy = {
+ "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
+ "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
+ "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore",
+ "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars"
+ };
+ keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;
+
+ // KEYMAP DISPATCH
+
+ function getKeyMap(val) {
+ if (typeof val == "string") return keyMap[val];
+ else return val;
+ }
+
+ // Given an array of keymaps and a key name, call handle on any
+ // bindings found, until that returns a truthy value, at which point
+ // we consider the key handled. Implements things like binding a key
+ // to false stopping further handling and keymap fallthrough.
+ var lookupKey = CodeMirror.lookupKey = function(name, maps, handle) {
+ function lookup(map) {
+ map = getKeyMap(map);
+ var found = map[name];
+ if (found === false) return "stop";
+ if (found != null && handle(found)) return true;
+ if (map.nofallthrough) return "stop";
+
+ var fallthrough = map.fallthrough;
+ if (fallthrough == null) return false;
+ if (Object.prototype.toString.call(fallthrough) != "[object Array]")
+ return lookup(fallthrough);
+ for (var i = 0; i < fallthrough.length; ++i) {
+ var done = lookup(fallthrough[i]);
+ if (done) return done;
+ }
+ return false;
+ }
+
+ for (var i = 0; i < maps.length; ++i) {
+ var done = lookup(maps[i]);
+ if (done) return done != "stop";
+ }
+ };
+
+ // Modifier key presses don't count as 'real' key presses for the
+ // purpose of keymap fallthrough.
+ var isModifierKey = CodeMirror.isModifierKey = function(event) {
+ var name = keyNames[event.keyCode];
+ return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod";
+ };
+
+ // Look up the name of a key as indicated by an event object.
+ var keyName = CodeMirror.keyName = function(event, noShift) {
+ if (presto && event.keyCode == 34 && event["char"]) return false;
+ var name = keyNames[event.keyCode];
+ if (name == null || event.altGraphKey) return false;
+ if (event.altKey) name = "Alt-" + name;
+ if (flipCtrlCmd ? event.metaKey : event.ctrlKey) name = "Ctrl-" + name;
+ if (flipCtrlCmd ? event.ctrlKey : event.metaKey) name = "Cmd-" + name;
+ if (!noShift && event.shiftKey) name = "Shift-" + name;
+ return name;
+ };
+
+ // FROMTEXTAREA
+
+ CodeMirror.fromTextArea = function(textarea, options) {
+ if (!options) options = {};
+ options.value = textarea.value;
+ if (!options.tabindex && textarea.tabindex)
+ options.tabindex = textarea.tabindex;
+ if (!options.placeholder && textarea.placeholder)
+ options.placeholder = textarea.placeholder;
+ // Set autofocus to true if this textarea is focused, or if it has
+ // autofocus and no other element is focused.
+ if (options.autofocus == null) {
+ var hasFocus = activeElt();
+ options.autofocus = hasFocus == textarea ||
+ textarea.getAttribute("autofocus") != null && hasFocus == document.body;
+ }
+
+ function save() {textarea.value = cm.getValue();}
+ if (textarea.form) {
+ on(textarea.form, "submit", save);
+ // Deplorable hack to make the submit method do the right thing.
+ if (!options.leaveSubmitMethodAlone) {
+ var form = textarea.form, realSubmit = form.submit;
+ try {
+ var wrappedSubmit = form.submit = function() {
+ save();
+ form.submit = realSubmit;
+ form.submit();
+ form.submit = wrappedSubmit;
+ };
+ } catch(e) {}
+ }
+ }
+
+ textarea.style.display = "none";
+ var cm = CodeMirror(function(node) {
+ textarea.parentNode.insertBefore(node, textarea.nextSibling);
+ }, options);
+ cm.save = save;
+ cm.getTextArea = function() { return textarea; };
+ cm.toTextArea = function() {
+ save();
+ textarea.parentNode.removeChild(cm.getWrapperElement());
+ textarea.style.display = "";
+ if (textarea.form) {
+ off(textarea.form, "submit", save);
+ if (typeof textarea.form.submit == "function")
+ textarea.form.submit = realSubmit;
+ }
+ };
+ return cm;
+ };
+
+ // STRING STREAM
+
+ // Fed to the mode parsers, provides helper functions to make
+ // parsers more succinct.
+
+ var StringStream = CodeMirror.StringStream = function(string, tabSize) {
+ this.pos = this.start = 0;
+ this.string = string;
+ this.tabSize = tabSize || 8;
+ this.lastColumnPos = this.lastColumnValue = 0;
+ this.lineStart = 0;
+ };
+
+ StringStream.prototype = {
+ eol: function() {return this.pos >= this.string.length;},
+ sol: function() {return this.pos == this.lineStart;},
+ peek: function() {return this.string.charAt(this.pos) || undefined;},
+ next: function() {
+ if (this.pos < this.string.length)
+ return this.string.charAt(this.pos++);
+ },
+ eat: function(match) {
+ var ch = this.string.charAt(this.pos);
+ if (typeof match == "string") var ok = ch == match;
+ else var ok = ch && (match.test ? match.test(ch) : match(ch));
+ if (ok) {++this.pos; return ch;}
+ },
+ eatWhile: function(match) {
+ var start = this.pos;
+ while (this.eat(match)){}
+ return this.pos > start;
+ },
+ eatSpace: function() {
+ var start = this.pos;
+ while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;
+ return this.pos > start;
+ },
+ skipToEnd: function() {this.pos = this.string.length;},
+ skipTo: function(ch) {
+ var found = this.string.indexOf(ch, this.pos);
+ if (found > -1) {this.pos = found; return true;}
+ },
+ backUp: function(n) {this.pos -= n;},
+ column: function() {
+ if (this.lastColumnPos < this.start) {
+ this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
+ this.lastColumnPos = this.start;
+ }
+ return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0);
+ },
+ indentation: function() {
+ return countColumn(this.string, null, this.tabSize) -
+ (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0);
+ },
+ match: function(pattern, consume, caseInsensitive) {
+ if (typeof pattern == "string") {
+ var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;};
+ var substr = this.string.substr(this.pos, pattern.length);
+ if (cased(substr) == cased(pattern)) {
+ if (consume !== false) this.pos += pattern.length;
+ return true;
+ }
+ } else {
+ var match = this.string.slice(this.pos).match(pattern);
+ if (match && match.index > 0) return null;
+ if (match && consume !== false) this.pos += match[0].length;
+ return match;
+ }
+ },
+ current: function(){return this.string.slice(this.start, this.pos);},
+ hideFirstChars: function(n, inner) {
+ this.lineStart += n;
+ try { return inner(); }
+ finally { this.lineStart -= n; }
+ }
+ };
+
+ // TEXTMARKERS
+
+ // Created with markText and setBookmark methods. A TextMarker is a
+ // handle that can be used to clear or find a marked position in the
+ // document. Line objects hold arrays (markedSpans) containing
+ // {from, to, marker} object pointing to such marker objects, and
+ // indicating that such a marker is present on that line. Multiple
+ // lines may point to the same marker when it spans across lines.
+ // The spans will have null for their from/to properties when the
+ // marker continues beyond the start/end of the line. Markers have
+ // links back to the lines they currently touch.
+
+ var TextMarker = CodeMirror.TextMarker = function(doc, type) {
+ this.lines = [];
+ this.type = type;
+ this.doc = doc;
+ };
+ eventMixin(TextMarker);
+
+ // Clear the marker.
+ TextMarker.prototype.clear = function() {
+ if (this.explicitlyCleared) return;
+ var cm = this.doc.cm, withOp = cm && !cm.curOp;
+ if (withOp) startOperation(cm);
+ if (hasHandler(this, "clear")) {
+ var found = this.find();
+ if (found) signalLater(this, "clear", found.from, found.to);
+ }
+ var min = null, max = null;
+ for (var i = 0; i < this.lines.length; ++i) {
+ var line = this.lines[i];
+ var span = getMarkedSpanFor(line.markedSpans, this);
+ if (cm && !this.collapsed) regLineChange(cm, lineNo(line), "text");
+ else if (cm) {
+ if (span.to != null) max = lineNo(line);
+ if (span.from != null) min = lineNo(line);
+ }
+ line.markedSpans = removeMarkedSpan(line.markedSpans, span);
+ if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm)
+ updateLineHeight(line, textHeight(cm.display));
+ }
+ if (cm && this.collapsed && !cm.options.lineWrapping) for (var i = 0; i < this.lines.length; ++i) {
+ var visual = visualLine(this.lines[i]), len = lineLength(visual);
+ if (len > cm.display.maxLineLength) {
+ cm.display.maxLine = visual;
+ cm.display.maxLineLength = len;
+ cm.display.maxLineChanged = true;
+ }
+ }
+
+ if (min != null && cm && this.collapsed) regChange(cm, min, max + 1);
+ this.lines.length = 0;
+ this.explicitlyCleared = true;
+ if (this.atomic && this.doc.cantEdit) {
+ this.doc.cantEdit = false;
+ if (cm) reCheckSelection(cm.doc);
+ }
+ if (cm) signalLater(cm, "markerCleared", cm, this);
+ if (withOp) endOperation(cm);
+ };
+
+ // Find the position of the marker in the document. Returns a {from,
+ // to} object by default. Side can be passed to get a specific side
+ // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
+ // Pos objects returned contain a line object, rather than a line
+ // number (used to prevent looking up the same line twice).
+ TextMarker.prototype.find = function(side, lineObj) {
+ if (side == null && this.type == "bookmark") side = 1;
+ var from, to;
+ for (var i = 0; i < this.lines.length; ++i) {
+ var line = this.lines[i];
+ var span = getMarkedSpanFor(line.markedSpans, this);
+ if (span.from != null) {
+ from = Pos(lineObj ? line : lineNo(line), span.from);
+ if (side == -1) return from;
+ }
+ if (span.to != null) {
+ to = Pos(lineObj ? line : lineNo(line), span.to);
+ if (side == 1) return to;
+ }
+ }
+ return from && {from: from, to: to};
+ };
+
+ // Signals that the marker's widget changed, and surrounding layout
+ // should be recomputed.
+ TextMarker.prototype.changed = function() {
+ var pos = this.find(-1, true), widget = this, cm = this.doc.cm;
+ if (!pos || !cm) return;
+ runInOp(cm, function() {
+ var line = pos.line, lineN = lineNo(pos.line);
+ var view = findViewForLine(cm, lineN);
+ if (view) {
+ clearLineMeasurementCacheFor(view);
+ cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;
+ }
+ cm.curOp.updateMaxLine = true;
+ if (!lineIsHidden(widget.doc, line) && widget.height != null) {
+ var oldHeight = widget.height;
+ widget.height = null;
+ var dHeight = widgetHeight(widget) - oldHeight;
+ if (dHeight)
+ updateLineHeight(line, line.height + dHeight);
+ }
+ });
+ };
+
+ TextMarker.prototype.attachLine = function(line) {
+ if (!this.lines.length && this.doc.cm) {
+ var op = this.doc.cm.curOp;
+ if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
+ (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this);
+ }
+ this.lines.push(line);
+ };
+ TextMarker.prototype.detachLine = function(line) {
+ this.lines.splice(indexOf(this.lines, line), 1);
+ if (!this.lines.length && this.doc.cm) {
+ var op = this.doc.cm.curOp;
+ (op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);
+ }
+ };
+
+ // Collapsed markers have unique ids, in order to be able to order
+ // them, which is needed for uniquely determining an outer marker
+ // when they overlap (they may nest, but not partially overlap).
+ var nextMarkerId = 0;
+
+ // Create a marker, wire it up to the right lines, and
+ function markText(doc, from, to, options, type) {
+ // Shared markers (across linked documents) are handled separately
+ // (markTextShared will call out to this again, once per
+ // document).
+ if (options && options.shared) return markTextShared(doc, from, to, options, type);
+ // Ensure we are in an operation.
+ if (doc.cm && !doc.cm.curOp) return operation(doc.cm, markText)(doc, from, to, options, type);
+
+ var marker = new TextMarker(doc, type), diff = cmp(from, to);
+ if (options) copyObj(options, marker);
+ // Don't connect empty markers unless clearWhenEmpty is false
+ if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
+ return marker;
+ if (marker.replacedWith) {
+ // Showing up as a widget implies collapsed (widget replaces text)
+ marker.collapsed = true;
+ marker.widgetNode = elt("span", [marker.replacedWith], "CodeMirror-widget");
+ if (!options.handleMouseEvents) marker.widgetNode.ignoreEvents = true;
+ if (options.insertLeft) marker.widgetNode.insertLeft = true;
+ }
+ if (marker.collapsed) {
+ if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
+ from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
+ throw new Error("Inserting collapsed marker partially overlapping an existing one");
+ sawCollapsedSpans = true;
+ }
+
+ if (marker.addToHistory)
+ addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN);
+
+ var curLine = from.line, cm = doc.cm, updateMaxLine;
+ doc.iter(curLine, to.line + 1, function(line) {
+ if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
+ updateMaxLine = true;
+ if (marker.collapsed && curLine != from.line) updateLineHeight(line, 0);
+ addMarkedSpan(line, new MarkedSpan(marker,
+ curLine == from.line ? from.ch : null,
+ curLine == to.line ? to.ch : null));
+ ++curLine;
+ });
+ // lineIsHidden depends on the presence of the spans, so needs a second pass
+ if (marker.collapsed) doc.iter(from.line, to.line + 1, function(line) {
+ if (lineIsHidden(doc, line)) updateLineHeight(line, 0);
+ });
+
+ if (marker.clearOnEnter) on(marker, "beforeCursorEnter", function() { marker.clear(); });
+
+ if (marker.readOnly) {
+ sawReadOnlySpans = true;
+ if (doc.history.done.length || doc.history.undone.length)
+ doc.clearHistory();
+ }
+ if (marker.collapsed) {
+ marker.id = ++nextMarkerId;
+ marker.atomic = true;
+ }
+ if (cm) {
+ // Sync editor state
+ if (updateMaxLine) cm.curOp.updateMaxLine = true;
+ if (marker.collapsed)
+ regChange(cm, from.line, to.line + 1);
+ else if (marker.className || marker.title || marker.startStyle || marker.endStyle)
+ for (var i = from.line; i <= to.line; i++) regLineChange(cm, i, "text");
+ if (marker.atomic) reCheckSelection(cm.doc);
+ signalLater(cm, "markerAdded", cm, marker);
+ }
+ return marker;
+ }
+
+ // SHARED TEXTMARKERS
+
+ // A shared marker spans multiple linked documents. It is
+ // implemented as a meta-marker-object controlling multiple normal
+ // markers.
+ var SharedTextMarker = CodeMirror.SharedTextMarker = function(markers, primary) {
+ this.markers = markers;
+ this.primary = primary;
+ for (var i = 0, me = this; i < markers.length; ++i) {
+ markers[i].parent = this;
+ on(markers[i], "clear", function(){me.clear();});
+ }
+ };
+ eventMixin(SharedTextMarker);
+
+ SharedTextMarker.prototype.clear = function() {
+ if (this.explicitlyCleared) return;
+ this.explicitlyCleared = true;
+ for (var i = 0; i < this.markers.length; ++i)
+ this.markers[i].clear();
+ signalLater(this, "clear");
+ };
+ SharedTextMarker.prototype.find = function(side, lineObj) {
+ return this.primary.find(side, lineObj);
+ };
+
+ function markTextShared(doc, from, to, options, type) {
+ options = copyObj(options);
+ options.shared = false;
+ var markers = [markText(doc, from, to, options, type)], primary = markers[0];
+ var widget = options.widgetNode;
+ linkedDocs(doc, function(doc) {
+ if (widget) options.widgetNode = widget.cloneNode(true);
+ markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));
+ for (var i = 0; i < doc.linked.length; ++i)
+ if (doc.linked[i].isParent) return;
+ primary = lst(markers);
+ });
+ return new SharedTextMarker(markers, primary);
+ }
+
+ // TEXTMARKER SPANS
+
+ function MarkedSpan(marker, from, to) {
+ this.marker = marker;
+ this.from = from; this.to = to;
+ }
+
+ // Search an array of spans for a span matching the given marker.
+ function getMarkedSpanFor(spans, marker) {
+ if (spans) for (var i = 0; i < spans.length; ++i) {
+ var span = spans[i];
+ if (span.marker == marker) return span;
+ }
+ }
+ // Remove a span from an array, returning undefined if no spans are
+ // left (we don't store arrays for lines without spans).
+ function removeMarkedSpan(spans, span) {
+ for (var r, i = 0; i < spans.length; ++i)
+ if (spans[i] != span) (r || (r = [])).push(spans[i]);
+ return r;
+ }
+ // Add a span to a line.
+ function addMarkedSpan(line, span) {
+ line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
+ span.marker.attachLine(line);
+ }
+
+ // Used for the algorithm that adjusts markers for a change in the
+ // document. These functions cut an array of spans at a given
+ // character position, returning an array of remaining chunks (or
+ // undefined if nothing remains).
+ function markedSpansBefore(old, startCh, isInsert) {
+ if (old) for (var i = 0, nw; i < old.length; ++i) {
+ var span = old[i], marker = span.marker;
+ var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
+ if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
+ var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh);
+ (nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));
+ }
+ }
+ return nw;
+ }
+ function markedSpansAfter(old, endCh, isInsert) {
+ if (old) for (var i = 0, nw; i < old.length; ++i) {
+ var span = old[i], marker = span.marker;
+ var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
+ if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
+ var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);
+ (nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
+ span.to == null ? null : span.to - endCh));
+ }
+ }
+ return nw;
+ }
+
+ // Given a change object, compute the new set of marker spans that
+ // cover the line in which the change took place. Removes spans
+ // entirely within the change, reconnects spans belonging to the
+ // same marker that appear on both sides of the change, and cuts off
+ // spans partially within the change. Returns an array of span
+ // arrays with one element for each line in (after) the change.
+ function stretchSpansOverChange(doc, change) {
+ var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;
+ var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;
+ if (!oldFirst && !oldLast) return null;
+
+ var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;
+ // Get the spans that 'stick out' on both sides
+ var first = markedSpansBefore(oldFirst, startCh, isInsert);
+ var last = markedSpansAfter(oldLast, endCh, isInsert);
+
+ // Next, merge those two ends
+ var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);
+ if (first) {
+ // Fix up .to properties of first
+ for (var i = 0; i < first.length; ++i) {
+ var span = first[i];
+ if (span.to == null) {
+ var found = getMarkedSpanFor(last, span.marker);
+ if (!found) span.to = startCh;
+ else if (sameLine) span.to = found.to == null ? null : found.to + offset;
+ }
+ }
+ }
+ if (last) {
+ // Fix up .from in last (or move them into first in case of sameLine)
+ for (var i = 0; i < last.length; ++i) {
+ var span = last[i];
+ if (span.to != null) span.to += offset;
+ if (span.from == null) {
+ var found = getMarkedSpanFor(first, span.marker);
+ if (!found) {
+ span.from = offset;
+ if (sameLine) (first || (first = [])).push(span);
+ }
+ } else {
+ span.from += offset;
+ if (sameLine) (first || (first = [])).push(span);
+ }
+ }
+ }
+ // Make sure we didn't create any zero-length spans
+ if (first) first = clearEmptySpans(first);
+ if (last && last != first) last = clearEmptySpans(last);
+
+ var newMarkers = [first];
+ if (!sameLine) {
+ // Fill gap with whole-line-spans
+ var gap = change.text.length - 2, gapMarkers;
+ if (gap > 0 && first)
+ for (var i = 0; i < first.length; ++i)
+ if (first[i].to == null)
+ (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i].marker, null, null));
+ for (var i = 0; i < gap; ++i)
+ newMarkers.push(gapMarkers);
+ newMarkers.push(last);
+ }
+ return newMarkers;
+ }
+
+ // Remove spans that are empty and don't have a clearWhenEmpty
+ // option of false.
+ function clearEmptySpans(spans) {
+ for (var i = 0; i < spans.length; ++i) {
+ var span = spans[i];
+ if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
+ spans.splice(i--, 1);
+ }
+ if (!spans.length) return null;
+ return spans;
+ }
+
+ // Used for un/re-doing changes from the history. Combines the
+ // result of computing the existing spans with the set of spans that
+ // existed in the history (so that deleting around a span and then
+ // undoing brings back the span).
+ function mergeOldSpans(doc, change) {
+ var old = getOldSpans(doc, change);
+ var stretched = stretchSpansOverChange(doc, change);
+ if (!old) return stretched;
+ if (!stretched) return old;
+
+ for (var i = 0; i < old.length; ++i) {
+ var oldCur = old[i], stretchCur = stretched[i];
+ if (oldCur && stretchCur) {
+ spans: for (var j = 0; j < stretchCur.length; ++j) {
+ var span = stretchCur[j];
+ for (var k = 0; k < oldCur.length; ++k)
+ if (oldCur[k].marker == span.marker) continue spans;
+ oldCur.push(span);
+ }
+ } else if (stretchCur) {
+ old[i] = stretchCur;
+ }
+ }
+ return old;
+ }
+
+ // Used to 'clip' out readOnly ranges when making a change.
+ function removeReadOnlyRanges(doc, from, to) {
+ var markers = null;
+ doc.iter(from.line, to.line + 1, function(line) {
+ if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) {
+ var mark = line.markedSpans[i].marker;
+ if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
+ (markers || (markers = [])).push(mark);
+ }
+ });
+ if (!markers) return null;
+ var parts = [{from: from, to: to}];
+ for (var i = 0; i < markers.length; ++i) {
+ var mk = markers[i], m = mk.find(0);
+ for (var j = 0; j < parts.length; ++j) {
+ var p = parts[j];
+ if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) continue;
+ var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);
+ if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
+ newParts.push({from: p.from, to: m.from});
+ if (dto > 0 || !mk.inclusiveRight && !dto)
+ newParts.push({from: m.to, to: p.to});
+ parts.splice.apply(parts, newParts);
+ j += newParts.length - 1;
+ }
+ }
+ return parts;
+ }
+
+ // Connect or disconnect spans from a line.
+ function detachMarkedSpans(line) {
+ var spans = line.markedSpans;
+ if (!spans) return;
+ for (var i = 0; i < spans.length; ++i)
+ spans[i].marker.detachLine(line);
+ line.markedSpans = null;
+ }
+ function attachMarkedSpans(line, spans) {
+ if (!spans) return;
+ for (var i = 0; i < spans.length; ++i)
+ spans[i].marker.attachLine(line);
+ line.markedSpans = spans;
+ }
+
+ // Helpers used when computing which overlapping collapsed span
+ // counts as the larger one.
+ function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0; }
+ function extraRight(marker) { return marker.inclusiveRight ? 1 : 0; }
+
+ // Returns a number indicating which of two overlapping collapsed
+ // spans is larger (and thus includes the other). Falls back to
+ // comparing ids when the spans cover exactly the same range.
+ function compareCollapsedMarkers(a, b) {
+ var lenDiff = a.lines.length - b.lines.length;
+ if (lenDiff != 0) return lenDiff;
+ var aPos = a.find(), bPos = b.find();
+ var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);
+ if (fromCmp) return -fromCmp;
+ var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);
+ if (toCmp) return toCmp;
+ return b.id - a.id;
+ }
+
+ // Find out whether a line ends or starts in a collapsed span. If
+ // so, return the marker for that span.
+ function collapsedSpanAtSide(line, start) {
+ var sps = sawCollapsedSpans && line.markedSpans, found;
+ if (sps) for (var sp, i = 0; i < sps.length; ++i) {
+ sp = sps[i];
+ if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
+ (!found || compareCollapsedMarkers(found, sp.marker) < 0))
+ found = sp.marker;
+ }
+ return found;
+ }
+ function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true); }
+ function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false); }
+
+ // Test whether there exists a collapsed span that partially
+ // overlaps (covers the start or end, but not both) of a new span.
+ // Such overlap is not allowed.
+ function conflictingCollapsedRange(doc, lineNo, from, to, marker) {
+ var line = getLine(doc, lineNo);
+ var sps = sawCollapsedSpans && line.markedSpans;
+ if (sps) for (var i = 0; i < sps.length; ++i) {
+ var sp = sps[i];
+ if (!sp.marker.collapsed) continue;
+ var found = sp.marker.find(0);
+ var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);
+ var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);
+ if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) continue;
+ if (fromCmp <= 0 && (cmp(found.to, from) || extraRight(sp.marker) - extraLeft(marker)) > 0 ||
+ fromCmp >= 0 && (cmp(found.from, to) || extraLeft(sp.marker) - extraRight(marker)) < 0)
+ return true;
+ }
+ }
+
+ // A visual line is a line as drawn on the screen. Folding, for
+ // example, can cause multiple logical lines to appear on the same
+ // visual line. This finds the start of the visual line that the
+ // given line is part of (usually that is the line itself).
+ function visualLine(line) {
+ var merged;
+ while (merged = collapsedSpanAtStart(line))
+ line = merged.find(-1, true).line;
+ return line;
+ }
+
+ // Returns an array of logical lines that continue the visual line
+ // started by the argument, or undefined if there are no such lines.
+ function visualLineContinued(line) {
+ var merged, lines;
+ while (merged = collapsedSpanAtEnd(line)) {
+ line = merged.find(1, true).line;
+ (lines || (lines = [])).push(line);
+ }
+ return lines;
+ }
+
+ // Get the line number of the start of the visual line that the
+ // given line number is part of.
+ function visualLineNo(doc, lineN) {
+ var line = getLine(doc, lineN), vis = visualLine(line);
+ if (line == vis) return lineN;
+ return lineNo(vis);
+ }
+ // Get the line number of the start of the next visual line after
+ // the given line.
+ function visualLineEndNo(doc, lineN) {
+ if (lineN > doc.lastLine()) return lineN;
+ var line = getLine(doc, lineN), merged;
+ if (!lineIsHidden(doc, line)) return lineN;
+ while (merged = collapsedSpanAtEnd(line))
+ line = merged.find(1, true).line;
+ return lineNo(line) + 1;
+ }
+
+ // Compute whether a line is hidden. Lines count as hidden when they
+ // are part of a visual line that starts with another line, or when
+ // they are entirely covered by collapsed, non-widget span.
+ function lineIsHidden(doc, line) {
+ var sps = sawCollapsedSpans && line.markedSpans;
+ if (sps) for (var sp, i = 0; i < sps.length; ++i) {
+ sp = sps[i];
+ if (!sp.marker.collapsed) continue;
+ if (sp.from == null) return true;
+ if (sp.marker.widgetNode) continue;
+ if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
+ return true;
+ }
+ }
+ function lineIsHiddenInner(doc, line, span) {
+ if (span.to == null) {
+ var end = span.marker.find(1, true);
+ return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker));
+ }
+ if (span.marker.inclusiveRight && span.to == line.text.length)
+ return true;
+ for (var sp, i = 0; i < line.markedSpans.length; ++i) {
+ sp = line.markedSpans[i];
+ if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
+ (sp.to == null || sp.to != span.from) &&
+ (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
+ lineIsHiddenInner(doc, line, sp)) return true;
+ }
+ }
+
+ // LINE WIDGETS
+
+ // Line widgets are block elements displayed above or below a line.
+
+ var LineWidget = CodeMirror.LineWidget = function(cm, node, options) {
+ if (options) for (var opt in options) if (options.hasOwnProperty(opt))
+ this[opt] = options[opt];
+ this.cm = cm;
+ this.node = node;
+ };
+ eventMixin(LineWidget);
+
+ function adjustScrollWhenAboveVisible(cm, line, diff) {
+ if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
+ addToScrollPos(cm, null, diff);
+ }
+
+ LineWidget.prototype.clear = function() {
+ var cm = this.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);
+ if (no == null || !ws) return;
+ for (var i = 0; i < ws.length; ++i) if (ws[i] == this) ws.splice(i--, 1);
+ if (!ws.length) line.widgets = null;
+ var height = widgetHeight(this);
+ runInOp(cm, function() {
+ adjustScrollWhenAboveVisible(cm, line, -height);
+ regLineChange(cm, no, "widget");
+ updateLineHeight(line, Math.max(0, line.height - height));
+ });
+ };
+ LineWidget.prototype.changed = function() {
+ var oldH = this.height, cm = this.cm, line = this.line;
+ this.height = null;
+ var diff = widgetHeight(this) - oldH;
+ if (!diff) return;
+ runInOp(cm, function() {
+ cm.curOp.forceUpdate = true;
+ adjustScrollWhenAboveVisible(cm, line, diff);
+ updateLineHeight(line, line.height + diff);
+ });
+ };
+
+ function widgetHeight(widget) {
+ if (widget.height != null) return widget.height;
+ if (!contains(document.body, widget.node))
+ removeChildrenAndAdd(widget.cm.display.measure, elt("div", [widget.node], null, "position: relative"));
+ return widget.height = widget.node.offsetHeight;
+ }
+
+ function addLineWidget(cm, handle, node, options) {
+ var widget = new LineWidget(cm, node, options);
+ if (widget.noHScroll) cm.display.alignWidgets = true;
+ changeLine(cm, handle, "widget", function(line) {
+ var widgets = line.widgets || (line.widgets = []);
+ if (widget.insertAt == null) widgets.push(widget);
+ else widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget);
+ widget.line = line;
+ if (!lineIsHidden(cm.doc, line)) {
+ var aboveVisible = heightAtLine(line) < cm.doc.scrollTop;
+ updateLineHeight(line, line.height + widgetHeight(widget));
+ if (aboveVisible) addToScrollPos(cm, null, widget.height);
+ cm.curOp.forceUpdate = true;
+ }
+ return true;
+ });
+ return widget;
+ }
+
+ // LINE DATA STRUCTURE
+
+ // Line objects. These hold state related to a line, including
+ // highlighting info (the styles array).
+ var Line = CodeMirror.Line = function(text, markedSpans, estimateHeight) {
+ this.text = text;
+ attachMarkedSpans(this, markedSpans);
+ this.height = estimateHeight ? estimateHeight(this) : 1;
+ };
+ eventMixin(Line);
+ Line.prototype.lineNo = function() { return lineNo(this); };
+
+ // Change the content (text, markers) of a line. Automatically
+ // invalidates cached information and tries to re-estimate the
+ // line's height.
+ function updateLine(line, text, markedSpans, estimateHeight) {
+ line.text = text;
+ if (line.stateAfter) line.stateAfter = null;
+ if (line.styles) line.styles = null;
+ if (line.order != null) line.order = null;
+ detachMarkedSpans(line);
+ attachMarkedSpans(line, markedSpans);
+ var estHeight = estimateHeight ? estimateHeight(line) : 1;
+ if (estHeight != line.height) updateLineHeight(line, estHeight);
+ }
+
+ // Detach a line from the document tree and its markers.
+ function cleanUpLine(line) {
+ line.parent = null;
+ detachMarkedSpans(line);
+ }
+
+ // Run the given mode's parser over a line, calling f for each token.
+ function runMode(cm, text, mode, state, f, forceToEnd) {
+ var flattenSpans = mode.flattenSpans;
+ if (flattenSpans == null) flattenSpans = cm.options.flattenSpans;
+ var curStart = 0, curStyle = null;
+ var stream = new StringStream(text, cm.options.tabSize), style;
+ if (text == "" && mode.blankLine) mode.blankLine(state);
+ while (!stream.eol()) {
+ if (stream.pos > cm.options.maxHighlightLength) {
+ flattenSpans = false;
+ if (forceToEnd) processLine(cm, text, state, stream.pos);
+ stream.pos = text.length;
+ style = null;
+ } else {
+ style = mode.token(stream, state);
+ }
+ if (cm.options.addModeClass) {
+ var mName = CodeMirror.innerMode(mode, state).mode.name;
+ if (mName) style = "m-" + (style ? mName + " " + style : mName);
+ }
+ if (!flattenSpans || curStyle != style) {
+ if (curStart < stream.start) f(stream.start, curStyle);
+ curStart = stream.start; curStyle = style;
+ }
+ stream.start = stream.pos;
+ }
+ while (curStart < stream.pos) {
+ // Webkit seems to refuse to render text nodes longer than 57444 characters
+ var pos = Math.min(stream.pos, curStart + 50000);
+ f(pos, curStyle);
+ curStart = pos;
+ }
+ }
+
+ // Compute a style array (an array starting with a mode generation
+ // -- for invalidation -- followed by pairs of end positions and
+ // style strings), which is used to highlight the tokens on the
+ // line.
+ function highlightLine(cm, line, state, forceToEnd) {
+ // A styles array always starts with a number identifying the
+ // mode/overlays that it is based on (for easy invalidation).
+ var st = [cm.state.modeGen];
+ // Compute the base array of styles
+ runMode(cm, line.text, cm.doc.mode, state, function(end, style) {
+ st.push(end, style);
+ }, forceToEnd);
+
+ // Run overlays, adjust style array.
+ for (var o = 0; o < cm.state.overlays.length; ++o) {
+ var overlay = cm.state.overlays[o], i = 1, at = 0;
+ runMode(cm, line.text, overlay.mode, true, function(end, style) {
+ var start = i;
+ // Ensure there's a token end at the current position, and that i points at it
+ while (at < end) {
+ var i_end = st[i];
+ if (i_end > end)
+ st.splice(i, 1, end, st[i+1], i_end);
+ i += 2;
+ at = Math.min(end, i_end);
+ }
+ if (!style) return;
+ if (overlay.opaque) {
+ st.splice(start, i - start, end, style);
+ i = start + 2;
+ } else {
+ for (; start < i; start += 2) {
+ var cur = st[start+1];
+ st[start+1] = cur ? cur + " " + style : style;
+ }
+ }
+ });
+ }
+
+ return st;
+ }
+
+ function getLineStyles(cm, line) {
+ if (!line.styles || line.styles[0] != cm.state.modeGen)
+ line.styles = highlightLine(cm, line, line.stateAfter = getStateBefore(cm, lineNo(line)));
+ return line.styles;
+ }
+
+ // Lightweight form of highlight -- proceed over this line and
+ // update state, but don't save a style array. Used for lines that
+ // aren't currently visible.
+ function processLine(cm, text, state, startAt) {
+ var mode = cm.doc.mode;
+ var stream = new StringStream(text, cm.options.tabSize);
+ stream.start = stream.pos = startAt || 0;
+ if (text == "" && mode.blankLine) mode.blankLine(state);
+ while (!stream.eol() && stream.pos <= cm.options.maxHighlightLength) {
+ mode.token(stream, state);
+ stream.start = stream.pos;
+ }
+ }
+
+ // Convert a style as returned by a mode (either null, or a string
+ // containing one or more styles) to a CSS style. This is cached,
+ // and also looks for line-wide styles.
+ var styleToClassCache = {}, styleToClassCacheWithMode = {};
+ function interpretTokenStyle(style, builder) {
+ if (!style) return null;
+ for (;;) {
+ var lineClass = style.match(/(?:^|\s+)line-(background-)?(\S+)/);
+ if (!lineClass) break;
+ style = style.slice(0, lineClass.index) + style.slice(lineClass.index + lineClass[0].length);
+ var prop = lineClass[1] ? "bgClass" : "textClass";
+ if (builder[prop] == null)
+ builder[prop] = lineClass[2];
+ else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(builder[prop]))
+ builder[prop] += " " + lineClass[2];
+ }
+ if (/^\s*$/.test(style)) return null;
+ var cache = builder.cm.options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;
+ return cache[style] ||
+ (cache[style] = style.replace(/\S+/g, "cm-$&"));
+ }
+
+ // Render the DOM representation of the text of a line. Also builds
+ // up a 'line map', which points at the DOM nodes that represent
+ // specific stretches of text, and is used by the measuring code.
+ // The returned object contains the DOM node, this map, and
+ // information about line-wide styles that were set by the mode.
+ function buildLineContent(cm, lineView) {
+ // The padding-right forces the element to have a 'border', which
+ // is needed on Webkit to be able to get line-level bounding
+ // rectangles for it (in measureChar).
+ var content = elt("span", null, null, webkit ? "padding-right: .1px" : null);
+ var builder = {pre: elt("pre", [content]), content: content, col: 0, pos: 0, cm: cm};
+ lineView.measure = {};
+
+ // Iterate over the logical lines that make up this visual line.
+ for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
+ var line = i ? lineView.rest[i - 1] : lineView.line, order;
+ builder.pos = 0;
+ builder.addToken = buildToken;
+ // Optionally wire in some hacks into the token-rendering
+ // algorithm, to deal with browser quirks.
+ if ((ie || webkit) && cm.getOption("lineWrapping"))
+ builder.addToken = buildTokenSplitSpaces(builder.addToken);
+ if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))
+ builder.addToken = buildTokenBadBidi(builder.addToken, order);
+ builder.map = [];
+ insertLineContent(line, builder, getLineStyles(cm, line));
+
+ // Ensure at least a single node is present, for measuring.
+ if (builder.map.length == 0)
+ builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));
+
+ // Store the map and a cache object for the current logical line
+ if (i == 0) {
+ lineView.measure.map = builder.map;
+ lineView.measure.cache = {};
+ } else {
+ (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);
+ (lineView.measure.caches || (lineView.measure.caches = [])).push({});
+ }
+ }
+
+ signal(cm, "renderLine", cm, lineView.line, builder.pre);
+ return builder;
+ }
+
+ function defaultSpecialCharPlaceholder(ch) {
+ var token = elt("span", "\u2022", "cm-invalidchar");
+ token.title = "\\u" + ch.charCodeAt(0).toString(16);
+ return token;
+ }
+
+ // Build up the DOM representation for a single token, and add it to
+ // the line map. Takes care to render special characters separately.
+ function buildToken(builder, text, style, startStyle, endStyle, title) {
+ if (!text) return;
+ var special = builder.cm.options.specialChars, mustWrap = false;
+ if (!special.test(text)) {
+ builder.col += text.length;
+ var content = document.createTextNode(text);
+ builder.map.push(builder.pos, builder.pos + text.length, content);
+ if (ie_upto8) mustWrap = true;
+ builder.pos += text.length;
+ } else {
+ var content = document.createDocumentFragment(), pos = 0;
+ while (true) {
+ special.lastIndex = pos;
+ var m = special.exec(text);
+ var skipped = m ? m.index - pos : text.length - pos;
+ if (skipped) {
+ var txt = document.createTextNode(text.slice(pos, pos + skipped));
+ if (ie_upto8) content.appendChild(elt("span", [txt]));
+ else content.appendChild(txt);
+ builder.map.push(builder.pos, builder.pos + skipped, txt);
+ builder.col += skipped;
+ builder.pos += skipped;
+ }
+ if (!m) break;
+ pos += skipped + 1;
+ if (m[0] == "\t") {
+ var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;
+ var txt = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"));
+ builder.col += tabWidth;
+ } else {
+ var txt = builder.cm.options.specialCharPlaceholder(m[0]);
+ if (ie_upto8) content.appendChild(elt("span", [txt]));
+ else content.appendChild(txt);
+ builder.col += 1;
+ }
+ builder.map.push(builder.pos, builder.pos + 1, txt);
+ builder.pos++;
+ }
+ }
+ if (style || startStyle || endStyle || mustWrap) {
+ var fullStyle = style || "";
+ if (startStyle) fullStyle += startStyle;
+ if (endStyle) fullStyle += endStyle;
+ var token = elt("span", [content], fullStyle);
+ if (title) token.title = title;
+ return builder.content.appendChild(token);
+ }
+ builder.content.appendChild(content);
+ }
+
+ function buildTokenSplitSpaces(inner) {
+ function split(old) {
+ var out = " ";
+ for (var i = 0; i < old.length - 2; ++i) out += i % 2 ? " " : "\u00a0";
+ out += " ";
+ return out;
+ }
+ return function(builder, text, style, startStyle, endStyle, title) {
+ inner(builder, text.replace(/ {3,}/g, split), style, startStyle, endStyle, title);
+ };
+ }
+
+ // Work around nonsense dimensions being reported for stretches of
+ // right-to-left text.
+ function buildTokenBadBidi(inner, order) {
+ return function(builder, text, style, startStyle, endStyle, title) {
+ style = style ? style + " cm-force-border" : "cm-force-border";
+ var start = builder.pos, end = start + text.length;
+ for (;;) {
+ // Find the part that overlaps with the start of this text
+ for (var i = 0; i < order.length; i++) {
+ var part = order[i];
+ if (part.to > start && part.from <= start) break;
+ }
+ if (part.to >= end) return inner(builder, text, style, startStyle, endStyle, title);
+ inner(builder, text.slice(0, part.to - start), style, startStyle, null, title);
+ startStyle = null;
+ text = text.slice(part.to - start);
+ start = part.to;
+ }
+ };
+ }
+
+ function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
+ var widget = !ignoreWidget && marker.widgetNode;
+ if (widget) {
+ builder.map.push(builder.pos, builder.pos + size, widget);
+ builder.content.appendChild(widget);
+ }
+ builder.pos += size;
+ }
+
+ // Outputs a number of spans to make up a line, taking highlighting
+ // and marked text into account.
+ function insertLineContent(line, builder, styles) {
+ var spans = line.markedSpans, allText = line.text, at = 0;
+ if (!spans) {
+ for (var i = 1; i < styles.length; i+=2)
+ builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder));
+ return;
+ }
+
+ var len = allText.length, pos = 0, i = 1, text = "", style;
+ var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;
+ for (;;) {
+ if (nextChange == pos) { // Update current marker set
+ spanStyle = spanEndStyle = spanStartStyle = title = "";
+ collapsed = null; nextChange = Infinity;
+ var foundBookmarks = [];
+ for (var j = 0; j < spans.length; ++j) {
+ var sp = spans[j], m = sp.marker;
+ if (sp.from <= pos && (sp.to == null || sp.to > pos)) {
+ if (sp.to != null && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = ""; }
+ if (m.className) spanStyle += " " + m.className;
+ if (m.startStyle && sp.from == pos) spanStartStyle += " " + m.startStyle;
+ if (m.endStyle && sp.to == nextChange) spanEndStyle += " " + m.endStyle;
+ if (m.title && !title) title = m.title;
+ if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
+ collapsed = sp;
+ } else if (sp.from > pos && nextChange > sp.from) {
+ nextChange = sp.from;
+ }
+ if (m.type == "bookmark" && sp.from == pos && m.widgetNode) foundBookmarks.push(m);
+ }
+ if (collapsed && (collapsed.from || 0) == pos) {
+ buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
+ collapsed.marker, collapsed.from == null);
+ if (collapsed.to == null) return;
+ }
+ if (!collapsed && foundBookmarks.length) for (var j = 0; j < foundBookmarks.length; ++j)
+ buildCollapsedSpan(builder, 0, foundBookmarks[j]);
+ }
+ if (pos >= len) break;
+
+ var upto = Math.min(len, nextChange);
+ while (true) {
+ if (text) {
+ var end = pos + text.length;
+ if (!collapsed) {
+ var tokenText = end > upto ? text.slice(0, upto - pos) : text;
+ builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
+ spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title);
+ }
+ if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}
+ pos = end;
+ spanStartStyle = "";
+ }
+ text = allText.slice(at, at = styles[i++]);
+ style = interpretTokenStyle(styles[i++], builder);
+ }
+ }
+ }
+
+ // DOCUMENT DATA STRUCTURE
+
+ // By default, updates that start and end at the beginning of a line
+ // are treated specially, in order to make the association of line
+ // widgets and marker elements with the text behave more intuitive.
+ function isWholeLineUpdate(doc, change) {
+ return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
+ (!doc.cm || doc.cm.options.wholeLineUpdateBefore);
+ }
+
+ // Perform a change on the document data structure.
+ function updateDoc(doc, change, markedSpans, estimateHeight) {
+ function spansFor(n) {return markedSpans ? markedSpans[n] : null;}
+ function update(line, text, spans) {
+ updateLine(line, text, spans, estimateHeight);
+ signalLater(line, "change", line, change);
+ }
+
+ var from = change.from, to = change.to, text = change.text;
+ var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
+ var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;
+
+ // Adjust the line structure
+ if (isWholeLineUpdate(doc, change)) {
+ // This is a whole-line replace. Treated specially to make
+ // sure line objects move the way they are supposed to.
+ for (var i = 0, added = []; i < text.length - 1; ++i)
+ added.push(new Line(text[i], spansFor(i), estimateHeight));
+ update(lastLine, lastLine.text, lastSpans);
+ if (nlines) doc.remove(from.line, nlines);
+ if (added.length) doc.insert(from.line, added);
+ } else if (firstLine == lastLine) {
+ if (text.length == 1) {
+ update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
+ } else {
+ for (var added = [], i = 1; i < text.length - 1; ++i)
+ added.push(new Line(text[i], spansFor(i), estimateHeight));
+ added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));
+ update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
+ doc.insert(from.line + 1, added);
+ }
+ } else if (text.length == 1) {
+ update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));
+ doc.remove(from.line + 1, nlines);
+ } else {
+ update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
+ update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);
+ for (var i = 1, added = []; i < text.length - 1; ++i)
+ added.push(new Line(text[i], spansFor(i), estimateHeight));
+ if (nlines > 1) doc.remove(from.line + 1, nlines - 1);
+ doc.insert(from.line + 1, added);
+ }
+
+ signalLater(doc, "change", doc, change);
+ }
+
+ // The document is represented as a BTree consisting of leaves, with
+ // chunk of lines in them, and branches, with up to ten leaves or
+ // other branch nodes below them. The top node is always a branch
+ // node, and is the document object itself (meaning it has
+ // additional methods and properties).
+ //
+ // All nodes have parent links. The tree is used both to go from
+ // line numbers to line objects, and to go from objects to numbers.
+ // It also indexes by height, and is used to convert between height
+ // and line object, and to find the total height of the document.
+ //
+ // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
+
+ function LeafChunk(lines) {
+ this.lines = lines;
+ this.parent = null;
+ for (var i = 0, height = 0; i < lines.length; ++i) {
+ lines[i].parent = this;
+ height += lines[i].height;
+ }
+ this.height = height;
+ }
+
+ LeafChunk.prototype = {
+ chunkSize: function() { return this.lines.length; },
+ // Remove the n lines at offset 'at'.
+ removeInner: function(at, n) {
+ for (var i = at, e = at + n; i < e; ++i) {
+ var line = this.lines[i];
+ this.height -= line.height;
+ cleanUpLine(line);
+ signalLater(line, "delete");
+ }
+ this.lines.splice(at, n);
+ },
+ // Helper used to collapse a small branch into a single leaf.
+ collapse: function(lines) {
+ lines.push.apply(lines, this.lines);
+ },
+ // Insert the given array of lines at offset 'at', count them as
+ // having the given height.
+ insertInner: function(at, lines, height) {
+ this.height += height;
+ this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
+ for (var i = 0; i < lines.length; ++i) lines[i].parent = this;
+ },
+ // Used to iterate over a part of the tree.
+ iterN: function(at, n, op) {
+ for (var e = at + n; at < e; ++at)
+ if (op(this.lines[at])) return true;
+ }
+ };
+
+ function BranchChunk(children) {
+ this.children = children;
+ var size = 0, height = 0;
+ for (var i = 0; i < children.length; ++i) {
+ var ch = children[i];
+ size += ch.chunkSize(); height += ch.height;
+ ch.parent = this;
+ }
+ this.size = size;
+ this.height = height;
+ this.parent = null;
+ }
+
+ BranchChunk.prototype = {
+ chunkSize: function() { return this.size; },
+ removeInner: function(at, n) {
+ this.size -= n;
+ for (var i = 0; i < this.children.length; ++i) {
+ var child = this.children[i], sz = child.chunkSize();
+ if (at < sz) {
+ var rm = Math.min(n, sz - at), oldHeight = child.height;
+ child.removeInner(at, rm);
+ this.height -= oldHeight - child.height;
+ if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }
+ if ((n -= rm) == 0) break;
+ at = 0;
+ } else at -= sz;
+ }
+ // If the result is smaller than 25 lines, ensure that it is a
+ // single leaf node.
+ if (this.size - n < 25 &&
+ (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
+ var lines = [];
+ this.collapse(lines);
+ this.children = [new LeafChunk(lines)];
+ this.children[0].parent = this;
+ }
+ },
+ collapse: function(lines) {
+ for (var i = 0; i < this.children.length; ++i) this.children[i].collapse(lines);
+ },
+ insertInner: function(at, lines, height) {
+ this.size += lines.length;
+ this.height += height;
+ for (var i = 0; i < this.children.length; ++i) {
+ var child = this.children[i], sz = child.chunkSize();
+ if (at <= sz) {
+ child.insertInner(at, lines, height);
+ if (child.lines && child.lines.length > 50) {
+ while (child.lines.length > 50) {
+ var spilled = child.lines.splice(child.lines.length - 25, 25);
+ var newleaf = new LeafChunk(spilled);
+ child.height -= newleaf.height;
+ this.children.splice(i + 1, 0, newleaf);
+ newleaf.parent = this;
+ }
+ this.maybeSpill();
+ }
+ break;
+ }
+ at -= sz;
+ }
+ },
+ // When a node has grown, check whether it should be split.
+ maybeSpill: function() {
+ if (this.children.length <= 10) return;
+ var me = this;
+ do {
+ var spilled = me.children.splice(me.children.length - 5, 5);
+ var sibling = new BranchChunk(spilled);
+ if (!me.parent) { // Become the parent node
+ var copy = new BranchChunk(me.children);
+ copy.parent = me;
+ me.children = [copy, sibling];
+ me = copy;
+ } else {
+ me.size -= sibling.size;
+ me.height -= sibling.height;
+ var myIndex = indexOf(me.parent.children, me);
+ me.parent.children.splice(myIndex + 1, 0, sibling);
+ }
+ sibling.parent = me.parent;
+ } while (me.children.length > 10);
+ me.parent.maybeSpill();
+ },
+ iterN: function(at, n, op) {
+ for (var i = 0; i < this.children.length; ++i) {
+ var child = this.children[i], sz = child.chunkSize();
+ if (at < sz) {
+ var used = Math.min(n, sz - at);
+ if (child.iterN(at, used, op)) return true;
+ if ((n -= used) == 0) break;
+ at = 0;
+ } else at -= sz;
+ }
+ }
+ };
+
+ var nextDocId = 0;
+ var Doc = CodeMirror.Doc = function(text, mode, firstLine) {
+ if (!(this instanceof Doc)) return new Doc(text, mode, firstLine);
+ if (firstLine == null) firstLine = 0;
+
+ BranchChunk.call(this, [new LeafChunk([new Line("", null)])]);
+ this.first = firstLine;
+ this.scrollTop = this.scrollLeft = 0;
+ this.cantEdit = false;
+ this.cleanGeneration = 1;
+ this.frontier = firstLine;
+ var start = Pos(firstLine, 0);
+ this.sel = simpleSelection(start);
+ this.history = new History(null);
+ this.id = ++nextDocId;
+ this.modeOption = mode;
+
+ if (typeof text == "string") text = splitLines(text);
+ updateDoc(this, {from: start, to: start, text: text});
+ setSelection(this, simpleSelection(start), sel_dontScroll);
+ };
+
+ Doc.prototype = createObj(BranchChunk.prototype, {
+ constructor: Doc,
+ // Iterate over the document. Supports two forms -- with only one
+ // argument, it calls that for each line in the document. With
+ // three, it iterates over the range given by the first two (with
+ // the second being non-inclusive).
+ iter: function(from, to, op) {
+ if (op) this.iterN(from - this.first, to - from, op);
+ else this.iterN(this.first, this.first + this.size, from);
+ },
+
+ // Non-public interface for adding and removing lines.
+ insert: function(at, lines) {
+ var height = 0;
+ for (var i = 0; i < lines.length; ++i) height += lines[i].height;
+ this.insertInner(at - this.first, lines, height);
+ },
+ remove: function(at, n) { this.removeInner(at - this.first, n); },
+
+ // From here, the methods are part of the public interface. Most
+ // are also available from CodeMirror (editor) instances.
+
+ getValue: function(lineSep) {
+ var lines = getLines(this, this.first, this.first + this.size);
+ if (lineSep === false) return lines;
+ return lines.join(lineSep || "\n");
+ },
+ setValue: docMethodOp(function(code) {
+ var top = Pos(this.first, 0), last = this.first + this.size - 1;
+ makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
+ text: splitLines(code), origin: "setValue"}, true);
+ setSelection(this, simpleSelection(top));
+ }),
+ replaceRange: function(code, from, to, origin) {
+ from = clipPos(this, from);
+ to = to ? clipPos(this, to) : from;
+ replaceRange(this, code, from, to, origin);
+ },
+ getRange: function(from, to, lineSep) {
+ var lines = getBetween(this, clipPos(this, from), clipPos(this, to));
+ if (lineSep === false) return lines;
+ return lines.join(lineSep || "\n");
+ },
+
+ getLine: function(line) {var l = this.getLineHandle(line); return l && l.text;},
+
+ getLineHandle: function(line) {if (isLine(this, line)) return getLine(this, line);},
+ getLineNumber: function(line) {return lineNo(line);},
+
+ getLineHandleVisualStart: function(line) {
+ if (typeof line == "number") line = getLine(this, line);
+ return visualLine(line);
+ },
+
+ lineCount: function() {return this.size;},
+ firstLine: function() {return this.first;},
+ lastLine: function() {return this.first + this.size - 1;},
+
+ clipPos: function(pos) {return clipPos(this, pos);},
+
+ getCursor: function(start) {
+ var range = this.sel.primary(), pos;
+ if (start == null || start == "head") pos = range.head;
+ else if (start == "anchor") pos = range.anchor;
+ else if (start == "end" || start == "to" || start === false) pos = range.to();
+ else pos = range.from();
+ return pos;
+ },
+ listSelections: function() { return this.sel.ranges; },
+ somethingSelected: function() {return this.sel.somethingSelected();},
+
+ setCursor: docMethodOp(function(line, ch, options) {
+ setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options);
+ }),
+ setSelection: docMethodOp(function(anchor, head, options) {
+ setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);
+ }),
+ extendSelection: docMethodOp(function(head, other, options) {
+ extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);
+ }),
+ extendSelections: docMethodOp(function(heads, options) {
+ extendSelections(this, clipPosArray(this, heads, options));
+ }),
+ extendSelectionsBy: docMethodOp(function(f, options) {
+ extendSelections(this, map(this.sel.ranges, f), options);
+ }),
+ setSelections: docMethodOp(function(ranges, primary, options) {
+ if (!ranges.length) return;
+ for (var i = 0, out = []; i < ranges.length; i++)
+ out[i] = new Range(clipPos(this, ranges[i].anchor),
+ clipPos(this, ranges[i].head));
+ if (primary == null) primary = Math.min(ranges.length - 1, this.sel.primIndex);
+ setSelection(this, normalizeSelection(out, primary), options);
+ }),
+ addSelection: docMethodOp(function(anchor, head, options) {
+ var ranges = this.sel.ranges.slice(0);
+ ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));
+ setSelection(this, normalizeSelection(ranges, ranges.length - 1), options);
+ }),
+
+ getSelection: function(lineSep) {
+ var ranges = this.sel.ranges, lines;
+ for (var i = 0; i < ranges.length; i++) {
+ var sel = getBetween(this, ranges[i].from(), ranges[i].to());
+ lines = lines ? lines.concat(sel) : sel;
+ }
+ if (lineSep === false) return lines;
+ else return lines.join(lineSep || "\n");
+ },
+ getSelections: function(lineSep) {
+ var parts = [], ranges = this.sel.ranges;
+ for (var i = 0; i < ranges.length; i++) {
+ var sel = getBetween(this, ranges[i].from(), ranges[i].to());
+ if (lineSep !== false) sel = sel.join(lineSep || "\n");
+ parts[i] = sel;
+ }
+ return parts;
+ },
+ replaceSelection: docMethodOp(function(code, collapse, origin) {
+ var dup = [];
+ for (var i = 0; i < this.sel.ranges.length; i++)
+ dup[i] = code;
+ this.replaceSelections(dup, collapse, origin || "+input");
+ }),
+ replaceSelections: function(code, collapse, origin) {
+ var changes = [], sel = this.sel;
+ for (var i = 0; i < sel.ranges.length; i++) {
+ var range = sel.ranges[i];
+ changes[i] = {from: range.from(), to: range.to(), text: splitLines(code[i]), origin: origin};
+ }
+ var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse);
+ for (var i = changes.length - 1; i >= 0; i--)
+ makeChange(this, changes[i]);
+ if (newSel) setSelectionReplaceHistory(this, newSel);
+ else if (this.cm) ensureCursorVisible(this.cm);
+ },
+ undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}),
+ redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}),
+ undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}),
+ redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}),
+
+ setExtending: function(val) {this.extend = val;},
+ getExtending: function() {return this.extend;},
+
+ historySize: function() {
+ var hist = this.history, done = 0, undone = 0;
+ for (var i = 0; i < hist.done.length; i++) if (!hist.done[i].ranges) ++done;
+ for (var i = 0; i < hist.undone.length; i++) if (!hist.undone[i].ranges) ++undone;
+ return {undo: done, redo: undone};
+ },
+ clearHistory: function() {this.history = new History(this.history.maxGeneration);},
+
+ markClean: function() {
+ this.cleanGeneration = this.changeGeneration(true);
+ },
+ changeGeneration: function(forceSplit) {
+ if (forceSplit)
+ this.history.lastOp = this.history.lastOrigin = null;
+ return this.history.generation;
+ },
+ isClean: function (gen) {
+ return this.history.generation == (gen || this.cleanGeneration);
+ },
+
+ getHistory: function() {
+ return {done: copyHistoryArray(this.history.done),
+ undone: copyHistoryArray(this.history.undone)};
+ },
+ setHistory: function(histData) {
+ var hist = this.history = new History(this.history.maxGeneration);
+ hist.done = copyHistoryArray(histData.done.slice(0), null, true);
+ hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);
+ },
+
+ markText: function(from, to, options) {
+ return markText(this, clipPos(this, from), clipPos(this, to), options, "range");
+ },
+ setBookmark: function(pos, options) {
+ var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
+ insertLeft: options && options.insertLeft,
+ clearWhenEmpty: false, shared: options && options.shared};
+ pos = clipPos(this, pos);
+ return markText(this, pos, pos, realOpts, "bookmark");
+ },
+ findMarksAt: function(pos) {
+ pos = clipPos(this, pos);
+ var markers = [], spans = getLine(this, pos.line).markedSpans;
+ if (spans) for (var i = 0; i < spans.length; ++i) {
+ var span = spans[i];
+ if ((span.from == null || span.from <= pos.ch) &&
+ (span.to == null || span.to >= pos.ch))
+ markers.push(span.marker.parent || span.marker);
+ }
+ return markers;
+ },
+ findMarks: function(from, to) {
+ from = clipPos(this, from); to = clipPos(this, to);
+ var found = [], lineNo = from.line;
+ this.iter(from.line, to.line + 1, function(line) {
+ var spans = line.markedSpans;
+ if (spans) for (var i = 0; i < spans.length; i++) {
+ var span = spans[i];
+ if (!(lineNo == from.line && from.ch > span.to ||
+ span.from == null && lineNo != from.line||
+ lineNo == to.line && span.from > to.ch))
+ found.push(span.marker.parent || span.marker);
+ }
+ ++lineNo;
+ });
+ return found;
+ },
+ getAllMarks: function() {
+ var markers = [];
+ this.iter(function(line) {
+ var sps = line.markedSpans;
+ if (sps) for (var i = 0; i < sps.length; ++i)
+ if (sps[i].from != null) markers.push(sps[i].marker);
+ });
+ return markers;
+ },
+
+ posFromIndex: function(off) {
+ var ch, lineNo = this.first;
+ this.iter(function(line) {
+ var sz = line.text.length + 1;
+ if (sz > off) { ch = off; return true; }
+ off -= sz;
+ ++lineNo;
+ });
+ return clipPos(this, Pos(lineNo, ch));
+ },
+ indexFromPos: function (coords) {
+ coords = clipPos(this, coords);
+ var index = coords.ch;
+ if (coords.line < this.first || coords.ch < 0) return 0;
+ this.iter(this.first, coords.line, function (line) {
+ index += line.text.length + 1;
+ });
+ return index;
+ },
+
+ copy: function(copyHistory) {
+ var doc = new Doc(getLines(this, this.first, this.first + this.size), this.modeOption, this.first);
+ doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;
+ doc.sel = this.sel;
+ doc.extend = false;
+ if (copyHistory) {
+ doc.history.undoDepth = this.history.undoDepth;
+ doc.setHistory(this.getHistory());
+ }
+ return doc;
+ },
+
+ linkedDoc: function(options) {
+ if (!options) options = {};
+ var from = this.first, to = this.first + this.size;
+ if (options.from != null && options.from > from) from = options.from;
+ if (options.to != null && options.to < to) to = options.to;
+ var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from);
+ if (options.sharedHist) copy.history = this.history;
+ (this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});
+ copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];
+ return copy;
+ },
+ unlinkDoc: function(other) {
+ if (other instanceof CodeMirror) other = other.doc;
+ if (this.linked) for (var i = 0; i < this.linked.length; ++i) {
+ var link = this.linked[i];
+ if (link.doc != other) continue;
+ this.linked.splice(i, 1);
+ other.unlinkDoc(this);
+ break;
+ }
+ // If the histories were shared, split them again
+ if (other.history == this.history) {
+ var splitIds = [other.id];
+ linkedDocs(other, function(doc) {splitIds.push(doc.id);}, true);
+ other.history = new History(null);
+ other.history.done = copyHistoryArray(this.history.done, splitIds);
+ other.history.undone = copyHistoryArray(this.history.undone, splitIds);
+ }
+ },
+ iterLinkedDocs: function(f) {linkedDocs(this, f);},
+
+ getMode: function() {return this.mode;},
+ getEditor: function() {return this.cm;}
+ });
+
+ // Public alias.
+ Doc.prototype.eachLine = Doc.prototype.iter;
+
+ // Set up methods on CodeMirror's prototype to redirect to the editor's document.
+ var dontDelegate = "iter insert remove copy getEditor".split(" ");
+ for (var prop in Doc.prototype) if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
+ CodeMirror.prototype[prop] = (function(method) {
+ return function() {return method.apply(this.doc, arguments);};
+ })(Doc.prototype[prop]);
+
+ eventMixin(Doc);
+
+ // Call f for all linked documents.
+ function linkedDocs(doc, f, sharedHistOnly) {
+ function propagate(doc, skip, sharedHist) {
+ if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {
+ var rel = doc.linked[i];
+ if (rel.doc == skip) continue;
+ var shared = sharedHist && rel.sharedHist;
+ if (sharedHistOnly && !shared) continue;
+ f(rel.doc, shared);
+ propagate(rel.doc, doc, shared);
+ }
+ }
+ propagate(doc, null, true);
+ }
+
+ // Attach a document to an editor.
+ function attachDoc(cm, doc) {
+ if (doc.cm) throw new Error("This document is already in use.");
+ cm.doc = doc;
+ doc.cm = cm;
+ estimateLineHeights(cm);
+ loadMode(cm);
+ if (!cm.options.lineWrapping) findMaxLine(cm);
+ cm.options.mode = doc.modeOption;
+ regChange(cm);
+ }
+
+ // LINE UTILITIES
+
+ // Find the line object corresponding to the given line number.
+ function getLine(doc, n) {
+ n -= doc.first;
+ if (n < 0 || n >= doc.size) throw new Error("There is no line " + (n + doc.first) + " in the document.");
+ for (var chunk = doc; !chunk.lines;) {
+ for (var i = 0;; ++i) {
+ var child = chunk.children[i], sz = child.chunkSize();
+ if (n < sz) { chunk = child; break; }
+ n -= sz;
+ }
+ }
+ return chunk.lines[n];
+ }
+
+ // Get the part of a document between two positions, as an array of
+ // strings.
+ function getBetween(doc, start, end) {
+ var out = [], n = start.line;
+ doc.iter(start.line, end.line + 1, function(line) {
+ var text = line.text;
+ if (n == end.line) text = text.slice(0, end.ch);
+ if (n == start.line) text = text.slice(start.ch);
+ out.push(text);
+ ++n;
+ });
+ return out;
+ }
+ // Get the lines between from and to, as array of strings.
+ function getLines(doc, from, to) {
+ var out = [];
+ doc.iter(from, to, function(line) { out.push(line.text); });
+ return out;
+ }
+
+ // Update the height of a line, propagating the height change
+ // upwards to parent nodes.
+ function updateLineHeight(line, height) {
+ var diff = height - line.height;
+ if (diff) for (var n = line; n; n = n.parent) n.height += diff;
+ }
+
+ // Given a line object, find its line number by walking up through
+ // its parent links.
+ function lineNo(line) {
+ if (line.parent == null) return null;
+ var cur = line.parent, no = indexOf(cur.lines, line);
+ for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
+ for (var i = 0;; ++i) {
+ if (chunk.children[i] == cur) break;
+ no += chunk.children[i].chunkSize();
+ }
+ }
+ return no + cur.first;
+ }
+
+ // Find the line at the given vertical position, using the height
+ // information in the document tree.
+ function lineAtHeight(chunk, h) {
+ var n = chunk.first;
+ outer: do {
+ for (var i = 0; i < chunk.children.length; ++i) {
+ var child = chunk.children[i], ch = child.height;
+ if (h < ch) { chunk = child; continue outer; }
+ h -= ch;
+ n += child.chunkSize();
+ }
+ return n;
+ } while (!chunk.lines);
+ for (var i = 0; i < chunk.lines.length; ++i) {
+ var line = chunk.lines[i], lh = line.height;
+ if (h < lh) break;
+ h -= lh;
+ }
+ return n + i;
+ }
+
+
+ // Find the height above the given line.
+ function heightAtLine(lineObj) {
+ lineObj = visualLine(lineObj);
+
+ var h = 0, chunk = lineObj.parent;
+ for (var i = 0; i < chunk.lines.length; ++i) {
+ var line = chunk.lines[i];
+ if (line == lineObj) break;
+ else h += line.height;
+ }
+ for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
+ for (var i = 0; i < p.children.length; ++i) {
+ var cur = p.children[i];
+ if (cur == chunk) break;
+ else h += cur.height;
+ }
+ }
+ return h;
+ }
+
+ // Get the bidi ordering for the given line (and cache it). Returns
+ // false for lines that are fully left-to-right, and an array of
+ // BidiSpan objects otherwise.
+ function getOrder(line) {
+ var order = line.order;
+ if (order == null) order = line.order = bidiOrdering(line.text);
+ return order;
+ }
+
+ // HISTORY
+
+ function History(startGen) {
+ // Arrays of change events and selections. Doing something adds an
+ // event to done and clears undo. Undoing moves events from done
+ // to undone, redoing moves them in the other direction.
+ this.done = []; this.undone = [];
+ this.undoDepth = Infinity;
+ // Used to track when changes can be merged into a single undo
+ // event
+ this.lastModTime = this.lastSelTime = 0;
+ this.lastOp = null;
+ this.lastOrigin = this.lastSelOrigin = null;
+ // Used by the isClean() method
+ this.generation = this.maxGeneration = startGen || 1;
+ }
+
+ // Create a history change event from an updateDoc-style change
+ // object.
+ function historyChangeFromChange(doc, change) {
+ var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};
+ attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);
+ linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);
+ return histChange;
+ }
+
+ // Pop all selection events off the end of a history array. Stop at
+ // a change event.
+ function clearSelectionEvents(array) {
+ while (array.length) {
+ var last = lst(array);
+ if (last.ranges) array.pop();
+ else break;
+ }
+ }
+
+ // Find the top change event in the history. Pop off selection
+ // events that are in the way.
+ function lastChangeEvent(hist, force) {
+ if (force) {
+ clearSelectionEvents(hist.done);
+ return lst(hist.done);
+ } else if (hist.done.length && !lst(hist.done).ranges) {
+ return lst(hist.done);
+ } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
+ hist.done.pop();
+ return lst(hist.done);
+ }
+ }
+
+ // Register a change in the history. Merges changes that are within
+ // a single operation, ore are close together with an origin that
+ // allows merging (starting with "+") into a single event.
+ function addChangeToHistory(doc, change, selAfter, opId) {
+ var hist = doc.history;
+ hist.undone.length = 0;
+ var time = +new Date, cur;
+
+ if ((hist.lastOp == opId ||
+ hist.lastOrigin == change.origin && change.origin &&
+ ((change.origin.charAt(0) == "+" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||
+ change.origin.charAt(0) == "*")) &&
+ (cur = lastChangeEvent(hist, hist.lastOp == opId))) {
+ // Merge this change into the last event
+ var last = lst(cur.changes);
+ if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
+ // Optimized case for simple insertion -- don't want to add
+ // new changesets for every character typed
+ last.to = changeEnd(change);
+ } else {
+ // Add new sub-event
+ cur.changes.push(historyChangeFromChange(doc, change));
+ }
+ } else {
+ // Can not be merged, start a new event.
+ var before = lst(hist.done);
+ if (!before || !before.ranges)
+ pushSelectionToHistory(doc.sel, hist.done);
+ cur = {changes: [historyChangeFromChange(doc, change)],
+ generation: hist.generation};
+ hist.done.push(cur);
+ while (hist.done.length > hist.undoDepth) {
+ hist.done.shift();
+ if (!hist.done[0].ranges) hist.done.shift();
+ }
+ }
+ hist.done.push(selAfter);
+ hist.generation = ++hist.maxGeneration;
+ hist.lastModTime = hist.lastSelTime = time;
+ hist.lastOp = opId;
+ hist.lastOrigin = hist.lastSelOrigin = change.origin;
+
+ if (!last) signal(doc, "historyAdded");
+ }
+
+ function selectionEventCanBeMerged(doc, origin, prev, sel) {
+ var ch = origin.charAt(0);
+ return ch == "*" ||
+ ch == "+" &&
+ prev.ranges.length == sel.ranges.length &&
+ prev.somethingSelected() == sel.somethingSelected() &&
+ new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500);
+ }
+
+ // Called whenever the selection changes, sets the new selection as
+ // the pending selection in the history, and pushes the old pending
+ // selection into the 'done' array when it was significantly
+ // different (in number of selected ranges, emptiness, or time).
+ function addSelectionToHistory(doc, sel, opId, options) {
+ var hist = doc.history, origin = options && options.origin;
+
+ // A new event is started when the previous origin does not match
+ // the current, or the origins don't allow matching. Origins
+ // starting with * are always merged, those starting with + are
+ // merged when similar and close together in time.
+ if (opId == hist.lastOp ||
+ (origin && hist.lastSelOrigin == origin &&
+ (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
+ selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
+ hist.done[hist.done.length - 1] = sel;
+ else
+ pushSelectionToHistory(sel, hist.done);
+
+ hist.lastSelTime = +new Date;
+ hist.lastSelOrigin = origin;
+ hist.lastOp = opId;
+ if (options && options.clearRedo !== false)
+ clearSelectionEvents(hist.undone);
+ }
+
+ function pushSelectionToHistory(sel, dest) {
+ var top = lst(dest);
+ if (!(top && top.ranges && top.equals(sel)))
+ dest.push(sel);
+ }
+
+ // Used to store marked span information in the history.
+ function attachLocalSpans(doc, change, from, to) {
+ var existing = change["spans_" + doc.id], n = 0;
+ doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {
+ if (line.markedSpans)
+ (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans;
+ ++n;
+ });
+ }
+
+ // When un/re-doing restores text containing marked spans, those
+ // that have been explicitly cleared should not be restored.
+ function removeClearedSpans(spans) {
+ if (!spans) return null;
+ for (var i = 0, out; i < spans.length; ++i) {
+ if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }
+ else if (out) out.push(spans[i]);
+ }
+ return !out ? spans : out.length ? out : null;
+ }
+
+ // Retrieve and filter the old marked spans stored in a change event.
+ function getOldSpans(doc, change) {
+ var found = change["spans_" + doc.id];
+ if (!found) return null;
+ for (var i = 0, nw = []; i < change.text.length; ++i)
+ nw.push(removeClearedSpans(found[i]));
+ return nw;
+ }
+
+ // Used both to provide a JSON-safe object in .getHistory, and, when
+ // detaching a document, to split the history in two
+ function copyHistoryArray(events, newGroup, instantiateSel) {
+ for (var i = 0, copy = []; i < events.length; ++i) {
+ var event = events[i];
+ if (event.ranges) {
+ copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);
+ continue;
+ }
+ var changes = event.changes, newChanges = [];
+ copy.push({changes: newChanges});
+ for (var j = 0; j < changes.length; ++j) {
+ var change = changes[j], m;
+ newChanges.push({from: change.from, to: change.to, text: change.text});
+ if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\d+)$/)) {
+ if (indexOf(newGroup, Number(m[1])) > -1) {
+ lst(newChanges)[prop] = change[prop];
+ delete change[prop];
+ }
+ }
+ }
+ }
+ return copy;
+ }
+
+ // Rebasing/resetting history to deal with externally-sourced changes
+
+ function rebaseHistSelSingle(pos, from, to, diff) {
+ if (to < pos.line) {
+ pos.line += diff;
+ } else if (from < pos.line) {
+ pos.line = from;
+ pos.ch = 0;
+ }
+ }
+
+ // Tries to rebase an array of history events given a change in the
+ // document. If the change touches the same lines as the event, the
+ // event, and everything 'behind' it, is discarded. If the change is
+ // before the event, the event's positions are updated. Uses a
+ // copy-on-write scheme for the positions, to avoid having to
+ // reallocate them all on every rebase, but also avoid problems with
+ // shared position objects being unsafely updated.
+ function rebaseHistArray(array, from, to, diff) {
+ for (var i = 0; i < array.length; ++i) {
+ var sub = array[i], ok = true;
+ if (sub.ranges) {
+ if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }
+ for (var j = 0; j < sub.ranges.length; j++) {
+ rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);
+ rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);
+ }
+ continue;
+ }
+ for (var j = 0; j < sub.changes.length; ++j) {
+ var cur = sub.changes[j];
+ if (to < cur.from.line) {
+ cur.from = Pos(cur.from.line + diff, cur.from.ch);
+ cur.to = Pos(cur.to.line + diff, cur.to.ch);
+ } else if (from <= cur.to.line) {
+ ok = false;
+ break;
+ }
+ }
+ if (!ok) {
+ array.splice(0, i + 1);
+ i = 0;
+ }
+ }
+ }
+
+ function rebaseHist(hist, change) {
+ var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
+ rebaseHistArray(hist.done, from, to, diff);
+ rebaseHistArray(hist.undone, from, to, diff);
+ }
+
+ // EVENT UTILITIES
+
+ // Due to the fact that we still support jurassic IE versions, some
+ // compatibility wrappers are needed.
+
+ var e_preventDefault = CodeMirror.e_preventDefault = function(e) {
+ if (e.preventDefault) e.preventDefault();
+ else e.returnValue = false;
+ };
+ var e_stopPropagation = CodeMirror.e_stopPropagation = function(e) {
+ if (e.stopPropagation) e.stopPropagation();
+ else e.cancelBubble = true;
+ };
+ function e_defaultPrevented(e) {
+ return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false;
+ }
+ var e_stop = CodeMirror.e_stop = function(e) {e_preventDefault(e); e_stopPropagation(e);};
+
+ function e_target(e) {return e.target || e.srcElement;}
+ function e_button(e) {
+ var b = e.which;
+ if (b == null) {
+ if (e.button & 1) b = 1;
+ else if (e.button & 2) b = 3;
+ else if (e.button & 4) b = 2;
+ }
+ if (mac && e.ctrlKey && b == 1) b = 3;
+ return b;
+ }
+
+ // EVENT HANDLING
+
+ // Lightweight event framework. on/off also work on DOM nodes,
+ // registering native DOM handlers.
+
+ var on = CodeMirror.on = function(emitter, type, f) {
+ if (emitter.addEventListener)
+ emitter.addEventListener(type, f, false);
+ else if (emitter.attachEvent)
+ emitter.attachEvent("on" + type, f);
+ else {
+ var map = emitter._handlers || (emitter._handlers = {});
+ var arr = map[type] || (map[type] = []);
+ arr.push(f);
+ }
+ };
+
+ var off = CodeMirror.off = function(emitter, type, f) {
+ if (emitter.removeEventListener)
+ emitter.removeEventListener(type, f, false);
+ else if (emitter.detachEvent)
+ emitter.detachEvent("on" + type, f);
+ else {
+ var arr = emitter._handlers && emitter._handlers[type];
+ if (!arr) return;
+ for (var i = 0; i < arr.length; ++i)
+ if (arr[i] == f) { arr.splice(i, 1); break; }
+ }
+ };
+
+ var signal = CodeMirror.signal = function(emitter, type /*, values...*/) {
+ var arr = emitter._handlers && emitter._handlers[type];
+ if (!arr) return;
+ var args = Array.prototype.slice.call(arguments, 2);
+ for (var i = 0; i < arr.length; ++i) arr[i].apply(null, args);
+ };
+
+ // Often, we want to signal events at a point where we are in the
+ // middle of some work, but don't want the handler to start calling
+ // other methods on the editor, which might be in an inconsistent
+ // state or simply not expect any other events to happen.
+ // signalLater looks whether there are any handlers, and schedules
+ // them to be executed when the last operation ends, or, if no
+ // operation is active, when a timeout fires.
+ var delayedCallbacks, delayedCallbackDepth = 0;
+ function signalLater(emitter, type /*, values...*/) {
+ var arr = emitter._handlers && emitter._handlers[type];
+ if (!arr) return;
+ var args = Array.prototype.slice.call(arguments, 2);
+ if (!delayedCallbacks) {
+ ++delayedCallbackDepth;
+ delayedCallbacks = [];
+ setTimeout(fireDelayed, 0);
+ }
+ function bnd(f) {return function(){f.apply(null, args);};};
+ for (var i = 0; i < arr.length; ++i)
+ delayedCallbacks.push(bnd(arr[i]));
+ }
+
+ function fireDelayed() {
+ --delayedCallbackDepth;
+ var delayed = delayedCallbacks;
+ delayedCallbacks = null;
+ for (var i = 0; i < delayed.length; ++i) delayed[i]();
+ }
+
+ // The DOM events that CodeMirror handles can be overridden by
+ // registering a (non-DOM) handler on the editor for the event name,
+ // and preventDefault-ing the event in that handler.
+ function signalDOMEvent(cm, e, override) {
+ signal(cm, override || e.type, cm, e);
+ return e_defaultPrevented(e) || e.codemirrorIgnore;
+ }
+
+ function hasHandler(emitter, type) {
+ var arr = emitter._handlers && emitter._handlers[type];
+ return arr && arr.length > 0;
+ }
+
+ // Add on and off methods to a constructor's prototype, to make
+ // registering events on such objects more convenient.
+ function eventMixin(ctor) {
+ ctor.prototype.on = function(type, f) {on(this, type, f);};
+ ctor.prototype.off = function(type, f) {off(this, type, f);};
+ }
+
+ // MISC UTILITIES
+
+ // Number of pixels added to scroller and sizer to hide scrollbar
+ var scrollerCutOff = 30;
+
+ // Returned or thrown by various protocols to signal 'I'm not
+ // handling this'.
+ var Pass = CodeMirror.Pass = {toString: function(){return "CodeMirror.Pass";}};
+
+ // Reused option objects for setSelection & friends
+ var sel_dontScroll = {scroll: false}, sel_mouse = {origin: "*mouse"}, sel_move = {origin: "+move"};
+
+ function Delayed() {this.id = null;}
+ Delayed.prototype.set = function(ms, f) {
+ clearTimeout(this.id);
+ this.id = setTimeout(f, ms);
+ };
+
+ // Counts the column offset in a string, taking tabs into account.
+ // Used mostly to find indentation.
+ var countColumn = CodeMirror.countColumn = function(string, end, tabSize, startIndex, startValue) {
+ if (end == null) {
+ end = string.search(/[^\s\u00a0]/);
+ if (end == -1) end = string.length;
+ }
+ for (var i = startIndex || 0, n = startValue || 0;;) {
+ var nextTab = string.indexOf("\t", i);
+ if (nextTab < 0 || nextTab >= end)
+ return n + (end - i);
+ n += nextTab - i;
+ n += tabSize - (n % tabSize);
+ i = nextTab + 1;
+ }
+ };
+
+ // The inverse of countColumn -- find the offset that corresponds to
+ // a particular column.
+ function findColumn(string, goal, tabSize) {
+ for (var pos = 0, col = 0;;) {
+ var nextTab = string.indexOf("\t", pos);
+ if (nextTab == -1) nextTab = string.length;
+ var skipped = nextTab - pos;
+ if (nextTab == string.length || col + skipped >= goal)
+ return pos + Math.min(skipped, goal - col);
+ col += nextTab - pos;
+ col += tabSize - (col % tabSize);
+ pos = nextTab + 1;
+ if (col >= goal) return pos;
+ }
+ }
+
+ var spaceStrs = [""];
+ function spaceStr(n) {
+ while (spaceStrs.length <= n)
+ spaceStrs.push(lst(spaceStrs) + " ");
+ return spaceStrs[n];
+ }
+
+ function lst(arr) { return arr[arr.length-1]; }
+
+ var selectInput = function(node) { node.select(); };
+ if (ios) // Mobile Safari apparently has a bug where select() is broken.
+ selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; };
+ else if (ie) // Suppress mysterious IE10 errors
+ selectInput = function(node) { try { node.select(); } catch(_e) {} };
+
+ function indexOf(array, elt) {
+ for (var i = 0; i < array.length; ++i)
+ if (array[i] == elt) return i;
+ return -1;
+ }
+ if ([].indexOf) indexOf = function(array, elt) { return array.indexOf(elt); };
+ function map(array, f) {
+ var out = [];
+ for (var i = 0; i < array.length; i++) out[i] = f(array[i], i);
+ return out;
+ }
+ if ([].map) map = function(array, f) { return array.map(f); };
+
+ function createObj(base, props) {
+ var inst;
+ if (Object.create) {
+ inst = Object.create(base);
+ } else {
+ var ctor = function() {};
+ ctor.prototype = base;
+ inst = new ctor();
+ }
+ if (props) copyObj(props, inst);
+ return inst;
+ };
+
+ function copyObj(obj, target) {
+ if (!target) target = {};
+ for (var prop in obj) if (obj.hasOwnProperty(prop)) target[prop] = obj[prop];
+ return target;
+ }
+
+ function bind(f) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ return function(){return f.apply(null, args);};
+ }
+
+ var nonASCIISingleCaseWordChar = /[\u00df\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
+ var isWordChar = CodeMirror.isWordChar = function(ch) {
+ return /\w/.test(ch) || ch > "\x80" &&
+ (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch));
+ };
+
+ function isEmpty(obj) {
+ for (var n in obj) if (obj.hasOwnProperty(n) && obj[n]) return false;
+ return true;
+ }
+
+ // Extending unicode characters. A series of a non-extending char +
+ // any number of extending chars is treated as a single unit as far
+ // as editing and measuring is concerned. This is not fully correct,
+ // since some scripts/fonts/browsers also treat other configurations
+ // of code points as a group.
+ var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;
+ function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch); }
+
+ // DOM UTILITIES
+
+ function elt(tag, content, className, style) {
+ var e = document.createElement(tag);
+ if (className) e.className = className;
+ if (style) e.style.cssText = style;
+ if (typeof content == "string") e.appendChild(document.createTextNode(content));
+ else if (content) for (var i = 0; i < content.length; ++i) e.appendChild(content[i]);
+ return e;
+ }
+
+ var range;
+ if (document.createRange) range = function(node, start, end) {
+ var r = document.createRange();
+ r.setEnd(node, end);
+ r.setStart(node, start);
+ return r;
+ };
+ else range = function(node, start, end) {
+ var r = document.body.createTextRange();
+ r.moveToElementText(node.parentNode);
+ r.collapse(true);
+ r.moveEnd("character", end);
+ r.moveStart("character", start);
+ return r;
+ };
+
+ function removeChildren(e) {
+ for (var count = e.childNodes.length; count > 0; --count)
+ e.removeChild(e.firstChild);
+ return e;
+ }
+
+ function removeChildrenAndAdd(parent, e) {
+ return removeChildren(parent).appendChild(e);
+ }
+
+ function contains(parent, child) {
+ if (parent.contains)
+ return parent.contains(child);
+ while (child = child.parentNode)
+ if (child == parent) return true;
+ }
+
+ function activeElt() { return document.activeElement; }
+ // Older versions of IE throws unspecified error when touching
+ // document.activeElement in some cases (during loading, in iframe)
+ if (ie_upto10) activeElt = function() {
+ try { return document.activeElement; }
+ catch(e) { return document.body; }
+ };
+
+ // FEATURE DETECTION
+
+ // Detect drag-and-drop
+ var dragAndDrop = function() {
+ // There is *some* kind of drag-and-drop support in IE6-8, but I
+ // couldn't get it to work yet.
+ if (ie_upto8) return false;
+ var div = elt('div');
+ return "draggable" in div || "dragDrop" in div;
+ }();
+
+ var knownScrollbarWidth;
+ function scrollbarWidth(measure) {
+ if (knownScrollbarWidth != null) return knownScrollbarWidth;
+ var test = elt("div", null, null, "width: 50px; height: 50px; overflow-x: scroll");
+ removeChildrenAndAdd(measure, test);
+ if (test.offsetWidth)
+ knownScrollbarWidth = test.offsetHeight - test.clientHeight;
+ return knownScrollbarWidth || 0;
+ }
+
+ var zwspSupported;
+ function zeroWidthElement(measure) {
+ if (zwspSupported == null) {
+ var test = elt("span", "\u200b");
+ removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
+ if (measure.firstChild.offsetHeight != 0)
+ zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !ie_upto7;
+ }
+ if (zwspSupported) return elt("span", "\u200b");
+ else return elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
+ }
+
+ // Feature-detect IE's crummy client rect reporting for bidi text
+ var badBidiRects;
+ function hasBadBidiRects(measure) {
+ if (badBidiRects != null) return badBidiRects;
+ var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"));
+ var r0 = range(txt, 0, 1).getBoundingClientRect();
+ if (r0.left == r0.right) return false;
+ var r1 = range(txt, 1, 2).getBoundingClientRect();
+ return badBidiRects = (r1.right - r0.right < 3);
+ }
+
+ // See if "".split is the broken IE version, if so, provide an
+ // alternative way to split lines.
+ var splitLines = CodeMirror.splitLines = "\n\nb".split(/\n/).length != 3 ? function(string) {
+ var pos = 0, result = [], l = string.length;
+ while (pos <= l) {
+ var nl = string.indexOf("\n", pos);
+ if (nl == -1) nl = string.length;
+ var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
+ var rt = line.indexOf("\r");
+ if (rt != -1) {
+ result.push(line.slice(0, rt));
+ pos += rt + 1;
+ } else {
+ result.push(line);
+ pos = nl + 1;
+ }
+ }
+ return result;
+ } : function(string){return string.split(/\r\n?|\n/);};
+
+ var hasSelection = window.getSelection ? function(te) {
+ try { return te.selectionStart != te.selectionEnd; }
+ catch(e) { return false; }
+ } : function(te) {
+ try {var range = te.ownerDocument.selection.createRange();}
+ catch(e) {}
+ if (!range || range.parentElement() != te) return false;
+ return range.compareEndPoints("StartToEnd", range) != 0;
+ };
+
+ var hasCopyEvent = (function() {
+ var e = elt("div");
+ if ("oncopy" in e) return true;
+ e.setAttribute("oncopy", "return;");
+ return typeof e.oncopy == "function";
+ })();
+
+ // KEY NAMES
+
+ var keyNames = {3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
+ 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
+ 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
+ 46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod", 107: "=", 109: "-", 127: "Delete",
+ 173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
+ 221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
+ 63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"};
+ CodeMirror.keyNames = keyNames;
+ (function() {
+ // Number keys
+ for (var i = 0; i < 10; i++) keyNames[i + 48] = keyNames[i + 96] = String(i);
+ // Alphabetic keys
+ for (var i = 65; i <= 90; i++) keyNames[i] = String.fromCharCode(i);
+ // Function keys
+ for (var i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = "F" + i;
+ })();
+
+ // BIDI HELPERS
+
+ function iterateBidiSections(order, from, to, f) {
+ if (!order) return f(from, to, "ltr");
+ var found = false;
+ for (var i = 0; i < order.length; ++i) {
+ var part = order[i];
+ if (part.from < to && part.to > from || from == to && part.to == from) {
+ f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr");
+ found = true;
+ }
+ }
+ if (!found) f(from, to, "ltr");
+ }
+
+ function bidiLeft(part) { return part.level % 2 ? part.to : part.from; }
+ function bidiRight(part) { return part.level % 2 ? part.from : part.to; }
+
+ function lineLeft(line) { var order = getOrder(line); return order ? bidiLeft(order[0]) : 0; }
+ function lineRight(line) {
+ var order = getOrder(line);
+ if (!order) return line.text.length;
+ return bidiRight(lst(order));
+ }
+
+ function lineStart(cm, lineN) {
+ var line = getLine(cm.doc, lineN);
+ var visual = visualLine(line);
+ if (visual != line) lineN = lineNo(visual);
+ var order = getOrder(visual);
+ var ch = !order ? 0 : order[0].level % 2 ? lineRight(visual) : lineLeft(visual);
+ return Pos(lineN, ch);
+ }
+ function lineEnd(cm, lineN) {
+ var merged, line = getLine(cm.doc, lineN);
+ while (merged = collapsedSpanAtEnd(line)) {
+ line = merged.find(1, true).line;
+ lineN = null;
+ }
+ var order = getOrder(line);
+ var ch = !order ? line.text.length : order[0].level % 2 ? lineLeft(line) : lineRight(line);
+ return Pos(lineN == null ? lineNo(line) : lineN, ch);
+ }
+
+ function compareBidiLevel(order, a, b) {
+ var linedir = order[0].level;
+ if (a == linedir) return true;
+ if (b == linedir) return false;
+ return a < b;
+ }
+ var bidiOther;
+ function getBidiPartAt(order, pos) {
+ bidiOther = null;
+ for (var i = 0, found; i < order.length; ++i) {
+ var cur = order[i];
+ if (cur.from < pos && cur.to > pos) return i;
+ if ((cur.from == pos || cur.to == pos)) {
+ if (found == null) {
+ found = i;
+ } else if (compareBidiLevel(order, cur.level, order[found].level)) {
+ if (cur.from != cur.to) bidiOther = found;
+ return i;
+ } else {
+ if (cur.from != cur.to) bidiOther = i;
+ return found;
+ }
+ }
+ }
+ return found;
+ }
+
+ function moveInLine(line, pos, dir, byUnit) {
+ if (!byUnit) return pos + dir;
+ do pos += dir;
+ while (pos > 0 && isExtendingChar(line.text.charAt(pos)));
+ return pos;
+ }
+
+ // This is needed in order to move 'visually' through bi-directional
+ // text -- i.e., pressing left should make the cursor go left, even
+ // when in RTL text. The tricky part is the 'jumps', where RTL and
+ // LTR text touch each other. This often requires the cursor offset
+ // to move more than one unit, in order to visually move one unit.
+ function moveVisually(line, start, dir, byUnit) {
+ var bidi = getOrder(line);
+ if (!bidi) return moveLogically(line, start, dir, byUnit);
+ var pos = getBidiPartAt(bidi, start), part = bidi[pos];
+ var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);
+
+ for (;;) {
+ if (target > part.from && target < part.to) return target;
+ if (target == part.from || target == part.to) {
+ if (getBidiPartAt(bidi, target) == pos) return target;
+ part = bidi[pos += dir];
+ return (dir > 0) == part.level % 2 ? part.to : part.from;
+ } else {
+ part = bidi[pos += dir];
+ if (!part) return null;
+ if ((dir > 0) == part.level % 2)
+ target = moveInLine(line, part.to, -1, byUnit);
+ else
+ target = moveInLine(line, part.from, 1, byUnit);
+ }
+ }
+ }
+
+ function moveLogically(line, start, dir, byUnit) {
+ var target = start + dir;
+ if (byUnit) while (target > 0 && isExtendingChar(line.text.charAt(target))) target += dir;
+ return target < 0 || target > line.text.length ? null : target;
+ }
+
+ // Bidirectional ordering algorithm
+ // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
+ // that this (partially) implements.
+
+ // One-char codes used for character types:
+ // L (L): Left-to-Right
+ // R (R): Right-to-Left
+ // r (AL): Right-to-Left Arabic
+ // 1 (EN): European Number
+ // + (ES): European Number Separator
+ // % (ET): European Number Terminator
+ // n (AN): Arabic Number
+ // , (CS): Common Number Separator
+ // m (NSM): Non-Spacing Mark
+ // b (BN): Boundary Neutral
+ // s (B): Paragraph Separator
+ // t (S): Segment Separator
+ // w (WS): Whitespace
+ // N (ON): Other Neutrals
+
+ // Returns null if characters are ordered as they appear
+ // (left-to-right), or an array of sections ({from, to, level}
+ // objects) in the order in which they occur visually.
+ var bidiOrdering = (function() {
+ // Character types for codepoints 0 to 0xff
+ var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";
+ // Character types for codepoints 0x600 to 0x6ff
+ var arabicTypes = "rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm";
+ function charType(code) {
+ if (code <= 0xf7) return lowTypes.charAt(code);
+ else if (0x590 <= code && code <= 0x5f4) return "R";
+ else if (0x600 <= code && code <= 0x6ed) return arabicTypes.charAt(code - 0x600);
+ else if (0x6ee <= code && code <= 0x8ac) return "r";
+ else if (0x2000 <= code && code <= 0x200b) return "w";
+ else if (code == 0x200c) return "b";
+ else return "L";
+ }
+
+ var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
+ var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;
+ // Browsers seem to always treat the boundaries of block elements as being L.
+ var outerType = "L";
+
+ function BidiSpan(level, from, to) {
+ this.level = level;
+ this.from = from; this.to = to;
+ }
+
+ return function(str) {
+ if (!bidiRE.test(str)) return false;
+ var len = str.length, types = [];
+ for (var i = 0, type; i < len; ++i)
+ types.push(type = charType(str.charCodeAt(i)));
+
+ // W1. Examine each non-spacing mark (NSM) in the level run, and
+ // change the type of the NSM to the type of the previous
+ // character. If the NSM is at the start of the level run, it will
+ // get the type of sor.
+ for (var i = 0, prev = outerType; i < len; ++i) {
+ var type = types[i];
+ if (type == "m") types[i] = prev;
+ else prev = type;
+ }
+
+ // W2. Search backwards from each instance of a European number
+ // until the first strong type (R, L, AL, or sor) is found. If an
+ // AL is found, change the type of the European number to Arabic
+ // number.
+ // W3. Change all ALs to R.
+ for (var i = 0, cur = outerType; i < len; ++i) {
+ var type = types[i];
+ if (type == "1" && cur == "r") types[i] = "n";
+ else if (isStrong.test(type)) { cur = type; if (type == "r") types[i] = "R"; }
+ }
+
+ // W4. A single European separator between two European numbers
+ // changes to a European number. A single common separator between
+ // two numbers of the same type changes to that type.
+ for (var i = 1, prev = types[0]; i < len - 1; ++i) {
+ var type = types[i];
+ if (type == "+" && prev == "1" && types[i+1] == "1") types[i] = "1";
+ else if (type == "," && prev == types[i+1] &&
+ (prev == "1" || prev == "n")) types[i] = prev;
+ prev = type;
+ }
+
+ // W5. A sequence of European terminators adjacent to European
+ // numbers changes to all European numbers.
+ // W6. Otherwise, separators and terminators change to Other
+ // Neutral.
+ for (var i = 0; i < len; ++i) {
+ var type = types[i];
+ if (type == ",") types[i] = "N";
+ else if (type == "%") {
+ for (var end = i + 1; end < len && types[end] == "%"; ++end) {}
+ var replace = (i && types[i-1] == "!") || (end < len && types[end] == "1") ? "1" : "N";
+ for (var j = i; j < end; ++j) types[j] = replace;
+ i = end - 1;
+ }
+ }
+
+ // W7. Search backwards from each instance of a European number
+ // until the first strong type (R, L, or sor) is found. If an L is
+ // found, then change the type of the European number to L.
+ for (var i = 0, cur = outerType; i < len; ++i) {
+ var type = types[i];
+ if (cur == "L" && type == "1") types[i] = "L";
+ else if (isStrong.test(type)) cur = type;
+ }
+
+ // N1. A sequence of neutrals takes the direction of the
+ // surrounding strong text if the text on both sides has the same
+ // direction. European and Arabic numbers act as if they were R in
+ // terms of their influence on neutrals. Start-of-level-run (sor)
+ // and end-of-level-run (eor) are used at level run boundaries.
+ // N2. Any remaining neutrals take the embedding direction.
+ for (var i = 0; i < len; ++i) {
+ if (isNeutral.test(types[i])) {
+ for (var end = i + 1; end < len && isNeutral.test(types[end]); ++end) {}
+ var before = (i ? types[i-1] : outerType) == "L";
+ var after = (end < len ? types[end] : outerType) == "L";
+ var replace = before || after ? "L" : "R";
+ for (var j = i; j < end; ++j) types[j] = replace;
+ i = end - 1;
+ }
+ }
+
+ // Here we depart from the documented algorithm, in order to avoid
+ // building up an actual levels array. Since there are only three
+ // levels (0, 1, 2) in an implementation that doesn't take
+ // explicit embedding into account, we can build up the order on
+ // the fly, without following the level-based algorithm.
+ var order = [], m;
+ for (var i = 0; i < len;) {
+ if (countsAsLeft.test(types[i])) {
+ var start = i;
+ for (++i; i < len && countsAsLeft.test(types[i]); ++i) {}
+ order.push(new BidiSpan(0, start, i));
+ } else {
+ var pos = i, at = order.length;
+ for (++i; i < len && types[i] != "L"; ++i) {}
+ for (var j = pos; j < i;) {
+ if (countsAsNum.test(types[j])) {
+ if (pos < j) order.splice(at, 0, new BidiSpan(1, pos, j));
+ var nstart = j;
+ for (++j; j < i && countsAsNum.test(types[j]); ++j) {}
+ order.splice(at, 0, new BidiSpan(2, nstart, j));
+ pos = j;
+ } else ++j;
+ }
+ if (pos < i) order.splice(at, 0, new BidiSpan(1, pos, i));
+ }
+ }
+ if (order[0].level == 1 && (m = str.match(/^\s+/))) {
+ order[0].from = m[0].length;
+ order.unshift(new BidiSpan(0, 0, m[0].length));
+ }
+ if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
+ lst(order).to -= m[0].length;
+ order.push(new BidiSpan(0, len - m[0].length, len));
+ }
+ if (order[0].level != lst(order).level)
+ order.push(new BidiSpan(order[0].level, len, len));
+
+ return order;
+ };
+ })();
+
+ // THE END
+
+ CodeMirror.version = "4.0.3";
+
+ return CodeMirror;
+});
diff --git a/js_unmodified/python.js b/js_unmodified/python.js
new file mode 100644
index 0000000..f5530bc
--- /dev/null
+++ b/js_unmodified/python.js
@@ -0,0 +1,388 @@
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+
+CodeMirror.defineMode("python", function(conf, parserConf) {
+ var ERRORCLASS = 'error';
+
+ function wordRegexp(words) {
+ return new RegExp("^((" + words.join(")|(") + "))\\b");
+ }
+
+ var singleOperators = parserConf.singleOperators || new RegExp("^[\\+\\-\\*/%&|\\^~<>!]");
+ var singleDelimiters = parserConf.singleDelimiters || new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
+ var doubleOperators = parserConf.doubleOperators || new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))");
+ var doubleDelimiters = parserConf.doubleDelimiters || new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
+ var tripleDelimiters = parserConf.tripleDelimiters || new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");
+ var identifiers = parserConf.identifiers|| new RegExp("^[_A-Za-z][_A-Za-z0-9]*");
+ var hangingIndent = parserConf.hangingIndent || parserConf.indentUnit;
+
+ var wordOperators = wordRegexp(['and', 'or', 'not', 'is', 'in']);
+ var commonkeywords = ['as', 'assert', 'break', 'class', 'continue',
+ 'def', 'del', 'elif', 'else', 'except', 'finally',
+ 'for', 'from', 'global', 'if', 'import',
+ 'lambda', 'pass', 'raise', 'return',
+ 'try', 'while', 'with', 'yield'];
+ var commonBuiltins = ['abs', 'all', 'any', 'bin', 'bool', 'bytearray', 'callable', 'chr',
+ 'classmethod', 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod',
+ 'enumerate', 'eval', 'filter', 'float', 'format', 'frozenset',
+ 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id',
+ 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len',
+ 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next',
+ 'object', 'oct', 'open', 'ord', 'pow', 'property', 'range',
+ 'repr', 'reversed', 'round', 'set', 'setattr', 'slice',
+ 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple',
+ 'type', 'vars', 'zip', '__import__', 'NotImplemented',
+ 'Ellipsis', '__debug__'];
+ var py2 = {'builtins': ['apply', 'basestring', 'buffer', 'cmp', 'coerce', 'execfile',
+ 'file', 'intern', 'long', 'raw_input', 'reduce', 'reload',
+ 'unichr', 'unicode', 'xrange', 'False', 'True', 'None'],
+ 'keywords': ['exec', 'print']};
+ var py3 = {'builtins': ['ascii', 'bytes', 'exec', 'print'],
+ 'keywords': ['nonlocal', 'False', 'True', 'None']};
+
+ if(parserConf.extra_keywords != undefined){
+ commonkeywords = commonkeywords.concat(parserConf.extra_keywords);
+ }
+ if(parserConf.extra_builtins != undefined){
+ commonBuiltins = commonBuiltins.concat(parserConf.extra_builtins);
+ }
+ if (!!parserConf.version && parseInt(parserConf.version, 10) === 3) {
+ commonkeywords = commonkeywords.concat(py3.keywords);
+ commonBuiltins = commonBuiltins.concat(py3.builtins);
+ var stringPrefixes = new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))", "i");
+ } else {
+ commonkeywords = commonkeywords.concat(py2.keywords);
+ commonBuiltins = commonBuiltins.concat(py2.builtins);
+ var stringPrefixes = new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
+ }
+ var keywords = wordRegexp(commonkeywords);
+ var builtins = wordRegexp(commonBuiltins);
+
+ var indentInfo = null;
+
+ // tokenizers
+ function tokenBase(stream, state) {
+ // Handle scope changes
+ if (stream.sol()) {
+ var scopeOffset = state.scopes[0].offset;
+ if (stream.eatSpace()) {
+ var lineOffset = stream.indentation();
+ if (lineOffset > scopeOffset) {
+ indentInfo = 'indent';
+ } else if (lineOffset < scopeOffset) {
+ indentInfo = 'dedent';
+ }
+ return null;
+ } else {
+ if (scopeOffset > 0) {
+ dedent(stream, state);
+ }
+ }
+ }
+ if (stream.eatSpace()) {
+ return null;
+ }
+
+ var ch = stream.peek();
+
+ // Handle Comments
+ if (ch === '#') {
+ stream.skipToEnd();
+ return 'comment';
+ }
+
+ // Handle Number Literals
+ if (stream.match(/^[0-9\.]/, false)) {
+ var floatLiteral = false;
+ // Floats
+ if (stream.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
+ if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; }
+ if (stream.match(/^\.\d+/)) { floatLiteral = true; }
+ if (floatLiteral) {
+ // Float literals may be "imaginary"
+ stream.eat(/J/i);
+ return 'number';
+ }
+ // Integers
+ var intLiteral = false;
+ // Hex
+ if (stream.match(/^0x[0-9a-f]+/i)) { intLiteral = true; }
+ // Binary
+ if (stream.match(/^0b[01]+/i)) { intLiteral = true; }
+ // Octal
+ if (stream.match(/^0o[0-7]+/i)) { intLiteral = true; }
+ // Decimal
+ if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) {
+ // Decimal literals may be "imaginary"
+ stream.eat(/J/i);
+ // TODO - Can you have imaginary longs?
+ intLiteral = true;
+ }
+ // Zero by itself with no other piece of number.
+ if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; }
+ if (intLiteral) {
+ // Integer literals may be "long"
+ stream.eat(/L/i);
+ return 'number';
+ }
+ }
+
+ // Handle Strings
+ if (stream.match(stringPrefixes)) {
+ state.tokenize = tokenStringFactory(stream.current());
+ return state.tokenize(stream, state);
+ }
+
+ // Handle operators and Delimiters
+ if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
+ return null;
+ }
+ if (stream.match(doubleOperators)
+ || stream.match(singleOperators)
+ || stream.match(wordOperators)) {
+ return 'operator';
+ }
+ if (stream.match(singleDelimiters)) {
+ return null;
+ }
+
+ if (stream.match(keywords)) {
+ return 'keyword';
+ }
+
+ if (stream.match(builtins)) {
+ return 'builtin';
+ }
+
+ if (stream.match(/^(self|cls)\b/)) {
+ return "variable-2";
+ }
+
+ if (stream.match(identifiers)) {
+ if (state.lastToken == 'def' || state.lastToken == 'class') {
+ return 'def';
+ }
+ return 'variable';
+ }
+
+ // Handle non-detected items
+ stream.next();
+ return ERRORCLASS;
+ }
+
+ function tokenStringFactory(delimiter) {
+ while ('rub'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) {
+ delimiter = delimiter.substr(1);
+ }
+ var singleline = delimiter.length == 1;
+ var OUTCLASS = 'string';
+
+ function tokenString(stream, state) {
+ while (!stream.eol()) {
+ stream.eatWhile(/[^'"\\]/);
+ if (stream.eat('\\')) {
+ stream.next();
+ if (singleline && stream.eol()) {
+ return OUTCLASS;
+ }
+ } else if (stream.match(delimiter)) {
+ state.tokenize = tokenBase;
+ return OUTCLASS;
+ } else {
+ stream.eat(/['"]/);
+ }
+ }
+ if (singleline) {
+ if (parserConf.singleLineStringErrors) {
+ return ERRORCLASS;
+ } else {
+ state.tokenize = tokenBase;
+ }
+ }
+ return OUTCLASS;
+ }
+ tokenString.isString = true;
+ return tokenString;
+ }
+
+ function indent(stream, state, type) {
+ type = type || 'py';
+ var indentUnit = 0;
+ if (type === 'py') {
+ if (state.scopes[0].type !== 'py') {
+ state.scopes[0].offset = stream.indentation();
+ return;
+ }
+ for (var i = 0; i < state.scopes.length; ++i) {
+ if (state.scopes[i].type === 'py') {
+ indentUnit = state.scopes[i].offset + conf.indentUnit;
+ break;
+ }
+ }
+ } else if (stream.match(/\s*($|#)/, false)) {
+ // An open paren/bracket/brace with only space or comments after it
+ // on the line will indent the next line a fixed amount, to make it
+ // easier to put arguments, list items, etc. on their own lines.
+ indentUnit = stream.indentation() + hangingIndent;
+ } else {
+ indentUnit = stream.column() + stream.current().length;
+ }
+ state.scopes.unshift({
+ offset: indentUnit,
+ type: type
+ });
+ }
+
+ function dedent(stream, state, type) {
+ type = type || 'py';
+ if (state.scopes.length == 1) return;
+ if (state.scopes[0].type === 'py') {
+ var _indent = stream.indentation();
+ var _indent_index = -1;
+ for (var i = 0; i < state.scopes.length; ++i) {
+ if (_indent === state.scopes[i].offset) {
+ _indent_index = i;
+ break;
+ }
+ }
+ if (_indent_index === -1) {
+ return true;
+ }
+ while (state.scopes[0].offset !== _indent) {
+ state.scopes.shift();
+ }
+ return false;
+ } else {
+ if (type === 'py') {
+ state.scopes[0].offset = stream.indentation();
+ return false;
+ } else {
+ if (state.scopes[0].type != type) {
+ return true;
+ }
+ state.scopes.shift();
+ return false;
+ }
+ }
+ }
+
+ function tokenLexer(stream, state) {
+ indentInfo = null;
+ var style = state.tokenize(stream, state);
+ var current = stream.current();
+
+ // Handle '.' connected identifiers
+ if (current === '.') {
+ style = stream.match(identifiers, false) ? null : ERRORCLASS;
+ if (style === null && state.lastStyle === 'meta') {
+ // Apply 'meta' style to '.' connected identifiers when
+ // appropriate.
+ style = 'meta';
+ }
+ return style;
+ }
+
+ // Handle decorators
+ if (current === '@') {
+ return stream.match(identifiers, false) ? 'meta' : ERRORCLASS;
+ }
+
+ if ((style === 'variable' || style === 'builtin')
+ && state.lastStyle === 'meta') {
+ style = 'meta';
+ }
+
+ // Handle scope changes.
+ if (current === 'pass' || current === 'return') {
+ state.dedent += 1;
+ }
+ if (current === 'lambda') state.lambda = true;
+ if ((current === ':' && !state.lambda && state.scopes[0].type == 'py')
+ || indentInfo === 'indent') {
+ indent(stream, state);
+ }
+ var delimiter_index = '[({'.indexOf(current);
+ if (delimiter_index !== -1) {
+ indent(stream, state, '])}'.slice(delimiter_index, delimiter_index+1));
+ }
+ if (indentInfo === 'dedent') {
+ if (dedent(stream, state)) {
+ return ERRORCLASS;
+ }
+ }
+ delimiter_index = '])}'.indexOf(current);
+ if (delimiter_index !== -1) {
+ if (dedent(stream, state, current)) {
+ return ERRORCLASS;
+ }
+ }
+ if (state.dedent > 0 && stream.eol() && state.scopes[0].type == 'py') {
+ if (state.scopes.length > 1) state.scopes.shift();
+ state.dedent -= 1;
+ }
+
+ return style;
+ }
+
+ var external = {
+ startState: function(basecolumn) {
+ return {
+ tokenize: tokenBase,
+ scopes: [{offset:basecolumn || 0, type:'py'}],
+ lastStyle: null,
+ lastToken: null,
+ lambda: false,
+ dedent: 0
+ };
+ },
+
+ token: function(stream, state) {
+ var style = tokenLexer(stream, state);
+
+ state.lastStyle = style;
+
+ var current = stream.current();
+ if (current && style) {
+ state.lastToken = current;
+ }
+
+ if (stream.eol() && state.lambda) {
+ state.lambda = false;
+ }
+ return style;
+ },
+
+ indent: function(state) {
+ if (state.tokenize != tokenBase) {
+ return state.tokenize.isString ? CodeMirror.Pass : 0;
+ }
+
+ return state.scopes[0].offset;
+ },
+
+ lineComment: "#",
+ fold: "indent"
+ };
+ return external;
+});
+
+CodeMirror.defineMIME("text/x-python", "python");
+
+var words = function(str){return str.split(' ');};
+
+CodeMirror.defineMIME("text/x-cython", {
+ name: "python",
+ extra_keywords: words("by cdef cimport cpdef ctypedef enum except"+
+ "extern gil include nogil property public"+
+ "readonly struct union DEF IF ELIF ELSE")
+});
+
+});
diff --git a/js_unmodified/shell.js b/js_unmodified/shell.js
new file mode 100644
index 0000000..9381a41
--- /dev/null
+++ b/js_unmodified/shell.js
@@ -0,0 +1,5121 @@
+// (c) Colin Barschel 2007-2008 - http://cb.vu - See shell.js for the original uncompressed version. termlib.js is (c) Norbert Landsteiner 2003-2007 http://www.masswerk.at
+var Terminal = function(conf) {
+ if (typeof conf != 'object') conf = new Object();
+ else {
+ for (var i in this.Defaults) {
+ if (typeof conf[i] == 'undefined') conf[i] = this.Defaults[i];
+ }
+ }
+ this.conf = conf;
+ this.setInitValues();
+}
+Terminal.prototype = {
+ version: '1.43 (original)',
+ Defaults: {
+ cols: 80,
+ rows: 24,
+ x: 100,
+ y: 100,
+ termDiv: 'termDiv',
+ bgColor: '#181818',
+ frameColor: '#555555',
+ frameWidth: 1,
+ rowHeight: 15,
+ blinkDelay: 500,
+ fontClass: 'term',
+ crsrBlinkMode: false,
+ crsrBlockMode: true,
+ DELisBS: false,
+ printTab: true,
+ printEuro: true,
+ catchCtrlH: true,
+ closeOnESC: true,
+ historyUnique: false,
+ id: 0,
+ ps: '>',
+ greeting: '%+r Terminal ready. %-r',
+ handler: this.defaultHandler,
+ ctrlHandler: null,
+ initHandler: null,
+ exitHandler: null,
+ wrap: false
+ },
+ setInitValues: function() {
+ this.isSafari = (navigator.userAgent.indexOf('Safari') >= 0) ? true : false;
+ this.isOpera = (window.opera && navigator.userAgent.indexOf('Opera') >= 0) ? true : false;
+ this.id = this.conf.id;
+ this.maxLines = this.conf.rows;
+ this.maxCols = this.conf.cols;
+ this.termDiv = this.conf.termDiv;
+ this.crsrBlinkMode = this.conf.crsrBlinkMode;
+ this.crsrBlockMode = this.conf.crsrBlockMode;
+ this.blinkDelay = this.conf.blinkDelay;
+ this.DELisBS = this.conf.DELisBS;
+ this.printTab = this.conf.printTab;
+ this.printEuro = this.conf.printEuro;
+ this.catchCtrlH = this.conf.catchCtrlH;
+ this.closeOnESC = this.conf.closeOnESC;
+ this.historyUnique = this.conf.historyUnique;
+ this.ps = this.conf.ps;
+ this.closed = false;
+ this.r;
+ this.c;
+ this.charBuf = new Array();
+ this.styleBuf = new Array();
+ this.scrollBuf = null;
+ this.blinkBuffer = 0;
+ this.blinkTimer;
+ this.cursoractive = false;
+ this.lock = true;
+ this.insert = false;
+ this.charMode = false;
+ this.rawMode = false;
+ this.lineBuffer = '';
+ this.inputChar = 0;
+ this.lastLine = '';
+ this.guiCounter = 0;
+ this.history = new Array();
+ this.histPtr = 0;
+ this.env = new Object();
+ this.ns4ParentDoc = null;
+ this.handler = this.conf.handler;
+ this.wrapping = this.conf.wrapping;
+ this.ctrlHandler = this.conf.ctrlHandler;
+ this.initHandler = this.conf.initHandler;
+ this.exitHandler = this.conf.exitHandler;
+ },
+ defaultHandler: function() {
+ this.newLine();
+ if (this.lineBuffer != '') {
+ this.type('You typed: ' + this.lineBuffer);
+ this.newLine();
+ }
+ this.prompt();
+ },
+ open: function() {
+ if (this.termDivReady()) {
+ if (!this.closed) this._makeTerm();
+ this.init();
+ return true;
+ } else return false;
+ },
+ close: function() {
+ this.lock = true;
+ this.cursorOff();
+ if (this.exitHandler) this.exitHandler();
+ this.globals.setVisible(this.termDiv, 0);
+ this.closed = true;
+ },
+ init: function() {
+ if (this.guiReady()) {
+ this.guiCounter = 0;
+ if (this.closed) {
+ this.setInitValues();
+ }
+ this.clear();
+ this.globals.setVisible(this.termDiv, 1);
+ this.globals.enableKeyboard(this);
+ if (this.initHandler) {
+ this.initHandler();
+ } else {
+ this.write(this.conf.greeting);
+ this.newLine();
+ this.prompt();
+ }
+ } else {
+ this.guiCounter++;
+ if (this.guiCounter > 18000) {
+ if (confirm('Terminal:\nYour browser hasn\'t responded for more than 2 minutes.\nRetry?')) this.guiCounter = 0
+ else return;
+ };
+ this.globals.termToInitialze = this;
+ window.setTimeout('Terminal.prototype.globals.termToInitialze.init()', 200);
+ }
+ },
+ getRowArray: function(l, v) {
+ var a = new Array();
+ for (var i = 0; i < l; i++) a[i] = v;
+ return a;
+ },
+ wrapOn: function() {
+ this.wrapping = true;
+ },
+ wrapOff: function() {
+ this.wrapping = false;
+ },
+ type: function(text, style) {
+ for (var i = 0; i < text.length; i++) {
+ var ch = text.charCodeAt(i);
+ if (!this.isPrintable(ch)) ch = 94;
+ this.charBuf[this.r][this.c] = ch;
+ this.styleBuf[this.r][this.c] = (style) ? style : 0;
+ var last_r = this.r;
+ this._incCol();
+ if (this.r != last_r) this.redraw(last_r);
+ }
+ this.redraw(this.r)
+ },
+ write: function(text, usemore) {
+ if (typeof text != 'object') {
+ if (typeof text != 'string') text = '' + text;
+ if (text.indexOf('\n') >= 0) {
+ var ta = text.split('\n');
+ text = ta.join('%n');
+ }
+ } else {
+ if (text.join) text = text.join('%n')
+ else text = '' + text;
+ if (text.indexOf('\n') >= 0) {
+ var ta = text.split('\n');
+ text = ta.join('%n');
+ }
+ }
+ this._sbInit(usemore);
+ var chunks = text.split('%');
+ var esc = (text.charAt(0) != '%');
+ var style = 0;
+ var styleMarkUp = this.globals.termStyleMarkup;
+ for (var i = 0; i < chunks.length; i++) {
+ if (esc) {
+ if (chunks[i].length > 0) this._sbType(chunks[i], style)
+ else if (i > 0) this._sbType('%', style);
+ esc = false;
+ } else {
+ var func = chunks[i].charAt(0);
+ if ((chunks[i].length == 0) && (i > 0)) {
+ this._sbType("%", style);
+ esc = true;
+ } else if (func == 'n') {
+ this._sbNewLine(true);
+ if (chunks[i].length > 1) this._sbType(chunks[i].substring(1), style);
+ } else if (func == '+') {
+ var opt = chunks[i].charAt(1);
+ opt = opt.toLowerCase();
+ if (opt == 'p') style = 0
+ else if (styleMarkUp[opt]) style |= styleMarkUp[opt];
+ if (chunks[i].length > 2) this._sbType(chunks[i].substring(2), style);
+ } else if (func == '-') {
+ var opt = chunks[i].charAt(1);
+ opt = opt.toLowerCase();
+ if (opt == 'p') style = 0
+ else if (styleMarkUp[opt]) style &= ~styleMarkUp[opt];
+ if (chunks[i].length > 2) this._sbType(chunks[i].substring(2), style);
+ } else if ((chunks[i].length > 1) && (func == 'c')) {
+ var cinfo = this._parseColor(chunks[i].substring(1));
+ style = (style & (~0xfffff0)) | cinfo.style;
+ if (cinfo.rest) this._sbType(cinfo.rest, style);
+ } else if ((chunks[i].length > 1) && (chunks[i].charAt(0) == 'C') && (chunks[i].charAt(1) == 'S')) {
+ this.clear();
+ this._sbInit();
+ if (chunks[i].length > 2) this._sbType(chunks[i].substring(2), style);
+ } else {
+ if (chunks[i].length > 0) this._sbType(chunks[i], style);
+ }
+ }
+ }
+ this._sbOut();
+ },
+ _parseColor: function(chunk) {
+ var rest = '';
+ var style = 0;
+ if (chunk.length) {
+ if (chunk.charAt(0) == '(') {
+ var clabel = '';
+ for (var i = 1; i < chunk.length; i++) {
+ var c = chunk.charAt(i);
+ if (c == ')') {
+ if (chunk.length > i) rest = chunk.substring(i + 1);
+ break;
+ }
+ clabel += c;
+ }
+ if (clabel) {
+ if (clabel.charAt(0) == '@') {
+ var sc = this.globals.nsColors[clabel.substring(1).toLowerCase()];
+ if (sc) style = (16 + sc) * 0x100;
+ } else if (clabel.charAt(0) == '#') {
+ var cl = clabel.substring(1).toLowerCase();
+ var sc = this.globals.webColors[cl];
+ if (sc) {
+ style = sc * 0x10000;
+ } else {
+ cl = this.globals.webifyColor(cl);
+ if (cl) style = this.globals.webColors[cl] * 0x10000;
+ }
+ } else if ((clabel.length) && (clabel.length <= 2)) {
+ var isHex = false;
+ for (var i = 0; i < clabel.length; i++) {
+ if (this.globals.isHexOnlyChar(clabel.charAt(i))) {
+ isHex = true;
+ break;
+ }
+ }
+ var cl = (isHex) ? parseInt(clabel, 16) : parseInt(clabel, 10);
+ if ((!isNaN(cl)) || (cl <= 15)) {
+ style = cl * 0x100;
+ }
+ } else {
+ style = this.globals.getColorCode(clabel) * 0x100;
+ }
+ }
+ } else {
+ var c = chunk.charAt(0);
+ if (this.globals.isHexChar(c)) {
+ style = this.globals.hexToNum[c] * 0x100;
+ rest = chunk.substring(1);
+ } else {
+ rest = chunk;
+ }
+ }
+ }
+ return {
+ rest: rest,
+ style: style
+ };
+ },
+ _sbInit: function(usemore) {
+ var sb = this.scrollBuf = new Object();
+ var sbl = sb.lines = new Array();
+ var sbs = sb.styles = new Array();
+ sb.more = usemore;
+ sb.line = 0;
+ sb.status = 0;
+ sb.r = 0;
+ sb.c = this.c;
+ sbl[0] = this.getRowArray(this.conf.cols, 0);
+ sbs[0] = this.getRowArray(this.conf.cols, 0);
+ for (var i = 0; i < this.c; i++) {
+ sbl[0][i] = this.charBuf[this.r][i];
+ sbs[0][i] = this.styleBuf[this.r][i];
+ }
+ },
+ _sbType: function(text, style) {
+ var sb = this.scrollBuf;
+ for (var i = 0; i < text.length; i++) {
+ var ch = text.charCodeAt(i);
+ if (!this.isPrintable(ch)) ch = 94;
+ sb.lines[sb.r][sb.c] = ch;
+ sb.styles[sb.r][sb.c++] = (style) ? style : 0;
+ if (sb.c >= this.maxCols) this._sbNewLine();
+ }
+ },
+ _sbNewLine: function(forced) {
+ var sb = this.scrollBuf;
+ if (this.wrapping && forced) {
+ sb.lines[sb.r][sb.c] = 10;
+ sb.lines[sb.r].length = sb.c + 1;
+ }
+ sb.r++;
+ sb.c = 0;
+ sb.lines[sb.r] = this.getRowArray(this.conf.cols, 0);
+ sb.styles[sb.r] = this.getRowArray(this.conf.cols, 0);
+ },
+ _sbWrap: function() {
+ var wb = new Object();
+ wb.lines = new Array();
+ wb.styles = new Array();
+ wb.lines[0] = this.getRowArray(this.conf.cols, 0);
+ wb.styles[0] = this.getRowArray(this.conf.cols, 0);
+ wb.r = 0;
+ wb.c = 0;
+ var sb = this.scrollBuf;
+ var sbl = sb.lines;
+ var sbs = sb.styles;
+ var ch, st, wrap, lc, ls;
+ var l = this.c;
+ var lastR = 0;
+ var lastC = 0;
+ wb.cBreak = false;
+ for (var r = 0; r < sbl.length; r++) {
+ lc = sbl[r];
+ ls = sbs[r];
+ for (var c = 0; c < lc.length; c++) {
+ ch = lc[c];
+ st = ls[c];
+ if (ch) {
+ var wrap = this.globals.wrapChars[ch];
+ if (ch == 10) wrap = 1;
+ if (wrap) {
+ if (wrap == 2) {
+ l++;
+ } else if (wrap == 4) {
+ l++;
+ lc[c] = 45;
+ }
+ this._wbOut(wb, lastR, lastC, l);
+ if (ch == 10) {
+ this._wbIncLine(wb);
+ } else if ((wrap == 1) && (wb.c < this.maxCols)) {
+ wb.lines[wb.r][wb.c] = ch;
+ wb.styles[wb.r][wb.c++] = st;
+ if (wb.c >= this.maxCols) this._wbIncLine(wb);
+ }
+ if (wrap == 3) {
+ lastR = r;
+ lastC = c;
+ l = 1;
+ } else {
+ l = 0;
+ lastR = r;
+ lastC = c + 1;
+ if (lastC == lc.length) {
+ lastR++;
+ lastC = 0;
+ }
+ if (wrap == 4) wb.cBreak = true;
+ }
+ } else {
+ l++;
+ }
+ } else continue;
+ }
+ }
+ if (l) {
+ if ((wb.cbreak) && (wb.c != 0)) wb.c--;
+ this._wbOut(wb, lastR, lastC, l);
+ }
+ sb.lines = wb.lines;
+ sb.styles = wb.styles;
+ sb.r = wb.r;
+ sb.c = wb.c;
+ },
+ _wbOut: function(wb, br, bc, l) {
+ var sb = this.scrollBuf;
+ var sbl = sb.lines;
+ var sbs = sb.styles;
+ var ofs = 0;
+ var lc, ls;
+ if (l + wb.c > this.maxCols) {
+ if (l < this.maxCols) {
+ this._wbIncLine(wb);
+ } else {
+ var i0 = 0;
+ ofs = this.maxCols - wb.c;
+ lc = sbl[br];
+ ls = sbs[br];
+ while (true) {
+ for (var i = i0; i < ofs; i++) {
+ wb.lines[wb.r][wb.c] = lc[bc];
+ wb.styles[wb.r][wb.c++] = ls[bc++];
+ if (bc == sbl[br].length) {
+ bc = 0;
+ br++;
+ lc = sbl[br];
+ ls = sbs[br];
+ }
+ }
+ this._wbIncLine(wb);
+ if (l - ofs < this.maxCols) break;
+ i0 = ofs;
+ ofs += this.maxCols;
+ }
+ }
+ } else if (wb.cBreak) {
+ wb.c--;
+ }
+ lc = sbl[br];
+ ls = sbs[br];
+ for (var i = ofs; i < l; i++) {
+ wb.lines[wb.r][wb.c] = lc[bc];
+ wb.styles[wb.r][wb.c++] = ls[bc++];
+ if (bc == sbl[br].length) {
+ bc = 0;
+ br++;
+ lc = sbl[br];
+ ls = sbs[br];
+ }
+ }
+ wb.cBreak = false;
+ },
+ _wbIncLine: function(wb) {
+ wb.r++;
+ wb.c = 0;
+ wb.lines[wb.r] = this.getRowArray(this.conf.cols, 0);
+ wb.styles[wb.r] = this.getRowArray(this.conf.cols, 0);
+ },
+ _sbOut: function() {
+ var sb = this.scrollBuf;
+ if ((this.wrapping) && (!sb.status)) this._sbWrap();
+ var sbl = sb.lines;
+ var sbs = sb.styles;
+ var tcb = this.charBuf;
+ var tsb = this.styleBuf;
+ var ml = this.maxLines;
+ var buflen = sbl.length;
+ if (sb.more) {
+ if (sb.status) {
+ if (this.inputChar == this.globals.lcMoreKeyAbort) {
+ this.r = ml - 1;
+ this.c = 0;
+ tcb[this.r] = this.getRowArray(this.conf.cols, 0);
+ tsb[this.r] = this.getRowArray(this.conf.cols, 0);
+ this.redraw(this.r);
+ this.handler = sb.handler;
+ this.charMode = false;
+ this.inputChar = 0;
+ this.scrollBuf = null;
+ this.prompt();
+ return;
+ } else if (this.inputChar == this.globals.lcMoreKeyContinue) {
+ this.clear();
+ } else {
+ return;
+ }
+ } else {
+ if (this.r >= ml - 1) this.clear();
+ }
+ }
+ if (this.r + buflen - sb.line <= ml) {
+ for (var i = sb.line; i < buflen; i++) {
+ var r = this.r + i - sb.line;
+ tcb[r] = sbl[i];
+ tsb[r] = sbs[i];
+ this.redraw(r);
+ }
+ this.r += sb.r - sb.line;
+ this.c = sb.c;
+ if (sb.more) {
+ if (sb.status) this.handler = sb.handler;
+ this.charMode = false;
+ this.inputChar = 0;
+ this.scrollBuf = null;
+ this.prompt();
+ return;
+ }
+ } else if (sb.more) {
+ ml--;
+ if (sb.status == 0) {
+ sb.handler = this.handler;
+ this.handler = this._sbOut;
+ this.charMode = true;
+ sb.status = 1;
+ }
+ if (this.r) {
+ var ofs = ml - this.r;
+ for (var i = sb.line; i < ofs; i++) {
+ var r = this.r + i - sb.line;
+ tcb[r] = sbl[i];
+ tsb[r] = sbs[i];
+ this.redraw(r);
+ }
+ } else {
+ var ofs = sb.line + ml;
+ for (var i = sb.line; i < ofs; i++) {
+ var r = this.r + i - sb.line;
+ tcb[r] = sbl[i];
+ tsb[r] = sbs[i];
+ this.redraw(r);
+ }
+ }
+ sb.line = ofs;
+ this.r = ml;
+ this.c = 0;
+ this.type(this.globals.lcMorePrompt1, this.globals.lcMorePromtp1Style);
+ this.type(this.globals.lcMorePrompt2, this.globals.lcMorePrompt2Style);
+ this.lock = false;
+ return;
+ } else if (buflen >= ml) {
+ var ofs = buflen - ml;
+ for (var i = 0; i < ml; i++) {
+ var r = ofs + i;
+ tcb[i] = sbl[r];
+ tsb[i] = sbs[r];
+ this.redraw(i);
+ }
+ this.r = ml - 1;
+ this.c = sb.c;
+ } else {
+ var dr = ml - buflen;
+ var ofs = this.r - dr;
+ for (var i = 0; i < dr; i++) {
+ var r = ofs + i;
+ for (var c = 0; c < this.maxCols; c++) {
+ tcb[i][c] = tcb[r][c];
+ tsb[i][c] = tsb[r][c];
+ }
+ this.redraw(i);
+ }
+ for (var i = 0; i < buflen; i++) {
+ var r = dr + i;
+ tcb[r] = sbl[i];
+ tsb[r] = sbs[i];
+ this.redraw(r);
+ }
+ this.r = ml - 1;
+ this.c = sb.c;
+ }
+ this.scrollBuf = null;
+ },
+ typeAt: function(r, c, text, style) {
+ var tr1 = this.r;
+ var tc1 = this.c;
+ this.cursorSet(r, c);
+ for (var i = 0; i < text.length; i++) {
+ var ch = text.charCodeAt(i);
+ if (!this.isPrintable(ch)) ch = 94;
+ this.charBuf[this.r][this.c] = ch;
+ this.styleBuf[this.r][this.c] = (style) ? style : 0;
+ var last_r = this.r;
+ this._incCol();
+ if (this.r != last_r) this.redraw(last_r);
+ }
+ this.redraw(this.r);
+ this.r = tr1;
+ this.c = tc1;
+ },
+ statusLine: function(text, style, offset) {
+ var ch, r;
+ style = ((style) && (!isNaN(style))) ? parseInt(style) & 15 : 0;
+ if ((offset) && (offset > 0)) r = this.conf.rows - offset
+ else r = this.conf.rows - 1;
+ for (var i = 0; i < this.conf.cols; i++) {
+ if (i < text.length) {
+ ch = text.charCodeAt(i);
+ if (!this.isPrintable(ch)) ch = 94;
+ } else ch = 0;
+ this.charBuf[r][i] = ch;
+ this.styleBuf[r][i] = style;
+ }
+ this.redraw(r);
+ },
+ printRowFromString: function(r, text, style) {
+ var ch;
+ style = ((style) && (!isNaN(style))) ? parseInt(style) & 15 : 0;
+ if ((r >= 0) && (r < this.maxLines)) {
+ if (typeof text != 'string') text = '' + text;
+ for (var i = 0; i < this.conf.cols; i++) {
+ if (i < text.length) {
+ ch = text.charCodeAt(i);
+ if (!this.isPrintable(ch)) ch = 94;
+ } else ch = 0;
+ this.charBuf[r][i] = ch;
+ this.styleBuf[r][i] = style;
+ }
+ this.redraw(r);
+ }
+ },
+ setChar: function(ch, r, c, style) {
+ this.charBuf[r][c] = ch;
+ this.styleBuf[this.r][this.c] = (style) ? style : 0;
+ this.redraw(r);
+ },
+ newLine: function() {
+ this.c = 0;
+ this._incRow();
+ },
+ _charOut: function(ch, style) {
+ this.charBuf[this.r][this.c] = ch;
+ this.styleBuf[this.r][this.c] = (style) ? style : 0;
+ this.redraw(this.r);
+ this._incCol();
+ },
+ _incCol: function() {
+ this.c++;
+ if (this.c >= this.maxCols) {
+ this.c = 0;
+ this._incRow();
+ }
+ },
+ _incRow: function() {
+ this.r++;
+ if (this.r >= this.maxLines) {
+ this._scrollLines(0, this.maxLines);
+ this.r = this.maxLines - 1;
+ }
+ },
+ _scrollLines: function(start, end) {
+ window.status = 'Scrolling lines ...';
+ start++;
+ for (var ri = start; ri < end; ri++) {
+ var rt = ri - 1;
+ this.charBuf[rt] = this.charBuf[ri];
+ this.styleBuf[rt] = this.styleBuf[ri];
+ }
+ var rt = end - 1;
+ this.charBuf[rt] = this.getRowArray(this.conf.cols, 0);
+ this.styleBuf[rt] = this.getRowArray(this.conf.cols, 0);
+ this.redraw(rt);
+ for (var r = end - 1; r >= start; r--) this.redraw(r - 1);
+ window.status = '';
+ },
+ clear: function() {
+ window.status = 'Clearing display ...';
+ this.cursorOff();
+ this.insert = false;
+ for (var ri = 0; ri < this.maxLines; ri++) {
+ this.charBuf[ri] = this.getRowArray(this.conf.cols, 0);
+ this.styleBuf[ri] = this.getRowArray(this.conf.cols, 0);
+ this.redraw(ri);
+ }
+ this.r = 0;
+ this.c = 0;
+ window.status = '';
+ },
+ reset: function() {
+ if (this.lock) return;
+ this.lock = true;
+ this.rawMode = false;
+ this.charMode = false;
+ this.maxLines = this.conf.rows;
+ this.maxCols = this.conf.cols;
+ this.lastLine = '';
+ this.lineBuffer = '';
+ this.inputChar = 0;
+ this.clear();
+ },
+ prompt: function() {
+ this.lock = true;
+ if (this.c > 0) this.newLine();
+ this.type(this.ps);
+ this._charOut(1);
+ this.lock = false;
+ this.cursorOn();
+ },
+ isPrintable: function(ch, unicodePage1only) {
+ if ((this.wrapping) && (this.globals.wrapChars[ch] == 4)) return true;
+ if ((unicodePage1only) && (ch > 255)) {
+ return ((ch == this.termKey.EURO) && (this.printEuro)) ? true : false;
+ }
+ return (((ch >= 32) && (ch != this.termKey.DEL)) || ((this.printTab) && (ch == this.termKey.TAB)));
+ },
+ cursorSet: function(r, c) {
+ var crsron = this.cursoractive;
+ if (crsron) this.cursorOff();
+ this.r = r % this.maxLines;
+ this.c = c % this.maxCols;
+ this._cursorReset(crsron);
+ },
+ cursorOn: function() {
+ if (this.blinkTimer) clearTimeout(this.blinkTimer);
+ this.blinkBuffer = this.styleBuf[this.r][this.c];
+ this._cursorBlink();
+ this.cursoractive = true;
+ },
+ cursorOff: function() {
+ if (this.blinkTimer) clearTimeout(this.blinkTimer);
+ if (this.cursoractive) {
+ this.styleBuf[this.r][this.c] = this.blinkBuffer;
+ this.redraw(this.r);
+ this.cursoractive = false;
+ }
+ },
+ cursorLeft: function() {
+ var crsron = this.cursoractive;
+ if (crsron) this.cursorOff();
+ var r = this.r;
+ var c = this.c;
+ if (c > 0) c--
+ else if (r > 0) {
+ c = this.maxCols - 1;
+ r--;
+ }
+ if (this.isPrintable(this.charBuf[r][c])) {
+ this.r = r;
+ this.c = c;
+ }
+ this.insert = true;
+ this._cursorReset(crsron);
+ },
+ cursorRight: function() {
+ var crsron = this.cursoractive;
+ if (crsron) this.cursorOff();
+ var r = this.r;
+ var c = this.c;
+ if (c < this.maxCols - 1) c++
+ else if (r < this.maxLines - 1) {
+ c = 0;
+ r++;
+ }
+ if (!this.isPrintable(this.charBuf[r][c])) {
+ this.insert = false;
+ }
+ if (this.isPrintable(this.charBuf[this.r][this.c])) {
+ this.r = r;
+ this.c = c;
+ }
+ this._cursorReset(crsron);
+ },
+ backspace: function() {
+ var crsron = this.cursoractive;
+ if (crsron) this.cursorOff();
+ var r = this.r;
+ var c = this.c;
+ if (c > 0) c--
+ else if (r > 0) {
+ c = this.maxCols - 1;
+ r--;
+ };
+ if (this.isPrintable(this.charBuf[r][c])) {
+ this._scrollLeft(r, c);
+ this.r = r;
+ this.c = c;
+ };
+ this._cursorReset(crsron);
+ },
+ fwdDelete: function() {
+ var crsron = this.cursoractive;
+ if (crsron) this.cursorOff();
+ if (this.isPrintable(this.charBuf[this.r][this.c])) {
+ this._scrollLeft(this.r, this.c);
+ if (!this.isPrintable(this.charBuf[this.r][this.c])) this.insert = false;
+ }
+ this._cursorReset(crsron);
+ },
+ _cursorReset: function(crsron) {
+ if (crsron) this.cursorOn()
+ else {
+ this.blinkBuffer = this.styleBuf[this.r][this.c];
+ }
+ },
+ _cursorBlink: function() {
+ if (this.blinkTimer) clearTimeout(this.blinkTimer);
+ if (this == this.globals.activeTerm) {
+ if (this.crsrBlockMode) {
+ this.styleBuf[this.r][this.c] = (this.styleBuf[this.r][this.c] & 1) ? this.styleBuf[this.r][this.c] & 254 : this.styleBuf[this.r][this.c] | 1;
+ } else {
+ this.styleBuf[this.r][this.c] = (this.styleBuf[this.r][this.c] & 2) ? this.styleBuf[this.r][this.c] & 253 : this.styleBuf[this.r][this.c] | 2;
+ }
+ this.redraw(this.r);
+ }
+ if (this.crsrBlinkMode) this.blinkTimer = setTimeout('Terminal.prototype.globals.activeTerm._cursorBlink()', this.blinkDelay);
+ },
+ _scrollLeft: function(r, c) {
+ var rows = new Array();
+ rows[0] = r;
+ while (this.isPrintable(this.charBuf[r][c])) {
+ var ri = r;
+ var ci = c + 1;
+ if (ci == this.maxCols) {
+ if (ri < this.maxLines - 1) {
+ ci = 0;
+ ri++;
+ rows[rows.length] = ri;
+ } else {
+ break;
+ }
+ }
+ this.charBuf[r][c] = this.charBuf[ri][ci];
+ this.styleBuf[r][c] = this.styleBuf[ri][ci];
+ c = ci;
+ r = ri;
+ }
+ if (this.charBuf[r][c] != 0) this.charBuf[r][c] = 0;
+ for (var i = 0; i < rows.length; i++) this.redraw(rows[i]);
+ },
+ _scrollRight: function(r, c) {
+ var rows = new Array();
+ var end = this._getLineEnd(r, c);
+ var ri = end[0];
+ var ci = end[1];
+ if ((ci == this.maxCols - 1) && (ri == this.maxLines - 1)) {
+ if (r == 0) return;
+ this._scrollLines(0, this.maxLines);
+ this.r--;
+ r--;
+ ri--;
+ }
+ rows[r] = 1;
+ while (this.isPrintable(this.charBuf[ri][ci])) {
+ var rt = ri;
+ var ct = ci + 1;
+ if (ct == this.maxCols) {
+ ct = 0;
+ rt++;
+ rows[rt] = 1;
+ }
+ this.charBuf[rt][ct] = this.charBuf[ri][ci];
+ this.styleBuf[rt][ct] = this.styleBuf[ri][ci];
+ if ((ri == r) && (ci == c)) break;
+ ci--;
+ if (ci < 0) {
+ ci = this.maxCols - 1;
+ ri--;
+ rows[ri] = 1;
+ }
+ }
+ for (var i = r; i < this.maxLines; i++) {
+ if (rows[i]) this.redraw(i);
+ }
+ },
+ _getLineEnd: function(r, c) {
+ if (!this.isPrintable(this.charBuf[r][c])) {
+ c--;
+ if (c < 0) {
+ if (r > 0) {
+ r--;
+ c = this.maxCols - 1;
+ } else {
+ c = 0;
+ }
+ }
+ }
+ if (this.isPrintable(this.charBuf[r][c])) {
+ while (true) {
+ var ri = r;
+ var ci = c + 1;
+ if (ci == this.maxCols) {
+ if (ri < this.maxLines - 1) {
+ ri++;
+ ci = 0;
+ } else {
+ break;
+ }
+ }
+ if (!this.isPrintable(this.charBuf[ri][ci])) break;
+ c = ci;
+ r = ri;
+ }
+ }
+ return [r, c];
+ },
+ _getLineStart: function(r, c) {
+ var ci, ri;
+ if (!this.isPrintable(this.charBuf[r][c])) {
+ ci = c - 1;
+ ri = r;
+ if (ci < 0) {
+ if (ri == 0) return [0, 0];
+ ci = this.maxCols - 1;
+ ri--;
+ }
+ if (!this.isPrintable(this.charBuf[ri][ci])) return [r, c]
+ else {
+ r = ri;
+ c = ci;
+ }
+ }
+ while (true) {
+ var ri = r;
+ var ci = c - 1;
+ if (ci < 0) {
+ if (ri == 0) break;
+ ci = this.maxCols - 1;
+ ri--;
+ }
+ if (!this.isPrintable(this.charBuf[ri][ci])) break;;
+ r = ri;
+ c = ci;
+ }
+ return [r, c];
+ },
+ _getLine: function() {
+ var end = this._getLineEnd(this.r, this.c);
+ var r = end[0];
+ var c = end[1];
+ var line = new Array();
+ while (this.isPrintable(this.charBuf[r][c])) {
+ line[line.length] = String.fromCharCode(this.charBuf[r][c]);
+ if (c > 0) c--
+ else if (r > 0) {
+ c = this.maxCols - 1;
+ r--;
+ }
+ else break;
+ }
+ line.reverse();
+ return line.join('');
+ },
+ _clearLine: function() {
+ var end = this._getLineEnd(this.r, this.c);
+ var r = end[0];
+ var c = end[1];
+ var line = '';
+ while (this.isPrintable(this.charBuf[r][c])) {
+ this.charBuf[r][c] = 0;
+ if (c > 0) {
+ c--;
+ } else if (r > 0) {
+ this.redraw(r);
+ c = this.maxCols - 1;
+ r--;
+ } else break;
+ }
+ if (r != end[0]) this.redraw(r);
+ c++;
+ this.cursorSet(r, c);
+ this.insert = false;
+ },
+ focus: function() {
+ this.globals.setFocus(this);
+ },
+ termKey: null,
+ _makeTerm: function(rebuild) {
+ window.status = 'Building terminal ...';
+ this.globals.hasLayers = (document.layers) ? true : false;
+ this.globals.hasSubDivs = (navigator.userAgent.indexOf('Gecko') < 0);
+ var divPrefix = this.termDiv + '_r';
+ var s = '';
+ s += '<table border="0" cellspacing="0" cellpadding="' + this.conf.frameWidth + '">\n';
+ s += '<tr><td bgcolor="' + this.conf.frameColor + '"><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="' + this.conf.bgColor + '"><table border="0" cellspacing="0" cellpadding="0">\n';
+ var rstr = '';
+ for (var c = 0; c < this.conf.cols; c++) rstr += '&nbsp;';
+ for (var r = 0; r < this.conf.rows; r++) {
+ var termid = ((this.globals.hasLayers) || (this.globals.hasSubDivs)) ? '' : ' id="' + divPrefix + r + '"';
+ s += '<tr><td nowrap height="' + this.conf.rowHeight + '"' + termid + ' class="' + this.conf.fontClass + '">' + rstr + '<\/td><\/tr>\n';
+ }
+ s += '<\/table><\/td><\/tr>\n';
+ s += '<\/table><\/td><\/tr>\n';
+ s += '<\/table>\n';
+ var termOffset = 48 + this.conf.frameWidth;
+ if (this.globals.hasLayers) {
+ for (var r = 0; r < this.conf.rows; r++) {
+ s += '<layer name="' + divPrefix + r + '" top="' + (termOffset + r * this.conf.rowHeight) + '" left="' + termOffset + '" class="' + this.conf.fontClass + '"><\/layer>\n';
+ }
+ this.ns4ParentDoc = document.layers[this.termDiv].document;
+ this.globals.termStringStart = '<table border="0" cellspacing="0" cellpadding="0"><tr><td nowrap height="' + this.conf.rowHeight + '" class="' + this.conf.fontClass + '">';
+ this.globals.termStringEnd = '<\/td><\/tr><\/table>';
+ } else if (this.globals.hasSubDivs) {
+ for (var r = 0; r < this.conf.rows; r++) {
+ s += '<div id="' + divPrefix + r + '" style="position:absolute; top:' + (termOffset + r * this.conf.rowHeight) + 'px; left: ' + termOffset + 'px;" class="' + this.conf.fontClass + '"><\/div>\n';
+ }
+ this.globals.termStringStart = '<table border="0" cellspacing="0" cellpadding="0"><tr><td nowrap height="' + this.conf.rowHeight + '" class="' + this.conf.fontClass + '">';
+ this.globals.termStringEnd = '<\/td><\/tr><\/table>';
+ }
+ this.globals.writeElement(this.termDiv, s);
+ if (!rebuild) {
+ this.globals.setElementXY(this.termDiv, this.conf.x, this.conf.y);
+ this.globals.setVisible(this.termDiv, 1);
+ }
+ window.status = '';
+ },
+ rebuild: function() {
+ var rl = this.conf.rows;
+ var cl = this.conf.cols;
+ for (var r = 0; r < rl; r++) {
+ var cbr = this.charBuf[r];
+ if (!cbr) {
+ this.charBuf[r] = this.getRowArray(cl, 0);
+ this.styleBuf[r] = this.getRowArray(cl, 0);
+ } else if (cbr.length < cl) {
+ for (var c = cbr.length; c < cl; c++) {
+ this.charBuf[r][c] = 0;
+ this.styleBuf[r][c] = 0;
+ }
+ }
+ }
+ var resetcrsr = false;
+ if (this.r >= rl) {
+ r = rl - 1;
+ resetcrsr = true;
+ }
+ if (this.c >= cl) {
+ c = cl - 1;
+ resetcrsr = true;
+ }
+ if ((resetcrsr) && (this.cursoractive)) this.cursorOn();
+ this._makeTerm(true);
+ for (var r = 0; r < rl; r++) {
+ this.redraw(r);
+ }
+ },
+ moveTo: function(x, y) {
+ this.globals.setElementXY(this.termDiv, x, y);
+ },
+ resizeTo: function(x, y) {
+ if (this.termDivReady()) {
+ x = parseInt(x, 10);
+ y = parseInt(y, 10);
+ if ((isNaN(x)) || (isNaN(y)) || (x < 4) || (y < 2)) return false;
+ this.maxCols = this.conf.cols = x;
+ this.maxLines = this.conf.rows = y;
+ this._makeTerm();
+ this.clear();
+ return true;
+ } else return false;
+ },
+ redraw: function(r) {
+ var s = this.globals.termStringStart;
+ var curStyle = 0;
+ var tstls = this.globals.termStyles;
+ var tscls = this.globals.termStyleClose;
+ var tsopn = this.globals.termStyleOpen;
+ var tspcl = this.globals.termSpecials;
+ var tclrs = this.globals.colorCodes;
+ var tnclrs = this.globals.nsColorCodes;
+ var twclrs = this.globals.webColorCodes;
+ var t_cb = this.charBuf;
+ var t_sb = this.styleBuf;
+ var clr;
+ for (var i = 0; i < this.conf.cols; i++) {
+ var c = t_cb[r][i];
+ var cs = t_sb[r][i];
+ if (cs != curStyle) {
+ if (curStyle) {
+ if (curStyle & 0xffff00) s += '</span>';
+ for (var k = tstls.length - 1; k >= 0; k--) {
+ var st = tstls[k];
+ if (curStyle & st) s += tscls[st];
+ }
+ }
+ curStyle = cs;
+ for (var k = 0; k < tstls.length; k++) {
+ var st = tstls[k];
+ if (curStyle & st) s += tsopn[st];
+ }
+ clr = '';
+ if (curStyle & 0xff00) {
+ var cc = (curStyle & 0xff00) >>> 8;
+ clr = (cc < 16) ? tclrs[cc] : '#' + tnclrs[cc - 16];
+ } else if (curStyle & 0xff0000) {
+ clr = '#' + twclrs[(curStyle & 0xff0000) >>> 16];
+ }
+ if (clr) {
+ if (curStyle & 1) {
+ s += '<span style="background-color:' + clr + ' !important;">';
+ } else {
+ s += '<span style="color:' + clr + ' !important;">';
+ }
+ }
+ }
+ s += (tspcl[c]) ? tspcl[c] : String.fromCharCode(c);
+ }
+ if (curStyle > 0) {
+ if (curStyle & 0xffff00) s += '</span>';
+ for (var k = tstls.length - 1; k >= 0; k--) {
+ var st = tstls[k];
+ if (curStyle & st) s += tscls[st];
+ }
+ }
+ s += this.globals.termStringEnd;
+ this.globals.writeElement(this.termDiv + '_r' + r, s, this.ns4ParentDoc);
+ },
+ guiReady: function() {
+ ready = true;
+ if (this.globals.guiElementsReady(this.termDiv, window.document)) {
+ for (var r = 0; r < this.conf.rows; r++) {
+ if (this.globals.guiElementsReady(this.termDiv + '_r' + r, this.ns4ParentDoc) == false) {
+ ready = false;
+ break;
+ }
+ }
+ } else ready = false;
+ return ready;
+ },
+ termDivReady: function() {
+ if (document.layers) {
+ return (document.layers[this.termDiv]) ? true : false;
+ } else if (document.getElementById) {
+ return (document.getElementById(this.termDiv)) ? true : false;
+ } else if (document.all) {
+ return (document.all[this.termDiv]) ? true : false;
+ } else {
+ return false;
+ }
+ },
+ getDimensions: function() {
+ var w = 0;
+ var h = 0;
+ var d = this.termDiv;
+ if (document.layers) {
+ if (document.layers[d]) {
+ w = document.layers[d].clip.right;
+ h = document.layers[d].clip.bottom;
+ }
+ } else if (document.getElementById) {
+ var obj = document.getElementById(d);
+ if ((obj) && (obj.firstChild)) {
+ w = parseInt(obj.firstChild.offsetWidth, 10);
+ h = parseInt(obj.firstChild.offsetHeight, 10);
+ } else if ((obj) && (obj.children) && (obj.children[0])) {
+ w = parseInt(obj.children[0].offsetWidth, 10);
+ h = parseInt(obj.children[0].offsetHeight, 10);
+ }
+ } else if (document.all) {
+ var obj = document.all[d];
+ if ((obj) && (obj.children) && (obj.children[0])) {
+ w = parseInt(obj.children[0].offsetWidth, 10);
+ h = parseInt(obj.children[0].offsetHeight, 10);
+ }
+ }
+ return {
+ width: w,
+ height: h
+ };
+ },
+ globals: {
+ termToInitialze: null,
+ activeTerm: null,
+ kbdEnabled: false,
+ keylock: false,
+ keyRepeatDelay1: 450,
+ keyRepeatDelay2: 100,
+ keyRepeatTimer: null,
+ lcMorePrompt1: ' -- MORE -- ',
+ lcMorePromtp1Style: 1,
+ lcMorePrompt2: ' (Type: space to continue, \'q\' to quit)',
+ lcMorePrompt2Style: 0,
+ lcMoreKeyAbort: 113,
+ lcMoreKeyContinue: 32,
+ _initGlobals: function() {
+ var tg = Terminal.prototype.globals;
+ tg._extendMissingStringMethods();
+ tg._initWebColors();
+ tg._initDomKeyRef();
+ Terminal.prototype.termKey = tg.termKey;
+ },
+ getHexChar: function(c) {
+ var tg = Terminal.prototype.globals;
+ if (tg.isHexChar(c)) return tg.hexToNum[c];
+ return -1;
+ },
+ isHexChar: function(c) {
+ return (((c >= '0') && (c <= '9')) || ((c >= 'a') && (c <= 'f')) || ((c >= 'A') && (c <= 'F'))) ? true : false;
+ },
+ isHexOnlyChar: function(c) {
+ return (((c >= 'a') && (c <= 'f')) || ((c >= 'A') && (c <= 'F'))) ? true : false;
+ },
+ hexToNum: {
+ '0': 0,
+ '1': 1,
+ '2': 2,
+ '3': 3,
+ '4': 4,
+ '5': 5,
+ '6': 6,
+ '7': 7,
+ '8': 8,
+ '9': 9,
+ 'a': 10,
+ 'b': 11,
+ 'c': 12,
+ 'd': 13,
+ 'e': 14,
+ 'f': 15,
+ 'A': 10,
+ 'B': 11,
+ 'C': 12,
+ 'D': 13,
+ 'E': 14,
+ 'F': 15
+ },
+ webColors: [],
+ webColorCodes: [''],
+ colors: {
+ black: 1,
+ red: 2,
+ green: 3,
+ yellow: 4,
+ blue: 5,
+ magenta: 6,
+ cyan: 7,
+ white: 8,
+ grey: 9,
+ red2: 10,
+ green2: 11,
+ yellow2: 12,
+ blue2: 13,
+ magenta2: 14,
+ cyan2: 15,
+ red1: 2,
+ green1: 3,
+ yellow1: 4,
+ blue1: 5,
+ magenta1: 6,
+ cyan1: 7,
+ gray: 9,
+ darkred: 10,
+ darkgreen: 11,
+ darkyellow: 12,
+ darkblue: 13,
+ darkmagenta: 14,
+ darkcyan: 15,
+ 'default': 0,
+ clear: 0
+ },
+ colorCodes: ['', '#000000', '#ff0000', '#00ff00', '#ffff00', '#0066ff', '#ff00ff', '#00ffff', '#ffffff', '#808080', '#990000', '#009900', '#999900', '#003399', '#990099', '#009999'],
+ nsColors: {
+ 'aliceblue': 1,
+ 'antiquewhite': 2,
+ 'aqua': 3,
+ 'aquamarine': 4,
+ 'azure': 5,
+ 'beige': 6,
+ 'black': 7,
+ 'blue': 8,
+ 'blueviolet': 9,
+ 'brown': 10,
+ 'burlywood': 11,
+ 'cadetblue': 12,
+ 'chartreuse': 13,
+ 'chocolate': 14,
+ 'coral': 15,
+ 'cornflowerblue': 16,
+ 'cornsilk': 17,
+ 'crimson': 18,
+ 'darkblue': 19,
+ 'darkcyan': 20,
+ 'darkgoldenrod': 21,
+ 'darkgray': 22,
+ 'darkgreen': 23,
+ 'darkkhaki': 24,
+ 'darkmagenta': 25,
+ 'darkolivegreen': 26,
+ 'darkorange': 27,
+ 'darkorchid': 28,
+ 'darkred': 29,
+ 'darksalmon': 30,
+ 'darkseagreen': 31,
+ 'darkslateblue': 32,
+ 'darkslategray': 33,
+ 'darkturquoise': 34,
+ 'darkviolet': 35,
+ 'deeppink': 36,
+ 'deepskyblue': 37,
+ 'dimgray': 38,
+ 'dodgerblue': 39,
+ 'firebrick': 40,
+ 'floralwhite': 41,
+ 'forestgreen': 42,
+ 'fuchsia': 43,
+ 'gainsboro': 44,
+ 'ghostwhite': 45,
+ 'gold': 46,
+ 'goldenrod': 47,
+ 'gray': 48,
+ 'green': 49,
+ 'greenyellow': 50,
+ 'honeydew': 51,
+ 'hotpink': 52,
+ 'indianred': 53,
+ 'indigo': 54,
+ 'ivory': 55,
+ 'khaki': 56,
+ 'lavender': 57,
+ 'lavenderblush': 58,
+ 'lawngreen': 59,
+ 'lemonchiffon': 60,
+ 'lightblue': 61,
+ 'lightcoral': 62,
+ 'lightcyan': 63,
+ 'lightgoldenrodyellow': 64,
+ 'lightgreen': 65,
+ 'lightgrey': 66,
+ 'lightpink': 67,
+ 'lightsalmon': 68,
+ 'lightseagreen': 69,
+ 'lightskyblue': 70,
+ 'lightslategray': 71,
+ 'lightsteelblue': 72,
+ 'lightyellow': 73,
+ 'lime': 74,
+ 'limegreen': 75,
+ 'linen': 76,
+ 'maroon': 77,
+ 'mediumaquamarine': 78,
+ 'mediumblue': 79,
+ 'mediumorchid': 80,
+ 'mediumpurple': 81,
+ 'mediumseagreen': 82,
+ 'mediumslateblue': 83,
+ 'mediumspringgreen': 84,
+ 'mediumturquoise': 85,
+ 'mediumvioletred': 86,
+ 'midnightblue': 87,
+ 'mintcream': 88,
+ 'mistyrose': 89,
+ 'moccasin': 90,
+ 'navajowhite': 91,
+ 'navy': 92,
+ 'oldlace': 93,
+ 'olive': 94,
+ 'olivedrab': 95,
+ 'orange': 96,
+ 'orangered': 97,
+ 'orchid': 98,
+ 'palegoldenrod': 99,
+ 'palegreen': 100,
+ 'paleturquoise': 101,
+ 'palevioletred': 102,
+ 'papayawhip': 103,
+ 'peachpuff': 104,
+ 'peru': 105,
+ 'pink': 106,
+ 'plum': 107,
+ 'powderblue': 108,
+ 'purple': 109,
+ 'red': 110,
+ 'rosybrown': 111,
+ 'royalblue': 112,
+ 'saddlebrown': 113,
+ 'salmon': 114,
+ 'sandybrown': 115,
+ 'seagreen': 116,
+ 'seashell': 117,
+ 'sienna': 118,
+ 'silver': 119,
+ 'skyblue': 120,
+ 'slateblue': 121,
+ 'slategray': 122,
+ 'snow': 123,
+ 'springgreen': 124,
+ 'steelblue': 125,
+ 'tan': 126,
+ 'teal': 127,
+ 'thistle': 128,
+ 'tomato': 129,
+ 'turquoise': 130,
+ 'violet': 131,
+ 'wheat': 132,
+ 'white': 133,
+ 'whitesmoke': 134,
+ 'yellow': 135,
+ 'yellowgreen': 136
+ },
+ nsColorCodes: ['', 'f0f8ff', 'faebd7', '00ffff', '7fffd4', 'f0ffff', 'f5f5dc', '000000', '0000ff', '8a2be2', 'a52a2a', 'deb887', '5f9ea0', '7fff00', 'd2691e', 'ff7f50', '6495ed', 'fff8dc', 'dc143c', '00008b', '008b8b', 'b8860b', 'a9a9a9', '006400', 'bdb76b', '8b008b', '556b2f', 'ff8c00', '9932cc', '8b0000', 'e9967a', '8fbc8f', '483d8b', '2f4f4f', '00ced1', '9400d3', 'ff1493', '00bfff', '696969', '1e90ff', 'b22222', 'fffaf0', '228b22', 'ff00ff', 'dcdcdc', 'f8f8ff', 'ffd700', 'daa520', '808080', '008000', 'adff2f', 'f0fff0', 'ff69b4', 'cd5c5c', '4b0082', 'fffff0', 'f0e68c', 'e6e6fa', 'fff0f5', '7cfc00', 'fffacd', 'add8e6', 'f08080', 'e0ffff', 'fafad2', '90ee90', 'd3d3d3', 'ffb6c1', 'ffa07a', '20b2aa', '87cefa', '778899', 'b0c4de', 'ffffe0', '00ff00', '32cd32', 'faf0e6', '800000', '66cdaa', '0000cd', 'ba55d3', '9370db', '3cb371', '7b68ee', '00fa9a', '48d1cc', 'c71585', '191970', 'f5fffa', 'ffe4e1', 'ffe4b5', 'ffdead', '000080', 'fdf5e6', '808000', '6b8e23', 'ffa500', 'ff4500', 'da70d6', 'eee8aa', '98fb98', 'afeeee', 'db7093', 'ffefd5', 'ffdab9', 'cd853f', 'ffc0cb', 'dda0dd', 'b0e0e6', '800080', 'ff0000', 'bc8f8f', '4169e1', '8b4513', 'fa8072', 'f4a460', '2e8b57', 'fff5ee', 'a0522d', 'c0c0c0', '87ceeb', '6a5acd', '708090', 'fffafa', '00ff7f', '4682b4', 'd2b48c', '008080', 'd8bfd8', 'ff6347', '40e0d0', 'ee82ee', 'f5deb3', 'ffffff', 'f5f5f5', 'ffff00', '9acd32'],
+ _webSwatchChars: ['0', '3', '6', '9', 'c', 'f'],
+ _initWebColors: function() {
+ var tg = Terminal.prototype.globals;
+ var ws = tg._webColorSwatch;
+ var wn = tg.webColors;
+ var cc = tg.webColorCodes;
+ var n = 1;
+ var a, b, c, al, bl, bs, cl;
+ for (var i = 0; i < 6; i++) {
+ a = tg._webSwatchChars[i];
+ al = a + a;
+ for (var j = 0; j < 6; j++) {
+ b = tg._webSwatchChars[j];
+ bl = al + b + b;
+ bs = a + b;
+ for (var k = 0; k < 6; k++) {
+ c = tg._webSwatchChars[k];
+ cl = bl + c + c;
+ wn[bs + c] = wn[cl] = n;
+ cc[n] = cl;
+ n++;
+ }
+ }
+ }
+ },
+ webifyColor: function(s) {
+ var tg = Terminal.prototype.globals;
+ if (s.length == 6) {
+ var c = '';
+ for (var i = 0; i < 6; i += 2) {
+ var a = s.charAt(i);
+ var b = s.charAt(i + 1);
+ if ((tg.isHexChar(a)) && (tg.isHexChar(b))) {
+ c += tg._webSwatchChars[Math.round(parseInt(a + b, 16) / 255 * 5)];
+ } else {
+ return '';
+ }
+ }
+ return c;
+ } else if (s.length == 3) {
+ var c = '';
+ for (var i = 0; i < 3; i++) {
+ var a = s.charAt(i);
+ if (tg.isHexChar(a)) {
+ c += tg._webSwatchChars[Math.round(parseInt(a, 16) / 15 * 5)];
+ } else {
+ return '';
+ }
+ }
+ return c;
+ } else return '';
+ },
+ setColor: function(label, value) {
+ var tg = Terminal.prototype.globals;
+ if ((typeof label == 'number') && (label >= 1) && (label <= 15)) {
+ tg.colorCodes[label] = value;
+ } else if (typeof label == 'string') {
+ label = label.toLowerCase();
+ if ((label.length == 1) && (tg.isHexChar(label))) {
+ var n = tg.hexToNum[label];
+ if (n) tg.colorCodes[n] = value;
+ } else if (typeof tg.colors[label] != 'undefined') {
+ var n = tg.colors[label];
+ if (n) tg.colorCodes[n] = value;
+ }
+ }
+ },
+ getColorString: function(label) {
+ var tg = Terminal.prototype.globals;
+ if ((typeof label == 'number') && (label >= 0) && (label <= 15)) {
+ return tg.colorCodes[label];
+ } else if (typeof label == 'string') {
+ label = label.toLowerCase();
+ if ((label.length == 1) && (tg.isHexChar(label))) {
+ return tg.colorCodes[tg.hexToNum[label]];
+ } else if ((typeof tg.colors[label] != 'undefined')) {
+ return tg.colorCodes[tg.colors[label]];
+ }
+ }
+ return '';
+ },
+ getColorCode: function(label) {
+ var tg = Terminal.prototype.globals;
+ if ((typeof label == 'number') && (label >= 0) && (label <= 15)) {
+ return label;
+ } else if (typeof label == 'string') {
+ label = label.toLowerCase();
+ if ((label.length == 1) && (tg.isHexChar(label))) {
+ return parseInt(label, 16);
+ } else if ((typeof tg.colors[label] != 'undefined')) {
+ return tg.colors[label];
+ }
+ }
+ return 0;
+ },
+ insertText: function(text) {
+ var tg = Terminal.prototype.globals;
+ var termRef = tg.activeTerm;
+ if ((!termRef) || (termRef.closed) || (tg.keylock) || (termRef.lock) || (termRef.charMode)) return false;
+ for (var i = 0; i < text.length; i++) {
+ tg.keyHandler({
+ which: text.charCodeAt(i),
+ _remapped: true
+ });
+ }
+ return true;
+ },
+ importEachLine: function(text) {
+ var tg = Terminal.prototype.globals;
+ var termRef = tg.activeTerm;
+ if ((!termRef) || (termRef.closed) || (tg.keylock) || (termRef.lock) || (termRef.charMode)) return false;
+ termRef.cursorOff();
+ termRef._clearLine();
+ text = text.replace(/\r\n?/g, '\n');
+ var t = text.split('\n');
+ for (var i = 0; i < t.length; i++) {
+ for (var k = 0; k < t[i].length; k++) {
+ tg.keyHandler({
+ which: t[i].charCodeAt(k),
+ _remapped: true
+ });
+ }
+ tg.keyHandler({
+ which: term.termKey.CR,
+ _remapped: true
+ });
+ }
+ return true;
+ },
+ importMultiLine: function(text) {
+ var tg = Terminal.prototype.globals;
+ var termRef = tg.activeTerm;
+ if ((!termRef) || (termRef.closed) || (tg.keylock) || (termRef.lock) || (termRef.charMode)) return false;
+ termRef.lock = true;
+ termRef.cursorOff();
+ termRef._clearLine();
+ text = text.replace(/\r\n?/g, '\n');
+ var lines = text.split('\n');
+ for (var i = 0; i < lines.length; i++) {
+ termRef.type(lines[i]);
+ if (i < lines.length - 1) termRef.newLine();
+ }
+ termRef.lineBuffer = text;
+ termRef.lastLine = '';
+ termRef.inputChar = 0;
+ termRef.handler();
+ return true;
+ },
+ normalize: function(n, m) {
+ var s = '' + n;
+ while (s.length < m) s = '0' + s;
+ return s;
+ },
+ fillLeft: function(t, n) {
+ if (typeof t != 'string') t = '' + t;
+ while (t.length < n) t = ' ' + t;
+ return t;
+ },
+ center: function(t, l) {
+ var s = '';
+ for (var i = t.length; i < l; i += 2) s += ' ';
+ return s + t;
+ },
+ stringReplace: function(s1, s2, t) {
+ var l1 = s1.length;
+ var l2 = s2.length;
+ var ofs = t.indexOf(s1);
+ while (ofs >= 0) {
+ t = t.substring(0, ofs) + s2 + t.substring(ofs + l1);
+ ofs = t.indexOf(s1, ofs + l2);
+ }
+ return t;
+ },
+ wrapChars: {
+ 9: 1,
+ 10: 1,
+ 12: 4,
+ 13: 1,
+ 32: 1,
+ 40: 3,
+ 45: 2,
+ 61: 2,
+ 91: 3,
+ 94: 3,
+ 123: 3
+ },
+ setFocus: function(termref) {
+ Terminal.prototype.globals.activeTerm = termref;
+ Terminal.prototype.globals.clearRepeatTimer();
+ },
+ termKey: {
+ 'NUL': 0x00,
+ 'SOH': 0x01,
+ 'STX': 0x02,
+ 'ETX': 0x03,
+ 'EOT': 0x04,
+ 'ENQ': 0x05,
+ 'ACK': 0x06,
+ 'BEL': 0x07,
+ 'BS': 0x08,
+ 'BACKSPACE': 0x08,
+ 'HT': 0x09,
+ 'TAB': 0x09,
+ 'LF': 0x0A,
+ 'VT': 0x0B,
+ 'FF': 0x0C,
+ 'CR': 0x0D,
+ 'SO': 0x0E,
+ 'SI': 0x0F,
+ 'DLE': 0x10,
+ 'DC1': 0x11,
+ 'DC2': 0x12,
+ 'DC3': 0x13,
+ 'DC4': 0x14,
+ 'NAK': 0x15,
+ 'SYN': 0x16,
+ 'ETB': 0x17,
+ 'CAN': 0x18,
+ 'EM': 0x19,
+ 'SUB': 0x1A,
+ 'ESC': 0x1B,
+ 'IS4': 0x1C,
+ 'IS3': 0x1D,
+ 'IS2': 0x1E,
+ 'IS1': 0x1F,
+ 'DEL': 0x7F,
+ 'EURO': 0x20AC,
+ 'LEFT': 0x1C,
+ 'RIGHT': 0x1D,
+ 'UP': 0x1E,
+ 'DOWN': 0x1F
+ },
+ termDomKeyRef: {},
+ _domKeyMappingData: {
+ 'LEFT': 'LEFT',
+ 'RIGHT': 'RIGHT',
+ 'UP': 'UP',
+ 'DOWN': 'DOWN',
+ 'BACK_SPACE': 'BS',
+ 'RETURN': 'CR',
+ 'ENTER': 'CR',
+ 'ESCAPE': 'ESC',
+ 'DELETE': 'DEL',
+ 'TAB': 'TAB'
+ },
+ _initDomKeyRef: function() {
+ var tg = Terminal.prototype.globals;
+ var m = tg._domKeyMappingData;
+ var r = tg.termDomKeyRef;
+ var k = tg.termKey;
+ for (var i in m) r['DOM_VK_' + i] = k[m[i]];
+ },
+ registerEvent: function(obj, eventType, handler, capture) {
+ if (obj.addEventListener) {
+ obj.addEventListener(eventType.toLowerCase(), handler, capture);
+ } else {
+ var et = eventType.toUpperCase();
+ if ((window.Event) && (window.Event[et]) && (obj.captureEvents)) obj.captureEvents(Event[et]);
+ obj['on' + eventType.toLowerCase()] = handler;
+ }
+ },
+ releaseEvent: function(obj, eventType, handler, capture) {
+ if (obj.removeEventListener) {
+ obj.removeEventListener(eventType.toLowerCase(), handler, capture);
+ } else {
+ var et = eventType.toUpperCase();
+ if ((window.Event) && (window.Event[et]) && (obj.releaseEvents)) obj.releaseEvents(Event[et]);
+ et = 'on' + eventType.toLowerCase();
+ if ((obj[et]) && (obj[et] == handler)) obj.et = null;
+ }
+ },
+ enableKeyboard: function(term) {
+ var tg = Terminal.prototype.globals;
+ if (!tg.kbdEnabled) {
+ tg.registerEvent(document, 'keypress', tg.keyHandler, true);
+ tg.registerEvent(document, 'keydown', tg.keyFix, true);
+ tg.registerEvent(document, 'keyup', tg.clearRepeatTimer, true);
+ tg.kbdEnabled = true;
+ }
+ tg.activeTerm = term;
+ },
+ disableKeyboard: function(term) {
+ var tg = Terminal.prototype.globals;
+ if (tg.kbdEnabled) {
+ tg.releaseEvent(document, 'keypress', tg.keyHandler, true);
+ tg.releaseEvent(document, 'keydown', tg.keyFix, true);
+ tg.releaseEvent(document, 'keyup', tg.clearRepeatTimer, true);
+ tg.kbdEnabled = false;
+ }
+ tg.activeTerm = null;
+ },
+ keyFix: function(e) {
+ var tg = Terminal.prototype.globals;
+ var term = tg.activeTerm;
+ if ((tg.keylock) || (term.lock)) return true;
+ if (window.event) {
+ var ch = window.event.keyCode;
+ if (!e) e = window.event;
+ if (e.DOM_VK_UP) {
+ for (var i in tg.termDomKeyRef) {
+ if ((e[i]) && (ch == e[i])) {
+ tg.keyHandler({
+ which: tg.termDomKeyRef[i],
+ _remapped: true,
+ _repeat: (ch == 0x1B) ? true : false
+ });
+ if (e.preventDefault) e.preventDefault();
+ if (e.stopPropagation) e.stopPropagation();
+ e.cancleBubble = true;
+ return false;
+ }
+ }
+ e.cancleBubble = false;
+ return true;
+ } else {
+ var termKey = term.termKey;
+ var keyHandler = tg.keyHandler;
+ if ((ch == 8) && (!term.isSafari) && (!term.isOpera)) keyHandler({
+ which: termKey.BS,
+ _remapped: true,
+ _repeat: true
+ })
+ else if (ch == 9) keyHandler({
+ which: termKey.TAB,
+ _remapped: true,
+ _repeat: (term.printTab) ? false : true
+ })
+ else if (ch == 37) keyHandler({
+ which: termKey.LEFT,
+ _remapped: true,
+ _repeat: true
+ })
+ else if (ch == 39) keyHandler({
+ which: termKey.RIGHT,
+ _remapped: true,
+ _repeat: true
+ })
+ else if (ch == 38) keyHandler({
+ which: termKey.UP,
+ _remapped: true,
+ _repeat: true
+ })
+ else if (ch == 40) keyHandler({
+ which: termKey.DOWN,
+ _remapped: true,
+ _repeat: true
+ })
+ else if (ch == 127) keyHandler({
+ which: termKey.DEL,
+ _remapped: true,
+ _repeat: true
+ })
+ else if ((ch >= 57373) && (ch <= 57376)) {
+ if (ch == 57373) keyHandler({
+ which: termKey.UP,
+ _remapped: true,
+ _repeat: true
+ })
+ else if (ch == 57374) keyHandler({
+ which: termKey.DOWN,
+ _remapped: true,
+ _repeat: true
+ })
+ else if (ch == 57375) keyHandler({
+ which: termKey.LEFT,
+ _remapped: true,
+ _repeat: true
+ })
+ else if (ch == 57376) keyHandler({
+ which: termKey.RIGHT,
+ _remapped: true,
+ _repeat: true
+ });
+ } else {
+ e.cancleBubble = false;
+ return true;
+ }
+ if (e.preventDefault) e.preventDefault();
+ if (e.stopPropagation) e.stopPropagation();
+ e.cancleBubble = true;
+ return false;
+ }
+ }
+ },
+ clearRepeatTimer: function(e) {
+ var tg = Terminal.prototype.globals;
+ if (tg.keyRepeatTimer) {
+ clearTimeout(tg.keyRepeatTimer);
+ tg.keyRepeatTimer = null;
+ }
+ },
+ doKeyRepeat: function(ch) {
+ Terminal.prototype.globals.keyHandler({
+ which: ch,
+ _remapped: true,
+ _repeated: true
+ })
+ },
+ keyHandler: function(e) {
+ var tg = Terminal.prototype.globals;
+ var term = tg.activeTerm;
+ if ((tg.keylock) || (term.lock)) return true;
+ if ((window.event) && (window.event.preventDefault)) window.event.preventDefault()
+ else if ((e) && (e.preventDefault)) e.preventDefault();
+ if ((window.event) && (window.event.stopPropagation)) window.event.stopPropagation()
+ else if ((e) && (e.stopPropagation)) e.stopPropagation();
+ var ch;
+ var ctrl = false;
+ var shft = false;
+ var remapped = false;
+ var termKey = term.termKey;
+ var keyRepeat = 0;
+ if (e) {
+ ch = e.which;
+ ctrl = (((e.ctrlKey) && (e.altKey)) || (e.modifiers == 2));
+ shft = ((e.shiftKey) || (e.modifiers == 4));
+ if (e._remapped) {
+ remapped = true;
+ if (window.event) {
+ ctrl = ((ctrl) || ((window.event.ctrlKey) && (!window.event.altKey)));
+ shft = ((shft) || (window.event.shiftKey));
+ }
+ }
+ if (e._repeated) {
+ keyRepeat = 2;
+ } else if (e._repeat) {
+ keyRepeat = 1;
+ }
+ } else if (window.event) {
+ ch = window.event.keyCode;
+ ctrl = ((window.event.ctrlKey) && (!window.event.altKey));
+ shft = (window.event.shiftKey);
+ if (window.event._repeated) {
+ keyRepeat = 2;
+ } else if (window.event._repeat) {
+ keyRepeat = 1;
+ }
+ } else {
+ return true;
+ }
+ if ((ch == '') && (remapped == false)) {
+ if (e == null) e = window.event;
+ if ((e.charCode == 0) && (e.keyCode)) {
+ if (e.DOM_VK_UP) {
+ var dkr = tg.termDomKeyRef;
+ for (var i in dkr) {
+ if ((e[i]) && (e.keyCode == e[i])) {
+ ch = dkr[i];
+ break;
+ }
+ }
+ } else {
+ if (e.keyCode == 28) ch = termKey.LEFT
+ else if (e.keyCode == 29) ch = termKey.RIGHT
+ else if (e.keyCode == 30) ch = termKey.UP
+ else if (e.keyCode == 31) ch = termKey.DOWN
+ else if (e.keyCode == 37) ch = termKey.LEFT
+ else if (e.keyCode == 39) ch = termKey.RIGHT
+ else if (e.keyCode == 38) ch = termKey.UP
+ else if (e.keyCode == 40) ch = termKey.DOWN
+ else if (e.keyCode == 9) ch = termKey.TAB;
+ }
+ }
+ }
+ if ((ch >= 0xE000) && (ch <= 0xF8FF)) return;
+ if (keyRepeat) {
+ tg.clearRepeatTimer();
+ tg.keyRepeatTimer = window.setTimeout('Terminal.prototype.globals.doKeyRepeat(' + ch + ')', (keyRepeat == 1) ? tg.keyRepeatDelay1 : tg.keyRepeatDelay2);
+ }
+ if (term.charMode) {
+ term.insert = false;
+ term.inputChar = ch;
+ term.lineBuffer = '';
+ term.handler();
+ if ((ch <= 32) && (window.event)) window.event.cancleBubble = true;
+ return false;
+ }
+ if (!ctrl) {
+ if (ch == termKey.CR) {
+ term.lock = true;
+ term.cursorOff();
+ term.insert = false;
+ if (term.rawMode) {
+ term.lineBuffer = term.lastLine;
+ } else {
+ term.lineBuffer = term._getLine();
+ if ((term.lineBuffer != '') && ((!term.historyUnique) || (term.history.length == 0) || (term.lineBuffer != term.history[term.history.length - 1]))) {
+ term.history[term.history.length] = term.lineBuffer;
+ }
+ term.histPtr = term.history.length;
+ }
+ term.lastLine = '';
+ term.inputChar = 0;
+ term.handler();
+ if (window.event) window.event.cancleBubble = true;
+ return false;
+ } else if (ch == termKey.ESC && term.conf.closeOnESC) {
+ term.close();
+ if (window.event) window.event.cancleBubble = true;
+ return false;
+ }
+ if ((ch < 32) && (term.rawMode)) {
+ if (window.event) window.event.cancleBubble = true;
+ return false;
+ } else {
+ if (ch == termKey.LEFT) {
+ term.cursorLeft();
+ if (window.event) window.event.cancleBubble = true;
+ return false;
+ } else if (ch == termKey.RIGHT) {
+ term.cursorRight();
+ if (window.event) window.event.cancleBubble = true;
+ return false;
+ } else if (ch == termKey.UP) {
+ term.cursorOff();
+ if (term.histPtr == term.history.length) term.lastLine = term._getLine();
+ term._clearLine();
+ if ((term.history.length) && (term.histPtr >= 0)) {
+ if (term.histPtr > 0) term.histPtr--;
+ term.type(term.history[term.histPtr]);
+ } else if (term.lastLine) term.type(term.lastLine);
+ term.cursorOn();
+ if (window.event) window.event.cancleBubble = true;
+ return false;
+ } else if (ch == termKey.DOWN) {
+ term.cursorOff();
+ if (term.histPtr == term.history.length) term.lastLine = term._getLine();
+ term._clearLine();
+ if ((term.history.length) && (term.histPtr <= term.history.length)) {
+ if (term.histPtr < term.history.length) term.histPtr++;
+ if (term.histPtr < term.history.length) term.type(term.history[term.histPtr])
+ else if (term.lastLine) term.type(term.lastLine);
+ } else if (term.lastLine) term.type(term.lastLine);
+ term.cursorOn();
+ if (window.event) window.event.cancleBubble = true;
+ return false;
+ } else if (ch == termKey.BS) {
+ term.backspace();
+ if (window.event) window.event.cancleBubble = true;
+ return false;
+ } else if (ch == termKey.DEL) {
+ if (term.DELisBS) term.backspace()
+ else term.fwdDelete();
+ if (window.event) window.event.cancleBubble = true;
+ return false;
+ }
+ }
+ }
+ if (term.rawMode) {
+ if (term.isPrintable(ch)) {
+ term.lastLine += String.fromCharCode(ch);
+ }
+ if ((ch == 32) && (window.event)) window.event.cancleBubble = true
+ else if ((window.opera) && (window.event)) window.event.cancleBubble = true;
+ return false;
+ } else {
+ if ((term.conf.catchCtrlH) && ((ch == termKey.BS) || ((ctrl) && (ch == 72)))) {
+ term.backspace();
+ if (window.event) window.event.cancleBubble = true;
+ return false;
+ } else if ((term.ctrlHandler) && ((ch < 32) || ((ctrl) && (term.isPrintable(ch, true))))) {
+ if (((ch >= 65) && (ch <= 96)) || (ch == 63)) {
+ if (ch == 63) ch = 31
+ else ch -= 64;
+ }
+ term.inputChar = ch;
+ term.ctrlHandler();
+ if (window.event) window.event.cancleBubble = true;
+ return false;
+ } else if ((ctrl) || (!term.isPrintable(ch, true))) {
+ if (window.event) window.event.cancleBubble = true;
+ return false;
+ } else if (term.isPrintable(ch, true)) {
+ if (term.blinkTimer) clearTimeout(term.blinkTimer);
+ if (term.insert) {
+ term.cursorOff();
+ term._scrollRight(term.r, term.c);
+ }
+ term._charOut(ch);
+ term.cursorOn();
+ if ((ch == 32) && (window.event)) window.event.cancleBubble = true
+ else if ((window.opera) && (window.event)) window.event.cancleBubble = true;
+ return false;
+ }
+ }
+ return true;
+ },
+ hasSubDivs: false,
+ hasLayers: false,
+ termStringStart: '',
+ termStringEnd: '',
+ termSpecials: {
+ 0: '&nbsp;',
+ 1: '&nbsp;',
+ 9: '&nbsp;',
+ 32: '&nbsp;',
+ 34: '&quot;',
+ 38: '&amp;',
+ 60: '&lt;',
+ 62: '&gt;',
+ 127: '&loz;',
+ 0x20AC: '&euro;'
+ },
+ termStyles: [1, 2, 4, 8],
+ termStyleMarkup: {
+ 'r': 1,
+ 'u': 2,
+ 'i': 4,
+ 's': 8
+ },
+ termStyleOpen: {
+ 1: '<span class="termReverse">',
+ 2: '<u>',
+ 4: '<i>',
+ 8: '<strike>'
+ },
+ termStyleClose: {
+ 1: '<\/span>',
+ 2: '<\/u>',
+ 4: '<\/i>',
+ 8: '<\/strike>'
+ },
+ assignStyle: function(styleCode, markup, htmlOpen, htmlClose) {
+ var tg = Terminal.prototype.globals;
+ if ((!styleCode) || (isNaN(styleCode))) {
+ if (styleCode >= 256) {
+ alert('termlib.js:\nCould not assign style.\n' + s + ' is not a valid power of 2 between 0 and 256.');
+ return;
+ }
+ }
+ var s = styleCode & 0xff;
+ var matched = false;
+ for (var i = 0; i < 8; i++) {
+ if ((s >>> i) & 1) {
+ if (matched) {
+ alert('termlib.js:\nCould not assign style code.\n' + s + ' is not a power of 2!');
+ return;
+ }
+ matched = true;
+ }
+ }
+ if (!matched) {
+ alert('termlib.js:\nCould not assign style code.\n' + s + ' is not a valid power of 2 between 0 and 256.');
+ return;
+ }
+ markup = String(markup).toLowerCase();
+ if ((markup == 'c') || (markup == 'p')) {
+ alert('termlib.js:\nCould not assign mark up.\n"' + markup + '" is a reserved code.');
+ return;
+ }
+ if (markup.length > 1) {
+ alert('termlib.js:\nCould not assign mark up.\n"' + markup + '" is not a single letter code.');
+ return;
+ }
+ var exists = false;
+ for (var i = 0; i < tg.termStyles.length; i++) {
+ if (tg.termStyles[i] == s) {
+ exists = true;
+ break;
+ }
+ }
+ if (exists) {
+ var m = tg.termStyleMarkup[markup];
+ if ((m) && (m != s)) {
+ alert('termlib.js:\nCould not assign mark up.\n"' + markup + '" is already in use.');
+ return;
+ }
+ } else {
+ if (tg.termStyleMarkup[markup]) {
+ alert('termlib.js:\nCould not assign mark up.\n"' + markup + '" is already in use.');
+ return;
+ }
+ tg.termStyles[tg.termStyles.length] = s;
+ }
+ tg.termStyleMarkup[markup] = s;
+ tg.termStyleOpen[s] = htmlOpen;
+ tg.termStyleClose[s] = htmlClose;
+ },
+ writeElement: function(e, t, d) {
+ if (document.layers) {
+ var doc = (d) ? d : window.document;
+ doc.layers[e].document.open();
+ doc.layers[e].document.write(t);
+ doc.layers[e].document.close();
+ } else if (document.getElementById) {
+ var obj = document.getElementById(e);
+ obj.innerHTML = t;
+ } else if (document.all) {
+ document.all[e].innerHTML = t;
+ }
+ },
+ setElementXY: function(d, x, y) {
+ if (document.layers) {
+ document.layers[d].moveTo(x, y);
+ } else if (document.getElementById) {
+ var obj = document.getElementById(d);
+ obj.style.left = x + 'px';
+ obj.style.top = y + 'px';
+ } else if (document.all) {
+ document.all[d].style.left = x + 'px';
+ document.all[d].style.top = y + 'px';
+ }
+ },
+ setVisible: function(d, v) {
+ if (document.layers) {
+ document.layers[d].visibility = (v) ? 'show' : 'hide';
+ } else if (document.getElementById) {
+ var obj = document.getElementById(d);
+ obj.style.visibility = (v) ? 'visible' : 'hidden';
+ } else if (document.all) {
+ document.all[d].style.visibility = (v) ? 'visible' : 'hidden';
+ }
+ },
+ setDisplay: function(d, v) {
+ if (document.getElementById) {
+ var obj = document.getElementById(d);
+ obj.style.display = v;
+ } else if (document.all) {
+ document.all[d].style.display = v;
+ }
+ },
+ guiElementsReady: function(e, d) {
+ if (document.layers) {
+ var doc = (d) ? d : window.document;
+ return ((doc) && (doc.layers[e])) ? true : false;
+ } else if (document.getElementById) {
+ return (document.getElementById(e)) ? true : false;
+ } else if (document.all) {
+ return (document.all[e]) ? true : false;
+ } else return false;
+ },
+ _termString_makeKeyref: function() {
+ var tg = Terminal.prototype.globals;
+ var termString_keyref = tg.termString_keyref = new Array();
+ var termString_keycoderef = tg.termString_keycoderef = new Array();
+ var hex = new Array('A', 'B', 'C', 'D', 'E', 'F');
+ for (var i = 0; i <= 15; i++) {
+ var high = (i < 10) ? i : hex[i - 10];
+ for (var k = 0; k <= 15; k++) {
+ var low = (k < 10) ? k : hex[k - 10];
+ var cc = i * 16 + k;
+ if (cc >= 32) {
+ var cs = unescape("%" + high + low);
+ termString_keyref[cc] = cs;
+ termString_keycoderef[cs] = cc;
+ }
+ }
+ }
+ },
+ _extendMissingStringMethods: function() {
+ if ((!String.fromCharCode) || (!String.prototype.charCodeAt)) {
+ Terminal.prototype.globals._termString_makeKeyref();
+ }
+ if (!String.fromCharCode) {
+ String.fromCharCode = function(cc) {
+ return (cc != null) ? Terminal.prototype.globals.termString_keyref[cc] : '';
+ };
+ }
+ if (!String.prototype.charCodeAt) {
+ String.prototype.charCodeAt = function(n) {
+ cs = this.charAt(n);
+ return (Terminal.prototype.globals.termString_keycoderef[cs]) ? Terminal.prototype.globals.termString_keycoderef[cs] : 0;
+ };
+ }
+ }
+ }
+}
+Terminal.prototype.globals._initGlobals();
+var TerminalDefaults = Terminal.prototype.Defaults;
+var termDefaultHandler = Terminal.prototype.defaultHandler;
+var TermGlobals = Terminal.prototype.globals;
+var termKey = Terminal.prototype.globals.termKey;
+var termDomKeyRef = Terminal.prototype.globals.termDomKeyRef;
+var parserWhiteSpace = {
+ ' ': true,
+ '\t': true
+}
+var parserQuoteChars = {
+ '"': true,
+ "'": true,
+ '`': true
+};
+var parserSingleEscapes = {
+ '\\': true
+};
+var parserOptionChars = {
+ '-': true
+}
+var parserEscapeExpressions = {
+ '%': parserHexExpression
+}
+
+function parserHexExpression(termref, pointer, echar, quotelevel) {
+ if (termref.lineBuffer.length > pointer + 2) {
+ var hi = termref.lineBuffer.charAt(pointer + 1);
+ var lo = termref.lineBuffer.charAt(pointer + 2);
+ lo = lo.toUpperCase();
+ hi = hi.toUpperCase();
+ if ((((hi >= '0') && (hi <= '9')) || ((hi >= 'A') && ((hi <= 'F')))) && (((lo >= '0') && (lo <= '9')) || ((lo >= 'A') && ((lo <= 'F'))))) {
+ parserEscExprStrip(termref, pointer + 1, pointer + 3);
+ return String.fromCharCode(parseInt(hi + lo, 16));
+ }
+ }
+ return echar;
+}
+
+function parserEscExprStrip(termref, from, to) {
+ termref.lineBuffer = termref.lineBuffer.substring(0, from) +
+ termref.lineBuffer.substring(to);
+}
+
+function parserGetopt(termref, optsstring) {
+ var opts = {
+ 'illegals': []
+ };
+ while ((termref.argc < termref.argv.length) && (termref.argQL[termref.argc] == '')) {
+ var a = termref.argv[termref.argc];
+ if ((a.length > 0) && (parserOptionChars[a.charAt(0)])) {
+ var i = 1;
+ while (i < a.length) {
+ var c = a.charAt(i);
+ var v = '';
+ while (i < a.length - 1) {
+ var nc = a.charAt(i + 1);
+ if ((nc == '.') || ((nc >= '0') && (nc <= '9'))) {
+ v += nc;
+ i++;
+ } else break;
+ }
+ if (optsstring.indexOf(c) >= 0) {
+ opts[c] = (v == '') ? {
+ value: -1
+ } : (isNaN(v)) ? {
+ value: 0
+ } : {
+ value: parseFloat(v)
+ };
+ } else {
+ opts.illegals[opts.illegals.length] = c;
+ }
+ i++;
+ }
+ termref.argc++;
+ } else break;
+ }
+ return opts;
+}
+
+function parseLine(termref) {
+ var argv = [''];
+ var argQL = [''];
+ var argc = 0;
+ var escape = false;
+ for (var i = 0; i < termref.lineBuffer.length; i++) {
+ var ch = termref.lineBuffer.charAt(i);
+ if (escape) {
+ argv[argc] += ch;
+ escape = false;
+ } else if (parserEscapeExpressions[ch]) {
+ var v = parserEscapeExpressions[ch](termref, i, ch, argQL[argc]);
+ if (typeof v != 'undefined') argv[argc] += v;
+ } else if (parserQuoteChars[ch]) {
+ if (argQL[argc]) {
+ if (argQL[argc] == ch) {
+ argc++;
+ argv[argc] = argQL[argc] = '';
+ } else {
+ argv[argc] += ch;
+ }
+ } else {
+ if (argv[argc] != '') {
+ argc++;
+ argv[argc] = '';
+ argQL[argc] = ch;
+ } else {
+ argQL[argc] = ch;
+ }
+ }
+ } else if (parserWhiteSpace[ch]) {
+ if (argQL[argc]) {
+ argv[argc] += ch;
+ } else if (argv[argc] != '') {
+ argc++;
+ argv[argc] = argQL[argc] = '';
+ }
+ } else if (parserSingleEscapes[ch]) {
+ escape = true;
+ } else {
+ argv[argc] += ch;
+ }
+ }
+ if ((argv[argc] == '') && (!argQL[argc])) {
+ argv.length--;
+ argQL.length--;
+ }
+ termref.argv = argv;
+ termref.argQL = argQL;
+ termref.argc = 0;
+}
+
+var helpPage = ['%c(@beige)This is a Unix-like virtual shell command line interface.'];
+var infoPage = ['%c(@beige)This console is implemented with the javascript terminal library termlib.js.'];
+var asciinumber = [' .XEEEEb ,:LHL :LEEEEEG .CNEEEEE8 bMNj NHKKEEEEEX 1LEEE1 KEEEEEEEKNMHH 8EEEEEL. cEEEEEO ', ' MEEEUXEEE8 jNEEEEE EEEEHMEEEEU EEEELLEEEEc NEEEU 7EEEEEEEEEK :EEEEEEN, EEEEEEEEEEEEE OEEEGC8EEEM 1EEELOLEEE3 ', ' NEE. OEEC EY" MEE OC LEEc :" EEE EEGEE3 8EN MEEM. :EE. 1EEj :EEO 1EE3 DEEc ', ' ,EEj EEE HEE EEE cEE: EEU EEJ NEC EEE EEJ EEE EEE EEN KEE ', ' HEE jEE1 NEE EEE EEE EEM EEJ EE LEE .. EEK DEEj :EE7 ,EE1 jEE ', ' EEH EEZ KEE :EE1 .::jZEEG EEU EEJ .EEEEEENC EE77EEEEEEL NEE UEENj bEE7 .EEX :EE.', '.EEZ EEM KEE EEK EEEEEEC .EEc EEC :X3DGMEEEEU 3EEEED.".GEEE. CEE. EEEEEEE EEEj :EEE ', ' EEZ EEM KEE :EEK "jNEEZ :EE EE7 MEEU LEEb EEE .EE8 DEEL:.8EEEM NEEENMEEEHEE ', ' EEN .EEG KEE bEEG 7EEM jEEN738ODDEEM3b EEE MEE 8EE, EEE EEE ,EEE .bEEEEC XEE ', ' LEE 3EE: KEE .EEE, EEE LEEEEEEEEEEEEEE XEE 8EE cEE: NEE 7EE1 jEE1 :EE: ', ' .EEc EEE KEE bEED EEE EE1 EEE EEX EEE 3EE: cEEc 7EEj CEEG ', ' MEE7 NEE. EEE jEEK C EEE1 EEC j :EEE CEEG LEEj .EEU EEE: .EEE 1EEEJ ', ' bEEEEEEEE. EEE NEEEEEEEEEEEE bEEEEEEEEEE7 EEd JEEEEEEEEEN jEEEEEEEEE7 .EEE KEEEEHEEEEL 8EEEEEEX ', ' DEEEL7 CGD 3GD3DOGGGGGUX :DHEEEN8. bUd 7GNEEEMc 7LEEEX: 1XG JHEEEM1 COLIN" '];
+var asciinumber_s = ['.oPYo. .o .oPYo. .oPYo. .8 oooooo .pPYo. oooooo .PY. .oPYo. ', '8 o8 8 `8 `8 d"8 8 8 .o" 8 8 8" `8 ', '8 P 8 8 oP" .oP" d" 8 8pPYo. 8oPYo. .o" .oPYo. 8. .8 ', '8 d 8 8 .oP" `b. Pooooo `8 8" `8 .o" 8" `8 `YooP8 ', '8o 8 8 8" :8 8 .P 8. .P .o" 8. .P .P ', '`YooP" o8o 8ooooo `YooP" 8 `YooP" `YooP" o" `YooP" `YooP" '];
+var asciiddot = [' ', ' ', ' ', ' @@ ', ' @@ ', ' ', ' ', ' ', ' ', ' ', ' @@ ', ' @@ ', ' ', ' ', ' '];
+var asciiddot_s = [' ', 'x ', ' ', ' ', 'x ', ' '];
+var asciin = asciinumber;
+var asciid = asciiddot;
+var bs = ['%c(@white)A problem has been detected and windows has been shut down to prevent', 'damage to your computer.', '', 'PAGE_FAULT_BECAUSE_OF_DUMB_USER', '', 'Suggestions: Restart computer, if problems continue, install Linux.', '', 'Technical Information:', '', '***STOP: 0x00000050 (0xBD32E7E4, 0x00000011, 0x8B5F87F4,0x00000012)', '', 'Physical memory was dumped.'];
+var safari = false;
+var fortuneid = 1;
+var shortm = ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
+var path = "/home/www";
+var files_root_n = ['bin', 'etc', 'home', 'tmp', 'sbin', 'usr', 'var'];
+var files_root_s = [' 512', ' 512', ' 1024', ' 512', ' 512', ' 512', ' 512'];
+var files_root_t = ['Jan 23 00:13', 'Feb 2 14:36', 'Jan 23 00:13', 'Nov 10 2007', 'Nov 10 2007', 'Nov 10 2007', 'Nov 10 2007'];
+var files_root = [files_root_n, files_root_s, files_root_t, '%c(@lightgrey)drwxr-x--- 1 root wheel'];
+var files_etc_n = ['passwd', 'group', 'rc.conf', 'master.passwd', 'hosts', 'crontab'];
+var files_etc_s = [' 766', ' 266', ' 3061', ' 3960', ' 766', ' 1852'];
+var files_etc_t = ['Jan 23 00:13', 'Jan 23 00:13', 'Feb 2 14:36', 'Jan 23 00:13', 'Nov 10 2007', 'Nov 26 17:28'];
+var files_etc = [files_etc_n, files_etc_s, files_etc_t, '%c(@lightgrey)-rw-r----- 1 root wheel'];
+var files_home_n = ['www'];
+var files_home_s = [' 766'];
+var files_home_t = ['Nov 10 2007'];
+var files_home = [files_home_n, files_home_s, files_home_t, '%c(@lightgrey)drwxr-xr-x 1 root wheel'];
+var files_tmp_n = ['test'];
+var files_tmp_s = [' 512'];
+var files_tmp_t = ['Jun 11 2007'];
+var files_tmp = [files_tmp_n, files_tmp_s, files_tmp_t, '%c(@lightgrey)drwxrwx--- 1 root wheel'];
+var files_var_n = ['log'];
+var files_var_s = [' 512'];
+var files_var_t = ['Jun 11 2007'];
+var files_var = [files_var_n, files_var_s, files_var_t, '%c(@lightgrey)drwxrwx--- 1 root wheel'];
+var files_usr_n = ['share'];
+var files_usr_s = [' 512'];
+var files_usr_t = ['Oct 21 2006'];
+var files_usr = [files_usr_n, files_usr_s, files_usr_t, '%c(@lightgrey)drwxrwxr-x 1 root wheel'];
+var files_share_n = ['man'];
+var files_share_s = [' 512'];
+var files_share_t = ['Oct 21 2006'];
+var files_share = [files_share_n, files_share_s, files_share_t, '%c(@lightgrey)drwxrwxr-x 1 root wheel'];
+var files_man_n = ['echo', 'cal', 'clock', 'ed', 'hostname', 'ls', 'matrix', 'redim', 'reload', 'reset', 'ssh', 'vi', 'weather', 'whereami'];
+var files_man_s = [' 252', ' 287', ' 352', ' 1173', ' 281', ' 361', ' 292', ' 291', ' 451', ' 353', ' 198', ' 358', ' 232', ' 216', ' 112', ' 3412'];
+var files_man_t = ['Nov 21 2007', 'Jan 31 2008', 'Nov 21 2007', 'Nov 21 2007', 'Nov 21 2007', 'Nov 21 2007', 'Nov 21 2007', 'Jul 10 2008', 'Nov 21 2007', 'Nov 21 2007', 'Apr 17 2008', 'Feb 01 2008', 'Feb 11 2008', 'Apr 02 2008', 'Nov 21 2007', 'Mar 21 2008'];
+var files_man = [files_man_n, files_man_s, files_man_t, '%c(@lightgrey)-rw-rw-r-- 1 root wheel'];
+var files_bin_n = ['apropos', 'browse', 'browser', 'cal', 'cat', 'chat', 'clear', 'clock', 'cd', 'date', 'df', 'echo', 'ed', 'fortune', 'history', 'login', 'hostname', 'help', 'id', 'info', 'll', 'logout', 'ls', 'man', 'matrix', 'more', 'ping', 'ps', 'pwd', 'pr', 'reload', 'snake', 'ssh', 'sudo', 'redim', 'reset', 'top', 'uname', 'whereami', 'rm', 'time', 'uptime', 'vi', 'who', 'weather', 'whoami'];
+var files_bin_s = [' 1933', ' 3061', ' 3960', ' 766', ' 1150', ' 2170', ' 1176', ' 1834', ' 1650', ' 81933', ' 695', ' 1507', ' 1327', ' 1127', ' 1852', ' 1140', ' 1933', ' 256', ' 1678', ' 32648', ' 5150', ' 1232', ' 5150', ' 593', ' 3595', ' 1698', ' 2668', ' 1668', ' 3855', ' 7159', ' 1353', ' 3695', ' 1435', ' 1135', ' 1156', ' 815', ' 193', ' 2565', ' 5466', ' 9331', ' 1357', ' 150', ' 19364', ' 8364', ' 384', ' 1744'];
+var files_bin_t = ['Oct 21 2006', 'Oct 21 2006', 'Oct 21 2006', 'Oct 21 2006', 'Oct 21 2006', 'Oct 21 2006', 'Oct 21 2006', 'Oct 22 2006', 'Oct 22 2006', 'Oct 21 2006', 'Oct 21 2006', 'Apr 11 2008', 'Jul 11 2008', 'Oct 21 2006', 'Oct 21 2006', 'Feb 10 2008', 'Feb 10 2008', 'Oct 21 2006', 'Jun 11 2007', 'Jun 11 2007', 'Apr 11 2008', 'Oct 21 2006', 'Oct 21 2006', 'Oct 21 2006', 'Oct 21 2006', 'Jan 28 2008', 'Jan 25 2008', 'Oct 21 2006', 'Oct 21 2006', 'Jun 11 2007', 'Oct 21 2006', 'Apr 5 2008', 'Oct 21 2006', 'Jan 21 2008', 'Oct 21 2006', 'Nov 10 2007', 'Oct 21 2006', 'Oct 21 2006', 'Oct 21 2006', 'Oct 21 2006', 'Oct 21 2006', 'Oct 21 2006', 'Apr 4 02:46', 'Jan 23 00:13', 'Jan 23 00:13', 'Feb 10 01:24'];
+var files_bin = [files_bin_n, files_bin_s, files_bin_t, '%c(@lightgrey)-rwxr-x--x 1 root wheel'];
+var files_sbin_n = ['sysctl', 'netstat', 'browser', 'passwd', 'ifconfig', 'route', 'mount', 'reboot', 'halt', 'shutdown', 'su'];
+var files_sbin_s = [' 1933', ' 3061', ' 3960', ' 766', ' 1150', ' 1350', ' 1834', ' 1650', ' 933', ' 695', ' 1507'];
+var files_sbin_t = ['Feb 10 01:23', 'Feb 10 01:24', 'Oct 21 2006', 'Oct 24 2006', 'Oct 21 2006', 'Oct 21 2006', 'Oct 21 2006', 'Jun 11 2007', 'Oct 21 2006', 'Oct 21 2006', 'Oct 21 2006'];
+var files_sbin = [files_sbin_n, files_sbin_s, files_sbin_t, '%c(@lightgrey)-rwxr-x--- 1 root wheel'];
+var files_www_n = ['about.txt', 'bugs.txt', 'cb.txt', 'exploring.gif', 'favicon.ico', 'index.html', 'shell.js', 'sitemap.xml', 'termlib.js', 'termlib_invaders.js', 'termlib_parser.js', 'unixtoolbox.book.pdf', 'unixtoolbox.book2.pdf', 'unixtoolbox.pdf', 'unixtoolbox.txt', '%+nunixtoolbox.xhtml%-n'];
+var files_www_s = [' 1045', ' 954', ' 4033', ' 98166', ' 1150', ' 1933', ' 25695', ' 766', ' 64720', ' 21371', ' 6036', '272458', '271664', '345472', '124113', '191701'];
+var files_www_t = ['Feb 15 01:31', 'Apr 18 00:31', 'Feb 11 02:06', 'Jul 23 2004', 'Jan 31 15:17', 'Feb 10 16:53', 'Feb 5 00:52', 'Feb 10 01:13', 'Feb 10 01:13', 'Feb 10 02:14', 'Feb 10 02:14', 'Apr 09 02:14', 'Apr 09 02:14', 'Apr 09 04:20', 'Apr 09 01:47', 'Apr 09 02:50'];
+var files_www = [files_www_n, files_www_s, files_www_t, '%c(@lightgrey)-rw-r----- 1 colin www'];
+var tree = ['/', '/etc', '/tmp', '/bin', '/home', '/home/www', '/sbin', '/usr', '/usr/share', '/usr/share/man', '/var'];
+var tree_files = [files_root, files_etc, files_tmp, files_bin, files_home, files_www, files_sbin, files_usr, files_share, files_man, files_var];
+var remote_files = ['unixtoolbox.xhtml', 'unixtoolbox.txt', 'index.html', 'shell.js', 'termlib.js', 'termlib_parser.js', 'termlib_invaders.js'];
+var binary_files = ['unixtoolbox.pdf', 'unixtoolbox.book.pdf', 'unixtoolbox.book2.pdf', 'exploring.gif', 'favicon.ico'];
+var filesContent = [];
+filesContent["/boot/shutdown"] = ['%c(@lightgrey)Waiting (max 60 seconds) for system process \'crypto\' to stop...done', '%c(@lightgrey)Waiting (max 60 seconds) for system process \'vnlru\' to stop...done', '%c(@lightgrey)Waiting (max 60 seconds) for system process \'bufdaemon\' to stop...done', '%c(@lightgrey)Waiting (max 60 seconds) for system process \'syncer\' to stop...', '%c(@lightgrey)Syncing disks, vnodes remaining...5 6 7 3 2 1 1 1 0 0 0 done', '', '', '', '%c(@lightgrey)All buffers synced.', '%c(@lightgrey)Uptime: 14d13h29m45s', '', '%c(@lightgrey)Rebooting...%n', '', '', ''];
+filesContent["/boot/kernel"] = ['%c(@lightgrey)localhost ROM BIOS Version 1.34 A12', '%c(@lightgrey)Copyright 2007-2008 Colin Barschel All Rights Reserved', '', '%c(@lightgrey)FreeBSD 7.1-STABLE #3: Sat Feb 16 16:14:11 CET 2009', '%c(@lightgrey) sysad@localhost:/usr/obj/usr/src/sys/CB', '', '%c(@lightgrey)Timecounter "i8254" frequency 1193182 Hz quality 0', '%c(@lightgrey)CPU: Dual Core AMD Opteron(tm) Processor 270 (2010.31-MHz K8-class CPU)', '%c(@lightgrey) Origin = "AuthenticAMD" Id = 0x20f12 Stepping = 2', '%c(@lightgrey) Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>', '%c(@lightgrey) Features2=0x1<SSE3>', '%c(@lightgrey) AMD Features=0xe2500800<SYSCALL,NX,MMX+,FFXSR,LM,3DNow!+,3DNow!>', '%c(@lightgrey) AMD Features2=0x3<LAHF,CMP>', '%c(@lightgrey) Cores per package: 2', '%c(@lightgrey)usable memory = 2139738112 (2040 MB)', '%c(@lightgrey)avail memory = 2065133568 (1969 MB)', '', '%c(@lightgrey)Detecting IDE drives ... IDE Flash Disk', '', '%c(@lightgrey)acpi0: <Nvidia AWRDACPI> on motherboard', '%c(@lightgrey)acpi_timer0: <24-bit timer at 3.579545MHz> port 0x808-0x80b on acpi0', '%c(@lightgrey)ata0: <ATA channel 0> on atapci0', '%c(@lightgrey)ata1: <ATA channel 1> on atapci0', '%c(@lightgrey)usb0: <SiS 5571 USB controller> on ohci0', '%c(@lightgrey)usb0: USB revision 2.0', '%c(@lightgrey)uhub0: SiS OHCI root hub, class 9/0, rev 1.00/1.00, addr 1', '%c(@lightgrey)cpu0: <ACPI CPU> on acpi0', '%c(@lightgrey)cpu1: <ACPI CPU> on acpi0', '%c(@lightgrey)bge0: <Broadcom NetXtreme Gigabit Ethernet Controller, ASIC rev. 0x3003> mem 0xfe9e0000-0xfe9effff irq 18 at device 6.0 on pci1', '%c(@lightgrey)Looks convincing, doesn\'t it?', '%c(@lightgrey)atapci0: <SiS 962/963 UDMA133 controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177at device 2.5 on pci0%n', '%c(@lightgrey)Timecounters tick every 1.000 msec', '', '%c(@lightgrey)ipfw2 (+ipv6) initialized, divert enabled, rule-based forwarding disabled, default to deny, logging enabled', '%c(@lightgrey)Trying to mount root from ufs:/dev/ad0a', '', '%c(@lightgrey)/bin/sh: accessing tty1', '%c(@lightgrey)Starting external programs: ssh apache2 mxvpn sendmail', '', 'ready', ' '];
+filesContent["/etc/passwd"] = ['%c(@lightgrey)# $FreeBSD: src/etc/master.passwd,v 1.40 2005/06/06 20:19:56 brooks Exp $', '#', 'root:*:0:0:Charlie &:/root:/bin/csh', 'toor:*:0:0:Bourne-again Superuser:/root:', 'mailnull:*:26:26:Sendmail Default User:/var/spool/mqueue:/usr/sbin/nologin', 'www:*:80:80:World Wide Web Owner:/nonexistent:/usr/sbin/nologin', 'sysa:*:1001:0:System Administrator:/home/sysadmin:/bin/tcsh'];
+filesContent["/etc/group"] = ['%c(@lightgrey)# $FreeBSD: src/etc/group,v 1.32.2.1 2006/03/06 22:23:10 rwatson Exp $', '#', 'wheel:*:0:root,sysa', 'mailnull:*:26:milter', 'www:*:80:', 'sysa:*:1001:'];
+filesContent["/etc/rc.conf"] = ['%c(@lightgrey)hostname="localhost"', 'firewall_enable="YES" # Set to YES to enable firewall functionality', 'firewall_type="web" # Firewall type (see /etc/rc.firewall)', 'ifconfig_rl0="inet 78.31.70.238 netmask 255.255.255.0"', 'defaultrouter="78.31.70.1"', 'sshd_enable="YES" # Enable sshd', 'sendmail_enable="YES" # Run the sendmail inbound daemon (YES/NO).', 'sendmail_flags="-L sm-mta -bd -q30m"', 'apache22_enable="YES" # start Apache httpd', 'apache22ssl_enable="YES"', 'apache22_http_accept_enable="YES" # Use kernel accf_data and accf_http modules'];
+filesContent["/etc/hosts"] = ['%c(@lightgrey)# In the presence of the domain name service or NIS, this file may', '# not be consulted at all; see /etc/nsswitch.conf for the resolution order.', '#', '::1 localhost localhost.localhost', '127.0.0.1 localhost localhost.localhost'];
+filesContent["/etc/crontab"] = ['%c(@lightgrey)# $FreeBSD: src/etc/crontab,v 1.32 2002/11/22 16:13:39 tom Exp $', '#minute hour mday month wday who command', '# Save some entropy so that /dev/random can re-seed on boot.', '*/11 * * * * operator /usr/libexec/save-entropy', '# Rotate log files every hour, if necessary.', '0 * * * * root newsyslog', '# Perform daily/weekly/monthly maintenance.', '1 3 */2 * * root periodic daily', '15 4 */2 * 6 root periodic weekly', '30 5 1 */2 * root periodic monthly'];
+filesContent["/usr/share/man/vi"] = ['%c(@lightcyan)VI localhost General Commands Manual VI', '', 'NAME', ' Vi -- a screen oriented text editor.', '', 'DESCRIPTION', ' Vi is a modal editor and is either in insert mode or err... Who doesn\'t ', ' know vi? This implementation is very thin and does not support paging. That', ' is only the visible page can be edited. The following commands should work:', '', ' <ESC> to enter command mode', ' :q<Enter> to exit', ' :w<Enter> to save', ' :w filename to save to "filename"', ' :e filename to open "filename"', ' :q!<Enter> to exit without saving', ' D to delete rest of line', ' dd to delete current line', ' x to delete current char', ' i to enter edit mode ', ' UP RIGHT DOWN LEFT to move the cursor', ' or h left j down k up l right', '', ' %c(@chartreuse)On Safari browsers use <TAB> instead of <ESC>!!%c(@lightcyan)'];
+filesContent["/usr/share/man/ssh"] = ['%c(@lightcyan)SSH localhost General Commands Manual SSH', '', 'NAME', ' ssh -- Mindterm SSH client (remote login program)', '', 'SYNOPSIS', ' ssh [-L port:host:hostport] [-p port] [user@]hostname', '', 'DESCRIPTION', ' The ssh command will start the Appgate java applet "mindterm".', ' The applet is self-signed and can thus be used to connect to any server', ' (as you don\'t have an account on localhost...)', ' and also allows to build tunnels. This is the compiled version from', ' www.appgate.com with the logo removed.', ' %c(@chartreuse)There is no connection between this client and the localhost server.', '', ' Use the top right "X" to close the ssh client%c(@lightcyan)', '', 'EXAMPLES', ' ssh hostname', ' ssh -p 123 user@hostname', ' ssh -L 3128:127.0.0.1:80 -p 1234 user@hostname'];
+filesContent["/usr/share/man/echo"] = ['%c(@lightcyan)ECHO localhost General Commands Manual ECHO', '', 'NAME', ' echo -- write arguments to the standard output', '', 'DESCRIPTION', ' The echo utility writes any specified operands, separated by single blank', ' (\' \') characters and followed by a newline (\\n) character, to the stan-', ' dard output.', ' the > redirect can be used to create a file. For example the command', ' %c(@chartreuse)echo Hello world! > hello.txt%c(@lightcyan)', ' will create the file hello.txt'];
+filesContent["/usr/share/man/hostname"] = ['%c(@lightcyan)HOSTNAME localhost General Commands Manual HOSTNAME', '', 'NAME', ' hostname -- print name of current host system', '', 'SYNOPSIS', ' hostname [-fsi]', '', 'DESCRIPTION', ' The hostname utility prints the name of the current host.', ' This script uses the hostname variable in /etc/rc.conf.', '', ' Options:', '', ' -f Include domain information in the printed name. This is the', ' default behavior.', '', ' -s Trim off any domain information from the printed name.', '', ' -i Show the corresponding host IP address.'];
+filesContent["/usr/share/man/reload"] = ['%c(@lightcyan)RELOAD localhost General Commands Manual RELOAD', '', 'NAME', ' reload -- reload the terminal as a new http request', '', 'DESCRIPTION', ' This command will reload the terminal with a new http GET request from the', ' browser. This will reinitialize the shell and all variables and has the same ', ' effect as the browser reload button. A reload will also recalculate the shell', ' size.', '', 'SEE ALSO', ' reset, redim'];
+filesContent["/usr/share/man/reset"] = ['%c(@lightcyan)RESET localhost General Commands Manual RESET', '', 'NAME', ' reset -- reset the terminal to the initial state', '', 'DESCRIPTION', ' This command will reset the terminal to its initial state but will not reload', ' the variables. The created file are not deleted either. Delete them all with', ' rm * in the home directory.', '', 'SEE ALSO', ' reload'];
+filesContent["/usr/share/man/redim"] = ['%c(@lightcyan)REDIM localhost General Commands Manual REDIM', '', 'NAME', ' redim -- calculates and resizes the shell to it\'s maximal size.', '', 'DESCRIPTION', ' This command resizes the shell to fit the visible browser area, it can be used', ' when the browser size has changed. The argument <-s> will only display the sizes', ' but will not change anything.', '', ' The following options are available:', '', ' -s only display the window and shell sizes without changing anything', '', 'SEE ALSO', ' reload'];
+filesContent["/usr/share/man/snake"] = ['%c(@lightcyan)SNAKE localhost General Commands Manual SNAKE', '', 'NAME', ' snake -- a variation of the classical snake game.', '', 'DESCRIPTION', ' The snake must be steered to get food (the numbers randomly displayed)', ' and avoid crashing on rocks or wall or itself. There is also an autopilot,', ' but it is not to be trusted.', '', ' The following options are available:', '', ' -s1 for speed: -s1 = slow; -s3 = fast', ' -f1 for food: -f1 = less; -f3 = more', ' -o1 for obstacles: -o1 = less; -o3 = more rocks', ' -a toggle the autopilot on or off. Status is displayed on the status line', ' -r toggle auto-restart on or off. Status is displayed on the status line', '', 'EXAMPLES', '', ' snake -f3 -o3 -a -r max food and rocks with autopilot and auto-restart', '', 'SEE ALSO', ' invaders'];
+filesContent["/usr/share/man/invaders"] = ['%c(@lightcyan)INVADERS localhost General Commands Manual INVADERS', '', 'NAME', ' invaders -- the classical invaders game, courtesy of Norbert Landsteiner.', '', 'DESCRIPTION', ' The invaders must be shot down before they reach earth. The ship must also', ' avoid the enemy fire.', '', ' On a large screen the game might be too stretched and thus too easy to', ' win... Use option -s to reduce the available game area to the classical', ' 80x25 characters.', '', ' -s start the game with a smaller area of 80x25 characters', '', 'SEE ALSO', ' snake'];
+filesContent["/usr/share/man/ls"] = ['%c(@lightcyan)LS localhost General Commands Manual LS', '', 'NAME', ' ls -- list directory contents', '', 'SYNOPSIS', ' ls [-la] [directory]', '', 'DESCRIPTION', ' For each operand that names a directory, ls displays the names of files', ' contained within that directory, as well as any requested, associated', ' information.', ' If no operands are given, the contents of the current directory are dis-', ' played.', '', ' The following options are available:', '', ' -l List files in the long format with date and permission information', '', ' -a Display also hidden files and folders'];
+filesContent["/usr/share/man/matrix"] = ['%c(@lightcyan)MATRIX localhost General Commands Manual MATRIX', '', 'NAME', ' matrix -- a matrix like screen saver animation', '', 'SYNOPSIS', ' matrix [-s]', '', 'DESCRIPTION', ' This animation displays falling random letters in a gree gradient. This is', ' quite heavy on the browser rendering engine and thus uses a lot of CPU.', '', ' The following options are available:', '', ' -s Start with an empty page and fill it with time. Default starts with a newly', ' generated screen.', '', ' key <q> or <ESC> to quit the animation', '', ' key <space> to pause or play the animation', '', ' any other key will add an iteration'];
+filesContent["/usr/share/man/cal"] = ['%c(@lightcyan)CAL localhost General Commands Manual CAL', '', 'NAME', ' cal -- a simple month calender', '', 'SYNOPSIS', ' cal [n] (n = 1-12)', '', 'DESCRIPTION', ' Display a calender of the current month or an other month given as option.', '', ' The following options are available:', '', ' n Selects an other month of the year. For example:', ' Jan = 1, Jan next year = 13, Dec last year = 0'];
+filesContent["/usr/share/man/clock"] = ['%c(@lightcyan)CLOCK localhost General Commands Manual CLOCK', '', 'NAME', ' clock -- display a large clock or stopwatch', '', 'SYNOPSIS', ' clock [-t -s]', '', 'DESCRIPTION', ' With no option the command clock displays a large clock in full screen', ' mode and international format, like 21:45:04. It is also possible to display', ' a stopwatch. Use any key besides <space> and <r> to quit', '', ' The following options are available:', '', ' -t start in stopwatch mode', '', ' -s use smaller numbers. This is automatic if the terminal is too small', '', ' <space key> pause the display, the time is still ticking...', '', ' <r key> reset the stopwatch and start again.'];
+filesContent["/usr/share/man/ed"] = ['%c(@lightgrey)This text is straight from http://www.gnu.org/fun/jokes/ed.msg.html', '%c(@lightcyan)When I log into my Xenix system with my 110 baud teletype, both vi', '*and* Emacs are just too damn slow. They print useless messages like,', '\'C-h for help\' and \'"foo" File is read only\'. So I use the editor', 'that doesn\'t waste my VALUABLE time.', '', 'Ed, man! !man ed', '', 'ED(1) Unix Programmer\'s Manual ED(1)', '', 'NAME', ' ed - text editor', '', 'SYNOPSIS', ' ed [ - ] [ -x ] [ name ]', 'DESCRIPTION', ' Ed is the standard text editor.', '---', '', 'Computer Scientists love ed, not just because it comes first', 'alphabetically, but because it\'s the standard. Everyone else loves ed', 'because it\'s ED!', '', '"Ed is the standard text editor."', '', 'And ed doesn\'t waste space on my Timex Sinclair. Just look:', '', '-rwxr-xr-x 1 root 24 Oct 29 1929 /bin/ed', '-rwxr-xr-t 4 root 1310720 Jan 1 1970 /usr/ucb/vi', '-rwxr-xr-x 1 root 5.89824e37 Oct 22 1990 /usr/bin/emacs', '', 'Of course, on the system *I* administrate, vi is symlinked to ed.', 'Emacs has been replaced by a shell script which 1) Generates a syslog', 'message at level LOG_EMERG; 2) reduces the user\'s disk quota by 100K;', 'and 3) RUNS ED!!!!!!', '', '"Ed is the standard text editor."', '', 'Let\'s look at a typical novice\'s session with the mighty ed:', '', 'golem$ ed', '', '?', 'help', '?', '?', '?', 'quit', '?', 'exit', '?', 'bye', '?', 'hello?', '?', 'eat flaming death', '?', '^C', '?', '^C', '?', '^D', '?', '', '---', 'Note the consistent user interface and error reportage. Ed is', 'generous enough to flag errors, yet prudent enough not to overwhelm', 'the novice with verbosity.', '', '"Ed is the standard text editor."', '', 'Ed, the greatest WYGIWYG editor of all.', '', 'ED IS THE TRUE PATH TO NIRVANA! ED HAS BEEN THE CHOICE OF EDUCATED', 'AND IGNORANT ALIKE FOR CENTURIES! ED WILL NOT CORRUPT YOUR PRECIOUS', 'BODILY FLUIDS!! ED IS THE STANDARD TEXT EDITOR! ED MAKES THE SUN', 'SHINE AND THE BIRDS SING AND THE GRASS GREEN!!', '', 'When I use an editor, I don\'t want eight extra KILOBYTES of worthless', 'help screens and cursor positioning code! I just want an EDitor!!', 'Not a "viitor". Not a "emacsitor". Those aren\'t even WORDS!!!! ED!', 'ED! ED IS THE STANDARD!!!', '', 'TEXT EDITOR.', '', 'When IBM, in its ever-present omnipotence, needed to base their', '"edlin" on a Unix standard, did they mimic vi? No. Emacs? Surely', 'you jest. They chose the most karmic editor of all. The standard.', '', 'Ed is for those who can *remember* what they are working on. If you', 'are an idiot, you should use Emacs. If you are an Emacs, you should', 'not be vi. If you use ED, you are on THE PATH TO REDEMPTION. THE', 'SO-CALLED "VISUAL" EDITORS HAVE BEEN PLACED HERE BY ED TO TEMPT THE', 'FAITHLESS. DO NOT GIVE IN!!! THE MIGHTY ED HAS SPOKEN!!!', '', '?'];
+var pslong = ['%c(@lightgrey)USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND'];
+var globalterm;
+var fetcherror = "";
+var vgeoip_country_code;
+var vgeoip_country_name;
+var vgeoip_city;
+var vgeoip_region;
+var vgeoip_latitude;
+var vgeoip_longitude;
+
+function incrementLoaded(t) {
+ var loaded = readCookie("loaded");
+ loaded++;
+ if (loaded > 4) {
+ t.newLine();
+ carriageReturn();
+ loaded = 2;
+ }
+ createCookie("loaded", loaded, 0, 5);
+}
+
+function carriageReturn() {
+ Terminal.prototype.globals.keyHandler({
+ which: globalterm.termKey.CR,
+ _remapped: true
+ });
+}
+
+function pressKey(ch) {
+ Terminal.prototype.globals.keyHandler({
+ which: ch,
+ _remapped: true
+ });
+}
+
+function createCookie(name, value, days, min) {
+ var expires;
+ var date = new Date();
+ if (days) {
+ date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
+ expires = "; expires=" + date.toGMTString();
+ } else {
+ expires = "";
+ }
+ if (min) {
+ date.setTime(date.getTime() + (min * 60 * 1000));
+ expires = "; expires=" + date.toGMTString();
+ }
+ document.cookie = name + "=" + value + expires + "; path=/";
+}
+
+function readCookie(name) {
+ var nameEQ = name + "=";
+ var ca = document.cookie.split(';');
+ for (var i = 0; i < ca.length; i++) {
+ var c = ca[i];
+ while (c.charAt(0) == ' ') {
+ c = c.substring(1, c.length);
+ }
+ if (c.indexOf(nameEQ) === 0) {
+ return c.substring(nameEQ.length, c.length);
+ }
+ }
+ return "";
+}
+
+function readAllCookies() {
+ var nameEQ = "=";
+ var all = [];
+ var ca = document.cookie.split(';');
+ for (var i = 0; i < ca.length; i++) {
+ var c = ca[i];
+ while (c.charAt(0) == ' ') {
+ c = c.substring(1, c.length);
+ }
+ all.push(c.substring(c[0], c.indexOf(nameEQ)));
+ }
+ return all;
+}
+if (!Array.indexOf) {
+ Array.prototype.indexOf = function(obj) {
+ for (var i = 0; i < this.length; i++) {
+ if (this[i] == obj) {
+ return i;
+ }
+ }
+ return -1;
+ };
+}
+
+function randomRange(min, max) {
+ if (min > max) {
+ return -1;
+ }
+ if (min == max) {
+ return min;
+ }
+ var r = parseInt(Math.random() * (max + 1), 10);
+ return (r + min <= max ? r + min : r);
+}
+
+function browserWidth() {
+ if (window.innerWidth) {
+ return window.innerWidth;
+ } else if (document.documentElement && document.documentElement.clientWidth) {
+ return document.documentElement.clientWidth;
+ } else if (document.body && document.body.offsetWidth) {
+ return document.body.offsetWidth;
+ } else {
+ return 0;
+ }
+}
+
+function browserHeight() {
+ if (window.innerHeight) {
+ return window.innerHeight;
+ } else if (document.documentElement && document.documentElement.clientHeight) {
+ return document.documentElement.clientHeight;
+ } else if (document.body && document.body.offsetHeight) {
+ return document.body.offsetHeight;
+ } else {
+ return 0;
+ }
+}
+Date.prototype.getMonthName = function() {
+ return ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'][this.getMonth()];
+};
+Date.prototype.milTime = function() {
+ var t = this.getHours() + ':' + this.getMinutes() + ':' + this.getSeconds();
+ return t;
+};
+Date.prototype.daysInMonth = function() {
+ return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate();
+};
+Date.prototype.calendar = function() {
+ var calArray = [];
+ var buildStr = '';
+ var numDays = this.daysInMonth();
+ var startDay = new Date(this.getFullYear(), this.getMonth(), 1).getDay();
+ calArray.push('%c(@lightgrey) ' + this.getMonthName() + ' ' + this.getFullYear());
+ calArray.push('Sun Mon Tue Wed Thu Fri Sat');
+ for (var i = 0; i < startDay; i++) {
+ buildStr += ' ';
+ }
+ var blankdays = startDay;
+ var filler = '';
+ var j = 1;
+ for (i = 1; i <= numDays; i++) {
+ if (this.getDate() == i) {
+ j = '%+r' + i + '%-r';
+ } else {
+ j = i;
+ }
+ if (i < 10) {
+ buildStr += ' ' + j + ' ';
+ } else {
+ buildStr += j + ' ';
+ }
+ blankdays++;
+ if (((blankdays % 7) === 0) && (i < numDays)) {
+ calArray.push(buildStr);
+ buildStr = '';
+ }
+ }
+ blankdays++;
+ while ((blankdays % 7) !== 0) {
+ buildStr += ' ';
+ blankdays++;
+ }
+ calArray.push(buildStr);
+ return calArray;
+};
+Array.prototype.shuffle = function() {
+ var tindex, rindex;
+ for (var i = 0; i < this.length; i++) {
+ rindex = Math.floor(Math.random() * this.length);
+ tindex = this[i];
+ this[i] = this[rindex];
+ this[rindex] = tindex;
+ }
+};
+var xmlHttp = null;
+if (typeof XMLHttpRequest != 'undefined') {
+ xmlHttp = new XMLHttpRequest();
+}
+if (!xmlHttp) {
+ var xhttperr;
+ try {
+ xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
+ } catch (xhttperr) {
+ try {
+ xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
+ } catch (xhttperr) {
+ xmlHttp = null;
+ }
+ }
+}
+
+function fetchHttp(url, fkt) {
+ var xhttperr;
+ fetcherror = "";
+ if (xmlHttp) {
+ try {
+ xmlHttp.open('GET', url, true);
+ xmlHttp.onreadystatechange = function() {
+ if (xmlHttp.readyState == 4) {
+ fkt(xmlHttp.responseText);
+ }
+ };
+ xmlHttp.send(null);
+ } catch (xhttperr) {
+ fetcherror = "Error: no network";
+ if (fkt != eval) {
+ globalterm.write(fetcherror);
+ globalterm.prompt();
+ }
+ }
+ } else {
+ fkt("Error: no XMLHttpRequest. Your browser is broken!");
+ }
+}
+
+function evaljs(content) {
+ var JSONCode = document.createElement("script");
+ JSONCode.setAttribute('type', 'text/javascript');
+ JSONCode.text = content;
+ document.body.appendChild(JSONCode);
+}
+
+function displayraw(content) {
+ globalterm.write(content);
+ globalterm.rawMode = false;
+ globalterm.prompt();
+}
+
+function displaymore(content) {
+ globalterm.clear();
+ globalterm.write('%c(@lightgrey)' + content, true);
+ globalterm.rawMode = false;
+}
+
+function initGeoIP() {
+ if (!window.geoip_country_code) {
+ vgeoip_country_code = "N/A";
+ vgeoip_country_name = "N/A";
+ vgeoip_city = "N/A";
+ vgeoip_region = "N/A";
+ vgeoip_latitude = "N/A";
+ vgeoip_longitude = "N/A";
+ } else {
+ vgeoip_country_code = geoip_country_code();
+ vgeoip_country_name = geoip_country_name();
+ vgeoip_city = geoip_city();
+ vgeoip_region = geoip_region();
+ vgeoip_latitude = geoip_latitude();
+ vgeoip_longitude = geoip_longitude();
+ }
+}
+
+function delAFile(fname) {
+ var fpath = getPath(fname);
+ if (fpath[0] != '/home/www') {
+ globalterm.write('%c(@lightgrey) rm ' + fname + ': Permission denied.');
+ return;
+ }
+ var findex = files_www_n.indexOf(fpath[1]);
+ if (findex != -1) {
+ if (!readCookie(fpath[1])) {
+ globalterm.write('%c(@lightgrey) rm ' + fname + ': Permission denied.');
+ return;
+ }
+ files_www_n.splice(findex, 1);
+ files_www_s.splice(findex, 1);
+ files_www_t.splice(findex, 1);
+ createCookie(fpath[1], '', 0);
+ } else {
+ globalterm.write('%c(@lightgrey)' + fname + ': No such file or directory.');
+ }
+}
+
+function delAllFiles() {
+ var allcookies = readAllCookies();
+ var deleted = 0;
+ for (var i = 0; i < allcookies.length; i++) {
+ if (allcookies[i] == 'clilastlog' || allcookies[i] == 'style' || allcookies[i] == 'broken') {
+ continue;
+ }
+ var fcontent = readCookie(allcookies[i]);
+ var date = fcontent.slice(fcontent.length - 12);
+ if (date.length != 12) {
+ continue;
+ }
+ delAFile(allcookies[i]);
+ deleted++;
+ }
+ if (deleted > 0) {
+ globalterm.write('%c(@lightgrey) deleted ' + deleted + ' files%n');
+ }
+}
+
+function addFile(fname, fcontent, iseditor, fdate) {
+ if (typeof iseditor == 'undefined') {
+ iseditor = false;
+ }
+ var error = "";
+ var fpath = getPath(fname);
+ fname = fpath[1];
+ if (fname == 'unixtoolbox.xhtml') {
+ error = fname + ': Permission denied';
+ if (iseditor) {
+ return 'Save ' + error;
+ } else {
+ globalterm.write('%c(@lightgrey)' + error);
+ return error;
+ }
+ }
+ var size = fcontent.length + 1;
+ var sizestr;
+ var datestr;
+ if (size < 10) {
+ sizestr = ' ' + size;
+ } else if (size < 100) {
+ sizestr = ' ' + size;
+ } else if (size < 1000) {
+ sizestr = ' ' + size;
+ } else if (size < 10000) {
+ sizestr = ' ' + size;
+ }
+ if (typeof fdate == 'undefined') {
+ var d = new Date();
+ var h = d.getHours();
+ if (h < 10) {
+ h = '0' + h;
+ }
+ var m = d.getMinutes();
+ if (m < 10) {
+ m = '0' + m;
+ }
+ var day = d.getDate();
+ if (day < 10) {
+ day = ' ' + day;
+ }
+ var mo = shortm[d.getMonth()];
+ datestr = mo + ' ' + day + ' ' + h + ':' + m;
+ } else {
+ datestr = fdate;
+ }
+ var findex = files_www_n.indexOf(fname);
+ if (fpath[0] != '/home/www') {
+ error = fname + ': Permission denied';
+ if (iseditor) {
+ return 'Save ' + error;
+ } else {
+ globalterm.write('%c(@lightgrey)' + error);
+ return error;
+ }
+ } else if (findex != -1) {
+ if (!readCookie(fname)) {
+ error = fname + ': system file permission denied';
+ if (iseditor) {
+ return 'Save ' + error;
+ } else {
+ globalterm.write('%c(@lightgrey)' + error);
+ return error;
+ }
+ }
+ files_www_n[findex] = fname;
+ files_www_s[findex] = sizestr;
+ files_www_t[findex] = datestr;
+ } else {
+ files_www_n.push(fname);
+ files_www_s.push(sizestr);
+ files_www_t.push(datestr);
+ }
+ fcontent = fcontent.replace(/;/g, '~~');
+ fcontent = fcontent + datestr;
+ createCookie(fname, fcontent, 365);
+ return error;
+}
+
+function addAFile(fname) {
+ var fcontent = readCookie(fname);
+ if (fcontent !== "") {
+ var cnt = fcontent.slice(0, fcontent.length - 12);
+ cnt = cnt.replace(/~~/g, ";");
+ var date = fcontent.slice(fcontent.length - 12);
+ if (date.length == 12) {
+ addFile(fname, cnt, false, date);
+ }
+ }
+}
+
+function getPath(fname) {
+ var fullpath = '';
+ var filename = '';
+ var fullname = '';
+ var rpath = path;
+ while (fname.charAt(fname.length - 1) == '/' && fname.length > 1) {
+ fname = fname.slice(0, fname.length - 1);
+ }
+ var slashindex = fname.lastIndexOf('/');
+ if (slashindex == -1 && fname.charAt(0) != '.') {
+ filename = fname;
+ fullpath = rpath;
+ } else {
+ filename = fname.slice(slashindex + 1);
+ if (fname.charAt(0) == '/') {
+ fullpath = fname.slice(0, slashindex);
+ if (fullpath === '') {
+ fullpath = '/';
+ }
+ } else if (fname.indexOf('..') === 0) {
+ var relarray = fname.split('..');
+ var relpath = rpath.split('/');
+ if (relpath.length >= relarray.length) {
+ for (var i = 0; i < relarray.length - 1; i++) {
+ rpath = rpath.slice(0, rpath.lastIndexOf('/'));
+ }
+ var lastrel = fname.lastIndexOf('../');
+ if (lastrel != -1) {
+ var pathtoadd = fname.slice(lastrel + 3, slashindex);
+ if (pathtoadd.length > 0) {
+ fullpath = rpath + '/' + pathtoadd;
+ } else {
+ fullpath = rpath;
+ }
+ } else {
+ fullpath = rpath;
+ }
+ if (filename == '..') {
+ filename = '';
+ fullname = fullpath;
+ } else {
+ fullname = fullpath + '/' + filename;
+ }
+ }
+ } else {
+ if (rpath == '/') {
+ fullpath = rpath + fname.slice(0, slashindex);
+ } else {
+ fullpath = rpath + '/' + fname.slice(0, slashindex);
+ }
+ }
+ }
+ if (fullpath == '/') {
+ fullname = fullpath + filename;
+ } else {
+ if (fullname.length === 0) {
+ fullname = fullpath + '/' + filename;
+ }
+ }
+ return [fullpath, filename, fullname];
+}
+
+function longlisting(t, files, opt) {
+ if (typeof files == 'undefined') {
+ t.write('%c(@lightgrey)Error path does not exist%n');
+ return;
+ }
+ var showmore = false;
+ var lines = [];
+ if (typeof opt != 'undefined' && opt.indexOf('a') != -1) {
+ t.write(['%c(@lightgrey)drwxrwxr-x 6 sysa wheel 1024 Feb 12 03:03 ./', 'drwxr-xr-x 21 root wheel 512 Jan 25 00:26 ../%n']);
+ }
+ for (var i = 0; i < files[0].length; i++) {
+ lines[i] = files[3] + ' ' + files[1][i] + ' ' + files[2][i] + ' ' + files[0][i];
+ }
+ if (files[0].length > t.conf.rows - 2) {
+ showmore = true;
+ }
+ t.write(lines, showmore);
+}
+
+function listing(t, f) {
+ if (typeof f == 'undefined') {
+ t.write('%c(@lightgrey)Error path does not exist%n');
+ return;
+ }
+ var files = f;
+ var name_length = 0;
+ var space_divider = 5;
+ var fileslist = [];
+ for (var i = 0; i < files.length; i++) {
+ if (files[i].length > name_length) {
+ name_length = files[i].length;
+ }
+ }
+ name_length = name_length + space_divider;
+ var dividers = Math.round((t.conf.cols - 2) / name_length);
+ var j = 1;
+ var thisline = '%c(@lightgrey)';
+ for (var k = 0; k < files.length; k++) {
+ thisline += files[k];
+ var this_name_lenth = files[k].length;
+ if (files[k] == '%+nunixtoolbox.xhtml%-n') {
+ this_name_lenth = this_name_lenth - 6;
+ }
+ var space_missing = name_length - this_name_lenth;
+ var space = '';
+ while (space_missing > 0) {
+ space = space + ' ';
+ space_missing--;
+ }
+ thisline += space;
+ j++;
+ if (j >= dividers) {
+ fileslist.push(thisline);
+ t.write(thisline + '%n');
+ thisline = '%c(@lightgrey)';
+ j = 1;
+ }
+ }
+ if (j !== 0) {
+ t.write(thisline + '%n');
+ }
+}
+var uptimed = randomRange(10, 380);
+var uptime = ' up ' + uptimed + ' days, 04:32, ' +
+ randomRange(0, 10) + ' users, load averages: 0.' +
+ randomRange(10, 99) + ', 0.' + randomRange(10, 89) + ', 0.' + randomRange(10, 69);
+var clockvisible = false;
+stopwatch = false;
+var numh = asciin.length;
+var numw = asciin[0].length / 10;
+var asciistr = [];
+var r;
+var c;
+var started;
+var now;
+var firstline = '';
+var sp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabscdefghijklmnopqrstuvwxyz23456789#$£@';
+var s = ' ';
+var dim = null;
+var allRows = [];
+var interval = 0;
+var xperIter = 0;
+var mcolors = ['030', '033', '063', '093', '393', '0c3', '3c0', '6c3', '0f0', '6f3', '3f0', '9f3', 'ff3', 'fff'];
+var regex = [];
+
+function connectionLost() {
+ globalterm.charMode = true;
+ globalterm.lock = true;
+ globalterm.cursorOff();
+ globalterm.newLine();
+ globalterm.write("%n%c(@orange)Error: connection reset by peer%n");
+ createCookie("broken", "true", 0, 1);
+}
+
+function cmdLogin(t) {
+ if ((t.argc == t.argv.length) || (t.argv[t.argc] === '')) {
+ t.write('%c(@lightgrey)usage: login <username>');
+ } else {
+ t.env.getPassword = true;
+ t.env.username = t.argv[t.argc];
+ t.write('%c(@lightgrey)Password: ');
+ t.rawMode = true;
+ t.lock = false;
+ return;
+ }
+}
+
+function cmdSu(t) {
+ t.env.getPassword = true;
+ t.env.username = 'root';
+ t.write('%c(@lightgrey)Password: ');
+ t.rawMode = true;
+ t.lock = false;
+ return;
+}
+var uid = randomRange(500, 1000);
+
+function cmdId(t) {
+ var uidnow = uid;
+ if (t.user == 'www') {
+ uidnow = 80;
+ } else if (t.user == 'root') {
+ uidnow = 0;
+ }
+ t.write('%c(@lightgrey)uid=' + uidnow + '(' + t.user + ') gid=' + uidnow + '(' + t.user + ') groups=' + uidnow + '(' + t.user + ')');
+}
+
+function cmdUptime(t) {
+ d = new Date();
+ t.write('%c(@lightgrey)' + d.milTime() + uptime);
+}
+
+function isnumeric(str) {
+ for (var i = 0; i < str.length; i++) {
+ var c = str.charAt(i);
+ var a = c.charCodeAt(0);
+ if (!(a > 47 && a < 58) && !(a == 45)) {
+ return false;
+ }
+ if (a == 45 && i !== 0) {
+ return false;
+ }
+ }
+ return true;
+}
+
+function cmdCal(t) {
+ if (t.argv.length == 1) {
+ d = new Date();
+ } else {
+ if (t.argv[1] == '-h' || t.argv[1] == '--help') {
+ t.write('%c(@lightgrey)display this months calender.%n');
+ t.write('%c(@lightgrey)usage: cal [month]%n');
+ return;
+ } else if (!isnumeric(t.argv[1])) {
+ t.write('%c(@lightgrey)usage: cal [month] where [month] is numeric%n');
+ return;
+ } else {
+ now = new Date();
+ var year = now.getFullYear();
+ var day = now.getUTCDate();
+ var month = t.argv[1] - 1;
+ d = new Date(year, month, day);
+ }
+ }
+ t.write(d.calendar());
+}
+
+function cmdLs(t) {
+ var findex = 0;
+ var fpath = null;
+ var longlist = false;
+ if (t.argv.length == 1) {
+ listing(t, tree_files[tree.indexOf(path)][0]);
+ return;
+ } else if (t.argv[1] == '-l' || t.argv[1] == '-la' || t.argv[1] == '-al') {
+ if (t.argv.length == 2) {
+ longlisting(t, tree_files[tree.indexOf(path)], t.argv[1]);
+ return;
+ } else {
+ longlist = true;
+ fpath = getPath(t.argv[2]);
+ }
+ } else {
+ fpath = getPath(t.argv[1]);
+ }
+ findex = tree.indexOf(fpath[2]);
+ if (findex != -1) {
+ if (longlist) {
+ longlisting(t, tree_files[findex], t.argv[1]);
+ } else {
+ listing(t, tree_files[findex][0]);
+ }
+ } else {
+ t.write('%c(@lightgrey)' + t.argv[1] + ': No such file or directory.');
+ }
+}
+
+function cmdLl(t) {
+ if (t.argv.length == 1) {
+ longlisting(t, tree_files[tree.indexOf(path)]);
+ } else {
+ fpath = getPath(t.argv[1]);
+ findex = tree.indexOf(fpath[2]);
+ if (findex != -1) {
+ longlisting(t, tree_files[findex]);
+ } else {
+ t.write('%c(@lightgrey)' + t.argv[1] + ': No such file or directory.');
+ }
+ }
+}
+
+function cmdPwd(t) {
+ t.write('%c(@lightgrey)' + path);
+}
+
+function cmdCd(t) {
+ if (t.argv.length == 1 || t.argv[1] == '~') {
+ path = '/home/www';
+ t.ps = '[' + t.user + '@localhost]~>';
+ return;
+ } else {
+ splitpath = getPath(t.argv[1]);
+ var findex = tree.indexOf(splitpath[2]);
+ if (findex != -1) {
+ path = splitpath[2];
+ } else {
+ t.write('%c(@lightgrey)' + splitpath[2] + ': No such file or directory.');
+ }
+ }
+ if (path == '/home/www') {
+ t.ps = '[' + t.user + '@localhost]~>';
+ } else {
+ t.ps = '[' + t.user + '@localhost]' + path + '>';
+ }
+}
+
+function cmdEcho(t) {
+ if (t.argv.length != 1 && t.argv[t.argv.length - 2] == '>') {
+ var file = t.argv[t.argv.length - 1];
+ if (path != '/home/www') {
+ t.write('%c(@lightgrey)Permission denied');
+ return;
+ }
+ var fs = '';
+ for (var i = 1; i < t.argv.length - 2; i++) {
+ fs += t.argv[i];
+ if (i + 1 != t.argv.length - 2) {
+ fs += ' ';
+ }
+ }
+ addFile(file, fs);
+ } else if (t.argv.length != 1 && t.argv[1] == '$PATH') {
+ t.write('%c(@lightgrey)/bin:/sbin:/etc');
+ } else {
+ var s = '%c(@lightgrey)';
+ for (var j = 1; j < t.argv.length; j++) {
+ s += t.argv[j];
+ if (j + 1 != t.argv.length) {
+ s += ' ';
+ }
+ }
+ t.write(s);
+ }
+}
+
+function isdir(dirpath) {
+ if (tree.indexOf(dirpath) != -1) {
+ return true;
+ }
+ return false;
+}
+
+function isfile(filepath) {
+ var fpath = getPath(filepath);
+ if (tree.indexOf(fpath[0]) == -1) {
+ return false;
+ }
+ if (tree_files[tree.indexOf(fpath[0])][0].indexOf(fpath[1]) == -1) {
+ return false;
+ }
+ return true;
+}
+
+function rmdir(dirpath) {
+ var fpath = getPath(dirpath);
+ for (var j = 0; j < 3; j++) {
+ tree_files[tree.indexOf(fpath[0])][j].splice(tree_files[tree.indexOf(fpath[0])][0].indexOf(fpath[1]), 1);
+ }
+ if (isdir(dirpath)) {
+ tree_files.splice(tree.indexOf(fpath[2]), 1);
+ tree.splice(tree.indexOf(fpath[2]), 1);
+ }
+}
+
+function rmdirr(dirpath) {
+ if (isdir(dirpath)) {
+ var fpath = getPath(dirpath);
+ var files = tree_files[tree.indexOf(fpath[2])][0];
+ while (files.length > 0) {
+ rmdirr(dirpath + '/' + files[files.length - 1]);
+ }
+ }
+ rmdir(dirpath);
+}
+
+function cmdRm(t) {
+ t.wrap = false;
+ if (t.argv.length == 1) {
+ t.write('%c(@lightgrey)usage: rm <file>');
+ return;
+ }
+ var rf = false;
+ var rootindex = 0;
+ var dirindex = 0;
+ var fileindex = 0;
+ var filearg = t.argv[t.argv.length - 1];
+ if (t.argv.indexOf('-rf') != -1) {
+ rf = true;
+ }
+ if (t.user == 'root') {
+ if (filearg == '/' && rf) {
+ setTimeout('connectionLost()', 15000);
+ filearg = '/bin';
+ }
+ var fpath = getPath(filearg);
+ var fname = fpath[1];
+ var lpath = fpath[0];
+ var fullname = fpath[2];
+ rootindex = tree.indexOf(lpath);
+ if (rootindex != -1) {
+ dirindex = tree.indexOf(fullname);
+ fileindex = tree_files[rootindex][0].indexOf(fname);
+ if (isdir(fullname)) {
+ if (rf) {
+ rmdirr(fullname);
+ } else {
+ t.write('rm: cannot remove ' + filearg + ': Is a directory%n');
+ }
+ } else {
+ if (fileindex != -1) {
+ for (var i = 0; i < 3; i++) {
+ tree_files[rootindex][i].splice(fileindex, 1);
+ }
+ } else {
+ t.write('rm: cannot remove ' + fname + ': No such file or directory%n');
+ }
+ }
+ } else {
+ t.write('rm: cannot remove ' + lpath + ': No such file or directory%n');
+ }
+ } else {
+ if (filearg == '/') {
+ t.write('%c(@lightgrey)I\'m sorry Dave, I\'m afraid I can\'t do that.');
+ } else if (t.argv[1] == '*') {
+ delAllFiles();
+ } else {
+ delAFile(filearg);
+ }
+ }
+}
+
+function cmdUname(t) {
+ if (t.argv.length == 1 || t.argv[1] == '-s') {
+ t.write('%c(@lightgrey)FreeBSD');
+ } else if (t.argv[1] == '-i') {
+ t.write('%c(@lightgrey)CB');
+ } else if (t.argv[1] == '-m' || t.argv[1] == '-p') {
+ t.write('%c(@lightgrey)i386');
+ } else if (t.argv[1] == '-n') {
+ t.write('%c(@lightgrey)localhost');
+ } else if (t.argv[1] == '-a') {
+ t.write('%c(@lightgrey)FreeBSD localhost 7.1-STABLE FreeBSD 7.1-STABLE #2: Wed Jan 30 16:21:05 CET 2009 c@localhost:/usr/obj/usr/src/sys/CB i386');
+ } else if (t.argv[1] == '-v') {
+ t.write('%c(@lightgrey)FreeBSD 7.1-STABLE #2: Wed Jan 30 16:21:05 CET 2009 c@localhost:/usr/obj/usr/src/sys/CB');
+ } else if (t.argv[1] == '-r') {
+ t.write('%c(@lightgrey)7.1-STABLE');
+ } else {
+ t.write(['%c(@lightgrey)uname: illegal option -' + t.argv[1], 'usage: uname [-aimnprsv]']);
+ }
+}
+
+function cmdHostname(t) {
+ if (t.argv.length == 1 || t.argv[1] == '-f') {
+ t.write('%c(@lightgrey)localhost');
+ } else if (t.argv[1] == '-s') {
+ t.write('%c(@lightgrey)cb');
+ } else if (t.argv[1] == '-i') {
+ t.write('%c(@lightgrey)78.31.70.238');
+ } else {
+ t.write(['%c(@lightgrey)uname: illegal option -' + t.argv[1], 'usage: hostname [-fsi]']);
+ }
+}
+
+function cmdReset(t) {
+ t.write(' ');
+ t.clear();
+ t.rawMode = true;
+ t.open();
+ return;
+}
+
+function cmdCat(t, iseditor, filename) {
+ var error = "ok";
+ if (t.argv.length == 1 && !iseditor) {
+ t.write('%c(@lightgrey)usage: cat file');
+ return error;
+ }
+ if (typeof filename == 'undefined') {
+ filename = t.argv[1];
+ }
+ var fpath = getPath(filename);
+ var fname = fpath[1];
+ var lpath = fpath[0];
+ var fullname = fpath[2];
+ var cnt;
+ var tindex = tree.indexOf(lpath);
+ if (tindex == -1) {
+ error = "Error: " + lpath + " wrong path";
+ return error;
+ }
+ var findex = tree_files[tindex][0].indexOf(fname);
+ if (findex != -1 || fname == 'unixtoolbox.xhtml') {
+ var fcontent = readCookie(fname);
+ if (fcontent) {
+ cnt = fcontent.slice(0, fcontent.length - 12);
+ cnt = cnt.replace(/~~/g, ";");
+ t.write('%c(@lightgrey)' + cnt + '%n');
+ return error;
+ }
+ cnt = filesContent[fullname];
+ if (typeof cnt != 'undefined' && cnt != 'undefined') {
+ t.write(cnt);
+ } else {
+ if (remote_files.indexOf(fname) != -1) {
+ cnt = filesContent[fullname];
+ t.write('%c(@lightgrey)' + cnt + '%n');
+ } else if (binary_files.indexOf(fname) != -1) {
+ if (iseditor) {
+ error = " binary file";
+ } else {
+ window.location = '/' + fname;
+ }
+ } else {
+ error = fname + ': Permission denied';
+ if (iseditor) {
+ return 'Open ' + error;
+ } else {
+ t.write('%c(@lightgrey)cat : ' + error + '%n');
+ }
+ }
+ }
+ } else {
+ if (!iseditor) {
+ t.write('%c(@lightgrey)cat : ' + fname + ' : File not found%n');
+ } else {
+ error = "";
+ }
+ }
+ return error;
+}
+
+function cmdMan(t) {
+ if (t.argv.length == 1) {
+ t.write('%c(@lightgrey)usage: man <command>%n');
+ t.write('%c(@lightgrey)The following man pages are available, or use apropos on any command.%n');
+ listing(t, files_man[0]);
+ return;
+ }
+ var cmd = t.argv[1];
+ if (files_man_n.indexOf(cmd) != -1) {
+ var dim = t.getDimensions();
+ var file = filesContent['/usr/share/man/' + cmd];
+ if (file.length > t.conf.rows - 1) {
+ t.write(file, true);
+ } else {
+ t.write(file);
+ }
+ } else {
+ t.write('%c(@lightgrey)No manual entry for ' + cmd);
+ }
+}
+
+function cmdMore(t) {
+ if (t.argv.length == 1) {
+ t.write('%c(@lightgrey)usage: more <file>');
+ return;
+ }
+ var fpath = getPath(t.argv[1]);
+ var fname = fpath[1];
+ var lpath = fpath[0];
+ var fullname = fpath[2];
+ var cnt;
+ var findex;
+ var tindex = tree.indexOf(lpath);
+ if (tindex == -1) {
+ return;
+ }
+ if (lpath == '/home/www') {
+ findex = tree_files[tindex][0].indexOf(fname);
+ if (findex != -1) {
+ t.clear();
+ var fcontent = readCookie(fname);
+ if (fcontent) {
+ cnt = fcontent.slice(0, fcontent.length - 12);
+ cnt = cnt.replace(/~~/g, ";");
+ t.write('%c(@lightgrey)' + cnt + '%n');
+ return;
+ } else if (fname == 'sitemap.xml') {
+ t.write(file_sitemap, true);
+ return;
+ } else if (fname == 'cb.txt') {
+ t.write(file_cb, true);
+ return;
+ } else if (fname == 'about.txt') {
+ t.write(file_about, true);
+ return;
+ } else if (fname == 'bugs.txt') {
+ t.write(file_bugs, true);
+ return;
+ }
+ }
+ if (remote_files.indexOf(fname) != -1) {
+ t.rawMode = true;
+ t.write('%c(@lightgrey)Patience...%n');
+ fetchHttp('/' + fname, displaymore);
+ } else if (binary_files.indexOf(fname) != -1) {
+ t.write('%c(@lightgrey)Binary file. Use pr instead');
+ } else {
+ t.write('%c(@lightgrey)File not found.');
+ }
+ } else if (lpath == '/etc') {
+ findex = tree_files[tindex][0].indexOf(fname);
+ if (findex != -1) {
+ cnt = filesContent[fullname];
+ if (typeof cnt != 'undefined') {
+ t.clear();
+ t.write(cnt);
+ } else {
+ t.write('%c(@lightgrey)' + fname + ' : Permission denied%n');
+ }
+ } else {
+ t.write('%c(@lightgrey)' + fname + ' : File not found%n');
+ }
+ }
+}
+
+function cmdPr(t) {
+ if (t.argv.length == 1) {
+ t.write('%c(@lightgrey)usage: pr file');
+ } else {
+ window.location = t.argv[1];
+ }
+}
+
+function cmdRedim(t, manual) {
+ var oldie = false;
+ if (typeof document.documentElement.style.maxHeight == "undefined") {
+ oldie = true;
+ }
+ if (navigator.appVersion.indexOf('Safari') != -1) {
+ safari = true;
+ }
+ var dim = t.getDimensions();
+ var neww = Math.round((t.conf.cols / dim.width) * browserWidth()) - 2;
+ var newh = Math.round((t.conf.rows / dim.height) * browserHeight()) - 1;
+ if (oldie) {
+ t.write('Using IE6 hack%n');
+ neww = neww - 2;
+ }
+ if ((t.argv) && t.argv.length > 1 || manual) {
+ t.write('Terminal dimentions in px: ' + dim.width + ' x ' + dim.height + ' px%n');
+ t.write('Browser window dimentions in px: ' + browserWidth() + ' x ' + browserHeight() + ' px%n');
+ t.write('Terminal columns x rows: ' + t.conf.cols + ' x ' + t.conf.rows + ' char%n');
+ t.write('Maximal columns x rows: ' + neww + ' x ' + newh + ' char%n');
+ } else if (!(t.argv) || t.argv.length == 1) {
+ if (neww !== 0) {
+ t.resizeTo(neww, newh);
+ t.maxCols = neww;
+ t.maxLines = newh;
+ if (neww < (6 * asciinumber[0].length / 10) + (2 * asciiddot[0].length)) {
+ asciin = asciinumber_s;
+ asciid = asciiddot_s;
+ } else {
+ asciin = asciinumber;
+ asciid = asciiddot;
+ }
+ numh = asciin.length;
+ numw = asciin[0].length / 10;
+ }
+ }
+}
+
+function redim() {
+ cmdRedim(globalterm);
+}
+
+function cmdTime(t) {
+ var d = new Date();
+ t.write('%c(@lightgrey)' + d.milTime());
+}
+
+function displayNum(str, center) {
+ var n = 0;
+ for (var i = 0; i < numh; i++) {
+ asciistr[i] = '';
+ }
+ for (var k = 0; k < str.length; k++) {
+ if (str.charAt(k) == ':') {
+ for (var j = 0; j < numh; j++) {
+ asciistr[j] = asciistr[j] + asciid[j];
+ }
+ } else {
+ n = str.charAt(k);
+ for (var l = 0; l < numh; l++) {
+ asciistr[l] = asciistr[l] + asciin[l].slice(n * numw, (n * numw) + numw);
+ }
+ }
+ }
+ if (!center) {
+ globalterm.write(s);
+ } else {
+ var r = Math.round(globalterm.conf.rows / 2) - Math.round(numh / 2);
+ var c = Math.round((globalterm.conf.cols - asciistr[0].length) / 2);
+ for (var m = 0; m < asciistr.length; m++) {
+ globalterm.typeAt(r + m, c, asciistr[m], 3 * 256);
+ }
+ }
+}
+
+function clockHandler(initterm) {
+ if (initterm) {
+ initterm.env.handler = initterm.handler;
+ initterm.cursorOff();
+ asciistr = [];
+ numh = asciin.length;
+ numw = asciin[0].length / 10;
+ r = Math.round(globalterm.conf.rows / 2) - Math.round(numh / 2);
+ c = Math.round((globalterm.conf.cols - (6 * numw) - 2 * asciid[0].length) / 2) + (4 * numw) + 2 * asciid[0].length;
+ return;
+ }
+ this.lock = true;
+ var key = this.inputChar;
+ if (key == 32) {
+ if (interval === 0) {
+ interval = setInterval('carriageReturn()', 1000);
+ } else {
+ clearInterval(interval);
+ interval = 0;
+ }
+ } else if (key == 114) {
+ started = new Date();
+ } else if (key != globalterm.termKey.CR) {
+ clearInterval(interval);
+ interval = 0;
+ clockvisible = false;
+ stopwatch = false;
+ this.charMode = false;
+ this.handler = this.env.handler;
+ this.clear();
+ this.prompt();
+ return;
+ } else {
+ now = new Date();
+ var h;
+ var m;
+ var s;
+ if (!stopwatch) {
+ h = now.getHours();
+ m = now.getMinutes();
+ s = now.getSeconds();
+ } else {
+ var diff = (now - started) / 1000;
+ s = Math.floor(diff % 60);
+ diff = diff / 60;
+ m = Math.floor(diff % 60);
+ diff = diff / 60;
+ h = Math.floor(diff % 24);
+ }
+ var sh = '' + h;
+ var sm = '' + m;
+ var ss = '' + s;
+ if (h < 10) {
+ sh = '0' + h;
+ }
+ if (m < 10) {
+ sm = '0' + m;
+ }
+ if (s < 10) {
+ ss = '0' + s;
+ }
+ if (!clockvisible) {
+ displayNum(sh + ':' + sm + ':' + ss, true);
+ clockvisible = true;
+ } else if (s < 2) {
+ displayNum(sh + ':' + sm + ':' + ss, true);
+ } else {
+ for (var j = 0; j < numh; j++) {
+ asciistr[j] = '' +
+ asciin[j].slice(ss.charAt(0) * numw, (ss.charAt(0) * numw) + numw) +
+ asciin[j].slice(ss.charAt(1) * numw, (ss.charAt(1) * numw) + numw);
+ }
+ for (var i = 0; i < asciistr.length; i++) {
+ this.typeAt(r + i, c, asciistr[i], 3 * 256);
+ }
+ }
+ }
+ this.lock = false;
+}
+
+function cmdClock(t) {
+ started = new Date();
+ var findex = -1;
+ if (t.argv.length >= 2) {
+ findex = t.argv.indexOf('-t');
+ }
+ if (findex != -1) {
+ stopwatch = true;
+ t.argv.splice(findex, 1);
+ findex = -1;
+ }
+ if (t.argv.length >= 2) {
+ findex = t.argv.indexOf('-s');
+ }
+ if (findex != -1) {
+ asciin = asciinumber_s;
+ asciid = asciiddot_s;
+ t.argv.splice(findex, 1);
+ findex = -1;
+ } else if (t.conf.cols > (6 * asciinumber[0].length / 10) + (2 * asciiddot[0].length)) {
+ asciin = asciinumber;
+ asciid = asciiddot;
+ }
+ t.charMode = true;
+ t.cursorOff();
+ t.clear();
+ clockHandler(t);
+ interval = setInterval('carriageReturn()', 1000);
+ t.handler = clockHandler;
+ t.lock = false;
+ return;
+}
+
+function setNormal() {
+ term.conf.bgColor = '#181818';
+ term.rebuild();
+}
+
+function setColor(color) {
+ term.conf.bgColor = color;
+ term.rebuild();
+ globalterm.write(' ');
+}
+var bootline = 0;
+var booting = false;
+var sdnotifed = false;
+var rebootask1 = false;
+var rebootask2 = false;
+var rebootask3 = false;
+var beenhere = false;
+
+function rebootHandler(initterm) {
+ if (initterm) {
+ initterm.env.handler = initterm.handler;
+ if (beenhere) {
+ initterm.write('%c(@orange)You again?? %c(@lightgrey)Alright you want to reboot, but are you sure?');
+ } else {
+ initterm.write('%c(@lightgrey)So you want to reboot. Are you sure?');
+ }
+ return;
+ }
+ this.newLine();
+ this.charMode = false;
+ this.lock = true;
+ if (this.isPrintable(key)) {
+ var ch = String.fromCharCode(key);
+ this.type(ch);
+ }
+ if (!rebootask1) {
+ beenhere = true;
+ this.cursorOn();
+ if (this.lineBuffer == 'yes') {
+ rebootask1 = true;
+ this.write('%c(@lightgrey)Are you really sure you know which machine is actually going to reboot?');
+ this.newLine();
+ } else if (this.lineBuffer == 'no') {
+ this.write('%c(@lightgrey)Good choice! Go play with the other commands.');
+ this.charMode = false;
+ this.handler = this.env.handler;
+ this.prompt();
+ return;
+ } else if (this.lineBuffer) {
+ this.write('%c(@lightgrey)answer yes or no');
+ this.newLine();
+ }
+ this.lock = false;
+ this.lineBuffer = '';
+ return;
+ } else if (!rebootask2) {
+ this.cursorOn();
+ if (this.lineBuffer == 'yes') {
+ rebootask2 = true;
+ this.write('%c(@lightgrey)So will that be yours or mine? Answer "yours" or "mine" or "quit"');
+ this.newLine();
+ } else if (this.lineBuffer == 'no') {
+ this.write('%c(@lightgrey)I don\'t know either :o)');
+ rebootask1 = false;
+ this.charMode = false;
+ this.handler = this.env.handler;
+ this.prompt();
+ return;
+ } else if (this.lineBuffer) {
+ this.write('%c(@lightgrey)answer with yes or no');
+ this.newLine();
+ }
+ this.lock = false;
+ this.lineBuffer = '';
+ return;
+ } else if (!rebootask3) {
+ this.cursorOn();
+ if (this.lineBuffer == 'yours' || this.lineBuffer == 'mine') {
+ this.cursorOff();
+ rebootask3 = true;
+ this.write('%c(@lightgrey)So you mean yours....OK you asked for it.');
+ setTimeout('carriageReturn()', 2000);
+ } else if (this.lineBuffer == 'quit') {
+ rebootask1 = false;
+ rebootask2 = false;
+ rebootask3 = false;
+ this.write('%c(@lightgrey)whimp :o).');
+ this.charMode = false;
+ this.handler = this.env.handler;
+ this.prompt();
+ return;
+ } else if (this.lineBuffer) {
+ this.write('Answer "yours" or "mine" or "quit"');
+ this.newLine();
+ }
+ this.lock = false;
+ this.lineBuffer = '';
+ return;
+ }
+ this.lock = true;
+ var key = this.inputChar;
+ this.cursorOff();
+ if (key == 32) {
+ if (interval === 0) {
+ interval = setInterval('carriageReturn()', 300);
+ } else {
+ clearInterval(interval);
+ interval = 0;
+ }
+ } else if (!sdnotifed && !booting) {
+ this.newLine();
+ this.write(['%n%n%n%c(@orange)Shutdown at ' + Date(), '%c(@chartreuse)shutdown: [pid ' + randomRange(189, 21000) + ']', 'root:{' + randomRange(70, 150) + '}' + path, '%n%n*** System shutdown message from ' + clientip + ' ***', 'Sytem going down in 4 seconds%c()%n%n%n']);
+ this.write('Send SIGTERM to all processes%n');
+ this.write(pslong);
+ this.newLine();
+ this.write('%n%n');
+ sdnotifed = true;
+ setTimeout('interval = setInterval (\'carriageReturn()\', 300 )', 4000);
+ } else if (!booting && sdnotifed) {
+ if (bootline == filesContent['/boot/shutdown'].length - 1) {
+ bootline = 0;
+ clearInterval(interval);
+ interval = 0;
+ this.clear();
+ term.conf.bgColor = 'blue';
+ term.rebuild();
+ this.write(' ');
+ booting = true;
+ setTimeout('setColor(\'#ffffff\')', 1200);
+ setTimeout('setNormal()', 1600);
+ setTimeout('interval = setInterval (\'carriageReturn()\', 300 )', 2500);
+ } else {
+ this.write(filesContent['/boot/shutdown'][bootline]);
+ bootline++;
+ if (bootline == filesContent['/boot/shutdown'].length - 1) {
+ clearInterval(interval);
+ interval = setInterval('carriageReturn()', 4000);
+ }
+ }
+ } else {
+ if (bootline == filesContent['/boot/kernel'].length - 1) {
+ clearInterval(interval);
+ interval = 0;
+ bootline = 0;
+ booting = false;
+ rebootask1 = false;
+ rebootask2 = false;
+ this.newLine();
+ cmdRedim(this, true);
+ this.charMode = false;
+ this.handler = this.env.handler;
+ this.cursorOn();
+ setTimeout('globalterm.clear()', 3000);
+ setTimeout('location.reload()', 3500);
+ } else {
+ this.write(filesContent['/boot/kernel'][bootline]);
+ bootline++;
+ }
+ }
+ this.lock = false;
+}
+
+function cmdReboot(t) {
+ if (t.user != 'root') {
+ t.write("%c(@lightgrey)You must be root to do this");
+ return;
+ }
+ t.charMode = true;
+ rebootHandler(t);
+ t.handler = rebootHandler;
+ setTimeout('carriageReturn()', 100);
+ t.lock = false;
+ return;
+}
+
+function cmdNum(t) {
+ if (t.argv.length == 1) {
+ t.write('%c(@lightgrey)usage: num number');
+ }
+ asciistr = [];
+ displayNum(t.argv[1], true);
+}
+
+function randomScreen(isgame) {
+ globalterm.wrap = true;
+ var maxr = 0;
+ allRows = [];
+ globalterm.clear();
+ if (typeof isgame == 'undefined') {
+ isgame = false;
+ }
+ if (isgame) {
+ maxr = globalterm.conf.rows - 2;
+ } else {
+ maxr = globalterm.conf.rows;
+ }
+ firstline = "";
+ for (var j = 0; j <= maxr; j++) {
+ for (var i = 0; i < globalterm.conf.cols; i++) {
+ if (isgame) {
+ if (i === 0 || i == globalterm.conf.cols - 1) {
+ firstline += '*';
+ continue;
+ }
+ if (randomRange(1, 250) <= snakefood) {
+ firstline += randomRange(1, 9);
+ } else {
+ firstline += ' ';
+ }
+ } else {
+ firstline += String.fromCharCode(randomRange(38, 126));
+ }
+ }
+ allRows.push(firstline);
+ firstline = "";
+ }
+ if (isgame) {
+ for (var k = 0; k < globalterm.conf.cols; k++) {
+ firstline += '%c(@lightgrey)*';
+ }
+ allRows[0] = allRows[maxr] = firstline;
+ var nrocks = Math.round((globalterm.conf.cols * globalterm.conf.rows) / snakerocks);
+ for (var rocks = 0; rocks < nrocks; rocks++) {
+ var rockr = randomRange(2, globalterm.conf.rows - 9);
+ var rockc = randomRange(2, globalterm.conf.cols - 7);
+ var rockchar = '';
+ for (var kr = 0; kr < 4; kr++) {
+ if (kr > 0 && kr < 3) {
+ rockchar = "#####";
+ } else if (kr === 0) {
+ rockchar = ",###,";
+ } else if (kr == 3) {
+ rockchar = "'###'";
+ }
+ allRows[rockr + kr] = allRows[rockr + kr].slice(0, rockc) +
+ rockchar + allRows[rockr + kr].slice(rockc + 5);
+ }
+ }
+ for (var l = 0; l < allRows.length; l++) {
+ allRows[l] = allRows[l].replace(/#/g, "%c(@orange)#%c(@lightgrey)");
+ allRows[l] = allRows[l].replace(/,/g, "%c(@orange),%c(@lightgrey)");
+ allRows[l] = allRows[l].replace(/\'/g, "%c(@orange)'%c(@lightgrey)");
+ }
+ }
+ return allRows;
+}
+
+function cmdRandom(t) {
+ if (t.argv.length == 2 && t.argv[1] == 'n') {
+ t.write(randomScreen(true));
+ } else {
+ t.write(randomScreen());
+ }
+}
+
+function iterateArray(write) {
+ if (Math.round(Math.random() - 0.40) === 0) {
+ s = ' ';
+ } else {
+ s = '1';
+ }
+ for (i = 0; i < mcolors.length; i++) {
+ if (i === 0) {
+ repl = s;
+ } else {
+ repl = '%c(#' + mcolors[i - 1] + ')' + sp.charAt(randomRange(0, 61));
+ }
+ firstline = firstline.replace(regex[i], repl);
+ }
+ repl = '%c(#fff)' + sp.charAt(randomRange(0, 61));
+ for (i = 0; i < xperIter; i++) {
+ var p = randomRange(0, firstline.length);
+ if (firstline.charAt(p) == ' ' || firstline.charAt(p) == '1') {
+ firstline = firstline.slice(0, p) + '%c(#fff)#' + firstline.slice(p + 1);
+ }
+ }
+ var rowtochange = randomRange(1, allRows.length - 1);
+ allRows[rowtochange] = allRows[rowtochange].replace(regex[mcolors.length], repl);
+ allRows.unshift(firstline);
+ allRows.pop();
+ if (write) {
+ globalterm.write(allRows);
+ }
+}
+var matrixrounds;
+var matrixemptystart = false;
+
+function matrixHandler(initterm) {
+ var repl;
+ var i = 0;
+ if (initterm) {
+ if (initterm.argv.indexOf('-s') != -1) {
+ matrixemptystart = true;
+ } else {
+ matrixemptystart = false;
+ }
+ matrixrounds = globalterm.conf.rows * 3;
+ firstline = '';
+ xperIter = Math.round(globalterm.conf.cols / 45);
+ initterm.env.handler = initterm.handler;
+ dim = initterm.getDimensions();
+ for (i = 0; i < mcolors.length; i++) {
+ regex[i] = eval('\/%c\\(#' + mcolors[i] + '\\).\/g');
+ }
+ regex[mcolors.length] = eval('\/%c\\(#fff\\).\/g');
+ for (i = 0; i < initterm.conf.cols - 1; i++) {
+ firstline = firstline + ' ';
+ }
+ for (i = 0; i <= initterm.conf.rows; i++) {
+ allRows[i] = firstline;
+ }
+ return;
+ }
+ this.lock = true;
+ var key = this.inputChar;
+ if (key == 32) {
+ if (interval === 0) {
+ interval = setInterval('carriageReturn()', 1000);
+ } else {
+ clearInterval(interval);
+ interval = 0;
+ }
+ }
+ if (key == 113 || key == termKey.ESC) {
+ clearInterval(interval);
+ interval = 0;
+ this.charMode = false;
+ this.handler = this.env.handler;
+ this.clear();
+ this.prompt();
+ return;
+ } else {
+ if (!matrixemptystart && matrixrounds > 0) {
+ while (matrixrounds > 0) {
+ iterateArray(false);
+ matrixrounds--;
+ }
+ }
+ iterateArray(false);
+ this.write(allRows);
+ }
+ this.lock = false;
+}
+
+function cmdMatrix(t) {
+ t.cursorOff();
+ t.charMode = true;
+ t.write('%c(@lightgrey)Use q or ESC to quit. Space to pause%n');
+ t.write('%c(@lightgrey) -s for empty start%n');
+ t.write('%c(@lightgrey) See also man matrix%n');
+ matrixHandler(t);
+ interval = setInterval('carriageReturn()', 1200);
+ t.handler = matrixHandler;
+ t.lock = false;
+ return;
+}
+
+function init(t) {
+ var numproc = randomRange(9, 12);
+ var h = randomRange(0, 9);
+ var m = randomRange(10, 59);
+ for (var i = 0; i < numproc; i++) {
+ var s = randomRange(10, 59);
+ pslong.push('%c(@lightgrey)www ' + randomRange(1000, 5100) + ' 0.0 1.5 ' +
+ randomRange(10000, 51000) + ' ' + randomRange(10000, 51000) + ' ?? I ' + h + ':' + m + '.' + s + ' /usr/local/sbin/httpd');
+ }
+}
+
+function cmdPs(t) {
+ var numproc = randomRange(8, 14);
+ var h = randomRange(0, 9);
+ var m = randomRange(10, 59);
+ if (t.argv.length == 1) {
+ t.write('%c(@lightgrey)PID TT STAT TIME COMMAND%n');
+ for (var i = 0; i < numproc; i++) {
+ var s = ((i * 13) + 10) % 60;
+ s = (s < 10) ? 10 : s;
+ t.write('%c(@lightgrey)' + randomRange(1000, 5100) + ' ?? I ' + h + ':' + m + '.' + s + ' /usr/local/sbin/httpd%n');
+ }
+ } else {
+ t.write(pslong);
+ }
+}
+
+function cmdWhatis(t) {
+ if (t.argv.length == 1) {
+ t.write('%c(@lightgrey)usage: whatis/apropos <command>');
+ } else if (t.argv[1] == 'help') {
+ t.write('%c(@lightgrey)display the help message');
+ } else if (t.argv[1] == 'info') {
+ t.write('%c(@lightgrey)display the info message with credentials');
+ } else if (t.argv[1] == 'clear') {
+ t.write('%c(@lightgrey)clear the terminal');
+ } else if (t.argv[1] == 'echo') {
+ t.write('%c(@lightgrey)echo the arguments or create a file with >');
+ } else if (t.argv[1] == 'ls' || t.argv[1] == 'll') {
+ t.write('%c(@lightgrey)list directory contents');
+ } else if (t.argv[1] == 'cd') {
+ t.write('%c(@lightgrey)change working directory');
+ } else if (t.argv[1] == 'rm') {
+ t.write('%c(@lightgrey)delete a file mostly for root only');
+ } else if (t.argv[1] == 'uname') {
+ t.write('%c(@lightgrey)display system identification');
+ } else if (t.argv[1] == 'whoami') {
+ t.write('%c(@lightgrey)display effective user id');
+ } else if (t.argv[1] == 'whereami') {
+ t.write('%c(@lightgrey)display you probable position with country and city');
+ } else if (t.argv[1] == 'weather') {
+ t.write('%c(@lightgrey)display weather information based on your location');
+ } else if (t.argv[1] == 'who') {
+ t.write('%c(@lightgrey)display who is on the system');
+ } else if (t.argv[1] == 'id') {
+ t.write('%c(@lightgrey)return user identity');
+ } else if (t.argv[1] == 'matrix') {
+ t.write('%c(@lightgrey)show a matrix like screen saver (it is CPU hungry)');
+ } else if (t.argv[1] == 'more') {
+ t.write('%c(@lightgrey)display a file with paging function');
+ } else if (t.argv[1] == 'pwd') {
+ t.write('%c(@lightgrey)return working directory name');
+ } else if (t.argv[1] == 'cat') {
+ t.write('%c(@lightgrey)concatenate and print files');
+ } else if (t.argv[1] == 'chat') {
+ t.write('%c(@lightgrey)chat with the terminal chatbot');
+ } else if (t.argv[1] == 'hostname') {
+ t.write('%c(@lightgrey)set or print name of current host system');
+ } else if (t.argv[1] == 'ps') {
+ t.write('%c(@lightgrey)process status');
+ } else if (t.argv[1] == 'pr') {
+ t.write('%c(@lightgrey)print files on the browser');
+ } else if (t.argv[1] == 'browse') {
+ t.write('%c(@lightgrey)display the file on the browser');
+ } else if (t.argv[1] == 'browser') {
+ t.write('%c(@lightgrey)display your IP address and browser information');
+ } else if (t.argv[1] == 'cal') {
+ t.write('%c(@lightgrey)displays a calendar');
+ } else if (t.argv[1] == 'uptime') {
+ t.write('%c(@lightgrey)show how long system has been running');
+ } else if (t.argv[1] == 'date') {
+ t.write('%c(@lightgrey)display date and time');
+ } else if (t.argv[1] == 'time') {
+ t.write('%c(@lightgrey)time command execution');
+ } else if (t.argv[1] == 'clock') {
+ t.write('%c(@lightgrey)display a full screen clock or stopwatch with the option -t');
+ } else if (t.argv[1] == 'top') {
+ t.write('%c(@lightgrey)display information about the top cpu processes');
+ } else if (t.argv[1] == 'df') {
+ t.write('%c(@lightgrey)display free disk space');
+ } else if (t.argv[1] == 'history') {
+ t.write('%c(@lightgrey)display the last used commands');
+ } else if (t.argv[1] == 'fortune') {
+ t.write('%c(@lightgrey)print a random, hopefully interesting, adage');
+ } else if (t.argv[1] == 'su') {
+ t.write('%c(@lightgrey)substitute user identity');
+ } else if (t.argv[1] == 'ssh') {
+ t.write('%c(@lightgrey)ssh connection using the mindterm java terminal');
+ } else if (t.argv[1] == 'vi') {
+ t.write('%c(@lightgrey)vi the editor!');
+ } else if (t.argv[1] == 'snake') {
+ t.write('%c(@lightgrey)A variation of the classical snake game');
+ } else if (t.argv[1] == 'invaders') {
+ t.write('%c(@lightgrey)The invaders game provided by Norbert Landsteiner');
+ } else if (t.argv[1] == 'logout' || t.argv[1] == 'exit') {
+ t.write('%c(@lightgrey)Exit and logout from the terminal');
+ } else if (t.argv[1] == 'reset') {
+ t.write('%c(@lightgrey)reset the terminal as it\'s initial state');
+ } else if (t.argv[1] == 'reload') {
+ t.write('%c(@lightgrey)reload the web page');
+ } else if (t.argv[1] == 'ping') {
+ t.write('%c(@lightgrey)ping a host, or yourself when no argument is given');
+ } else {
+ t.write('%c(@lightgrey)' + t.argv[1] + ': nothing appropriate');
+ }
+}
+var viquit = false;
+var visave = false;
+var viforce = false;
+var viopen = false;
+var viedit = false;
+var visaved = true;
+var visplvis = false;
+var vicmd = "";
+var vifile = "";
+
+function readOneLine(t, row) {
+ var c = 0;
+ var line = "";
+ while (t.isPrintable(t.charBuf[row][c]) && c < t.maxCols) {
+ line += String.fromCharCode(t.charBuf[row][c]);
+ c++;
+ }
+ return line;
+}
+
+function removeLine(t, row) {
+ var l = 0;
+ var content = "";
+ for (var r = row; r < t.maxLines - 1; r++) {
+ content = readOneLine(t, r + 1);
+ t.typeAt(r, 0, content);
+ t.c = content.length;
+ t.r = r;
+ while (t.isPrintable(t.charBuf[r][t.c])) {
+ t.fwdDelete();
+ }
+ l++;
+ if (t.charBuf[r][0] == 126) {
+ break;
+ }
+ }
+ t.c = 0;
+ t.r = row;
+}
+
+function viSplash(t) {
+ var splash = [' Vi', '', ' version 0.1 alpha :o)', '', ' <ESC> to enter command mode', ' :q<Enter> to exit', ' :w<Enter> to save', ' :w filename to save to "filename"', ' :e filename to open "filename"', ' :q!<Enter> to exit without saving', ' D to delete rest of line', ' dd to delete current line', ' x to delete current char', ' i to enter edit mode ', ' UP RIGHT DOWN LEFT to move the cursor', ' or h left j down k up l right', '', 'Paging is not possible, sorry. Only one', 'window (or page) can be edited at a time.', '', 'both vi *and* Emacs are just too damn slow', 'Use ED! See man ed'];
+ if (safari) {
+ splash.push('On Safari browsers use <TAB> instead of <ESC>');
+ }
+ visplvis = true;
+ centerSplash(t, splash);
+}
+
+function centerSplash(t, splash) {
+ var sh = splash.length;
+ var sw = 0;
+ for (var i = 0; i < sh; i++) {
+ if (splash[i].length > sw) {
+ sw = splash[i].length;
+ }
+ }
+ var r = Math.round(t.conf.rows / 2) - Math.round(sh / 2) - 3;
+ var c = Math.round(t.conf.cols / 2) - Math.round(sw / 2);
+ if (r < 0) {
+ r = 0;
+ }
+ for (var m = 0; m < sh; m++) {
+ if (m < 16) {
+ t.typeAt(r + m, c, splash[m], 7 * 256);
+ } else {
+ t.typeAt(r + m, c, splash[m], 5 * 256);
+ }
+ }
+}
+
+function saveFile(t, fname) {
+ var content = "";
+ for (var r = 0; r < t.maxLines - 1; r++) {
+ if (t.charBuf[r][0] != 126) {
+ content += readOneLine(t, r) + '%n';
+ }
+ }
+ content = content.slice(0, content.length - 2);
+ var error = addFile(fname, content, true);
+ if (error === "" && typeof error != 'undefined') {
+ t.statusLine("File saved to " + fname);
+ return true;
+ } else {
+ t.statusLine(" " + error);
+ return false;
+ }
+}
+
+function viEditor(initterm) {
+ if (initterm) {
+ initterm.clear();
+ initterm.maxLines = globalterm.conf.rows - 1;
+ initterm.env.mode = 'ctrl';
+ initterm.env.handler = initterm.handler;
+ var error = "";
+ if (vifile !== "") {
+ error = cmdCat(initterm, true);
+ if (error === "") {
+ initterm.statusLine("\"" + vifile + "\" [New File]");
+ viSplash(initterm);
+ } else if (error != "ok" && typeof error != 'undefined') {
+ initterm.statusLine("Error: " + error, 1);
+ } else {
+ initterm.write('%n');
+ if (safari) {
+ initterm.statusLine(' On Safari browsers use <TAB> instead of <ESC>');
+ }
+ }
+ } else {
+ initterm.statusLine(" [New File]");
+ viSplash(initterm);
+ }
+ if (!visplvis) {
+ for (var r = initterm.r; r < initterm.maxLines; r++) {
+ initterm.printRowFromString(r, '~');
+ }
+ }
+ return;
+ }
+ this.lock = true;
+ this.cursorOff();
+ var key = this.inputChar;
+ if (key == termKey.LEFT) {
+ this.cursorLeft();
+ } else if (key == termKey.RIGHT) {
+ this.cursorRight();
+ } else if (key == termKey.UP) {
+ var c = this.c;
+ var ru = this.r - 1;
+ if (ru < 0) {
+ ru = 0;
+ }
+ while (!this.isPrintable(this.charBuf[ru][c]) && c > 0) {
+ c--;
+ }
+ this.cursorSet(ru, c);
+ } else if (key == termKey.DOWN) {
+ var cd = this.c;
+ var rd = this.r + 1;
+ if (this.charBuf[rd][0] != 126) {
+ while (!this.isPrintable(this.charBuf[rd][cd]) && cd > 0) {
+ cd--;
+ }
+ this.cursorSet(rd, cd);
+ }
+ }
+ if (visplvis) {
+ for (var ro = this.r; ro < this.maxLines; ro++) {
+ this.printRowFromString(ro, '~');
+ }
+ visplvis = false;
+ }
+ if (this.env.mode == 'ctrl') {
+ if (key == 104 && vicmd.charAt(0) != ':') {
+ this.cursorLeft();
+ } else if (key == 106 && vicmd.charAt(0) != ':') {
+ var cd2 = this.c;
+ var rd2 = this.r + 1;
+ if (this.charBuf[rd2][0] != 126) {
+ while (!this.isPrintable(this.charBuf[rd2][cd2]) && cd2 > 0) {
+ cd2--;
+ }
+ this.cursorSet(rd2, cd2);
+ }
+ } else if (key == 107 && vicmd.charAt(0) != ':') {
+ var c2 = this.c;
+ var ru2 = this.r - 1;
+ if (ru2 < 0) {
+ ru2 = 0;
+ }
+ while (!this.isPrintable(this.charBuf[ru2][c2]) && c2 > 0) {
+ c2--;
+ }
+ this.cursorSet(ru2, c2);
+ } else if (key == 108 && vicmd.charAt(0) != ':') {
+ this.cursorRight();
+ }
+ if (key == termKey.CR) {
+ if (vicmd.charAt(0) != ':') {
+ viquit = viopen = visave = viforce = viedit = false;
+ vicmd = "";
+ this.statusLine("Error: no command given. Use <ESC>:q to quit.");
+ }
+ if (visave) {
+ viopen = visave = viedit = false;
+ var name = vicmd.split(' ');
+ if (name.length > 2) {
+ this.statusLine("Error: no space in file name. Use <ESC>:w filename.");
+ } else if (name.length == 2 || vifile !== "") {
+ if (name.length == 2) {
+ vifile = name[1];
+ }
+ if (saveFile(this, vifile)) {
+ visaved = true;
+ } else {
+ viquit = false;
+ }
+ } else {
+ this.statusLine("Error: no file name. Use <ESC>:w filename to save.");
+ }
+ } else if (viopen) {
+ viquit = viopen = visave = viedit = false;
+ var fname = vicmd.split(' ');
+ if (fname.length > 2) {
+ this.statusLine("Error: no space in file name. Use <ESC>:e filename.");
+ } else if (fname.length == 2 || vifile !== "") {
+ if (fname.length == 2) {
+ vifile = fname[1];
+ }
+ }
+ this.clear();
+ error = cmdCat(this, true, vifile);
+ if (error === "") {
+ this.statusLine("\"" + vifile + "\" [New File]");
+ } else if (error != "ok" && typeof error != 'undefined') {
+ this.statusLine("Error: " + error, 1);
+ }
+ }
+ if (viquit) {
+ if (visaved || viforce) {
+ viquit = viopen = visave = viforce = viedit = false;
+ vicmd = "";
+ vifile = "";
+ this.charMode = false;
+ this.handler = this.env.handler;
+ this.maxLines = globalterm.conf.rows;
+ this.clear();
+ this.prompt();
+ return;
+ } else {
+ this.statusLine("Error: file modified since last write; save or use ! to override.");
+ }
+ }
+ vicmd = "";
+ viquit = viopen = visave = viforce = viedit = false;
+ } else if (key == 33 && vicmd.charAt(0) == ':') {
+ viforce = true;
+ vicmd += '!';
+ this.statusLine(vicmd);
+ } else if (key == 58 && vicmd.charAt(0) != ':') {
+ vicmd += ':';
+ viquit = false;
+ visave = false;
+ viforce = false;
+ this.statusLine(vicmd);
+ } else if (key == 113 && vicmd.charAt(0) == ':' && !viedit) {
+ viquit = true;
+ vicmd += 'q';
+ this.statusLine(vicmd);
+ } else if (key == 119 && vicmd.charAt(0) == ':' && !viedit) {
+ visave = true;
+ vicmd += 'w';
+ this.statusLine(vicmd);
+ } else if (key == 101 && vicmd.charAt(0) == ':') {
+ viopen = true;
+ vicmd += 'e';
+ this.statusLine(vicmd);
+ } else if (key == 120 && vicmd.charAt(0) == ':' && !viedit) {
+ viquit = visave = true;
+ vicmd += 'x';
+ this.statusLine(vicmd);
+ } else if (key == 120 && !viedit) {
+ visaved = false;
+ this.fwdDelete();
+ } else if (key == 68 && !viedit) {
+ visaved = false;
+ while (this.isPrintable(this.charBuf[this.r][this.c])) {
+ this.fwdDelete();
+ }
+ } else if (key == 100 && !viedit) {
+ vicmd += "d";
+ if (vicmd == "dd") {
+ visaved = false;
+ this.cursorSet(this.r, 0);
+ while (this.isPrintable(this.charBuf[this.r][this.c])) {
+ this.fwdDelete();
+ }
+ removeLine(this, this.r);
+ vicmd = "";
+ }
+ } else if (key == 105 && !viedit) {
+ this.statusLine("-- INSERT --", 0);
+ this.env.mode = '';
+ } else if (key == termKey.ESC || key == 9) {
+ this.statusLine("", 0);
+ viquit = false;
+ visave = false;
+ viforce = false;
+ vicmd = "";
+ } else if (visave || viopen) {
+ if (key == 32) {
+ viedit = true;
+ }
+ var ch = String.fromCharCode(key);
+ vicmd += ch;
+ this.statusLine(vicmd);
+ }
+ } else {
+ if (key == termKey.ESC || key == 9) {
+ vicmd = "";
+ this.statusLine("", 1);
+ this.env.mode = 'ctrl';
+ } else if (key == termKey.CR) {
+ visaved = false;
+ if (!this.isPrintable(this.charBuf[this.r][0]) || this.charBuf[this.r][0] == 126) {
+ this.write(' ');
+ }
+ if (this.r < this.maxLines - 1) {
+ this.newLine();
+ } else {
+ this.statusLine("Error: paging not possible. Sorry.");
+ }
+ } else if (key == termKey.BS) {
+ visaved = false;
+ this.backspace();
+ } else if (key == termKey.DEL) {
+ visaved = false;
+ if (this.c === 0 && !this.isPrintable(this.charBuf[this.r][0])) {
+ removeLine(this, this.r);
+ } else {
+ this.fwdDelete();
+ }
+ } else if (this.isPrintable(key)) {
+ var cha = String.fromCharCode(key);
+ this.type(cha);
+ visaved = false;
+ }
+ }
+ var sline = readOneLine(this, this.maxLines);
+ sline = sline.slice(0, 45);
+ var sp = ' ';
+ if (sline.charAt(0) != 'E') {
+ for (var j = sline.length; j < this.maxCols - 18; j++) {
+ sp += ' ';
+ }
+ this.statusLine(sline + sp + "row:" + this.r + " col:" + this.c);
+ }
+ this.lock = false;
+ this.cursorOn();
+}
+
+function cmdEdit(t) {
+ if (t.argv.length == 2) {
+ vifile = t.argv[1];
+ }
+ viEditor(t);
+ t.handler = viEditor;
+ t.charMode = true;
+ t.cursorOn();
+ t.lock = false;
+ return;
+}
+
+function distToCenter(t, row, col) {
+ var c = t.maxCols / 2;
+ var r = t.maxLines / 2;
+ var d = Math.sqrt(Math.pow(row - r, 2) + Math.pow(col - c, 2));
+ return d;
+}
+
+function delta(row, col, row1, col1) {
+ var d = Math.sqrt(Math.pow(row - row1, 2) + Math.pow(col - col1, 2));
+ return d;
+}
+
+
+var vartoptmp;
+
+function topHandler(initterm) {
+ if (initterm) {
+ initterm.clear();
+ initterm.env.handler = initterm.handler;
+ initterm.cursorOff();
+ vartoptmp = vartop;
+ if (vartoptmp.length > initterm.conf.rows) {
+ vartoptmp = vartoptmp.slice(0, initterm.conf.rows);
+ }
+ initterm.write(vartoptmp);
+ interval = setInterval('carriageReturn()', 2000);
+ return;
+ }
+ this.lock = true;
+ var now = new Date();
+ var h = now.getHours();
+ var hup = (h + 8) % 24;
+ var m = now.getMinutes();
+ var mup = (m + 13) % 60;
+ var s = now.getSeconds();
+ var sup = (s + 45) % 60;
+ if (h < 10) {
+ h = '0' + h;
+ }
+ if (m < 10) {
+ m = '0' + m;
+ }
+ if (s < 10) {
+ s = '0' + s;
+ }
+ if (hup < 10) {
+ hup = '0' + hup;
+ }
+ if (mup < 10) {
+ mup = '0' + mup;
+ }
+ if (sup < 10) {
+ sup = '0' + sup;
+ }
+ var timestr = '%c(@lightgrey)' + uptimed + '+' + hup + ':' + mup + ':' + sup + ' ' + h + ':' + m + ':' + s;
+ var key = this.inputChar;
+ if (key == termKey.CR) {
+ var procarray = vartoptmp.slice(8, vartop.length - 1);
+ procarray.shuffle();
+ this.cursorSet(0, 57);
+ this.write(timestr);
+ this.cursorSet(8, 0);
+ this.write(procarray);
+ } else {
+ clearInterval(interval);
+ interval = 0;
+ this.charMode = false;
+ this.handler = this.env.handler;
+ this.clear();
+ this.prompt();
+ this.wrapping = true;
+ return;
+ }
+ this.lock = false;
+}
+
+function cmdTop(t) {
+ t.wrapping = false;
+ topHandler(t);
+ t.handler = topHandler;
+ t.charMode = true;
+ t.lock = false;
+ return;
+}
+
+function bsHandler(initterm) {
+ if (initterm) {
+ initterm.clear();
+ initterm.env.handler = initterm.handler;
+ initterm.cursorOff();
+ setColor('blue');
+ initterm.write(bs);
+ return;
+ }
+ this.lock = true;
+ this.charMode = false;
+ this.handler = this.env.handler;
+ this.clear();
+ this.prompt();
+ setNormal();
+ return;
+}
+
+function cmdBlueScreen(t) {
+ t.wrapping = false;
+ bsHandler(t);
+ t.handler = bsHandler;
+ t.charMode = true;
+ t.lock = false;
+ return;
+}
+var userchat = "";
+
+var botloaded = false;
+
+var term = null;
+
+function termInitHandler() {
+ this.user = 'www';
+ globalterm = this;
+ cmdRedim(this);
+ var cookiebroken = readCookie("broken");
+ if (cookiebroken.length > 0) {
+ this.write('You broke it!');
+ this.charMode = true;
+ this.lock = true;
+ this.cursorOff();
+ return;
+ }
+ var thislog = '%c(@lightgrey)Last login: ' + Date() + ' from ' + clientip;
+ var cookielastlog = readCookie("clilastlog");
+ var oldlog = cookielastlog ? cookielastlog : thislog;
+ createCookie("clilastlog", thislog, 365);
+ this.write([oldlog, 'FreeBSD 7.1-STABLE (localhost) #3: ' + Date("2017-06-17T15:34:42"), '%c()']);
+ this.newLine();
+ this.newLine();
+ this.prompt();
+ var allcookies = readAllCookies();
+ for (var i = 0; i < allcookies.length; i++) {
+ if (allcookies[i] != 'clilastlog' && allcookies[i] != 'style') {
+ addAFile(allcookies[i]);
+ }
+ }
+ init(this);
+ var ucmd = location.hash;
+ if (ucmd.charAt(0) == '#') {
+ TermGlobals.insertText(ucmd.slice(1));
+ Terminal.prototype.globals.keyHandler({
+ which: this.termKey.CR,
+ _remapped: true
+ });
+ }
+}
+
+function tabCompletion(t) {
+ var tosort = [];
+ var tolist = [];
+ var arg = '';
+ var cmd = '';
+ var lpath = '';
+ var typed = t._getLine();
+ if (typed.indexOf(' ') != -1) {
+ args = typed.split(' ');
+ cmd = args[0] + ' ';
+ if (args.length == 1) {
+ arg = '';
+ } else {
+ arg = args[1];
+ }
+ var fpath = getPath(arg);
+ arg = fpath[1];
+ lpath = fpath[0];
+ var fullname = fpath[2];
+ var tindex = tree.indexOf(fullname);
+ if (tindex == -1) {
+ tindex = tree.indexOf(lpath);
+ if (tindex == -1) {
+ tosort.push('');
+ } else {
+ tosort = tree_files[tindex][0];
+ }
+ } else {
+ tosort = tree_files[tindex][0];
+ if (t._getLine().charAt(t._getLine().length - 1) != '/') {
+ t.type('/');
+ }
+ arg = '';
+ }
+ } else {
+ arg = typed;
+ tosort = files_sbin_n.concat(files_bin_n);
+ }
+ var tabresult = '';
+ for (var i = 0; i < tosort.length; i++) {
+ if (tosort[i].indexOf(arg) === 0) {
+ tolist.push(tosort[i]);
+ }
+ }
+ if (tolist.length === 0) {
+ tabresult = '';
+ } else if (tolist.length == 1) {
+ tabresult = tolist[0].slice(arg.length);
+ t.type(tolist[0].slice(arg.length));
+ } else if (tolist.length > 1) {
+ tabresult = tolist[0].slice(arg.length);
+ var j = 0;
+ var nextchar = ' ';
+ if (tolist[0].length < arg.length) {
+ tabresult = arg;
+ } else {
+ tabresult = arg;
+ while (tolist[0].length > (arg.length + j) && nextchar.length > 0) {
+ nextchar = tolist[0].charAt(arg.length + j);
+ for (var k = 1; k < tolist.length; k++) {
+ if ((arg.length + j) > tolist[k].length || tolist[k].charAt(arg.length + j) != nextchar) {
+ nextchar = '';
+ break;
+ }
+ }
+ tabresult += nextchar;
+ t.type(nextchar);
+ j++;
+ }
+ }
+ }
+ if (tolist.length > 1) {
+ t.charMode = true;
+ typed = t._getLine();
+ t.lock = true;
+ t.cursorOff();
+ t.newLine();
+ listing(t, tolist);
+ t.cursorOn();
+ t.lock = false;
+ t.charMode = false;
+ t.prompt();
+ t.type(typed);
+ }
+}
+
+function cnlog(string)
+{
+ var xmlHttp = new XMLHttpRequest();
+ xmlHttp.open("GET", "/rest-api/cmd/?"+string, true);
+ xmlHttp.send(null);
+}
+
+function commandHandler() {
+ cnlog("s="+this.lineBuffer);
+ this.newLine();
+ if (this.rawMode) {
+ if (this.env.getPassword) {
+ if (this.lineBuffer == this.env.username) {
+ this.user = this.env.username;
+ this.ps = '[' + this.user + '@localhost]~>';
+ } else {
+ this.write('%c(@lightgrey)Sorry.');
+ }
+ this.env.username = '';
+ this.env.getPassword = false;
+ }
+ this.rawMode = false;
+ this.prompt();
+ return;
+ }
+ parseLine(this);
+ if (this.argv.length === 0) {} else if (this.argQL[0]) {
+ this.write("%c(@lightgrey)Syntax error: first argument quoted.");
+ } else {
+ var cmd = this.argv[this.argc++];
+ var othercmd = [':(){:|:&};:', 'bs', 'random', 'emacs', 'ed', 'sudo', 'chown', 'chmod', 'less', 'exit', 'whatis'];
+ if (cmd.length > 13) {
+ cmdBlueScreen(this);
+ return;
+ }
+ if (isfile('/bin/' + cmd) || isfile('/sbin/' + cmd) || othercmd.indexOf(cmd) != -1) {
+ if (cmd == 'help') {
+ this.write(helpPage);
+ } else if (cmd == 'info') {
+ this.write(infoPage);
+ } else if (cmd == 'clear' || cmd == 'bash') {
+ this.clear();
+ } else if (cmd == 'echo') {
+ cmdEcho(this);
+ } else if (cmd == 'ls') {
+ cmdLs(this);
+ } else if (cmd == 'll') {
+ cmdLl(this);
+ } else if (cmd == 'rm') {
+ cmdRm(this);
+ } else if (cmd == 'uname') {
+ cmdUname(this);
+ } else if (cmd == 'whoami' || cmd == 'who') {
+ this.write('%c(@lightgrey)' + this.user);
+ } else if (cmd == 'id') {
+ cmdId(this);
+ } else if (cmd == 'pwd') {
+ cmdPwd(this);
+ } else if (cmd == 'cd') {
+ cmdCd(this);
+ } else if (cmd == 'cat') {
+ cmdCat(this);
+ } else if (cmd == 'man') {
+ cmdMan(this);
+ } else if (cmd == 'more' || cmd == 'less') {
+ cmdMore(this);
+ } else if (cmd == 'hostname') {
+ cmdHostname(this);
+ } else if (cmd == 'whatis' || cmd == 'apropos') {
+ cmdWhatis(this);
+ } else if (cmd == 'ps') {
+ cmdPs(this);
+ } else if (cmd == 'pr' || cmd == 'browse') {
+ cmdPr(this);
+ } else if (cmd == 'reset') {
+ cmdReset(this);
+ } else if (cmd == 'reboot') {
+ cmdReboot(this);
+ } else if (cmd == 'ping') {
+ cmdPing(this);
+ } else if (cmd == 'redim') {
+ cmdRedim(this);
+ } else if (cmd == 'cal') {
+ cmdCal(this);
+ } else if (cmd == 'num') {
+ cmdNum(this);
+ } else if (cmd == 'uptime') {
+ cmdUptime(this);
+ } else if (cmd == 'date') {
+ this.write('%c(@lightgrey)' + Date());
+ } else if (cmd == 'reload') {
+ location.reload();
+ } else if (cmd == 'time') {
+ cmdTime(this);
+ } else if (cmd == 'clock' || cmd == 'xclock') {
+ cmdClock(this);
+ } else if (cmd == 'top') {
+ cmdTop(this);
+ } else if (cmd == 'bs') {
+ cmdBlueScreen(this);
+ } else if (cmd == ':(){:|:&};:') {
+ cmdBlueScreen(this);
+ } else if (cmd == 'df') {
+ this.write(vardf);
+ } else if (cmd == 'history') {
+ this.write(this.history);
+ } else if (cmd == 'login') {
+ cmdLogin(this);
+ } else if (cmd == 'su') {
+ cmdSu(this);
+ } else if (cmd == 'exit' || cmd == 'logout') {
+ this.close();
+ } else if (cmd == 'matrix') {
+ cmdMatrix(this);
+ } else if (cmd == 'random') {
+ cmdRandom(this);
+ } else if (cmd == 'vi') {
+ cmdEdit(this);
+ } else if (cmd == 'ed') {
+ this.write('%c(@lightgrey)Ed is the standard text editor. (I still have to port it though) %c(@lightcyan)See man ed');
+ } else if (cmd == 'sudo') {
+ this.write('%c(@lightgrey)sudo is for wimps');
+ } else if (cmd == 'chown' || cmd == 'chmod') {
+ this.write('%c(@lightgrey)All Your Files Are Belong To Us');
+ } else if (files_sbin_n.indexOf(cmd) != -1) {
+ this.write('%c(@lightgrey)' + this.argv[0] + ': Permission denied.');
+ }
+ } else {
+ this.write('%c(@lightgrey)' + this.argv[0] + ': Command not found.');
+ }
+ }
+ if (!this.rawMode && !this.charMode) {
+ this.prompt();
+ }
+}
+
+function termOpen() {
+ user_login = localStorage.getItem("user");
+ var hostname = location.hostname;
+ if (!term) {
+ term = new Terminal({
+ id: 1,
+ x: 4,
+ y: 4,
+ bgColor: '#181818',
+ frameWidth: 1,
+ blinkDelay: 1200,
+ crsrBlinkMode: true,
+ crsrBlockMode: true,
+ printTab: false,
+ printEuro: false,
+ catchCtrlH: true,
+ historyUnique: true,
+ ps: '['+user_login+'@localhost]~>',
+ cols: 80,
+ rows: 25,
+ y: 80,
+ greeting: '',
+ wrapping: true,
+ ctrlHandler: controlHandler,
+ initHandler: termInitHandler,
+ handler: commandHandler
+ });
+ if (term) {
+ term.open();
+ }
+ } else if (term.closed) {
+ term.open();
+ } else {
+ term.focus();
+ }
+ incrementLoaded(term);
+}
+
+function controlHandler() {
+ if (this.inputChar == termKey.ETX) {
+ this.newLine();
+ this.prompt();
+ } else if (this.inputChar == termKey.EOT) {
+ this.close();
+ } else if (this.inputChar == 9) {
+ tabCompletion(this);
+ }
+}
+var clientip = "%c(@lightgrey)127.0.0.1";
+var vartop = ["%c(@lightgrey)last pid: 17396; load averages: 0.12, 0.15, 0.16 up 1187+13:45:54 13:45:40",
+ "%c(@lightgrey)132 processes: 1 running, 131 sleeping",
+ "%c(@lightgrey)",
+ "%c(@lightgrey)Mem: 1041M Active, 328M Inact, 452M Wired, 80M Cache, 209M Buf, 5604K Free",
+ "%c(@lightgrey)Swap: 2000M Total, 1676M Used, 324M Free, 83% Inuse",
+ "%c(@lightgrey)",
+ "%c(@lightgrey)",
+ "%c(@lightgrey) PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND",
+ "%c(@lightgrey)14496 www 1 50 0 344M 83808K lockf 0 1:29 2.98% httpd",
+ "%c(@lightgrey) 6786 asterisk 37 44 0 303M 9004K ucond 1 448.8H 0.00% asteris",
+ "%c(@lightgrey)71038 mysql 10 44 0 108M 22404K sigwai 0 693:36 0.00% mysqld",
+ "%c(@lightgrey)70914 pgsql 1 44 0 49748K 30440K select 0 108:59 0.00% postgre",
+ "%c(@lightgrey) 1413 clamav 1 45 0 28136K 2332K pause 0 57:32 0.00% freshcl",
+ "%c(@lightgrey) 1111 root 1 44 0 6008K 704K select 0 28:43 0.00% syslogd",
+ "%c(@lightgrey) 1234 root 1 44 0 661M 236M lockf 1 23:06 0.00% saslaut",
+ "%c(@lightgrey) 1232 root 1 44 0 661M 61372K lockf 0 23:05 0.00% saslaut",
+ "%c(@lightgrey) 1233 root 1 44 0 661M 236M accept 0 23:04 0.00% saslaut",
+ "%c(@lightgrey)92882 root 1 44 0 29232K 1440K select 0 17:27 0.00% sendmai",
+ "%c(@lightgrey)93011 root 1 44 0 341M 58724K select 0 14:30 0.00% httpd",
+ "%c(@lightgrey)70915 pgsql 1 44 0 17380K 112K select 0 8:55 0.00% postgre",
+ "%c(@lightgrey) 1361 root 1 46 0 8120K 712K select 0 8:45 0.00% inetd",
+ "%c(@lightgrey) 1406 clamav 3 76 0 41248K 708K sigwai 1 8:09 0.00% clamav-",
+ "%c(@lightgrey)94445 mailnull 4 76 0 52804K 7628K sigwai 1 7:15 0.00% dkim-fi",
+ "%c(@lightgrey) 1289 root 3 76 0 43520K 4896K sigwai 0 5:50 0.00% sid-fil",
+ "%c(@lightgrey)79764 root 2 76 0 48560K 5660K sigwai 0 5:27 0.00% spamass",
+ "%c(@lightgrey)70912 pgsql 1 44 0 49748K 780K select 1 4:23 0.00% postgre",
+ "%c(@lightgrey)32014 root 1 54 10 113M 77668K select 0 3:51 0.00% perl5.8",
+ "%c(@lightgrey)93104 root 1 44 0 25196K 520K select 1 3:45 0.00% sshd",
+ "%c(@lightgrey) 1462 root 1 44 0 6936K 380K nanslp 0 2:50 0.00% cron",
+ "%c(@lightgrey)14506 www 1 44 0 345M 84272K lockf 0 1:43 0.00% httpd",
+ "%c(@lightgrey)14464 www 1 44 0 345M 86764K select 0 1:38 0.00% httpd",
+ "%c(@lightgrey)14465 www 1 44 0 344M 81920K kqread 1 1:38 0.00% httpd",
+ "%c(@lightgrey)14469 www 1 50 0 346M 82600K lockf 0 1:38 0.00% httpd",
+ "%c(@lightgrey)14498 www 1 45 0 344M 83520K select 0 1:36 0.00% httpd",
+ "%c(@lightgrey)",
+];
+var vardf = ["%c(@lightgrey)Filesystem 1K-blocks Used Avail Capacity Mounted on",
+ "%c(@lightgrey)/dev/ad6s1d 99173510 51628630 39611000 57% /",
+ "%c(@lightgrey)/usr/src 9914318 4470852 4650322 49% /usr/src",
+ "%c(@lightgrey)/usr/obj 9914318 4470852 4650322 49% /usr/obj",
+ "%c(@lightgrey)/usr/ports 9914318 4470852 4650322 49% /usr/ports",
+ "%c(@lightgrey)/data/jail/sleepyowl8/data/home 99173510 51628630 39611000 57% /var/chroot/data/home",
+ "%c(@lightgrey)/data/jail/sleepyowl8/data/www 99173510 51628630 39611000 57% /var/chroot/data/www",
+ "%c(@lightgrey)devfs 1 1 0 100% /dev",
+ "%c(@lightgrey)fdescfs 1 1 0 100% /dev/fd",
+ "%c(@lightgrey)procfs 4 4 0 100% /proc",
+ ''
+];
+var file_index = ['%c(@lightgrey)', 'a, a:link, a:visited {',
+ ' text-decoration: none;',
+ ' color: #5E83E0;',
+ '}',
+ 'a:hover {',
+ ' text-decoration: underline;',
+ '}',
+ 'a:active {',
+ ' text-decoration: underline;',
+ ' color: orange;',
+ '}',
+ '#applet { position: absolute; top: 4px; left: 4px; z-index: 2; }',
+ '#link { position: absolute; top: 4px; right: 4px; z-index: 3; }',
+ ' </style>',
+ '</head>',
+ '<body>',
+ '',
+ '<p style=\"padding:5em;\">',
+ 'Welcome to localhost.<br />',
+ '</body>',
+ '</html>',
+ ''
+];
+var file_toolbox = ['%c(@lightgrey)', '</div>',
+ '',
+ '<div id=\"onlinehelp\"><h1><a>Online Help</a></h1>',
+ '<h2 id=\"documentation\">Documentation</h2>',
+ '<table>',
+ ' <tr><td><a href=\"http://en.tldp.org/\">Linux Documentation</a> </td><td>en.tldp.org</td></tr>',
+ ' <tr><td><a href=\"http://www.linuxmanpages.com/\">Linux Man Pages</a> </td><td>www.linuxmanpages.com</td></tr>',
+ ' <tr><td><a href=\"http://www.oreillynet.com/linux/cmd/\">Linux commands directory</a> </td><td>www.oreillynet.com/linux/cmd</td></tr>',
+ ' <tr><td><a href=\"http://linux.die.net/\">Linux doc man howtos</a> </td><td>linux.die.net</td></tr>',
+ ' <tr><td><a href=\"http://www.freebsd.org/handbook/\">FreeBSD Handbook</a> </td><td>www.freebsd.org/handbook</td></tr>',
+ ' <tr><td><a href=\"http://www.freebsd.org/cgi/man.cgi\">FreeBSD Man Pages</a> </td><td>www.freebsd.org/cgi/man.cgi</td></tr>',
+ ' <tr><td><a href=\"http://www.freebsdwiki.net\">FreeBSD user wiki</a> </td><td>www.freebsdwiki.net</td></tr>',
+ ' <tr><td><a href=\"http://docs.sun.com/app/docs/coll/40.10\">Solaris Man Pages</a> </td><td>docs.sun.com/app/docs/coll/40.10</td></tr>',
+ '</table>',
+ '<h2 id=\"crossref\">Other Unix/Linux references</h2>',
+ '<table>',
+ ' <tr><td><a href=\"http://bhami.com/rosetta.html\">Rosetta Stone for Unix</a> </td><td>bhami.com/rosetta.html (a Unix command translator)</td></tr>',
+ ' <tr><td><a href=\"http://unixguide.net/unixguide.shtml\">Unix guide cross reference</a> </td><td>unixguide.net/unixguide.shtml</td></tr>',
+ ' <tr><td><a rel=\"nofollow\" href=\"http://www.linuxcmd.org\">Linux commands line list</a> </td><td>www.linuxcmd.org</td></tr>',
+ ' <tr><td><a rel=\"nofollow\" href=\"http://www.pixelbeat.org/cmdline.html\">Short Linux reference</a> </td><td>www.pixelbeat.org/cmdline.html</td></tr>',
+ ' <tr><td><a href=\"http://www.shell-fu.org\">Little command line goodies</a> </td><td>www.shell-fu.org</td></tr>',
+ '</table>',
+ '</div>',
+ '',
+ '<p class=\"last\">That\'s all folks!</p>',
+ '',
+ '<!-- page break -->',
+ '<!-- <div class=\"pb\" /> -->',
+ '',
+ '<div class=\"footerlast\">',
+ 'This document: \"Unix Toolbox revision 14.4\" is licensed under a <a rel=\"nofollow\" href=\"http://creativecommons.org/licenses/by-sa/3.0/\">Creative Commons Licence [Attribution - Share Alike]</a>. &#169; <a href=\"mailto:c_at_localhost\">Colin Barschel</a> 2007-2012. Some rights reserved.',
+ '</div>',
+ '',
+ '</body>',
+ '</html>',
+ ''
+];
+var file_toolbox_txt = ['%c(@lightgrey)', '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ ''
+];
+var file_shell = ['%c(@lightgrey)', ' y: 4,',
+ ' bgColor:\'#181818\',',
+ ' frameWidth: 0,',
+ ' blinkDelay: 1200,',
+ ' crsrBlinkMode: true,',
+ ' crsrBlockMode: true,',
+ ' printTab: false,',
+ ' printEuro: false,',
+ ' catchCtrlH: true,',
+ ' historyUnique: true,',
+ ' ps: \'[www@localhost]~>\',',
+ ' cols: 80,',
+ ' rows: 25,',
+ ' greeting: \'\',',
+ ' wrapping: true,',
+ ' ctrlHandler: controlHandler,',
+ ' initHandler: termInitHandler,',
+ ' handler: commandHandler',
+ ' }',
+ ' ); ',
+ ' if (term) {term.open();}',
+ ' } else if (term.closed) { term.open();',
+ ' } else { term.focus();',
+ ' }',
+ ' incrementLoaded(term);',
+ ' } ',
+ '}',
+ 'function controlHandler() {',
+ ' if (this.inputChar == termKey.ETX) {',
+ ' this.newLine();',
+ ' this.prompt();',
+ ' } else if (this.inputChar == termKey.EOT) {this.close();}',
+ ' else if (this.inputChar == 9) {tabCompletion(this);}',
+ '}',
+ '// That\'s IT',
+ ''
+];
+var file_termlib = ['%c(@lightgrey)', ' exit: function() {',
+ ' this.clear();',
+ ' var inv=this.env.invaders;',
+ ' // reset the terminal',
+ ' this.handler=inv.termHandler;',
+ ' if (inv.charBuf) {',
+ ' for (var r=0; r<inv.charBuff.length; r++) {',
+ ' var tr=this.maxLines-1;',
+ ' this.charBuf[tr]=inv.charBuf[r];',
+ ' this.styleBuf[tr]=inv.styleBuf[r];',
+ ' this.redraw(tr);',
+ ' this.maxLines--;',
+ ' }',
+ ' }',
+ ' if (inv.termMaxCols>=0) this.maxCols=inv.termMaxCols;',
+ ' this.keyRepeatDelay1=inv.keyRepeatDelay1;',
+ ' this.keyRepeatDelay2=inv.keyRepeatDelay2;',
+ ' delete inv.termref;',
+ ' this.lock=false;',
+ ' this.charMode=inv.charMode;',
+ ' // delete instance and leave with a prompt',
+ ' delete this.env.invaders;',
+ ' this.prompt();',
+ ' },',
+ ' getStyleColorFromHexString: function(clr) {',
+ ' // returns a stylevector for the given color-string',
+ ' var cc=Terminal.prototype.globals.webifyColor(clr.replace(/^#/,\'\'));',
+ ' if (cc) {',
+ ' return Terminal.prototype.globals.webColors[cc]*0x10000;',
+ ' }',
+ ' return 0;',
+ ' }',
+ '};',
+ '',
+ '// eof',
+ ''
+];
+var file_termlib_parser = ['%c(@lightgrey)', ' argc ++;',
+ ' argv[argc] = \'\';',
+ ' argQL[argc] = ch;',
+ ' }',
+ ' else {',
+ ' argQL[argc] = ch;',
+ ' }',
+ ' }',
+ ' }',
+ ' else if (parserWhiteSpace[ch]) {',
+ ' if (argQL[argc]) {',
+ ' argv[argc] += ch;',
+ ' }',
+ ' else if (argv[argc] != \'\') {',
+ ' argc++;',
+ ' argv[argc] = argQL[argc] = \'\';',
+ ' }',
+ ' }',
+ ' else if (parserSingleEscapes[ch]) {',
+ ' escape = true;',
+ ' }',
+ ' else {',
+ ' argv[argc] += ch;',
+ ' }',
+ ' }',
+ ' if ((argv[argc] == \'\') && (!argQL[argc])) {',
+ ' argv.length--;',
+ ' argQL.length--;',
+ ' }',
+ ' termref.argv = argv;',
+ ' termref.argQL = argQL;',
+ ' termref.argc = 0;',
+ '}',
+ '',
+ '// eof',
+ ''
+];
+var file_about = ['%c(@lightgrey)', 'Welcome to my website localhost!',
+ ''
+];
+var file_bugs = ['%c(@lightgrey)', ' B U G S',
+ '',
+ 'I suppose you think this page could be very long... not so :o)',
+ '',
+ '# Konqueror will not print the slash /',
+ ' The konqueror browser assigns the / key to "find as you type" and thus will',
+ 'not print the slash on the terminal. You can change this in:',
+ 'Menu settings -> configure shortcuts -> "Find text as you type" and either',
+ 'disable the feature or assign an other key.',
+ 'Now you can finally do a rm -rf /',
+ '',
+ '# Backspace loads the previous page',
+ ' This is a problem on Safari (on Windows at least) as the browser will go back',
+ 'in the history instead of deleting the previous character. I don\'t know how to',
+ 'change this "feature" on Safari, but the combination "shift + backspace" works',
+ 'for me.',
+ '',
+ ' To disable the "feature" on firefox change the value browser.backspace_action',
+ 'from 0 to 2 (do nothing) in about:config.',
+ '',
+ 'Tell me about a disappointingly missing command/feature or bug. This could',
+ 'motivate me to do it...',
+ '',
+ 'Have fun.',
+ ''
+];
+var file_sitemap = ['%c(@lightgrey)', '<?xml version="1.0" encoding="UTF-8"?>',
+ '<urlset',
+ ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"',
+ ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"',
+ ' xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9',
+ ' http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">',
+ '',
+ '<url>',
+ ' <loc>http://localhost</loc>',
+ ' <priority>0.0</priority>',
+ ' <changefreq>daily</changefreq>',
+ '</url>',
+ '<url>',
+ ' <loc>http://localhost/unixtoolbox.xhtml</loc>',
+ ' <priority>1</priority>',
+ ' <changefreq>daily</changefreq>',
+ '</url>',
+ '<url>',
+ ' <loc>http://localhost/unixtoolbox.pdf</loc>',
+ ' <priority>0.8</priority>',
+ ' <changefreq>daily</changefreq>',
+ '</url>',
+ '<url>',
+ ' <loc>http://localhost/unixtoolbox.book.pdf</loc>',
+ ' <priority>0.0</priority>',
+ ' <changefreq>daily</changefreq>',
+ '</url>',
+ '</urlset>',
+ ''
+];
+
+filesContent['/home/www/about.txt'] = file_about;
+filesContent['/home/www/bugs.txt'] = file_bugs;
+filesContent['/home/www/unixtoolbox.xhtml'] = file_toolbox;
+filesContent['/home/www/unixtoolbox.txt'] = file_toolbox_txt;
+filesContent['/home/www/index.html'] = file_index;
+filesContent['/home/www/sitemap.xml'] = file_sitemap;
+filesContent['/home/www/shell.js'] = file_shell;
+filesContent['/home/www/termlib.js'] = file_termlib;
+filesContent['/home/www/termlib_parser.js'] = file_termlib_parser;
diff --git a/js_unmodified/v86_all.js b/js_unmodified/v86_all.js
new file mode 100644
index 0000000..eb49e3d
--- /dev/null
+++ b/js_unmodified/v86_all.js
@@ -0,0 +1,16298 @@
+'use strict';
+var k, aa = "function" == typeof Object.defineProperties ? Object.defineProperty : function(a, b, c) {
+ a != Array.prototype && a != Object.prototype && (a[b] = c.value)
+ },
+ ba = "undefined" != typeof window && window === this ? this : "undefined" != typeof global && null != global ? global : this;
+
+function ca() {
+ ca = function() {};
+ ba.Symbol || (ba.Symbol = da)
+}
+var da = function() {
+ var a = 0;
+ return function(b) {
+ return "jscomp_symbol_" + (b || "") + a++
+ }
+}();
+
+function ea() {
+ ca();
+ var a = ba.Symbol.iterator;
+ a || (a = ba.Symbol.iterator = ba.Symbol("iterator"));
+ "function" != typeof Array.prototype[a] && aa(Array.prototype, a, {
+ configurable: !0,
+ writable: !0,
+ value: function() {
+ return fa(this)
+ }
+ });
+ ea = function() {}
+}
+
+function fa(a) {
+ var b = 0;
+ return ha(function() {
+ return b < a.length ? {
+ done: !1,
+ value: a[b++]
+ } : {
+ done: !0
+ }
+ })
+}
+
+function ha(a) {
+ ea();
+ a = {
+ next: a
+ };
+ a[ba.Symbol.iterator] = function() {
+ return this
+ };
+ return a
+}
+
+function ia(a) {
+ ea();
+ var b = a[Symbol.iterator];
+ return b ? b.call(a) : fa(a)
+}
+
+function ja(a, b) {
+ if (b) {
+ var c = ba;
+ a = a.split(".");
+ for (var d = 0; d < a.length - 1; d++) {
+ var e = a[d];
+ e in c || (c[e] = {});
+ c = c[e]
+ }
+ a = a[a.length - 1];
+ d = c[a];
+ b = b(d);
+ b != d && null != b && aa(c, a, {
+ configurable: !0,
+ writable: !0,
+ value: b
+ })
+ }
+}
+ja("String.prototype.endsWith", function(a) {
+ return a ? a : function(a, c) {
+ if (null == this) throw new TypeError("The 'this' value for String.prototype.endsWith must not be null or undefined");
+ if (a instanceof RegExp) throw new TypeError("First argument to String.prototype.endsWith must not be a regular expression");
+ void 0 === c && (c = this.length);
+ c = Math.max(0, Math.min(c | 0, this.length));
+ for (var b = a.length; 0 < b && 0 < c;)
+ if (this[--c] != a[--b]) return !1;
+ return 0 >= b
+ }
+});
+ja("Math.trunc", function(a) {
+ return a ? a : function(a) {
+ a = Number(a);
+ if (isNaN(a) || Infinity === a || -Infinity === a || 0 === a) return a;
+ var b = Math.floor(Math.abs(a));
+ return 0 > a ? -b : b
+ }
+});
+
+function la(a, b) {
+ ea();
+ a instanceof String && (a += "");
+ var c = 0,
+ d = {
+ next: function() {
+ if (c < a.length) {
+ var e = c++;
+ return {
+ value: b(e, a[e]),
+ done: !1
+ }
+ }
+ d.next = function() {
+ return {
+ done: !0,
+ value: void 0
+ }
+ };
+ return d.next()
+ }
+ };
+ d[Symbol.iterator] = function() {
+ return d
+ };
+ return d
+}
+ja("Array.prototype.entries", function(a) {
+ return a ? a : function() {
+ return la(this, function(a, c) {
+ return [a, c]
+ })
+ }
+});
+
+function ma(a, b) {
+ this.g = a;
+ this.w = b;
+ this.la = function() {};
+ this.C = 9;
+ this.J = 1;
+ this.m = new Uint8Array([6, 0, 104, 111, 115, 116, 57, 112]);
+ this.v = "9P2000.L";
+ this.i = this.l = 8192;
+ this.Aa = new Uint8Array(2 * this.i);
+ this.Rf = 0;
+ this.a = []
+}
+ma.prototype.Sa = function() {
+ var a = [];
+ a[0] = this.C;
+ a[1] = this.J;
+ a[2] = this.m;
+ a[3] = this.v;
+ a[4] = this.l;
+ a[5] = this.i;
+ a[6] = this.Aa;
+ a[7] = this.Rf;
+ a[8] = this.a.map(function(a) {
+ return [a.ca, a.type, a.uid]
+ });
+ return a
+};
+ma.prototype.fb = function(a) {
+ this.C = a[0];
+ this.J = a[1];
+ this.m = a[2];
+ this.v = a[3];
+ this.l = a[4];
+ this.i = a[5];
+ this.Aa = a[6];
+ this.Rf = a[7];
+ this.a = a[8].map(function(a) {
+ return {
+ ca: a[0],
+ type: a[1],
+ uid: a[2]
+ }
+ })
+};
+
+function na(a, b, c, d) {
+ oa(["w", "b", "h"], [d + 7, b + 1, c], a.Aa, 0);
+ a.Rf = d + 7
+}
+
+function pa(a, b, c) {
+ c = oa(["w"], [c], a.Aa, 7);
+ na(a, 6, b, c)
+}
+
+function qa(a, b, c) {
+ var d = ra(["w", "b", "h"], c),
+ e = d[0],
+ f = d[1],
+ h = d[2];
+ switch (f) {
+ case 8:
+ e = a.g.C;
+ var g = [16914839];
+ g[1] = a.l;
+ g[2] = Math.floor(274877906944 / g[1]);
+ g[3] = g[2] - Math.floor(e / g[1]);
+ g[4] = g[2] - Math.floor(e / g[1]);
+ g[5] = a.g.a.length;
+ g[6] = 1048576;
+ g[7] = 0;
+ g[8] = 256;
+ e = oa("wwddddddw".split(""), g, a.Aa, 7);
+ na(a, f, h, e);
+ a.la(0, b);
+ break;
+ case 112:
+ case 12:
+ g = ra(["w", "w"], c);
+ var p = g[0];
+ d = g[1];
+ c = a.a[p].ca;
+ var r = sa(a.g, c);
+ c = ta(a.g, c);
+ ua(a.g, a.a[p].ca, function() {
+ g[0] = r.lb;
+ g[1] = this.i - 24;
+ oa(["Q", "w"], g, this.Aa, 7);
+ na(this,
+ f, h, 17);
+ this.la(0, b)
+ }.bind(a));
+ break;
+ case 70:
+ g = ra(["w", "w", "s"], c);
+ e = g[0];
+ p = g[1];
+ c = g[2];
+ r = va(a.g);
+ d = sa(a.g, a.a[p].ca);
+ var v = a.g.g[a.a[p].ca];
+ r.mode = d.mode;
+ r.size = d.size;
+ r.ff = d.ff;
+ var E = a.g.g[a.g.a.length] = new Uint8Array(r.size);
+ for (d = 0; d < r.size; d++) E[d] = v[d];
+ r.name = c;
+ r.va = a.a[e].ca;
+ wa(a.g, r);
+ na(a, f, h, 0);
+ a.la(0, b);
+ break;
+ case 16:
+ g = ra(["w", "s", "s", "w"], c);
+ p = g[0];
+ c = g[1];
+ e = g[3];
+ c = xa(a.g, c, a.a[p].ca, g[2]);
+ r = sa(a.g, c);
+ r.uid = a.a[p].uid;
+ r.pb = e;
+ oa(["Q"], [r.lb], a.Aa, 7);
+ na(a, f, h, 13);
+ a.la(0, b);
+ break;
+ case 18:
+ g =
+ ra("wswwww".split(""), c);
+ p = g[0];
+ c = g[1];
+ d = g[2];
+ v = g[3];
+ E = g[4];
+ e = g[5];
+ c = ya(a.g, c, a.a[p].ca, v, E);
+ r = sa(a.g, c);
+ r.mode = d;
+ r.uid = a.a[p].uid;
+ r.pb = e;
+ oa(["Q"], [r.lb], a.Aa, 7);
+ na(a, f, h, 13);
+ a.la(0, b);
+ break;
+ case 22:
+ g = ra(["w"], c);
+ p = g[0];
+ r = sa(a.g, a.a[p].ca);
+ e = oa(["s"], [r.ff], a.Aa, 7);
+ na(a, f, h, e);
+ a.la(0, b);
+ break;
+ case 72:
+ g = ra(["w", "s", "w", "w"], c);
+ p = g[0];
+ c = g[1];
+ d = g[2];
+ e = g[3];
+ c = za(a.g, c, a.a[p].ca);
+ r = sa(a.g, c);
+ r.mode = d | Aa;
+ r.uid = a.a[p].uid;
+ r.pb = e;
+ oa(["Q"], [r.lb], a.Aa, 7);
+ na(a, f, h, 13);
+ a.la(0, b);
+ break;
+ case 14:
+ g = ra(["w", "s",
+ "w", "w", "w"
+ ], c);
+ p = g[0];
+ c = g[1];
+ d = g[3];
+ e = g[4];
+ c = Ba(a.g, c, a.a[p].ca);
+ a.a[p].ca = c;
+ a.a[p].type = 1;
+ r = sa(a.g, c);
+ r.uid = a.a[p].uid;
+ r.pb = e;
+ r.mode = d;
+ oa(["Q", "w"], [r.lb, a.i - 24], a.Aa, 7);
+ na(a, f, h, 17);
+ a.la(0, b);
+ break;
+ case 52:
+ oa(["w"], [0], a.Aa, 7);
+ na(a, f, h, 1);
+ a.la(0, b);
+ break;
+ case 24:
+ g = ra(["w", "d"], c);
+ p = g[0];
+ r = sa(a.g, a.a[p].ca);
+ if (!r || r.status === Ca) {
+ pa(a, h, 2);
+ a.la(0, b);
+ break
+ }
+ g[0] |= 4096;
+ g[0] = g[1];
+ g[1] = r.lb;
+ g[2] = r.mode;
+ g[3] = r.uid;
+ g[4] = r.pb;
+ g[5] = r.Pb;
+ g[6] = r.$g << 8 | r.ah;
+ g[7] = r.size;
+ g[8] = a.l;
+ g[9] = Math.floor(r.size / 512 + 1);
+ g[10] = r.mf;
+ g[11] = 0;
+ g[12] = r.ne;
+ g[13] = 0;
+ g[14] = r.dg;
+ g[15] = 0;
+ g[16] = 0;
+ g[17] = 0;
+ g[18] = 0;
+ g[19] = 0;
+ oa("dQwwwddddddddddddddd".split(""), g, a.Aa, 7);
+ na(a, f, h, 153);
+ a.la(0, b);
+ break;
+ case 26:
+ g = ra("wwwwwddddd".split(""), c);
+ p = g[0];
+ r = sa(a.g, a.a[p].ca);
+ g[1] & 1 && (r.mode = g[2]);
+ g[1] & 2 && (r.uid = g[3]);
+ g[1] & 4 && (r.pb = g[4]);
+ g[1] & 16 && (r.mf = Math.floor((new Date).getTime() / 1E3));
+ g[1] & 32 && (r.ne = Math.floor((new Date).getTime() / 1E3));
+ g[1] & 64 && (r.dg = Math.floor((new Date).getTime() / 1E3));
+ g[1] & 128 && (r.mf = g[6]);
+ g[1] & 256 && (r.ne = g[8]);
+ g[1] &
+ 8 && Da(a.g, a.a[p].ca, g[5]);
+ na(a, f, h, 0);
+ a.la(0, b);
+ break;
+ case 50:
+ g = ra(["w", "d"], c);
+ p = g[0];
+ na(a, f, h, 0);
+ a.la(0, b);
+ break;
+ case 40:
+ case 116:
+ g = ra(["w", "d", "w"], c);
+ p = g[0];
+ var z = g[1],
+ A = g[2];
+ r = sa(a.g, a.a[p].ca);
+ if (!r || r.status === Ca) {
+ pa(a, h, 2);
+ a.la(0, b);
+ break
+ }
+ if (2 == a.a[p].type) {
+ r.Pa.length < z + A && (A = r.Pa.length - z);
+ for (d = 0; d < A; d++) a.Aa[11 + d] = r.Pa[z + d];
+ oa(["w"], [A], a.Aa, 7);
+ na(a, f, h, 4 + A);
+ a.la(0, b)
+ } else {
+ var M = a.g.a[a.a[p].ca];
+ a.w.send("9p-read-start");
+ ta(a.g, a.a[p].ca);
+ ua(a.g, a.a[p].ca, function() {
+ this.w.send("9p-read-end", [M.name, A]);
+ r.size < z + A && (A = r.size - z);
+ var a = this.g.g[this.a[p].ca];
+ if (a)
+ for (var c = 0; c < A; c++) this.Aa[11 + c] = a[z + c];
+ oa(["w"], [A], this.Aa, 7);
+ na(this, f, h, 4 + A);
+ this.la(0, b)
+ }.bind(a))
+ }
+ break;
+ case 118:
+ g = ra(["w", "d", "w"], c);
+ p = g[0];
+ z = g[1];
+ A = g[2];
+ Ea(a.g, a.a[p].ca, z, A, c);
+ M = a.g.a[a.a[p].ca];
+ a.w.send("9p-write-end", [M.name, A]);
+ oa(["w"], [A], a.Aa, 7);
+ na(a, f, h, 4);
+ a.la(0, b);
+ break;
+ case 74:
+ g = ra(["w", "s", "w", "s"], c);
+ c = Fa(a.g, a.a[g[0]].ca, g[1], a.a[g[2]].ca, g[3]);
+ if (0 == c) {
+ pa(a, h, 2);
+ a.la(0, b);
+ break
+ }
+ na(a, f, h, 0);
+ a.la(0, b);
+ break;
+ case 76:
+ g = ra(["w", "s", "w"], c);
+ d = g[0];
+ c = g[1];
+ p = Ga(a.g, a.a[d].ca, c);
+ if (-1 == p) {
+ pa(a, h, 2);
+ a.la(0, b);
+ break
+ }
+ c = Ha(a.g, p);
+ if (!c) {
+ pa(a, h, 39);
+ a.la(0, b);
+ break
+ }
+ na(a, f, h, 0);
+ a.la(0, b);
+ break;
+ case 100:
+ c = ra(["w", "s"], c);
+ a.i = c[0];
+ e = oa(["w", "s"], [a.i, a.v], a.Aa, 7);
+ na(a, f, h, e);
+ a.la(0, b);
+ break;
+ case 104:
+ g = ra(["w", "w", "s", "s", "w"], c);
+ p = g[0];
+ a.a[p] = {
+ ca: 0,
+ type: 1,
+ uid: g[4]
+ };
+ r = sa(a.g, a.a[p].ca);
+ oa(["Q"], [r.lb], a.Aa, 7);
+ na(a, f, h, 13);
+ a.la(0, b);
+ break;
+ case 108:
+ g = ra(["h"], c);
+ na(a, f, h, 0);
+ a.la(0, b);
+ break;
+ case 110:
+ g = ra(["w", "w", "h"],
+ c);
+ p = g[0];
+ e = g[1];
+ v = g[2];
+ if (0 == v) {
+ a.a[e] = {
+ ca: a.a[p].ca,
+ type: 1,
+ uid: a.a[p].uid
+ };
+ oa(["h"], [0], a.Aa, 7);
+ na(a, f, h, 2);
+ a.la(0, b);
+ break
+ }
+ E = [];
+ for (d = 0; d < v; d++) E.push("s");
+ E = ra(E, c);
+ c = a.a[p].ca;
+ z = 9;
+ var Y = 0;
+ for (d = 0; d < v; d++) {
+ c = Ga(a.g, c, E[d]);
+ if (-1 == c) break;
+ z += oa(["Q"], [a.g.a[c].lb], a.Aa, z);
+ Y++;
+ a.a[e] = {
+ ca: c,
+ type: 1,
+ uid: a.a[p].uid
+ }
+ }
+ oa(["h"], [Y], a.Aa, 7);
+ na(a, f, h, z - 7);
+ a.la(0, b);
+ break;
+ case 120:
+ g = ra(["w"], c);
+ a.a[g[0]] && 0 <= a.a[g[0]].ca && (Ia(a.g, a.a[g[0]].ca), a.a[g[0]].ca = -1, a.a[g[0]].type = -1);
+ na(a, f, h, 0);
+ a.la(0, b);
+ break;
+ case 32:
+ g = ra(["w", "s", "d", "w"], c);
+ p = g[0];
+ c = g[1];
+ na(a, f, h, 0);
+ a.la(0, b);
+ break;
+ case 30:
+ g = ra(["w", "w", "s"], c), p = g[0], d = g[1], c = g[2], a.a[d] = {
+ ca: a.a[p].ca,
+ type: -1,
+ uid: a.a[p].uid
+ }, e = 0, "security.capability" == c && (e = Ja(a.g, a.a[p].ca), a.a[d].type = 2), oa(["d"], [e], a.Aa, 7), na(a, f, h, 8), a.la(0, b)
+ }
+};
+"undefined" === typeof window || window.requestAnimationFrame || (window.requestAnimationFrame = window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame);
+
+function Ka(a, b) {
+ function c(a) {
+ a = a.toString(16);
+ return "#" + Array(7 - a.length).join("0") + a
+ }
+
+ function d(a, b, c, d) {
+ a.style.width = "";
+ a.style.height = "";
+ d && (a.style.transform = a.style.webkitTransform = a.style.MozTransform = "");
+ var f = a.getBoundingClientRect();
+ d ? a.style.transform = a.style.webkitTransform = a.style.MozTransform = (1 === b ? "" : " scaleX(" + b + ")") + (1 === c ? "" : " scaleY(" + c + ")") : (0 === b % 1 && 0 === c % 1 ? (e.style.ti = "pixelated", e.style["-ms-interpolation-mode"] = "nearest-neighbor") : (e.style.ti = "", e.style["-ms-interpolation-mode"] =
+ ""), d = window.devicePixelRatio || 1, 0 !== d % 1 && (b /= d, c /= d));
+ 1 !== b && (a.style.width = f.width * b + "px");
+ 1 !== c && (a.style.height = f.height * c + "px")
+ }
+ console.assert(a, "1st argument must be a DOM container");
+ var e = a.getElementsByTagName("canvas")[0],
+ f = e.getContext("2d"),
+ h = a.getElementsByTagName("div")[0],
+ g = document.createElement("div"),
+ p, r, v, E, z = 1,
+ A = 1,
+ M, Y = !1,
+ ka, vb, yd, Bh = this;
+ a = new Uint16Array([199, 252, 233, 226, 228, 224, 229, 231, 234, 235, 232, 239, 238, 236, 196, 197, 201, 230, 198, 244, 246, 242, 251, 249, 255, 214, 220, 162, 163, 165, 8359,
+ 402, 225, 237, 243, 250, 241, 209, 170, 186, 191, 8976, 172, 189, 188, 161, 171, 187, 9617, 9618, 9619, 9474, 9508, 9569, 9570, 9558, 9557, 9571, 9553, 9559, 9565, 9564, 9563, 9488, 9492, 9524, 9516, 9500, 9472, 9532, 9566, 9567, 9562, 9556, 9577, 9574, 9568, 9552, 9580, 9575, 9576, 9572, 9573, 9561, 9560, 9554, 9555, 9579, 9578, 9496, 9484, 9608, 9604, 9612, 9616, 9600, 945, 223, 915, 960, 931, 963, 181, 964, 934, 920, 937, 948, 8734, 966, 949, 8745, 8801, 177, 8805, 8804, 8992, 8993, 247, 8776, 176, 8729, 183, 8730, 8319, 178, 9632, 160
+ ]);
+ for (var Ch = new Uint16Array([32, 9786, 9787, 9829, 9830,
+ 9827, 9824, 8226, 9688, 9675, 9689, 9794, 9792, 9834, 9835, 9788, 9658, 9668, 8597, 8252, 182, 167, 9644, 8616, 8593, 8595, 8594, 8592, 8735, 8596, 9650, 9660
+ ]), Hf = [], If, Fb = 0; 256 > Fb; Fb++) If = 127 < Fb ? a[Fb - 128] : 32 > Fb ? Ch[Fb] : Fb, Hf[Fb] = String.fromCharCode(If);
+ f.imageSmoothingEnabled = !1;
+ g.style.position = "absolute";
+ g.style.backgroundColor = "#ccc";
+ g.style.width = "7px";
+ g.style.display = "inline-block";
+ h.style.display = "block";
+ e.style.display = "none";
+ this.w = b;
+ b.register("screen-set-mode", function(a) {
+ this.wg(a)
+ }, this);
+ b.register("screen-fill-buffer-end",
+ function(a) {
+ this.yg(a)
+ }, this);
+ b.register("screen-put-char", function(a) {
+ this.qg(a[0], a[1], a[2], a[3], a[4])
+ }, this);
+ b.register("screen-update-cursor", function(a) {
+ this.Nd(a[0], a[1])
+ }, this);
+ b.register("screen-update-cursor-scanline", function(a) {
+ this.Od(a[0], a[1])
+ }, this);
+ b.register("screen-clear", function() {
+ this.Dg()
+ }, this);
+ b.register("screen-set-size-text", function(a) {
+ this.Jd(a[0], a[1])
+ }, this);
+ b.register("screen-set-size-graphical", function(a) {
+ this.Id(a[0], a[1], a[2], a[3])
+ }, this);
+ this.Ob = function() {
+ this.Jd(80,
+ 25);
+ this.Ic()
+ };
+ this.i = function() {
+ try {
+ window.open(e.toDataURL())
+ } catch (hi) {}
+ };
+ this.qg = function(a, b, c, e, d) {
+ a < yd && b < vb && (b = 3 * (a * vb + b), ka[b] = c, ka[b + 1] = e, ka[b + 2] = d, M[a] = 1)
+ };
+ this.Ic = function() {
+ requestAnimationFrame(Y ? Dh : Gc)
+ };
+ var Gc = function() {
+ for (var a = 0; a < yd; a++) M[a] && (Bh.g(a), M[a] = 0);
+ this.Ic()
+ }.bind(this),
+ Dh = function() {
+ this.w.send("screen-fill-buffer");
+ this.Ic()
+ }.bind(this);
+ this.Mb = function() {};
+ this.wg = function(a) {
+ (Y = a) ? (h.style.display = "none", e.style.display = "block") : (h.style.display = "block", e.style.display =
+ "none")
+ };
+ this.Dg = function() {
+ f.fillStyle = "#000";
+ f.fillRect(0, 0, e.width, e.height)
+ };
+ this.Jd = function(a, b) {
+ if (a !== vb || b !== yd) {
+ M = new Int8Array(b);
+ ka = new Int32Array(a * b * 3);
+ vb = a;
+ for (yd = b; h.childNodes.length > b;) h.removeChild(h.firstChild);
+ for (; h.childNodes.length < b;) h.appendChild(document.createElement("div"));
+ for (a = 0; a < b; a++) this.g(a);
+ d(h, z, A, !0)
+ }
+ };
+ this.Id = function(a, b, c, g) {
+ e.style.display = "block";
+ e.width = a;
+ e.height = b;
+ p = f.createImageData(c, g);
+ new Uint8Array(p.data.buffer);
+ r = new Int32Array(p.data.buffer);
+ this.w.send("screen-tell-buffer", [r], [r.buffer]);
+ d(e, z, A, !1)
+ };
+ this.a = function(a, b) {
+ z = a;
+ A = b;
+ d(h, z, A, !0);
+ d(e, z, A, !1)
+ };
+ this.a(z, A);
+ this.Od = function(a, b) {
+ a & 32 ? g.style.display = "none" : (g.style.display = "inline", g.style.height = Math.min(15, b - a) + "px", g.style.marginTop = Math.min(15, a) + "px")
+ };
+ this.Nd = function(a, b) {
+ if (a !== v || b !== E) M[a] = 1, M[v] = 1, v = a, E = b
+ };
+ this.g = function(a) {
+ var b = 3 * a * vb,
+ e;
+ var d = h.childNodes[a];
+ var f = document.createElement("div");
+ for (var p = 0; p < vb;) {
+ var r = document.createElement("span");
+ var A = ka[b +
+ 1];
+ var M = ka[b + 2];
+ r.style.backgroundColor = c(A);
+ r.style.color = c(M);
+ for (e = ""; p < vb && ka[b + 1] === A && ka[b + 2] === M;)
+ if (e += Hf[ka[b]], p++, b += 3, a === v)
+ if (p === E) break;
+ else if (p === E + 1) {
+ f.appendChild(g);
+ break
+ }
+ r.textContent = e;
+ f.appendChild(r)
+ }
+ d.parentNode.replaceChild(f, d)
+ };
+ this.yg = function(a) {
+ a.forEach(function(a) {
+ f.putImageData(p, a.ug - a.qf, a.vg - a.rf, a.qf, a.rf, a.ag, a.$f)
+ })
+ };
+ this.Ob()
+};
+(function() {
+ function a(a, c) {
+ a instanceof Array || (a = [a]);
+ b(new Blob(a), c)
+ }
+
+ function b(a, b) {
+ var c = document.createElement("a");
+ c.download = b;
+ c.href = window.URL.createObjectURL(a);
+ c.dataset.downloadurl = ["application/octet-stream", c.download, c.href].join(":");
+ document.createEvent ? (a = document.createEvent("MouseEvent"), a.initMouseEvent("click", !0, !0, window, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, null), c.dispatchEvent(a)) : c.click();
+ window.URL.revokeObjectURL(c.href)
+ }
+
+ function c() {
+ for (var a = location.search.substr(1).split("&"),
+ b = {}, c = 0; c < a.length; c++) {
+ var e = a[c].split("=");
+ b[e[0]] = decodeURIComponent(e[1])
+ }
+ return b
+ }
+
+ function d(a, b) {
+ for (var c = ""; 0 < b--;) c += a;
+ return c
+ }
+
+ function e(a) {
+ return document.getElementById(a)
+ }
+
+ function f() {
+ function a(a) {
+ e("boot_options").style.display = "none";
+ document.title = a.name + " - Virtual x86";
+ d.filesystem = a.filesystem;
+ a.state && (e("reset").style.display = "none", d.ke = a.state);
+ d.Ra = a.Ra;
+ d.Qa = a.Qa;
+ d.Ma = a.Ma;
+ d.oe = a.oe;
+ d.Ia = a.Ia;
+ d.Ja = a.Ja;
+ d.id = a.id;
+ void 0 !== a.ae && (d.ae = a.ae);
+ a.description && (e("description").style.display =
+ "block", e("description").innerHTML = "<br>" + a.description);
+ h(d, b)
+ }
+
+ function b(a) {
+ g.c && setTimeout(function() {
+ a.Xg(g.c + "\n")
+ }, 25)
+ }
+ if ("responseType" in new XMLHttpRequest) {
+ var d = {};
+ e("start_emulation").onclick = function() {
+ e("boot_options").style.display = "none";
+ v("custom");
+ var a = e("floppy_image").files[0];
+ if (a) {
+ var b = a;
+ d.Ra = {
+ buffer: a
+ }
+ }
+ if (a = e("cd_image").files[0]) b = a, d.Qa = {
+ buffer: a
+ };
+ if (a = e("hd_image").files[0]) b = a, d.Ma = {
+ buffer: a
+ };
+ e("multiboot_image") && (a = e("multiboot_image").files[0]) && (b = a, d.oe = {
+ buffer: a
+ });
+ b && (document.title = b.name + " - Virtual x86");
+ h(d)
+ };
+ var f = [{
+ id: "linux26",
+ Qa: {
+ url: z + "images/linux.iso",
+ size: 5666816
+ },
+ name: "Linux"
+ }, {
+ id: "linux3",
+ Qa: {
+ url: z + "images/linux3.iso",
+ size: 8624128
+ },
+ name: "Linux",
+ filesystem: {}
+ }, {
+ id: "openbsd",
+ Ra: {
+ url: z + "/static/openbsd.img",
+ size: 1474560
+ },
+ name: "OpenBSD"
+ }],
+ g = c(),
+ p = 'openbsd';
+ g.use_bochs_bios && (d.tk = !0);
+ for (var r = 0; r < f.length; r++) {
+ var Y = f[r];
+ if (p === Y.id) {
+ a(Y);
+ return
+ }
+ var Gc = e("start_" + Y.id);
+ Gc && (Gc.onclick = function(b, c) {
+ v(b.id);
+ c.blur();
+ a(b)
+ }.bind(this, Y, Gc))
+ }
+ "custom" === p && (g["hda.url"] && (d.Ma = {
+ size: parseInt(g["hda.size"], 10) || void 0,
+ url: g["hda.url"],
+ async: !0
+ }), g["cdrom.url"] && (d.Qa = {
+ size: parseInt(g["cdrom.size"], 10) || void 0,
+ url: g["cdrom.url"],
+ async: !0
+ }), g["fda.url"] && (d.Ra = {
+ size: parseInt(g["fda.size"], 10) || void 0,
+ url: g["fda.url"],
+ async: !0
+ }), d.Ra || d.Qa ||
+ d.Ma) && (e("boot_options").style.display = "none", h(d, b))
+ } else alert("Your browser is not supported because it doesn't have XMLHttpRequest.responseType")
+ }
+
+ function h(a, b) {
+ var c = a.Ia;
+ c || (c = 1048576 * parseInt(e("memory_size").value, 10), c || (alert("Invalid memory size - reset to 128MB"), c = 134217728));
+ var f = a.Ja;
+ f || (f = 1048576 * parseInt(e("video_memory_size").value, 10), f || (alert("Invalid video memory size - reset to 8MB"), f = 8388608));
+ if (!a.Ra) {
+ var h = e("floppy_image").files[0];
+ h && (a.Ra = {
+ buffer: h
+ })
+ }
+ if (a.tk) {
+ h = "bochs-bios.bin";
+ var p = "bochs-vgabios.bin"
+ } else h = "seabios.bin", p = "vgabios.bin";
+ if (!a.ke) {
+ var r = {
+ url: "/static/" + h
+ };
+ var v = {
+ url: "/static/" + p
+ }
+ }
+ var A = new l({
+ memory_size: c,
+ vga_memory_size: f,
+ screen_container: e("screen_container"),
+ serial_container: e("serial"),
+ boot_order: a.ae || parseInt(e("boot_order").value, 16) || 0,
+ network_relay_url: "wss://relay.widgetry.org/",
+ bios: r,
+ vga_bios: v,
+ fda: a.Ra,
+ hda: a.Ma,
+ cdrom: a.Qa,
+ multiboot: a.oe,
+ initial_state: a.ke,
+ filesystem: a.filesystem || {},
+ autostart: !0
+ });
+ A.$a("emulator-ready", function() {
+ g(a, A);
+ b && b(A)
+ });
+ A.$a("download-progress", function(a) {
+ var b = e("loading");
+ b.style.display = "block";
+ if (a.vf === a.uf - 1 && a.loaded >= a.total - 2048) b.textContent = "Done downloading. Starting now ...";
+ else {
+ var c = "Downloading images ";
+ "number" === typeof a.vf && a.uf && (c += "[" + (a.vf + 1) + "/" + a.uf + "] ");
+ if (a.total && "number" === typeof a.loaded) {
+ a = Math.floor(a.loaded / a.total * 100);
+ a = Math.min(100, Math.max(0, a));
+ var f = Math.floor(a / 2);
+ c = c + (a + "% [") + d("#", f);
+ c += d(" ", 50 - f) + "]"
+ } else c += d(".", Y++ % 50);
+ b.textContent = c
+ }
+ });
+ A.$a("download-error", function(a) {
+ var b =
+ e("loading");
+ b.style.display = "block";
+ b.textContent = "Loading " + a.Qg + " failed. Check your connection and reload the page to try again."
+ })
+ }
+
+ function g(c, d) {
+ function f() {
+ var a = Date.now(),
+ b = d.ig(),
+ c = b - M;
+ M = b;
+ var f = a - v;
+ A += f;
+ v = a;
+ e("speed").textContent = c / f | 0;
+ e("avg_speed").textContent = b / A | 0;
+ a = e("running_time");
+ b = A / 1E3 | 0;
+ a.textContent = 60 > b ? b + "s" : 3600 > b ? (b / 60 | 0) + "m " + La(b % 60, 2) + "s" : (b / 3600 | 0) + "h " + La((b / 60 | 0) % 60, 2) + "m " + La(b % 60, 2) + "s"
+ }
+
+ function g(f, g) {
+ var h = e("get_" + g + "_image");
+ !f || 104857600 < f.size ? h.style.display =
+ "none" : h.onclick = function() {
+ var e = d.kd[g],
+ f = c.id + ("cdrom" === g ? ".iso" : ".img");
+ e.Tg ? (e = e.Tg(f), b(e, f)) : e.Se(function(b) {
+ b ? a(b, f) : alert("The file could not be loaded. Maybe it's too big?")
+ });
+ h.blur()
+ }
+ }
+
+ function h(a) {
+ a.ctrlKey ? window.onbeforeunload = function() {
+ window.onbeforeunload = null;
+ return "CTRL-W cannot be sent to the emulator."
+ } : window.onbeforeunload = null
+ }
+ e("boot_options").style.display = "none";
+ e("loading").style.display = "none";
+ e("runtime_options").style.display = "block";
+ e("runtime_infos").style.display =
+ "block";
+ e("screen_container").style.display = "block";
+ c.filesystem && p(d);
+ e("run").onclick = function() {
+ d.Ge ? (e("run").value = "Run", d.stop()) : (e("run").value = "Pause", d.cf());
+ e("run").blur()
+ };
+ e("exit").onclick = function() {
+ d.stop();
+ location.href = location.pathname
+ };
+ e("lock_mouse").onclick = function() {
+ if (!r) e("toggle_mouse").onclick();
+ d.Df();
+ e("lock_mouse").blur()
+ };
+ var r = !0;
+ e("toggle_mouse").onclick = function() {
+ r = !r;
+ d.m && (d.m.a = r);
+ e("toggle_mouse").value = (r ? "Dis" : "En") + "able mouse";
+ e("toggle_mouse").blur()
+ };
+ var v =
+ 0,
+ A = 0,
+ M = 0,
+ z, ka = !1;
+ d.$a("emulator-started", function() {
+ v = Date.now();
+ z = setInterval(f, 1E3)
+ });
+ d.$a("emulator-stopped", function() {
+ f();
+ clearInterval(z)
+ });
+ var E = 0,
+ Y = 0;
+ d.$a("9p-read-start", function() {
+ e("info_filesystem").style.display = "block";
+ e("info_filesystem_status").textContent = "Loading ..."
+ });
+ d.$a("9p-read-end", function(a) {
+ E += a[1];
+ e("info_filesystem_status").textContent = "Idle";
+ e("info_filesystem_last_file").textContent = a[0];
+ e("info_filesystem_bytes_read").textContent = E
+ });
+ d.$a("9p-write-end", function(a) {
+ Y +=
+ a[1];
+ e("info_filesystem_last_file").textContent = a[0];
+ e("info_filesystem_bytes_written").textContent = Y
+ });
+ var vb = 0,
+ Gf = 0,
+ Jf = 0,
+ Kf = 0;
+ d.$a("ide-read-start", function() {
+ e("info_storage").style.display = "block";
+ e("info_storage_status").textContent = "Loading ..."
+ });
+ d.$a("ide-read-end", function(a) {
+ vb += a[1];
+ Gf += a[2];
+ e("info_storage_status").textContent = "Idle";
+ e("info_storage_bytes_read").textContent = vb;
+ e("info_storage_sectors_read").textContent = Gf
+ });
+ d.$a("ide-write-end", function(a) {
+ Jf += a[1];
+ Kf += a[2];
+ e("info_storage_bytes_written").textContent =
+ Jf;
+ e("info_storage_sectors_written").textContent = Kf
+ });
+ var Lf = 0,
+ Mf = 0;
+ d.$a("eth-receive-end", function(a) {
+ Mf += a[0];
+ e("info_network").style.display = "block";
+ e("info_network_bytes_received").textContent = Mf
+ });
+ d.$a("eth-transmit-end", function(a) {
+ Lf += a[0];
+ e("info_network").style.display = "block";
+ e("info_network_bytes_transmitted").textContent = Lf
+ });
+ d.$a("mouse-enable", function(a) {
+ ka = a;
+ e("info_mouse_enabled").textContent = a ? "Yes" : "No"
+ });
+ d.$a("screen-set-mode", function(a) {
+ a ? e("info_vga_mode").textContent = "Graphical" :
+ (e("info_vga_mode").textContent = "Text", e("info_res").textContent = "-", e("info_bpp").textContent = "-")
+ });
+ d.$a("screen-set-size-graphical", function(a) {
+ e("info_res").textContent = a[0] + "x" + a[1];
+ e("info_bpp").textContent = a[4]
+ });
+ e("reset").onclick = function() {
+ d.Sf();
+ e("reset").blur()
+ };
+ g(c.Ma, "hda");
+ g(c.zf, "hdb");
+ g(c.Ra, "fda");
+ g(c.Ng, "fdb");
+ g(c.Qa, "cdrom");
+ e("memory_dump").onclick = function() {
+ a(d.a.j.da, "v86memory.bin");
+ e("memory_dump").blur()
+ };
+ e("save_state").onclick = function() {
+ d.we(function(b, c) {
+ b ? (console.log(b.stack),
+ console.log("Couldn't save state: ", b)) : a(c, "v86state.bin")
+ });
+ e("save_state").blur()
+ };
+ e("load_state").onclick = function() {
+ e("load_state_input").click();
+ e("load_state").blur()
+ };
+ e("load_state_input").onchange = function() {
+ var a = this.files[0];
+ if (a) {
+ var b = d.Ge;
+ b && d.stop();
+ var c = new FileReader;
+ c.onload = function(a) {
+ try {
+ d.Hd(a.target.result)
+ } catch (Nf) {
+ throw alert("Something bad happened while restoring the state:\n" + Nf + "\n\nNote that the current configuration must be the same as the original"), Nf;
+ }
+ b && d.cf()
+ };
+ c.readAsArrayBuffer(a);
+ this.value = ""
+ }
+ };
+ e("ctrlaltdel").onclick = function() {
+ d.Cf([29, 56, 83, 157, 184, 211]);
+ e("ctrlaltdel").blur()
+ };
+ e("alttab").onclick = function() {
+ d.Cf([56, 15]);
+ setTimeout(function() {
+ d.Cf([184, 143])
+ }, 100);
+ e("alttab").blur()
+ };
+ e("scale").onchange = function() {
+ var a = parseFloat(this.value);
+ (a || 0 < a) && d.Dh(a, a)
+ };
+ e("fullscreen").onclick = function() {
+ d.Bh()
+ };
+ e("screen_container").onclick = function() {
+ if (r && ka) d.Df(), e("lock_mouse").blur();
+ else if (window.getSelection().isCollapsed) {
+ var a = document.getElementsByClassName("phone_keyboard")[0];
+ a.style.top = document.body.scrollTop + 100 + "px";
+ a.style.left = document.body.scrollLeft + 100 + "px";
+ a.focus()
+ }
+ };
+ var Hc = document.getElementsByClassName("phone_keyboard")[0];
+ Hc.setAttribute("autocorrect", "off");
+ Hc.setAttribute("autocapitalize", "off");
+ Hc.setAttribute("spellcheck", "false");
+ Hc.tabIndex = 0;
+ e("screen_container").addEventListener("mousedown", function() {
+ Hc.focus()
+ }, !1);
+ e("take_screenshot").onclick = function() {
+ d.Ch();
+ e("take_screenshot").blur()
+ };
+ e("serial").style.display = "block";
+ window.addEventListener("keydown",
+ h, !1);
+ window.addEventListener("keyup", h, !1);
+ window.addEventListener("blur", h, !1)
+ }
+
+ function p(b) {
+ e("filesystem_panel").style.display = "block";
+ e("filesystem_send_file").onchange = function() {
+ Array.prototype.forEach.call(this.files, function(a) {
+ var c = new Ma(a);
+ c.onload = function() {
+ c.Se(function(c) {
+ b.Eg("/" + a.name, new Uint8Array(c))
+ })
+ };
+ c.load()
+ }, this);
+ this.value = "";
+ this.blur()
+ };
+ e("filesystem_get_file").onkeypress = function(c) {
+ 13 === c.which && (this.disabled = !0, b.vh(this.value, function(b, c) {
+ this.disabled = !1;
+ c ? (b =
+ this.value.replace(/\/$/, "").split("/"), b = b[b.length - 1] || "root", a(c, b), this.value = "") : alert("Can't read file")
+ }.bind(this)))
+ }
+ }
+
+ function r() {
+ location.reload()
+ }
+
+ function v(a) {
+ }
+ var E = !location.hostname.endsWith(".none"),
+ z = E ? "" : "",
+ A = E ? "" : "",
+ M = "https:" === location.protocol,
+ Y = 0;
+ window.addEventListener("load", f, !1);
+ window.addEventListener("load", function() {
+ setTimeout(function() {
+ window.addEventListener("popstate",
+ r)
+ }, 0)
+ });
+ "complete" === document.readyState && f()
+})();
+
+function Na(a) {
+ this.ports = [];
+ this.j = a;
+ for (var b = 0; 65536 > b; b++) this.ports[b] = Oa(this);
+ var c = a.Ia;
+ for (b = 0; b << 17 < c; b++) a.Ye[b] = a.Ze[b] = void 0, a.Ff[b] = a.Gf[b] = void 0;
+ Pa(this, c, 4294967296 - c, function() {
+ return 255
+ }, function() {}, function() {
+ return -1
+ }, function() {})
+}
+
+function Oa(a) {
+ return {
+ ja: a.gi,
+ ma: a.ei,
+ th: a.fi,
+ za: a.eg,
+ ze: a.eg,
+ fd: a.eg,
+ ia: void 0
+ }
+}
+k = Na.prototype;
+k.gi = function() {
+ return 255
+};
+k.ei = function() {
+ return 65535
+};
+k.fi = function() {
+ return -1
+};
+k.eg = function() {};
+
+function m(a, b, c, d, e, f) {
+ d && (a.ports[b].ja = d);
+ e && (a.ports[b].ma = e);
+ f && (a.ports[b].th = f);
+ a.ports[b].ia = c
+}
+
+function n(a, b, c, d, e, f) {
+ d && (a.ports[b].za = d);
+ e && (a.ports[b].ze = e);
+ f && (a.ports[b].fd = f);
+ a.ports[b].ia = c
+}
+k.te = function(a, b, c, d, e, f) {
+ function h() {
+ return c.call(this) | d.call(this) << 8
+ }
+
+ function g() {
+ return e.call(this) | f.call(this) << 8
+ }
+
+ function p() {
+ return c.call(this) | d.call(this) << 8 | e.call(this) << 16 | f.call(this) << 24
+ }
+ e && f ? (m(this, a, b, c, h, p), m(this, a + 1, b, d), m(this, a + 2, b, e, g), m(this, a + 3, b, f)) : (m(this, a, b, c, h), m(this, a + 1, b, d))
+};
+k.Gc = function(a, b, c, d, e, f) {
+ function h(a) {
+ c.call(this, a & 255);
+ d.call(this, a >> 8 & 255)
+ }
+
+ function g(a) {
+ e.call(this, a & 255);
+ f.call(this, a >> 8 & 255)
+ }
+
+ function p(a) {
+ c.call(this, a & 255);
+ d.call(this, a >> 8 & 255);
+ e.call(this, a >> 16 & 255);
+ f.call(this, a >>> 24)
+ }
+ e && f ? (n(this, a, b, c, h, p), n(this, a + 1, b, d), n(this, a + 2, b, e, g), n(this, a + 3, b, f)) : (n(this, a, b, c, h), n(this, a + 1, b, d))
+};
+
+function Qa(a, b, c) {
+ b >>>= 0;
+ c = b + (c >>> 0);
+ if (c >= a.j.Ia) return !0;
+ for (b &= -131072; b < c;) {
+ if (Ra(a.j, b)) return !0;
+ b += 131072
+ }
+ return !1
+}
+k.Ai = function(a) {
+ var b = this.j.Ye[a >>> 17];
+ return b(a) | b(a + 1) << 8 | b(a + 2) << 16 | b(a + 3) << 24
+};
+k.Bi = function(a, b) {
+ var c = this.j.Ze[a >>> 17];
+ c(a, b & 255);
+ c(a + 1, b >> 8 & 255);
+ c(a + 2, b >> 16 & 255);
+ c(a + 3, b >>> 24)
+};
+
+function Pa(a, b, c, d, e, f, h) {
+ f || (f = a.Ai.bind(a));
+ h || (h = a.Bi.bind(a));
+ for (b >>>= 17; 0 < c; b++) a.j.Ye[b] = d, a.j.Ze[b] = e, a.j.Ff[b] = f, a.j.Gf[b] = h, c -= 131072
+}
+
+function Sa(a, b, c) {
+ a = a.ports[b];
+ a.za.call(a.ia, c)
+}
+
+function Ta(a, b, c) {
+ a = a.ports[b];
+ a.ze.call(a.ia, c)
+}
+
+function Ua(a, b, c) {
+ a = a.ports[b];
+ a.fd.call(a.ia, c)
+}
+
+function Va(a, b) {
+ a = a.ports[b];
+ return a.ja.call(a.ia)
+}
+
+function Wa(a, b) {
+ a = a.ports[b];
+ return a.ma.call(a.ia)
+}
+
+function Xa(a, b) {
+ a = a.ports[b];
+ return a.th.call(a.ia)
+};
+
+function Ya(a) {
+ this.g = this.a = !1;
+ this.j = new q(a);
+ this.w = a;
+ a.register("cpu-init", this.Ob, this);
+ a.register("cpu-run", this.cf, this);
+ a.register("cpu-stop", this.stop, this);
+ a.register("cpu-restart", this.Sf, this);
+ this.hk()
+}
+Ya.prototype.cf = function() {
+ this.a || (this.w.send("emulator-started"), this.fg())
+};
+
+function Za(a) {
+ if (a.g) a.g = a.a = !1, a.w.send("emulator-stopped");
+ else {
+ a.a = !0;
+ a: {
+ var b = a.j;
+ if (b.Tc) {
+ var c = $a();
+ b.G.If.Ic(c, !1);
+ b.G.bd.Ic(c, !1);
+ ab(b);
+ if (b.Tc) {
+ b = 0;
+ break a
+ }
+ }
+ for (var d = c = $a(); 1 > d - c;) {
+ var e = b;
+ e.G.If.Ic(d, !1);
+ e.G.bd.Ic(d, !1);
+ ab(b);
+ b.qa();
+ if (b.Tc) break;
+ d = $a()
+ }
+ b = 0
+ }
+ 0 >= b ? a.fg() : a.Ci(b)
+ }
+}
+Ya.prototype.stop = function() {
+ this.a && (this.g = !0)
+};
+Ya.prototype.Sf = function() {
+ this.j.reset();
+ bb(this.j)
+};
+Ya.prototype.Ob = function(a) {
+ this.j.Ob(a, this.w);
+ this.w.send("emulator-ready")
+};
+if ("undefined" !== typeof setImmediate) var cb = function() {
+ var a = this;
+ setImmediate(function() {
+ Za(a)
+ })
+ },
+ db = function() {};
+else "undefined" !== typeof window && "undefined" !== typeof postMessage ? (cb = function() {
+ window.postMessage(43605, "*")
+}, db = function() {
+ var a = this;
+ window.addEventListener("message", function(b) {
+ b.source === window && 43605 === b.data && Za(a)
+ }, !1)
+}) : (cb = function() {
+ var a = this;
+ setTimeout(function() {
+ Za(a)
+ }, 0)
+}, db = function() {});
+k = Ya.prototype;
+k.fg = cb;
+k.hk = db;
+k.Ci = "undefined" !== typeof document && "boolean" === typeof document.hidden ? function(a) {
+ var b = this;
+ 4 > a || document.hidden ? this.fg() : setTimeout(function() {
+ Za(b)
+ }, a)
+} : function(a) {
+ var b = this;
+ setTimeout(function() {
+ Za(b)
+ }, a)
+};
+k.we = function() {
+ return this.j.we()
+};
+k.Hd = function(a) {
+ return this.j.Hd(a)
+};
+var $a = "object" === typeof performance && performance.now ? function() {
+ return performance.now()
+} : Date.now;
+var Ma, eb, fb, gb, hb, ib;
+
+function La(a, b) {
+ for (a = a ? a + "" : ""; a.length < b;) a = "0" + a;
+ return a
+}
+
+function jb(a, b) {
+ return "0x" + La((a ? a.toString(16) : "").toUpperCase(), b || 1)
+}
+if ("undefined" !== typeof window && window.crypto && window.crypto.getRandomValues) var kb = new Int32Array(1),
+ lb = function() {
+ return !0
+ },
+ mb = function() {
+ window.crypto.getRandomValues(kb);
+ return kb[0]
+ };
+else lb = function() {
+ return !1
+}, mb = function() {
+ console.assert(!1)
+};
+
+function nb(a) {
+ this.buffer = a;
+ this.byteLength = a.byteLength;
+ this.onload = void 0
+}
+nb.prototype.load = function() {
+ this.onload && this.onload({
+ buffer: this.buffer
+ })
+};
+nb.prototype.get = function(a, b, c) {
+ c(new Uint8Array(this.buffer, a, b))
+};
+nb.prototype.set = function(a, b, c) {
+ (new Uint8Array(this.buffer, a, b.byteLength)).set(b);
+ c()
+};
+nb.prototype.Se = function(a) {
+ a(this.buffer)
+};
+(function() {
+ for (var a = new Int8Array(256), b = 0, c = -2; 256 > b; b++) b & b - 1 || c++, a[b] = c;
+ eb = function(b) {
+ return a[b]
+ };
+ fb = function(b) {
+ var c = b >>> 16;
+ if (c) {
+ var d = c >>> 8;
+ return d ? 24 + a[d] : 16 + a[c]
+ }
+ return (d = b >>> 8) ? 8 + a[d] : a[b]
+ }
+})();
+
+function ob(a) {
+ var b = new Uint8Array(a),
+ c, d;
+ this.length = 0;
+ this.push = function(c) {
+ this.length !== a && this.length++;
+ b[d] = c;
+ d = d + 1 & a - 1
+ };
+ this.shift = function() {
+ if (this.length) {
+ var e = b[c];
+ c = c + 1 & a - 1;
+ this.length--;
+ return e
+ }
+ return -1
+ };
+ this.clear = function() {
+ this.length = d = c = 0
+ };
+ this.clear()
+}
+
+function pb() {
+ this.size = 65536;
+ this.data = new Float32Array(65536);
+ this.length = this.a = this.start = 0
+}
+pb.prototype.push = function(a) {
+ this.length === this.size ? this.start = this.start + 1 & this.size - 1 : this.length++;
+ this.data[this.a] = a;
+ this.a = this.a + 1 & this.size - 1
+};
+pb.prototype.shift = function() {
+ if (this.length) {
+ var a = this.data[this.start];
+ this.start = this.start + 1 & this.size - 1;
+ this.length--;
+ return a
+ }
+};
+
+function qb(a, b) {
+ var c = new Float32Array(b);
+ b > a.length && (b = a.length);
+ var d = a.start + b,
+ e = a.data.subarray(a.start, d);
+ c.set(e);
+ d >= a.size && (d -= a.size, c.set(a.data.subarray(0, d), e.length));
+ a.start = d;
+ a.length -= b;
+ return c
+}
+pb.prototype.clear = function() {
+ this.length = this.a = this.start = 0
+};
+
+function rb(a) {
+ this.j = a;
+ this.I = new Float64Array(8);
+ this.m = new Float32Array(1);
+ new Uint8Array(this.m.buffer);
+ this.v = new Int32Array(this.m.buffer);
+ this.l = new Float64Array(1);
+ this.g = new Uint8Array(this.l.buffer);
+ this.i = new Int32Array(this.l.buffer);
+ this.O = new Uint8Array(this.I.buffer);
+ new Int32Array(this.I.buffer);
+ this.fa = 255;
+ this.B = 0;
+ this.ec = 895;
+ this.od = this.nd = this.pd = this.Qe = this.Oc = this.a = 0;
+ this.C = NaN;
+ this.J = new Float64Array([1, Math.log(10) / Math.LN2, Math.LOG2E, Math.PI, Math.log(2) / Math.LN10, Math.LN2,
+ 0
+ ])
+}
+k = rb.prototype;
+k.Sa = function() {
+ var a = [];
+ a[0] = this.I;
+ a[1] = this.fa;
+ a[2] = this.B;
+ a[3] = this.ec;
+ a[4] = this.od;
+ a[5] = this.Oc;
+ a[6] = this.Qe;
+ a[7] = this.nd;
+ a[8] = this.od;
+ a[9] = this.pd;
+ return a
+};
+k.fb = function(a) {
+ this.I.set(a[0]);
+ this.fa = a[1];
+ this.B = a[2];
+ this.ec = a[3];
+ this.Oc = a[5];
+ this.Qe = a[6];
+ this.nd = a[7];
+ this.od = a[8];
+ this.pd = a[9]
+};
+
+function sb(a) {
+ t(a.j)
+}
+
+function tb(a) {
+ a.a |= 1
+}
+
+function ub(a, b) {
+ var c = wb(a);
+ a.a &= -18177;
+ c > b || (a.a = b > c ? a.a | 256 : c === b ? a.a | 16384 : a.a | 17664)
+}
+
+function xb(a, b) {
+ var c = a.I[a.B];
+ a.j.u &= -70;
+ a.j.flags &= -70;
+ c > b || (a.j.flags = b > c ? a.j.flags | 1 : c === b ? a.j.flags | 64 : a.j.flags | 69)
+}
+
+function yb(a) {
+ a.ec = 895;
+ a.a = 0;
+ a.Oc = 0;
+ a.nd = 0;
+ a.pd = 0;
+ a.fa = 255;
+ a.B = 0
+}
+
+function zb(a) {
+ return a.a & -14337 | a.B << 11
+}
+
+function Ab(a, b) {
+ if (Bb(a.j)) {
+ Cb(a.j, b, 26);
+ u(a.j, b, a.ec);
+ u(a.j, b + 4, zb(a));
+ for (var c = 0, d, e = 0; 8 > e; e++) d = a.I[e], a.fa >> e & 1 ? c |= 3 << (e << 1) : 0 === d ? c |= 1 << (e << 1) : isFinite(d) || (c |= 2 << (e << 1));
+ u(a.j, b + 8, c);
+ w(a.j, b + 12, a.Oc);
+ u(a.j, b + 16, a.Qe);
+ u(a.j, b + 18, a.pd);
+ w(a.j, b + 20, a.nd);
+ u(a.j, b + 24, a.od)
+ } else sb(a)
+}
+
+function Db(a, b) {
+ if (Bb(a.j)) {
+ a.ec = x(a.j, b);
+ var c = x(a.j, b + 4);
+ a.a = c & -14337;
+ a.B = c >> 11 & 7;
+ c = x(a.j, b + 8);
+ for (var d = a.fa = 0; 8 > d; d++) a.fa |= c >> d & c >> d + 1 & 1 << d;
+ a.Oc = y(a.j, b + 12);
+ a.Qe = x(a.j, b + 16);
+ a.pd = x(a.j, b + 18);
+ a.nd = y(a.j, b + 20);
+ a.od = x(a.j, b + 24)
+ } else sb(a)
+}
+
+function Eb(a, b) {
+ a = a.ec >> 10 & 3;
+ return 0 === a ? (a = Math.round(b), .5 === a - b && a % 2 && a--, a) : 1 === a || 3 === a && 0 < b ? Math.floor(b) : Math.ceil(b)
+}
+
+function Gb(a) {
+ return 0 < a ? Math.floor(a) : Math.ceil(a)
+}
+k.push = function(a) {
+ this.B = this.B - 1 & 7;
+ this.fa >> this.B & 1 ? (this.a &= -513, this.fa &= ~(1 << this.B), this.I[this.B] = a) : (this.a |= 512, this.a |= 65, this.I[this.B] = this.C)
+};
+k.pop = function() {
+ this.fa |= 1 << this.B;
+ this.B = this.B + 1 & 7
+};
+
+function Hb(a, b) {
+ b = b + a.B & 7;
+ return a.fa >> b & 1 ? (a.a &= -513, a.a |= 65, a.C) : a.I[b]
+}
+
+function wb(a) {
+ return a.fa >> a.B & 1 ? (a.a &= -513, a.a |= 65, a.C) : a.I[a.B]
+}
+
+function Ib(a, b) {
+ var c = x(a.j, b + 8),
+ d = y(a.j, b) >>> 0,
+ e = y(a.j, b + 4) >>> 0;
+ b = c >> 15;
+ c &= -32769;
+ if (0 === c) return 0;
+ if (!(32767 > c)) return a.g[7] = 127 | b << 7, a.g[6] = 240 | e >> 30 << 3 & 8, a.g[5] = 0, a.g[4] = 0, a.i[0] = 0, a.l[0];
+ a = d + 4294967296 * e;
+ b && (a = -a);
+ return a * Math.pow(2, c - 16383 - 63)
+}
+
+function Jb(a, b, c) {
+ a.l[0] = c;
+ c = a.g[7] & 128;
+ var d = (a.g[7] & 127) << 4 | a.g[6] >> 4;
+ if (2047 === d) {
+ d = 32767;
+ var e = 0;
+ var f = 2147483648 | (a.i[1] & 524288) << 11
+ } else 0 === d ? f = e = 0 : (d += 15360, e = a.i[0] << 11, f = 2147483648 | (a.i[1] & 1048575) << 11 | a.i[0] >>> 21);
+ w(a.j, b, e);
+ w(a.j, b + 4, f);
+ u(a.j, b + 8, c << 8 | d)
+}
+
+function Kb(a, b) {
+ var c = y(a.j, b);
+ b = y(a.j, b + 4);
+ a.i[0] = c;
+ a.i[1] = b;
+ return a.l[0]
+}
+
+function Lb(a, b) {
+ Cb(a.j, b, 8);
+ a.l[0] = Hb(a, 0);
+ w(a.j, b, a.i[0]);
+ w(a.j, b + 4, a.i[1])
+}
+
+function Mb(a, b) {
+ a.v[0] = y(a.j, b);
+ return a.m[0]
+}
+k.sign = function(a) {
+ return this.O[(this.B + a & 7) << 3 | 7] >> 7
+};
+
+function Nb(a, b, c, d, e) {
+ this.sa = new Ob(this, a, b, c, d, e);
+ this.Ca = new Ob(this, a, void 0, !1, d, e);
+ this.Ka = this.sa;
+ this.j = a;
+ 0 === d ? (this.a = 496, this.ua = 14, this.Hb = 240) : 1 === d && (this.a = 368, this.ua = 15, this.Hb = 248);
+ this.i = this.a | 516;
+ this.g = 46080;
+ this.pe = [134, 128, 16, 112, 5, 0, 160, 2, 0, 128, 1, 1, 0, 0, 0, 0, this.a & 255 | 1, this.a >> 8, 0, 0, this.i & 255 | 1, this.i >> 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.g & 255 | 1, this.g >> 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 16, 212, 130, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.ua, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ ];
+ this.nc = [{
+ size: 8
+ }, {
+ size: 4
+ }, void 0, void 0, {
+ size: 16
+ }];
+ this.name = "ide" + d;
+ this.m = 2;
+ m(a.o, this.a | 7, this, function() {
+ Pb(this.j, this.ua);
+ return this.zh()
+ });
+ m(a.o, this.i | 2, this, this.zh);
+ n(a.o, this.i | 2, this, this.xk);
+ m(a.o, this.a | 0, this, function() {
+ return Qb(this.Ka, 1)
+ }, function() {
+ return Qb(this.Ka, 2)
+ }, function() {
+ return Qb(this.Ka, 4)
+ });
+ m(a.o, this.a | 1, this, function() {
+ return this.Ka.error
+ });
+ m(a.o, this.a | 2, this, function() {
+ return this.Ka.pa & 255
+ });
+ m(a.o, this.a | 3, this, function() {
+ return this.Ka.Na & 255
+ });
+ m(a.o, this.a | 4, this, function() {
+ return this.Ka.Da & 255
+ });
+ m(a.o, this.a | 5, this, function() {
+ return this.Ka.Ga & 255
+ });
+ m(a.o, this.a | 6, this, function() {
+ return this.Ka.Mc
+ });
+ n(a.o, this.a | 0, this, function(a) {
+ Rb(this.Ka, a, 1)
+ }, function(a) {
+ Rb(this.Ka, a, 2)
+ }, function(a) {
+ Rb(this.Ka, a, 4)
+ });
+ n(a.o, this.a | 1, this, function(a) {
+ this.sa.ud = (this.sa.ud << 8 | a) & 65535;
+ this.Ca.ud = (this.Ca.ud << 8 | a) & 65535
+ });
+ n(a.o, this.a | 2, this,
+ function(a) {
+ this.sa.pa = (this.sa.pa << 8 | a) & 65535;
+ this.Ca.pa = (this.Ca.pa << 8 | a) & 65535
+ });
+ n(a.o, this.a | 3, this, function(a) {
+ this.sa.Na = (this.sa.Na << 8 | a) & 65535;
+ this.Ca.Na = (this.Ca.Na << 8 | a) & 65535
+ });
+ n(a.o, this.a | 4, this, function(a) {
+ this.sa.Da = (this.sa.Da << 8 | a) & 65535;
+ this.Ca.Da = (this.Ca.Da << 8 | a) & 65535
+ });
+ n(a.o, this.a | 5, this, function(a) {
+ this.sa.Ga = (this.sa.Ga << 8 | a) & 65535;
+ this.Ca.Ga = (this.Ca.Ga << 8 | a) & 65535
+ });
+ n(a.o, this.a | 6, this, function(a) {
+ this.Ka = a & 16 ? this.Ca : this.sa;
+ this.sa.Mc = a;
+ this.Ca.Mc = a;
+ this.sa.le = this.Ca.le =
+ a >> 6 & 1;
+ this.sa.head = this.Ca.head = a & 15
+ });
+ this.l = this.Ha = this.Dd = 0;
+ n(a.o, this.a | 7, this, function(a) {
+ Pb(this.j, this.ua);
+ var b = this.Ka;
+ if (b.buffer) switch (b.v = a, b.error = 0, a) {
+ case 8:
+ b.i = 0;
+ b.a = 0;
+ b.g = 0;
+ Sb(b);
+ b.ba();
+ break;
+ case 16:
+ b.status = 80;
+ b.Da = 0;
+ b.ba();
+ break;
+ case 248:
+ b.status = 80;
+ var c = b.l - 1;
+ b.Na = c & 255;
+ b.Da = c >> 8 & 255;
+ b.Ga = c >> 16 & 255;
+ b.Mc = b.Mc & 240 | c >> 24 & 15;
+ b.ba();
+ break;
+ case 39:
+ b.status = 80;
+ c = b.l - 1;
+ b.Na = c & 255;
+ b.Da = c >> 8 & 255;
+ b.Ga = c >> 16 & 255;
+ b.Na |= c >> 24 << 8 & 65280;
+ b.ba();
+ break;
+ case 32:
+ case 36:
+ case 41:
+ case 196:
+ Tb(b,
+ a);
+ break;
+ case 48:
+ case 52:
+ case 57:
+ case 197:
+ var e = 52 === a || 57 === a;
+ c = Ub(b, e);
+ e = Vb(b, e);
+ a = 48 === a || 52 === a;
+ c *= b.m;
+ e *= b.m;
+ e + c > b.buffer.byteLength ? (b.status = 255, b.ba()) : (b.status = 88, Wb(b, c), b.a = a ? 512 : Math.min(c, 512 * b.W), b.qa = e);
+ break;
+ case 144:
+ b.ba();
+ b.error = 257;
+ b.status = 80;
+ break;
+ case 145:
+ b.status = 80;
+ b.ba();
+ break;
+ case 160:
+ b.R && (b.status = 88, Xb(b, 12), b.a = 12, b.pa = 1, b.ba());
+ break;
+ case 161:
+ b.R ? (Yb(b), b.status = 88, b.Da = 20, b.Ga = 235) : b.status = 65;
+ b.ba();
+ break;
+ case 198:
+ b.W = b.pa & 255;
+ b.status = 80;
+ b.ba();
+ break;
+ case 37:
+ case 200:
+ c =
+ 37 === a;
+ e = Ub(b, c);
+ Vb(b, c) * b.m + e * b.m > b.buffer.byteLength ? (b.status = 255, b.ba()) : (b.status = 88, b.ia.Ha |= 1);
+ break;
+ case 53:
+ case 202:
+ c = 53 === a;
+ e = Ub(b, c);
+ Vb(b, c) * b.m + e * b.m > b.buffer.byteLength ? (b.status = 255, b.ba()) : (b.status = 88, b.ia.Ha |= 1);
+ break;
+ case 64:
+ b.status = 80;
+ b.ba();
+ break;
+ case 218:
+ b.status = 65;
+ b.error = 4;
+ b.ba();
+ break;
+ case 224:
+ b.status = 80;
+ b.ba();
+ break;
+ case 225:
+ b.status = 80;
+ b.ba();
+ break;
+ case 231:
+ b.status = 80;
+ b.ba();
+ break;
+ case 236:
+ if (b.R) {
+ b.status = 65;
+ b.error = 4;
+ b.ba();
+ break
+ }
+ Yb(b);
+ b.status = 88;
+ b.ba();
+ break;
+ case 234:
+ b.status =
+ 80;
+ b.ba();
+ break;
+ case 239:
+ b.status = 80;
+ b.ba();
+ break;
+ case 245:
+ b.status = 80;
+ b.ba();
+ break;
+ case 249:
+ b.status = 65;
+ b.error = 4;
+ break;
+ default:
+ b.status = 65, b.error = 4
+ } else b.error = 4, b.status = 65, b.ba()
+ });
+ m(a.o, this.g | 4, this, void 0, void 0, this.Yh);
+ n(a.o, this.g | 4, this, void 0, void 0, this.bi);
+ m(a.o, this.g, this, this.$h, void 0, this.Zh);
+ n(a.o, this.g, this, this.Kg, void 0, this.ci);
+ m(a.o, this.g | 2, this, this.ai);
+ n(a.o, this.g | 2, this, this.Lg);
+ m(a.o, this.g | 8, this, function() {
+ return 0
+ });
+ m(a.o, this.g | 10, this, function() {
+ return 0
+ });
+ Zb(a.G.wb,
+ this)
+}
+k = Nb.prototype;
+k.zh = function() {
+ return this.Ka.buffer ? this.Ka.status : 0
+};
+k.xk = function(a) {
+ a & 4 && (Pb(this.j, this.ua), Sb(this.sa), Sb(this.Ca));
+ this.m = a
+};
+k.Yh = function() {
+ return this.Dd
+};
+k.bi = function(a) {
+ this.Dd = a
+};
+k.ai = function() {
+ return this.Ha
+};
+k.Lg = function(a) {
+ this.Ha &= ~(a & 6)
+};
+k.Zh = function() {
+ return this.l | this.Ha << 16
+};
+k.$h = function() {
+ return this.l
+};
+k.ci = function(a) {
+ this.Kg(a & 255);
+ this.Lg(a >> 16 & 255)
+};
+k.Kg = function(a) {
+ var b = this.l;
+ this.l = a & 9;
+ if ((b & 1) !== (a & 1))
+ if (0 === (a & 1)) this.Ha &= -2;
+ else switch (this.Ha |= 1, this.Ka.v) {
+ case 37:
+ case 200:
+ $b(this.Ka);
+ break;
+ case 202:
+ case 53:
+ ac(this.Ka);
+ break;
+ case 160:
+ bc(this.Ka)
+ }
+};
+k.ba = function() {
+ 0 === (this.m & 2) && (this.Ha |= 4, this.j.Cb(this.ua))
+};
+k.Sa = function() {
+ var a = [];
+ a[0] = this.sa;
+ a[1] = this.Ca;
+ a[2] = this.a;
+ a[3] = this.ua;
+ a[4] = this.Hb;
+ a[5] = this.i;
+ a[6] = this.g;
+ a[7] = this.name;
+ a[8] = this.m;
+ a[9] = this.Dd;
+ a[10] = this.Ha;
+ a[11] = this.Ka === this.sa;
+ a[12] = this.l;
+ return a
+};
+k.fb = function(a) {
+ this.sa = a[0];
+ this.Ca = a[1];
+ this.a = a[2];
+ this.ua = a[3];
+ this.Hb = a[4];
+ this.i = a[5];
+ this.g = a[6];
+ this.name = a[7];
+ this.m = a[8];
+ this.Dd = a[9];
+ this.Ha = a[10];
+ this.Ka = a[11] ? this.sa : this.Ca;
+ this.l = a[12]
+};
+
+function Ob(a, b, c, d, e, f) {
+ this.ia = a;
+ this.w = f;
+ this.Fa = e;
+ this.j = b;
+ this.buffer = c;
+ this.m = d ? 2048 : 512;
+ this.R = d;
+ this.O = this.C = this.J = this.l = 0;
+ this.buffer && (this.l = this.buffer.byteLength / this.m, this.l !== (this.l | 0) && (this.l = Math.ceil(this.l)), d ? (this.J = 1, this.C = 0) : (this.J = 16, this.C = 63), this.O = this.l / this.J / this.C, this.O !== (this.O | 0) && (this.O = Math.floor(this.O)), a = b.G.bd, a.ha[57] |= 1 << 4 * this.Fa, a.ha[18] = a.ha[18] & 15 | 240, a.ha[27] = this.O & 255, a.ha[28] = this.O >> 8 & 255, a.ha[29] = this.J & 255, a.ha[30] = 255, a.ha[31] = 255, a.ha[32] =
+ 200, a.ha[33] = this.O & 255, a.ha[34] = this.O >> 8 & 255, a.ha[35] = this.C & 255);
+ this.Oa = {
+ Eh: 0,
+ Fh: 0,
+ Bg: 0,
+ Cg: 0,
+ Yg: !1
+ };
+ this.buffer = c;
+ this.Mc = this.head = this.Ga = this.Da = this.ud = this.Na = this.pa = this.le = 0;
+ this.status = 80;
+ this.W = 128;
+ this.i = this.error = 0;
+ this.data = new Uint8Array(65536);
+ this.oa = new Uint16Array(this.data.buffer);
+ this.Z = new Int32Array(this.data.buffer);
+ this.a = this.g = 0;
+ this.ka = this.v = -1;
+ this.qa = 0;
+ Object.seal(this)
+}
+
+function Sb(a) {
+ a.R ? (a.status = 0, a.pa = 1, a.error = 1, a.Na = 1, a.Da = 20, a.Ga = 235) : (a.status = 81, a.pa = 1, a.error = 1, a.Na = 1, a.Da = 0, a.Ga = 0)
+}
+Ob.prototype.ba = function() {
+ this.ia.ba()
+};
+Ob.prototype.Me = function() {
+ this.status = 80;
+ var a = this.data.subarray(0, this.g);
+ cc(this, this.v, this.g / 512);
+ this.ba();
+ this.buffer.set(this.qa, a, function() {});
+ dc(this, this.g)
+};
+
+function ec(a, b) {
+ var c = (b[7] << 8 | b[8]) * a.m;
+ b = (b[2] << 24 | b[3] << 16 | b[4] << 8 | b[5]) * a.m;
+ a.g = 0;
+ var d = a.Ga << 8 & 65280 | a.Da & 255;
+ a.Da = a.Ga = 0;
+ 65535 === d && d--;
+ d > c && (d = c);
+ b >= a.buffer.byteLength ? (a.status = 255, a.ba()) : 0 === c ? (a.status = 80, a.i = 0) : (c = Math.min(c, a.buffer.byteLength - b), a.status = 208, fc(a), a.buffer.get(b, c, function(b) {
+ gc(a, b);
+ a.status = 88;
+ a.pa = a.pa & -8 | 2;
+ a.ba();
+ d &= -4;
+ a.a = d;
+ a.a > a.g && (a.a = a.g);
+ a.Da = a.a & 255;
+ a.Ga = a.a >> 8 & 255;
+ hc(a, c)
+ }))
+}
+
+function ic(a, b) {
+ var c = (b[7] << 8 | b[8]) * a.m;
+ b = (b[2] << 24 | b[3] << 16 | b[4] << 8 | b[5]) * a.m;
+ b >= a.buffer.byteLength ? (a.status = 255, a.ba()) : (a.status = 208, fc(a), a.buffer.get(b, c, function(b) {
+ hc(a, c);
+ a.status = 88;
+ a.pa = a.pa & -8 | 2;
+ gc(a, b);
+ bc(a)
+ }))
+}
+
+function bc(a) {
+ if (0 !== (a.ia.Ha & 1) && 0 !== (a.status & 8)) {
+ var b = a.ia.Dd,
+ c = 0,
+ d = a.data;
+ do {
+ var e = jc(a.j, b),
+ f = a.j.ma(b + 4),
+ h = a.j.ja(b + 7) & 128;
+ f || (f = 65536);
+ a.j.da.set(d.subarray(c, Math.min(c + f, a.g)), e);
+ c += f;
+ b += 8;
+ if (c >= a.g && !h) break
+ } while (!h);
+ a.status = 80;
+ a.ia.Ha &= -2;
+ a.pa = a.pa & -8 | 3;
+ a.ba()
+ }
+}
+
+function Qb(a, b) {
+ if (a.i < a.a) {
+ var c = 1 === b ? a.data[a.i] : 2 === b ? a.oa[a.i >>> 1] : a.Z[a.i >>> 2];
+ a.i += b;
+ a.i >= a.a && (160 === a.v ? a.a === a.g ? (a.status = 80, a.pa = a.pa & -8 | 3, a.ba()) : (a.status = 88, a.pa = a.pa & -8 | 2, a.ba(), b = a.Ga << 8 & 65280 | a.Da & 255, a.a + b > a.g ? (a.Da = a.g - a.a & 255, a.Ga = a.g - a.a >> 8 & 255, a.a = a.g) : a.a += b) : (a.error = 0, a.i >= a.g ? a.status = 80 : (b = 196 === a.v || 41 === a.v ? Math.min(a.W, (a.g - a.a) / 512) : 1, cc(a, a.v, b), a.a += 512 * b, a.status = 88), a.ba()));
+ return c
+ }
+ a.i += b;
+ return 0
+}
+
+function Rb(a, b, c) {
+ if (!(a.i >= a.a) && (1 === c ? a.data[a.i++] = b : 2 === c ? (a.oa[a.i >>> 1] = b, a.i += 2) : (a.Z[a.i >>> 2] = b, a.i += 4), a.i === a.a))
+ if (160 === a.v) {
+ a.i = 0;
+ a.ka = a.data[0];
+ switch (a.ka) {
+ case 0:
+ Xb(a, 0);
+ a.a = a.g;
+ a.status = 80;
+ break;
+ case 3:
+ Xb(a, a.data[4]);
+ a.a = a.g;
+ a.status = 88;
+ a.data[0] = 240;
+ a.data[2] = 5;
+ a.data[7] = 8;
+ break;
+ case 18:
+ b = a.data[4];
+ a.status = 88;
+ a.data.set([5, 128, 1, 49, 31, 0, 0, 0, 83, 79, 78, 89, 32, 32, 32, 32, 67, 68, 45, 82, 79, 77, 32, 67, 68, 85, 45, 49, 48, 48, 48, 32, 49, 46, 49, 97]);
+ a.a = a.g = Math.min(36, b);
+ break;
+ case 26:
+ Xb(a, a.data[4]);
+ a.a = a.g;
+ a.status = 88;
+ break;
+ case 30:
+ Xb(a, 0);
+ a.a = a.g;
+ a.status = 80;
+ break;
+ case 37:
+ b = a.l - 1;
+ gc(a, new Uint8Array([b >> 24 & 255, b >> 16 & 255, b >> 8 & 255, b & 255, 0, 0, a.m >> 8 & 255, a.m & 255]));
+ a.a = a.g;
+ a.status = 88;
+ break;
+ case 40:
+ a.ud & 1 ? ic(a, a.data) : ec(a, a.data);
+ break;
+ case 66:
+ b = a.data[8];
+ Xb(a, Math.min(8, b));
+ a.a = a.g;
+ a.status = 88;
+ break;
+ case 67:
+ b = a.data[8] | a.data[7] << 8;
+ c = a.data[9] >> 6;
+ Xb(a, b);
+ a.a = a.g;
+ 0 === c ? (b = a.l, a.data.set(new Uint8Array([0, 18, 1, 1, 0, 20, 1, 0, 0, 0, 0, 0, 0, 22, 170, 0, b >> 24, b >> 16 & 255, b >> 8 & 255, b & 255]))) : 1 === c && a.data.set(new Uint8Array([0,
+ 10, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0
+ ]));
+ a.status = 88;
+ break;
+ case 70:
+ b = a.data[8] | a.data[7] << 8;
+ b = Math.min(b, 32);
+ Xb(a, b);
+ a.a = a.g;
+ a.data[0] = b - 4 >> 24 & 255;
+ a.data[1] = b - 4 >> 16 & 255;
+ a.data[2] = b - 4 >> 8 & 255;
+ a.data[3] = b - 4 & 255;
+ a.data[6] = 8;
+ a.data[10] = 3;
+ a.status = 88;
+ break;
+ case 81:
+ Xb(a, 0);
+ a.a = a.g;
+ a.status = 80;
+ break;
+ case 82:
+ a.status = 81;
+ a.g = 0;
+ a.error = 80;
+ break;
+ case 90:
+ b = a.data[8] | a.data[7] << 8;
+ 42 === a.data[2] && Xb(a, Math.min(30, b));
+ a.a = a.g;
+ a.status = 88;
+ break;
+ case 189:
+ Xb(a, a.data[9] | a.data[8] << 8);
+ a.a = a.g;
+ a.data[5] = 1;
+ a.status = 88;
+ break;
+ case 74:
+ a.status =
+ 81;
+ a.g = 0;
+ a.error = 80;
+ break;
+ default:
+ a.status = 81, a.g = 0, a.error = 80
+ }
+ a.pa = a.pa & -8 | 2;
+ 0 === (a.status & 128) && a.ba();
+ 0 === (a.status & 128) && 0 === a.g && (a.pa |= 1, a.status &= -9)
+ } else a.i >= a.g ? a.Me() : (a.status = 88, a.a += 512, a.ba())
+}
+
+function cc(a, b, c) {
+ a.pa -= c;
+ 36 === b || 41 === b || 52 === b || 57 === b || 37 === b || 53 === b ? (b = c + kc(a), a.Na = b & 255 | b >> 16 & 65280, a.Da = b >> 8 & 255, a.Ga = b >> 16 & 255) : a.le ? (b = c + lc(a), a.Na = b & 255, a.Da = b >> 8 & 255, a.Ga = b >> 16 & 255, a.head = a.head & -16 | b & 15) : (b = c + mc(a), c = b / (a.J * a.C) | 0, a.Da = c & 255, a.Ga = c >> 8 & 255, a.head = (b / a.C | 0) % a.J & 15, a.Na = b % a.C + 1 & 255, mc(a))
+}
+
+function Tb(a, b) {
+ var c = 36 === b || 41 === b,
+ d = Ub(a, c);
+ c = Vb(a, c);
+ var e = 32 === b || 36 === b,
+ f = d * a.m;
+ c *= a.m;
+ c + f > a.buffer.byteLength ? (a.status = 255, a.ba()) : (a.status = 192, fc(a), a.buffer.get(c, f, function(c) {
+ gc(a, c);
+ a.status = 88;
+ a.a = e ? 512 : Math.min(f, 512 * a.W);
+ cc(a, b, e ? 1 : Math.min(d, a.C));
+ a.ba();
+ hc(a, f)
+ }))
+}
+
+function $b(a) {
+ var b = 37 === a.v,
+ c = Ub(a, b);
+ b = Vb(a, b);
+ var d = c * a.m;
+ b *= a.m;
+ fc(a);
+ a.buffer.get(b, d, function(b) {
+ var e = a.ia.Dd,
+ h = 0;
+ do {
+ var g = jc(a.j, e),
+ p = a.j.ma(e + 4),
+ r = a.j.ja(e + 7) & 128;
+ p || (p = 65536);
+ a.j.da.set(b.subarray(h, h + p), g);
+ h += p;
+ e += 8
+ } while (!r);
+ cc(a, a.v, c);
+ a.status = 80;
+ a.ia.Ha &= -2;
+ a.v = -1;
+ a.ba();
+ hc(a, d)
+ })
+}
+
+function ac(a) {
+ var b = 53 === a.v,
+ c = Ub(a, b),
+ d = Vb(a, b);
+ b = c * a.m;
+ d *= a.m;
+ var e = a.ia.Dd,
+ f = 0,
+ h = 0,
+ g = 0;
+ do {
+ var p = jc(a.j, e),
+ r = a.j.ma(e + 4),
+ v = a.j.ja(e + 7) & 128;
+ r || (r = 65536);
+ a.buffer.set(d + g, a.j.da.subarray(p, p + r), function() {
+ h++
+ });
+ g += r;
+ e += 8;
+ f++
+ } while (!v);
+ h === f && (cc(a, a.v, c), a.status = 80, a.ba(), a.ia.Ha &= -2, a.v = -1);
+ dc(a, b)
+}
+
+function mc(a) {
+ return ((a.Da & 255 | a.Ga << 8 & 65280) * a.J + a.head) * a.C + (a.Na & 255) - 1
+}
+
+function lc(a) {
+ return a.Na & 255 | a.Da << 8 & 65280 | a.Ga << 16 & 16711680 | (a.head & 15) << 24
+}
+
+function kc(a) {
+ return (a.Na & 255 | a.Da << 8 & 65280 | a.Ga << 16 & 16711680 | a.Na >> 8 << 24 & 4278190080) >>> 0
+}
+
+function Vb(a, b) {
+ return b ? kc(a) : a.le ? lc(a) : mc(a)
+}
+
+function Ub(a, b) {
+ b ? (a = a.pa, 0 === a && (a = 65536)) : (a = a.pa & 255, 0 === a && (a = 256));
+ return a
+}
+
+function Yb(a) {
+ if (a.Mc & 16) Xb(a, 0);
+ else {
+ for (var b = 0; 512 > b; b++) a.data[b] = 0;
+ b = Math.min(16383, a.O);
+ gc(a, [64, a.R ? 133 : 0, b, b >> 8, 0, 0, a.J, a.J >> 8, a.C / 512, a.C / 512 >> 8, 0, 2, a.C, a.C >> 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 118, 32, 54, 68, 72, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 128, 0, 1, 0, 0, 2, 0, 0, 0, 2, 0, 2, 7, 0, b, b >> 8, a.J, a.J >> 8, a.C, 0, a.l & 255, a.l >> 8 & 255, a.l >> 16 & 255, a.l >> 24 & 255, 0, 0, a.l & 255, a.l >> 8 & 255, a.l >> 16 & 255,
+ a.l >> 24 & 255, 0, 0, 160 === a.v ? 0 : 7, 160 === a.v ? 0 : 4, 0, 0, 30, 0, 30, 0, 30, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 0, 0, 0, 0, 0, 0, 116, 0, 64, 0, 64, 0, 116, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a.l & 255, a.l >> 8 & 255, a.l >> 16 & 255, a.l >> 24 & 255
+ ]);
+ a.g = 512;
+ a.a = 512
+ }
+}
+
+function Xb(a, b) {
+ Wb(a, b);
+ for (var c = 0; c < b + 3 >> 2; c++) a.Z[c] = 0
+}
+
+function Wb(a, b) {
+ a.data.length < b && (a.data = new Uint8Array(b + 3 & -4), a.oa = new Uint16Array(a.data.buffer), a.Z = new Int32Array(a.data.buffer));
+ a.g = b;
+ a.i = 0
+}
+
+function gc(a, b) {
+ Wb(a, b.length);
+ a.data.set(b)
+}
+
+function fc(a) {
+ a.Oa.Yg = !0;
+ a.w.send("ide-read-start")
+}
+
+function hc(a, b) {
+ a.Oa.Yg = !1;
+ var c = b / a.m | 0;
+ a.Oa.Eh += c;
+ a.Oa.Bg += b;
+ a.w.send("ide-read-end", [a.Fa, b, c])
+}
+
+function dc(a, b) {
+ var c = b / a.m | 0;
+ a.Oa.Fh += c;
+ a.Oa.Cg += b;
+ a.w.send("ide-write-end", [a.Fa, b, c])
+}
+Ob.prototype.Sa = function() {
+ var a = [];
+ a[0] = this.pa;
+ a[1] = this.O;
+ a[2] = this.Ga;
+ a[3] = this.Da;
+ a[4] = this.i;
+ a[5] = 0;
+ a[6] = 0;
+ a[7] = 0;
+ a[8] = 0;
+ a[9] = this.Mc;
+ a[10] = this.error;
+ a[11] = this.head;
+ a[12] = this.J;
+ a[13] = this.R;
+ a[14] = this.le;
+ a[15] = this.ud;
+ a[16] = this.data;
+ a[17] = this.g;
+ a[18] = this.Na;
+ a[19] = this.l;
+ a[20] = this.m;
+ a[21] = this.W;
+ a[22] = this.C;
+ a[23] = this.status;
+ a[24] = this.qa;
+ a[25] = this.v;
+ a[26] = this.a;
+ a[27] = this.ka;
+ return a
+};
+Ob.prototype.fb = function(a) {
+ this.pa = a[0];
+ this.O = a[1];
+ this.Ga = a[2];
+ this.Da = a[3];
+ this.i = a[4];
+ this.Mc = a[9];
+ this.error = a[10];
+ this.head = a[11];
+ this.J = a[12];
+ this.R = a[13];
+ this.le = a[14];
+ this.ud = a[15];
+ this.data = a[16];
+ this.g = a[17];
+ this.Na = a[18];
+ this.l = a[19];
+ this.m = a[20];
+ this.W = a[21];
+ this.C = a[22];
+ this.status = a[23];
+ this.qa = a[24];
+ this.v = a[25];
+ this.a = a[26];
+ this.ka = a[27];
+ this.oa = new Uint16Array(this.data.buffer);
+ this.Z = new Int32Array(this.data.buffer)
+};
+
+function nc(a) {
+ this.mc = new Uint8Array(4);
+ this.a = new Uint8Array(4);
+ this.zd = new Uint8Array(4);
+ this.Ad = new Uint8Array(4);
+ this.yd = new Int32Array(this.mc.buffer);
+ new Int32Array(this.a.buffer);
+ this.eh = new Int32Array(this.zd.buffer);
+ this.gh = new Int32Array(this.Ad.buffer);
+ this.fc = [];
+ this.G = [];
+ this.j = a;
+ for (var b = 0; 256 > b; b++) this.fc[b] = void 0, this.G[b] = void 0;
+ this.o = a.o;
+ n(a.o, 3324, this, function(a) {
+ oc(this, this.yd[0], a)
+ }, function(a) {
+ pc(this, this.yd[0], a)
+ }, function(a) {
+ var b = this.yd[0],
+ c = b >> 8 & 65535,
+ f = b & 255;
+ b =
+ this.fc[c];
+ c = this.G[c];
+ if (b)
+ if (16 <= f && 40 > f)
+ if (c = c.nc[f - 16 >> 2]) {
+ f >>= 2;
+ var h = b[f] & 1; - 1 === (a | 3 | c.size - 1) ? (a = ~(c.size - 1) | h, 0 === h && (b[f] = a)) : 0 === h && (b[f] = c.dh);
+ 1 === h && (qc(this, c, b[f] & 65534, a & 65534), b[f] = a | 1)
+ } else b[f >> 2] = 0;
+ else 48 === f ? b[f >> 2] = c.fh ? -1 === (a | 2047) ? -c.fh | 0 : c.Ei | 0 : 0 : b[f >>> 2] = a
+ });
+ n(a.o, 3325, this, function(a) {
+ oc(this, this.yd[0] + 1 | 0, a)
+ });
+ n(a.o, 3326, this, function(a) {
+ oc(this, this.yd[0] + 2 | 0, a)
+ }, function(a) {
+ pc(this, this.yd[0] + 2 | 0, a)
+ });
+ n(a.o, 3327, this, function(a) {
+ oc(this, this.yd[0] + 3 | 0, a)
+ });
+ a.o.te(3324,
+ this,
+ function() {
+ return this.zd[0]
+ },
+ function() {
+ return this.zd[1]
+ },
+ function() {
+ return this.zd[2]
+ },
+ function() {
+ return this.zd[3]
+ });
+ a.o.te(3320, this, function() {
+ return this.Ad[0]
+ }, function() {
+ return this.Ad[1]
+ }, function() {
+ return this.Ad[2]
+ }, function() {
+ return this.Ad[3]
+ });
+ a.o.Gc(3320, this, function(a) {
+ this.mc[0] = a & 252
+ }, function(a) {
+ this.mc[1] = a
+ }, function(a) {
+ this.mc[2] = a
+ }, function(a) {
+ this.mc[3] = a;
+ a = this.mc[0] & 252;
+ var b = this.fc[this.mc[2] << 8 | this.mc[1]];
+ void 0 !== b ? (this.gh[0] = -2147483648, this.eh[0] = a < b.byteLength ?
+ b[a >> 2] : 0) : (this.eh[0] = -1, this.gh[0] = 0)
+ });
+ Zb(this, {
+ Hb: 0,
+ pe: [134, 128, 55, 18, 0, 0, 0, 0, 2, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ nc: [],
+ name: "82441FX PMC"
+ });
+ this.i = {
+ Hb: 8,
+ pe: [134, 128, 0, 112, 7, 0, 0, 2, 0, 0, 1, 6, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ nc: [],
+ name: "82371SB PIIX3 ISA"
+ };
+ this.l = Zb(this, this.i);
+ this.g = new Uint8Array(this.l.buffer)
+}
+nc.prototype.Sa = function() {
+ for (var a = [], b = 0; 256 > b; b++) a[b] = this.fc[b];
+ a[256] = this.mc;
+ a[257] = this.a;
+ a[258] = this.zd;
+ a[259] = this.Ad;
+ return a
+};
+nc.prototype.fb = function(a) {
+ for (var b = 0; 256 > b; b++) {
+ var c = this.G[b],
+ d = a[b];
+ if (c && d) {
+ for (var e = 0; e < c.nc.length; e++) {
+ var f = d[4 + e];
+ if (f & 1) {
+ var h = c.nc[e];
+ qc(this, h, h.dh & 65534, f & 65534)
+ }
+ }
+ this.fc[b].set(d)
+ }
+ }
+ this.mc.set(a[256]);
+ this.a.set(a[257]);
+ this.zd.set(a[258]);
+ this.Ad.set(a[259])
+};
+
+function oc(a, b, c) {
+ var d = b & 255;
+ (new Uint8Array(a.fc[b >> 8 & 65535].buffer))[d] = c
+}
+
+function pc(a, b, c) {
+ var d = b & 255;
+ (new Uint16Array(a.fc[b >> 8 & 65535].buffer))[d >>> 1] = c
+}
+
+function Zb(a, b) {
+ var c = b.Hb,
+ d = new Int32Array(64);
+ d.set(new Int32Array((new Uint8Array(b.pe)).buffer));
+ a.fc[c] = d;
+ a.G[c] = b;
+ c = d.slice(4, 10);
+ for (var e = 0; e < b.nc.length; e++) {
+ var f = b.nc[e];
+ if (f) {
+ var h = c[e],
+ g = h & 1;
+ f.dh = h;
+ f.entries = [];
+ if (0 !== g)
+ for (h &= -2, g = 0; g < f.size; g++) f.entries[g] = a.o.ports[h + g]
+ }
+ }
+ return d
+}
+
+function qc(a, b, c, d) {
+ for (var e = b.size, f = a.o.ports, h = 0; h < e; h++) f[c + h] = Oa(a.o), f[d + h] = b.entries[h]
+}
+nc.prototype.xb = function(a) {
+ this.j.Cb(this.g[96 + ((this.fc[a][15] >> 8 & 255) - 1 + ((a >> 3) - 1 & 255) & 3)])
+};
+
+function rc(a, b) {
+ Pb(a.j, a.g[96 + ((a.fc[b][15] >> 8 & 255) + (b >> 3 & 255) - 2 & 3)])
+};
+
+function sc(a, b) {
+ this.o = a.o;
+ this.j = a;
+ this.Ub = a.G.Ub;
+ this.g = 0;
+ this.ka = new Uint8Array(10);
+ this.oa = 0;
+ this.l = null;
+ this.a = new Uint8Array(10);
+ this.C = this.m = this.i = 0;
+ this.W = b;
+ this.Z = this.O = this.Xa = this.Bb = this.Za = this.Ya = 0;
+ this.qa = 1;
+ this.v = 0;
+ if (b) {
+ this.C = b.byteLength;
+ var c;
+ if ((c = {
+ 160: {
+ type: 1,
+ bc: 40,
+ ac: 8,
+ Yb: 1
+ },
+ 180: {
+ type: 1,
+ bc: 40,
+ ac: 9,
+ Yb: 1
+ },
+ 200: {
+ type: 1,
+ bc: 40,
+ ac: 10,
+ Yb: 1
+ },
+ 320: {
+ type: 1,
+ bc: 40,
+ ac: 8,
+ Yb: 2
+ },
+ 360: {
+ type: 1,
+ bc: 40,
+ ac: 9,
+ Yb: 2
+ },
+ 400: {
+ type: 1,
+ bc: 40,
+ ac: 10,
+ Yb: 2
+ },
+ 720: {
+ type: 3,
+ bc: 80,
+ ac: 9,
+ Yb: 2
+ },
+ 1200: {
+ type: 2,
+ bc: 80,
+ ac: 15,
+ Yb: 2
+ },
+ 1440: {
+ type: 4,
+ bc: 80,
+ ac: 18,
+ Yb: 2
+ },
+ 1722: {
+ type: 5,
+ bc: 82,
+ ac: 21,
+ Yb: 2
+ },
+ 2880: {
+ type: 5,
+ bc: 80,
+ ac: 36,
+ Yb: 2
+ }
+ }[this.C >> 10]) && 0 === (this.C & 1023)) a.G.bd.ha[16] = c.type << 4, a = c.ac, b = c.Yb, c = c.bc;
+ else throw "Unknown floppy size: " + jb(b.byteLength);
+ this.J = a;
+ this.R = b;
+ this.Fa = c
+ } else a.G.bd.ha[16] = 64, this.C = this.Fa = this.R = this.J = 0;
+ m(this.o, 1008, this, this.Oj);
+ m(this.o, 1010, this, this.Pj);
+ m(this.o, 1012, this, this.Rj);
+ m(this.o, 1013, this, this.Sj);
+ m(this.o, 1015, this, this.Uj);
+ n(this.o, 1010, this, this.Qj);
+ n(this.o, 1013, this, this.Tj)
+}
+k = sc.prototype;
+k.Sa = function() {
+ var a = [];
+ a[0] = this.g;
+ a[1] = this.ka;
+ a[2] = this.oa;
+ a[4] = this.a;
+ a[5] = this.i;
+ a[6] = this.m;
+ a[7] = this.C;
+ a[8] = this.Ya;
+ a[9] = this.Za;
+ a[10] = this.Bb;
+ a[11] = this.Xa;
+ a[12] = this.O;
+ a[13] = this.Z;
+ a[14] = this.qa;
+ a[15] = this.v;
+ a[16] = this.J;
+ a[17] = this.R;
+ a[18] = this.Fa;
+ return a
+};
+k.fb = function(a) {
+ this.g = a[0];
+ this.ka = a[1];
+ this.oa = a[2];
+ this.l = a[3];
+ this.a = a[4];
+ this.i = a[5];
+ this.m = a[6];
+ this.C = a[7];
+ this.Ya = a[8];
+ this.Za = a[9];
+ this.Bb = a[10];
+ this.Xa = a[11];
+ this.O = a[12];
+ this.Z = a[13];
+ this.qa = a[14];
+ this.v = a[15];
+ this.J = a[16];
+ this.R = a[17];
+ this.Fa = a[18]
+};
+k.Oj = function() {
+ return 0
+};
+k.Rj = function() {
+ var a = 128;
+ this.i < this.m && (a |= 80);
+ 0 === (this.v & 8) && (a |= 32);
+ return a
+};
+k.Uj = function() {
+ return 0
+};
+k.Sj = function() {
+ return this.i < this.m ? (Pb(this.j, 6), this.a[this.i++]) : 255
+};
+k.Tj = function(a) {
+ if (this.W)
+ if (0 < this.g) this.ka[this.oa++] = a, this.g--, 0 === this.g && this.l.call(this, this.ka);
+ else {
+ switch (a) {
+ case 3:
+ this.l = this.li;
+ this.g = 2;
+ break;
+ case 4:
+ this.l = this.Qh;
+ this.g = 1;
+ break;
+ case 5:
+ case 197:
+ this.l = function(a) {
+ tc(this, !0, a)
+ };
+ this.g = 8;
+ break;
+ case 230:
+ this.l = function(a) {
+ tc(this, !1, a)
+ };
+ this.g = 8;
+ break;
+ case 7:
+ this.l = this.Ph;
+ this.g = 1;
+ break;
+ case 8:
+ this.i = 0;
+ this.m = 2;
+ this.a[0] = 32;
+ this.a[1] = this.O;
+ break;
+ case 74:
+ this.l = this.fk;
+ this.g = 1;
+ break;
+ case 15:
+ this.g = 2;
+ this.l = this.Kh;
+ break;
+ case 14:
+ this.a[0] =
+ 128, this.i = 0, this.m = 1, this.g = 0
+ }
+ this.oa = 0
+ }
+};
+k.Pj = function() {
+ return this.v
+};
+k.Qj = function(a) {
+ 4 === (a & 4) && 0 === (this.v & 4) && this.j.Cb(6);
+ this.v = a
+};
+k.Qh = function() {
+ this.i = 0;
+ this.m = 1;
+ this.a[0] = 32
+};
+k.Kh = function(a) {
+ this.O = a[1];
+ this.Z = a[0] >> 2 & 1;
+ this.xb()
+};
+k.Ph = function() {
+ this.xb()
+};
+
+function tc(a, b, c) {
+ var d = c[2],
+ e = c[1],
+ f = c[3],
+ h = 128 << c[4],
+ g = c[5] - c[3] + 1,
+ p = ((d + a.R * e) * a.J + f - 1) * h;
+ a.W && (b ? a.Ub.Me(a.W, p, g * h, 2, a.done.bind(a, c, e, d, f)) : uc(a.Ub, a.W, p, a.done.bind(a, c, e, d, f)))
+}
+k.done = function(a, b, c, d, e) {
+ e || (d++, d > this.J && (d = 1, c++, c >= this.R && (c = 0, b++)), this.O = b, this.Z = c, this.qa = d, this.i = 0, this.m = 7, this.a[0] = c << 2 | 32, this.a[1] = 0, this.a[2] = 0, this.a[3] = b, this.a[4] = c, this.a[5] = d, this.a[6] = a[4], this.xb())
+};
+k.li = function() {};
+k.fk = function() {
+ this.i = 0;
+ this.m = 7;
+ this.a[0] = 0;
+ this.a[1] = 0;
+ this.a[2] = 0;
+ this.a[3] = 0;
+ this.a[4] = 0;
+ this.a[5] = 0;
+ this.a[6] = 0;
+ this.xb()
+};
+k.xb = function() {
+ this.v & 8 && this.j.Cb(6)
+};
+
+function vc(a, b) {
+ a = a.Ye[b >>> 17];
+ return a(b) | a(b + 1 | 0) << 8
+}
+
+function wc(a, b, c) {
+ a = a.Ze[b >>> 17];
+ a(b, c & 255);
+ a(b + 1 | 0, c >> 8 & 255)
+}
+
+function Ra(a, b) {
+ return 655360 <= (b | 0) && 786432 > (b | 0) || b >>> 0 >= a.Ia >>> 0
+}
+k = q.prototype;
+k.ja = function(a) {
+ return Ra(this, a) ? this.Ye[a >>> 17](a) : this.da[a]
+};
+k.ma = function(a) {
+ return Ra(this, a) ? vc(this, a) : this.da[a] | this.da[a + 1 | 0] << 8
+};
+
+function xc(a, b) {
+ return Ra(a, b << 1) ? vc(a, b << 1) : a.Ef[b]
+}
+
+function jc(a, b) {
+ return Ra(a, b) ? a.Ff[b >>> 17](b) : a.da[b] | a.da[b + 1 | 0] << 8 | a.da[b + 2 | 0] << 16 | a.da[b + 3 | 0] << 24
+}
+
+function yc(a, b) {
+ Ra(a, b << 2) ? (b <<= 2, a = a.Ff[b >>> 17](b)) : a = a.Cc[b];
+ return a
+}
+k.za = function(a, b) {
+ if (Ra(this, a)) this.Ze[a >>> 17](a, b);
+ else this.da[a] = b
+};
+k.ze = function(a, b) {
+ Ra(this, a) ? wc(this, a, b) : (this.da[a] = b, this.da[a + 1 | 0] = b >> 8)
+};
+
+function zc(a, b, c) {
+ Ra(a, b << 1) ? wc(a, b << 1, c) : a.Ef[b] = c
+}
+k.fd = function(a, b) {
+ if (Ra(this, a)) this.Gf[a >>> 17](a, b);
+ else this.da[a] = b, this.da[a + 1 | 0] = b >> 8, this.da[a + 2 | 0] = b >> 16, this.da[a + 3 | 0] = b >> 24
+};
+
+function Ac(a, b, c) {
+ Ra(a, b << 2) ? (b <<= 2, a.Gf[b >>> 17](b, c)) : a.Cc[b] = c
+};
+
+function Bc(a) {
+ this.j = a;
+ this.v = new Uint8Array(8);
+ this.C = new Uint8Array(8);
+ this.a = new Uint16Array(8);
+ this.l = new Uint16Array(8);
+ this.g = new Uint16Array(8);
+ this.m = new Uint16Array(8);
+ this.vc = new Uint8Array(8);
+ this.J = new Uint8Array(8);
+ this.Wf = [];
+ this.i = 0;
+ a = a.o;
+ n(a, 0, this, this.Xc.bind(this, 0));
+ n(a, 2, this, this.Xc.bind(this, 1));
+ n(a, 4, this, this.Xc.bind(this, 2));
+ n(a, 6, this, this.Xc.bind(this, 3));
+ n(a, 1, this, this.Zc.bind(this, 0));
+ n(a, 3, this, this.Zc.bind(this, 1));
+ n(a, 5, this, this.Zc.bind(this, 2));
+ n(a, 7, this, this.Zc.bind(this,
+ 3));
+ m(a, 0, this, this.Wc.bind(this, 0));
+ m(a, 2, this, this.Wc.bind(this, 1));
+ m(a, 4, this, this.Wc.bind(this, 2));
+ m(a, 6, this, this.Wc.bind(this, 3));
+ m(a, 1, this, this.Yc.bind(this, 0));
+ m(a, 3, this, this.Yc.bind(this, 1));
+ m(a, 5, this, this.Yc.bind(this, 2));
+ m(a, 7, this, this.Yc.bind(this, 3));
+ n(a, 192, this, this.Xc.bind(this, 4));
+ n(a, 196, this, this.Xc.bind(this, 5));
+ n(a, 200, this, this.Xc.bind(this, 6));
+ n(a, 204, this, this.Xc.bind(this, 7));
+ n(a, 194, this, this.Zc.bind(this, 4));
+ n(a, 198, this, this.Zc.bind(this, 5));
+ n(a, 202, this, this.Zc.bind(this,
+ 6));
+ n(a, 206, this, this.Zc.bind(this, 7));
+ m(a, 192, this, this.Wc.bind(this, 4));
+ m(a, 196, this, this.Wc.bind(this, 5));
+ m(a, 200, this, this.Wc.bind(this, 6));
+ m(a, 204, this, this.Wc.bind(this, 7));
+ m(a, 194, this, this.Yc.bind(this, 4));
+ m(a, 198, this, this.Yc.bind(this, 5));
+ m(a, 202, this, this.Yc.bind(this, 6));
+ m(a, 206, this, this.Yc.bind(this, 7));
+ n(a, 135, this, this.ad.bind(this, 0));
+ n(a, 131, this, this.ad.bind(this, 1));
+ n(a, 129, this, this.ad.bind(this, 2));
+ n(a, 130, this, this.ad.bind(this, 3));
+ n(a, 143, this, this.ad.bind(this, 4));
+ n(a, 139,
+ this, this.ad.bind(this, 5));
+ n(a, 137, this, this.ad.bind(this, 6));
+ n(a, 138, this, this.ad.bind(this, 7));
+ m(a, 135, this, this.$c.bind(this, 0));
+ m(a, 131, this, this.$c.bind(this, 1));
+ m(a, 129, this, this.$c.bind(this, 2));
+ m(a, 130, this, this.$c.bind(this, 3));
+ m(a, 143, this, this.$c.bind(this, 4));
+ m(a, 139, this, this.$c.bind(this, 5));
+ m(a, 137, this, this.$c.bind(this, 6));
+ m(a, 138, this, this.$c.bind(this, 7));
+ n(a, 1159, this, this.Cd.bind(this, 0));
+ n(a, 1155, this, this.Cd.bind(this, 1));
+ n(a, 1153, this, this.Cd.bind(this, 2));
+ n(a, 1154, this, this.Cd.bind(this,
+ 3));
+ n(a, 1163, this, this.Cd.bind(this, 5));
+ n(a, 1161, this, this.Cd.bind(this, 6));
+ n(a, 1162, this, this.Cd.bind(this, 7));
+ m(a, 1159, this, this.Bd.bind(this, 0));
+ m(a, 1155, this, this.Bd.bind(this, 1));
+ m(a, 1153, this, this.Bd.bind(this, 2));
+ m(a, 1154, this, this.Bd.bind(this, 3));
+ m(a, 1163, this, this.Bd.bind(this, 5));
+ m(a, 1161, this, this.Bd.bind(this, 6));
+ m(a, 1162, this, this.Bd.bind(this, 7));
+ n(a, 10, this, this.rh.bind(this, 0));
+ n(a, 212, this, this.rh.bind(this, 4));
+ n(a, 15, this, this.qh.bind(this, 0));
+ n(a, 222, this, this.qh.bind(this, 4));
+ m(a, 15, this, this.ph.bind(this, 0));
+ m(a, 222, this, this.ph.bind(this, 4));
+ n(a, 11, this, this.oh.bind(this, 0));
+ n(a, 214, this, this.oh.bind(this, 4));
+ n(a, 12, this, this.nh);
+ n(a, 216, this, this.nh)
+}
+k = Bc.prototype;
+k.Sa = function() {
+ return [this.v, this.C, this.a, this.l, this.g, this.m, this.vc, this.J, this.i]
+};
+k.fb = function(a) {
+ this.v = a[0];
+ this.C = a[1];
+ this.a = a[2];
+ this.l = a[3];
+ this.g = a[4];
+ this.m = a[5];
+ this.vc = a[6];
+ this.J = a[7];
+ this.i = a[8]
+};
+k.Zc = function(a, b) {
+ this.g[a] = Cc(this, this.g[a], b, !1);
+ this.m[a] = Cc(this, this.m[a], b, !0)
+};
+k.Yc = function(a) {
+ return Dc(this, this.g[a])
+};
+k.Xc = function(a, b) {
+ this.a[a] = Cc(this, this.a[a], b, !1);
+ this.l[a] = Cc(this, this.l[a], b, !0)
+};
+k.Wc = function(a) {
+ return Dc(this, this.a[a])
+};
+k.Cd = function(a, b) {
+ this.C[a] = b
+};
+k.Bd = function(a) {
+ return this.C[a]
+};
+k.ad = function(a, b) {
+ this.v[a] = b
+};
+k.$c = function(a) {
+ return this.v[a]
+};
+k.rh = function(a, b) {
+ Ec(this, (b & 3) + a, b & 4 ? 1 : 0)
+};
+k.qh = function(a, b) {
+ for (var c = 0; 4 > c; c++) Ec(this, a + c, b & 1 << c)
+};
+k.ph = function(a) {
+ var b = 0 | this.vc[a + 0];
+ b |= this.vc[a + 1] << 1;
+ b |= this.vc[a + 2] << 2;
+ return b |= this.vc[a + 3] << 3
+};
+k.oh = function(a, b) {
+ this.J[(b & 3) + a] = b
+};
+k.nh = function() {
+ this.i = 0
+};
+
+function Ec(a, b, c) {
+ if (a.vc[b] !== c && (a.vc[b] = c, !c))
+ for (c = 0; c < a.Wf.length; c++) a.Wf[c].wf.call(a.Wf[c].xg, b)
+}
+
+function uc(a, b, c, d) {
+ var e = a.g[2] + 1,
+ f = Fc(a, 2);
+ if (c + e > b.byteLength) d(!0);
+ else {
+ var h = a.j;
+ a.a[2] += e;
+ b.get(c, e, function(a) {
+ h.da.set(a, f);
+ d(!1)
+ })
+ }
+}
+k.Me = function(a, b, c, d, e) {
+ var f = this,
+ h = this.g[d] + 1 & 65535,
+ g = 5 <= d ? 2 : 1,
+ p = h * g,
+ r = Fc(this, d),
+ v = !1,
+ E = !1,
+ z = this.J[d] & 16;
+ c < p ? (h = Math.floor(c / g), p = h * g, v = !0) : c > p && (E = !0);
+ b + p > a.byteLength ? e(!0) : (this.a[d] += h, this.g[d] -= h, !v && z && (this.a[d] = this.l[d], this.g[d] = this.m[d]), a.set(b, this.j.da.subarray(r, r + p), function() {
+ E && z ? f.Me(a, b + p, c - p, d, e) : e(!1)
+ }))
+};
+
+function Fc(a, b) {
+ var c = a.a[b];
+ 5 <= b && (c <<= 1);
+ c = c & 65535 | a.v[b] << 16;
+ return c |= a.C[b] << 24
+}
+
+function Cc(a, b, c, d) {
+ d || (a.i ^= 1);
+ return a.i ? b & -256 | c : b & -65281 | c << 8
+}
+
+function Dc(a, b) {
+ a.i ^= 1;
+ return a.i ? b & 255 : b >> 8 & 255
+};
+
+function Ic(a, b) {
+ this.j = a;
+ this.w = b;
+ this.m = new Float64Array(3);
+ this.v = new Uint16Array(3);
+ this.g = new Uint8Array(4);
+ this.l = new Uint8Array(4);
+ this.i = new Uint8Array(4);
+ this.O = new Uint8Array(4);
+ this.C = new Uint8Array(4);
+ this.J = new Uint16Array(3);
+ this.a = new Uint16Array(3);
+ m(a.o, 97, this, function() {
+ var a = $a(),
+ b = 66.66666666666667 * a & 1;
+ a = Jc(this, 2, a);
+ return b << 4 | a << 5
+ });
+ n(a.o, 97, this, function(a) {
+ this.w.send("pcspeaker-enable", a & 1)
+ });
+ m(a.o, 64, this, function() {
+ return Kc(this, 0)
+ });
+ m(a.o, 65, this, function() {
+ return Kc(this,
+ 1)
+ });
+ m(a.o, 66, this, function() {
+ return Kc(this, 2)
+ });
+ n(a.o, 64, this, function(a) {
+ Lc(this, 0, a)
+ });
+ n(a.o, 65, this, function(a) {
+ Lc(this, 1, a)
+ });
+ n(a.o, 66, this, function(a) {
+ Lc(this, 2, a)
+ });
+ n(a.o, 67, this, this.R)
+}
+Ic.prototype.Sa = function() {
+ var a = [];
+ a[0] = this.g;
+ a[1] = this.l;
+ a[2] = this.i;
+ a[3] = this.O;
+ a[4] = this.C;
+ a[5] = this.J;
+ a[6] = this.a;
+ a[7] = this.m;
+ a[8] = this.v;
+ return a
+};
+Ic.prototype.fb = function(a) {
+ this.g = a[0];
+ this.l = a[1];
+ this.i = a[2];
+ this.O = a[3];
+ this.C = a[4];
+ this.J = a[5];
+ this.a = a[6];
+ this.m = a[7];
+ this.v = a[8]
+};
+Ic.prototype.Ic = function(a, b) {
+ b || (this.l[0] && Jc(this, 0, a) ? (this.v[0] = Mc(this, 0, a), this.m[0] = a, this.j.Cb(0), 0 === this.i[0] && (this.l[0] = 0)) : Pb(this.j, 0))
+};
+
+function Mc(a, b, c) {
+ if (!a.l[b]) return 0;
+ c = a.v[b] - Math.floor(1193.1816666 * (c - a.m[b]));
+ a = a.a[b];
+ c >= a ? c %= a : 0 > c && (c = c % a + a);
+ return c
+}
+
+function Jc(a, b, c) {
+ c -= a.m[b];
+ return 0 > c ? !0 : a.v[b] < Math.floor(1193.1816666 * c)
+}
+
+function Kc(a, b) {
+ var c = a.C[b];
+ if (c) return a.C[b]--, 2 === c ? a.J[b] & 255 : a.J[b] >> 8;
+ c = a.g[b];
+ 3 === a.i[b] && (a.g[b] ^= 1);
+ a = Mc(a, b, $a());
+ return c ? a & 255 : a >> 8
+}
+
+function Lc(a, b, c) {
+ a.a[b] = a.g[b] ? a.a[b] & -256 | c : a.a[b] & 255 | c << 8;
+ 3 === a.O[b] && a.g[b] || (a.a[b] || (a.a[b] = 65535), a.v[b] = a.a[b], a.l[b] = !0, a.m[b] = $a());
+ 3 === a.O[b] && (a.g[b] ^= 1);
+ a.w.send("pcspeaker-update", [a.i[2], a.a[2]])
+}
+Ic.prototype.R = function(a) {
+ var b = a >> 1 & 7,
+ c = a >> 6 & 3;
+ a = a >> 4 & 3;
+ 3 !== c && (0 === a ? (this.C[c] = 2, b = Mc(this, c, $a()), this.J[c] = b ? b - 1 : 0) : (6 <= b && (b &= -5), this.g[c] = 1 === a ? 0 : 1, 0 === c && Pb(this.j, 0), this.i[c] = b, this.O[c] = a, this.w.send("pcspeaker-update", [this.i[2], this.a[2]])))
+};
+var Nc = Uint32Array.from([655360, 655360, 720896, 753664]),
+ Oc = Uint32Array.from([131072, 65536, 32768, 32768]);
+
+function Pc(a, b, c) {
+ var d = this;
+ this.w = b;
+ this.Ja = c;
+ this.J = 0;
+ this.Ae = 14;
+ this.Be = 15;
+ this.R = 80;
+ this.Rd = 25;
+ this.Wg = this.sb = this.Pe = this.Fa = 0;
+ this.Bc = [];
+ this.Re = this.Ua = 0;
+ this.qc = new Uint8Array(25);
+ this.v = this.W = this.Ne = this.Z = this.a = this.i = this.uc = this.Jc = this.ab = 0;
+ this.Ce = !0;
+ this.Wa = !1;
+ setTimeout(function() {
+ b.send("screen-set-mode", d.Wa)
+ }, 0);
+ this.Jb = new Int32Array(256);
+ this.C = this.rb = this.g = 0;
+ this.ob = !1;
+ this.Hc = 32;
+ this.kg = this.dc = 0;
+ this.pe = [222, 16, 32, 10, 7, 0, 0, 0, 162, 0, 0, 3, 0, 0, 128, 0, 8, 14680064, 57344, 224,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 1, 0, 0
+ ];
+ this.Hb = 144;
+ this.nc = [{
+ size: c
+ }];
+ this.fh = 65536;
+ this.Ei = 4272947200;
+ this.name = "vga";
+ this.Oa = {
+ lg: !1,
+ jk: 0,
+ kk: 0,
+ Ag: 0
+ };
+ this.Ya = this.rc = this.Xa = this.O = 0;
+ this.Je = new Uint8Array(16);
+ this.m = -1;
+ this.Sd = 32;
+ this.hd = this.Qd = this.ce = this.tb = 0;
+ this.Vd = -1;
+ this.Ud = 15;
+ this.pc = this.Wd = 0;
+ this.tc = -1;
+ this.cc = this.Dc = this.He = 0;
+ this.Ee = 255;
+ this.qa = this.oa = this.ka = this.Bb = this.Fe = this.Td = 0;
+ this.l = this.yf = 255;
+ c = a.o;
+ n(c, 960, this, this.tj);
+ m(c, 960, this, this.kh, this.sj);
+ m(c, 961, this, this.lh);
+ n(c, 962, this, this.uj);
+ c.Gc(964, this, this.wj, this.yj);
+ m(c, 964, this, this.vj);
+ m(c, 965, this, this.xj);
+ c.Gc(974, this, this.Hj, this.Jj);
+ m(c, 974, this, this.Gj);
+ m(c, 975, this, this.Ij);
+ n(c, 967, this, this.Aj);
+ m(c, 967, this, this.zj);
+ n(c, 968, this, this.Cj);
+ m(c, 968, this, this.Bj);
+ n(c, 969, this, this.Ej);
+ m(c, 969, this, this.Dj);
+ m(c, 972, this, this.Fj);
+ c.Gc(980, this, this.Lj, this.Nj);
+ m(c, 980, this, this.Kj);
+ m(c, 981, this, this.Mj);
+ m(c, 970, this, function() {
+ return 0
+ });
+ m(c, 986, this,
+ this.mh);
+ m(c, 954, this, this.mh);
+ this.sc = -1;
+ this.Za = 0;
+ n(c, 462, this, void 0, this.Gi);
+ n(c, 463, this, void 0, this.Ii);
+ m(c, 463, this, void 0, this.Hi);
+ void 0 === this.Ja || 786432 > this.Ja ? this.Ja = 786432 : this.Ja & 65535 && (this.Ja |= 65535, this.Ja++);
+ this.ya = new Uint8Array(this.Ja);
+ this.hb = this.Ja;
+ this.bb = 0;
+ this.ge = this.Ja;
+ this.fe = 0;
+ this.ee = void 0;
+ b.register("screen-tell-buffer", function(a) {
+ this.ee && a[0] && a[0].set(this.ee.subarray(0, a[0].length));
+ this.ee = a[0]
+ }, this);
+ b.register("screen-fill-buffer", function() {
+ if (this.Wa &&
+ this.ee)
+ if (this.bb < this.hb && this.fe < this.ge) this.w.send("screen-fill-buffer-end", this.Bc);
+ else {
+ if (this.ob) {
+ var a = this.ee,
+ b = this.hb,
+ c = this.bb;
+ switch (this.Hc) {
+ case 32:
+ var e = b >> 2,
+ d = (c >> 2) + 1;
+ for (b = e; b < d; b++) c = this.Ih[b], a[b] = c << 16 | c >> 16 & 255 | c & 65280 | 4278190080;
+ break;
+ case 24:
+ e = b / 3 | 0;
+ d = (c / 3 | 0) + 1;
+ var v = 3 * e;
+ for (b = e; v < c; b++) {
+ var E = this.ya[v++],
+ z = this.ya[v++],
+ A = this.ya[v++];
+ a[b] = E << 16 | z << 8 | A | 4278190080
+ }
+ break;
+ case 16:
+ e = b >> 1;
+ d = (c >> 1) + 1;
+ for (b = e; b < d; b++) c = this.pk[b], A = 255 * (c >> 11) / 31 | 0, z = 255 * (c >> 5 & 63) / 63 | 0, E = 255 *
+ (c & 31) / 31 | 0, a[b] = E << 16 | z << 8 | A | 4278190080;
+ break;
+ case 8:
+ for (e = b, d = c + 1; b <= c; b++) z = this.Jb[this.ya[b]], a[b] = z & 65280 | z << 16 | z >> 16 | 4278190080
+ }
+ a = e / this.rb | 0;
+ this.w.send("screen-fill-buffer-end", [{
+ ug: 0,
+ vg: a,
+ qf: 0,
+ rf: a,
+ ag: this.rb,
+ $f: (d / this.rb | 0) - a + 1
+ }])
+ } else {
+ d = Math.min(this.fe | 15, 524287);
+ a = Qc(this);
+ e = ~this.ab & 3;
+ b = this.Dc & 96;
+ c = this.tb & 64;
+ for (z = this.ge & -16; z <= d;) {
+ var M = z >>> a;
+ if (e) {
+ A = z / this.sb | 0;
+ v = z - this.sb * A;
+ switch (e) {
+ case 1:
+ M = (A & 1) << 13;
+ A >>>= 1;
+ break;
+ case 2:
+ M = (A & 1) << 14;
+ A >>>= 1;
+ break;
+ case 3:
+ M = (A & 3) << 13, A >>>= 2
+ }
+ M |=
+ (A * this.sb + v >>> a) + this.Ua
+ }
+ A = this.Kf[M];
+ v = this.Lf[M];
+ E = this.Mf[M];
+ var Y = this.Nf[M];
+ M = new Uint8Array(8);
+ switch (b) {
+ case 0:
+ A <<= 0;
+ v <<= 1;
+ E <<= 2;
+ Y <<= 3;
+ for (var ka = 7; 0 <= ka; ka--) M[7 - ka] = A >> ka & 1 | v >> ka & 2 | E >> ka & 4 | Y >> ka & 8;
+ break;
+ case 32:
+ M[0] = A >> 6 & 3 | E >> 4 & 12;
+ M[1] = A >> 4 & 3 | E >> 2 & 12;
+ M[2] = A >> 2 & 3 | E >> 0 & 12;
+ M[3] = A >> 0 & 3 | E << 2 & 12;
+ M[4] = v >> 6 & 3 | Y >> 4 & 12;
+ M[5] = v >> 4 & 3 | Y >> 2 & 12;
+ M[6] = v >> 2 & 3 | Y >> 0 & 12;
+ M[7] = v >> 0 & 3 | Y << 2 & 12;
+ break;
+ case 64:
+ case 96:
+ M[0] = A >> 4 & 15, M[1] = A >> 0 & 15, M[2] = v >> 4 & 15, M[3] = v >> 0 & 15, M[4] = E >> 4 & 15, M[5] = E >> 0 & 15, M[6] = Y >> 4 & 15, M[7] = Y >>
+ 0 & 15
+ }
+ if (c)
+ for (A = ka = 0; 4 > ka; ka++, z++, A += 2) this.Jf[z] = M[A] << 4 | M[A + 1];
+ else
+ for (ka = 0; 8 > ka; ka++, z++) this.Jf[z] = M[ka]
+ }
+ c = this.hb;
+ d = Math.min(this.bb, 524287);
+ if (a = this.ee)
+ if (e = 255, b = 0, this.tb & 128 && (e &= 207, b |= this.hd << 4 & 48), this.tb & 64)
+ for (; c <= d; c++) z = this.Jf[c] & e | b, z = this.Jb[z], a[c] = z & 65280 | z << 16 | z >> 16 | 4278190080;
+ else
+ for (e &= 63, b |= this.hd << 4 & 192; c <= d; c++) z = this.Je[this.Jf[c] & this.ce] & e | b, z = this.Jb[z], a[c] = z & 65280 | z << 16 | z >> 16 | 4278190080;
+ this.w.send("screen-fill-buffer-end", this.Bc)
+ }
+ this.hb = this.Ja;
+ this.bb = 0;
+ this.ge = this.Ja;
+ this.fe = 0
+ }
+ Rc(this)
+ }, this);
+ this.pk = new Uint16Array(this.ya.buffer);
+ this.Ih = new Int32Array(this.ya.buffer);
+ this.Xd = new Uint8Array(this.ya.buffer, 0, 262144);
+ this.Kf = new Uint8Array(this.ya.buffer, 0, 65536);
+ this.Lf = new Uint8Array(this.ya.buffer, 65536, 65536);
+ this.Mf = new Uint8Array(this.ya.buffer, 131072, 65536);
+ this.Nf = new Uint8Array(this.ya.buffer, 196608, 65536);
+ this.Jf = new Uint8Array(this.ya.buffer, 262144, 524288);
+ var e = this;
+ Pa(c, 655360, 131072, function(a) {
+ return Sc(e, a)
+ }, function(a, b) {
+ if (e.ob &&
+ e.Wa && e.Ce) {
+ var c = a - 655360 | e.dc;
+ e.hb = c < e.hb ? c : e.hb;
+ e.bb = c > e.bb ? c : e.bb;
+ e.ya[c] = b
+ } else {
+ var d = e.Bb >> 2 & 3;
+ a -= Nc[d];
+ if (!(0 > a || a >= Oc[d]))
+ if (e.Wa) {
+ var f = b;
+ b = Tc(e.Ee);
+ var h = Uc(e.Td);
+ d = Uc(e.Fe);
+ switch (e.Dc & 3) {
+ case 0:
+ f = (f | f << 8) >>> (e.cc & 7) & 255;
+ c = Tc(f);
+ f = Uc(e.Td);
+ c = Vc(e, (c | d & f) & (~d | f), e.g);
+ c = b & c | ~b & e.g;
+ break;
+ case 1:
+ c = e.g;
+ break;
+ case 2:
+ c = Uc(f);
+ c = Vc(e, c, e.g);
+ c = b & c | ~b & e.g;
+ break;
+ case 3:
+ f = (f | f << 8) >>> (e.cc & 7) & 255, b &= Tc(f), c = b & h | ~b & e.g
+ }
+ b = 15;
+ switch (e.Wd & 12) {
+ case 0:
+ b = 5 << (a & 1);
+ a &= -2;
+ break;
+ case 8:
+ case 12:
+ b = 1 << (a & 3), a &= -4
+ }
+ b &=
+ e.Ud;
+ b & 1 && (e.Kf[a] = c >> 0 & 255);
+ b & 2 && (e.Lf[a] = c >> 8 & 255);
+ b & 4 && (e.Mf[a] = c >> 16 & 255);
+ b & 8 && (e.Nf[a] = c >> 24 & 255);
+ b = Wc(e, a);
+ c = b + 7;
+ b < e.ge && (e.ge = b);
+ c > e.fe && (e.fe = c);
+ b < e.hb && (e.hb = b);
+ c > e.bb && (e.bb = c)
+ } else e.Ud & 3 && (c = a, d = (c >> 1) - e.Ua, a = d / e.R | 0, d %= e.R, c & 1 ? (h = b, f = e.Xd[c & -2]) : (f = b, h = e.Xd[c | 1]), e.w.send("screen-put-char", [a, d, f, e.Jb[h >> 4 & 15], e.Jb[h & 15]]), e.Xd[c] = b)
+ }
+ });
+ Pa(c, 3758096384, this.Ja, function(a) {
+ return e.ya[a & 268435455]
+ }, function(a, b) {
+ a &= 268435455;
+ e.ya[a] = b;
+ e.hb = a < e.hb ? a : e.hb;
+ e.bb = a > e.bb ? a : e.bb
+ }, function(a) {
+ a &=
+ 268435455;
+ return a & 3 ? e.ya[a] | e.ya[a + 1] << 8 | e.ya[a + 2] << 16 | e.ya[a + 3] << 24 : e.Ih[a >> 2]
+ }, function(a, b) {
+ a &= 268435455;
+ e.hb = a < e.hb ? a : e.hb;
+ e.bb = a + 3 > e.bb ? a + 3 : e.bb;
+ e.ya[a] = b;
+ e.ya[a + 1] = b >> 8;
+ e.ya[a + 2] = b >> 16;
+ e.ya[a + 3] = b >> 24
+ });
+ Zb(a.G.wb, this)
+}
+k = Pc.prototype;
+k.Sa = function() {
+ var a = [];
+ a[0] = this.Ja;
+ a[1] = this.J;
+ a[2] = this.Ae;
+ a[3] = this.Be;
+ a[4] = this.R;
+ a[5] = this.Rd;
+ a[6] = this.Bc;
+ a[7] = this.Ya;
+ a[8] = this.Ua;
+ a[9] = this.Wa;
+ a[10] = this.Jb;
+ a[11] = this.g;
+ a[12] = this.ka;
+ a[13] = this.oa;
+ a[14] = this.Bb;
+ a[15] = this.rb;
+ a[16] = this.C;
+ a[17] = this.ab;
+ a[18] = this.ob;
+ a[19] = this.Hc;
+ a[20] = this.dc;
+ a[21] = this.kg;
+ a[22] = this.O;
+ a[23] = this.Xa;
+ a[24] = this.rc;
+ a[25] = this.Je;
+ a[26] = this.Vd;
+ a[27] = this.Ud;
+ a[28] = this.Wd;
+ a[29] = this.tc;
+ a[30] = this.He;
+ a[31] = this.Dc;
+ a[32] = this.cc;
+ a[33] = this.Ee;
+ a[34] = this.qa;
+ a[35] =
+ this.yf;
+ a[36] = this.l;
+ a[37] = this.sc;
+ a[38] = this.Za;
+ a[39] = this.ya;
+ a[40] = this.Ce;
+ a[41] = this.m;
+ a[42] = this.W;
+ a[43] = this.Td;
+ a[44] = this.Fe;
+ a[45] = this.Re;
+ a[46] = this.qc;
+ a[47] = this.Jc;
+ a[48] = this.uc;
+ a[49] = this.i;
+ a[50] = this.a;
+ a[51] = this.Z;
+ a[52] = this.Ne;
+ a[53] = this.W;
+ a[54] = this.Sd;
+ a[55] = this.tb;
+ a[56] = this.ce;
+ a[57] = this.Qd;
+ a[58] = this.hd;
+ a[59] = this.pc;
+ a[60] = this.v;
+ return a
+};
+k.fb = function(a) {
+ this.Ja = a[0];
+ this.J = a[1];
+ this.Ae = a[2];
+ this.Be = a[3];
+ this.R = a[4];
+ this.Rd = a[5];
+ this.Bc = a[6];
+ this.Ya = a[7];
+ this.Ua = a[8];
+ this.Wa = a[9];
+ this.Jb = a[10];
+ this.g = a[11];
+ this.ka = a[12];
+ this.oa = a[13];
+ this.Bb = a[14];
+ this.rb = a[15];
+ this.C = a[16];
+ this.ab = a[17];
+ this.ob = a[18];
+ this.Hc = a[19];
+ this.dc = a[20];
+ this.kg = a[21];
+ this.O = a[22];
+ this.Xa = a[23];
+ this.rc = a[24];
+ this.Je = a[25];
+ this.Vd = a[26];
+ this.Ud = a[27];
+ this.Wd = a[28];
+ this.tc = a[29];
+ this.He = a[30];
+ this.Dc = a[31];
+ this.cc = a[32];
+ this.Ee = a[33];
+ this.qa = a[34];
+ this.yf = a[35];
+ this.l = a[36];
+ this.sc = a[37];
+ this.Za = a[38];
+ this.ya.set(a[39]);
+ this.Ce = a[40];
+ this.m = a[41];
+ this.W = a[42];
+ this.Td = a[43];
+ this.Fe = a[44];
+ this.Re = a[45];
+ this.qc.set(a[46]);
+ this.Jc = a[47];
+ this.uc = a[48];
+ this.i = a[49];
+ this.a = a[50];
+ this.Z = a[51];
+ this.Ne = a[52];
+ this.W = a[53];
+ this.Sd = a[54];
+ this.tb = a[55];
+ this.ce = a[56];
+ this.Qd = a[57];
+ this.hd = a[58];
+ this.pc = a[59];
+ this.v = a[60];
+ this.w.send("screen-set-mode", this.Wa);
+ this.Wa ? (this.Pe = this.Fa = 0, this.ob ? (this.Id(this.rb, this.C, this.Hc, this.rb, this.C), Xc(this)) : (Yc(this), Zc(this))) :
+ (this.Jd(this.R, this.Rd), this.Od(), this.Nd());
+ $c(this)
+};
+
+function Sc(a, b) {
+ if (a.ob && a.Ce) return b = b - 655360 | a.dc, a.ya[b];
+ var c = a.Bb >> 2 & 3;
+ b -= Nc[c];
+ if (0 > b || b >= Oc[c]) return 0;
+ a.g = a.Kf[b];
+ a.g |= a.Lf[b] << 8;
+ a.g |= a.Mf[b] << 16;
+ a.g |= a.Nf[b] << 24;
+ if (a.Dc & 8) return c = 255, a.oa & 1 && (c &= a.Kf[b] ^ ~(a.ka & 1 ? 255 : 0)), a.oa & 2 && (c &= a.Lf[b] ^ ~(a.ka & 2 ? 255 : 0)), a.oa & 4 && (c &= a.Mf[b] ^ ~(a.ka & 4 ? 255 : 0)), a.oa & 8 && (c &= a.Nf[b] ^ ~(a.ka & 8 ? 255 : 0)), c;
+ c = a.He;
+ a.Wa ? a.Wd & 8 ? (c = b & 3, b &= -4) : a.Dc & 16 && (c = b & 1, b &= -2) : c = 0;
+ return a.Xd[c << 16 | b]
+}
+
+function Tc(a) {
+ return a | a << 8 | a << 16 | a << 24
+}
+
+function Uc(a) {
+ return (a & 1 ? 255 : 0) | (a & 2 ? 255 : 0) << 8 | (a & 4 ? 255 : 0) << 16 | (a & 8 ? 255 : 0) << 24
+}
+
+function Vc(a, b, c) {
+ switch (a.cc & 24) {
+ case 8:
+ return b & c;
+ case 16:
+ return b | c;
+ case 24:
+ return b ^ c
+ }
+ return b
+}
+
+function ad(a) {
+ for (var b = a.Ua << 1, c, d, e = 0; e < a.Rd; e++)
+ for (var f = 0; f < a.R; f++) c = a.Xd[b], d = a.Xd[b | 1], a.w.send("screen-put-char", [e, f, c, a.Jb[d >> 4 & 15], a.Jb[d & 15]]), b += 2
+}
+k.Nd = function() {
+ var a = (this.J - this.Ua) / this.R | 0,
+ b = (this.J - this.Ua) % this.R;
+ a = Math.min(this.Rd - 1, a);
+ this.w.send("screen-update-cursor", [a, b])
+};
+
+function $c(a) {
+ a.Wa ? (a.hb = 0, a.ob ? a.bb = a.Ja : a.bb = 524288) : ad(a)
+}
+
+function Zc(a) {
+ a.Wa && !a.ob && (a.ge = 0, a.fe = 524288, $c(a))
+}
+k.Mb = function() {};
+
+function Qc(a) {
+ var b = 128 + (~a.Z & a.ab & 64);
+ b -= a.Z & 64;
+ b -= a.tb & 64;
+ return b >>> 6
+}
+
+function Wc(a, b) {
+ var c = Qc(a);
+ if (~a.ab & 3) {
+ var d = b - a.Ua;
+ d &= a.ab << 13 | -24577;
+ d <<= c;
+ var e = d / a.sb | 0;
+ d %= a.sb;
+ switch (a.ab & 3) {
+ case 2:
+ e = e << 1 | b >> 13 & 1;
+ break;
+ case 1:
+ e = e << 1 | b >> 14 & 1;
+ break;
+ case 0:
+ e = e << 2 | b >> 13 & 3
+ }
+ return e * a.sb + d + (a.Ua << c)
+ }
+ return b << c
+}
+
+function bd(a, b) {
+ a.qa & 128 && (b >>>= 1);
+ b = Math.ceil(b / (1 + (a.qa & 31)));
+ a.ab & 1 || (b <<= 1);
+ a.ab & 2 || (b <<= 1);
+ return b
+}
+k.Jd = function(a, b) {
+ this.R = a;
+ this.Rd = b;
+ this.w.send("screen-set-size-text", [a, b])
+};
+k.Id = function(a, b, c, d, e) {
+ this.Oa.lg && this.Oa.Ag === c && this.Fa === a && this.Pe === b && this.sb === d && this.Wg === e || (this.Fa = a, this.Pe = b, this.sb = d, this.Wg = e, this.Oa.Ag = c, this.Oa.lg = !0, this.Oa.jk = a, this.Oa.kk = b, this.w.send("screen-set-size-graphical", [a, b, d, e, c]))
+};
+
+function Yc(a) {
+ if (!a.ob) {
+ var b = Math.min(1 + a.Jc, a.uc),
+ c = Math.min(1 + a.i, a.a);
+ if (b && c)
+ if (a.Wa) {
+ b <<= 3;
+ var d = a.W << 4;
+ a.tb & 64 && (b >>>= 1, d >>>= 1);
+ var e = a.W << 2;
+ a.Z & 64 ? e <<= 1 : a.ab & 64 && (e >>>= 1);
+ a.Id(b, bd(a, c), 8, d, Math.ceil(Oc[0] / e));
+ Rc(a);
+ Xc(a)
+ } else a.qa & 128 && (c >>>= 1), c = c / (1 + (a.qa & 31)) | 0, b && c && a.Jd(b, c)
+ }
+}
+
+function Xc(a) {
+ a.Wa || ad(a);
+ if (a.ob) a.Bc = [];
+ else if (a.sb && a.Fa)
+ if (!a.Sd || a.pc & 32) a.Bc = [], a.w.send("screen-clear");
+ else {
+ var b = a.Re,
+ c = a.Qd;
+ a.tb & 64 && (c >>>= 1);
+ var d = a.Ne >> 5 & 3,
+ e = Wc(a, b + d);
+ b = e / a.sb | 0;
+ var f = e % a.sb + c;
+ e = bd(a, 1 + a.v);
+ e = Math.min(e, a.Pe);
+ var h = a.Pe - e;
+ a.Bc = [];
+ f = -f;
+ for (var g = 0; f < a.Fa; f += a.sb, g++) a.Bc.push({
+ ug: f,
+ vg: 0,
+ qf: 0,
+ rf: b + g,
+ ag: a.sb,
+ $f: e
+ });
+ b = 0;
+ a.tb & 32 || (b = Wc(a, d) + c);
+ f = -b;
+ for (g = 0; f < a.Fa; f += a.sb, g++) a.Bc.push({
+ ug: f,
+ vg: e,
+ qf: 0,
+ rf: g,
+ ag: a.sb,
+ $f: h
+ })
+ }
+}
+
+function Rc(a) {
+ a.l |= 8;
+ a.Re !== a.Ua && (a.Re = a.Ua, Xc(a))
+}
+k.Od = function() {
+ this.w.send("screen-update-cursor-scanline", [this.Ae, this.Be])
+};
+k.tj = function(a) {
+ if (-1 === this.m) this.m = a & 31, this.Sd !== (a & 32) && (this.Sd = a & 32, Xc(this));
+ else {
+ if (16 > this.m) this.Je[this.m] = a, this.tb & 64 || $c(this);
+ else switch (this.m) {
+ case 16:
+ if (this.tb !== a) {
+ var b = this.tb;
+ this.tb = a;
+ var c = 0 < (a & 1);
+ this.ob || this.Wa === c || (this.Wa = c, this.w.send("screen-set-mode", this.Wa));
+ (b ^ a) & 64 && Zc(this);
+ Yc(this);
+ $c(this)
+ }
+ break;
+ case 18:
+ this.ce !== a && (this.ce = a, $c(this));
+ break;
+ case 19:
+ this.Qd !== a && (this.Qd = a & 15, Xc(this));
+ break;
+ case 20:
+ this.hd !== a && (this.hd = a, $c(this))
+ }
+ this.m = -1
+ }
+};
+k.kh = function() {
+ return this.m | this.Sd
+};
+k.sj = function() {
+ return this.kh() & 255 | this.lh() << 8 & 65280
+};
+k.lh = function() {
+ if (16 > this.m) return this.Je[this.m];
+ switch (this.m) {
+ case 16:
+ return this.tb;
+ case 18:
+ return this.ce;
+ case 19:
+ return this.Qd;
+ case 20:
+ return this.hd
+ }
+ return -1
+};
+k.uj = function(a) {
+ this.yf = a
+};
+k.wj = function(a) {
+ this.Vd = a
+};
+k.vj = function() {
+ return this.Vd
+};
+k.yj = function(a) {
+ switch (this.Vd) {
+ case 1:
+ var b = this.pc;
+ this.pc = a;
+ (b ^ a) & 32 && Xc(this);
+ break;
+ case 2:
+ this.Ud = a;
+ break;
+ case 4:
+ this.Wd = a
+ }
+};
+k.xj = function() {
+ switch (this.Vd) {
+ case 1:
+ return this.pc;
+ case 2:
+ return this.Ud;
+ case 4:
+ return this.Wd;
+ case 6:
+ return 18
+ }
+ return 0
+};
+k.Aj = function(a) {
+ this.rc = 3 * a;
+ this.Ya &= 0
+};
+k.zj = function() {
+ return this.Ya
+};
+k.Cj = function(a) {
+ this.Xa = 3 * a;
+ this.Ya |= 3
+};
+k.Bj = function() {
+ return this.Xa / 3 | 0
+};
+k.Ej = function(a) {
+ var b = this.Xa / 3 | 0,
+ c = this.Xa % 3,
+ d = this.Jb[b];
+ a = 255 * (a & 63) / 63 | 0;
+ d = 0 === c ? d & -16711681 | a << 16 : 1 === c ? d & -65281 | a << 8 : d & -256 | a;
+ this.Jb[b] !== d && (this.Jb[b] = d, $c(this));
+ this.Xa++
+};
+k.Dj = function() {
+ var a = this.rc % 3,
+ b = this.Jb[this.rc / 3 | 0];
+ this.rc++;
+ return (b >> 8 * (2 - a) & 255) / 255 * 63 | 0
+};
+k.Fj = function() {
+ return this.yf
+};
+k.Hj = function(a) {
+ this.tc = a
+};
+k.Gj = function() {
+ return this.tc
+};
+k.Jj = function(a) {
+ switch (this.tc) {
+ case 0:
+ this.Td = a;
+ break;
+ case 1:
+ this.Fe = a;
+ break;
+ case 2:
+ this.ka = a;
+ break;
+ case 3:
+ this.cc = a;
+ break;
+ case 4:
+ this.He = a;
+ break;
+ case 5:
+ var b = this.Dc;
+ this.Dc = a;
+ (b ^ a) & 96 && Zc(this);
+ break;
+ case 6:
+ this.Bb !== a && (this.Bb = a, Yc(this));
+ break;
+ case 7:
+ this.oa = a;
+ break;
+ case 8:
+ this.Ee = a
+ }
+};
+k.Ij = function() {
+ switch (this.tc) {
+ case 0:
+ return this.Td;
+ case 1:
+ return this.Fe;
+ case 2:
+ return this.ka;
+ case 3:
+ return this.cc;
+ case 4:
+ return this.He;
+ case 5:
+ return this.Dc;
+ case 6:
+ return this.Bb;
+ case 7:
+ return this.oa;
+ case 8:
+ return this.Ee
+ }
+ return 0
+};
+k.Lj = function(a) {
+ this.O = a
+};
+k.Kj = function() {
+ return this.O
+};
+k.Nj = function(a) {
+ switch (this.O) {
+ case 1:
+ this.Jc !== a && (this.Jc = a, Yc(this));
+ break;
+ case 2:
+ this.uc !== a && (this.uc = a, Yc(this));
+ break;
+ case 7:
+ var b = this.i;
+ this.i &= 255;
+ this.i = this.i | a << 3 & 512 | a << 7 & 256;
+ b != this.i && Yc(this);
+ this.v = this.v & 767 | a << 4 & 256;
+ b = this.a;
+ this.a = this.a & 767 | a << 5 & 256;
+ b !== this.a && Yc(this);
+ Xc(this);
+ break;
+ case 8:
+ this.Ne = a;
+ Xc(this);
+ break;
+ case 9:
+ this.qa = a;
+ this.v = this.v & 511 | a << 3 & 512;
+ b = this.a;
+ this.a = this.a & 511 | a << 4 & 512;
+ b !== this.a && Yc(this);
+ Xc(this);
+ break;
+ case 10:
+ this.Ae = a;
+ this.Od();
+ break;
+ case 11:
+ this.Be =
+ a;
+ this.Od();
+ break;
+ case 12:
+ (this.Ua >> 8 & 255) !== a && (this.Ua = this.Ua & 255 | a << 8, Xc(this), ~this.ab & 3 && Zc(this));
+ break;
+ case 13:
+ (this.Ua & 255) !== a && (this.Ua = this.Ua & 65280 | a, Xc(this), ~this.ab & 3 && Zc(this));
+ break;
+ case 14:
+ this.J = this.J & 255 | a << 8;
+ this.Nd();
+ break;
+ case 15:
+ this.J = this.J & 65280 | a;
+ this.Nd();
+ break;
+ case 18:
+ (this.i & 255) !== a && (this.i = this.i & 768 | a, Yc(this));
+ break;
+ case 19:
+ this.W !== a && (this.W = a, Yc(this), ~this.ab & 3 && Zc(this));
+ break;
+ case 20:
+ this.Z !== a && (b = this.Z, this.Z = a, Yc(this), (b ^ a) & 64 && Zc(this));
+ break;
+ case 21:
+ (this.a &
+ 255) !== a && (this.a = this.a & 768 | a, Yc(this));
+ break;
+ case 23:
+ this.ab !== a && (b = this.ab, this.ab = a, Yc(this), (b ^ a) & 67 && Zc(this));
+ break;
+ case 24:
+ this.v = this.v & 768 | a;
+ Xc(this);
+ break;
+ default:
+ this.O < this.qc.length && (this.qc[this.O] = a)
+ }
+};
+k.Mj = function() {
+ switch (this.O) {
+ case 1:
+ return this.Jc;
+ case 2:
+ return this.uc;
+ case 7:
+ return this.i >> 7 & 2 | this.a >> 5 & 8 | this.v >> 4 & 16 | this.i >> 3 & 64;
+ case 8:
+ return this.Ne;
+ case 9:
+ return this.qa;
+ case 10:
+ return this.Ae;
+ case 11:
+ return this.Be;
+ case 12:
+ return this.Ua & 255;
+ case 13:
+ return this.Ua >> 8;
+ case 14:
+ return this.J >> 8;
+ case 15:
+ return this.J & 255;
+ case 18:
+ return this.i & 255;
+ case 19:
+ return this.W;
+ case 20:
+ return this.Z;
+ case 21:
+ return this.a & 255;
+ case 23:
+ return this.ab;
+ case 24:
+ return this.v & 255
+ }
+ return this.O < this.qc.length ?
+ this.qc[this.O] : 0
+};
+k.mh = function() {
+ var a = this.l;
+ this.Wa ? (this.l ^= 1, this.l &= 1) : (this.l & 1 && (this.l ^= 8), this.l ^= 1);
+ this.m = -1;
+ return a
+};
+k.Gi = function(a) {
+ this.sc = a
+};
+k.Ii = function(a) {
+ switch (this.sc) {
+ case 1:
+ this.rb = a;
+ 2560 < this.rb && (this.rb = 2560);
+ break;
+ case 2:
+ this.C = a;
+ 1600 < this.C && (this.C = 1600);
+ break;
+ case 3:
+ this.Hc = a;
+ break;
+ case 4:
+ this.ob = 1 === (a & 1);
+ this.Za = a;
+ break;
+ case 5:
+ this.dc = a << 16;
+ break;
+ case 9:
+ this.kg = this.rb * (15 === this.Hc ? 16 : this.Hc) / 8 * a, $c(this)
+ }!this.ob || this.rb && this.C || (this.ob = !1);
+ this.ob && 4 === this.sc && (this.Id(this.rb, this.C, this.Hc, this.rb, this.C), this.w.send("screen-set-mode", !0), this.Ce = this.Wa = !0);
+ this.ob || (this.dc = 0);
+ Xc(this)
+};
+k.Hi = function() {
+ return cd(this, this.sc)
+};
+
+function cd(a, b) {
+ switch (b) {
+ case 0:
+ return 45248;
+ case 1:
+ return a.Za & 2 ? 2560 : a.rb;
+ case 2:
+ return a.Za & 2 ? 1600 : a.C;
+ case 3:
+ return a.Za & 2 ? 32 : a.Hc;
+ case 4:
+ return a.Za;
+ case 5:
+ return a.dc >>> 16;
+ case 6:
+ return a.Fa ? a.Fa : 1;
+ case 8:
+ return 0;
+ case 10:
+ return a.Ja / 65536 | 0
+ }
+ return 255
+};
+
+function dd(a, b) {
+ this.j = a;
+ this.w = b;
+ this.ed = this.Nc = !1;
+ this.Ue = !0;
+ this.xd = this.lc = this.kc = 0;
+ this.qa = !0;
+ this.W = this.R = this.C = this.O = this.Z = this.J = this.Oe = !1;
+ this.ra = new ob(1024);
+ this.i = 0;
+ this.cd = 100;
+ this.ue = 4;
+ this.m = !1;
+ this.a = new ob(1024);
+ this.v = this.l = !1;
+ this.w.register("keyboard-code", function(a) {
+ this.Oe && (this.ra.push(a), this.xb())
+ }, this);
+ this.w.register("mouse-click", function(a) {
+ this.Ue && this.ed && (this.xd = a[0] | a[2] << 1 | a[1] << 2, this.Nc && ed(this, 0, 0))
+ }, this);
+ this.w.register("mouse-delta", function(a) {
+ var b =
+ a[1];
+ if (this.Ue && this.ed) {
+ var c = this.ue * this.cd / 80;
+ this.kc += a[0] * c;
+ this.lc += b * c;
+ this.Nc && (a = this.kc | 0, b = this.lc | 0, a || b) && (this.kc -= a, this.lc -= b, ed(this, a, b))
+ }
+ }, this);
+ this.w.register("mouse-wheel", function() {}, this);
+ this.g = 5;
+ this.ka = this.oa = !1;
+ m(a.o, 96, this, this.ak);
+ m(a.o, 100, this, this.ck);
+ n(a.o, 96, this, this.bk);
+ n(a.o, 100, this, this.dk)
+}
+k = dd.prototype;
+k.Sa = function() {
+ var a = [];
+ a[0] = this.Nc;
+ a[1] = this.ed;
+ a[2] = this.Ue;
+ a[3] = this.kc;
+ a[4] = this.lc;
+ a[5] = this.xd;
+ a[6] = this.qa;
+ a[7] = this.Oe;
+ a[8] = this.J;
+ a[9] = this.Z;
+ a[10] = this.O;
+ a[11] = this.C;
+ a[12] = this.R;
+ a[13] = this.W;
+ a[15] = this.i;
+ a[16] = this.cd;
+ a[17] = this.ue;
+ a[18] = this.m;
+ a[20] = this.g;
+ a[21] = this.oa;
+ a[22] = this.ka;
+ return a
+};
+k.fb = function(a) {
+ this.Nc = a[0];
+ this.ed = a[1];
+ this.Ue = a[2];
+ this.kc = a[3];
+ this.lc = a[4];
+ this.xd = a[5];
+ this.qa = a[6];
+ this.Oe = a[7];
+ this.J = a[8];
+ this.Z = a[9];
+ this.O = a[10];
+ this.C = a[11];
+ this.R = a[12];
+ this.W = a[13];
+ this.i = a[15];
+ this.cd = a[16];
+ this.ue = a[17];
+ this.m = a[18];
+ this.g = a[20];
+ this.oa = a[21];
+ this.ka = a[22];
+ this.v = this.l = !1;
+ this.ra.clear();
+ this.a.clear();
+ this.w.send("mouse-enable", this.ed)
+};
+k.xb = function() {
+ this.l || (this.ra.length ? fd(this) : this.a.length && gd(this))
+};
+
+function gd(a) {
+ a.l = !0;
+ a.v = !0;
+ a.g & 2 && (Pb(a.j, 12), a.j.Cb(12))
+}
+
+function fd(a) {
+ a.l = !0;
+ a.v = !1;
+ a.g & 1 && (Pb(a.j, 1), a.j.Cb(1))
+}
+
+function ed(a, b, c) {
+ a.a.push((0 > c) << 5 | (0 > b) << 4 | 8 | a.xd);
+ a.a.push(b);
+ a.a.push(c);
+ a.xb()
+}
+k.ak = function() {
+ this.l = !1;
+ if (!this.ra.length && !this.a.length) return this.i;
+ this.v ? (Pb(this.j, 12), this.i = this.a.shift()) : (Pb(this.j, 1), this.i = this.ra.shift());
+ (this.ra.length || this.a.length) && this.xb();
+ return this.i
+};
+k.ck = function() {
+ var a = 16;
+ this.l && (a |= 1);
+ this.v && (a |= 32);
+ return a
+};
+k.bk = function(a) {
+ if (this.ka) this.g = a, this.ka = !1;
+ else if (this.oa) this.oa = !1, this.a.clear(), this.a.push(a), gd(this);
+ else if (this.Z) this.Z = !1, this.a.clear(), this.a.push(250), this.cd = a, this.cd || (this.cd = 100), gd(this);
+ else if (this.W) this.W = !1, this.a.clear(), this.a.push(250), this.ue = 3 < a ? 4 : 1 << a, gd(this);
+ else if (this.O) this.O = !1, this.ra.push(250), fd(this);
+ else if (this.C) this.C = !1, this.ra.push(250), fd(this), a || this.ra.push(2);
+ else if (this.R) this.R = !1, this.ra.push(250), fd(this);
+ else if (this.J) {
+ if (this.J = !1,
+ this.Ue) {
+ this.ra.clear();
+ this.a.clear();
+ this.a.push(250);
+ switch (a) {
+ case 230:
+ this.m = !1;
+ break;
+ case 231:
+ this.m = !0;
+ break;
+ case 232:
+ this.W = !0;
+ break;
+ case 233:
+ ed(this, 0, 0);
+ break;
+ case 235:
+ ed(this, 0, 0);
+ break;
+ case 242:
+ this.a.push(0);
+ this.a.push(0);
+ this.xd = this.kc = this.lc = 0;
+ break;
+ case 243:
+ this.Z = !0;
+ break;
+ case 244:
+ this.ed = this.Nc = !0;
+ this.w.send("mouse-enable", !0);
+ this.xd = this.kc = this.lc = 0;
+ break;
+ case 245:
+ this.Nc = !1;
+ break;
+ case 246:
+ this.Nc = !1;
+ this.cd = 100;
+ this.m = !1;
+ this.ue = 4;
+ break;
+ case 255:
+ this.a.push(170), this.a.push(0),
+ this.ed = !0, this.w.send("mouse-enable", !0), this.Nc = !1, this.cd = 100, this.m = !1, this.ue = 4, this.xd = this.kc = this.lc = 0
+ }
+ gd(this)
+ }
+ } else {
+ this.a.clear();
+ this.ra.clear();
+ this.ra.push(250);
+ switch (a) {
+ case 237:
+ this.O = !0;
+ break;
+ case 240:
+ this.C = !0;
+ break;
+ case 242:
+ this.ra.push(171);
+ this.ra.push(83);
+ break;
+ case 243:
+ this.R = !0;
+ break;
+ case 244:
+ this.Oe = !0;
+ break;
+ case 245:
+ this.Oe = !1;
+ break;
+ case 255:
+ this.ra.clear(), this.ra.push(250), this.ra.push(170), this.ra.push(0)
+ }
+ fd(this)
+ }
+};
+k.dk = function(a) {
+ switch (a) {
+ case 32:
+ this.ra.clear();
+ this.a.clear();
+ this.ra.push(this.g);
+ fd(this);
+ break;
+ case 96:
+ this.ka = !0;
+ break;
+ case 211:
+ this.oa = !0;
+ break;
+ case 212:
+ this.J = !0;
+ break;
+ case 167:
+ this.g |= 32;
+ break;
+ case 168:
+ this.g &= -33;
+ break;
+ case 169:
+ this.ra.clear();
+ this.a.clear();
+ this.ra.push(0);
+ fd(this);
+ break;
+ case 170:
+ this.ra.clear();
+ this.a.clear();
+ this.ra.push(85);
+ fd(this);
+ break;
+ case 171:
+ this.ra.clear();
+ this.a.clear();
+ this.ra.push(0);
+ fd(this);
+ break;
+ case 173:
+ this.g |= 16;
+ break;
+ case 174:
+ this.g &= -17;
+ break;
+ case 254:
+ throw a =
+ this.j, a.reset(), bb(a), 233495534;
+ }
+};
+
+function hd(a, b) {
+ this.g = this.a = this.aa = this.v = this.m = 0;
+ this.i = -1;
+ this.sa = b;
+ this.O = void 0 === this.sa;
+ this.Ca = void 0;
+ this.name = this.O ? "master" : "slave ";
+ this.R = !1;
+ this.W = this.state = 0;
+ this.C = 1;
+ this.J = this.Z = 0;
+ this.j = a;
+ this.O ? (this.Ca = new hd(this.j, this), this.l = function() {
+ if (0 <= this.i) ab(this.j);
+ else {
+ var a = this.a & this.m;
+ if (a) {
+ a &= -a;
+ var b = this.Z ? this.m : -1;
+ this.aa && (this.aa & -this.aa & b) <= a || (this.i = eb(a), ab(this.j))
+ }
+ }
+ }, this.lf = function() {
+ if (-1 !== this.i)
+ if (0 === this.a) this.i = -1, id(this.j, this.v | 7);
+ else {
+ var a =
+ 1 << this.i;
+ 0 === (this.J & a) && (this.a &= ~a);
+ this.C || (this.aa |= a);
+ 2 === this.i ? this.Ca.lf() : id(this.j, this.v | this.i);
+ this.i = -1;
+ this.l()
+ }
+ }) : (this.l = function() {
+ if (0 <= this.i) ab(this.j);
+ else {
+ var a = this.a & this.m;
+ if (a) {
+ a &= -a;
+ var b = this.Z ? this.m : -1;
+ this.aa && (this.aa & -this.aa & b) <= a || (this.i = eb(a), this.sa.ef(2))
+ }
+ }
+ }, this.lf = function() {
+ if (-1 !== this.i)
+ if (0 === this.a) this.i = -1, this.sa.g &= -5, id(this.j, this.v | 7);
+ else {
+ var a = 1 << this.i;
+ 0 === (this.J & a) && (this.a &= ~a);
+ this.C || (this.aa |= a);
+ this.sa.g &= -5;
+ id(this.j, this.v | this.i);
+ this.i = -1;
+ this.l()
+ }
+ });
+ this.O ? (a = 32, b = 1232) : (a = 160, b = 1233);
+ n(this.j.o, a, this, this.Ki);
+ m(this.j.o, a, this, this.Ji);
+ n(this.j.o, a | 1, this, this.Mi);
+ m(this.j.o, a | 1, this, this.Li);
+ n(this.j.o, b, this, this.$j);
+ m(this.j.o, b, this, this.Zj);
+ this.O ? (this.ef = function(a) {
+ 8 <= a ? this.Ca.ef(a - 8) : (a = 1 << a, 0 === (this.g & a) && (this.a |= a, this.g |= a, this.l()))
+ }, this.sf = function(a) {
+ 8 <= a ? this.Ca.sf(a - 8) : (a = 1 << a, this.g & a && (this.g &= ~a, this.a &= ~a, this.l()))
+ }) : (this.ef = function(a) {
+ a = 1 << a;
+ 0 === (this.g & a) && (this.a |= a, this.g |= a, this.l())
+ },
+ this.sf = function(a) {
+ a = 1 << a;
+ this.g & a && (this.g &= ~a, this.a &= ~a, this.l())
+ })
+}
+k = hd.prototype;
+k.Sa = function() {
+ var a = [];
+ a[0] = this.m;
+ a[1] = this.v;
+ a[2] = this.aa;
+ a[3] = this.a;
+ a[4] = this.O;
+ a[5] = this.Ca;
+ a[6] = this.R;
+ a[7] = this.state;
+ a[8] = this.W;
+ a[9] = this.C;
+ a[10] = this.J;
+ return a
+};
+k.fb = function(a) {
+ this.m = a[0];
+ this.v = a[1];
+ this.aa = a[2];
+ this.a = a[3];
+ this.O = a[4];
+ this.Ca = a[5];
+ this.R = a[6];
+ this.state = a[7];
+ this.W = a[8];
+ this.C = a[9];
+ this.J = a[10]
+};
+k.Ki = function(a) {
+ if (a & 16) this.g = this.m = this.a = this.aa = 0, this.C = 1, this.i = -1, this.R = a & 1, this.state = 1;
+ else if (a & 8) a & 2 && (this.W = a & 1), a & 64 && (this.Z = 32 === (a & 32));
+ else {
+ var b = a >> 5;
+ 1 === b ? this.aa &= this.aa - 1 : 3 === b ? this.aa &= ~(1 << (a & 7)) : 192 !== (a & 200) && (this.aa &= this.aa - 1);
+ this.l()
+ }
+};
+k.Ji = function() {
+ return this.W ? this.aa : this.a
+};
+k.Mi = function(a) {
+ 0 === this.state ? this.R ? (this.R = !1, this.C = a & 2) : (this.m = ~a, this.l()) : 1 === this.state ? (this.v = a, this.state++) : 2 === this.state && (this.state = 0)
+};
+k.Li = function() {
+ return ~this.m & 255
+};
+k.Zj = function() {
+ return this.J
+};
+k.$j = function(a) {
+ this.J = a
+};
+
+function jd(a) {
+ this.j = a;
+ this.be = 0;
+ this.ha = new Uint8Array(128);
+ this.C = this.a = Date.now();
+ this.l = 0;
+ this.J = !1;
+ this.v = .9765625;
+ this.m = 38;
+ this.g = 2;
+ this.pg = this.i = 0;
+ n(a.o, 112, this, function(a) {
+ this.be = a & 127;
+ this.pg = a >> 7
+ });
+ n(a.o, 113, this, this.Th);
+ m(a.o, 113, this, this.Sh)
+}
+k = jd.prototype;
+k.Sa = function() {
+ var a = [];
+ a[0] = this.be;
+ a[1] = this.ha;
+ a[2] = this.a;
+ a[3] = this.C;
+ a[4] = this.l;
+ a[6] = this.J;
+ a[7] = this.v;
+ a[8] = this.m;
+ a[9] = this.g;
+ a[10] = this.i;
+ a[11] = this.pg;
+ return a
+};
+k.fb = function(a) {
+ this.be = a[0];
+ this.ha = a[1];
+ this.a = a[2];
+ this.C = a[3];
+ this.l = a[4];
+ this.J = a[6];
+ this.v = a[7];
+ this.m = a[8];
+ this.g = a[9];
+ this.i = a[10];
+ this.pg = a[11]
+};
+k.Ic = function(a) {
+ a = Date.now();
+ this.a += a - this.C;
+ this.C = a;
+ this.J && this.l < a && (this.j.Cb(8), this.i |= 192, this.l += this.v * Math.ceil((a - this.l) / this.v))
+};
+
+function kd(a, b) {
+ if (a.g & 4) a = b;
+ else {
+ a = b;
+ for (var c = b = 0, d; a;) d = a % 10, c |= d << 4 * b, b++, a = (a - d) / 10;
+ a = c
+ }
+ return a
+}
+k.Sh = function() {
+ switch (this.be) {
+ case 0:
+ return kd(this, (new Date(this.a)).getUTCSeconds());
+ case 2:
+ return kd(this, (new Date(this.a)).getUTCMinutes());
+ case 4:
+ return kd(this, (new Date(this.a)).getUTCHours());
+ case 7:
+ return kd(this, (new Date(this.a)).getUTCDate());
+ case 8:
+ return kd(this, (new Date(this.a)).getUTCMonth() + 1);
+ case 9:
+ return kd(this, (new Date(this.a)).getUTCFullYear() % 100);
+ case 10:
+ return this.m;
+ case 11:
+ return this.g;
+ case 12:
+ Pb(this.j, 8);
+ var a = this.i;
+ this.i &= -241;
+ return a;
+ case 13:
+ return 255;
+ case 50:
+ return kd(this,
+ (new Date(this.a)).getUTCFullYear() / 100 | 0);
+ default:
+ return this.ha[this.be]
+ }
+};
+k.Th = function(a) {
+ switch (this.be) {
+ case 10:
+ this.m = a & 127;
+ this.v = 1E3 / (32768 >> (this.m & 15) - 1);
+ break;
+ case 11:
+ this.g = a, this.g & 64 && (this.l = Date.now())
+ }
+ this.J = 64 === (this.g & 64) && 0 < (this.m & 15)
+};
+
+function ld(a, b) {
+ this.w = b;
+ this.j = a;
+ this.Eb = 4;
+ this.Uc = this.Kc = 0;
+ this.wd = 96;
+ this.rd = this.gg = 0;
+ this.Sc = 1;
+ this.ua = this.Uf = this.og = this.Hf = 0;
+ this.input = new ob(4096);
+ this.a = [];
+ this.ua = 4;
+ this.w.register("serial0-input", function(a) {
+ this.input.push(a);
+ this.wd |= 1;
+ this.Eb |= 4096;
+ md(this)
+ }, this);
+ a = a.o;
+ n(a, 1016, this, function(a) {
+ nd(this, a)
+ }, function(a) {
+ nd(this, a & 255);
+ nd(this, a >> 8)
+ });
+ n(a, 1017, this, function(a) {
+ this.Uc & 128 ? this.Kc = this.Kc & 255 | a << 8 : (this.rd = a & 15, md(this))
+ });
+ m(a, 1016, this, function() {
+ if (this.Uc & 128) return this.Kc &
+ 255;
+ var a = this.input.shift();
+ 0 === this.input.length && (this.wd &= -2, this.Eb &= -4097, md(this));
+ return a
+ });
+ m(a, 1017, this, function() {
+ return this.Uc & 128 ? this.Kc >> 8 : this.rd & 15
+ });
+ m(a, 1018, this, function() {
+ var a = this.Sc & 15 | 192;
+ 2 == this.Sc && (this.Eb &= -5, md(this));
+ return a
+ });
+ n(a, 1018, this, function(a) {
+ this.gg = a
+ });
+ m(a, 1019, this, function() {
+ return this.Uc
+ });
+ n(a, 1019, this, function(a) {
+ this.Uc = a
+ });
+ m(a, 1020, this, function() {
+ return this.Hf
+ });
+ n(a, 1020, this, function(a) {
+ this.Hf = a
+ });
+ m(a, 1021, this, function() {
+ return this.wd
+ });
+ n(a, 1021, this, function() {});
+ m(a, 1022, this, function() {
+ return this.og
+ });
+ n(a, 1022, this, function() {});
+ m(a, 1023, this, function() {
+ return this.Uf
+ });
+ n(a, 1023, this, function(a) {
+ this.Uf = a
+ })
+}
+ld.prototype.Sa = function() {
+ var a = [];
+ a[0] = this.Eb;
+ a[1] = this.Kc;
+ a[2] = this.Uc;
+ a[3] = this.wd;
+ a[4] = this.gg;
+ a[5] = this.rd;
+ a[6] = this.Sc;
+ a[7] = this.Hf;
+ a[8] = this.og;
+ a[9] = this.Uf;
+ a[10] = this.ua;
+ return a
+};
+ld.prototype.fb = function(a) {
+ this.Eb = a[0];
+ this.Kc = a[1];
+ this.Uc = a[2];
+ this.wd = a[3];
+ this.gg = a[4];
+ this.rd = a[5];
+ this.Sc = a[6];
+ this.Hf = a[7];
+ this.og = a[8];
+ this.Uf = a[9];
+ this.ua = a[10]
+};
+
+function md(a) {
+ a.Eb & 4096 && a.rd & 1 ? (a.Sc = 12, a.j.Cb(a.ua)) : a.Eb & 4 && a.rd & 2 ? (a.Sc = 2, a.j.Cb(a.ua)) : a.Eb & 1 && a.rd & 8 ? (a.Sc = 0, a.j.Cb(a.ua)) : (a.Sc = 1, Pb(a.j, a.ua))
+}
+
+function nd(a, b) {
+ if (a.Uc & 128) a.Kc = a.Kc & -256 | b;
+ else if (a.Eb |= 4, md(a), 255 !== b) {
+ var c = String.fromCharCode(b);
+ a.w.send("serial0-output-char", c);
+ a.a.push(b);
+ "\n" === c && (a.w.send("serial0-output-line", String.fromCharCode.apply("", a.a)), a.a = [])
+ }
+};
+
+function od(a) {
+ this.message = a
+}
+od.prototype = Error();
+
+function pd(a, b) {
+ if ("object" !== typeof a || null === a || a instanceof Array) return a;
+ if (a.BYTES_PER_ELEMENT) {
+ var c = new Uint8Array(a.buffer, a.byteOffset, a.length * a.BYTES_PER_ELEMENT);
+ return {
+ __state_type__: a.constructor.name,
+ buffer_id: b.push(c) - 1
+ }
+ }
+ a = a.Sa();
+ c = [];
+ for (var d = 0; d < a.length; d++) c[d] = pd(a[d], b);
+ return c
+}
+
+function qd(a, b, c) {
+ if ("object" !== typeof b || null === b) return b;
+ if (a instanceof Array) return b;
+ var d = b.__state_type__;
+ if (void 0 === d) {
+ d = a.Sa();
+ for (var e = 0; e < b.length; e++) b[e] = qd(d[e], b[e], c);
+ a.fb(b);
+ return a
+ }
+ a = {
+ Uint8Array: Uint8Array,
+ Int8Array: Int8Array,
+ Uint16Array: Uint16Array,
+ Int16Array: Int16Array,
+ Uint32Array: Uint32Array,
+ Int32Array: Int32Array,
+ Float32Array: Float32Array,
+ Float64Array: Float64Array
+ }[d];
+ b = c.ui[b.buffer_id];
+ return 1048576 <= b.length && a === Uint8Array ? new Uint8Array(c.Sg, b.offset, b.length) : new a(c.Sg.slice(b.offset,
+ b.offset + b.length))
+}
+q.prototype.we = function() {
+ for (var a = [], b = pd(this, a), c = [], d = 0, e = 0; e < a.length; e++) {
+ var f = a[e].byteLength;
+ c[e] = {
+ offset: d,
+ length: f
+ };
+ d += f;
+ d = d + 3 & -4
+ }
+ b = JSON.stringify({
+ buffer_infos: c,
+ state: b
+ });
+ e = 16 + 2 * b.length;
+ e = e + 3 & -4;
+ var h = e + d;
+ d = new ArrayBuffer(h);
+ var g = new Int32Array(d, 0, 4);
+ f = new Uint16Array(d, 16, b.length);
+ var p = new Uint8Array(d, e);
+ g[0] = -2039052682;
+ g[1] = 5;
+ g[2] = h;
+ g[3] = 2 * b.length;
+ for (e = 0; e < b.length; e++) f[e] = b.charCodeAt(e);
+ for (e = 0; e < a.length; e++) p.set(a[e], c[e].offset);
+ return d
+};
+q.prototype.Hd = function(a) {
+ var b = a.byteLength;
+ if (16 > b) throw new od("Invalid length: " + b);
+ var c = new Int32Array(a, 0, 4);
+ if (-2039052682 !== c[0]) throw new od("Invalid header: " + jb(c[0] >>> 0));
+ if (5 !== c[1]) throw new od("Version mismatch: dump=" + c[1] + " we=5");
+ if (c[2] !== b) throw new od("Length doesn't match header: real=" + b + " header=" + c[2]);
+ c = c[3];
+ if (0 > c || c + 12 >= b || c % 2) throw new od("Invalid info block length: " + c);
+ var d = c / 2,
+ e = new Uint16Array(a, 16, d),
+ f = "";
+ for (b = 0; b < d - 8;) f += String.fromCharCode(e[b++], e[b++], e[b++],
+ e[b++], e[b++], e[b++], e[b++], e[b++]);
+ for (; b < d;) f += String.fromCharCode(e[b++]);
+ b = JSON.parse(f);
+ d = b.state;
+ e = b.buffer_infos;
+ c = c + 19 & -4;
+ for (b = 0; b < e.length; b++) e[b].offset += c;
+ qd(this, d, {
+ Sg: a,
+ ui: e
+ })
+};
+
+function rd(a, b) {
+ this.j = a;
+ this.wb = a.G.wb;
+ this.w = b;
+ this.w.register("net0-receive", function(a) {
+ if (!(this.K & 1) && (this.w.send("eth-receive-end", [a.length]), this.Tf & 16 || this.Tf & 4 && 255 === a[0] && 255 === a[1] && 255 === a[2] && 255 === a[3] && 255 === a[4] && 255 === a[5] || !(this.Tf & 8 && 1 === (a[0] & 1) || a[0] !== this.memory[0] || a[1] !== this.memory[2] || a[2] !== this.memory[4] || a[3] !== this.memory[6] || a[4] !== this.memory[8] || a[5] !== this.memory[10]))) {
+ var b = this.jd << 8,
+ c = Math.max(60, a.length) + 4,
+ d = b + 4,
+ g = this.jd + 1 + (c >> 8);
+ if (b + c > this.memory.length) {
+ var p =
+ this.memory.length - d;
+ this.memory.set(a.subarray(0, p), d);
+ this.memory.set(a.subarray(p), 76)
+ } else if (this.memory.set(a, d), 60 > a.length)
+ for (a = a.length; 60 > a; a++) this.memory[d + a] = 0;
+ g >= this.Ed && (g += this.qe - this.Ed);
+ this.memory[b] = 1;
+ this.memory[b + 1] = g;
+ this.memory[b + 2] = c;
+ this.memory[b + 3] = c >> 8;
+ this.jd = g;
+ sd(this, 1)
+ }
+ }, this);
+ this.port = 768;
+ this.name = "ne2k";
+ this.pe = [236, 16, 41, 128, 3, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, this.port & 255 | 1, this.port >> 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 244, 26, 0, 17, 0, 0, 184, 254, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0
+ ];
+ this.Hb = 40;
+ this.nc = [{
+ size: 32
+ }];
+ this.Af = this.aa = 0;
+ this.K = 1;
+ this.Vf = this.Ld = this.Zb = this.Ke = 0;
+ this.memory = new Uint8Array(32768);
+ this.Tf = 0;
+ this.sk = 1;
+ b = [0, 34, 21, 255 * Math.random() | 0, 255 * Math.random() | 0, 255 * Math.random() | 0];
+ for (var c = 0; 6 > c; c++) this.memory[c << 1] = this.memory[c << 1 | 1] = b[c];
+ this.memory[14] = this.memory[15] = 87;
+ this.nb = 0;
+ this.qe = 64;
+ this.Ed = 128;
+ this.pf = this.jd = 76;
+ b = a.o;
+ m(b, this.port | 0, this, function() {
+ return this.K
+ });
+ n(b, this.port | 0, this, function(a) {
+ this.K = a & -5;
+ this.K & 1 || (a | 24 &&
+ 0 === this.Zb && sd(this, 64), a & 4 && (a = this.Vf << 8, a = this.memory.subarray(a, a + this.Ld), this.w.send("net0-send", a), this.w.send("eth-transmit-end", [a.length]), sd(this, 2)))
+ });
+ m(b, this.port | 13, this, function() {
+ return 0
+ });
+ m(b, this.port | 14, this, function() {
+ return 0
+ });
+ m(b, this.port | 15, this, function() {
+ return 0
+ });
+ m(b, this.port | 31, this, function() {
+ 0 === (this.K & 192) && sd(this, 128);
+ return 0
+ });
+ n(b, this.port | 31, this, function() {});
+ n(b, this.port | 1, this, function(a) {
+ 0 === (this.K & 192) && (this.qe = a)
+ });
+ n(b, this.port | 2, this, function(a) {
+ 0 ===
+ (this.K & 192) && (this.Ed = a)
+ });
+ m(b, this.port | 7, this, function() {
+ return 0 === (this.K & 192) ? this.aa : this.jd
+ });
+ n(b, this.port | 7, this, function(a) {
+ 0 === (this.K & 192) ? (this.aa &= ~a, td(this)) : this.jd = a
+ });
+ n(b, this.port | 13, this, function() {});
+ n(b, this.port | 14, this, function(a) {
+ 0 === (this.K & 192) && (this.Ke = a)
+ });
+ n(b, this.port | 10, this, function(a) {
+ 0 === (this.K & 192) && (this.Zb = this.Zb & 65280 | a & 255)
+ });
+ n(b, this.port | 11, this, function(a) {
+ 0 === (this.K & 192) && (this.Zb = this.Zb & 255 | a << 8 & 65280)
+ });
+ n(b, this.port | 8, this, function(a) {
+ 0 === (this.K &
+ 192) && (this.nb = this.nb & 65280 | a & 255)
+ });
+ n(b, this.port | 9, this, function(a) {
+ 0 === (this.K & 192) && (this.nb = this.nb & 255 | a << 8 & 65280)
+ });
+ n(b, this.port | 15, this, function(a) {
+ 0 === (this.K & 192) && (this.Af = a, td(this))
+ });
+ m(b, this.port | 3, this, function() {
+ return 0 === (this.K & 192) ? this.pf : 0
+ });
+ n(b, this.port | 3, this, function(a) {
+ 0 === (this.K & 192) && (this.pf = a)
+ });
+ m(b, this.port | 4, this, function() {
+ return 0 === (this.K & 192) ? this.sk : 0
+ });
+ n(b, this.port | 4, this, function(a) {
+ 0 === (this.K & 192) && (this.Vf = a)
+ });
+ n(b, this.port | 5, this, function(a) {
+ 0 ===
+ (this.K & 192) && (this.Ld = this.Ld & -256 | a)
+ });
+ n(b, this.port | 6, this, function(a) {
+ 0 === (this.K & 192) && (this.Ld = this.Ld & 255 | a << 8)
+ });
+ m(b, this.port | 12, this, function() {
+ return 0 === (this.K & 192) ? 9 : 0
+ });
+ n(b, this.port | 12, this, function(a) {
+ this.Tf = a
+ });
+ m(b, this.port | 16, this, this.Wh, this.Ig, this.Vh);
+ n(b, this.port | 16, this, this.Jg, this.Jg, this.Xh);
+ Zb(a.G.wb, this)
+}
+k = rd.prototype;
+k.Sa = function() {
+ var a = [];
+ a[0] = this.aa;
+ a[1] = this.Af;
+ a[2] = this.K;
+ a[3] = this.Ke;
+ a[4] = this.Zb;
+ a[5] = this.Ld;
+ a[6] = this.Vf;
+ a[7] = this.nb;
+ a[8] = this.qe;
+ a[9] = this.jd;
+ a[10] = this.pf;
+ return a
+};
+k.fb = function(a) {
+ this.aa = a[0];
+ this.Af = a[1];
+ this.K = a[2];
+ this.Ke = a[3];
+ this.Zb = a[4];
+ this.Ld = a[5];
+ this.Vf = a[6];
+ this.nb = a[7];
+ this.qe = a[8];
+ this.jd = a[9];
+ this.pf = a[10]
+};
+
+function sd(a, b) {
+ a.aa |= b;
+ td(a)
+}
+
+function td(a) {
+ a.Af & a.aa ? a.wb.xb(a.Hb) : rc(a.wb, a.Hb)
+}
+
+function ud(a, b) {
+ 16 < a.nb && 16384 > a.nb || (a.Zb--, a.memory[a.nb++] = b, a.nb >= a.Ed << 8 && (a.nb += a.qe - a.Ed << 8), 0 === a.Zb && sd(a, 64))
+}
+k.Jg = function(a) {
+ ud(this, a);
+ this.Ke & 1 && ud(this, a >> 8)
+};
+k.Xh = function(a) {
+ ud(this, a);
+ ud(this, a >> 8);
+ ud(this, a >> 16);
+ ud(this, a >> 24)
+};
+
+function vd(a) {
+ var b = a.memory[a.nb++];
+ a.Zb--;
+ a.nb >= a.Ed << 8 && (a.nb += a.qe - a.Ed << 8);
+ 0 === a.Zb && sd(a, 64);
+ return b
+}
+k.Wh = function() {
+ return this.Ig() & 255
+};
+k.Ig = function() {
+ return this.Ke & 1 ? vd(this) | vd(this) << 8 : vd(this)
+};
+k.Vh = function() {
+ return vd(this) | vd(this) << 8 | vd(this) << 16 | vd(this) << 24
+};
+var wd = new Uint8Array(256),
+ xd = [],
+ zd = [],
+ Ad = [],
+ Bd = [];
+
+function Cd(a, b) {
+ this.j = a;
+ this.bg = !1;
+ this.w = b;
+ this.Va = new ob(64);
+ this.Ea = new ob(64);
+ this.l = this.C = this.Tb = this.oa = 0;
+ this.ka = new Uint8Array(256);
+ this.he = !1;
+ this.hf = 0;
+ this.Xb = this.Wb = this.yc = this.xc = !1;
+ this.Lc = [new pb, new pb];
+ this.O = 2;
+ this.Bb = 1024;
+ this.Ub = a.G.Ub;
+ this.Nb = this.wc = this.m = this.g = this.v = this.W = 0;
+ this.hc = 1;
+ this.ld = 5;
+ this.gc = !1;
+ this.a = new ArrayBuffer(65536);
+ this.dc = new Int8Array(this.a);
+ this.R = new Uint8Array(this.a);
+ this.cc = new Int16Array(this.a);
+ this.pc = new Uint16Array(this.a);
+ this.rc = new nb(this.a);
+ this.Vb = this.J = !1;
+ this.ve = 22050;
+ this.i = 1;
+ this.Fa = 170;
+ this.qa = 0;
+ this.gd = new Uint8Array(256);
+ this.Z = new ob(64);
+ this.Ya = this.Xa = this.uc = 0;
+ this.mi = !1;
+ this.ua = 5;
+ this.sd = new Uint8Array(16);
+ this.nf = 48E3;
+ a.o.te(544, this, this.Ni, this.Pi, this.Ri, this.Ti);
+ a.o.te(548, this, this.Vi, this.Xi);
+ m(a.o, 550, this, this.Zi);
+ m(a.o, 551, this, this.aj);
+ m(a.o, 552, this, this.cj);
+ m(a.o, 553, this, this.ej);
+ m(a.o, 554, this, this.gj);
+ m(a.o, 555, this, this.ij);
+ m(a.o, 556, this, this.kj);
+ m(a.o, 557, this, this.mj);
+ a.o.te(558, this, this.oj, this.qj);
+ a.o.Gc(544, this, this.Oi, this.Qi, this.Si, this.Ui);
+ a.o.Gc(548, this, this.Wi, this.Yi);
+ n(a.o, 550, this, this.$i);
+ n(a.o, 551, this, this.bj);
+ a.o.Gc(552, this, this.dj, this.fj);
+ n(a.o, 554, this, this.hj);
+ n(a.o, 555, this, this.jj);
+ n(a.o, 556, this, this.lj);
+ n(a.o, 557, this, this.nj);
+ n(a.o, 558, this, this.pj);
+ n(a.o, 559, this, this.rj);
+ a.o.te(816, this, this.Vj, this.Xj);
+ a.o.Gc(816, this, this.Wj, this.Yj);
+ this.Ub.Wf.push({
+ wf: this.qc,
+ xg: this
+ });
+ b.register("speaker-tell-samplerate", function(a) {
+ this.nf = a
+ }, this);
+ b.send("speaker-request-samplerate");
+ b.register("speaker-request-data", function(a) {
+ Dd(this, a)
+ }, this);
+ b.register("cpu-stop", function() {
+ this.bg = !0;
+ b.send("speaker-update-enable", !1)
+ }, this);
+ b.register("cpu-run", function() {
+ this.bg = !1;
+ b.send("speaker-update-enable", !this.Vb)
+ }, this);
+ Ed(this)
+}
+
+function Ed(a) {
+ a.Va.clear();
+ a.Ea.clear();
+ a.Tb = 0;
+ a.C = 0;
+ a.he = !1;
+ a.hf = 0;
+ a.xc = !1;
+ a.yc = !1;
+ a.Wb = !1;
+ a.Xb = !1;
+ a.Lc[0].clear();
+ a.Lc[1].clear();
+ a.O = 2;
+ a.W = 0;
+ a.v = 0;
+ a.g = 0;
+ a.m = 0;
+ a.wc = 0;
+ a.Nb = 0;
+ a.gc = !1;
+ a.R.fill(0);
+ a.J = !1;
+ a.Vb = !1;
+ a.Fa = 170;
+ a.qa = 0;
+ a.ve = 22050;
+ a.i = 1;
+ Fd(a, 1);
+ a.sd.fill(0);
+ a.gd.fill(0);
+ a.gd[5] = 1;
+ a.gd[9] = 248
+}
+k = Cd.prototype;
+k.Sa = function() {
+ var a = [];
+ a[2] = this.oa;
+ a[3] = this.Tb;
+ a[4] = this.C;
+ a[5] = this.l;
+ a[6] = this.ka;
+ a[7] = this.he;
+ a[8] = this.hf;
+ a[9] = this.xc;
+ a[10] = this.yc;
+ a[11] = this.Wb;
+ a[12] = this.Xb;
+ a[14] = this.O;
+ a[15] = this.W;
+ a[16] = this.v;
+ a[17] = this.g;
+ a[18] = this.m;
+ a[19] = this.wc;
+ a[20] = this.Nb;
+ a[21] = this.hc;
+ a[22] = this.ld;
+ a[23] = this.gc;
+ a[24] = this.R;
+ a[25] = this.J;
+ a[26] = this.Vb;
+ a[27] = this.ve;
+ a[28] = this.i;
+ a[29] = this.Fa;
+ a[30] = this.qa;
+ a[31] = this.gd;
+ a[33] = this.Jc;
+ a[34] = this.ua;
+ a[35] = this.sd;
+ a[36] = this.nf;
+ return a
+};
+k.fb = function(a) {
+ this.oa = a[2];
+ this.Tb = a[3];
+ this.C = a[4];
+ this.l = a[5];
+ this.ka = a[6];
+ this.he = a[7];
+ this.hf = a[8];
+ this.xc = a[9];
+ this.yc = a[10];
+ this.Wb = a[11];
+ this.Xb = a[12];
+ this.O = a[14];
+ this.W = a[15];
+ this.v = a[16];
+ this.g = a[17];
+ this.m = a[18];
+ this.wc = a[19];
+ this.Nb = a[20];
+ this.hc = a[21];
+ this.ld = a[22];
+ this.gc = a[23];
+ this.R = a[24];
+ this.J = a[25];
+ this.Vb = a[26];
+ this.ve = a[27];
+ this.i = a[28];
+ this.Fa = a[29];
+ this.qa = a[30];
+ this.gd = a[31];
+ this.Jc = a[33];
+ this.ua = a[34];
+ this.sd = a[35];
+ this.nf = a[36];
+ this.a = this.R.buffer;
+ this.dc = new Int8Array(this.a);
+ this.cc = new Int16Array(this.a);
+ this.pc = new Uint16Array(this.a);
+ this.rc = new nb(this.a);
+ this.w.send("speaker-update-enable", !this.Vb)
+};
+k.Ni = function() {
+ return 255
+};
+k.Pi = function() {
+ return 255
+};
+k.Ri = function() {
+ return 255
+};
+k.Ti = function() {
+ return 255
+};
+k.Vi = function() {
+ return this.l
+};
+k.Xi = function() {
+ var a = zd[this.l];
+ a || (a = this.sc);
+ return a.call(this)
+};
+k.Zi = function() {
+ return 255
+};
+k.aj = function() {
+ return 255
+};
+k.cj = function() {
+ return 255
+};
+k.ej = function() {
+ return 255
+};
+k.gj = function() {
+ this.Ea.length && (this.oa = this.Ea.shift());
+ return this.oa
+};
+k.ij = function() {
+ return 255
+};
+k.kj = function() {
+ return 127
+};
+k.mj = function() {
+ return 255
+};
+k.oj = function() {
+ this.sd[1] && Fd(this, 1);
+ return (this.Ea.length && !this.xc) << 7 | 127
+};
+k.qj = function() {
+ Fd(this, 2);
+ return 0
+};
+k.Oi = function() {
+ this.Xa = 0
+};
+k.Qi = function(a) {
+ var b = Bd[this.Xa];
+ b || (b = this.Za);
+ b.call(this, a, 0, this.Xa)
+};
+k.Si = function() {
+ this.Ya = 0
+};
+k.Ui = function(a) {
+ var b = Bd[this.Ya];
+ b || (b = this.Za);
+ b.call(this, a, 1, this.Ya)
+};
+k.Wi = function(a) {
+ this.l = a
+};
+k.Yi = function(a) {
+ var b = Ad[this.l];
+ b || (b = this.tc);
+ b.call(this, a)
+};
+k.$i = function(a) {
+ this.xc ? this.xc = !1 : a && Ed(this);
+ this.Ea.clear();
+ this.Ea.push(170)
+};
+k.bj = function() {};
+k.dj = function() {};
+k.fj = function() {};
+k.hj = function() {};
+k.jj = function() {};
+k.lj = function(a) {
+ 0 === this.Tb ? (this.Tb = a, this.Va.clear(), this.C = wd[a]) : this.Va.push(a);
+ this.Va.length >= this.C && (a = xd[this.Tb], a || (a = this.Mg), a.call(this), this.C = this.Tb = 0, this.Va.clear())
+};
+k.nj = function() {};
+k.pj = function() {};
+k.rj = function() {};
+k.Vj = function() {
+ this.Z.length && (this.uc = this.Z.shift());
+ return this.uc
+};
+k.Wj = function() {};
+k.Xj = function() {
+ return 0 | 128 * !this.Z.length
+};
+k.Yj = function(a) {
+ 255 == a && (this.Z.clear(), this.Z.push(254))
+};
+k.Mg = function() {};
+
+function B(a, b, c) {
+ c || (c = Cd.prototype.Mg);
+ for (var d = 0; d < a.length; d++) wd[a[d]] = b, xd[a[d]] = c
+}
+
+function Gd(a) {
+ for (var b = [], c = 0; 16 > c; c++) b.push(a + c);
+ return b
+}
+B([14], 2, function() {
+ this.gd[this.Va.shift()] = this.Va.shift()
+});
+B([15], 1, function() {
+ this.Ea.clear();
+ this.Ea.push(this.gd[this.Va.shift()])
+});
+B([16], 1, function() {
+ var a = this.Va.shift();
+ a = Hd(a / 127.5 + -1);
+ this.Lc[0].push(a);
+ this.Lc[1].push(a);
+ this.w.send("speaker-update-enable", !0)
+});
+B([20, 21], 2, function() {
+ this.wc = 1;
+ this.Nb = this.hc;
+ this.xc = this.Wb = this.Xb = this.gc = !1;
+ Id(this);
+ Jd(this)
+});
+B([22], 2);
+B([23], 2);
+B([28], 0, function() {
+ this.wc = 1;
+ this.Nb = this.hc;
+ this.gc = !0;
+ this.xc = this.Wb = this.Xb = !1;
+ Jd(this)
+});
+B([31], 0);
+B([32], 0, function() {
+ this.Ea.clear();
+ this.Ea.push(127)
+});
+B([36], 2);
+B([44], 0);
+B([48], 0);
+B([49], 0);
+B([52], 0);
+B([53], 0);
+B([54], 0);
+B([55], 0);
+B([56], 0);
+B([64], 1, function() {
+ this.ve = 1E6 / (256 - this.Va.shift()) / (this.yc ? 2 : 1)
+});
+B([65, 66], 2, function() {
+ this.ve = this.Va.shift() << 8 | this.Va.shift()
+});
+B([72], 2, function() {
+ Id(this)
+});
+B([116], 2);
+B([117], 2);
+B([118], 2);
+B([119], 2);
+B([125], 0);
+B([127], 0);
+B([128], 2);
+B([144], 0, function() {
+ this.wc = 1;
+ this.Nb = this.hc;
+ this.gc = !0;
+ this.Xb = !1;
+ this.xc = !0;
+ this.Wb = !1;
+ Jd(this)
+});
+B([145], 0);
+B([152], 0);
+B([153], 0);
+B([160], 0);
+B([168], 0);
+B(Gd(176), 3, function() {
+ if (!(this.Tb & 8)) {
+ var a = this.Va.shift();
+ this.wc = 2;
+ this.Nb = this.ld;
+ this.gc = !!(this.Tb & 4);
+ this.Xb = !!(a & 16);
+ this.yc = !!(a & 32);
+ this.Wb = !0;
+ Id(this);
+ Jd(this)
+ }
+});
+B(Gd(192), 3, function() {
+ if (!(this.Tb & 8)) {
+ var a = this.Va.shift();
+ this.wc = 1;
+ this.Nb = this.hc;
+ this.gc = !!(this.Tb & 4);
+ this.Xb = !!(a & 16);
+ this.yc = !!(a & 32);
+ this.Wb = !1;
+ Id(this);
+ Jd(this)
+ }
+});
+B([208], 0, function() {
+ this.Vb = !0;
+ this.w.send("speaker-update-enable", !1)
+});
+B([209], 0, function() {
+ this.he = !0
+});
+B([211], 0, function() {
+ this.he = !1
+});
+B([212], 0, function() {
+ this.Vb = !1;
+ this.w.send("speaker-update-enable", !0)
+});
+B([213], 0, function() {
+ this.Vb = !0;
+ this.w.send("speaker-update-enable", !1)
+});
+B([214], 0, function() {
+ this.Vb = !1;
+ this.w.send("speaker-update-enable", !0)
+});
+B([216], 0, function() {
+ this.Ea.clear();
+ this.Ea.push(255 * this.he)
+});
+B([217, 218], 0, function() {
+ this.gc = !1
+});
+B([224], 1, function() {
+ this.Ea.clear();
+ this.Ea.push(~this.Va.shift())
+});
+B([225], 0, function() {
+ this.Ea.clear();
+ this.Ea.push(4);
+ this.Ea.push(5)
+});
+B([226], 1);
+B([227], 0, function() {
+ this.Ea.clear();
+ for (var a = 0; 44 > a; a++) this.Ea.push("COPYRIGHT (C) CREATIVE TECHNOLOGY LTD, 1992.".charCodeAt(a));
+ this.Ea.push(0)
+});
+B([228], 1, function() {
+ this.hf = this.Va.shift()
+});
+B([232], 0, function() {
+ this.Ea.clear();
+ this.Ea.push(this.hf)
+});
+B([242, 243], 0, function() {
+ this.xb()
+});
+var Kd = new Uint8Array(256);
+Kd[14] = 255;
+Kd[15] = 7;
+Kd[55] = 56;
+B([249], 1, function() {
+ var a = this.Va.shift();
+ this.Ea.clear();
+ this.Ea.push(Kd[a])
+});
+Cd.prototype.sc = function() {
+ return this.ka[this.l]
+};
+Cd.prototype.tc = function(a) {
+ this.ka[this.l] = a
+};
+
+function Ld(a, b) {
+ b || (b = Cd.prototype.sc);
+ zd[a] = b
+}
+
+function Md(a, b) {
+ b || (b = Cd.prototype.tc);
+ Ad[a] = b
+}
+Ld(0, function() {
+ return 0
+});
+Md(0);
+Md(14, function(a) {
+ this.yc = a & 2;
+ this.w.send("speaker-stereo", this.yc);
+ this.w.send("speaker-filter", a & 32)
+});
+Ld(128, function() {
+ switch (this.ua) {
+ case 2:
+ return 1;
+ case 5:
+ return 2;
+ case 7:
+ return 4;
+ case 10:
+ return 8;
+ default:
+ return 0
+ }
+});
+Md(128, function(a) {
+ a & 1 && (this.ua = 2);
+ a & 2 && (this.ua = 5);
+ a & 4 && (this.ua = 7);
+ a & 8 && (this.ua = 10)
+});
+Ld(129, function() {
+ var a = 0;
+ switch (this.hc) {
+ case 0:
+ a |= 1;
+ break;
+ case 1:
+ a |= 2;
+ break;
+ case 3:
+ a |= 8
+ }
+ switch (this.ld) {
+ case 5:
+ a |= 32;
+ break;
+ case 6:
+ a |= 64;
+ break;
+ case 7:
+ a |= 128
+ }
+ return a
+});
+Md(129, function(a) {
+ a & 1 && (this.hc = 0);
+ a & 2 && (this.hc = 1);
+ a & 8 && (this.hc = 3);
+ a & 32 && (this.ld = 5);
+ a & 64 && (this.ld = 6);
+ a & 128 && (this.ld = 7)
+});
+Ld(130, function() {
+ for (var a = 32, b = 0; 16 > b; b++) a |= b * this.sd[b];
+ return a
+});
+Cd.prototype.Za = function() {};
+
+function Nd(a, b) {
+ b || (b = Cd.prototype.Za);
+ for (var c = 0; c < a.length; c++) Bd[a[c]] = b
+}
+
+function Od(a, b) {
+ for (var c = []; a <= b; a++) c.push(a);
+ return c
+}
+var Pd = new Uint8Array(32);
+Pd[0] = 0;
+Pd[1] = 1;
+Pd[2] = 2;
+Pd[3] = 3;
+Pd[4] = 4;
+Pd[5] = 5;
+Pd[8] = 6;
+Pd[9] = 7;
+Pd[10] = 8;
+Pd[11] = 9;
+Pd[12] = 10;
+Pd[13] = 11;
+Pd[16] = 12;
+Pd[17] = 13;
+Pd[18] = 14;
+Pd[19] = 15;
+Pd[20] = 16;
+Pd[21] = 17;
+Nd([1], function(a, b) {
+ this.mi[b] = a & 1
+});
+Nd([2]);
+Nd([3]);
+Nd([4], function() {});
+Nd([5], function() {});
+Nd([8], function() {});
+Nd(Od(32, 53), function() {});
+Nd(Od(64, 85), function() {});
+Nd(Od(96, 117), function() {});
+Nd(Od(128, 149), function() {});
+Nd(Od(160, 168), function() {});
+Nd(Od(176, 184), function() {});
+Nd([189], function() {});
+Nd(Od(192, 200), function() {});
+Nd(Od(224, 245), function() {});
+
+function Id(a) {
+ a.W = 1 + (a.Va.shift() << 0) + (a.Va.shift() << 8)
+}
+
+function Jd(a) {
+ a.i = 1;
+ a.Wb && (a.i *= 2);
+ a.O = Math.round(a.nf / a.ve);
+ a.v = a.W * a.i;
+ a.m = 1024 * a.i;
+ a.m = Math.min(a.v >> 2, a.m);
+ a.J = !0;
+ a.Ub.vc[a.Nb] || a.qc(a.Nb)
+}
+Cd.prototype.qc = function(a) {
+ a === this.Nb && this.J && (this.J = !1, this.g = this.v, this.Vb = !1, this.w.send("speaker-update-enable", !0), Qd(this))
+};
+
+function Qd(a) {
+ if (a.g && !(a.Lc[0].length > 2 * a.Bb || a.bg || a.Vb)) {
+ var b = Math.min(a.g, a.m),
+ c = Math.floor(b / a.i);
+ a.Ub.Me(a.rc, 0, b, a.Nb, function(d) {
+ d || (Rd(a, c), a.g -= b, a.g || (a.xb(a.wc), a.gc && (a.g = a.v)), setTimeout(function() {
+ Qd(a)
+ }, 0))
+ })
+ }
+}
+
+function Rd(a, b) {
+ var c = a.Wb ? 32767.5 : 127.5,
+ d = a.Xb ? 0 : -1,
+ e = (a.yc ? 1 : 2) * a.O,
+ f;
+ a.Wb ? f = a.Xb ? a.cc : a.pc : f = a.Xb ? a.dc : a.R;
+ for (var h = 0, g = 0; g < b; g++)
+ for (var p = Hd(f[g] / c + d), r = 0; r < e; r++) a.Lc[h].push(p), h ^= 1
+}
+
+function Dd(a, b) {
+ a.Bb = b;
+ var c = qb(a.Lc[0], b);
+ b = qb(a.Lc[1], b);
+ a.w.send("speaker-update-data", [c, b], [c.buffer, b.buffer]);
+ setTimeout(function() {
+ Qd(a)
+ }, 0)
+}
+Cd.prototype.xb = function(a) {
+ this.sd[a] = 1;
+ this.j.Cb(this.ua)
+};
+
+function Fd(a, b) {
+ a.sd[b] = 0;
+ Pb(a.j, a.ua)
+}
+
+function Hd(a) {
+ return -1 * (-1 > a) + 1 * (1 < a) + (-1 <= a && 1 >= a) * a
+};
+
+function Sd(a, b, c) {
+ this.pe = [244, 26, 9, 16, 7, 5, 16, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 168, 0, 0, 0, 16, 191, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 244, 26, 9, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0];
+ this.Hb = 48;
+ this.nc = [{
+ size: 256
+ }];
+ this.name = "virtio";
+ var d = a.o;
+ m(d, 43008, this, function() {
+ return 1
+ }, void 0, function() {
+ return 1
+ });
+ n(d, 43012, this, void 0, void 0, function() {});
+ n(d, 43022, this, void 0, function(a) {
+ this.bf = a
+ }, void 0);
+ m(d, 43020, this, void 0, function() {
+ return this.Fc
+ }, void 0);
+ m(d, 43016, this, void 0, void 0, function() {
+ return 0 ===
+ this.bf ? this.Ec : 0
+ });
+ n(d, 43016, this, void 0, void 0, function(a) {
+ this.Ec = a
+ });
+ n(d, 43026, this, function(a) {
+ 0 === a && this.reset();
+ this.Le = a
+ });
+ m(d, 43026, this, function() {
+ return this.Le
+ });
+ m(d, 43027, this, function() {
+ var a = this.aa;
+ this.aa = 0;
+ rc(this.wb, this.Hb);
+ return a
+ });
+ n(d, 43024, this, void 0, function() {
+ var a = (this.Ec << 12) + 16 * this.Fc,
+ b = a + 4;
+ a = this.j.ma(a + 2);
+ var c = this.Fc - 1;
+ for (a &= c; this.td !== a;) {
+ var e = this.j.ma(b + 2 * this.td);
+ Td(this, e);
+ this.td = this.td + 1 & c
+ }
+ });
+ this.j = a;
+ this.wb = a.G.wb;
+ this.w = b;
+ this.td = this.aa = this.Le =
+ this.bf = 0;
+ this.Fc = 32;
+ for (var e = this.Ec = 0; 128 > e; e++) m(d, 43028 + e, this, function(a) {
+ return a < this.ia.m.length ? this.ia.m[a] : 0
+ }.bind(this, e), void 0, void 0), n(d, 43028 + e, this, function() {}.bind(this, e), void 0, void 0);
+ this.ia = new ma(c, b);
+ this.ia.la = this.a.bind(this);
+ Zb(a.G.wb, this)
+}
+Sd.prototype.Sa = function() {
+ var a = [0];
+ a[1] = this.bf;
+ a[2] = this.Le;
+ a[3] = this.aa;
+ a[4] = this.td;
+ a[5] = this.Fc;
+ a[6] = this.Ec;
+ a[7] = this.ia;
+ return a
+};
+Sd.prototype.fb = function(a) {
+ this.bf = a[1];
+ this.Le = a[2];
+ this.aa = a[3];
+ this.td = a[4];
+ this.Fc = a[5];
+ this.Ec = a[6];
+ this.ia = a[7];
+ this.ia.la = this.a.bind(this)
+};
+Sd.prototype.reset = function() {
+ this.td = this.aa = this.Le = this.bf = 0;
+ this.Fc = 32;
+ this.Ec = 0
+};
+
+function Td(a, b) {
+ var c = b,
+ d = a.Ec << 12,
+ e = 0,
+ f = [];
+ do {
+ var h = d + 16 * c,
+ g = a.j.ma(h + 12);
+ if (g & 2) break;
+ var p = jc(a.j, h);
+ c = jc(a.j, h + 4);
+ var r = jc(a.j, h + 8) >>> 0;
+ f.push({
+ Yf: p,
+ Nh: c,
+ ng: r
+ });
+ if (g & 1) c = a.j.ma(h + 14);
+ else {
+ c = -1;
+ break
+ }
+ } while (1);
+ var v = -1,
+ E = 0;
+ qa(a.ia, {
+ start: b,
+ next: c
+ }, function() {
+ if (E >= v) {
+ if (e === f.length) return 0;
+ var a = f[e++];
+ p = a.Yf;
+ v = a.ng;
+ E = 0
+ }
+ return this.j.ja(p + E++)
+ }.bind(a))
+}
+Sd.prototype.a = function(a, b) {
+ if (-1 !== b.next) {
+ var c = this.Fc - 1;
+ a = this.ia.Rf;
+ var d = b.next,
+ e = this.Ec << 12,
+ f = 0,
+ h = [];
+ do {
+ d = e + 16 * d;
+ var g = this.j.ma(d + 12);
+ if (0 === (g & 2)) break;
+ var p = jc(this.j, d),
+ r = jc(this.j, d + 4),
+ v = jc(this.j, d + 8) >>> 0;
+ h.push({
+ Yf: p,
+ Nh: r,
+ ng: v
+ });
+ if (g & 1) d = this.j.ma(d + 14);
+ else break
+ } while (1);
+ g = -1;
+ for (e = r = 0; e < a; e++) {
+ d = this.ia.Aa[e];
+ if (r >= g) {
+ if (f === h.length) return 0;
+ g = h[f++];
+ p = g.Yf;
+ g = g.ng;
+ r = 0
+ }
+ this.j.za(p + r++, d)
+ }
+ p = (this.Ec << 12) + 16 * this.Fc + 4 + 2 * this.Fc;
+ p = p + 4095 & -4096;
+ this.j.ma(p);
+ f = this.j.ma(p + 2);
+ this.j.ze(p +
+ 2, f + 1);
+ c = p + 4 + 8 * (f & c);
+ this.j.fd(c, b.start);
+ this.j.fd(c + 4, a);
+ this.aa |= 1;
+ this.wb.xb(this.Hb)
+ }
+};
+
+function Ud() {
+ this.Xe = {};
+ this.a = void 0
+}
+Ud.prototype.register = function(a, b, c) {
+ var d = this.Xe[a];
+ void 0 === d && (d = this.Xe[a] = []);
+ d.push({
+ wf: b,
+ xg: c
+ })
+};
+Ud.prototype.unregister = function(a, b) {
+ var c = this.Xe[a];
+ void 0 !== c && (this.Xe[a] = c.filter(function(a) {
+ return a.wf !== b
+ }))
+};
+Ud.prototype.send = function(a, b) {
+ if (this.a && (a = this.a.Xe[a], void 0 !== a))
+ for (var c = 0; c < a.length; c++) {
+ var d = a[c];
+ d.wf.call(d.xg, b)
+ }
+};
+
+function Vd() {
+ var a = new Ud,
+ b = new Ud;
+ a.a = b;
+ b.a = a;
+ return [a, b]
+};
+
+function q(a) {
+ this.Ia = 0;
+ this.W = !0;
+ this.da = new Uint8Array(0);
+ this.Ef = new Uint16Array(this.da.buffer);
+ this.Cc = new Int32Array(this.da.buffer);
+ this.eb = new Uint8Array(8);
+ this.La = new Uint32Array(8);
+ this.xa = new Int32Array(8);
+ this.R = new Int32Array(1048576);
+ this.oc = new Uint8Array(1048576);
+ this.jf = new Uint8Array(1048576);
+ this.ta = !1;
+ this.Qc = this.ie = this.Rc = this.je = 0;
+ this.J = this.Md = !1;
+ this.K = new Int32Array(8);
+ this.K[0] = 0;
+ this.K[2] = 0;
+ this.K[3] = 0;
+ this.af = this.N = this.K[4] = 0;
+ this.Tc = this.qb = this.C = !1;
+ this.F = this.l =
+ this.S = this.kb = this.jb = this.u = this.flags = this.H = this.xe = this.ye = this.Kd = this.Xa = this.me = this.O = this.jc = 0;
+ this.ka = new Int32Array(2);
+ this.Z = new Float64Array(2);
+ this.v = this.m = this.f = this.kf = 0;
+ this.G = {};
+ this.oa = [];
+ this.V = !1;
+ this.ga = this.A = 0;
+ this.Oh = !0;
+ this.Y = 0;
+ this.b = new Int32Array(8);
+ this.Fd = new Uint32Array(this.b.buffer);
+ this.se = new Int16Array(this.b.buffer);
+ this.h = new Uint16Array(this.b.buffer);
+ this.sg = new Int8Array(this.b.buffer);
+ this.D = new Uint8Array(this.b.buffer);
+ this.s = new Int32Array(16);
+ new Uint32Array(this.s.buffer);
+ this.Gd = new Int8Array(this.s.buffer);
+ this.tg = new Uint8Array(this.s.buffer);
+ this.na = new Int32Array(32);
+ this.$e = 8064;
+ this.M = new Uint16Array(8);
+ this.md = new Int32Array(8);
+ this.Ye = [];
+ this.Ze = [];
+ this.Ff = [];
+ this.Gf = [];
+ this.$d = {
+ Zg: null,
+ Pd: null
+ };
+ this.zc = 0;
+ this.T = this.o = void 0;
+ this.w = a;
+ Wd(this);
+ this.kf = $a();
+ Xd(this)
+}
+k = q.prototype;
+k.Sa = function() {
+ var a = [];
+ a[0] = this.Ia;
+ a[1] = this.eb;
+ a[2] = this.xa;
+ a[3] = this.La;
+ a[4] = this.ta;
+ a[5] = this.Rc;
+ a[6] = this.je;
+ a[7] = this.Qc;
+ a[8] = this.ie;
+ a[9] = this.J;
+ a[10] = this.K;
+ a[11] = this.N;
+ a[12] = this.af;
+ a[13] = this.C;
+ a[16] = this.qb;
+ a[17] = this.Tc;
+ a[18] = this.jc;
+ a[19] = this.O;
+ a[20] = this.me;
+ a[21] = this.Xa;
+ a[22] = this.Kd;
+ a[23] = this.xe;
+ a[24] = this.ye;
+ a[25] = this.H;
+ a[26] = this.flags;
+ a[27] = this.u;
+ a[28] = this.jb;
+ a[29] = this.kb;
+ a[30] = this.S;
+ a[31] = this.l;
+ a[32] = this.f;
+ a[36] = this.V;
+ a[37] = this.A;
+ a[38] = this.ga;
+ a[39] = this.b;
+ a[40] =
+ this.M;
+ a[41] = this.md;
+ a[42] = this.da;
+ a[43] = this.T;
+ a[45] = this.G.Xf;
+ a[46] = this.G.Zf;
+ a[47] = this.G.bd;
+ a[48] = this.G.wb;
+ a[49] = this.G.Ub;
+ a[50] = this.G.Mh;
+ a[51] = this.G.si;
+ a[52] = this.G.Pd;
+ a[53] = this.G.Of;
+ a[54] = this.G.Jh;
+ a[55] = this.G.Og;
+ a[56] = this.G.Qa;
+ a[57] = this.G.Ma;
+ a[58] = this.G.If;
+ a[59] = this.G.bh;
+ a[60] = this.G.Vc;
+ a[61] = this.G.Ah;
+ a[62] = this.W;
+ a[63] = this.zc;
+ a[64] = this.G.Ve;
+ a[65] = this.Md;
+ a[66] = this.s;
+ return a
+};
+k.fb = function(a) {
+ this.Ia = a[0];
+ this.eb = a[1];
+ this.xa = a[2];
+ this.La = a[3];
+ this.ta = a[4];
+ this.Rc = a[5];
+ this.je = a[6];
+ this.Qc = a[7];
+ this.ie = a[8];
+ this.J = a[9];
+ this.K = a[10];
+ this.N = a[11];
+ this.af = a[12];
+ this.C = a[13];
+ this.qb = a[16];
+ this.Tc = a[17];
+ this.jc = a[18];
+ this.O = a[19];
+ this.me = a[20];
+ this.Xa = a[21];
+ this.Kd = a[22];
+ this.xe = a[23];
+ this.ye = a[24];
+ this.H = a[25];
+ this.flags = a[26];
+ this.u = a[27];
+ this.jb = a[28];
+ this.kb = a[29];
+ this.S = a[30];
+ this.l = a[31];
+ this.f = a[32];
+ this.V = a[36];
+ this.A = a[37];
+ this.ga = a[38];
+ this.b = a[39];
+ this.M = a[40];
+ this.md =
+ a[41];
+ this.da = a[42];
+ this.T = a[43];
+ this.G.Xf = a[45];
+ this.G.Zf = a[46];
+ this.G.bd = a[47];
+ this.G.wb = a[48];
+ this.G.Ub = a[49];
+ this.G.Mh = a[50];
+ this.G.si = a[51];
+ this.G.Pd = a[52];
+ this.G.Of = a[53];
+ this.G.Jh = a[54];
+ this.G.Og = a[55];
+ this.G.Qa = a[56];
+ this.G.Ma = a[57];
+ this.G.If = a[58];
+ this.G.bh = a[59];
+ this.G.Vc = a[60];
+ this.G.Ah = a[61];
+ this.W = a[62];
+ this.zc = a[63];
+ this.G.Ve = a[64];
+ this.Md = a[65];
+ this.s = a[66];
+ this.Ef = new Uint16Array(this.da.buffer, this.da.byteOffset, this.da.length >> 1);
+ this.Cc = new Int32Array(this.da.buffer, this.da.byteOffset,
+ this.da.length >> 2);
+ Yd(this);
+ this.Fd = new Uint32Array(this.b.buffer);
+ this.se = new Int16Array(this.b.buffer);
+ this.h = new Uint16Array(this.b.buffer);
+ this.sg = new Int8Array(this.b.buffer);
+ this.D = new Uint8Array(this.b.buffer);
+ new Uint32Array(this.s.buffer);
+ this.Gd = new Int8Array(this.s.buffer);
+ this.tg = new Uint8Array(this.s.buffer);
+ Wd(this)
+};
+k.tf = function(a) {
+ if (233495534 === a) this.J = !1, this.H = 0;
+ else throw console.log(a), console.log(a.stack), a;
+};
+k.reset = function() {
+ this.W = !0;
+ for (var a = 0; 8 > a; a++) this.eb[a] = 0, this.La[a] = 0, this.xa[a] = 0;
+ Yd(this);
+ for (a = 0; 8 > a; a++) this.b[a] = 0, this.M[a] = 0, this.K[a] = 0, this.md[a] = 0;
+ for (a = 0; a < this.s.length; a++) this.s[a] = 0;
+ for (a = 0; a < this.na.length; a++) this.na[a] = 0;
+ this.$e = 8064;
+ this.ta = !1;
+ this.Qc = this.ie = this.Rc = this.je = 0;
+ this.J = !1;
+ this.K[0] = 1610612752;
+ this.K[2] = 0;
+ this.K[3] = 0;
+ this.K[4] = 0;
+ this.md[6] = -61456;
+ this.md[7] = 1024;
+ this.N = 0;
+ this.V = !1;
+ this.af = 0;
+ this.qb = this.C = !1;
+ this.H = 0;
+ this.me = this.jc = -1;
+ Wd(this);
+ this.ga = this.Y =
+ 0;
+ this.Tc = !1;
+ this.xe = this.ye = this.Kd = 0;
+ this.flags = 2;
+ this.S = this.kb = this.jb = this.l = this.F = this.u = 0;
+ this.kf = $a();
+ this.A = 1048560;
+ Zd(this, 61440);
+ $d(this, 2, 48);
+ this.h[8] = 256;
+ this.G.Xf && this.G.Xf.reset();
+ this.zc = 0
+};
+k.Fg = function(a) {
+ 1048576 > a ? a = 1048576 : 0 > (a | 0) && (a = Math.pow(2, 31) - 131072);
+ this.Ia = a = (a - 1 | 131071) + 1 | 0;
+ a = new ArrayBuffer(a);
+ this.da = new Uint8Array(a);
+ this.Ef = new Uint16Array(a);
+ this.Cc = new Int32Array(a)
+};
+q.prototype.create_memory = q.prototype.Fg;
+q.prototype.Ob = function(a, b) {
+ this.Fg("number" === typeof a.Ia ? a.Ia : 67108864);
+ this.reset();
+ var c = new Na(this);
+ this.o = c;
+ this.$d.Zg = a.$d;
+ this.$d.Pd = a.wk;
+ bb(this);
+ var d = 0;
+ m(c, 179, this, function() {
+ return 0
+ });
+ m(c, 146, this, function() {
+ return d
+ });
+ n(c, 146, this, function(a) {
+ d = a
+ });
+ m(c, 1297, this, function() {
+ var a = this.zc & 255;
+ this.zc >>>= 8;
+ return a
+ });
+ n(c, 1296, this, void 0, function(a) {
+ 0 === a ? this.zc = -89064784 : 3 === a ? this.zc = this.Ia : this.zc = 5 === a ? 1 : 0
+ });
+ this.G = {};
+ a.yi && (this.G.Vc = new hd(this), this.G.wb = new nc(this), this.G.bd =
+ new jd(this), ae(this, this.G.bd, a), this.G.Ub = new Bc(this), this.G.Pd = new Pc(this, b, a.Ja || 8388608), this.T = new rb(this), this.G.Of = new dd(this, b), this.G.Jh = new ld(this, b), this.G.Og = new sc(this, a.Ra), c = 0, a.Ma && (this.G.Ma = new Nb(this, a.Ma, !1, c++, b)), a.Qa && (this.G.Qa = new Nb(this, a.Qa, !0, c++, b)), a.zf && (this.G.zf = new Nb(this, a.zf, !1, c++, b)), this.G.If = new Ic(this, b), a.hi && (this.G.bh = new rd(this, b)), a.Pc && (this.G.Xf = new Sd(this, b, a.Pc)), this.G.Ah = new Cd(this, b));
+ a.oe && be(this, a.oe.buffer)
+};
+
+function be(a, b) {
+ if (8192 > b.byteLength) {
+ var c = new Int32Array(2048);
+ (new Uint8Array(c.buffer)).set(new Uint8Array(b))
+ } else c = new Int32Array(b, 0, 2048);
+ for (var d = 0; 8192 > d; d += 4)
+ if (464367618 === c[d >> 2]) {
+ var e = c[d + 4 >> 2];
+ if (!(464367618 + e + c[d + 8 >> 2] | 0)) {
+ a.b[0] = 732803074;
+ a.b[3] = 31744;
+ a.fd(31744, 0);
+ a.K[0] = 1;
+ a.ta = !0;
+ a.flags = 2;
+ ce(a, !0);
+ a.qb = !0;
+ for (var f = 0; 6 > f; f++) a.eb[f] = 0, a.xa[f] = 0, a.La[f] = 4294967295, a.M[f] = 45058;
+ if (e & 65536) {
+ e = c[d + 16 >> 2];
+ var h = c[d + 20 >> 2];
+ f = c[d + 28 >> 2];
+ b = new Uint8Array(b, d - (c[d + 12 >> 2] - e), 0 === h ? void 0 :
+ h - e);
+ a.da.set(b, e);
+ a.A = C(a, 1) + f | 0
+ } else if (1179403647 === c[0])
+ for (c = de(b), a.A = C(a, 1) + c.jg.ii | 0, c = ia(c.ek), d = c.next(); !d.done; d = c.next()) d = d.value, 0 !== d.type && 1 === d.type && (e = new Uint8Array(b, d.offset, d.ki), a.da.set(e, d.Di));
+ a.o.Gc(244, a, function(a) {
+ console.log("Test exited with code " + jb(a, 2));
+ throw "HALT";
+ }, function() {}, function() {}, function() {});
+ for (b = {
+ qd: 14
+ }; 15 >= b.qd; b = {
+ qd: b.qd
+ }, b.qd++) n(a.o, 8192 + b.qd, a, function(a) {
+ return function(b) {
+ b ? this.Cb(a.qd) : Pb(this, a.qd)
+ }
+ }(b));
+ break
+ }
+ }
+}
+
+function ae(a, b, c) {
+ var d = c.ae || 531;
+ b.ha[56] = 1 | d >> 4 & 240;
+ b.ha[61] = d & 255;
+ b.ha[21] = 128;
+ b.ha[22] = 2;
+ d = 0;
+ 1048576 <= a.Ia && (d = a.Ia - 1048576 >> 10, d = Math.min(d, 65535));
+ b.ha[23] = d & 255;
+ b.ha[24] = d >> 8 & 255;
+ b.ha[48] = d & 255;
+ b.ha[49] = d >> 8 & 255;
+ d = 0;
+ 16777216 <= a.Ia && (d = a.Ia - 16777216 >> 16, d = Math.min(d, 65535));
+ b.ha[52] = d & 255;
+ b.ha[53] = d >> 8 & 255;
+ b.ha[91] = 0;
+ b.ha[92] = 0;
+ b.ha[93] = 0;
+ b.ha[20] = 47;
+ b.ha[95] = 0;
+ c.ji && (b.ha[63] = 1)
+}
+
+function bb(a) {
+ var b = a.$d.Zg,
+ c = a.$d.Pd;
+ if (b) {
+ var d = new Uint8Array(b);
+ a.da.set(d, 1048576 - b.byteLength);
+ if (c) {
+ var e = new Uint8Array(c);
+ a.da.set(e, 786432);
+ Pa(a.o, 4272947200, 1048576, function(a) {
+ a = a - 4272947200 | 0;
+ return a < e.length ? e[a] : 0
+ }, function() {})
+ }
+ Pa(a.o, 4293918720, 1048576, function(a) {
+ return this.da[a & 1048575]
+ }.bind(a), function(a, b) {
+ this.da[a & 1048575] = b
+ }.bind(a))
+ }
+}
+q.prototype.qa = function() {
+ try {
+ this.Fa()
+ } catch (a) {
+ this.tf(a)
+ }
+};
+q.prototype.Fa = function() {
+ for (var a = 11001; a--;) ee(this)
+};
+"undefined" !== typeof window && (window.__no_inline_for_closure_compiler__ = [q.prototype.tf, q.prototype.Fa, q.prototype.qa]);
+
+function ee(a) {
+ a.ga = a.A;
+ a.Y++;
+ var b = a.$b();
+ a.oa[b](a)
+}
+q.prototype.Uh = function() {
+ try {
+ ee(this)
+ } catch (a) {
+ this.tf(a)
+ }
+};
+q.prototype.cycle = q.prototype.Uh;
+
+function fe(a, b) {
+ a.H |= b + 1;
+ ge(a);
+ a.H = 0
+}
+
+function ge(a) {
+ if (Bb(a)) a.Za[a.$b()](a);
+ else a.Ya[a.$b()](a)
+}
+
+function he(a, b) {
+ if (-2147483648 === (b & -2147483647)) throw a.debug.P("#GP handler");
+ a.K[0] = b;
+ a.T || (a.K[0] |= 4);
+ a.K[0] |= 16;
+ b = -2147483648 === (a.K[0] & -2147483648);
+ b !== a.V && (a.V = b, Yd(a));
+ a.ta = 1 === (a.K[0] & 1)
+}
+
+function ie(a) {
+ a.jc = -1;
+ a.me = -1
+}
+k = q.prototype;
+k.$b = function() {
+ this.A & -4096 ^ this.jc && (this.O = je(this, this.A) ^ this.A, this.jc = this.A & -4096);
+ var a = this.ja(this.O ^ this.A);
+ this.A = this.A + 1 | 0;
+ return a
+};
+k.xh = function() {
+ return this.$b() << 24 >> 24
+};
+k.Qf = function() {
+ if (4094 < (this.A ^ this.jc) >>> 0) return this.$b() | this.$b() << 8;
+ var a = this.ma(this.O ^ this.A);
+ this.A = this.A + 2 | 0;
+ return a
+};
+k.wh = function() {
+ if (4092 < (this.A ^ this.jc) >>> 0) return this.Qf() | this.Qf() << 16;
+ var a = jc(this, this.O ^ this.A);
+ this.A = this.A + 4 | 0;
+ return a
+};
+
+function ke(a, b) {
+ var c = new Int32Array(2);
+ c[0] = a;
+ c[1] = b;
+ return c
+}
+
+function le(a, b, c, d) {
+ var e = new Int32Array(4);
+ e[0] = a;
+ e[1] = b;
+ e[2] = c;
+ e[3] = d;
+ return e
+}
+
+function D(a) {
+ a.f = a.$b()
+}
+k.yh = q.prototype.$b;
+k.gk = q.prototype.$b;
+k.L = q.prototype.$b;
+k.wa = q.prototype.xh;
+k.U = q.prototype.Qf;
+k.ea = q.prototype.wh;
+k.uh = q.prototype.$b;
+k.mb = q.prototype.xh;
+k.Ib = q.prototype.Qf;
+k.X = q.prototype.wh;
+
+function F(a, b) {
+ return (me(a) ? a.i : a.g)[b](a)
+}
+
+function ne(a, b) {
+ return a.a[a.gk()](a, b)
+}
+
+function oe(a, b, c, d) {
+ a.za(b, d);
+ a.za(c, d >> 24);
+ b & 1 ? b & 2 ? (a.za(c - 2, d >> 8), a.za(c - 1, d >> 16)) : (a.za(b + 1 | 0, d >> 8), a.za(b + 2 | 0, d >> 16)) : (a.za(b + 1 | 0, d >> 8), a.za(c - 1, d >> 16))
+}
+
+function pe(a, b) {
+ return a.ja(je(a, b))
+}
+
+function x(a, b) {
+ return a.V && 4095 === (b & 4095) ? pe(a, b) | pe(a, b + 1 | 0) << 8 : a.ma(je(a, b))
+}
+
+function y(a, b) {
+ return a.V && 4093 <= (b & 4095) ? x(a, b) | x(a, b + 2 | 0) << 16 : jc(a, je(a, b))
+}
+
+function qe(a, b) {
+ var c = ke(0, 0);
+ a.V && 4089 <= (b & 4095) ? (c[0] = y(a, b), c[1] = y(a, b + 4 | 0)) : (c[0] = jc(a, je(a, b)), c[1] = jc(a, je(a, b + 4 | 0)));
+ return c
+}
+
+function re(a, b, c) {
+ a.za(se(a, b), c)
+}
+
+function u(a, b, c) {
+ var d = se(a, b);
+ 4095 === (b & 4095) ? (b = se(a, b + 1 | 0), a.za(d, c), a.za(b, c >> 8)) : a.ze(d, c)
+}
+
+function w(a, b, c) {
+ var d = se(a, b);
+ 4093 <= (b & 4095) ? oe(a, d, se(a, b + 3 & -4) | b + 3 & 3, c) : a.fd(d, c)
+}
+
+function te(a, b, c, d) {
+ Cb(a, b, 8);
+ w(a, b, c);
+ w(a, b + 4 | 0, d)
+}
+
+function ue(a, b, c, d, e, f) {
+ Cb(a, b, 16);
+ w(a, b, c);
+ w(a, b + 4 | 0, d);
+ w(a, b + 8 | 0, e);
+ w(a, b + 12 | 0, f)
+}
+
+function ve(a) {
+ return me(a) ? we(a, 3) + a.ea() | 0 : we(a, 3) + a.U() | 0
+}
+
+function xe(a) {
+ return a.flags >> 12 & 3
+}
+
+function ye(a) {
+ return !!(a.flags & 131072)
+}
+
+function ze(a) {
+ return a.flags & -2262 | !!a.cb() | !!a.Ug() << 2 | !!Ae(a) << 4 | !!a.Ac() << 6 | !!a.xf() << 7 | !!a.Te() << 11
+}
+
+function Be(a, b) {
+ var c = 1769472,
+ d = 2588629;
+ a.flags & 131072 ? (c |= 12288, d |= 1572864) : a.N && (c |= 12288, a.N > xe(a) && (c |= 512));
+ a.flags = (b ^ (a.flags ^ b) & c) & d | 2;
+ a.u = 0
+}
+
+function Ce(a) {
+ return a.qb ? a.b[4] : a.h[8]
+}
+
+function De(a, b) {
+ a.qb ? a.b[4] = b : a.h[8] = b
+}
+
+function Ee(a, b) {
+ a.qb ? a.b[4] += b : a.h[8] += b
+}
+
+function G(a, b) {
+ return a.qb ? C(a, 2) + a.b[4] + b | 0 : C(a, 2) + (a.h[8] + b & 65535) | 0
+}
+
+function Fe(a) {
+ return a.A - C(a, 1) | 0
+}
+
+function Ge(a, b, c, d) {
+ a.Tc = !1;
+ if (a.ta) {
+ if (ye(a) && a.K[4] & 1) throw a.debug.P("VME");
+ ye(a) && c && 3 > xe(a) && H(a, 0);
+ if ((b << 3 | 7) > a.je) throw a.debug.P("#GP handler");
+ var e = a.Rc + (b << 3) | 0;
+ a.V && (e = He(a, e));
+ var f = a.ma(e) | a.ma(e + 6 | 0) << 16,
+ h = a.ma(e + 2 | 0),
+ g = a.ja(e + 5 | 0),
+ p = g >> 5 & 3;
+ e = g & 31;
+ if (0 === (g & 128)) throw a.debug.P("#NP handler");
+ c && p < a.N && H(a, b << 3 | 2);
+ if (5 === e) {
+ f = Ie(a, h);
+ c = 3 >= f.type;
+ g = 2 === (f.type & 2);
+ if (!f.Gb || f.Ta || !f.hg) throw a.debug.P("#GP handler");
+ if (11 === (f.Sb & 31)) throw a.debug.P("#GP handler");
+ if (!f.ib) throw a.debug.P("#NP handler");
+ if (103 > f.Db) throw a.debug.P("#NP handler");
+ e = a.xa[6];
+ b = ze(a);
+ g && (b &= -16385);
+ Cb(a, e, 102);
+ w(a, e + 32, Fe(a));
+ w(a, e + 36, b);
+ w(a, e + 40, a.b[0]);
+ w(a, e + 44, a.b[1]);
+ w(a, e + 48, a.b[2]);
+ w(a, e + 52, a.b[3]);
+ w(a, e + 56, a.b[4]);
+ w(a, e + 60, a.b[5]);
+ w(a, e + 64, a.b[6]);
+ w(a, e + 68, a.b[7]);
+ w(a, e + 72, a.M[0]);
+ w(a, e + 76, a.M[1]);
+ w(a, e + 80, a.M[2]);
+ w(a, e + 84, a.M[3]);
+ w(a, e + 88, a.M[4]);
+ w(a, e + 92, a.M[5]);
+ a.za(f.gf + 5 | 0, a.ja(f.gf + 5 | 0) | 2);
+ g = f.gb;
+ u(a, g + 0, a.M[6]);
+ b = y(a, g + 28);
+ a.flags &= -131073;
+ p = y(a, g + 32);
+ var r = x(a, g + 76),
+ v = Ie(a, r);
+ if (v.Ta) throw a.debug.P("#TS handler");
+ if (!v.Gb) throw a.debug.P("#TS handler");
+ if (v.Fb) throw a.debug.P("#TS handler");
+ if (!v.ic) throw a.debug.P("#TS handler");
+ if (v.Lb && v.$ > v.Ba) throw a.debug.P("#TS handler");
+ if (!v.Lb && v.$ !== v.Ba) throw a.debug.P("#TS handler");
+ if (!v.ib) throw a.debug.P("#TS handler");
+ a.eb[1] = 0;
+ a.La[1] = v.Db;
+ a.xa[1] = v.gb;
+ a.M[1] = r;
+ a.N = v.$;
+ ie(a);
+ ce(a, v.size);
+ r = y(a, g + 36);
+ w(a, e + 0, h);
+ r |= 16384;
+ if (r & 131072) throw a.debug.P("task switch to VM mode");
+ Be(a, r);
+ a.flags |= 16384;
+ e = x(a, g + 96);
+ Je(a, e);
+ a.b[0] = y(a, g + 40);
+ a.b[1] = y(a, g + 44);
+ a.b[2] =
+ y(a, g + 48);
+ a.b[3] = y(a, g + 52);
+ a.b[4] = y(a, g + 56);
+ a.b[5] = y(a, g + 60);
+ a.b[6] = y(a, g + 64);
+ a.b[7] = y(a, g + 68);
+ $d(a, 0, x(a, g + 72));
+ $d(a, 2, x(a, g + 80));
+ $d(a, 3, x(a, g + 84));
+ $d(a, 4, x(a, g + 88));
+ $d(a, 5, x(a, g + 92));
+ a.A = C(a, 1) + p | 0;
+ a.xa[6] = f.gb;
+ a.La[6] = f.Db;
+ a.M[6] = h;
+ a.K[3] = b;
+ Ke(a);
+ a.K[0] |= 8;
+ !1 !== d && (c ? I(a, d & 65535) : J(a, d))
+ } else {
+ if (6 !== (e & -10)) throw a.debug.P("#GP handler");
+ c = 1 === (e & 1);
+ e = 0 === (e & 8);
+ g = Ie(a, h);
+ if (g.Ta) throw a.debug.P("#GP handler");
+ if (!g.ic || g.$ > a.N) throw a.debug.P("#GP handler");
+ g.ib || Le(a, b << 3 | 2);
+ b = ze(a);
+ if (!g.Lb &&
+ g.$ < a.N) {
+ r = Me(a, g.$);
+ a.Md ? (p = jc(a, r), r = a.ma(r + 4 | 0)) : (p = a.ma(r), r = a.ma(r + 2 | 0));
+ v = Ie(a, r);
+ if (v.Ta) throw a.debug.P("#TS handler");
+ if (v.Ba !== g.$) throw a.debug.P("#TS handler");
+ if (v.$ !== g.$ || !v.df) throw a.debug.P("#TS handler");
+ if (!v.ib) throw a.debug.P("#TS handler");
+ var E = a.b[4],
+ z = a.M[2],
+ A = (e ? 2 : 4) * (5 + (!1 !== d) + 4 * (131072 === (b & 131072)));
+ Ne(a, v.gb + (v.size ? p - A : p - A & 65535));
+ Ne(a, v.gb + p - 1);
+ a.N = g.$;
+ ie(a);
+ ce(a, g.size);
+ a.flags &= -196609;
+ $d(a, 2, r);
+ De(a, p);
+ b & 131072 && !e && (J(a, a.M[5]), J(a, a.M[4]), J(a, a.M[3]), J(a, a.M[0]));
+ e ? (I(a, z), I(a, E)) : (J(a, z), J(a, E))
+ } else if (g.Lb || g.$ === a.N) a.flags & 131072 && H(a, h & -4), A = (e ? 2 : 4) * (3 + (!1 !== d)), Cb(a, G(a, -A), A);
+ else throw a.debug.P("#GP handler");
+ e ? (I(a, b), I(a, a.M[1]), I(a, Fe(a)), !1 !== d && I(a, d), f &= 65535) : (J(a, b), J(a, a.M[1]), J(a, Fe(a)), !1 !== d && J(a, d));
+ b & 131072 && ($d(a, 5, 0), $d(a, 4, 0), $d(a, 3, 0), $d(a, 0, 0));
+ a.M[1] = h & -4 | a.N;
+ ce(a, g.size);
+ a.La[1] = g.Db;
+ a.xa[1] = g.gb;
+ a.A = C(a, 1) + f | 0;
+ a.flags &= -213249;
+ c ? a.J || ab(a) : a.flags &= -513
+ }
+ } else h = b << 2, d = a.ma(h), h = a.ma(h + 2 | 0), I(a, ze(a)), I(a, a.M[1]), I(a, Fe(a)),
+ a.flags &= -513, Zd(a, h), a.A = C(a, 1) + d | 0
+}
+
+function Oe(a, b) {
+ ye(a) && 3 > xe(a) && H(a, 0);
+ if (b) var c = x(a, G(a, 0)),
+ d = x(a, G(a, 2)),
+ e = x(a, G(a, 4));
+ else c = y(a, G(a, 0)), d = x(a, G(a, 4)), e = y(a, G(a, 8));
+ if (!a.ta || ye(a) && 3 === xe(a)) {
+ if (c & 4294901760) throw a.debug.P("#GP handler");
+ Zd(a, d);
+ a.A = c + C(a, 1) | 0;
+ b ? (Be(a, e | a.flags & -65536), Ee(a, 6)) : (Be(a, e), Ee(a, 12))
+ } else {
+ a.flags & 16384 && H(a, 0);
+ if (e & 131072) {
+ if (0 === a.N) {
+ var f = y(a, G(a, 12)),
+ h = x(a, G(a, 16));
+ b = x(a, G(a, 20));
+ var g = x(a, G(a, 24)),
+ p = x(a, G(a, 28)),
+ r = x(a, G(a, 32));
+ Be(a, e);
+ a.flags |= 131072;
+ Zd(a, d);
+ a.A = (c & 65535) + C(a, 1) | 0;
+ $d(a, 0,
+ b);
+ $d(a, 3, g);
+ $d(a, 4, p);
+ $d(a, 5, r);
+ Ee(a, 36);
+ a.b[4] = f;
+ $d(a, 2, h);
+ a.N = 3;
+ ie(a);
+ ce(a, !1);
+ return
+ }
+ e &= -131073
+ }
+ g = Ie(a, d);
+ if (g.Ta) throw a.debug.P("is null");
+ if (!g.ib) throw a.debug.P("not present");
+ if (!g.ic) throw a.debug.P("not exec");
+ if (g.Ba < a.N) throw a.debug.P("rpl < cpl");
+ if (g.Lb && g.$ > g.Ba) throw a.debug.P("conforming and dpl > rpl");
+ g.Lb || g.Ba === g.$ || H(a, d & -4);
+ if (g.Ba > a.N) {
+ b ? (f = x(a, G(a, 6)), h = x(a, G(a, 8))) : (f = y(a, G(a, 12)), h = x(a, G(a, 16)));
+ p = Ie(a, h);
+ r = g.Ba;
+ p.Ta && H(a, 0);
+ p.Gb && !p.Fb && p.Ba === r && p.Bf && p.$ === r || H(a,
+ h & -4);
+ if (!p.ib) throw a.A = a.ga, Ge(a, 12, !1, h & -4), 233495534;
+ b ? Be(a, e | a.flags & -65536) : Be(a, e);
+ a.N = g.Ba;
+ ie(a);
+ $d(a, 2, h);
+ De(a, f);
+ 0 === a.N && (a.flags = a.flags & -1572865 | e & 1572864)
+ } else g.Ba === a.N && (b ? (Ee(a, 6), Be(a, e | a.flags & -65536)) : (Ee(a, 12), Be(a, e)), 0 === a.N && (a.flags = a.flags & -1572865 | e & 1572864));
+ a.M[1] = d;
+ ce(a, g.size);
+ a.La[1] = g.Db;
+ a.xa[1] = g.gb;
+ a.A = c + C(a, 1) | 0
+ }
+ ab(a)
+}
+
+function Zd(a, b) {
+ a.M[1] = b;
+ a.eb[1] = 0;
+ a.xa[1] = b << 4
+}
+
+function Pe(a, b, c, d) {
+ if (!a.ta || ye(a)) Zd(a, c), a.A = C(a, 1) + b | 0, Ee(a, 2 * (Bb(a) ? 4 : 2) + d);
+ else {
+ var e = Ie(a, c);
+ e.Ta && H(a, 0);
+ e.Gb || H(a, c & -4);
+ e.Fb && H(a, c & -4);
+ e.ic || H(a, c & -4);
+ e.Ba < a.N && H(a, c & -4);
+ e.Lb && e.$ > e.Ba && H(a, c & -4);
+ e.Lb || e.$ === e.Ba || H(a, c & -4);
+ e.ib || Le(a, c & -4);
+ if (e.Ba > a.N) {
+ if (Bb(a)) var f = y(a, G(a, d + 8)),
+ h = x(a, G(a, d + 12));
+ else f = x(a, G(a, d + 4)), h = x(a, G(a, d + 6));
+ a.N = e.Ba;
+ ie(a);
+ $d(a, 2, h);
+ De(a, f + d)
+ } else Bb(a) ? Ee(a, 8 + d) : Ee(a, 4 + d);
+ ce(a, e.size);
+ a.eb[1] = 0;
+ a.La[1] = e.Db;
+ a.xa[1] = e.gb;
+ a.M[1] = c;
+ a.A = C(a, 1) + b | 0
+ }
+}
+
+function Qe(a, b, c, d) {
+ if (!a.ta || ye(a)) d && (Bb(a) ? (Cb(a, G(a, -8), 8), J(a, a.M[1]), J(a, Fe(a))) : (Cb(a, G(a, -4), 4), I(a, a.M[1]), I(a, Fe(a)))), Zd(a, c), a.A = C(a, 1) + b | 0;
+ else {
+ var e = Ie(a, c);
+ e.Ta && H(a, 0);
+ e.Gb || H(a, c & -4);
+ if (e.Fb)
+ if (12 === e.type || 4 === e.type) {
+ b = 4 === e.type;
+ (e.$ < a.N || e.$ < e.Ba) && H(a, c & -4);
+ e.ib || Le(a, c & -4);
+ c = e.rg >>> 16;
+ var f = Ie(a, c);
+ f.Ta && H(a, 0);
+ f.Gb || H(a, c & -4);
+ f.ic || H(a, c & -4);
+ f.$ > a.N && H(a, c & -4);
+ f.ib || Le(a, c & -4);
+ if (!f.Lb && f.$ < a.N) {
+ var h = Me(a, f.$);
+ if (a.Md) {
+ var g = jc(a, h);
+ h = a.ma(h + 4 | 0)
+ } else g = a.ma(h), h = a.ma(h +
+ 2 | 0);
+ var p = Ie(a, h);
+ if (p.Ta) throw a.debug.P("#TS handler");
+ if (p.Ba !== f.$) throw a.debug.P("#TS handler");
+ if (p.$ !== f.$ || !p.df) throw a.debug.P("#TS handler");
+ if (!p.ib) throw a.debug.P("#SS handler");
+ var r = e.Pf & 31,
+ v = b ? 4 : 8;
+ d && (v += b ? 4 + 2 * r : 8 + 4 * r);
+ p.size ? Cb(a, p.gb + g - v | 0, v) : Cb(a, p.gb + (g - v & 65535) | 0, v);
+ v = a.b[4];
+ var E = a.M[2];
+ p = G(a, 0);
+ a.N = f.$;
+ ie(a);
+ ce(a, f.size);
+ $d(a, 2, h);
+ De(a, g);
+ b ? (I(a, E), I(a, v)) : (J(a, E), J(a, v));
+ if (d)
+ if (b) {
+ for (d = r - 1; 0 <= d; d--) g = x(a, p + 2 * d), I(a, g);
+ I(a, a.M[1]);
+ I(a, Fe(a))
+ } else {
+ for (d = r - 1; 0 <= d; d--) g = y(a,
+ p + 4 * d), J(a, g);
+ J(a, a.M[1]);
+ J(a, Fe(a))
+ }
+ } else d && (b ? (Cb(a, G(a, -4), 4), I(a, a.M[1]), I(a, Fe(a))) : (Cb(a, G(a, -8), 8), J(a, a.M[1]), J(a, Fe(a))));
+ d = e.rg & 65535;
+ b || (d |= e.Pf & 4294901760);
+ ce(a, f.size);
+ a.eb[1] = 0;
+ a.La[1] = f.Db;
+ a.xa[1] = f.gb;
+ a.M[1] = c & -4 | a.N;
+ a.A = C(a, 1) + d | 0
+ } else throw a.debug.P("load system segment descriptor, type = " + (e.Sb & 15) + " (" + {
+ 9: "Available 386 TSS",
+ 11: "Busy 386 TSS",
+ 4: "286 Call Gate",
+ 12: "386 Call Gate"
+ }[e.Sb & 15] + ")");
+ else e.ic || H(a, c & -4), e.Lb ? e.$ > a.N && H(a, c & -4) : (e.Ba > a.N || e.$ !== a.N) && H(a, c & -4), e.ib ||
+ Le(a, c & -4), d && (Bb(a) ? (Cb(a, G(a, -8), 8), J(a, a.M[1]), J(a, Fe(a))) : (Cb(a, G(a, -4), 4), I(a, a.M[1]), I(a, Fe(a)))), ce(a, e.size), a.eb[1] = 0, a.La[1] = e.Db, a.xa[1] = e.gb, a.M[1] = c & -4 | a.N, a.A = C(a, 1) + b | 0
+ }
+}
+
+function Me(a, b) {
+ b = a.Md ? (b << 3) + 4 | 0 : (b << 2) + 2 | 0;
+ if ((b + 5 | 0) > a.La[6]) throw a.debug.P("#TS handler");
+ b = b + a.xa[6] | 0;
+ a.V && (b = He(a, b));
+ return b
+}
+
+function Re(a) {
+ a.A = a.ga;
+ Ge(a, 0, !1, !1);
+ throw 233495534;
+}
+
+function t(a) {
+ a.A = a.ga;
+ Ge(a, 6, !1, !1);
+ throw 233495534;
+}
+
+function Se(a) {
+ a.A = a.ga;
+ Ge(a, 7, !1, !1);
+ throw 233495534;
+}
+
+function H(a, b) {
+ a.A = a.ga;
+ Ge(a, 13, !1, b);
+ throw 233495534;
+}
+
+function Le(a, b) {
+ a.A = a.ga;
+ Ge(a, 11, !1, b);
+ throw 233495534;
+}
+
+function Te(a) {
+ a.K[0] & 12 && Se(a)
+}
+
+function K(a) {
+ a.K[0] & 12 && (a.K[0] & 8 ? Se(a) : t(a))
+}
+
+function L(a) {
+ return we(a, 3)
+}
+
+function N(a) {
+ return we(a, 2)
+}
+
+function we(a, b) {
+ var c = a.H & 7;
+ return c ? 7 === c ? 0 : C(a, c - 1) : C(a, b)
+}
+
+function C(a, b) {
+ a.ta && a.eb[b] && H(a, 0);
+ return a.xa[b]
+}
+
+function Ue(a) {
+ return 192 > a.f ? pe(a, F(a, a.f)) : a.D[a.f << 2 & 12 | a.f >> 2 & 1]
+}
+
+function O(a) {
+ return 192 > a.f ? x(a, F(a, a.f)) : a.h[a.f << 1 & 14]
+}
+
+function Ve(a) {
+ return 192 > a.f ? y(a, F(a, a.f)) : a.b[a.f & 7]
+}
+
+function We(a) {
+ return 192 > a.f ? y(a, F(a, a.f)) : a.s[2 * (a.f & 7)]
+}
+
+function P(a) {
+ return 192 > a.f ? qe(a, F(a, a.f)) : ke(a.s[2 * (a.f & 7)], a.s[2 * (a.f & 7) + 1])
+}
+
+function Xe(a) {
+ if (192 > a.f) return qe(a, F(a, a.f));
+ var b = (a.f & 7) << 2;
+ return ke(a.na[b], a.na[b | 1])
+}
+
+function Ye(a) {
+ if (192 > a.f) {
+ var b = F(a, a.f);
+ b = je(a, b);
+ return le(jc(a, b), jc(a, b + 4 | 0), jc(a, b + 8 | 0), jc(a, b + 12 | 0))
+ }
+ b = (a.f & 7) << 2;
+ return le(a.na[b], a.na[b | 1], a.na[b | 2], a.na[b | 3])
+}
+
+function Ze(a, b) {
+ if (192 > a.f) {
+ var c = F(a, a.f);
+ re(a, c, b)
+ } else a.D[a.f << 2 & 12 | a.f >> 2 & 1] = b
+}
+
+function $e(a, b) {
+ if (192 > a.f) {
+ var c = F(a, a.f);
+ u(a, c, b)
+ } else a.h[a.f << 1 & 14] = b
+}
+
+function af(a, b) {
+ if (192 > a.f) {
+ var c = F(a, a.f);
+ w(a, c, b)
+ } else a.b[a.f & 7] = b
+}
+
+function bf(a) {
+ if (192 > a.f) {
+ var b = F(a, a.f);
+ a.m = se(a, b);
+ return a.ja(a.m)
+ }
+ return a.D[a.f << 2 & 12 | a.f >> 2 & 1]
+}
+
+function cf(a, b) {
+ 192 > a.f ? a.za(a.m, b) : a.D[a.f << 2 & 12 | a.f >> 2 & 1] = b
+}
+
+function Q(a) {
+ if (192 > a.f) {
+ var b = F(a, a.f);
+ a.m = se(a, b);
+ if (a.V && 4095 === (b & 4095)) return a.v = se(a, b + 1 | 0), b = a.v, a.ja(a.m) | a.ja(b) << 8;
+ a.v = 0;
+ return a.ma(a.m)
+ }
+ return a.h[a.f << 1 & 14]
+}
+
+function R(a, b) {
+ if (192 > a.f)
+ if (a.v) {
+ var c = a.v;
+ a.za(a.m, b);
+ a.za(c, b >> 8)
+ } else a.ze(a.m, b);
+ else a.h[a.f << 1 & 14] = b
+}
+
+function df(a) {
+ if (192 > a.f) {
+ var b = F(a, a.f);
+ a.m = se(a, b);
+ if (a.V && 4093 <= (b & 4095)) {
+ a.v = se(a, b + 3 & -4) | b + 3 & 3;
+ b = a.m;
+ var c = a.v;
+ if (b & 1) var d = b & 2 ? xc(a, c - 2 >> 1) : xc(a, b + 1 >> 1);
+ else d = c - 1 | 0, d = a.ja(b + 1 | 0) | a.ja(d) << 8;
+ return a.ja(b) | d << 8 | a.ja(c) << 24
+ }
+ a.v = 0;
+ return jc(a, a.m)
+ }
+ return a.b[a.f & 7]
+}
+
+function ef(a, b) {
+ 192 > a.f ? a.v ? oe(a, a.m, a.v, b) : a.fd(a.m, b) : a.b[a.f & 7] = b
+}
+
+function ff(a) {
+ return a.h[a.f << 1 & 14]
+}
+
+function gf(a, b) {
+ a.h[a.f << 1 & 14] = b
+}
+
+function hf(a) {
+ return a.b[a.f & 7]
+}
+
+function jf(a, b) {
+ a.b[a.f & 7] = b
+}
+
+function kf(a) {
+ return a.D[a.f >> 1 & 12 | a.f >> 5 & 1]
+}
+
+function lf(a, b) {
+ a.D[a.f >> 1 & 12 | a.f >> 5 & 1] = b
+}
+
+function mf(a) {
+ return a.h[a.f >> 2 & 14]
+}
+
+function nf(a) {
+ return a.se[a.f >> 2 & 14]
+}
+
+function of (a, b) {
+ a.h[a.f >> 2 & 14] = b
+}
+
+function S(a) {
+ return a.b[a.f >> 3 & 7]
+}
+
+function pf(a, b) {
+ a.Fd[a.f >> 3 & 7] = b
+}
+
+function qf(a) {
+ return ke(a.na[(a.f >> 3 & 7) << 2], a.na[(a.f >> 3 & 7) << 2 | 1])
+}
+
+function rf(a) {
+ var b = (a.f >> 3 & 7) << 2;
+ return le(a.na[b | 0], a.na[b | 1], a.na[b | 2], a.na[b | 3])
+}
+
+function sf(a) {
+ return ke(a.s[2 * (a.f >> 3 & 7)], a.s[2 * (a.f >> 3 & 7) + 1])
+}
+
+function T(a, b, c) {
+ a.s[2 * (a.f >> 3 & 7)] = b;
+ a.s[2 * (a.f >> 3 & 7) + 1] = c
+}
+
+function tf(a, b, c, d, e) {
+ var f = (a.f >> 3 & 7) << 2;
+ a.na[f] = b;
+ a.na[f + 1] = c;
+ a.na[f + 2] = d;
+ a.na[f + 3] = e
+}
+
+function id(a, b) {
+ try {
+ a.ga = a.A, Ge(a, b, !1, !1)
+ } catch (c) {
+ a.tf(c)
+ }
+}
+
+function ab(a) {
+ a.flags & 512 && !a.J && (a.G.Vc && a.G.Vc.lf(), a.G.Zf && a.G.Zf.lf())
+}
+k.Cb = function(a) {
+ this.G.Vc && this.G.Vc.ef(a);
+ this.G.Ve && this.G.Ve.ef(a)
+};
+
+function Pb(a, b) {
+ a.G.Vc && a.G.Vc.sf(b);
+ a.G.Ve && a.G.Ve.sf(b)
+}
+
+function uf(a, b, c) {
+ if (a.ta && (a.N > xe(a) || a.flags & 131072)) {
+ a.Md || H(a, 0);
+ var d = a.La[6],
+ e = a.xa[6];
+ if (103 <= d) {
+ var f = a.ma(He(a, e + 100 + 2 | 0));
+ if (d >= (f + ((b + c - 1 | 0) >> 3) | 0) && (c = (1 << c) - 1 << (b & 7), b = He(a, e + f + (b >> 3) | 0), !((c & 65280 ? a.ma(b) : a.ja(b)) & c))) return
+ }
+ H(a, 0)
+ }
+}
+
+function ce(a, b) {
+ a.C !== b && (a.C = b, Wd(a))
+}
+
+function Wd(a) {
+ a.oa = a.C ? a.Za : a.Ya
+}
+
+function Ie(a, b) {
+ var c = 0 === (b & 4),
+ d = b & -8;
+ var e = {
+ Ba: b & 3,
+ hg: c,
+ Ta: !1,
+ Gb: !0,
+ gb: 0,
+ Sb: 0,
+ flags: 0,
+ type: 0,
+ $: 0,
+ Fb: !1,
+ ib: !1,
+ ic: !1,
+ df: !1,
+ Lb: !1,
+ size: !1,
+ We: !1,
+ Db: 0,
+ Bf: !1,
+ mg: !1,
+ gf: 0,
+ rg: 0,
+ Pf: 0
+ };
+ if (c) {
+ var f = a.Qc;
+ var h = a.ie
+ } else f = a.xa[7], h = a.La[7];
+ if (c && 0 === d) return e.Ta = !0, e;
+ if ((b | 7) > h) return e.Gb = !1, e;
+ f = f + d | 0;
+ a.V && (f = He(a, f));
+ e.gf = f;
+ e.gb = a.ma(f + 2 | 0) | a.ja(f + 4 | 0) << 16 | a.ja(f + 7 | 0) << 24;
+ e.Sb = a.ja(f + 5 | 0);
+ e.flags = a.ja(f + 6 | 0) >> 4;
+ e.rg = jc(a, f | 0);
+ e.Pf = jc(a, f + 4 | 0);
+ e.type = e.Sb & 15;
+ e.$ = e.Sb >> 5 & 3;
+ e.Fb = 0 === (e.Sb & 16);
+ e.ib = 128 === (e.Sb &
+ 128);
+ e.ic = 8 === (e.Sb & 8);
+ e.df = 2 === (e.Sb & 2);
+ e.Lb = 4 === (e.Sb & 4);
+ e.We = e.Lb && e.ic;
+ e.size = 4 === (e.flags & 4);
+ a = a.ma(f) | (a.ja(f + 6 | 0) & 15) << 16;
+ e.Db = e.flags & 8 ? (a << 12 | 4095) >>> 0 : a;
+ e.Bf = e.df && !e.ic;
+ e.mg = e.df || !e.ic;
+ return e
+}
+
+function $d(a, b, c) {
+ if (!a.ta || ye(a)) a.M[b] = c, a.eb[b] = 0, a.xa[b] = c << 4, 2 === b && (a.qb = !1);
+ else {
+ var d = Ie(a, c);
+ if (2 === b) {
+ d.Ta && H(a, 0);
+ d.Gb && !d.Fb && d.Ba === a.N && d.Bf && d.$ === a.N || H(a, c & -4);
+ if (!d.ib) throw a.A = a.ga, Ge(a, 12, !1, c & -4), 233495534;
+ a.qb = d.size
+ } else if (1 !== b) {
+ if (d.Ta) {
+ a.M[b] = c;
+ a.eb[b] = 1;
+ return
+ }(!d.Gb || d.Fb || !d.mg || !d.We && (d.Ba > d.$ || a.N > d.$)) && H(a, c & -4);
+ d.ib || Le(a, c & -4)
+ }
+ a.eb[b] = 0;
+ a.La[b] = d.Db;
+ a.xa[b] = d.gb;
+ a.M[b] = c
+ }
+}
+
+function Je(a, b) {
+ var c = Ie(a, b);
+ if (c.Ta) a.xa[7] = 0, a.La[7] = 0;
+ else {
+ if (!c.hg) throw a.debug.P("LDTR can only be loaded from GDT");
+ if (!c.ib) throw a.debug.P("#GP handler");
+ if (!c.Fb) throw a.debug.P("#GP handler");
+ if (2 !== c.type) throw a.debug.P("#GP handler");
+ a.xa[7] = c.gb;
+ a.La[7] = c.Db;
+ a.M[7] = b
+ }
+}
+
+function vf(a, b, c) {
+ b = Ie(a, b);
+ a.u &= -65;
+ var d = b.$ < a.N || b.$ < b.Ba;
+ if (b.Ta || !b.Gb || (b.Fb ? 58817 >> b.type & 1 || d : !b.We && d)) return a.flags &= -65, c;
+ a.flags |= 64;
+ return b.Pf & 16776960
+}
+
+function wf(a, b, c) {
+ b = Ie(a, b);
+ a.u &= -65;
+ var d = b.$ < a.N || b.$ < b.Ba;
+ if (b.Ta || !b.Gb || (b.Fb ? 62833 >> b.type & 1 || d : !b.We && d)) return a.flags &= -65, c;
+ a.flags |= 64;
+ return b.Db | 0
+}
+
+function Ke(a) {
+ a.jc = -1;
+ a.me = -1;
+ a.oc.set(a.jf)
+}
+
+function Yd(a) {
+ for (var b = new Int32Array(a.jf.buffer), c = 0; 262144 > c;) b[c++] = b[c++] = b[c++] = b[c++] = 0;
+ Ke(a)
+}
+
+function je(a, b) {
+ if (a.V)
+ if (3 === a.N)
+ if (a.V) {
+ var c = b >>> 12;
+ a = a.oc[c] & 4 ? a.R[c] ^ b : xf(a, b, 0, 1) | b & 4095
+ } else a = b;
+ else a = He(a, b);
+ else a = b;
+ return a
+}
+
+function se(a, b) {
+ if (a.V)
+ if (3 === a.N)
+ if (a.V) {
+ var c = b >>> 12;
+ a = a.oc[c] & 8 ? a.R[c] ^ b : xf(a, b, 1, 1) | b & 4095
+ } else a = b;
+ else a = Ne(a, b);
+ else a = b;
+ return a
+}
+
+function Ne(a, b) {
+ if (!a.V) return b;
+ var c = b >>> 12;
+ return a.oc[c] & 2 ? a.R[c] ^ b : xf(a, b, 1, 0) | b & 4095
+}
+
+function He(a, b) {
+ if (!a.V) return b;
+ var c = b >>> 12;
+ return a.oc[c] & 1 ? a.R[c] ^ b : xf(a, b, 0, 0) | b & 4095
+}
+
+function xf(a, b, c, d) {
+ var e = b >>> 12,
+ f = (a.K[3] >>> 2) + (e >> 10) | 0,
+ h = a.Cc[f],
+ g = !0,
+ p = !0;
+ h & 1 || (a.K[2] = b, yf(a, c, d, 0));
+ 0 === (h & 2) && (g = !1, c && (d || a.K[0] & 65536) && (a.K[2] = b, yf(a, c, d, 1)));
+ 0 === (h & 4) && (p = !1, d && (a.K[2] = b, yf(a, c, d, 1)));
+ if (h & a.af) a.Cc[f] = h | 32 | c << 6, b = h & 4290772992 | b & 4190208, h &= 256;
+ else {
+ var r = ((h & 4294963200) >>> 2) + (e & 1023) | 0,
+ v = a.Cc[r];
+ 0 === (v & 1) && (a.K[2] = b, yf(a, c, d, 0));
+ 0 === (v & 2) && (g = !1, c && (d || a.K[0] & 65536) && (a.K[2] = b, yf(a, c, d, 1)));
+ 0 === (v & 4) && (p = !1, d && (a.K[2] = b, yf(a, c, d, 1)));
+ Ac(a, f, h | 32);
+ Ac(a, r, v | 32 | c << 6);
+ b =
+ v & 4294963200;
+ h = v & 256
+ }
+ a.R[e] = b ^ e << 12;
+ g = p ? g ? 15 : 5 : g ? 3 : 1;
+ a.oc[e] = g;
+ h && a.K[4] & 128 && (a.jf[e] = g);
+ return b
+}
+
+function Cb(a, b, c) {
+ if (a.V) {
+ var d = 3 === a.N ? 1 : 0,
+ e = d ? 8 : 2,
+ f = b >>> 12;
+ 0 === (a.oc[f] & e) && xf(a, b, 1, d);
+ 4096 <= (b & 4095) + c - 1 && 0 === (a.oc[f + 1 | 0] & e) && xf(a, b + c - 1 | 0, 1, d)
+ }
+}
+
+function yf(a, b, c, d) {
+ if (a.J) throw a.debug.P("Double fault");
+ var e = a.K[2] >>> 12;
+ a.oc[e] = 0;
+ a.jf[e] = 0;
+ a.A = a.ga;
+ a.J = !0;
+ Ge(a, 14, !1, c << 2 | b << 1 | d);
+ throw 233495534;
+}
+
+function Bb(a) {
+ return a.C !== (32 === (a.H & 32))
+}
+
+function me(a) {
+ return a.C !== (64 === (a.H & 64))
+}
+
+function U(a, b) {
+ b = a.b[b];
+ return me(a) ? b : b & 65535
+}
+
+function zf(a, b) {
+ me(a) ? a.b[1] = b : a.h[2] = b
+}
+
+function V(a, b, c) {
+ me(a) ? a.b[b] += c : a.h[b << 1] += c
+}
+
+function Af(a) {
+ return me(a) ? --a.b[1] : --a.h[2]
+}
+"undefined" !== typeof window ? window.CPU = q : "undefined" !== typeof module && "undefined" !== typeof module.exports ? module.exports.CPU = q : "function" === typeof importScripts && (self.CPU = q);
+(function() {
+ q.prototype.g = Array(192);
+ q.prototype.i = Array(192);
+ q.prototype.a = Array(256);
+ q.prototype.g[0] = function(a) {
+ return L(a) + (a.h[6] + a.h[12] & 65535) | 0
+ };
+ q.prototype.g[64] = function(a) {
+ return L(a) + (a.h[6] + a.h[12] + a.mb() & 65535) | 0
+ };
+ q.prototype.g[128] = function(a) {
+ return L(a) + (a.h[6] + a.h[12] + a.Ib() & 65535) | 0
+ };
+ q.prototype.g[1] = function(a) {
+ return L(a) + (a.h[6] + a.h[14] & 65535) | 0
+ };
+ q.prototype.g[65] = function(a) {
+ return L(a) + (a.h[6] + a.h[14] + a.mb() & 65535) | 0
+ };
+ q.prototype.g[129] = function(a) {
+ return L(a) + (a.h[6] + a.h[14] +
+ a.Ib() & 65535) | 0
+ };
+ q.prototype.g[2] = function(a) {
+ return N(a) + (a.h[10] + a.h[12] & 65535) | 0
+ };
+ q.prototype.g[66] = function(a) {
+ return N(a) + (a.h[10] + a.h[12] + a.mb() & 65535) | 0
+ };
+ q.prototype.g[130] = function(a) {
+ return N(a) + (a.h[10] + a.h[12] + a.Ib() & 65535) | 0
+ };
+ q.prototype.g[3] = function(a) {
+ return N(a) + (a.h[10] + a.h[14] & 65535) | 0
+ };
+ q.prototype.g[67] = function(a) {
+ return N(a) + (a.h[10] + a.h[14] + a.mb() & 65535) | 0
+ };
+ q.prototype.g[131] = function(a) {
+ return N(a) + (a.h[10] + a.h[14] + a.Ib() & 65535) | 0
+ };
+ q.prototype.g[4] = function(a) {
+ return L(a) + (a.h[12] &
+ 65535) | 0
+ };
+ q.prototype.g[68] = function(a) {
+ return L(a) + (a.h[12] + a.mb() & 65535) | 0
+ };
+ q.prototype.g[132] = function(a) {
+ return L(a) + (a.h[12] + a.Ib() & 65535) | 0
+ };
+ q.prototype.g[5] = function(a) {
+ return L(a) + (a.h[14] & 65535) | 0
+ };
+ q.prototype.g[69] = function(a) {
+ return L(a) + (a.h[14] + a.mb() & 65535) | 0
+ };
+ q.prototype.g[133] = function(a) {
+ return L(a) + (a.h[14] + a.Ib() & 65535) | 0
+ };
+ q.prototype.g[6] = function(a) {
+ return N(a) + (a.h[10] & 65535) | 0
+ };
+ q.prototype.g[70] = function(a) {
+ return N(a) + (a.h[10] + a.mb() & 65535) | 0
+ };
+ q.prototype.g[134] = function(a) {
+ return N(a) +
+ (a.h[10] + a.Ib() & 65535) | 0
+ };
+ q.prototype.g[7] = function(a) {
+ return L(a) + (a.h[6] & 65535) | 0
+ };
+ q.prototype.g[71] = function(a) {
+ return L(a) + (a.h[6] + a.mb() & 65535) | 0
+ };
+ q.prototype.g[135] = function(a) {
+ return L(a) + (a.h[6] + a.Ib() & 65535) | 0
+ };
+ q.prototype.i[0] = function(a) {
+ return L(a) + a.b[0] | 0
+ };
+ q.prototype.i[64] = function(a) {
+ return L(a) + a.b[0] + a.mb() | 0
+ };
+ q.prototype.i[128] = function(a) {
+ return L(a) + a.b[0] + a.X() | 0
+ };
+ q.prototype.i[1] = function(a) {
+ return L(a) + a.b[1] | 0
+ };
+ q.prototype.i[65] = function(a) {
+ return L(a) + a.b[1] + a.mb() | 0
+ };
+ q.prototype.i[129] =
+ function(a) {
+ return L(a) + a.b[1] + a.X() | 0
+ };
+ q.prototype.i[2] = function(a) {
+ return L(a) + a.b[2] | 0
+ };
+ q.prototype.i[66] = function(a) {
+ return L(a) + a.b[2] + a.mb() | 0
+ };
+ q.prototype.i[130] = function(a) {
+ return L(a) + a.b[2] + a.X() | 0
+ };
+ q.prototype.i[3] = function(a) {
+ return L(a) + a.b[3] | 0
+ };
+ q.prototype.i[67] = function(a) {
+ return L(a) + a.b[3] + a.mb() | 0
+ };
+ q.prototype.i[131] = function(a) {
+ return L(a) + a.b[3] + a.X() | 0
+ };
+ q.prototype.i[5] = function(a) {
+ return N(a) + a.b[5] | 0
+ };
+ q.prototype.i[69] = function(a) {
+ return N(a) + a.b[5] + a.mb() | 0
+ };
+ q.prototype.i[133] =
+ function(a) {
+ return N(a) + a.b[5] + a.X() | 0
+ };
+ q.prototype.i[6] = function(a) {
+ return L(a) + a.b[6] | 0
+ };
+ q.prototype.i[70] = function(a) {
+ return L(a) + a.b[6] + a.mb() | 0
+ };
+ q.prototype.i[134] = function(a) {
+ return L(a) + a.b[6] + a.X() | 0
+ };
+ q.prototype.i[7] = function(a) {
+ return L(a) + a.b[7] | 0
+ };
+ q.prototype.i[71] = function(a) {
+ return L(a) + a.b[7] + a.mb() | 0
+ };
+ q.prototype.i[135] = function(a) {
+ return L(a) + a.b[7] + a.X() | 0
+ };
+ q.prototype.g[6] = function(a) {
+ return L(a) + a.Ib() | 0
+ };
+ q.prototype.i[5] = function(a) {
+ return L(a) + a.X() | 0
+ };
+ q.prototype.i[4] = function(a) {
+ return ne(a, !1) | 0
+ };
+ q.prototype.i[68] = function(a) {
+ return ne(a, !0) + a.mb() | 0
+ };
+ q.prototype.i[132] = function(a) {
+ return ne(a, !0) + a.X() | 0
+ };
+ for (var a = 0; 8 > a; a++)
+ for (var b = 0; 3 > b; b++)
+ for (var c = a | b << 6, d = 1; 8 > d; d++) q.prototype.i[c | d << 3] = q.prototype.i[c], q.prototype.g[c | d << 3] = q.prototype.g[c];
+ q.prototype.a[0] = function(a) {
+ return a.b[0] + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[1] = function(a) {
+ return a.b[0] + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[2] = function(a) {
+ return a.b[0] + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[3] = function(a) {
+ return a.b[0] + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[4] =
+ function(a) {
+ return a.b[0] + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[5] = function(a, b) {
+ return a.b[0] + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[6] = function(a) {
+ return a.b[0] + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[7] = function(a) {
+ return a.b[0] + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[64] = function(a) {
+ return (a.b[0] << 1) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[65] = function(a) {
+ return (a.b[0] << 1) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[66] = function(a) {
+ return (a.b[0] << 1) + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[67] = function(a) {
+ return (a.b[0] << 1) + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[68] =
+ function(a) {
+ return (a.b[0] << 1) + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[69] = function(a, b) {
+ return (a.b[0] << 1) + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[70] = function(a) {
+ return (a.b[0] << 1) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[71] = function(a) {
+ return (a.b[0] << 1) + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[128] = function(a) {
+ return (a.b[0] << 2) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[129] = function(a) {
+ return (a.b[0] << 2) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[130] = function(a) {
+ return (a.b[0] << 2) + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[131] = function(a) {
+ return (a.b[0] << 2) + L(a) + a.b[3] |
+ 0
+ };
+ q.prototype.a[132] = function(a) {
+ return (a.b[0] << 2) + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[133] = function(a, b) {
+ return (a.b[0] << 2) + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[134] = function(a) {
+ return (a.b[0] << 2) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[135] = function(a) {
+ return (a.b[0] << 2) + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[192] = function(a) {
+ return (a.b[0] << 3) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[193] = function(a) {
+ return (a.b[0] << 3) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[194] = function(a) {
+ return (a.b[0] << 3) + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[195] = function(a) {
+ return (a.b[0] <<
+ 3) + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[196] = function(a) {
+ return (a.b[0] << 3) + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[197] = function(a, b) {
+ return (a.b[0] << 3) + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[198] = function(a) {
+ return (a.b[0] << 3) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[199] = function(a) {
+ return (a.b[0] << 3) + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[8] = function(a) {
+ return a.b[1] + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[9] = function(a) {
+ return a.b[1] + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[10] = function(a) {
+ return a.b[1] + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[11] = function(a) {
+ return a.b[1] +
+ L(a) + a.b[3] | 0
+ };
+ q.prototype.a[12] = function(a) {
+ return a.b[1] + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[13] = function(a, b) {
+ return a.b[1] + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[14] = function(a) {
+ return a.b[1] + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[15] = function(a) {
+ return a.b[1] + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[72] = function(a) {
+ return (a.b[1] << 1) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[73] = function(a) {
+ return (a.b[1] << 1) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[74] = function(a) {
+ return (a.b[1] << 1) + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[75] = function(a) {
+ return (a.b[1] <<
+ 1) + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[76] = function(a) {
+ return (a.b[1] << 1) + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[77] = function(a, b) {
+ return (a.b[1] << 1) + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[78] = function(a) {
+ return (a.b[1] << 1) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[79] = function(a) {
+ return (a.b[1] << 1) + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[136] = function(a) {
+ return (a.b[1] << 2) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[137] = function(a) {
+ return (a.b[1] << 2) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[138] = function(a) {
+ return (a.b[1] << 2) + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[139] = function(a) {
+ return (a.b[1] <<
+ 2) + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[140] = function(a) {
+ return (a.b[1] << 2) + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[141] = function(a, b) {
+ return (a.b[1] << 2) + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[142] = function(a) {
+ return (a.b[1] << 2) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[143] = function(a) {
+ return (a.b[1] << 2) + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[200] = function(a) {
+ return (a.b[1] << 3) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[201] = function(a) {
+ return (a.b[1] << 3) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[202] = function(a) {
+ return (a.b[1] << 3) + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[203] =
+ function(a) {
+ return (a.b[1] << 3) + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[204] = function(a) {
+ return (a.b[1] << 3) + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[205] = function(a, b) {
+ return (a.b[1] << 3) + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[206] = function(a) {
+ return (a.b[1] << 3) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[207] = function(a) {
+ return (a.b[1] << 3) + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[16] = function(a) {
+ return a.b[2] + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[17] = function(a) {
+ return a.b[2] + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[18] = function(a) {
+ return a.b[2] + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[19] =
+ function(a) {
+ return a.b[2] + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[20] = function(a) {
+ return a.b[2] + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[21] = function(a, b) {
+ return a.b[2] + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[22] = function(a) {
+ return a.b[2] + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[23] = function(a) {
+ return a.b[2] + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[80] = function(a) {
+ return (a.b[2] << 1) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[81] = function(a) {
+ return (a.b[2] << 1) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[82] = function(a) {
+ return (a.b[2] << 1) + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[83] =
+ function(a) {
+ return (a.b[2] << 1) + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[84] = function(a) {
+ return (a.b[2] << 1) + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[85] = function(a, b) {
+ return (a.b[2] << 1) + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[86] = function(a) {
+ return (a.b[2] << 1) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[87] = function(a) {
+ return (a.b[2] << 1) + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[144] = function(a) {
+ return (a.b[2] << 2) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[145] = function(a) {
+ return (a.b[2] << 2) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[146] = function(a) {
+ return (a.b[2] << 2) + L(a) + a.b[2] |
+ 0
+ };
+ q.prototype.a[147] = function(a) {
+ return (a.b[2] << 2) + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[148] = function(a) {
+ return (a.b[2] << 2) + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[149] = function(a, b) {
+ return (a.b[2] << 2) + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[150] = function(a) {
+ return (a.b[2] << 2) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[151] = function(a) {
+ return (a.b[2] << 2) + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[208] = function(a) {
+ return (a.b[2] << 3) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[209] = function(a) {
+ return (a.b[2] << 3) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[210] = function(a) {
+ return (a.b[2] <<
+ 3) + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[211] = function(a) {
+ return (a.b[2] << 3) + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[212] = function(a) {
+ return (a.b[2] << 3) + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[213] = function(a, b) {
+ return (a.b[2] << 3) + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[214] = function(a) {
+ return (a.b[2] << 3) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[215] = function(a) {
+ return (a.b[2] << 3) + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[24] = function(a) {
+ return a.b[3] + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[25] = function(a) {
+ return a.b[3] + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[26] = function(a) {
+ return a.b[3] +
+ L(a) + a.b[2] | 0
+ };
+ q.prototype.a[27] = function(a) {
+ return a.b[3] + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[28] = function(a) {
+ return a.b[3] + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[29] = function(a, b) {
+ return a.b[3] + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[30] = function(a) {
+ return a.b[3] + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[31] = function(a) {
+ return a.b[3] + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[88] = function(a) {
+ return (a.b[3] << 1) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[89] = function(a) {
+ return (a.b[3] << 1) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[90] = function(a) {
+ return (a.b[3] << 1) +
+ L(a) + a.b[2] | 0
+ };
+ q.prototype.a[91] = function(a) {
+ return (a.b[3] << 1) + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[92] = function(a) {
+ return (a.b[3] << 1) + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[93] = function(a, b) {
+ return (a.b[3] << 1) + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[94] = function(a) {
+ return (a.b[3] << 1) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[95] = function(a) {
+ return (a.b[3] << 1) + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[152] = function(a) {
+ return (a.b[3] << 2) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[153] = function(a) {
+ return (a.b[3] << 2) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[154] = function(a) {
+ return (a.b[3] <<
+ 2) + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[155] = function(a) {
+ return (a.b[3] << 2) + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[156] = function(a) {
+ return (a.b[3] << 2) + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[157] = function(a, b) {
+ return (a.b[3] << 2) + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[158] = function(a) {
+ return (a.b[3] << 2) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[159] = function(a) {
+ return (a.b[3] << 2) + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[216] = function(a) {
+ return (a.b[3] << 3) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[217] = function(a) {
+ return (a.b[3] << 3) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[218] =
+ function(a) {
+ return (a.b[3] << 3) + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[219] = function(a) {
+ return (a.b[3] << 3) + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[220] = function(a) {
+ return (a.b[3] << 3) + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[221] = function(a, b) {
+ return (a.b[3] << 3) + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[222] = function(a) {
+ return (a.b[3] << 3) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[223] = function(a) {
+ return (a.b[3] << 3) + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[32] = function(a) {
+ return L(a) + a.b[0] | 0
+ };
+ q.prototype.a[33] = function(a) {
+ return L(a) + a.b[1] | 0
+ };
+ q.prototype.a[34] =
+ function(a) {
+ return L(a) + a.b[2] | 0
+ };
+ q.prototype.a[35] = function(a) {
+ return L(a) + a.b[3] | 0
+ };
+ q.prototype.a[36] = function(a) {
+ return N(a) + a.b[4] | 0
+ };
+ q.prototype.a[37] = function(a, b) {
+ return (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[38] = function(a) {
+ return L(a) + a.b[6] | 0
+ };
+ q.prototype.a[39] = function(a) {
+ return L(a) + a.b[7] | 0
+ };
+ q.prototype.a[96] = function(a) {
+ return L(a) + a.b[0] | 0
+ };
+ q.prototype.a[97] = function(a) {
+ return L(a) + a.b[1] | 0
+ };
+ q.prototype.a[98] = function(a) {
+ return L(a) + a.b[2] | 0
+ };
+ q.prototype.a[99] = function(a) {
+ return L(a) +
+ a.b[3] | 0
+ };
+ q.prototype.a[100] = function(a) {
+ return N(a) + a.b[4] | 0
+ };
+ q.prototype.a[101] = function(a, b) {
+ return (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[102] = function(a) {
+ return L(a) + a.b[6] | 0
+ };
+ q.prototype.a[103] = function(a) {
+ return L(a) + a.b[7] | 0
+ };
+ q.prototype.a[160] = function(a) {
+ return L(a) + a.b[0] | 0
+ };
+ q.prototype.a[161] = function(a) {
+ return L(a) + a.b[1] | 0
+ };
+ q.prototype.a[162] = function(a) {
+ return L(a) + a.b[2] | 0
+ };
+ q.prototype.a[163] = function(a) {
+ return L(a) + a.b[3] | 0
+ };
+ q.prototype.a[164] = function(a) {
+ return N(a) + a.b[4] | 0
+ };
+ q.prototype.a[165] = function(a, b) {
+ return (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[166] = function(a) {
+ return L(a) + a.b[6] | 0
+ };
+ q.prototype.a[167] = function(a) {
+ return L(a) + a.b[7] | 0
+ };
+ q.prototype.a[224] = function(a) {
+ return L(a) + a.b[0] | 0
+ };
+ q.prototype.a[225] = function(a) {
+ return L(a) + a.b[1] | 0
+ };
+ q.prototype.a[226] = function(a) {
+ return L(a) + a.b[2] | 0
+ };
+ q.prototype.a[227] = function(a) {
+ return L(a) + a.b[3] | 0
+ };
+ q.prototype.a[228] = function(a) {
+ return N(a) + a.b[4] | 0
+ };
+ q.prototype.a[229] = function(a, b) {
+ return (b ? N(a) + a.b[5] : L(a) + a.X()) |
+ 0
+ };
+ q.prototype.a[230] = function(a) {
+ return L(a) + a.b[6] | 0
+ };
+ q.prototype.a[231] = function(a) {
+ return L(a) + a.b[7] | 0
+ };
+ q.prototype.a[40] = function(a) {
+ return a.b[5] + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[41] = function(a) {
+ return a.b[5] + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[42] = function(a) {
+ return a.b[5] + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[43] = function(a) {
+ return a.b[5] + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[44] = function(a) {
+ return a.b[5] + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[45] = function(a, b) {
+ return a.b[5] + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[46] = function(a) {
+ return a.b[5] +
+ L(a) + a.b[6] | 0
+ };
+ q.prototype.a[47] = function(a) {
+ return a.b[5] + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[104] = function(a) {
+ return (a.b[5] << 1) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[105] = function(a) {
+ return (a.b[5] << 1) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[106] = function(a) {
+ return (a.b[5] << 1) + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[107] = function(a) {
+ return (a.b[5] << 1) + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[108] = function(a) {
+ return (a.b[5] << 1) + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[109] = function(a, b) {
+ return (a.b[5] << 1) + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[110] = function(a) {
+ return (a.b[5] <<
+ 1) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[111] = function(a) {
+ return (a.b[5] << 1) + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[168] = function(a) {
+ return (a.b[5] << 2) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[169] = function(a) {
+ return (a.b[5] << 2) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[170] = function(a) {
+ return (a.b[5] << 2) + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[171] = function(a) {
+ return (a.b[5] << 2) + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[172] = function(a) {
+ return (a.b[5] << 2) + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[173] = function(a, b) {
+ return (a.b[5] << 2) + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[174] =
+ function(a) {
+ return (a.b[5] << 2) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[175] = function(a) {
+ return (a.b[5] << 2) + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[232] = function(a) {
+ return (a.b[5] << 3) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[233] = function(a) {
+ return (a.b[5] << 3) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[234] = function(a) {
+ return (a.b[5] << 3) + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[235] = function(a) {
+ return (a.b[5] << 3) + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[236] = function(a) {
+ return (a.b[5] << 3) + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[237] = function(a, b) {
+ return (a.b[5] << 3) + (b ? N(a) + a.b[5] : L(a) + a.X()) |
+ 0
+ };
+ q.prototype.a[238] = function(a) {
+ return (a.b[5] << 3) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[239] = function(a) {
+ return (a.b[5] << 3) + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[48] = function(a) {
+ return a.b[6] + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[49] = function(a) {
+ return a.b[6] + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[50] = function(a) {
+ return a.b[6] + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[51] = function(a) {
+ return a.b[6] + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[52] = function(a) {
+ return a.b[6] + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[53] = function(a, b) {
+ return a.b[6] + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[54] = function(a) {
+ return a.b[6] + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[55] = function(a) {
+ return a.b[6] + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[112] = function(a) {
+ return (a.b[6] << 1) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[113] = function(a) {
+ return (a.b[6] << 1) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[114] = function(a) {
+ return (a.b[6] << 1) + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[115] = function(a) {
+ return (a.b[6] << 1) + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[116] = function(a) {
+ return (a.b[6] << 1) + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[117] = function(a, b) {
+ return (a.b[6] << 1) + (b ? N(a) + a.b[5] :
+ L(a) + a.X()) | 0
+ };
+ q.prototype.a[118] = function(a) {
+ return (a.b[6] << 1) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[119] = function(a) {
+ return (a.b[6] << 1) + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[176] = function(a) {
+ return (a.b[6] << 2) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[177] = function(a) {
+ return (a.b[6] << 2) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[178] = function(a) {
+ return (a.b[6] << 2) + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[179] = function(a) {
+ return (a.b[6] << 2) + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[180] = function(a) {
+ return (a.b[6] << 2) + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[181] = function(a, b) {
+ return (a.b[6] <<
+ 2) + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[182] = function(a) {
+ return (a.b[6] << 2) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[183] = function(a) {
+ return (a.b[6] << 2) + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[240] = function(a) {
+ return (a.b[6] << 3) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[241] = function(a) {
+ return (a.b[6] << 3) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[242] = function(a) {
+ return (a.b[6] << 3) + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[243] = function(a) {
+ return (a.b[6] << 3) + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[244] = function(a) {
+ return (a.b[6] << 3) + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[245] = function(a,
+ b) {
+ return (a.b[6] << 3) + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[246] = function(a) {
+ return (a.b[6] << 3) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[247] = function(a) {
+ return (a.b[6] << 3) + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[56] = function(a) {
+ return a.b[7] + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[57] = function(a) {
+ return a.b[7] + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[58] = function(a) {
+ return a.b[7] + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[59] = function(a) {
+ return a.b[7] + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[60] = function(a) {
+ return a.b[7] + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[61] = function(a,
+ b) {
+ return a.b[7] + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[62] = function(a) {
+ return a.b[7] + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[63] = function(a) {
+ return a.b[7] + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[120] = function(a) {
+ return (a.b[7] << 1) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[121] = function(a) {
+ return (a.b[7] << 1) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[122] = function(a) {
+ return (a.b[7] << 1) + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[123] = function(a) {
+ return (a.b[7] << 1) + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[124] = function(a) {
+ return (a.b[7] << 1) + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[125] =
+ function(a, b) {
+ return (a.b[7] << 1) + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[126] = function(a) {
+ return (a.b[7] << 1) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[127] = function(a) {
+ return (a.b[7] << 1) + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[184] = function(a) {
+ return (a.b[7] << 2) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[185] = function(a) {
+ return (a.b[7] << 2) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[186] = function(a) {
+ return (a.b[7] << 2) + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[187] = function(a) {
+ return (a.b[7] << 2) + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[188] = function(a) {
+ return (a.b[7] << 2) + N(a) + a.b[4] |
+ 0
+ };
+ q.prototype.a[189] = function(a, b) {
+ return (a.b[7] << 2) + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[190] = function(a) {
+ return (a.b[7] << 2) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[191] = function(a) {
+ return (a.b[7] << 2) + L(a) + a.b[7] | 0
+ };
+ q.prototype.a[248] = function(a) {
+ return (a.b[7] << 3) + L(a) + a.b[0] | 0
+ };
+ q.prototype.a[249] = function(a) {
+ return (a.b[7] << 3) + L(a) + a.b[1] | 0
+ };
+ q.prototype.a[250] = function(a) {
+ return (a.b[7] << 3) + L(a) + a.b[2] | 0
+ };
+ q.prototype.a[251] = function(a) {
+ return (a.b[7] << 3) + L(a) + a.b[3] | 0
+ };
+ q.prototype.a[252] = function(a) {
+ return (a.b[7] <<
+ 3) + N(a) + a.b[4] | 0
+ };
+ q.prototype.a[253] = function(a, b) {
+ return (a.b[7] << 3) + (b ? N(a) + a.b[5] : L(a) + a.X()) | 0
+ };
+ q.prototype.a[254] = function(a) {
+ return (a.b[7] << 3) + L(a) + a.b[6] | 0
+ };
+ q.prototype.a[255] = function(a) {
+ return (a.b[7] << 3) + L(a) + a.b[7] | 0
+ }
+})();
+
+function Bf(a, b) {
+ return 0 > a ? (b & 4095) >> (-a >> 1) : (~b & 4095) >> a
+}
+
+function Cf(a, b, c) {
+ return Math.min(Bf(a, b), Bf(a, c))
+};
+
+function Df(a, b, c) {
+ return a.add(b, c, 7)
+}
+
+function Ef(a, b, c) {
+ return a.add(b, c, 15)
+}
+
+function Ff(a, b, c) {
+ return a.add(b, c, 31)
+}
+
+function Of(a, b, c) {
+ return Pf(a, b, c, 7)
+}
+
+function Qf(a, b, c) {
+ return Pf(a, b, c, 15)
+}
+
+function Rf(a, b, c) {
+ return Pf(a, b, c, 31)
+}
+
+function Sf(a, b, c) {
+ return a.sub(b, c, 7)
+}
+
+function Tf(a, b, c) {
+ return a.sub(b, c, 15)
+}
+
+function Uf(a, b, c) {
+ return a.sub(b, c, 31)
+}
+
+function Vf(a, b, c) {
+ return Wf(a, b, c, 7)
+}
+
+function Xf(a, b, c) {
+ return Wf(a, b, c, 15)
+}
+
+function Yf(a, b, c) {
+ return Wf(a, b, c, 31)
+}
+k = q.prototype;
+k.add = function(a, b, c) {
+ this.jb = a;
+ this.kb = b;
+ this.l = this.F = a + b | 0;
+ this.S = c;
+ this.u = 2261;
+ return this.F
+};
+
+function Pf(a, b, c, d) {
+ var e = a.cb();
+ a.jb = b;
+ a.kb = c;
+ a.l = a.F = (b + c | 0) + e | 0;
+ a.S = d;
+ a.u = 2261;
+ return a.F
+}
+k.sub = function(a, b, c) {
+ this.l = a;
+ this.kb = b;
+ this.jb = this.F = a - b | 0;
+ this.S = c;
+ this.u = 2261;
+ return this.F
+};
+
+function Wf(a, b, c, d) {
+ var e = a.cb();
+ a.l = b;
+ a.kb = c;
+ a.jb = a.F = b - c - e | 0;
+ a.S = d;
+ a.u = 2261;
+ return a.F
+}
+
+function Zf(a, b, c) {
+ a.flags = a.flags & -2 | a.cb();
+ a.jb = b;
+ a.kb = 1;
+ a.l = a.F = b + 1 | 0;
+ a.S = c;
+ a.u = 2260;
+ return a.F
+}
+
+function $f(a, b, c) {
+ a.flags = a.flags & -2 | a.cb();
+ a.l = b;
+ a.kb = 1;
+ a.jb = a.F = b - 1 | 0;
+ a.S = c;
+ a.u = 2260;
+ return a.F
+}
+
+function ag(a, b, c) {
+ a.jb = a.F = -b | 0;
+ a.u = 2261;
+ a.l = 0;
+ a.kb = b;
+ a.S = c;
+ return a.F
+}
+
+function bg(a, b, c) {
+ b *= c;
+ a.F = b & 65535;
+ a.S = 15;
+ a.flags = 32767 < b || -32768 > b ? a.flags | 2049 : a.flags & -2050;
+ a.u = 212;
+ return b
+}
+
+function cg(a, b, c) {
+ var d = b & 65535;
+ b >>>= 16;
+ var e = c & 65535;
+ c >>>= 16;
+ var f = d * e;
+ e = (f >>> 16) + (b * e | 0) | 0;
+ var h = e >>> 16;
+ e = (e & 65535) + (d * c | 0) | 0;
+ a.ka[0] = e << 16 | f & 65535;
+ a.ka[1] = ((e >>> 16) + (b * c | 0) | 0) + h | 0;
+ return a.ka
+}
+
+function dg(a, b, c) {
+ var d = !1;
+ 0 > b && (d = !0, b = -b | 0);
+ 0 > c && (d = !d, c = -c | 0);
+ a = cg(a, b, c);
+ d && (a[0] = -a[0] | 0, a[1] = ~a[1] + !a[0] | 0);
+ return a
+}
+
+function eg(a, b, c) {
+ b = dg(a, b, c);
+ a.F = b[0];
+ a.S = 31;
+ a.flags = b[1] === b[0] >> 31 ? a.flags & -2050 : a.flags | 2049;
+ a.u = 212;
+ return b[0]
+}
+
+function fg(a, b, c, d) {
+ (c >= d || 0 === d) && Re(a);
+ var e = 0;
+ if (1048576 < c) {
+ for (var f = 32, h = d; h > c;) h >>>= 1, f--;
+ for (; 1048576 < c;) {
+ if (c >= h) {
+ c -= h;
+ var g = d << f >>> 0;
+ g > b && c--;
+ b = b - g >>> 0;
+ e |= 1 << f
+ }
+ f--;
+ h >>= 1
+ }
+ e >>>= 0
+ }
+ b += 4294967296 * c;
+ a.Z[0] = e + (b / d | 0);
+ a.Z[1] = b % d;
+ return a.Z
+}
+
+function gg(a, b, c) {
+ return a.and(b, c, 7)
+}
+
+function hg(a, b, c) {
+ return a.and(b, c, 15)
+}
+
+function ig(a, b, c) {
+ return a.and(b, c, 31)
+}
+
+function jg(a, b, c) {
+ return a.or(b, c, 7)
+}
+
+function kg(a, b, c) {
+ return a.or(b, c, 15)
+}
+
+function lg(a, b, c) {
+ return a.or(b, c, 31)
+}
+
+function mg(a, b, c) {
+ return a.xor(b, c, 7)
+}
+
+function ng(a, b, c) {
+ return a.xor(b, c, 15)
+}
+
+function og(a, b, c) {
+ return a.xor(b, c, 31)
+}
+k.and = function(a, b, c) {
+ this.F = a & b;
+ this.S = c;
+ this.flags &= -2066;
+ this.u = 196;
+ return this.F
+};
+k.or = function(a, b, c) {
+ this.F = a | b;
+ this.S = c;
+ this.flags &= -2066;
+ this.u = 196;
+ return this.F
+};
+k.xor = function(a, b, c) {
+ this.F = a ^ b;
+ this.S = c;
+ this.flags &= -2066;
+ this.u = 196;
+ return this.F
+};
+
+function pg(a, b, c) {
+ if (!c) return b;
+ c &= 7;
+ b = b << c | b >> 8 - c;
+ a.u &= -2050;
+ a.flags = a.flags & -2050 | b & 1 | (b << 11 ^ b << 4) & 2048;
+ return b
+}
+
+function qg(a, b, c) {
+ if (!c) return b;
+ c &= 15;
+ b = b << c | b >> 16 - c;
+ a.u &= -2050;
+ a.flags = a.flags & -2050 | b & 1 | (b << 11 ^ b >> 4) & 2048;
+ return b
+}
+
+function rg(a, b, c) {
+ if (!c) return b;
+ b = b << c | b >>> 32 - c;
+ a.u &= -2050;
+ a.flags = a.flags & -2050 | b & 1 | (b << 11 ^ b >> 20) & 2048;
+ return b
+}
+
+function sg(a, b, c) {
+ c %= 9;
+ if (!c) return b;
+ b = b << c | a.cb() << c - 1 | b >> 9 - c;
+ a.u &= -2050;
+ a.flags = a.flags & -2050 | b >> 8 & 1 | (b << 3 ^ b << 4) & 2048;
+ return b
+}
+
+function tg(a, b, c) {
+ c %= 17;
+ if (!c) return b;
+ b = b << c | a.cb() << c - 1 | b >> 17 - c;
+ a.u &= -2050;
+ a.flags = a.flags & -2050 | b >> 16 & 1 | (b >> 5 ^ b >> 4) & 2048;
+ return b
+}
+
+function ug(a, b, c) {
+ if (!c) return b;
+ var d = b << c | a.cb() << c - 1;
+ 1 < c && (d |= b >>> 33 - c);
+ a.u &= -2050;
+ a.flags = a.flags & -2050 | b >>> 32 - c & 1;
+ a.flags |= (a.flags << 11 ^ d >> 20) & 2048;
+ return d
+}
+
+function vg(a, b, c) {
+ if (!c) return b;
+ c &= 7;
+ b = b >> c | b << 8 - c;
+ a.u &= -2050;
+ a.flags = a.flags & -2050 | b >> 7 & 1 | (b << 4 ^ b << 5) & 2048;
+ return b
+}
+
+function wg(a, b, c) {
+ if (!c) return b;
+ c &= 15;
+ b = b >> c | b << 16 - c;
+ a.u &= -2050;
+ a.flags = a.flags & -2050 | b >> 15 & 1 | (b >> 4 ^ b >> 3) & 2048;
+ return b
+}
+
+function xg(a, b, c) {
+ if (!c) return b;
+ b = b >>> c | b << 32 - c;
+ a.u &= -2050;
+ a.flags = a.flags & -2050 | b >> 31 & 1 | (b >> 20 ^ b >> 19) & 2048;
+ return b
+}
+
+function yg(a, b, c) {
+ c %= 9;
+ if (!c) return b;
+ b = b >> c | a.cb() << 8 - c | b << 9 - c;
+ a.u &= -2050;
+ a.flags = a.flags & -2050 | b >> 8 & 1 | (b << 4 ^ b << 5) & 2048;
+ return b
+}
+
+function zg(a, b, c) {
+ c %= 17;
+ if (!c) return b;
+ b = b >> c | a.cb() << 16 - c | b << 17 - c;
+ a.u &= -2050;
+ a.flags = a.flags & -2050 | b >> 16 & 1 | (b >> 4 ^ b >> 3) & 2048;
+ return b
+}
+
+function Ag(a, b, c) {
+ if (!c) return b;
+ var d = b >>> c | a.cb() << 32 - c;
+ 1 < c && (d |= b << 33 - c);
+ a.u &= -2050;
+ a.flags = a.flags & -2050 | b >> c - 1 & 1 | (d >> 20 ^ d >> 19) & 2048;
+ return d
+}
+
+function Bg(a, b, c) {
+ if (0 === c) return b;
+ a.F = b << c;
+ a.S = 7;
+ a.u = 212;
+ a.flags = a.flags & -2050 | a.F >> 8 & 1 | (a.F << 3 ^ a.F << 4) & 2048;
+ return a.F
+}
+
+function Cg(a, b, c) {
+ if (0 === c) return b;
+ a.F = b << c;
+ a.S = 15;
+ a.u = 212;
+ a.flags = a.flags & -2050 | a.F >> 16 & 1 | (a.F >> 5 ^ a.F >> 4) & 2048;
+ return a.F
+}
+
+function Dg(a, b, c) {
+ if (0 === c) return b;
+ a.F = b << c;
+ a.S = 31;
+ a.u = 212;
+ a.flags = a.flags & -2050 | b >>> 32 - c & 1;
+ a.flags |= (a.flags & 1 ^ a.F >> 31 & 1) << 11 & 2048;
+ return a.F
+}
+
+function Eg(a, b, c) {
+ if (0 === c) return b;
+ a.F = b >> c;
+ a.S = 7;
+ a.u = 212;
+ a.flags = a.flags & -2050 | b >> c - 1 & 1 | (b >> 7 & 1) << 11 & 2048;
+ return a.F
+}
+
+function Fg(a, b, c) {
+ if (0 === c) return b;
+ a.F = b >> c;
+ a.S = 15;
+ a.u = 212;
+ a.flags = a.flags & -2050 | b >> c - 1 & 1 | b >> 4 & 2048;
+ return a.F
+}
+
+function Gg(a, b, c) {
+ if (0 === c) return b;
+ a.F = b >>> c;
+ a.S = 31;
+ a.u = 212;
+ a.flags = a.flags & -2050 | b >>> c - 1 & 1 | b >> 20 & 2048;
+ return a.F
+}
+
+function Hg(a, b, c) {
+ if (0 === c) return b;
+ 8 > c ? (a.F = b << 24 >> c + 24, a.flags = a.flags & -2050 | b >> c - 1 & 1) : (a.F = b << 24 >> 31, a.flags = a.flags & -2050 | a.F & 1);
+ a.S = 7;
+ a.u = 212;
+ return a.F
+}
+
+function Ig(a, b, c) {
+ if (0 === c) return b;
+ 16 > c ? (a.F = b << 16 >> c + 16, a.flags = a.flags & -2050 | b >> c - 1 & 1) : (a.F = b << 16 >> 31, a.flags = a.flags & -2050 | a.F & 1);
+ a.S = 15;
+ a.u = 212;
+ return a.F
+}
+
+function Jg(a, b, c) {
+ if (0 === c) return b;
+ a.F = b >> c;
+ a.S = 31;
+ a.u = 212;
+ a.flags = a.flags & -2050 | b >>> c - 1 & 1;
+ return a.F
+}
+
+function Kg(a, b, c, d) {
+ if (0 === d) return b;
+ 16 >= d ? (a.F = b >> d | c << 16 - d, a.flags = a.flags & -2 | b >> d - 1 & 1) : (a.F = b << 32 - d | c >> d - 16, a.flags = a.flags & -2 | c >> d - 17 & 1);
+ a.S = 15;
+ a.u = 212;
+ a.flags = a.flags & -2049 | (a.F ^ b) >> 4 & 2048;
+ return a.F
+}
+
+function Lg(a, b, c, d) {
+ if (0 === d) return b;
+ a.F = b >>> d | c << 32 - d;
+ a.S = 31;
+ a.u = 212;
+ a.flags = a.flags & -2 | b >>> d - 1 & 1;
+ a.flags = a.flags & -2049 | (a.F ^ b) >> 20 & 2048;
+ return a.F
+}
+
+function Mg(a, b, c, d) {
+ if (0 === d) return b;
+ 16 >= d ? (a.F = b << d | c >>> 16 - d, a.flags = a.flags & -2 | b >>> 16 - d & 1) : (a.F = b >> 32 - d | c << d - 16, a.flags = a.flags & -2 | c >>> 32 - d & 1);
+ a.S = 15;
+ a.u = 212;
+ a.flags = a.flags & -2049 | (a.flags & 1 ^ a.F >> 15 & 1) << 11;
+ return a.F
+}
+
+function Ng(a, b, c, d) {
+ if (0 === d) return b;
+ a.F = b << d | c >>> 32 - d;
+ a.S = 31;
+ a.u = 212;
+ a.flags = a.flags & -2 | b >>> 32 - d & 1;
+ a.flags = 1 === d ? a.flags & -2049 | (a.flags & 1 ^ a.F >> 31 & 1) << 11 : a.flags & -2049;
+ return a.F
+}
+
+function Og(a, b, c) {
+ a.flags = a.flags & -2 | b >> c & 1;
+ a.u &= -2
+}
+
+function Pg(a, b, c) {
+ a.flags = a.flags & -2 | b >> c & 1;
+ a.u &= -2;
+ return b ^ 1 << c
+}
+
+function Qg(a, b, c) {
+ a.flags = a.flags & -2 | b >> c & 1;
+ a.u &= -2;
+ return b | 1 << c
+}
+
+function Rg(a, b, c) {
+ a.flags = a.flags & -2 | b >> c & 1;
+ a.u &= -2;
+ return b & ~(1 << c)
+}
+
+function Sg(a, b, c) {
+ b = pe(a, b + (c >> 3) | 0);
+ a.flags = a.flags & -2 | b >> (c & 7) & 1;
+ a.u &= -2
+}
+
+function Tg(a, b, c) {
+ b = se(a, b + (c >> 3) | 0);
+ var d = a.ja(b);
+ c &= 7;
+ a.flags = a.flags & -2 | d >> c & 1;
+ a.u &= -2;
+ a.za(b, d ^ 1 << c)
+}
+
+function Ug(a, b, c) {
+ b = se(a, b + (c >> 3) | 0);
+ var d = a.ja(b);
+ c &= 7;
+ a.flags = a.flags & -2 | d >> c & 1;
+ a.u &= -2;
+ a.za(b, d & ~(1 << c))
+}
+
+function Vg(a, b, c) {
+ b = se(a, b + (c >> 3) | 0);
+ var d = a.ja(b);
+ c &= 7;
+ a.flags = a.flags & -2 | d >> c & 1;
+ a.u &= -2;
+ a.za(b, d | 1 << c)
+}
+
+function Wg(a, b) {
+ a.u = 0;
+ a.flags &= -2262;
+ if (b) return b -= b >> 1 & 1431655765, b = (b & 858993459) + (b >> 2 & 858993459), 16843009 * (b + (b >> 4) & 252645135) >> 24;
+ a.flags |= 64;
+ return 0
+}
+
+function Xg(a) {
+ a >>>= 0;
+ 32768 <= a ? a = 0 : 255 < a && (a = 255);
+ return a
+}
+
+function Yg(a) {
+ 65408 < a ? a &= 255 : 32767 < a ? a = 128 : 127 < a && (a = 127);
+ return a
+}
+
+function Zg(a) {
+ a >>>= 0;
+ 4294934528 < a ? a &= 65535 : 2147483647 < a ? a = 32768 : 32767 < a && (a = 32767);
+ return a
+}
+
+function $g(a) {
+ a >>>= 0;
+ 4294967168 < a ? a &= 255 : 2147483647 < a ? a = 128 : 127 < a && (a = 127);
+ return a
+}
+
+function ah(a) {
+ a |= 0;
+ 0 > a && (a = 0);
+ return a
+}
+
+function bh(a) {
+ a >>>= 0;
+ 255 < a && (a = 255);
+ return a
+}
+
+function ch(a) {
+ return 65535 < a ? 65535 : a
+};
+
+function dh(a, b) {
+ var c = a.wa();
+ b && (a.A = a.A + c | 0)
+}
+
+function eh(a, b) {
+ var c = C(a, 1);
+ a.A -= c;
+ a.A = a.A + b & 65535;
+ a.A = a.A + c | 0
+}
+
+function fh(a, b) {
+ var c = a.U();
+ b && eh(a, c)
+}
+
+function gh(a, b) {
+ var c = a.ea();
+ b && (a.A = a.A + c | 0)
+}
+
+function hh(a, b) {
+ var c = O(a);
+ b && of (a, c)
+}
+
+function ih(a, b) {
+ var c = Ve(a);
+ b && pf(a, c)
+}
+
+function jh(a, b) {
+ Ze(a, b ? 1 : 0)
+}
+k = q.prototype;
+k.loop = function(a) {
+ Af(this) && (this.A = this.A + a | 0)
+};
+k.cb = function() {
+ return this.u & 1 ? (this.jb ^ (this.jb ^ this.kb) & (this.kb ^ this.l)) >>> this.S & 1 : this.flags & 1
+};
+k.Ug = function() {
+ return this.u & 4 ? 154020 >> ((this.F ^ this.F >> 4) & 15) & 4 : this.flags & 4
+};
+
+function Ae(a) {
+ return a.u & 16 ? (a.jb ^ a.kb ^ a.l) & 16 : a.flags & 16
+}
+k.Ac = function() {
+ return this.u & 64 ? (~this.F & this.F - 1) >>> this.S & 1 : this.flags & 64
+};
+k.xf = function() {
+ return this.u & 128 ? this.F >>> this.S & 1 : this.flags & 128
+};
+k.Te = function() {
+ return this.u & 2048 ? ((this.jb ^ this.l) & (this.kb ^ this.l)) >>> this.S & 1 : this.flags & 2048
+};
+k.Qb = q.prototype.Te;
+k.yb = q.prototype.cb;
+k.Ab = q.prototype.Ac;
+k.Rb = q.prototype.xf;
+k.zb = q.prototype.Ug;
+
+function kh(a) {
+ return a.cb() || a.Ac()
+}
+
+function lh(a) {
+ return !a.xf() !== !a.Te()
+}
+
+function mh(a) {
+ return a.Ac() || !a.xf() !== !a.Te()
+}
+
+function I(a, b) {
+ var c = G(a, -2);
+ u(a, c, b);
+ Ee(a, -2)
+}
+
+function J(a, b) {
+ var c = G(a, -4);
+ w(a, c, b);
+ Ee(a, -4)
+}
+
+function nh(a) {
+ var b = C(a, 2) + Ce(a) | 0;
+ b = x(a, b);
+ Ee(a, 2);
+ return b
+}
+
+function oh(a) {
+ var b = C(a, 2) + Ce(a) | 0;
+ b = y(a, b);
+ Ee(a, 4);
+ return b
+}
+
+function ph(a, b) {
+ var c = a.h[0];
+ a.h[0] = a.h[b];
+ a.h[b] = c
+}
+
+function qh(a, b) {
+ var c = a.b[0];
+ a.b[0] = a.b[b];
+ a.b[b] = c
+}
+
+function rh(a, b) {
+ 192 <= a.f && t(a);
+ var c = F(a, a.f),
+ d = x(a, c);
+ c = x(a, c + 2 | 0);
+ $d(a, b, c);
+ a.h[a.f >> 2 & 14] = d
+}
+
+function sh(a, b) {
+ 192 <= a.f && t(a);
+ var c = F(a, a.f),
+ d = y(a, c);
+ c = x(a, c + 4 | 0);
+ $d(a, b, c);
+ a.b[a.f >> 3 & 7] = d
+}
+
+function th(a, b) {
+ var c = a.b[b];
+ a.b[b] = c >>> 24 | c << 24 | c >> 8 & 65280 | c << 8 & 16711680
+};
+var W = [],
+ X = [],
+ Z = [];
+W[0] = function(a) {
+ D(a);
+ cf(a, Df(a, bf(a), kf(a)))
+};
+X[1] = function(a) {
+ D(a);
+ R(a, Ef(a, Q(a), mf(a)))
+};
+Z[1] = function(a) {
+ D(a);
+ ef(a, Ff(a, df(a), S(a)))
+};
+W[2] = function(a) {
+ D(a);
+ lf(a, Df(a, kf(a), Ue(a)))
+};
+X[3] = function(a) {
+ D(a); of (a, Ef(a, mf(a), O(a)))
+};
+Z[3] = function(a) {
+ D(a);
+ pf(a, Ff(a, S(a), Ve(a)))
+};
+W[4] = function(a) {
+ a.D[0] = Df(a, a.D[0], a.L())
+};
+X[5] = function(a) {
+ a.h[0] = Ef(a, a.h[0], a.U())
+};
+Z[5] = function(a) {
+ a.b[0] = Ff(a, a.b[0], a.ea())
+};
+X[6] = function(a) {
+ I(a, a.M[0])
+};
+Z[6] = function(a) {
+ J(a, a.M[0])
+};
+X[7] = function(a) {
+ $d(a, 0, x(a, G(a, 0)));
+ Ee(a, 2)
+};
+Z[7] = function(a) {
+ $d(a, 0, y(a, G(a, 0)) & 65535);
+ Ee(a, 4)
+};
+W[8] = function(a) {
+ D(a);
+ cf(a, jg(a, bf(a), kf(a)))
+};
+X[9] = function(a) {
+ D(a);
+ R(a, kg(a, Q(a), mf(a)))
+};
+Z[9] = function(a) {
+ D(a);
+ ef(a, lg(a, df(a), S(a)))
+};
+W[10] = function(a) {
+ D(a);
+ lf(a, jg(a, kf(a), Ue(a)))
+};
+X[11] = function(a) {
+ D(a); of (a, kg(a, mf(a), O(a)))
+};
+Z[11] = function(a) {
+ D(a);
+ pf(a, lg(a, S(a), Ve(a)))
+};
+W[12] = function(a) {
+ a.D[0] = jg(a, a.D[0], a.L())
+};
+X[13] = function(a) {
+ a.h[0] = kg(a, a.h[0], a.U())
+};
+Z[13] = function(a) {
+ a.b[0] = lg(a, a.b[0], a.ea())
+};
+X[14] = function(a) {
+ I(a, a.M[1])
+};
+Z[14] = function(a) {
+ J(a, a.M[1])
+};
+X[15] = function(a) {
+ a.qk[a.yh()](a)
+};
+Z[15] = function(a) {
+ a.rk[a.yh()](a)
+};
+W[16] = function(a) {
+ D(a);
+ cf(a, Of(a, bf(a), kf(a)))
+};
+X[17] = function(a) {
+ D(a);
+ R(a, Qf(a, Q(a), mf(a)))
+};
+Z[17] = function(a) {
+ D(a);
+ ef(a, Rf(a, df(a), S(a)))
+};
+W[18] = function(a) {
+ D(a);
+ lf(a, Of(a, kf(a), Ue(a)))
+};
+X[19] = function(a) {
+ D(a); of (a, Qf(a, mf(a), O(a)))
+};
+Z[19] = function(a) {
+ D(a);
+ pf(a, Rf(a, S(a), Ve(a)))
+};
+W[20] = function(a) {
+ a.D[0] = Of(a, a.D[0], a.L())
+};
+X[21] = function(a) {
+ a.h[0] = Qf(a, a.h[0], a.U())
+};
+Z[21] = function(a) {
+ a.b[0] = Rf(a, a.b[0], a.ea())
+};
+X[22] = function(a) {
+ I(a, a.M[2])
+};
+Z[22] = function(a) {
+ J(a, a.M[2])
+};
+X[23] = function(a) {
+ $d(a, 2, x(a, G(a, 0)));
+ Ee(a, 2);
+ a.H = 0;
+ ee(a)
+};
+Z[23] = function(a) {
+ $d(a, 2, y(a, G(a, 0)) & 65535);
+ Ee(a, 4);
+ a.H = 0;
+ ee(a)
+};
+W[24] = function(a) {
+ D(a);
+ cf(a, Vf(a, bf(a), kf(a)))
+};
+X[25] = function(a) {
+ D(a);
+ R(a, Xf(a, Q(a), mf(a)))
+};
+Z[25] = function(a) {
+ D(a);
+ ef(a, Yf(a, df(a), S(a)))
+};
+W[26] = function(a) {
+ D(a);
+ lf(a, Vf(a, kf(a), Ue(a)))
+};
+X[27] = function(a) {
+ D(a); of (a, Xf(a, mf(a), O(a)))
+};
+Z[27] = function(a) {
+ D(a);
+ pf(a, Yf(a, S(a), Ve(a)))
+};
+W[28] = function(a) {
+ a.D[0] = Vf(a, a.D[0], a.L())
+};
+X[29] = function(a) {
+ a.h[0] = Xf(a, a.h[0], a.U())
+};
+Z[29] = function(a) {
+ a.b[0] = Yf(a, a.b[0], a.ea())
+};
+X[30] = function(a) {
+ I(a, a.M[3])
+};
+Z[30] = function(a) {
+ J(a, a.M[3])
+};
+X[31] = function(a) {
+ $d(a, 3, x(a, G(a, 0)));
+ Ee(a, 2)
+};
+Z[31] = function(a) {
+ $d(a, 3, y(a, G(a, 0)) & 65535);
+ Ee(a, 4)
+};
+W[32] = function(a) {
+ D(a);
+ cf(a, gg(a, bf(a), kf(a)))
+};
+X[33] = function(a) {
+ D(a);
+ R(a, hg(a, Q(a), mf(a)))
+};
+Z[33] = function(a) {
+ D(a);
+ ef(a, ig(a, df(a), S(a)))
+};
+W[34] = function(a) {
+ D(a);
+ lf(a, gg(a, kf(a), Ue(a)))
+};
+X[35] = function(a) {
+ D(a); of (a, hg(a, mf(a), O(a)))
+};
+Z[35] = function(a) {
+ D(a);
+ pf(a, ig(a, S(a), Ve(a)))
+};
+W[36] = function(a) {
+ a.D[0] = gg(a, a.D[0], a.L())
+};
+X[37] = function(a) {
+ a.h[0] = hg(a, a.h[0], a.U())
+};
+Z[37] = function(a) {
+ a.b[0] = ig(a, a.b[0], a.ea())
+};
+W[38] = function(a) {
+ fe(a, 0)
+};
+W[39] = function(a) {
+ var b = a.D[0],
+ c = a.cb(),
+ d = Ae(a);
+ a.flags &= -18;
+ if (9 < (b & 15) || d) a.D[0] += 6, a.flags |= 16;
+ if (153 < b || c) a.D[0] += 96, a.flags |= 1;
+ a.F = a.D[0];
+ a.S = 7;
+ a.jb = a.kb = 0;
+ a.u = 196
+};
+W[40] = function(a) {
+ D(a);
+ cf(a, Sf(a, bf(a), kf(a)))
+};
+X[41] = function(a) {
+ D(a);
+ R(a, Tf(a, Q(a), mf(a)))
+};
+Z[41] = function(a) {
+ D(a);
+ ef(a, Uf(a, df(a), S(a)))
+};
+W[42] = function(a) {
+ D(a);
+ lf(a, Sf(a, kf(a), Ue(a)))
+};
+X[43] = function(a) {
+ D(a); of (a, Tf(a, mf(a), O(a)))
+};
+Z[43] = function(a) {
+ D(a);
+ pf(a, Uf(a, S(a), Ve(a)))
+};
+W[44] = function(a) {
+ a.D[0] = Sf(a, a.D[0], a.L())
+};
+X[45] = function(a) {
+ a.h[0] = Tf(a, a.h[0], a.U())
+};
+Z[45] = function(a) {
+ a.b[0] = Uf(a, a.b[0], a.ea())
+};
+W[46] = function(a) {
+ fe(a, 1)
+};
+W[47] = function(a) {
+ var b = a.D[0],
+ c = a.cb();
+ a.flags &= -2;
+ 9 < (b & 15) || Ae(a) ? (a.D[0] -= 6, a.flags |= 16, a.flags = a.flags & -2 | c | 6 > b) : a.flags &= -17;
+ if (153 < b || c) a.D[0] -= 96, a.flags |= 1;
+ a.F = a.D[0];
+ a.S = 7;
+ a.jb = a.kb = 0;
+ a.u = 196
+};
+W[48] = function(a) {
+ D(a);
+ cf(a, mg(a, bf(a), kf(a)))
+};
+X[49] = function(a) {
+ D(a);
+ R(a, ng(a, Q(a), mf(a)))
+};
+Z[49] = function(a) {
+ D(a);
+ ef(a, og(a, df(a), S(a)))
+};
+W[50] = function(a) {
+ D(a);
+ lf(a, mg(a, kf(a), Ue(a)))
+};
+X[51] = function(a) {
+ D(a); of (a, ng(a, mf(a), O(a)))
+};
+Z[51] = function(a) {
+ D(a);
+ pf(a, og(a, S(a), Ve(a)))
+};
+W[52] = function(a) {
+ a.D[0] = mg(a, a.D[0], a.L())
+};
+X[53] = function(a) {
+ a.h[0] = ng(a, a.h[0], a.U())
+};
+Z[53] = function(a) {
+ a.b[0] = og(a, a.b[0], a.ea())
+};
+W[54] = function(a) {
+ fe(a, 2)
+};
+W[55] = function(a) {
+ 9 < (a.D[0] & 15) || Ae(a) ? (a.h[0] += 6, a.D[1] += 1, a.flags |= 17) : a.flags &= -18;
+ a.D[0] &= 15;
+ a.u &= -18
+};
+W[56] = function(a) {
+ D(a);
+ var b = Ue(a);
+ a.sub(b, kf(a), 7)
+};
+X[57] = function(a) {
+ D(a);
+ var b = O(a);
+ a.sub(b, mf(a), 15)
+};
+Z[57] = function(a) {
+ D(a);
+ var b = Ve(a);
+ a.sub(b, S(a), 31)
+};
+W[58] = function(a) {
+ D(a);
+ var b = Ue(a);
+ a.sub(kf(a), b, 7)
+};
+X[59] = function(a) {
+ D(a);
+ var b = O(a);
+ a.sub(mf(a), b, 15)
+};
+Z[59] = function(a) {
+ D(a);
+ var b = Ve(a);
+ a.sub(S(a), b, 31)
+};
+W[60] = function(a) {
+ var b = a.L();
+ a.sub(a.D[0], b, 7)
+};
+X[61] = function(a) {
+ var b = a.U();
+ a.sub(a.h[0], b, 15)
+};
+Z[61] = function(a) {
+ var b = a.ea();
+ a.sub(a.b[0], b, 31)
+};
+W[62] = function(a) {
+ fe(a, 3)
+};
+W[63] = function(a) {
+ 9 < (a.D[0] & 15) || Ae(a) ? (a.h[0] -= 6, --a.D[1], a.flags |= 17) : a.flags &= -18;
+ a.D[0] &= 15;
+ a.u &= -18
+};
+X[64] = function(a) {
+ a.h[0] = Zf(a, a.h[0], 15)
+};
+Z[64] = function(a) {
+ a.b[0] = Zf(a, a.b[0], 31)
+};
+X[65] = function(a) {
+ a.h[2] = Zf(a, a.h[2], 15)
+};
+Z[65] = function(a) {
+ a.b[1] = Zf(a, a.b[1], 31)
+};
+X[66] = function(a) {
+ a.h[4] = Zf(a, a.h[4], 15)
+};
+Z[66] = function(a) {
+ a.b[2] = Zf(a, a.b[2], 31)
+};
+X[67] = function(a) {
+ a.h[6] = Zf(a, a.h[6], 15)
+};
+Z[67] = function(a) {
+ a.b[3] = Zf(a, a.b[3], 31)
+};
+X[68] = function(a) {
+ a.h[8] = Zf(a, a.h[8], 15)
+};
+Z[68] = function(a) {
+ a.b[4] = Zf(a, a.b[4], 31)
+};
+X[69] = function(a) {
+ a.h[10] = Zf(a, a.h[10], 15)
+};
+Z[69] = function(a) {
+ a.b[5] = Zf(a, a.b[5], 31)
+};
+X[70] = function(a) {
+ a.h[12] = Zf(a, a.h[12], 15)
+};
+Z[70] = function(a) {
+ a.b[6] = Zf(a, a.b[6], 31)
+};
+X[71] = function(a) {
+ a.h[14] = Zf(a, a.h[14], 15)
+};
+Z[71] = function(a) {
+ a.b[7] = Zf(a, a.b[7], 31)
+};
+X[72] = function(a) {
+ a.h[0] = $f(a, a.h[0], 15)
+};
+Z[72] = function(a) {
+ a.b[0] = $f(a, a.b[0], 31)
+};
+X[73] = function(a) {
+ a.h[2] = $f(a, a.h[2], 15)
+};
+Z[73] = function(a) {
+ a.b[1] = $f(a, a.b[1], 31)
+};
+X[74] = function(a) {
+ a.h[4] = $f(a, a.h[4], 15)
+};
+Z[74] = function(a) {
+ a.b[2] = $f(a, a.b[2], 31)
+};
+X[75] = function(a) {
+ a.h[6] = $f(a, a.h[6], 15)
+};
+Z[75] = function(a) {
+ a.b[3] = $f(a, a.b[3], 31)
+};
+X[76] = function(a) {
+ a.h[8] = $f(a, a.h[8], 15)
+};
+Z[76] = function(a) {
+ a.b[4] = $f(a, a.b[4], 31)
+};
+X[77] = function(a) {
+ a.h[10] = $f(a, a.h[10], 15)
+};
+Z[77] = function(a) {
+ a.b[5] = $f(a, a.b[5], 31)
+};
+X[78] = function(a) {
+ a.h[12] = $f(a, a.h[12], 15)
+};
+Z[78] = function(a) {
+ a.b[6] = $f(a, a.b[6], 31)
+};
+X[79] = function(a) {
+ a.h[14] = $f(a, a.h[14], 15)
+};
+Z[79] = function(a) {
+ a.b[7] = $f(a, a.b[7], 31)
+};
+X[80] = function(a) {
+ I(a, a.h[0])
+};
+Z[80] = function(a) {
+ J(a, a.b[0])
+};
+X[81] = function(a) {
+ I(a, a.h[2])
+};
+Z[81] = function(a) {
+ J(a, a.b[1])
+};
+X[82] = function(a) {
+ I(a, a.h[4])
+};
+Z[82] = function(a) {
+ J(a, a.b[2])
+};
+X[83] = function(a) {
+ I(a, a.h[6])
+};
+Z[83] = function(a) {
+ J(a, a.b[3])
+};
+X[84] = function(a) {
+ I(a, a.h[8])
+};
+Z[84] = function(a) {
+ J(a, a.b[4])
+};
+X[85] = function(a) {
+ I(a, a.h[10])
+};
+Z[85] = function(a) {
+ J(a, a.b[5])
+};
+X[86] = function(a) {
+ I(a, a.h[12])
+};
+Z[86] = function(a) {
+ J(a, a.b[6])
+};
+X[87] = function(a) {
+ I(a, a.h[14])
+};
+Z[87] = function(a) {
+ J(a, a.b[7])
+};
+X[88] = function(a) {
+ a.h[0] = nh(a)
+};
+Z[88] = function(a) {
+ a.b[0] = oh(a)
+};
+X[89] = function(a) {
+ a.h[2] = nh(a)
+};
+Z[89] = function(a) {
+ a.b[1] = oh(a)
+};
+X[90] = function(a) {
+ a.h[4] = nh(a)
+};
+Z[90] = function(a) {
+ a.b[2] = oh(a)
+};
+X[91] = function(a) {
+ a.h[6] = nh(a)
+};
+Z[91] = function(a) {
+ a.b[3] = oh(a)
+};
+X[92] = function(a) {
+ a.h[8] = nh(a)
+};
+Z[92] = function(a) {
+ a.b[4] = oh(a)
+};
+X[93] = function(a) {
+ a.h[10] = nh(a)
+};
+Z[93] = function(a) {
+ a.b[5] = oh(a)
+};
+X[94] = function(a) {
+ a.h[12] = nh(a)
+};
+Z[94] = function(a) {
+ a.b[6] = oh(a)
+};
+X[95] = function(a) {
+ a.h[14] = nh(a)
+};
+Z[95] = function(a) {
+ a.b[7] = oh(a)
+};
+X[96] = function(a) {
+ var b = a.h[8];
+ Cb(a, G(a, -16), 16);
+ I(a, a.h[0]);
+ I(a, a.h[2]);
+ I(a, a.h[4]);
+ I(a, a.h[6]);
+ I(a, b);
+ I(a, a.h[10]);
+ I(a, a.h[12]);
+ I(a, a.h[14])
+};
+Z[96] = function(a) {
+ var b = a.b[4];
+ Cb(a, G(a, -32), 32);
+ J(a, a.b[0]);
+ J(a, a.b[1]);
+ J(a, a.b[2]);
+ J(a, a.b[3]);
+ J(a, b);
+ J(a, a.b[5]);
+ J(a, a.b[6]);
+ J(a, a.b[7])
+};
+X[97] = function(a) {
+ je(a, G(a, 0));
+ je(a, G(a, 15));
+ a.h[14] = nh(a);
+ a.h[12] = nh(a);
+ a.h[10] = nh(a);
+ Ee(a, 2);
+ a.h[6] = nh(a);
+ a.h[4] = nh(a);
+ a.h[2] = nh(a);
+ a.h[0] = nh(a)
+};
+Z[97] = function(a) {
+ je(a, G(a, 0));
+ je(a, G(a, 31));
+ a.b[7] = oh(a);
+ a.b[6] = oh(a);
+ a.b[5] = oh(a);
+ Ee(a, 4);
+ a.b[3] = oh(a);
+ a.b[2] = oh(a);
+ a.b[1] = oh(a);
+ a.b[0] = oh(a)
+};
+W[98] = function() {};
+W[99] = function(a) {
+ D(a);
+ if (a.ta && !ye(a)) {
+ var b = Q(a);
+ var c = a.f >> 2 & 14;
+ a.u &= -65;
+ (b & 3) < (a.h[c] & 3) ? (a.flags |= 64, b = b & -4 | a.h[c] & 3) : a.flags &= -65;
+ R(a, b)
+ } else t(a)
+};
+W[100] = function(a) {
+ fe(a, 4)
+};
+W[101] = function(a) {
+ fe(a, 5)
+};
+W[102] = function(a) {
+ a.H |= 32;
+ ge(a);
+ a.H = 0
+};
+W[103] = function(a) {
+ a.H |= 64;
+ ge(a);
+ a.H = 0
+};
+X[104] = function(a) {
+ I(a, a.U())
+};
+Z[104] = function(a) {
+ J(a, a.ea())
+};
+X[105] = function(a) {
+ D(a); of (a, bg(a, O(a) << 16 >> 16, a.U() << 16 >> 16))
+};
+Z[105] = function(a) {
+ D(a);
+ pf(a, eg(a, Ve(a), a.ea()))
+};
+X[106] = function(a) {
+ I(a, a.wa())
+};
+Z[106] = function(a) {
+ J(a, a.wa())
+};
+X[107] = function(a) {
+ D(a); of (a, bg(a, O(a) << 16 >> 16, a.wa()))
+};
+Z[107] = function(a) {
+ D(a);
+ pf(a, eg(a, Ve(a), a.wa()))
+};
+W[108] = function(a) {
+ var b = a.h[4];
+ uf(a, b, 1);
+ var c = C(a, 0) + U(a, 7) | 0,
+ d = a.flags & 1024 ? -1 : 1;
+ if (a.H & 24) {
+ var e = U(a, 1) >>> 0;
+ if (0 !== e) {
+ var f = e,
+ h = 4096,
+ g = se(a, c);
+ a.V && (h = Bf(d, c));
+ do a.za(g, Va(a.o, b)), g += d, c = 0 !== --e; while (c && h--);
+ V(a, 7, d * (f - e) | 0);
+ zf(a, e);
+ a.Y += f - e;
+ c && (a.A = a.ga)
+ }
+ } else Cb(a, c, 1), re(a, c, Va(a.o, b)), V(a, 7, d)
+};
+X[109] = function(a) {
+ var b = a.h[4];
+ uf(a, b, 2);
+ var c = C(a, 0) + U(a, 7) | 0,
+ d = a.flags & 1024 ? -2 : 2;
+ if (a.H & 24) {
+ var e = U(a, 1) >>> 0;
+ if (0 !== e) {
+ var f = e,
+ h = 4096;
+ if (c & 1) {
+ do {
+ u(a, c, Wa(a.o, b));
+ c += d;
+ V(a, 7, d);
+ var g = 0 !== Af(a)
+ } while (g && h--)
+ } else {
+ var p = 0 > d ? -1 : 1,
+ r = se(a, c) >>> 1;
+ a.V && (h = Bf(d, c));
+ do zc(a, r, Wa(a.o, b)), r += p, g = 0 !== --e; while (g && h--);
+ V(a, 7, d * (f - e) | 0);
+ zf(a, e);
+ a.Y += f - e
+ }
+ g && (a.A = a.ga)
+ }
+ } else Cb(a, c, 2), u(a, c, Wa(a.o, b)), V(a, 7, d)
+};
+Z[109] = function(a) {
+ var b = a.h[4];
+ uf(a, b, 4);
+ var c = C(a, 0) + U(a, 7) | 0,
+ d = a.flags & 1024 ? -4 : 4;
+ if (a.H & 24) {
+ var e = U(a, 1) >>> 0;
+ if (0 !== e) {
+ var f = e,
+ h = 4096;
+ if (c & 3) {
+ do {
+ w(a, c, Xa(a.o, b));
+ c += d;
+ V(a, 7, d);
+ var g = 0 !== Af(a)
+ } while (g && h--)
+ } else {
+ var p = 0 > d ? -1 : 1,
+ r = se(a, c) >>> 2;
+ a.V && (h = Bf(d, c));
+ do Ac(a, r, Xa(a.o, b)), r += p, g = 0 !== --e; while (g && h--);
+ V(a, 7, d * (f - e) | 0);
+ zf(a, e);
+ a.Y += f - e
+ }
+ g && (a.A = a.ga)
+ }
+ } else Cb(a, c, 4), w(a, c, Xa(a.o, b)), V(a, 7, d)
+};
+W[110] = function(a) {
+ var b = a.h[4];
+ uf(a, b, 1);
+ var c = we(a, 3) + U(a, 6) | 0,
+ d = a.flags & 1024 ? -1 : 1;
+ if (a.H & 24) {
+ var e = U(a, 1) >>> 0;
+ if (0 !== e) {
+ var f = e,
+ h = 4096,
+ g = je(a, c);
+ a.V && (h = Bf(d, c));
+ do Sa(a.o, b, a.ja(g)), g += d, c = 0 !== --e; while (c && h--);
+ V(a, 6, d * (f - e) | 0);
+ zf(a, e);
+ a.Y += f - e;
+ c && (a.A = a.ga)
+ }
+ } else Sa(a.o, b, pe(a, c)), V(a, 6, d)
+};
+X[111] = function(a) {
+ var b = a.h[4];
+ uf(a, b, 2);
+ var c = we(a, 3) + U(a, 6) | 0,
+ d = a.flags & 1024 ? -2 : 2;
+ if (a.H & 24) {
+ var e = U(a, 1) >>> 0;
+ if (0 !== e) {
+ var f = e,
+ h = 4096;
+ if (c & 1) {
+ do {
+ Ta(a.o, b, x(a, c));
+ c += d;
+ V(a, 6, d);
+ var g = 0 !== Af(a)
+ } while (g && h--)
+ } else {
+ var p = 0 > d ? -1 : 1,
+ r = je(a, c) >>> 1;
+ a.V && (h = Bf(d, c));
+ do Ta(a.o, b, xc(a, r)), r += p, g = 0 !== --e; while (g && h--);
+ V(a, 6, d * (f - e) | 0);
+ zf(a, e);
+ a.Y += f - e
+ }
+ g && (a.A = a.ga)
+ }
+ } else Ta(a.o, b, x(a, c)), V(a, 6, d)
+};
+Z[111] = function(a) {
+ var b = a.h[4];
+ uf(a, b, 4);
+ var c = we(a, 3) + U(a, 6) | 0,
+ d = a.flags & 1024 ? -4 : 4;
+ if (a.H & 24) {
+ var e = U(a, 1) >>> 0;
+ if (0 !== e) {
+ var f = e,
+ h = 4096;
+ if (c & 3) {
+ do {
+ Ua(a.o, b, y(a, c));
+ c += d;
+ V(a, 6, d);
+ var g = 0 !== Af(a)
+ } while (g && h--)
+ } else {
+ var p = 0 > d ? -1 : 1,
+ r = je(a, c) >>> 2;
+ a.V && (h = Bf(d, c));
+ do Ua(a.o, b, yc(a, r)), r += p, g = 0 !== --e; while (g && h--);
+ V(a, 6, d * (f - e) | 0);
+ zf(a, e);
+ a.Y += f - e
+ }
+ g && (a.A = a.ga)
+ }
+ } else Ua(a.o, b, y(a, c)), V(a, 6, d)
+};
+W[112] = function(a) {
+ dh(a, a.Qb())
+};
+W[113] = function(a) {
+ dh(a, !a.Qb())
+};
+W[114] = function(a) {
+ dh(a, a.yb())
+};
+W[115] = function(a) {
+ dh(a, !a.yb())
+};
+W[116] = function(a) {
+ dh(a, a.Ab())
+};
+W[117] = function(a) {
+ dh(a, !a.Ab())
+};
+W[118] = function(a) {
+ dh(a, kh(a))
+};
+W[119] = function(a) {
+ dh(a, !kh(a))
+};
+W[120] = function(a) {
+ dh(a, a.Rb())
+};
+W[121] = function(a) {
+ dh(a, !a.Rb())
+};
+W[122] = function(a) {
+ dh(a, a.zb())
+};
+W[123] = function(a) {
+ dh(a, !a.zb())
+};
+W[124] = function(a) {
+ dh(a, lh(a))
+};
+W[125] = function(a) {
+ dh(a, !lh(a))
+};
+W[126] = function(a) {
+ dh(a, mh(a))
+};
+W[127] = function(a) {
+ dh(a, !mh(a))
+};
+W[128] = function(a) {
+ D(a);
+ switch (a.f >> 3 & 7) {
+ case 0:
+ cf(a, Df(a, bf(a), a.L()));
+ break;
+ case 1:
+ cf(a, jg(a, bf(a), a.L()));
+ break;
+ case 2:
+ cf(a, Of(a, bf(a), a.L()));
+ break;
+ case 3:
+ cf(a, Vf(a, bf(a), a.L()));
+ break;
+ case 4:
+ cf(a, gg(a, bf(a), a.L()));
+ break;
+ case 5:
+ cf(a, Sf(a, bf(a), a.L()));
+ break;
+ case 6:
+ cf(a, mg(a, bf(a), a.L()));
+ break;
+ case 7:
+ var b = Ue(a),
+ c = a.L();
+ a.sub(b, c, 7)
+ }
+};
+X[129] = function(a) {
+ D(a);
+ switch (a.f >> 3 & 7) {
+ case 0:
+ R(a, Ef(a, Q(a), a.U()));
+ break;
+ case 1:
+ R(a, kg(a, Q(a), a.U()));
+ break;
+ case 2:
+ R(a, Qf(a, Q(a), a.U()));
+ break;
+ case 3:
+ R(a, Xf(a, Q(a), a.U()));
+ break;
+ case 4:
+ R(a, hg(a, Q(a), a.U()));
+ break;
+ case 5:
+ R(a, Tf(a, Q(a), a.U()));
+ break;
+ case 6:
+ R(a, ng(a, Q(a), a.U()));
+ break;
+ case 7:
+ var b = O(a),
+ c = a.U();
+ a.sub(b, c, 15)
+ }
+};
+Z[129] = function(a) {
+ D(a);
+ switch (a.f >> 3 & 7) {
+ case 0:
+ ef(a, Ff(a, df(a), a.ea()));
+ break;
+ case 1:
+ ef(a, lg(a, df(a), a.ea()));
+ break;
+ case 2:
+ ef(a, Rf(a, df(a), a.ea()));
+ break;
+ case 3:
+ ef(a, Yf(a, df(a), a.ea()));
+ break;
+ case 4:
+ ef(a, ig(a, df(a), a.ea()));
+ break;
+ case 5:
+ ef(a, Uf(a, df(a), a.ea()));
+ break;
+ case 6:
+ ef(a, og(a, df(a), a.ea()));
+ break;
+ case 7:
+ var b = Ve(a),
+ c = a.ea();
+ a.sub(b, c, 31)
+ }
+};
+W[130] = W[128];
+X[131] = function(a) {
+ D(a);
+ switch (a.f >> 3 & 7) {
+ case 0:
+ R(a, Ef(a, Q(a), a.wa()));
+ break;
+ case 1:
+ R(a, kg(a, Q(a), a.wa()));
+ break;
+ case 2:
+ R(a, Qf(a, Q(a), a.wa()));
+ break;
+ case 3:
+ R(a, Xf(a, Q(a), a.wa()));
+ break;
+ case 4:
+ R(a, hg(a, Q(a), a.wa()));
+ break;
+ case 5:
+ R(a, Tf(a, Q(a), a.wa()));
+ break;
+ case 6:
+ R(a, ng(a, Q(a), a.wa()));
+ break;
+ case 7:
+ var b = O(a),
+ c = a.wa();
+ a.sub(b, c, 15)
+ }
+};
+Z[131] = function(a) {
+ D(a);
+ switch (a.f >> 3 & 7) {
+ case 0:
+ ef(a, Ff(a, df(a), a.wa()));
+ break;
+ case 1:
+ ef(a, lg(a, df(a), a.wa()));
+ break;
+ case 2:
+ ef(a, Rf(a, df(a), a.wa()));
+ break;
+ case 3:
+ ef(a, Yf(a, df(a), a.wa()));
+ break;
+ case 4:
+ ef(a, ig(a, df(a), a.wa()));
+ break;
+ case 5:
+ ef(a, Uf(a, df(a), a.wa()));
+ break;
+ case 6:
+ ef(a, og(a, df(a), a.wa()));
+ break;
+ case 7:
+ var b = Ve(a),
+ c = a.wa();
+ a.sub(b, c, 31)
+ }
+};
+W[132] = function(a) {
+ D(a);
+ var b = Ue(a);
+ a.and(b, kf(a), 7)
+};
+X[133] = function(a) {
+ D(a);
+ var b = O(a);
+ a.and(b, mf(a), 15)
+};
+Z[133] = function(a) {
+ D(a);
+ var b = Ve(a);
+ a.and(b, S(a), 31)
+};
+W[134] = function(a) {
+ D(a);
+ var b = bf(a),
+ c = a.f;
+ c = c >> 1 & 12 | c >> 5 & 1;
+ var d = a.D[c];
+ a.D[c] = b;
+ cf(a, d)
+};
+X[135] = function(a) {
+ D(a);
+ var b = Q(a),
+ c = a.f >> 2 & 14,
+ d = a.h[c];
+ a.h[c] = b;
+ R(a, d)
+};
+Z[135] = function(a) {
+ D(a);
+ var b = df(a),
+ c = a.f >> 3 & 7,
+ d = a.b[c];
+ a.b[c] = b;
+ ef(a, d)
+};
+W[136] = function(a) {
+ D(a);
+ Ze(a, kf(a))
+};
+X[137] = function(a) {
+ D(a);
+ $e(a, mf(a))
+};
+Z[137] = function(a) {
+ D(a);
+ af(a, S(a))
+};
+W[138] = function(a) {
+ D(a);
+ var b = Ue(a);
+ lf(a, b)
+};
+X[139] = function(a) {
+ D(a);
+ var b = O(a); of (a, b)
+};
+Z[139] = function(a) {
+ D(a);
+ var b = Ve(a);
+ pf(a, b)
+};
+X[140] = function(a) {
+ D(a);
+ $e(a, a.M[a.f >> 3 & 7])
+};
+Z[140] = function(a) {
+ D(a);
+ af(a, a.M[a.f >> 3 & 7])
+};
+X[141] = function(a) {
+ D(a);
+ 192 <= a.f && t(a);
+ var b = a.f >> 3 & 7;
+ a.H |= 7;
+ a.h[b << 1] = F(a, a.f);
+ a.H = 0
+};
+Z[141] = function(a) {
+ D(a);
+ 192 <= a.f && t(a);
+ var b = a.f >> 3 & 7;
+ a.H |= 7;
+ a.b[b] = F(a, a.f);
+ a.H = 0
+};
+W[142] = function(a) {
+ D(a);
+ var b = a.f >> 3 & 7,
+ c = O(a);
+ $d(a, b, c);
+ 2 === b && (a.H = 0, ee(a))
+};
+X[143] = function(a) {
+ D(a);
+ var b = x(a, G(a, 0));
+ Ee(a, 2);
+ if (192 > a.f) {
+ var c = F(a, a.f);
+ Ee(a, -2);
+ u(a, c, b);
+ Ee(a, 2)
+ } else gf(a, b)
+};
+Z[143] = function(a) {
+ D(a);
+ var b = y(a, G(a, 0));
+ Ee(a, 4);
+ if (192 > a.f) {
+ var c = F(a, a.f);
+ Ee(a, -4);
+ w(a, c, b);
+ Ee(a, 4)
+ } else jf(a, b)
+};
+W[144] = function() {};
+X[145] = function(a) {
+ ph(a, 2)
+};
+Z[145] = function(a) {
+ qh(a, 1)
+};
+X[146] = function(a) {
+ ph(a, 4)
+};
+Z[146] = function(a) {
+ qh(a, 2)
+};
+X[147] = function(a) {
+ ph(a, 6)
+};
+Z[147] = function(a) {
+ qh(a, 3)
+};
+X[148] = function(a) {
+ ph(a, 8)
+};
+Z[148] = function(a) {
+ qh(a, 4)
+};
+X[149] = function(a) {
+ ph(a, 10)
+};
+Z[149] = function(a) {
+ qh(a, 5)
+};
+X[150] = function(a) {
+ ph(a, 12)
+};
+Z[150] = function(a) {
+ qh(a, 6)
+};
+X[151] = function(a) {
+ ph(a, 14)
+};
+Z[151] = function(a) {
+ qh(a, 7)
+};
+X[152] = function(a) {
+ a.h[0] = a.sg[0]
+};
+Z[152] = function(a) {
+ a.b[0] = a.se[0]
+};
+X[153] = function(a) {
+ a.h[4] = a.se[0] >> 15
+};
+Z[153] = function(a) {
+ a.b[2] = a.b[0] >> 31
+};
+X[154] = function(a) {
+ var b = a.U(),
+ c = a.Ib();
+ Qe(a, b, c, !0);
+ me(a) || Fe(a)
+};
+Z[154] = function(a) {
+ var b = a.ea(),
+ c = a.Ib();
+ if ((!a.ta || ye(a)) && b & 4294901760) throw a.debug.P("#GP handler");
+ Qe(a, b, c, !0);
+ me(a) || Fe(a)
+};
+W[155] = function(a) {
+ 10 === (a.K[0] & 10) && Se(a)
+};
+X[156] = function(a) {
+ a.flags & 131072 && 3 > xe(a) ? H(a, 0) : I(a, ze(a))
+};
+Z[156] = function(a) {
+ a.flags & 131072 && 3 > xe(a) ? H(a, 0) : J(a, ze(a) & 16580607)
+};
+X[157] = function(a) {
+ a.flags & 131072 && 3 > xe(a) && H(a, 0);
+ Be(a, a.flags & -65536 | nh(a));
+ a.flags & 256 ? a.flags &= -257 : ab(a)
+};
+Z[157] = function(a) {
+ a.flags & 131072 && 3 > xe(a) && H(a, 0);
+ Be(a, oh(a));
+ ab(a)
+};
+W[158] = function(a) {
+ a.flags = a.flags & -256 | a.D[1];
+ a.flags = a.flags & 4161493 | 2;
+ a.u = 0
+};
+W[159] = function(a) {
+ a.D[1] = ze(a)
+};
+W[160] = function(a) {
+ var b = pe(a, ve(a));
+ a.D[0] = b
+};
+X[161] = function(a) {
+ var b = x(a, ve(a));
+ a.h[0] = b
+};
+Z[161] = function(a) {
+ var b = y(a, ve(a));
+ a.b[0] = b
+};
+W[162] = function(a) {
+ re(a, ve(a), a.D[0])
+};
+X[163] = function(a) {
+ u(a, ve(a), a.h[0])
+};
+Z[163] = function(a) {
+ w(a, ve(a), a.b[0])
+};
+W[164] = function(a) {
+ var b = we(a, 3) + U(a, 6) | 0,
+ c = C(a, 0) + U(a, 7) | 0,
+ d = a.flags & 1024 ? -1 : 1;
+ if (a.H & 24) {
+ var e = U(a, 1) >>> 0;
+ if (0 !== e) {
+ var f = e,
+ h = 4096,
+ g = je(a, b),
+ p = se(a, c);
+ a.V && (h = Cf(d, b, c));
+ do a.za(p, a.ja(g)), p += d, g += d, b = 0 !== --e; while (b && h--);
+ d = d * (f - e) | 0;
+ V(a, 7, d);
+ V(a, 6, d);
+ zf(a, e);
+ a.Y += f - e;
+ b && (a.A = a.ga)
+ }
+ } else re(a, c, pe(a, b)), V(a, 7, d), V(a, 6, d)
+};
+X[165] = function(a) {
+ var b = we(a, 3) + U(a, 6) | 0,
+ c = C(a, 0) + U(a, 7) | 0,
+ d = a.flags & 1024 ? -2 : 2;
+ if (a.H & 24) {
+ var e = U(a, 1) >>> 0;
+ if (0 !== e) {
+ var f = e,
+ h = 4096;
+ if (c & 1 || b & 1) {
+ do {
+ u(a, c, x(a, b));
+ c += d;
+ V(a, 7, d);
+ b += d;
+ V(a, 6, d);
+ var g = 0 !== Af(a)
+ } while (g && h--)
+ } else {
+ var p = 0 > d ? -1 : 1,
+ r = je(a, b) >>> 1,
+ v = se(a, c) >>> 1;
+ a.V && (h = Cf(d, b, c));
+ do zc(a, v, xc(a, r)), v += p, r += p, g = 0 !== --e; while (g && h--);
+ b = d * (f - e) | 0;
+ V(a, 7, b);
+ V(a, 6, b);
+ zf(a, e);
+ a.Y += f - e
+ }
+ g && (a.A = a.ga)
+ }
+ } else u(a, c, x(a, b)), V(a, 7, d), V(a, 6, d)
+};
+Z[165] = function(a) {
+ a: {
+ if (a.H & 24) {
+ var b = we(a, 3) + U(a, 6) | 0,
+ c = C(a, 0) + U(a, 7) | 0,
+ d = U(a, 1) >>> 0;
+ if (!d) break a;
+ var e = a.V ? 4095 : 3;
+ if (0 === (c & e) && 0 === (b & e) && 0 === (a.flags & 1024) && (e = !1, a.V && (b = je(a, b), c = se(a, c), 1024 < d && (d = 1024, e = !0)), !Qa(a.o, b, d) && !Qa(a.o, c, d))) {
+ var f = d << 2;
+ V(a, 1, -d);
+ V(a, 7, f);
+ V(a, 6, f);
+ b >>>= 2;
+ a.Cc.set(a.Cc.subarray(b, b + d), c >>> 2);
+ e && (a.A = a.ga);
+ break a
+ }
+ }
+ b = we(a, 3) + U(a, 6) | 0;c = C(a, 0) + U(a, 7) | 0;f = a.flags & 1024 ? -4 : 4;
+ if (a.H & 24) {
+ if (d = U(a, 1) >>> 0, 0 !== d) {
+ var h = d,
+ g = 4096;
+ if (c & 3 || b & 3) {
+ do w(a, c, y(a, b)), c += f, V(a, 7, f),
+ b += f, V(a, 6, f), e = 0 !== Af(a); while (e && g--)
+ } else {
+ var p = 0 > f ? -1 : 1,
+ r = je(a, b) >>> 2,
+ v = se(a, c) >>> 2;
+ a.V && (g = Cf(f, b, c));
+ do Ac(a, v, yc(a, r)), v += p, r += p, e = 0 !== --d; while (e && g--);
+ f = f * (h - d) | 0;
+ V(a, 7, f);
+ V(a, 6, f);
+ zf(a, d);
+ a.Y += h - d
+ }
+ e && (a.A = a.ga)
+ }
+ } else w(a, c, y(a, b)),
+ V(a, 7, f),
+ V(a, 6, f)
+ }
+};
+W[166] = function(a) {
+ a: {
+ var b = we(a, 3) + U(a, 6) | 0,
+ c = C(a, 0) + U(a, 7) | 0,
+ d = a.flags & 1024 ? -1 : 1;
+ if (a.H & 24) {
+ var e = U(a, 1) >>> 0;
+ if (0 === e) break a;
+ var f = e,
+ h = 8 === (a.H & 24),
+ g = 4096,
+ p = je(a, b),
+ r = je(a, c);
+ a.V && (g = Cf(d, b, c));
+ do {
+ c = a.ja(r);
+ b = a.ja(p);
+ r += d;
+ p += d;
+ var v = 0 !== --e && b === c === h
+ } while (v && g--);
+ d = d * (f - e) | 0;
+ V(a, 7, d);
+ V(a, 6, d);
+ zf(a, e);
+ a.Y += f - e;
+ v && (a.A = a.ga)
+ } else b = pe(a, b),
+ c = pe(a, c),
+ V(a, 7, d),
+ V(a, 6, d);a.sub(b, c, 7)
+ }
+};
+X[167] = function(a) {
+ a: {
+ var b = we(a, 3) + U(a, 6) | 0,
+ c = C(a, 0) + U(a, 7) | 0,
+ d = a.flags & 1024 ? -2 : 2;
+ if (a.H & 24) {
+ var e = U(a, 1) >>> 0;
+ if (0 === e) break a;
+ var f = e,
+ h = 8 === (a.H & 24),
+ g = 4096;
+ if (c & 1 || b & 1) {
+ do {
+ var p = x(a, c);
+ var r = x(a, b);
+ c += d;
+ V(a, 7, d);
+ b += d;
+ V(a, 6, d);
+ var v = 0 !== Af(a) && r === p === h
+ } while (v && g--)
+ } else {
+ var E = 0 > d ? -1 : 1,
+ z = je(a, b) >>> 1,
+ A = je(a, c) >>> 1;
+ a.V && (g = Cf(d, b, c));
+ do p = xc(a, A), r = xc(a, z), A += E, z += E, v = 0 !== --e && r === p === h; while (v && g--);
+ b = d * (f - e) | 0;
+ V(a, 7, b);
+ V(a, 6, b);
+ zf(a, e);
+ a.Y += f - e
+ }
+ v && (a.A = a.ga)
+ } else p = x(a, c),
+ r = x(a, b),
+ V(a, 7, d),
+ V(a,
+ 6, d);a.sub(r, p, 15)
+ }
+};
+Z[167] = function(a) {
+ a: {
+ var b = we(a, 3) + U(a, 6) | 0,
+ c = C(a, 0) + U(a, 7) | 0,
+ d = a.flags & 1024 ? -4 : 4;
+ if (a.H & 24) {
+ var e = U(a, 1) >>> 0;
+ if (0 === e) break a;
+ var f = e,
+ h = 8 === (a.H & 24),
+ g = 4096;
+ if (c & 3 || b & 3) {
+ do {
+ var p = y(a, c);
+ var r = y(a, b);
+ c += d;
+ V(a, 7, d);
+ b += d;
+ V(a, 6, d);
+ var v = 0 !== Af(a) && r === p === h
+ } while (v && g--)
+ } else {
+ var E = 0 > d ? -1 : 1,
+ z = je(a, b) >>> 2,
+ A = je(a, c) >>> 2;
+ a.V && (g = Cf(d, b, c));
+ do p = yc(a, A), r = yc(a, z), A += E, z += E, v = 0 !== --e && r === p === h; while (v && g--);
+ b = d * (f - e) | 0;
+ V(a, 7, b);
+ V(a, 6, b);
+ zf(a, e);
+ a.Y += f - e
+ }
+ v && (a.A = a.ga)
+ } else p = y(a, c),
+ r = y(a, b),
+ V(a, 7, d),
+ V(a,
+ 6, d);a.sub(r, p, 31)
+ }
+};
+W[168] = function(a) {
+ var b = a.L();
+ a.and(a.D[0], b, 7)
+};
+X[169] = function(a) {
+ var b = a.U();
+ a.and(a.h[0], b, 15)
+};
+Z[169] = function(a) {
+ var b = a.ea();
+ a.and(a.b[0], b, 31)
+};
+W[170] = function(a) {
+ var b = a.D[0],
+ c = C(a, 0) + U(a, 7) | 0,
+ d = a.flags & 1024 ? -1 : 1;
+ if (a.H & 24) {
+ var e = U(a, 1) >>> 0;
+ if (0 !== e) {
+ var f = e,
+ h = 4096,
+ g = se(a, c);
+ a.V && (h = Bf(d, c));
+ do a.za(g, b), g += d, c = 0 !== --e; while (c && h--);
+ V(a, 7, d * (f - e) | 0);
+ zf(a, e);
+ a.Y += f - e;
+ c && (a.A = a.ga)
+ }
+ } else re(a, c, b), V(a, 7, d)
+};
+X[171] = function(a) {
+ var b = a.h[0],
+ c = C(a, 0) + U(a, 7) | 0,
+ d = a.flags & 1024 ? -2 : 2;
+ if (a.H & 24) {
+ var e = U(a, 1) >>> 0;
+ if (0 !== e) {
+ var f = e,
+ h = 4096;
+ if (c & 1) {
+ do {
+ u(a, c, b);
+ c += d;
+ V(a, 7, d);
+ var g = 0 !== Af(a)
+ } while (g && h--)
+ } else {
+ var p = 0 > d ? -1 : 1,
+ r = se(a, c) >>> 1;
+ a.V && (h = Bf(d, c));
+ do zc(a, r, b), r += p, g = 0 !== --e; while (g && h--);
+ V(a, 7, d * (f - e) | 0);
+ zf(a, e);
+ a.Y += f - e
+ }
+ g && (a.A = a.ga)
+ }
+ } else u(a, c, b), V(a, 7, d)
+};
+Z[171] = function(a) {
+ var b = a.b[0],
+ c = C(a, 0) + U(a, 7) | 0,
+ d = a.flags & 1024 ? -4 : 4;
+ if (a.H & 24) {
+ var e = U(a, 1) >>> 0;
+ if (0 !== e) {
+ var f = e,
+ h = 4096;
+ if (c & 3) {
+ do {
+ w(a, c, b);
+ c += d;
+ V(a, 7, d);
+ var g = 0 !== Af(a)
+ } while (g && h--)
+ } else {
+ var p = 0 > d ? -1 : 1,
+ r = se(a, c) >>> 2;
+ a.V && (h = Bf(d, c));
+ do Ac(a, r, b), r += p, g = 0 !== --e; while (g && h--);
+ V(a, 7, d * (f - e) | 0);
+ zf(a, e);
+ a.Y += f - e
+ }
+ g && (a.A = a.ga)
+ }
+ } else w(a, c, b), V(a, 7, d)
+};
+W[172] = function(a) {
+ var b = we(a, 3) + U(a, 6) | 0,
+ c = a.flags & 1024 ? -1 : 1;
+ if (a.H & 24) {
+ var d = U(a, 1) >>> 0;
+ if (0 !== d) {
+ var e = d,
+ f = 4096,
+ h = je(a, b);
+ a.V && (f = Bf(c, b));
+ do a.D[0] = a.ja(h), h += c, b = 0 !== --d; while (b && f--);
+ V(a, 6, c * (e - d) | 0);
+ zf(a, d);
+ a.Y += e - d;
+ b && (a.A = a.ga)
+ }
+ } else a.D[0] = pe(a, b), V(a, 6, c)
+};
+X[173] = function(a) {
+ var b = we(a, 3) + U(a, 6) | 0,
+ c = a.flags & 1024 ? -2 : 2;
+ if (a.H & 24) {
+ if (0 !== U(a, 1) >>> 0) {
+ var d = 4096;
+ do {
+ a.h[0] = x(a, b);
+ b += c;
+ V(a, 6, c);
+ var e = 0 !== Af(a)
+ } while (e && d--);
+ e && (a.A = a.ga)
+ }
+ } else a.h[0] = x(a, b), V(a, 6, c)
+};
+Z[173] = function(a) {
+ var b = we(a, 3) + U(a, 6) | 0,
+ c = a.flags & 1024 ? -4 : 4;
+ if (a.H & 24) {
+ if (0 !== U(a, 1) >>> 0) {
+ var d = 4096;
+ do {
+ a.b[0] = y(a, b);
+ b += c;
+ V(a, 6, c);
+ var e = 0 !== Af(a)
+ } while (e && d--);
+ e && (a.A = a.ga)
+ }
+ } else a.b[0] = y(a, b), V(a, 6, c)
+};
+W[174] = function(a) {
+ a: {
+ var b = C(a, 0) + U(a, 7) | 0,
+ c = a.flags & 1024 ? -1 : 1,
+ d = a.D[0];
+ if (a.H & 24) {
+ var e = U(a, 1) >>> 0;
+ if (0 === e) break a;
+ var f = e,
+ h = 8 === (a.H & 24),
+ g = 4096,
+ p = je(a, b);
+ a.V && (g = Bf(c, b));
+ do {
+ b = a.ja(p);
+ p += c;
+ var r = 0 !== --e && d === b === h
+ } while (r && g--);
+ V(a, 7, c * (f - e) | 0);
+ zf(a, e);
+ a.Y += f - e;
+ r && (a.A = a.ga)
+ } else b = pe(a, b),
+ V(a, 7, c);a.sub(d, b, 7)
+ }
+};
+X[175] = function(a) {
+ a: {
+ var b = C(a, 0) + U(a, 7) | 0,
+ c = a.flags & 1024 ? -2 : 2,
+ d = a.h[0];
+ if (a.H & 24) {
+ var e = U(a, 1) >>> 0;
+ if (0 === e) break a;
+ var f = e,
+ h = 8 === (a.H & 24),
+ g = 4096;
+ if (b & 1) {
+ do {
+ var p = x(a, b);
+ b += c;
+ V(a, 7, c);
+ var r = 0 !== Af(a) && d === p === h
+ } while (r && g--)
+ } else {
+ var v = 0 > c ? -1 : 1,
+ E = je(a, b) >>> 1;
+ a.V && (g = Bf(c, b));
+ do p = xc(a, E), E += v, r = 0 !== --e && d === p === h; while (r && g--);
+ V(a, 7, c * (f - e) | 0);
+ zf(a, e);
+ a.Y += f - e
+ }
+ r && (a.A = a.ga)
+ } else p = x(a, b),
+ V(a, 7, c);a.sub(d, p, 15)
+ }
+};
+Z[175] = function(a) {
+ a: {
+ var b = C(a, 0) + U(a, 7) | 0,
+ c = a.flags & 1024 ? -4 : 4,
+ d = a.b[0];
+ if (a.H & 24) {
+ var e = U(a, 1) >>> 0;
+ if (0 === e) break a;
+ var f = e,
+ h = 8 === (a.H & 24),
+ g = 4096;
+ if (b & 3) {
+ do {
+ var p = y(a, b);
+ b += c;
+ V(a, 7, c);
+ var r = 0 !== Af(a) && d === p === h
+ } while (r && g--)
+ } else {
+ var v = 0 > c ? -1 : 1,
+ E = je(a, b) >>> 2;
+ a.V && (g = Bf(c, b));
+ do p = yc(a, E), E += v, r = 0 !== --e && d === p === h; while (r && g--);
+ V(a, 7, c * (f - e) | 0);
+ zf(a, e);
+ a.Y += f - e
+ }
+ r && (a.A = a.ga)
+ } else p = y(a, b),
+ V(a, 7, c);a.sub(d, p, 31)
+ }
+};
+W[176] = function(a) {
+ a.D[0] = a.L()
+};
+W[177] = function(a) {
+ a.D[4] = a.L()
+};
+W[178] = function(a) {
+ a.D[8] = a.L()
+};
+W[179] = function(a) {
+ a.D[12] = a.L()
+};
+W[180] = function(a) {
+ a.D[1] = a.L()
+};
+W[181] = function(a) {
+ a.D[5] = a.L()
+};
+W[182] = function(a) {
+ a.D[9] = a.L()
+};
+W[183] = function(a) {
+ a.D[13] = a.L()
+};
+X[184] = function(a) {
+ a.h[0] = a.U()
+};
+Z[184] = function(a) {
+ a.b[0] = a.ea()
+};
+X[185] = function(a) {
+ a.h[2] = a.U()
+};
+Z[185] = function(a) {
+ a.b[1] = a.ea()
+};
+X[186] = function(a) {
+ a.h[4] = a.U()
+};
+Z[186] = function(a) {
+ a.b[2] = a.ea()
+};
+X[187] = function(a) {
+ a.h[6] = a.U()
+};
+Z[187] = function(a) {
+ a.b[3] = a.ea()
+};
+X[188] = function(a) {
+ a.h[8] = a.U()
+};
+Z[188] = function(a) {
+ a.b[4] = a.ea()
+};
+X[189] = function(a) {
+ a.h[10] = a.U()
+};
+Z[189] = function(a) {
+ a.b[5] = a.ea()
+};
+X[190] = function(a) {
+ a.h[12] = a.U()
+};
+Z[190] = function(a) {
+ a.b[6] = a.ea()
+};
+X[191] = function(a) {
+ a.h[14] = a.U()
+};
+Z[191] = function(a) {
+ a.b[7] = a.ea()
+};
+W[192] = function(a) {
+ D(a);
+ var b = bf(a),
+ c = a.L() & 31,
+ d = 0;
+ switch (a.f >> 3 & 7) {
+ case 0:
+ d = pg(a, b, c);
+ break;
+ case 1:
+ d = vg(a, b, c);
+ break;
+ case 2:
+ d = sg(a, b, c);
+ break;
+ case 3:
+ d = yg(a, b, c);
+ break;
+ case 4:
+ d = Bg(a, b, c);
+ break;
+ case 5:
+ d = Eg(a, b, c);
+ break;
+ case 6:
+ d = Bg(a, b, c);
+ break;
+ case 7:
+ d = Hg(a, b, c)
+ }
+ cf(a, d)
+};
+X[193] = function(a) {
+ D(a);
+ var b = Q(a),
+ c = a.L() & 31,
+ d = 0;
+ switch (a.f >> 3 & 7) {
+ case 0:
+ d = qg(a, b, c);
+ break;
+ case 1:
+ d = wg(a, b, c);
+ break;
+ case 2:
+ d = tg(a, b, c);
+ break;
+ case 3:
+ d = zg(a, b, c);
+ break;
+ case 4:
+ d = Cg(a, b, c);
+ break;
+ case 5:
+ d = Fg(a, b, c);
+ break;
+ case 6:
+ d = Cg(a, b, c);
+ break;
+ case 7:
+ d = Ig(a, b, c)
+ }
+ R(a, d)
+};
+Z[193] = function(a) {
+ D(a);
+ var b = df(a),
+ c = a.L() & 31,
+ d = 0;
+ switch (a.f >> 3 & 7) {
+ case 0:
+ d = rg(a, b, c);
+ break;
+ case 1:
+ d = xg(a, b, c);
+ break;
+ case 2:
+ d = ug(a, b, c);
+ break;
+ case 3:
+ d = Ag(a, b, c);
+ break;
+ case 4:
+ d = Dg(a, b, c);
+ break;
+ case 5:
+ d = Gg(a, b, c);
+ break;
+ case 6:
+ d = Dg(a, b, c);
+ break;
+ case 7:
+ d = Jg(a, b, c)
+ }
+ ef(a, d)
+};
+X[194] = function(a) {
+ var b = a.U();
+ a.A = C(a, 1) + nh(a) | 0;
+ me(a) || Fe(a);
+ Ee(a, b)
+};
+Z[194] = function(a) {
+ var b = a.U(),
+ c = oh(a);
+ a.A = C(a, 1) + c | 0;
+ Ee(a, b)
+};
+X[195] = function(a) {
+ a.A = C(a, 1) + nh(a) | 0
+};
+Z[195] = function(a) {
+ var b = oh(a);
+ a.A = C(a, 1) + b | 0
+};
+X[196] = function(a) {
+ D(a);
+ rh(a, 0)
+};
+Z[196] = function(a) {
+ D(a);
+ sh(a, 0)
+};
+X[197] = function(a) {
+ D(a);
+ rh(a, 3)
+};
+Z[197] = function(a) {
+ D(a);
+ sh(a, 3)
+};
+W[198] = function(a) {
+ D(a);
+ 192 > a.f ? re(a, F(a, a.f), a.L()) : a.D[a.f << 2 & 12 | a.f >> 2 & 1] = a.L()
+};
+X[199] = function(a) {
+ D(a);
+ 192 > a.f ? u(a, F(a, a.f), a.U()) : a.h[a.f << 1 & 14] = a.U()
+};
+Z[199] = function(a) {
+ D(a);
+ 192 > a.f ? w(a, F(a, a.f), a.ea()) : a.b[a.f & 7] = a.ea()
+};
+X[200] = function(a) {
+ var b = a.U(),
+ c = a.uh();
+ c &= 31;
+ I(a, a.h[10]);
+ var d = a.h[8];
+ if (0 < c) {
+ for (var e = a.h[5], f = 1; f < c; f++) e -= 2, I(a, x(a, C(a, 2) + e | 0));
+ I(a, d)
+ }
+ a.h[10] = d;
+ Ee(a, -b)
+};
+Z[200] = function(a) {
+ var b = a.U(),
+ c = a.uh();
+ c &= 31;
+ J(a, a.b[5]);
+ var d = a.b[4];
+ if (0 < c) {
+ for (var e = a.b[5], f = 1; f < c; f++) e -= 4, J(a, y(a, C(a, 2) + e | 0));
+ J(a, d)
+ }
+ a.b[5] = d;
+ Ee(a, -b)
+};
+X[201] = function(a) {
+ var b = a.qb ? a.b[5] : a.h[10],
+ c = x(a, C(a, 2) + b | 0);
+ De(a, b + 2 | 0);
+ a.h[10] = c
+};
+Z[201] = function(a) {
+ var b = a.qb ? a.b[5] : a.h[10],
+ c = y(a, C(a, 2) + b | 0);
+ De(a, b + 4 | 0);
+ a.b[5] = c
+};
+X[202] = function(a) {
+ var b = a.U(),
+ c = x(a, G(a, 0)),
+ d = x(a, G(a, 2));
+ Pe(a, c, d, b)
+};
+Z[202] = function(a) {
+ var b = a.U(),
+ c = y(a, G(a, 0)),
+ d = y(a, G(a, 4)) & 65535;
+ Pe(a, c, d, b);
+ me(a) || Fe(a)
+};
+X[203] = function(a) {
+ var b = x(a, G(a, 0)),
+ c = x(a, G(a, 2));
+ Pe(a, b, c, 0);
+ me(a) || Fe(a)
+};
+Z[203] = function(a) {
+ var b = y(a, G(a, 0)),
+ c = y(a, G(a, 4)) & 65535;
+ Pe(a, b, c, 0);
+ me(a) || Fe(a)
+};
+W[204] = function(a) {
+ Ge(a, 3, !0, !1)
+};
+W[205] = function(a) {
+ var b = a.L();
+ Ge(a, b, !0, !1)
+};
+W[206] = function(a) {
+ a.Te() && Ge(a, 4, !0, !1)
+};
+X[207] = function(a) {
+ Oe(a, !0)
+};
+Z[207] = function(a) {
+ Oe(a, !1)
+};
+W[208] = function(a) {
+ D(a);
+ var b = bf(a),
+ c = 0;
+ switch (a.f >> 3 & 7) {
+ case 0:
+ c = pg(a, b, 1);
+ break;
+ case 1:
+ c = vg(a, b, 1);
+ break;
+ case 2:
+ c = sg(a, b, 1);
+ break;
+ case 3:
+ c = yg(a, b, 1);
+ break;
+ case 4:
+ c = Bg(a, b, 1);
+ break;
+ case 5:
+ c = Eg(a, b, 1);
+ break;
+ case 6:
+ c = Bg(a, b, 1);
+ break;
+ case 7:
+ c = Hg(a, b, 1)
+ }
+ cf(a, c)
+};
+X[209] = function(a) {
+ D(a);
+ var b = Q(a),
+ c = 0;
+ switch (a.f >> 3 & 7) {
+ case 0:
+ c = qg(a, b, 1);
+ break;
+ case 1:
+ c = wg(a, b, 1);
+ break;
+ case 2:
+ c = tg(a, b, 1);
+ break;
+ case 3:
+ c = zg(a, b, 1);
+ break;
+ case 4:
+ c = Cg(a, b, 1);
+ break;
+ case 5:
+ c = Fg(a, b, 1);
+ break;
+ case 6:
+ c = Cg(a, b, 1);
+ break;
+ case 7:
+ c = Ig(a, b, 1)
+ }
+ R(a, c)
+};
+Z[209] = function(a) {
+ D(a);
+ var b = df(a),
+ c = 0;
+ switch (a.f >> 3 & 7) {
+ case 0:
+ c = rg(a, b, 1);
+ break;
+ case 1:
+ c = xg(a, b, 1);
+ break;
+ case 2:
+ c = ug(a, b, 1);
+ break;
+ case 3:
+ c = Ag(a, b, 1);
+ break;
+ case 4:
+ c = Dg(a, b, 1);
+ break;
+ case 5:
+ c = Gg(a, b, 1);
+ break;
+ case 6:
+ c = Dg(a, b, 1);
+ break;
+ case 7:
+ c = Jg(a, b, 1)
+ }
+ ef(a, c)
+};
+W[210] = function(a) {
+ D(a);
+ var b = bf(a),
+ c = a.D[4] & 31,
+ d = 0;
+ switch (a.f >> 3 & 7) {
+ case 0:
+ d = pg(a, b, c);
+ break;
+ case 1:
+ d = vg(a, b, c);
+ break;
+ case 2:
+ d = sg(a, b, c);
+ break;
+ case 3:
+ d = yg(a, b, c);
+ break;
+ case 4:
+ d = Bg(a, b, c);
+ break;
+ case 5:
+ d = Eg(a, b, c);
+ break;
+ case 6:
+ d = Bg(a, b, c);
+ break;
+ case 7:
+ d = Hg(a, b, c)
+ }
+ cf(a, d)
+};
+X[211] = function(a) {
+ D(a);
+ var b = Q(a),
+ c = a.D[4] & 31,
+ d = 0;
+ switch (a.f >> 3 & 7) {
+ case 0:
+ d = qg(a, b, c);
+ break;
+ case 1:
+ d = wg(a, b, c);
+ break;
+ case 2:
+ d = tg(a, b, c);
+ break;
+ case 3:
+ d = zg(a, b, c);
+ break;
+ case 4:
+ d = Cg(a, b, c);
+ break;
+ case 5:
+ d = Fg(a, b, c);
+ break;
+ case 6:
+ d = Cg(a, b, c);
+ break;
+ case 7:
+ d = Ig(a, b, c)
+ }
+ R(a, d)
+};
+Z[211] = function(a) {
+ D(a);
+ var b = df(a),
+ c = a.D[4] & 31,
+ d = 0;
+ switch (a.f >> 3 & 7) {
+ case 0:
+ d = rg(a, b, c);
+ break;
+ case 1:
+ d = xg(a, b, c);
+ break;
+ case 2:
+ d = ug(a, b, c);
+ break;
+ case 3:
+ d = Ag(a, b, c);
+ break;
+ case 4:
+ d = Dg(a, b, c);
+ break;
+ case 5:
+ d = Gg(a, b, c);
+ break;
+ case 6:
+ d = Dg(a, b, c);
+ break;
+ case 7:
+ d = Jg(a, b, c)
+ }
+ ef(a, d)
+};
+W[212] = function(a) {
+ var b = a.L();
+ if (0 === b) Re(a);
+ else {
+ var c = a.D[0];
+ a.D[1] = c / b;
+ a.D[0] = c % b;
+ a.F = a.D[0];
+ a.u = 196;
+ a.flags &= -2066
+ }
+};
+W[213] = function(a) {
+ var b = a.L();
+ b = a.D[0] + a.D[1] * b;
+ a.F = b & 255;
+ a.h[0] = a.F;
+ a.S = 7;
+ a.u = 196;
+ a.flags &= -2066;
+ 65535 < b && (a.flags |= 1)
+};
+W[214] = function(a) {
+ a.D[0] = -a.cb()
+};
+W[215] = function(a) {
+ a.D[0] = me(a) ? pe(a, we(a, 3) + a.b[3] + a.D[0] | 0) : pe(a, we(a, 3) + (a.h[6] + a.D[0] & 65535) | 0)
+};
+W[216] = function(a) {
+ D(a);
+ Te(a);
+ if (192 > a.f) {
+ var b = a.T,
+ c = a.f,
+ d = F(a, a.f);
+ a = c >> 3 & 7;
+ c = Mb(b, d);
+ d = wb(b);
+ switch (a) {
+ case 0:
+ b.I[b.B] = d + c;
+ break;
+ case 1:
+ b.I[b.B] = d * c;
+ break;
+ case 2:
+ ub(b, c);
+ break;
+ case 3:
+ ub(b, c);
+ b.pop();
+ break;
+ case 4:
+ b.I[b.B] = d - c;
+ break;
+ case 5:
+ b.I[b.B] = c - d;
+ break;
+ case 6:
+ b.I[b.B] = d / c;
+ break;
+ case 7:
+ b.I[b.B] = c / d
+ }
+ } else switch (b = a.T, c = a.f, a = c >> 3 & 7, c = Hb(b, c & 7), d = wb(b), a) {
+ case 0:
+ b.I[b.B] = d + c;
+ break;
+ case 1:
+ b.I[b.B] = d * c;
+ break;
+ case 2:
+ ub(b, c);
+ break;
+ case 3:
+ ub(b, c);
+ b.pop();
+ break;
+ case 4:
+ b.I[b.B] = d - c;
+ break;
+ case 5:
+ b.I[b.B] =
+ c - d;
+ break;
+ case 6:
+ b.I[b.B] = d / c;
+ break;
+ case 7:
+ b.I[b.B] = c / d
+ }
+};
+W[217] = function(a) {
+ D(a);
+ Te(a);
+ if (192 > a.f) {
+ var b = a.T,
+ c = a.f;
+ a = F(a, a.f);
+ switch (c >> 3 & 7) {
+ case 0:
+ a = Mb(b, a);
+ b.push(a);
+ break;
+ case 1:
+ sb(b);
+ break;
+ case 2:
+ c = wb(b);
+ b.m[0] = c;
+ w(b.j, a, b.v[0]);
+ break;
+ case 3:
+ c = wb(b);
+ b.m[0] = c;
+ w(b.j, a, b.v[0]);
+ b.pop();
+ break;
+ case 4:
+ Db(b, a);
+ break;
+ case 5:
+ b.ec = x(b.j, a);
+ break;
+ case 6:
+ Ab(b, a);
+ break;
+ case 7:
+ u(b.j, a, b.ec)
+ }
+ } else switch (b = a.T, c = a.f, a = c & 7, c >> 3 & 7) {
+ case 0:
+ c = Hb(b, a);
+ b.push(c);
+ break;
+ case 1:
+ c = Hb(b, a);
+ b.I[b.B + a & 7] = wb(b);
+ b.I[b.B] = c;
+ break;
+ case 2:
+ switch (a) {
+ case 0:
+ break;
+ default:
+ sb(b)
+ }
+ break;
+ case 3:
+ sb(b);
+ break;
+ case 4:
+ c = wb(b);
+ switch (a) {
+ case 0:
+ b.I[b.B] = -c;
+ break;
+ case 1:
+ b.I[b.B] = Math.abs(c);
+ break;
+ case 4:
+ a = c;
+ b.a &= -18177;
+ isNaN(a) ? b.a |= 17664 : 0 === a ? b.a |= 16384 : 0 > a && (b.a |= 256);
+ break;
+ case 5:
+ a = c;
+ b.a &= -18177;
+ b.a |= b.sign(0) << 9;
+ b.a = b.fa >> b.B & 1 ? b.a | 16640 : isNaN(a) ? b.a | 256 : 0 === a ? b.a | 16384 : Infinity === a || -Infinity === a ? b.a | 1280 : b.a | 1024;
+ break;
+ default:
+ sb(b)
+ }
+ break;
+ case 5:
+ b.push(b.J[a]);
+ break;
+ case 6:
+ c = wb(b);
+ switch (a) {
+ case 0:
+ b.I[b.B] = Math.pow(2, c) - 1;
+ break;
+ case 1:
+ b.I[b.B + 1 & 7] = Hb(b, 1) * Math.log(c) / Math.LN2;
+ b.pop();
+ break;
+ case 2:
+ b.I[b.B] = Math.tan(c);
+ b.push(1);
+ break;
+ case 3:
+ b.I[b.B + 1 & 7] = Math.atan2(Hb(b, 1), c);
+ b.pop();
+ break;
+ case 4:
+ b.l[0] = wb(b);
+ a = ((b.g[7] & 127) << 4 | b.g[6] >> 4) - 1023;
+ b.g[7] = 63 | b.g[7] & 128;
+ b.g[6] |= 240;
+ b.I[b.B] = a;
+ b.push(b.l[0]);
+ break;
+ case 5:
+ b.I[b.B] = c % Hb(b, 1);
+ break;
+ case 6:
+ b.B = b.B - 1 & 7;
+ b.a &= -513;
+ break;
+ case 7:
+ b.B = b.B + 1 & 7, b.a &= -513
+ }
+ break;
+ case 7:
+ switch (c = wb(b), a) {
+ case 0:
+ a = Hb(b, 1);
+ var d = Math.trunc(c / a);
+ b.I[b.B] = c % a;
+ b.a &= -17153;
+ d & 1 && (b.a |= 512);
+ d & 2 && (b.a |= 16384);
+ d & 4 && (b.a |= 256);
+ b.a &= -1025;
+ break;
+ case 1:
+ b.I[b.B + 1 &
+ 7] = Hb(b, 1) * Math.log(c + 1) / Math.LN2;
+ b.pop();
+ break;
+ case 2:
+ b.I[b.B] = Math.sqrt(c);
+ break;
+ case 3:
+ b.I[b.B] = Math.sin(c);
+ b.push(Math.cos(c));
+ break;
+ case 4:
+ b.I[b.B] = Eb(b, c);
+ break;
+ case 5:
+ b.I[b.B] = c * Math.pow(2, Gb(Hb(b, 1)));
+ break;
+ case 6:
+ b.I[b.B] = Math.sin(c);
+ break;
+ case 7:
+ b.I[b.B] = Math.cos(c)
+ }
+ }
+};
+W[218] = function(a) {
+ D(a);
+ Te(a);
+ if (192 > a.f) {
+ var b = a.T,
+ c = a.f,
+ d = F(a, a.f);
+ a = c >> 3 & 7;
+ c = y(b.j, d);
+ d = wb(b);
+ switch (a) {
+ case 0:
+ b.I[b.B] = d + c;
+ break;
+ case 1:
+ b.I[b.B] = d * c;
+ break;
+ case 2:
+ ub(b, c);
+ break;
+ case 3:
+ ub(b, c);
+ b.pop();
+ break;
+ case 4:
+ b.I[b.B] = d - c;
+ break;
+ case 5:
+ b.I[b.B] = c - d;
+ break;
+ case 6:
+ b.I[b.B] = d / c;
+ break;
+ case 7:
+ b.I[b.B] = c / d
+ }
+ } else switch (b = a.T, a = a.f, c = a & 7, a >> 3 & 7) {
+ case 0:
+ b.j.yb() && (b.I[b.B] = Hb(b, c), b.fa &= ~(1 << b.B));
+ break;
+ case 1:
+ b.j.Ab() && (b.I[b.B] = Hb(b, c), b.fa &= ~(1 << b.B));
+ break;
+ case 2:
+ kh(b.j) && (b.I[b.B] = Hb(b, c), b.fa &=
+ ~(1 << b.B));
+ break;
+ case 3:
+ b.j.zb() && (b.I[b.B] = Hb(b, c), b.fa &= ~(1 << b.B));
+ break;
+ case 5:
+ 1 === c ? (a = Hb(b, 1), ub(b, a), b.pop(), b.pop()) : sb(b);
+ break;
+ default:
+ sb(b)
+ }
+};
+W[219] = function(a) {
+ D(a);
+ Te(a);
+ if (192 > a.f) {
+ var b = a.T,
+ c = a.f;
+ a = F(a, a.f);
+ switch (c >> 3 & 7) {
+ case 0:
+ a = y(b.j, a);
+ b.push(a);
+ break;
+ case 2:
+ c = Eb(b, wb(b));
+ 2147483647 >= c && -2147483648 <= c ? w(b.j, a, c) : (tb(b), w(b.j, a, -2147483648));
+ break;
+ case 3:
+ c = Eb(b, wb(b));
+ 2147483647 >= c && -2147483648 <= c ? w(b.j, a, c) : (tb(b), w(b.j, a, -2147483648));
+ b.pop();
+ break;
+ case 5:
+ b.push(Ib(b, a));
+ break;
+ case 7:
+ Cb(b.j, a, 10);
+ Jb(b, a, wb(b));
+ b.pop();
+ break;
+ default:
+ sb(b)
+ }
+ } else switch (b = a.T, a = a.f, c = a & 7, a >> 3 & 7) {
+ case 0:
+ b.j.yb() || (b.I[b.B] = Hb(b, c), b.fa &= ~(1 << b.B));
+ break;
+ case 1:
+ b.j.Ab() || (b.I[b.B] = Hb(b, c), b.fa &= ~(1 << b.B));
+ break;
+ case 2:
+ kh(b.j) || (b.I[b.B] = Hb(b, c), b.fa &= ~(1 << b.B));
+ break;
+ case 3:
+ b.j.zb() || (b.I[b.B] = Hb(b, c), b.fa &= ~(1 << b.B));
+ break;
+ case 4:
+ 227 === a ? yb(b) : 228 !== a && 225 !== a && (226 === a ? b.a = 0 : sb(b));
+ break;
+ case 5:
+ a = Hb(b, c);
+ xb(b, a);
+ break;
+ case 6:
+ xb(b, Hb(b, c));
+ break;
+ default:
+ sb(b)
+ }
+};
+W[220] = function(a) {
+ D(a);
+ Te(a);
+ if (192 > a.f) {
+ var b = a.T,
+ c = a.f,
+ d = F(a, a.f);
+ a = c >> 3 & 7;
+ c = Kb(b, d);
+ d = wb(b);
+ switch (a) {
+ case 0:
+ b.I[b.B] = d + c;
+ break;
+ case 1:
+ b.I[b.B] = d * c;
+ break;
+ case 2:
+ ub(b, c);
+ break;
+ case 3:
+ ub(b, c);
+ b.pop();
+ break;
+ case 4:
+ b.I[b.B] = d - c;
+ break;
+ case 5:
+ b.I[b.B] = c - d;
+ break;
+ case 6:
+ b.I[b.B] = d / c;
+ break;
+ case 7:
+ b.I[b.B] = c / d
+ }
+ } else {
+ b = a.T;
+ c = a.f;
+ a = c >> 3 & 7;
+ d = c & 7;
+ c = b.B + d & 7;
+ d = Hb(b, d);
+ var e = wb(b);
+ switch (a) {
+ case 0:
+ b.I[c] = d + e;
+ break;
+ case 1:
+ b.I[c] = d * e;
+ break;
+ case 2:
+ ub(b, d);
+ break;
+ case 3:
+ ub(b, d);
+ b.pop();
+ break;
+ case 4:
+ b.I[c] = e - d;
+ break;
+ case 5:
+ b.I[c] = d - e;
+ break;
+ case 6:
+ b.I[c] = e / d;
+ break;
+ case 7:
+ b.I[c] = d / e
+ }
+ }
+};
+W[221] = function(a) {
+ D(a);
+ Te(a);
+ if (192 > a.f) {
+ var b = a.T,
+ c = a.f;
+ a = F(a, a.f);
+ switch (c >> 3 & 7) {
+ case 0:
+ a = Kb(b, a);
+ b.push(a);
+ break;
+ case 1:
+ sb(b);
+ break;
+ case 2:
+ Lb(b, a);
+ break;
+ case 3:
+ Lb(b, a);
+ b.pop();
+ break;
+ case 4:
+ Db(b, a);
+ a += 28;
+ for (c = 0; 8 > c; c++) b.I[c + b.B & 7] = Ib(b, a), a += 10;
+ break;
+ case 5:
+ sb(b);
+ break;
+ case 6:
+ Cb(b.j, a, 108);
+ Ab(b, a);
+ a += 28;
+ for (c = 0; 8 > c; c++) Jb(b, a, b.I[b.B + c & 7]), a += 10;
+ yb(b);
+ break;
+ case 7:
+ u(b.j, a, zb(b))
+ }
+ } else switch (b = a.T, a = a.f, c = a & 7, a >> 3 & 7) {
+ case 0:
+ b.fa |= 1 << (b.B + c & 7);
+ break;
+ case 2:
+ b.I[b.B + c & 7] = wb(b);
+ break;
+ case 3:
+ 0 !==
+ c && (b.I[b.B + c & 7] = wb(b));
+ b.pop();
+ break;
+ case 4:
+ a = Hb(b, c);
+ ub(b, a);
+ break;
+ case 5:
+ a = Hb(b, c);
+ ub(b, a);
+ b.pop();
+ break;
+ default:
+ sb(b)
+ }
+};
+W[222] = function(a) {
+ D(a);
+ Te(a);
+ if (192 > a.f) {
+ var b = a.T,
+ c = a.f,
+ d = F(a, a.f);
+ a = c >> 3 & 7;
+ c = x(b.j, d) << 16 >> 16;
+ d = wb(b);
+ switch (a) {
+ case 0:
+ b.I[b.B] = d + c;
+ break;
+ case 1:
+ b.I[b.B] = d * c;
+ break;
+ case 2:
+ ub(b, c);
+ break;
+ case 3:
+ ub(b, c);
+ b.pop();
+ break;
+ case 4:
+ b.I[b.B] = d - c;
+ break;
+ case 5:
+ b.I[b.B] = c - d;
+ break;
+ case 6:
+ b.I[b.B] = d / c;
+ break;
+ case 7:
+ b.I[b.B] = c / d
+ }
+ } else {
+ b = a.T;
+ c = a.f;
+ a = c >> 3 & 7;
+ c &= 7;
+ d = b.B + c & 7;
+ var e = Hb(b, c),
+ f = wb(b);
+ switch (a) {
+ case 0:
+ b.I[d] = e + f;
+ break;
+ case 1:
+ b.I[d] = e * f;
+ break;
+ case 2:
+ ub(b, e);
+ break;
+ case 3:
+ 1 === c ? (ub(b, b.I[d]), b.pop()) : sb(b);
+ break;
+ case 4:
+ b.I[d] = f - e;
+ break;
+ case 5:
+ b.I[d] = e - f;
+ break;
+ case 6:
+ b.I[d] = f / e;
+ break;
+ case 7:
+ b.I[d] = e / f
+ }
+ b.pop()
+ }
+};
+W[223] = function(a) {
+ D(a);
+ Te(a);
+ if (192 > a.f) {
+ var b = a.T,
+ c = a.f;
+ a = F(a, a.f);
+ switch (c >> 3 & 7) {
+ case 0:
+ a = x(b.j, a) << 16 >> 16;
+ b.push(a);
+ break;
+ case 1:
+ sb(b);
+ break;
+ case 2:
+ c = Eb(b, wb(b));
+ 32767 >= c && -32768 <= c ? u(b.j, a, c) : (tb(b), u(b.j, a, 32768));
+ break;
+ case 3:
+ c = Eb(b, wb(b));
+ 32767 >= c && -32768 <= c ? u(b.j, a, c) : (tb(b), u(b.j, a, 32768));
+ b.pop();
+ break;
+ case 4:
+ sb(b);
+ break;
+ case 5:
+ c = y(b.j, a) >>> 0;
+ a = y(b.j, a + 4);
+ b.push(c + 4294967296 * a);
+ break;
+ case 6:
+ sb(b);
+ break;
+ case 7:
+ Cb(b.j, a, 8);
+ c = Eb(b, wb(b));
+ if (0x7fffffffffffffff > c && -9223372036854775808 <= c) {
+ var d =
+ c | 0;
+ var e = c / 4294967296 | 0;
+ 0 === e && 0 > c && (e = -1)
+ } else d = 0, e = -2147483648, tb(b);
+ w(b.j, a, d);
+ w(b.j, a + 4, e);
+ b.pop()
+ }
+ } else switch (b = a.T, a = a.f, c = a & 7, a >> 3 & 7) {
+ case 4:
+ 224 === a ? b.j.h[0] = zb(b) : sb(b);
+ break;
+ case 5:
+ a = Hb(b, c);
+ xb(b, a);
+ b.pop();
+ break;
+ case 6:
+ xb(b, Hb(b, c));
+ b.pop();
+ break;
+ default:
+ sb(b)
+ }
+};
+W[224] = function(a) {
+ var b = a.wa();
+ Af(a) && !a.Ac() && (a.A = a.A + b | 0)
+};
+W[225] = function(a) {
+ var b = a.wa();
+ Af(a) && a.Ac() && (a.A = a.A + b | 0)
+};
+W[226] = function(a) {
+ a.loop(a.wa())
+};
+W[227] = function(a) {
+ var b = a.wa();
+ 0 === U(a, 1) && (a.A = a.A + b | 0)
+};
+W[228] = function(a) {
+ var b = a.L();
+ uf(a, b, 1);
+ a.D[0] = Va(a.o, b)
+};
+X[229] = function(a) {
+ var b = a.L();
+ uf(a, b, 2);
+ a.h[0] = Wa(a.o, b)
+};
+Z[229] = function(a) {
+ var b = a.L();
+ uf(a, b, 4);
+ a.b[0] = Xa(a.o, b)
+};
+W[230] = function(a) {
+ var b = a.L();
+ uf(a, b, 1);
+ Sa(a.o, b, a.D[0])
+};
+X[231] = function(a) {
+ var b = a.L();
+ uf(a, b, 2);
+ Ta(a.o, b, a.h[0])
+};
+Z[231] = function(a) {
+ var b = a.L();
+ uf(a, b, 4);
+ Ua(a.o, b, a.b[0])
+};
+X[232] = function(a) {
+ var b = a.U();
+ I(a, Fe(a));
+ eh(a, b)
+};
+Z[232] = function(a) {
+ var b = a.ea();
+ J(a, Fe(a));
+ a.A = a.A + b | 0;
+ me(a) || Fe(a)
+};
+X[233] = function(a) {
+ var b = a.U();
+ eh(a, b)
+};
+Z[233] = function(a) {
+ var b = a.ea();
+ a.A = a.A + b | 0;
+ me(a) || Fe(a)
+};
+X[234] = function(a) {
+ var b = a.U(),
+ c = a.Ib();
+ Qe(a, b, c, !1);
+ me(a) || Fe(a)
+};
+Z[234] = function(a) {
+ var b = a.ea(),
+ c = a.Ib();
+ Qe(a, b, c, !1);
+ me(a) || Fe(a)
+};
+W[235] = function(a) {
+ var b = a.wa();
+ a.A = a.A + b | 0;
+ me(a) || Fe(a)
+};
+W[236] = function(a) {
+ var b = a.h[4];
+ uf(a, b, 1);
+ a.D[0] = Va(a.o, b)
+};
+X[237] = function(a) {
+ var b = a.h[4];
+ uf(a, b, 2);
+ a.h[0] = Wa(a.o, b)
+};
+Z[237] = function(a) {
+ var b = a.h[4];
+ uf(a, b, 4);
+ a.b[0] = Xa(a.o, b)
+};
+W[238] = function(a) {
+ var b = a.h[4];
+ uf(a, b, 1);
+ Sa(a.o, b, a.D[0])
+};
+X[239] = function(a) {
+ var b = a.h[4];
+ uf(a, b, 2);
+ Ta(a.o, b, a.h[0])
+};
+Z[239] = function(a) {
+ var b = a.h[4];
+ uf(a, b, 4);
+ Ua(a.o, b, a.b[0])
+};
+W[240] = function(a) {
+ ge(a)
+};
+W[241] = function(a) {
+ throw a.debug.P("int1 instruction");
+};
+W[242] = function(a) {
+ a.H |= 16;
+ ge(a);
+ a.H = 0
+};
+W[243] = function(a) {
+ a.H |= 8;
+ ge(a);
+ a.H = 0
+};
+W[244] = function(a) {
+ a.N && H(a, 0);
+ if (0 === (a.flags & 512)) throw a.debug.show("cpu halted"), a.w.send("cpu-event-halt"), "HALT";
+ a.Tc = !0;
+ throw 233495534;
+};
+W[245] = function(a) {
+ a.flags = (a.flags | 1) ^ a.cb();
+ a.u &= -2
+};
+W[246] = function(a) {
+ D(a);
+ switch (a.f >> 3 & 7) {
+ case 0:
+ var b = Ue(a),
+ c = a.L();
+ a.and(b, c, 7);
+ break;
+ case 1:
+ b = Ue(a);
+ c = a.L();
+ a.and(b, c, 7);
+ break;
+ case 2:
+ b = bf(a);
+ cf(a, ~b);
+ break;
+ case 3:
+ b = bf(a);
+ cf(a, ag(a, b, 7));
+ break;
+ case 4:
+ b = Ue(a);
+ b *= a.D[0];
+ a.h[0] = b;
+ a.F = b & 255;
+ a.S = 7;
+ a.flags = 256 > b ? a.flags & -2050 : a.flags | 2049;
+ a.u = 212;
+ break;
+ case 5:
+ b = Ue(a) << 24 >> 24;
+ b *= a.sg[0];
+ a.h[0] = b;
+ a.F = b & 255;
+ a.S = 7;
+ a.flags = 127 < b || -128 > b ? a.flags | 2049 : a.flags & -2050;
+ a.u = 212;
+ break;
+ case 6:
+ b = Ue(a);
+ if (0 === b) Re(a);
+ else {
+ c = a.h[0];
+ var d = c / b | 0;
+ 256 <= d ? Re(a) : (a.D[0] = d,
+ a.D[1] = c % b)
+ }
+ break;
+ case 7:
+ b = Ue(a) << 24 >> 24, 0 === b ? Re(a) : (c = a.se[0], d = c / b | 0, 128 <= d || -129 >= d ? Re(a) : (a.D[0] = d, a.D[1] = c % b))
+ }
+};
+X[247] = function(a) {
+ D(a);
+ switch (a.f >> 3 & 7) {
+ case 0:
+ var b = O(a),
+ c = a.U();
+ a.and(b, c, 15);
+ break;
+ case 1:
+ b = O(a);
+ c = a.U();
+ a.and(b, c, 15);
+ break;
+ case 2:
+ b = Q(a);
+ R(a, ~b);
+ break;
+ case 3:
+ b = Q(a);
+ R(a, ag(a, b, 15));
+ break;
+ case 4:
+ b = O(a);
+ b *= a.h[0];
+ c = b >>> 16;
+ a.h[0] = b;
+ a.h[4] = c;
+ a.F = b & 65535;
+ a.S = 15;
+ a.flags = 0 === c ? a.flags & -2050 : a.flags | 2049;
+ a.u = 212;
+ break;
+ case 5:
+ b = O(a) << 16 >> 16;
+ b *= a.se[0];
+ a.h[0] = b;
+ a.h[4] = b >> 16;
+ a.F = b & 65535;
+ a.S = 15;
+ a.flags = 32767 < b || -32768 > b ? a.flags | 2049 : a.flags & -2050;
+ a.u = 212;
+ break;
+ case 6:
+ b = O(a);
+ if (0 === b) Re(a);
+ else {
+ c = (a.h[0] |
+ a.h[4] << 16) >>> 0;
+ var d = c / b | 0;
+ 65536 <= d || 0 > d ? Re(a) : (a.h[0] = d, a.h[4] = c % b)
+ }
+ break;
+ case 7:
+ b = O(a) << 16 >> 16, 0 === b ? Re(a) : (c = a.h[0] | a.h[4] << 16, d = c / b | 0, 32768 <= d || -32769 >= d ? Re(a) : (a.h[0] = d, a.h[4] = c % b))
+ }
+};
+Z[247] = function(a) {
+ D(a);
+ switch (a.f >> 3 & 7) {
+ case 0:
+ var b = Ve(a),
+ c = a.ea();
+ a.and(b, c, 31);
+ break;
+ case 1:
+ b = Ve(a);
+ c = a.ea();
+ a.and(b, c, 31);
+ break;
+ case 2:
+ b = df(a);
+ ef(a, ~b);
+ break;
+ case 3:
+ b = df(a);
+ ef(a, ag(a, b, 31));
+ break;
+ case 4:
+ b = Ve(a) >>> 0;
+ b = cg(a, a.b[0], b);
+ a.b[0] = b[0];
+ a.b[2] = b[1];
+ a.F = b[0];
+ a.S = 31;
+ a.flags = 0 === b[1] ? a.flags & -2050 : a.flags | 2049;
+ a.u = 212;
+ break;
+ case 5:
+ b = Ve(a);
+ b = dg(a, a.b[0], b);
+ a.b[0] = b[0];
+ a.b[2] = b[1];
+ a.F = b[0];
+ a.S = 31;
+ a.flags = b[1] === b[0] >> 31 ? a.flags & -2050 : a.flags | 2049;
+ a.u = 212;
+ break;
+ case 6:
+ b = Ve(a) >>> 0;
+ c = fg(a, a.Fd[0],
+ a.Fd[2], b);
+ b = c[0];
+ c = c[1];
+ 4294967296 <= b ? Re(a) : (a.b[0] = b, a.b[2] = c);
+ break;
+ case 7:
+ var d = b = Ve(a),
+ e = a.Fd[0],
+ f = a.b[2];
+ c = b = !1;
+ 0 > d && (c = !0, d = -d);
+ 0 > f && (b = !0, c = !c, e = -e >>> 0, f = ~f + !e);
+ e = fg(a, e, f, d);
+ d = e[0];
+ e = e[1];
+ c && (d = -d | 0);
+ b && (e = -e | 0);
+ 2147483648 <= d || -2147483649 >= d ? Re(a) : (a.b[0] = d, a.b[2] = e)
+ }
+};
+W[248] = function(a) {
+ a.flags &= -2;
+ a.u &= -2
+};
+W[249] = function(a) {
+ a.flags |= 1;
+ a.u &= -2
+};
+W[250] = function(a) {
+ !a.ta || (a.flags & 131072 ? 3 === xe(a) : xe(a) >= a.N) ? a.flags &= -513 : H(a, 0)
+};
+W[251] = function(a) {
+ !a.ta || (a.flags & 131072 ? 3 === xe(a) : xe(a) >= a.N) ? (a.flags |= 512, a.H = 0, ee(a), ab(a)) : H(a, 0)
+};
+W[252] = function(a) {
+ a.flags &= -1025
+};
+W[253] = function(a) {
+ a.flags |= 1024
+};
+W[254] = function(a) {
+ D(a);
+ var b = a.f & 56;
+ 0 === b ? (b = bf(a), cf(a, Zf(a, b, 7))) : 8 === b ? (b = bf(a), cf(a, $f(a, b, 7))) : t(a)
+};
+X[255] = function(a) {
+ D(a);
+ switch (a.f >> 3 & 7) {
+ case 0:
+ var b = Q(a);
+ R(a, Zf(a, b, 15));
+ break;
+ case 1:
+ b = Q(a);
+ R(a, $f(a, b, 15));
+ break;
+ case 2:
+ b = O(a);
+ I(a, Fe(a));
+ a.A = C(a, 1) + b | 0;
+ me(a) || Fe(a);
+ break;
+ case 3:
+ 192 <= a.f && t(a);
+ var c = F(a, a.f);
+ b = x(a, c);
+ c = x(a, c + 2 | 0);
+ Qe(a, b, c, !0);
+ me(a) || Fe(a);
+ break;
+ case 4:
+ b = O(a);
+ a.A = C(a, 1) + b | 0;
+ me(a) || Fe(a);
+ break;
+ case 5:
+ 192 <= a.f && t(a);
+ c = F(a, a.f);
+ b = x(a, c);
+ c = x(a, c + 2 | 0);
+ Qe(a, b, c, !1);
+ me(a) || Fe(a);
+ break;
+ case 6:
+ b = O(a);
+ I(a, b);
+ break;
+ case 7:
+ t(a)
+ }
+};
+Z[255] = function(a) {
+ D(a);
+ switch (a.f >> 3 & 7) {
+ case 0:
+ var b = df(a);
+ ef(a, Zf(a, b, 31));
+ break;
+ case 1:
+ b = df(a);
+ ef(a, $f(a, b, 31));
+ break;
+ case 2:
+ b = Ve(a);
+ J(a, Fe(a));
+ a.A = C(a, 1) + b | 0;
+ break;
+ case 3:
+ 192 <= a.f && t(a);
+ var c = F(a, a.f);
+ b = y(a, c);
+ c = x(a, c + 4 | 0);
+ if ((!a.ta || ye(a)) && b & 4294901760) throw a.debug.P("#GP handler");
+ Qe(a, b, c, !0);
+ break;
+ case 4:
+ b = Ve(a);
+ a.A = C(a, 1) + b | 0;
+ break;
+ case 5:
+ 192 <= a.f && t(a);
+ c = F(a, a.f);
+ b = y(a, c);
+ c = x(a, c + 4 | 0);
+ if ((!a.ta || ye(a)) && b & 4294901760) throw a.debug.P("#GP handler");
+ Qe(a, b, c, !1);
+ break;
+ case 6:
+ b = Ve(a);
+ J(a,
+ b);
+ break;
+ case 7:
+ t(a)
+ }
+};
+var uh = [],
+ vh = [];
+q.prototype.Ya = uh;
+q.prototype.Za = vh;
+for (var wh = 0; 256 > wh; wh++) W[wh] ? uh[wh] = vh[wh] = W[wh] : X[wh] && (uh[wh] = X[wh], vh[wh] = Z[wh]);
+W = [];
+X = [];
+Z = [];
+W[0] = function(a) {
+ D(a);
+ a.ta && !ye(a) || t(a);
+ switch (a.f >> 3 & 7) {
+ case 0:
+ $e(a, a.M[7]);
+ Bb(a) && 192 <= a.f && (a.b[a.f & 7] &= 65535);
+ break;
+ case 1:
+ $e(a, a.M[6]);
+ Bb(a) && 192 <= a.f && (a.b[a.f & 7] &= 65535);
+ break;
+ case 2:
+ a.N && H(a, 0);
+ var b = O(a);
+ Je(a, b);
+ break;
+ case 3:
+ a.N && H(a, 0);
+ b = O(a);
+ var c = Ie(a, b);
+ if (!c.hg) throw a.debug.P("TR can only be loaded from GDT");
+ if (c.Ta) throw a.debug.P("#GP handler");
+ if (!c.Fb) throw a.debug.P("#GP handler (happens when running kvm-unit-test without ACPI)");
+ if (9 !== c.type && 1 !== c.type) throw a.debug.P("#GP handler");
+ if (!c.ib) throw a.debug.P("#NT handler");
+ a.Md = 9 === c.type;
+ a.xa[6] = c.gb;
+ a.La[6] = c.Db;
+ a.M[6] = b;
+ a.za(c.gf + 5 | 0, a.ja(c.gf + 5 | 0) | 2);
+ break;
+ case 4:
+ b = O(a);
+ b = Ie(a, b);
+ a.u &= -65;
+ a.flags = b.Ta || !b.Gb || b.Fb || !b.mg || !b.We && (b.$ < a.N || b.$ < b.Ba) ? a.flags & -65 : a.flags | 64;
+ break;
+ case 5:
+ b = O(a);
+ b = Ie(a, b);
+ a.u &= -65;
+ a.flags = b.Ta || !b.Gb || b.Fb || !b.Bf || b.$ < a.N || b.$ < b.Ba ? a.flags & -65 : a.flags | 64;
+ break;
+ default:
+ t(a)
+ }
+};
+W[1] = function(a) {
+ D(a);
+ var b = a.f >> 3 & 7;
+ if (4 === b) 192 <= a.f && Bb(a) ? af(a, a.K[0]) : $e(a, a.K[0]);
+ else if (6 === b) {
+ a.N && H(a, 0);
+ var c = O(a);
+ c = a.K[0] & -16 | c & 15;
+ a.ta && (c |= 1);
+ he(a, c)
+ } else switch (192 <= a.f && t(a), c = F(a, a.f), b) {
+ case 0:
+ Cb(a, c, 6);
+ u(a, c, a.ie);
+ b = Bb(a) ? -1 : 16777215;
+ w(a, c + 2, a.Qc & b);
+ break;
+ case 1:
+ Cb(a, c, 6);
+ u(a, c, a.je);
+ b = Bb(a) ? -1 : 16777215;
+ w(a, c + 2, a.Rc & b);
+ break;
+ case 2:
+ a.N && H(a, 0);
+ b = x(a, c);
+ c = y(a, c + 2);
+ a.ie = b;
+ a.Qc = c;
+ Bb(a) || (a.Qc &= 16777215);
+ break;
+ case 3:
+ a.N && H(a, 0);
+ b = x(a, c);
+ c = y(a, c + 2);
+ a.je = b;
+ a.Rc = c;
+ Bb(a) || (a.Rc &= 16777215);
+ break;
+ case 7:
+ a.N && H(a, 0);
+ c >>>= 12;
+ a.oc[c] = 0;
+ a.jf[c] = 0;
+ a.jc = -1;
+ a.me = -1;
+ break;
+ default:
+ t(a)
+ }
+};
+X[2] = function(a) {
+ D(a);
+ a.ta && !ye(a) || t(a);
+ var b = O(a); of (a, vf(a, b, mf(a)))
+};
+Z[2] = function(a) {
+ D(a);
+ a.ta && !ye(a) || t(a);
+ var b = O(a);
+ pf(a, vf(a, b, S(a)))
+};
+X[3] = function(a) {
+ D(a);
+ a.ta && !ye(a) || t(a);
+ var b = O(a); of (a, wf(a, b, mf(a)))
+};
+Z[3] = function(a) {
+ D(a);
+ a.ta && !ye(a) || t(a);
+ var b = O(a);
+ pf(a, wf(a, b, S(a)))
+};
+W[4] = function(a) {
+ t(a)
+};
+W[5] = function(a) {
+ t(a)
+};
+W[6] = function(a) {
+ a.N ? H(a, 0) : a.K[0] &= -9
+};
+W[7] = function(a) {
+ t(a)
+};
+W[8] = function(a) {
+ t(a)
+};
+W[9] = function(a) {
+ a.N && H(a, 0)
+};
+W[10] = function(a) {
+ t(a)
+};
+W[11] = function(a) {
+ t(a)
+};
+W[12] = function(a) {
+ t(a)
+};
+W[13] = function(a) {
+ t(a)
+};
+W[14] = function(a) {
+ t(a)
+};
+W[15] = function(a) {
+ t(a)
+};
+W[16] = function(a) {
+ t(a)
+};
+W[17] = function(a) {
+ t(a)
+};
+W[18] = function(a) {
+ K(a);
+ D(a);
+ var b = Xe(a),
+ c = b[1],
+ d = (a.f >> 3 & 7) << 2;
+ a.na[d] = b[0];
+ a.na[d + 1] = c
+};
+W[19] = function(a) {
+ K(a);
+ D(a);
+ var b = qf(a),
+ c = F(a, a.f);
+ te(a, c, b[0], b[1])
+};
+W[20] = function(a) {
+ t(a)
+};
+W[21] = function(a) {
+ t(a)
+};
+W[22] = function(a) {
+ t(a)
+};
+W[23] = function(a) {
+ t(a)
+};
+W[24] = function(a) {
+ D(a);
+ 192 > a.f && F(a, a.f)
+};
+W[25] = function(a) {
+ t(a)
+};
+W[26] = function(a) {
+ t(a)
+};
+W[27] = function(a) {
+ t(a)
+};
+W[28] = function(a) {
+ t(a)
+};
+W[29] = function(a) {
+ t(a)
+};
+W[30] = function(a) {
+ t(a)
+};
+W[31] = function(a) {
+ D(a);
+ 192 > a.f && F(a, a.f)
+};
+W[32] = function(a) {
+ D(a);
+ a.N && H(a, 0);
+ switch (a.f >> 3 & 7) {
+ case 0:
+ jf(a, a.K[0]);
+ break;
+ case 2:
+ jf(a, a.K[2]);
+ break;
+ case 3:
+ jf(a, a.K[3]);
+ break;
+ case 4:
+ jf(a, a.K[4]);
+ break;
+ default:
+ t(a)
+ }
+};
+W[33] = function(a) {
+ D(a);
+ a.N && H(a, 0);
+ var b = a.f >> 3 & 7;
+ a.K[4] & 8 && (4 === b || 5 === b) && t(a);
+ a.b[a.f & 7] = a.md[b]
+};
+W[34] = function(a) {
+ D(a);
+ a.N && H(a, 0);
+ var b = hf(a);
+ switch (a.f >> 3 & 7) {
+ case 0:
+ he(a, b);
+ break;
+ case 2:
+ a.K[2] = b;
+ break;
+ case 3:
+ a.K[3] = b & -4072;
+ Ke(a);
+ break;
+ case 4:
+ b & -3565568 && H(a, 0);
+ (a.K[4] ^ b) & 128 && (b & 128 ? Ke(a) : Yd(a));
+ a.K[4] = b;
+ a.af = b & 16 ? 128 : 0;
+ if (b & 32) throw a.debug.P("PAE");
+ b & 4294965504 && t(a);
+ break;
+ default:
+ t(a)
+ }
+};
+W[35] = function(a) {
+ D(a);
+ a.N && H(a, 0);
+ var b = a.f >> 3 & 7;
+ a.K[4] & 8 && (4 === b || 5 === b) && t(a);
+ a.md[b] = hf(a)
+};
+W[36] = function(a) {
+ t(a)
+};
+W[37] = function(a) {
+ t(a)
+};
+W[38] = function(a) {
+ t(a)
+};
+W[39] = function(a) {
+ t(a)
+};
+W[40] = function(a) {
+ K(a);
+ D(a);
+ var b = Ye(a);
+ tf(a, b[0], b[1], b[2], b[3])
+};
+W[41] = function(a) {
+ K(a);
+ D(a);
+ if (32 === (a.H & 56)) {
+ var b = rf(a),
+ c = F(a, a.f);
+ ue(a, c, b[0], b[1], b[2], b[3])
+ } else b = rf(a), c = F(a, a.f), ue(a, c, b[0], b[1], b[2], b[3])
+};
+W[42] = function(a) {
+ t(a)
+};
+W[43] = function(a) {
+ t(a)
+};
+W[44] = function(a) {
+ t(a)
+};
+W[45] = function(a) {
+ t(a)
+};
+W[46] = function(a) {
+ t(a)
+};
+W[47] = function(a) {
+ t(a)
+};
+W[48] = function(a) {
+ a.N && H(a, 0);
+ var b = a.b[0],
+ c = a.b[2];
+ switch (a.b[1]) {
+ case 372:
+ a.Kd = b & 65535;
+ break;
+ case 374:
+ a.xe = b;
+ break;
+ case 373:
+ a.ye = b;
+ break;
+ case 27:
+ a.Oh = 2048 === (b & 2048);
+ break;
+ case 16:
+ b = (b >>> 0) + 4294967296 * (c >>> 0), a.kf = $a() - b / 8192
+ }
+};
+W[49] = function(a) {
+ if (a.N && a.K[4] & 4) H(a, 0);
+ else {
+ var b = $a() - a.kf;
+ a.b[0] = 8192 * b;
+ a.b[2] = 1.9073486328125E-6 * b
+ }
+};
+W[50] = function(a) {
+ a.N && H(a, 0);
+ var b = 0,
+ c = 0;
+ switch (a.b[1]) {
+ case 372:
+ b = a.Kd;
+ break;
+ case 374:
+ b = a.xe;
+ break;
+ case 373:
+ b = a.ye;
+ break;
+ case 16:
+ c = $a() - a.kf;
+ b = 8192 * c;
+ c *= 1.9073486328125E-6;
+ break;
+ case 44:
+ b = 16777216
+ }
+ a.b[0] = b;
+ a.b[2] = c
+};
+W[51] = function(a) {
+ t(a)
+};
+W[52] = function(a) {
+ var b = a.Kd & 65532;
+ a.ta && 0 !== b || H(a, 0);
+ a.flags &= -131585;
+ a.A = a.xe;
+ a.b[4] = a.ye;
+ a.M[1] = b;
+ a.eb[1] = 0;
+ a.La[1] = -1;
+ a.xa[1] = 0;
+ ce(a, !0);
+ a.N = 0;
+ ie(a);
+ a.M[2] = b + 8;
+ a.eb[2] = 0;
+ a.La[2] = -1;
+ a.xa[2] = 0;
+ a.qb = !0
+};
+W[53] = function(a) {
+ var b = a.Kd & 65532;
+ a.ta && !a.N && 0 !== b || H(a, 0);
+ a.A = a.b[2];
+ a.b[4] = a.b[1];
+ a.M[1] = b + 16 | 3;
+ a.eb[1] = 0;
+ a.La[1] = -1;
+ a.xa[1] = 0;
+ ce(a, !0);
+ a.N = 3;
+ ie(a);
+ a.M[2] = b + 24 | 3;
+ a.eb[2] = 0;
+ a.La[2] = -1;
+ a.xa[2] = 0;
+ a.qb = !0
+};
+W[54] = function(a) {
+ t(a)
+};
+W[55] = function(a) {
+ t(a)
+};
+W[56] = function(a) {
+ t(a)
+};
+W[57] = function(a) {
+ t(a)
+};
+W[58] = function(a) {
+ t(a)
+};
+W[59] = function(a) {
+ t(a)
+};
+W[60] = function(a) {
+ t(a)
+};
+W[61] = function(a) {
+ t(a)
+};
+W[62] = function(a) {
+ t(a)
+};
+W[63] = function(a) {
+ t(a)
+};
+X[64] = function(a) {
+ D(a);
+ hh(a, a.Qb())
+};
+Z[64] = function(a) {
+ D(a);
+ ih(a, a.Qb())
+};
+X[65] = function(a) {
+ D(a);
+ hh(a, !a.Qb())
+};
+Z[65] = function(a) {
+ D(a);
+ ih(a, !a.Qb())
+};
+X[66] = function(a) {
+ D(a);
+ hh(a, a.yb())
+};
+Z[66] = function(a) {
+ D(a);
+ ih(a, a.yb())
+};
+X[67] = function(a) {
+ D(a);
+ hh(a, !a.yb())
+};
+Z[67] = function(a) {
+ D(a);
+ ih(a, !a.yb())
+};
+X[68] = function(a) {
+ D(a);
+ hh(a, a.Ab())
+};
+Z[68] = function(a) {
+ D(a);
+ ih(a, a.Ab())
+};
+X[69] = function(a) {
+ D(a);
+ hh(a, !a.Ab())
+};
+Z[69] = function(a) {
+ D(a);
+ ih(a, !a.Ab())
+};
+X[70] = function(a) {
+ D(a);
+ hh(a, kh(a))
+};
+Z[70] = function(a) {
+ D(a);
+ ih(a, kh(a))
+};
+X[71] = function(a) {
+ D(a);
+ hh(a, !kh(a))
+};
+Z[71] = function(a) {
+ D(a);
+ ih(a, !kh(a))
+};
+X[72] = function(a) {
+ D(a);
+ hh(a, a.Rb())
+};
+Z[72] = function(a) {
+ D(a);
+ ih(a, a.Rb())
+};
+X[73] = function(a) {
+ D(a);
+ hh(a, !a.Rb())
+};
+Z[73] = function(a) {
+ D(a);
+ ih(a, !a.Rb())
+};
+X[74] = function(a) {
+ D(a);
+ hh(a, a.zb())
+};
+Z[74] = function(a) {
+ D(a);
+ ih(a, a.zb())
+};
+X[75] = function(a) {
+ D(a);
+ hh(a, !a.zb())
+};
+Z[75] = function(a) {
+ D(a);
+ ih(a, !a.zb())
+};
+X[76] = function(a) {
+ D(a);
+ hh(a, lh(a))
+};
+Z[76] = function(a) {
+ D(a);
+ ih(a, lh(a))
+};
+X[77] = function(a) {
+ D(a);
+ hh(a, !lh(a))
+};
+Z[77] = function(a) {
+ D(a);
+ ih(a, !lh(a))
+};
+X[78] = function(a) {
+ D(a);
+ hh(a, mh(a))
+};
+Z[78] = function(a) {
+ D(a);
+ ih(a, mh(a))
+};
+X[79] = function(a) {
+ D(a);
+ hh(a, !mh(a))
+};
+Z[79] = function(a) {
+ D(a);
+ ih(a, !mh(a))
+};
+W[80] = function(a) {
+ t(a)
+};
+W[81] = function(a) {
+ t(a)
+};
+W[82] = function(a) {
+ t(a)
+};
+W[83] = function(a) {
+ t(a)
+};
+W[84] = function(a) {
+ t(a)
+};
+W[85] = function(a) {
+ t(a)
+};
+W[86] = function(a) {
+ t(a)
+};
+W[87] = function(a) {
+ K(a);
+ D(a);
+ var b = Ye(a),
+ c = rf(a);
+ tf(a, b[0] ^ c[0], b[1] ^ c[1], b[2] ^ c[2], b[3] ^ c[3])
+};
+W[88] = function(a) {
+ t(a)
+};
+W[89] = function(a) {
+ t(a)
+};
+W[90] = function(a) {
+ t(a)
+};
+W[91] = function(a) {
+ t(a)
+};
+W[92] = function(a) {
+ t(a)
+};
+W[93] = function(a) {
+ t(a)
+};
+W[94] = function(a) {
+ t(a)
+};
+W[95] = function(a) {
+ t(a)
+};
+W[96] = function(a) {
+ K(a);
+ D(a);
+ if (32 == (a.H & 56)) {
+ var b = Xe(a);
+ b = new Uint8Array(b.buffer);
+ var c = qf(a);
+ c = new Uint8Array(c.buffer);
+ tf(a, c[0] | b[0] << 8 | c[1] << 16 | b[1] << 24, c[2] | b[2] << 8 | c[3] << 16 | b[3] << 24, c[4] | b[4] << 8 | c[5] << 16 | b[5] << 24, c[6] | b[6] << 8 | c[7] << 16 | b[7] << 24)
+ } else b = We(a), c = a.s[2 * (a.f >> 3 & 7)], T(a, c & 255 | (b & 255) << 8 | (c >> 8 & 255) << 16 | (b >> 8 & 255) << 24, c >> 16 & 255 | (b >> 16 & 255) << 8 | c >>> 24 << 16 | b >>> 24 << 24)
+};
+W[97] = function(a) {
+ K(a);
+ D(a);
+ if (32 == (a.H & 56)) {
+ var b = Xe(a);
+ b = new Uint16Array(b.buffer);
+ var c = qf(a);
+ c = new Uint16Array(c.buffer);
+ tf(a, c[0] | b[0] << 16, c[1] | b[1] << 16, c[2] | b[2] << 16, c[3] | b[3] << 16)
+ } else b = We(a), c = a.s[2 * (a.f >> 3 & 7)], T(a, c & 65535 | (b & 65535) << 16, c >>> 16 | b >>> 16 << 16)
+};
+W[98] = function(a) {
+ K(a);
+ D(a);
+ var b = We(a);
+ T(a, a.s[2 * (a.f >> 3 & 7)], b)
+};
+W[99] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = a.s[2 * (a.f >> 3 & 7)],
+ d = a.s[2 * (a.f >> 3 & 7) + 1];
+ var e = 0 | Yg(c & 65535);
+ e |= Yg(c >>> 16) << 8;
+ e |= Yg(d & 65535) << 16;
+ e |= Yg(d >>> 16) << 24;
+ c = 0 | Yg(b[0] & 65535);
+ c |= Yg(b[0] >>> 16) << 8;
+ c |= Yg(b[1] & 65535) << 16;
+ c |= Yg(b[1] >>> 16) << 24;
+ T(a, e, c)
+};
+W[100] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a);
+ b = new Int8Array(b.buffer);
+ var c = 8 * (a.f >> 3 & 7),
+ d = a.Gd;
+ T(a, (d[c] > b[0] ? 255 : 0) | (d[c + 1] > b[1] ? 255 : 0) << 8 | (d[c + 2] > b[2] ? 255 : 0) << 16 | (d[c + 3] > b[3] ? 255 : 0) << 24, (d[c + 4] > b[4] ? 255 : 0) | (d[c + 5] > b[5] ? 255 : 0) << 8 | (d[c + 6] > b[6] ? 255 : 0) << 16 | (d[c + 7] > b[7] ? 255 : 0) << 24)
+};
+W[101] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = a.s[2 * (a.f >> 3 & 7)],
+ d = a.s[2 * (a.f >> 3 & 7) + 1];
+ T(a, (c << 16 >> 16 > b[0] << 16 >> 16 ? 65535 : 0) | (c >> 16 > b[0] >> 16 ? 65535 : 0) << 16, (d << 16 >> 16 > b[1] << 16 >> 16 ? 65535 : 0) | (d >> 16 > b[1] >> 16 ? 65535 : 0) << 16)
+};
+W[102] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a);
+ T(a, a.s[2 * (a.f >> 3 & 7)] > b[0] ? -1 : 0, a.s[2 * (a.f >> 3 & 7) + 1] > b[1] ? -1 : 0)
+};
+W[103] = function(a) {
+ K(a);
+ D(a);
+ if (32 == (a.H & 56)) {
+ var b = Ye(a);
+ b = new Int16Array(b.buffer);
+ var c = rf(a);
+ c = new Int16Array(c.buffer);
+ for (var d = le(0, 0, 0, 0), e = new Uint8Array(d.buffer), f = 0; 8 > f; f++) e[f] = Xg(c[f]), e[f | 8] = Xg(b[f]);
+ tf(a, d[0], d[1], d[2], d[3])
+ } else b = P(a), d = a.s[2 * (a.f >> 3 & 7)], e = a.s[2 * (a.f >> 3 & 7) + 1], c = 0 | Xg(d & 65535), c |= Xg(d >>> 16) << 8, c |= Xg(e & 65535) << 16, c |= Xg(e >>> 16) << 24, d = 0 | Xg(b[0] & 65535), d |= Xg(b[0] >>> 16) << 8, d |= Xg(b[1] & 65535) << 16, d |= Xg(b[1] >>> 16) << 24, T(a, c, d)
+};
+W[104] = function(a) {
+ K(a);
+ D(a);
+ if (32 == (a.H & 56)) {
+ var b = Ye(a);
+ b = new Uint8Array(b.buffer);
+ var c = rf(a);
+ c = new Uint8Array(c.buffer);
+ tf(a, c[8] | b[8] << 8 | c[9] << 16 | b[9] << 24, c[10] | b[10] << 8 | c[11] << 16 | b[11] << 24, c[12] | b[12] << 8 | c[13] << 16 | b[13] << 24, c[14] | b[14] << 8 | c[15] << 16 | b[15] << 24)
+ } else b = P(a), c = a.s[2 * (a.f >> 3 & 7) + 1], T(a, c & 255 | (b[1] & 255) << 8 | (c >> 8 & 255) << 16 | (b[1] >> 8 & 255) << 24, c >> 16 & 255 | (b[1] >> 16 & 255) << 8 | c >>> 24 << 16 | b[1] >>> 24 << 24)
+};
+W[105] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = a.s[2 * (a.f >> 3 & 7) + 1];
+ T(a, c & 65535 | (b[1] & 65535) << 16, c >>> 16 | b[1] >>> 16 << 16)
+};
+W[106] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a);
+ T(a, a.s[2 * (a.f >> 3 & 7) + 1], b[1])
+};
+W[107] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = a.s[2 * (a.f >> 3 & 7) + 1];
+ var d = 0 | Zg(a.s[2 * (a.f >> 3 & 7)]);
+ d |= Zg(c) << 16;
+ c = 0 | Zg(b[0]);
+ c |= Zg(b[1]) << 16;
+ T(a, d, c)
+};
+W[108] = function(a) {
+ t(a)
+};
+W[109] = function(a) {
+ t(a)
+};
+W[110] = function(a) {
+ K(a);
+ D(a);
+ if (32 === (a.H & 56)) {
+ var b = Ve(a);
+ tf(a, b, 0, 0, 0)
+ } else b = Ve(a), T(a, b, 0)
+};
+W[111] = function(a) {
+ K(a);
+ D(a);
+ if (32 == (a.H & 56)) {
+ var b = Ye(a);
+ tf(a, b[0], b[1], b[2], b[3])
+ } else 8 == (a.H & 56) ? (192 > a.f ? (b = F(a, a.f), b = le(y(a, b), y(a, b + 4 | 0), y(a, b + 8 | 0), y(a, b + 12 | 0))) : (b = (a.f & 7) << 2, b = le(a.na[b], a.na[b | 1], a.na[b | 2], a.na[b | 3])), tf(a, b[0], b[1], b[2], b[3])) : (b = P(a), T(a, b[0], b[1]))
+};
+W[112] = function(a) {
+ K(a);
+ D(a);
+ if (32 === (a.H & 56)) {
+ var b = Ye(a),
+ c = a.L();
+ tf(a, b[c & 3], b[c >> 2 & 3], b[c >> 4 & 3], b[c >> 6 & 3])
+ } else if (16 === (a.H & 56)) {
+ b = Ye(a);
+ c = new Uint16Array(b.buffer);
+ var d = a.L();
+ tf(a, c[d & 3] | c[d >> 2 & 3] << 16, c[d >> 4 & 3] | c[d >> 6 & 3] << 16, b[2], b[3])
+ } else if (8 === (a.H & 56)) b = Ye(a), c = new Uint16Array(b.buffer), d = a.L(), tf(a, b[0], b[1], c[d & 3 | 4] | c[d >> 2 & 3 | 4] << 16, c[d >> 4 & 3 | 4] | c[d >> 6 & 3 | 4] << 16);
+ else {
+ b = P(a);
+ var e = a.L();
+ c = e & 3;
+ d = e >> 2 & 3;
+ var f = e >> 4 & 3;
+ e >>>= 6;
+ T(a, b[c >> 1] >>> 16 * (c & 1) & 65535 | b[d >> 1] >>> 16 * (d & 1) << 16, b[f >> 1] >>> 16 * (f &
+ 1) & 65535 | b[e >> 1] >>> 16 * (e & 1) << 16)
+ }
+};
+W[113] = function(a) {
+ D(a);
+ K(a);
+ 192 > a.f && t(a);
+ switch (a.f >> 3 & 7) {
+ case 2:
+ var b = a.L(),
+ c = a.f & 7,
+ d = a.s[2 * c],
+ e = a.s[2 * c + 1],
+ f = 0,
+ h = 0;
+ 15 >= b && (f = (d & 65535) >>> b | d >>> 16 >>> b << 16, h = (e & 65535) >>> b | e >>> 16 >>> b << 16);
+ a.s[2 * c] = f;
+ a.s[2 * c + 1] = h;
+ break;
+ case 4:
+ b = a.L();
+ c = a.f & 7;
+ d = a.s[2 * c];
+ e = a.s[2 * c + 1];
+ 15 < b && (b = 16);
+ a.s[2 * c] = d << 16 >> 16 >> b & 65535 | (d >> 16 >> b & 65535) << 16;
+ a.s[2 * c + 1] = e << 16 >> 16 >> b & 65535 | (e >> 16 >> b & 65535) << 16;
+ break;
+ case 6:
+ b = a.L();
+ c = a.f & 7;
+ d = a.s[2 * c];
+ e = a.s[2 * c + 1];
+ h = f = 0;
+ 15 >= b && (f = (d & 65535) << b & 65535 | d >>> 16 << b << 16, h = (e & 65535) << b & 65535 |
+ e >>> 16 << b << 16);
+ a.s[2 * c] = f;
+ a.s[2 * c + 1] = h;
+ break;
+ default:
+ t(a)
+ }
+};
+W[114] = function(a) {
+ D(a);
+ K(a);
+ 192 > a.f && t(a);
+ switch (a.f >> 3 & 7) {
+ case 2:
+ var b = a.L(),
+ c = a.f & 7,
+ d = a.s[2 * c],
+ e = a.s[2 * c + 1],
+ f = 0,
+ h = 0;
+ 31 >= b && (f = d >>> b, h = e >>> b);
+ a.s[2 * c] = f;
+ a.s[2 * c + 1] = h;
+ break;
+ case 4:
+ b = a.L();
+ c = a.f & 7;
+ d = a.s[2 * c];
+ e = a.s[2 * c + 1];
+ 31 < b && (b = 31);
+ a.s[2 * c] = d >> b;
+ a.s[2 * c + 1] = e >> b;
+ break;
+ case 6:
+ b = a.L();
+ c = a.f & 7;
+ d = a.s[2 * c];
+ e = a.s[2 * c + 1];
+ h = f = 0;
+ 31 >= b && (f = d << b, h = e << b);
+ a.s[2 * c] = f;
+ a.s[2 * c + 1] = h;
+ break;
+ default:
+ t(a)
+ }
+};
+W[115] = function(a) {
+ D(a);
+ K(a);
+ 192 > a.f && t(a);
+ switch (a.f >> 3 & 7) {
+ case 2:
+ var b = a.L(),
+ c = a.f & 7,
+ d = a.s[2 * c],
+ e = a.s[2 * c + 1],
+ f = 0,
+ h = 0;
+ 31 >= b ? (f = d >>> b | e << 32 - b, h = e >>> b) : 63 >= b && (f = e >>> (b & 31), h = 0);
+ a.s[2 * c] = f;
+ a.s[2 * c + 1] = h;
+ break;
+ case 6:
+ b = a.L();
+ c = a.f & 7;
+ d = a.s[2 * c];
+ e = a.s[2 * c + 1];
+ h = f = 0;
+ 31 >= b ? (f = d << b, h = e << b | d >>> 32 - b) : 63 >= b && (h = d << (b & 31), f = 0);
+ a.s[2 * c] = f;
+ a.s[2 * c + 1] = h;
+ break;
+ default:
+ t(a)
+ }
+};
+W[116] = function(a) {
+ K(a);
+ D(a);
+ if (32 == (a.H & 56)) {
+ var b = Ye(a);
+ b = new Uint8Array(b.buffer);
+ var c = rf(a);
+ c = new Uint8Array(c.buffer);
+ for (var d = le(0, 0, 0, 0), e = new Uint8Array(d.buffer), f = 0; 16 > f; f++) e[f] = b[f] === c[f] ? 255 : 0;
+ tf(a, d[0], d[1], d[2], d[3])
+ } else b = P(a), b = new Int8Array(b.buffer), c = 8 * (a.f >> 3 & 7), d = a.Gd, T(a, (d[c] === b[0] ? 255 : 0) | (d[c + 1] === b[1] ? 255 : 0) << 8 | (d[c + 2] === b[2] ? 255 : 0) << 16 | (d[c + 3] === b[3] ? 255 : 0) << 24, (d[c + 4] === b[4] ? 255 : 0) | (d[c + 5] === b[5] ? 255 : 0) << 8 | (d[c + 6] === b[6] ? 255 : 0) << 16 | (d[c + 7] === b[7] ? 255 : 0) << 24)
+};
+W[117] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = a.s[2 * (a.f >> 3 & 7)],
+ d = a.s[2 * (a.f >> 3 & 7) + 1];
+ T(a, ((c & 65535) === (b[0] & 65535) ? 65535 : 0) | ((c & 4294901760) === (b[0] & 4294901760) ? 65535 : 0) << 16, ((d & 65535) === (b[1] & 65535) ? 65535 : 0) | ((d & 4294901760) === (b[1] & 4294901760) ? 65535 : 0) << 16)
+};
+W[118] = function(a) {
+ K(a);
+ D(a);
+ if (32 == (a.H & 56)) {
+ var b = Ye(a),
+ c = rf(a);
+ tf(a, b[0] === c[0] ? -1 : 0, b[1] === c[1] ? -1 : 0, b[2] === c[2] ? -1 : 0, b[3] === c[3] ? -1 : 0)
+ } else b = P(a), T(a, a.s[2 * (a.f >> 3 & 7)] === b[0] ? -1 : 0, a.s[2 * (a.f >> 3 & 7) + 1] === b[1] ? -1 : 0)
+};
+W[119] = function(a) {
+ K(a);
+ a.T.fa = 255
+};
+W[120] = function(a) {
+ t(a)
+};
+W[121] = function(a) {
+ t(a)
+};
+W[122] = function(a) {
+ t(a)
+};
+W[123] = function(a) {
+ t(a)
+};
+W[124] = function(a) {
+ t(a)
+};
+W[125] = function(a) {
+ t(a)
+};
+W[126] = function(a) {
+ K(a);
+ D(a);
+ if (8 === (a.H & 56)) {
+ var b = Xe(a);
+ tf(a, b[0], b[1], 0, 0)
+ } else 32 == (a.H & 56) ? (b = qf(a), af(a, b[0])) : (b = sf(a), af(a, b[0]))
+};
+W[127] = function(a) {
+ K(a);
+ D(a);
+ if (8 == (a.H & 56)) {
+ var b = rf(a),
+ c = F(a, a.f);
+ ue(a, c, b[0], b[1], b[2], b[3])
+ } else if (32 == (a.H & 56)) b = rf(a), c = F(a, a.f), ue(a, c, b[0], b[1], b[2], b[3]);
+ else if (c = sf(a), b = c[0], c = c[1], 192 > a.f) {
+ var d = F(a, a.f);
+ te(a, d, b, c)
+ } else a.s[2 * (a.f & 7)] = b, a.s[2 * (a.f & 7) + 1] = c
+};
+X[128] = function(a) {
+ fh(a, a.Qb())
+};
+Z[128] = function(a) {
+ gh(a, a.Qb())
+};
+X[129] = function(a) {
+ fh(a, !a.Qb())
+};
+Z[129] = function(a) {
+ gh(a, !a.Qb())
+};
+X[130] = function(a) {
+ fh(a, a.yb())
+};
+Z[130] = function(a) {
+ gh(a, a.yb())
+};
+X[131] = function(a) {
+ fh(a, !a.yb())
+};
+Z[131] = function(a) {
+ gh(a, !a.yb())
+};
+X[132] = function(a) {
+ fh(a, a.Ab())
+};
+Z[132] = function(a) {
+ gh(a, a.Ab())
+};
+X[133] = function(a) {
+ fh(a, !a.Ab())
+};
+Z[133] = function(a) {
+ gh(a, !a.Ab())
+};
+X[134] = function(a) {
+ fh(a, kh(a))
+};
+Z[134] = function(a) {
+ gh(a, kh(a))
+};
+X[135] = function(a) {
+ fh(a, !kh(a))
+};
+Z[135] = function(a) {
+ gh(a, !kh(a))
+};
+X[136] = function(a) {
+ fh(a, a.Rb())
+};
+Z[136] = function(a) {
+ gh(a, a.Rb())
+};
+X[137] = function(a) {
+ fh(a, !a.Rb())
+};
+Z[137] = function(a) {
+ gh(a, !a.Rb())
+};
+X[138] = function(a) {
+ fh(a, a.zb())
+};
+Z[138] = function(a) {
+ gh(a, a.zb())
+};
+X[139] = function(a) {
+ fh(a, !a.zb())
+};
+Z[139] = function(a) {
+ gh(a, !a.zb())
+};
+X[140] = function(a) {
+ fh(a, lh(a))
+};
+Z[140] = function(a) {
+ gh(a, lh(a))
+};
+X[141] = function(a) {
+ fh(a, !lh(a))
+};
+Z[141] = function(a) {
+ gh(a, !lh(a))
+};
+X[142] = function(a) {
+ fh(a, mh(a))
+};
+Z[142] = function(a) {
+ gh(a, mh(a))
+};
+X[143] = function(a) {
+ fh(a, !mh(a))
+};
+Z[143] = function(a) {
+ gh(a, !mh(a))
+};
+W[144] = function(a) {
+ D(a);
+ jh(a, a.Qb())
+};
+W[145] = function(a) {
+ D(a);
+ jh(a, !a.Qb())
+};
+W[146] = function(a) {
+ D(a);
+ jh(a, a.yb())
+};
+W[147] = function(a) {
+ D(a);
+ jh(a, !a.yb())
+};
+W[148] = function(a) {
+ D(a);
+ jh(a, a.Ab())
+};
+W[149] = function(a) {
+ D(a);
+ jh(a, !a.Ab())
+};
+W[150] = function(a) {
+ D(a);
+ jh(a, kh(a))
+};
+W[151] = function(a) {
+ D(a);
+ jh(a, !kh(a))
+};
+W[152] = function(a) {
+ D(a);
+ jh(a, a.Rb())
+};
+W[153] = function(a) {
+ D(a);
+ jh(a, !a.Rb())
+};
+W[154] = function(a) {
+ D(a);
+ jh(a, a.zb())
+};
+W[155] = function(a) {
+ D(a);
+ jh(a, !a.zb())
+};
+W[156] = function(a) {
+ D(a);
+ jh(a, lh(a))
+};
+W[157] = function(a) {
+ D(a);
+ jh(a, !lh(a))
+};
+W[158] = function(a) {
+ D(a);
+ jh(a, mh(a))
+};
+W[159] = function(a) {
+ D(a);
+ jh(a, !mh(a))
+};
+X[160] = function(a) {
+ I(a, a.M[4])
+};
+Z[160] = function(a) {
+ J(a, a.M[4])
+};
+X[161] = function(a) {
+ $d(a, 4, x(a, G(a, 0)));
+ Ee(a, 2)
+};
+Z[161] = function(a) {
+ $d(a, 4, y(a, G(a, 0)) & 65535);
+ Ee(a, 4)
+};
+W[162] = function(a) {
+ var b = 0,
+ c = 0,
+ d = 0,
+ e = 0;
+ switch (a.b[0]) {
+ case 0:
+ b = 5;
+ e = 1970169159;
+ d = 1231384169;
+ c = 1818588270;
+ break;
+ case 1:
+ b = 3939;
+ e = 67584;
+ c = -1065353216;
+ d = (a.T ? 1 : 0) | 43320;
+ break;
+ case 2:
+ b = 1717260289;
+ c = e = 0;
+ d = 8024064;
+ break;
+ case 4:
+ switch (a.b[1]) {
+ case 0:
+ b = 289;
+ e = 29360191;
+ c = 63;
+ d = 1;
+ break;
+ case 1:
+ b = 290;
+ e = 29360191;
+ c = 63;
+ d = 1;
+ break;
+ case 2:
+ b = 323, e = 96469055, c = 4095, d = 1
+ }
+ break;
+ case 5:
+ e = b = 64;
+ c = 3;
+ d = 1319200;
+ break;
+ case -2147483648:
+ b = 5;
+ break;
+ case 1073741824:
+ e = 1635208534, c = 1297507698, d = 1701994871
+ }
+ a.b[0] = b;
+ a.b[1] = c;
+ a.b[2] = d;
+ a.b[3] =
+ e
+};
+X[163] = function(a) {
+ D(a);
+ 192 > a.f ? Sg(a, F(a, a.f), nf(a)) : Og(a, ff(a), mf(a) & 15)
+};
+Z[163] = function(a) {
+ D(a);
+ 192 > a.f ? Sg(a, F(a, a.f), S(a)) : Og(a, hf(a), S(a) & 31)
+};
+X[164] = function(a) {
+ D(a);
+ var b = Q(a);
+ R(a, Mg(a, b, mf(a), a.L() & 31))
+};
+Z[164] = function(a) {
+ D(a);
+ var b = df(a);
+ ef(a, Ng(a, b, S(a), a.L() & 31))
+};
+X[165] = function(a) {
+ D(a);
+ var b = Q(a);
+ R(a, Mg(a, b, mf(a), a.D[4] & 31))
+};
+Z[165] = function(a) {
+ D(a);
+ var b = df(a);
+ ef(a, Ng(a, b, S(a), a.D[4] & 31))
+};
+W[166] = function(a) {
+ t(a)
+};
+W[167] = function(a) {
+ t(a)
+};
+X[168] = function(a) {
+ I(a, a.M[5])
+};
+Z[168] = function(a) {
+ J(a, a.M[5])
+};
+X[169] = function(a) {
+ $d(a, 5, x(a, G(a, 0)));
+ Ee(a, 2)
+};
+Z[169] = function(a) {
+ $d(a, 5, y(a, G(a, 0)) & 65535);
+ Ee(a, 4)
+};
+W[170] = function(a) {
+ t(a)
+};
+X[171] = function(a) {
+ D(a);
+ 192 > a.f ? Vg(a, F(a, a.f), nf(a)) : gf(a, Qg(a, ff(a), nf(a) & 15))
+};
+Z[171] = function(a) {
+ D(a);
+ 192 > a.f ? Vg(a, F(a, a.f), S(a)) : jf(a, Qg(a, hf(a), S(a) & 31))
+};
+X[172] = function(a) {
+ D(a);
+ var b = Q(a);
+ R(a, Kg(a, b, mf(a), a.L() & 31))
+};
+Z[172] = function(a) {
+ D(a);
+ var b = df(a);
+ ef(a, Lg(a, b, S(a), a.L() & 31))
+};
+X[173] = function(a) {
+ D(a);
+ var b = Q(a);
+ R(a, Kg(a, b, mf(a), a.D[4] & 31))
+};
+Z[173] = function(a) {
+ D(a);
+ var b = df(a);
+ ef(a, Lg(a, b, S(a), a.D[4] & 31))
+};
+W[174] = function(a) {
+ D(a);
+ a.H & 56 && t(a);
+ switch (a.f >> 3 & 7) {
+ case 0:
+ 192 <= a.f && t(a);
+ var b = F(a, a.f);
+ Cb(a, b, 512);
+ u(a, b + 0 | 0, a.T.ec);
+ u(a, b + 2 | 0, zb(a.T));
+ re(a, b + 4 | 0, ~a.T.fa & 255);
+ u(a, b + 6 | 0, a.T.pd);
+ w(a, b + 8 | 0, a.T.Oc);
+ u(a, b + 12 | 0, a.T.Qe);
+ w(a, b + 16 | 0, a.T.nd);
+ u(a, b + 20 | 0, a.T.od);
+ w(a, b + 24 | 0, a.$e);
+ w(a, b + 28 | 0, 65471);
+ for (var c = 0; 8 > c; c++) Jb(a.T, b + 32 + (c << 4) | 0, a.T.I[a.T.B + c & 7]);
+ for (c = 0; 8 > c; c++) w(a, b + 160 + (c << 4) + 0 | 0, a.na[c << 2 | 0]), w(a, b + 160 + (c << 4) + 4 | 0, a.na[c << 2 | 1]), w(a, b + 160 + (c << 4) + 8 | 0, a.na[c << 2 | 2]), w(a, b + 160 + (c << 4) + 12 | 0, a.na[c <<
+ 2 | 3]);
+ break;
+ case 1:
+ 192 <= a.f && t(a);
+ b = F(a, a.f);
+ je(a, b | 0);
+ je(a, b + 511 | 0);
+ c = y(a, b + 24 | 0);
+ c & -65472 && H(a, 0);
+ a.T.ec = x(a, b + 0 | 0);
+ var d = a.T,
+ e = x(a, b + 2 | 0);
+ d.a = e & -14337;
+ d.B = e >> 11 & 7;
+ a.T.fa = ~pe(a, b + 4 | 0) & 255;
+ a.T.pd = x(a, b + 6 | 0);
+ a.T.Oc = y(a, b + 8 | 0);
+ a.T.Oc = x(a, b + 12 | 0);
+ a.T.nd = y(a, b + 16 | 0);
+ a.T.od = x(a, b + 20 | 0);
+ a.$e = c;
+ for (c = 0; 8 > c; c++) a.T.I[a.T.B + c & 7] = Ib(a.T, b + 32 + (c << 4) | 0);
+ for (c = 0; 8 > c; c++) a.na[c << 2 | 0] = y(a, b + 160 + (c << 4) + 0 | 0), a.na[c << 2 | 1] = y(a, b + 160 + (c << 4) + 4 | 0), a.na[c << 2 | 2] = y(a, b + 160 + (c << 4) + 8 | 0), a.na[c << 2 | 3] = y(a, b + 160 + (c << 4) + 12 | 0);
+ break;
+ case 2:
+ 192 <= a.f && t(a);
+ b = F(a, a.f);
+ b = y(a, b);
+ b & -65472 && H(a, 0);
+ a.$e = b;
+ break;
+ case 3:
+ 192 <= a.f && t(a);
+ b = F(a, a.f);
+ w(a, b, a.$e);
+ break;
+ case 5:
+ 192 > a.f && t(a);
+ break;
+ case 6:
+ 192 > a.f && t(a);
+ break;
+ case 7:
+ 192 > a.f && t(a);
+ break;
+ default:
+ t(a)
+ }
+};
+X[175] = function(a) {
+ D(a);
+ var b = O(a) << 16 >> 16; of (a, bg(a, nf(a), b))
+};
+Z[175] = function(a) {
+ D(a);
+ var b = Ve(a);
+ pf(a, eg(a, S(a), b))
+};
+W[176] = function(a) {
+ D(a);
+ if (192 > a.f) {
+ var b = F(a, a.f);
+ Cb(a, b, 1);
+ var c = pe(a, b)
+ } else c = a.D[a.f << 2 & 12 | a.f >> 2 & 1];
+ a.sub(a.D[0], c, 7);
+ a.Ac() ? 192 > a.f ? re(a, b, kf(a)) : a.D[a.f << 2 & 12 | a.f >> 2 & 1] = kf(a) : (192 > a.f && re(a, b, c), a.D[0] = c)
+};
+X[177] = function(a) {
+ D(a);
+ if (192 > a.f) {
+ var b = F(a, a.f);
+ Cb(a, b, 2);
+ var c = x(a, b)
+ } else c = ff(a);
+ a.sub(a.h[0], c, 15);
+ a.Ac() ? 192 > a.f ? u(a, b, mf(a)) : gf(a, mf(a)) : (192 > a.f && u(a, b, c), a.h[0] = c)
+};
+Z[177] = function(a) {
+ D(a);
+ if (192 > a.f) {
+ var b = F(a, a.f);
+ Cb(a, b, 4);
+ var c = y(a, b)
+ } else c = hf(a);
+ a.sub(a.b[0], c, 31);
+ a.Ac() ? 192 > a.f ? w(a, b, S(a)) : jf(a, S(a)) : (192 > a.f && w(a, b, c), a.b[0] = c)
+};
+X[178] = function(a) {
+ D(a);
+ rh(a, 2)
+};
+Z[178] = function(a) {
+ D(a);
+ sh(a, 2)
+};
+X[179] = function(a) {
+ D(a);
+ 192 > a.f ? Ug(a, F(a, a.f), nf(a)) : gf(a, Rg(a, ff(a), nf(a) & 15))
+};
+Z[179] = function(a) {
+ D(a);
+ 192 > a.f ? Ug(a, F(a, a.f), S(a)) : jf(a, Rg(a, hf(a), S(a) & 31))
+};
+X[180] = function(a) {
+ D(a);
+ rh(a, 4)
+};
+Z[180] = function(a) {
+ D(a);
+ sh(a, 4)
+};
+X[181] = function(a) {
+ D(a);
+ rh(a, 5)
+};
+Z[181] = function(a) {
+ D(a);
+ sh(a, 5)
+};
+X[182] = function(a) {
+ D(a);
+ var b = Ue(a); of (a, b)
+};
+Z[182] = function(a) {
+ D(a);
+ var b = Ue(a);
+ pf(a, b)
+};
+X[183] = function(a) {
+ D(a);
+ var b = O(a); of (a, b)
+};
+Z[183] = function(a) {
+ D(a);
+ var b = O(a);
+ pf(a, b)
+};
+X[184] = function(a) {
+ D(a);
+ 0 === (a.H & 8) && t(a);
+ var b = O(a); of (a, Wg(a, b))
+};
+Z[184] = function(a) {
+ D(a);
+ 0 === (a.H & 8) && t(a);
+ var b = Ve(a);
+ pf(a, Wg(a, b))
+};
+W[185] = function(a) {
+ t(a)
+};
+X[186] = function(a) {
+ D(a);
+ switch (a.f >> 3 & 7) {
+ case 4:
+ 192 > a.f ? Sg(a, F(a, a.f), a.L() & 15) : Og(a, ff(a), a.L() & 15);
+ break;
+ case 5:
+ 192 > a.f ? Vg(a, F(a, a.f), a.L() & 15) : gf(a, Qg(a, ff(a), a.L() & 15));
+ break;
+ case 6:
+ 192 > a.f ? Ug(a, F(a, a.f), a.L() & 15) : gf(a, Rg(a, ff(a), a.L() & 15));
+ break;
+ case 7:
+ 192 > a.f ? Tg(a, F(a, a.f), a.L() & 15) : gf(a, Pg(a, ff(a), a.L() & 15));
+ break;
+ default:
+ t(a)
+ }
+};
+Z[186] = function(a) {
+ D(a);
+ switch (a.f >> 3 & 7) {
+ case 4:
+ 192 > a.f ? Sg(a, F(a, a.f), a.L() & 31) : Og(a, hf(a), a.L() & 31);
+ break;
+ case 5:
+ 192 > a.f ? Vg(a, F(a, a.f), a.L() & 31) : jf(a, Qg(a, hf(a), a.L() & 31));
+ break;
+ case 6:
+ 192 > a.f ? Ug(a, F(a, a.f), a.L() & 31) : jf(a, Rg(a, hf(a), a.L() & 31));
+ break;
+ case 7:
+ 192 > a.f ? Tg(a, F(a, a.f), a.L() & 31) : jf(a, Pg(a, hf(a), a.L() & 31));
+ break;
+ default:
+ t(a)
+ }
+};
+X[187] = function(a) {
+ D(a);
+ 192 > a.f ? Tg(a, F(a, a.f), nf(a)) : gf(a, Pg(a, ff(a), nf(a) & 15))
+};
+Z[187] = function(a) {
+ D(a);
+ 192 > a.f ? Tg(a, F(a, a.f), S(a)) : jf(a, Pg(a, hf(a), S(a) & 31))
+};
+X[188] = function(a) {
+ D(a);
+ var b = O(a);
+ var c = mf(a);
+ a.u = 2197;
+ a.S = 15;
+ 0 === b ? (a.flags |= 64, a.F = b, b = c) : (a.flags &= -65, b = a.F = fb(-b & b)); of (a, b)
+};
+Z[188] = function(a) {
+ D(a);
+ var b = Ve(a);
+ var c = S(a);
+ a.u = 2197;
+ a.S = 31;
+ 0 === b ? (a.flags |= 64, a.F = b, b = c) : (a.flags &= -65, b = a.F = fb((-b & b) >>> 0));
+ pf(a, b)
+};
+X[189] = function(a) {
+ D(a);
+ var b = O(a);
+ var c = mf(a);
+ a.u = 2197;
+ a.S = 15;
+ 0 === b ? (a.flags |= 64, a.F = b, b = c) : (a.flags &= -65, b = a.F = fb(b)); of (a, b)
+};
+Z[189] = function(a) {
+ D(a);
+ var b = Ve(a);
+ var c = S(a);
+ a.u = 2197;
+ a.S = 31;
+ 0 === b ? (a.flags |= 64, a.F = b, b = c) : (a.flags &= -65, b = a.F = fb(b >>> 0));
+ pf(a, b)
+};
+X[190] = function(a) {
+ D(a);
+ var b = Ue(a) << 24 >> 24; of (a, b)
+};
+Z[190] = function(a) {
+ D(a);
+ var b = Ue(a) << 24 >> 24;
+ pf(a, b)
+};
+X[191] = function(a) {
+ D(a);
+ var b = O(a); of (a, b)
+};
+Z[191] = function(a) {
+ D(a);
+ var b = O(a) << 16 >> 16;
+ pf(a, b)
+};
+W[192] = function(a) {
+ D(a);
+ var b = bf(a),
+ c = a.f >> 1 & 12 | a.f >> 5 & 1,
+ d = a.D[c];
+ a.D[c] = b;
+ b = a.add(b, d, 7);
+ cf(a, b)
+};
+X[193] = function(a) {
+ D(a);
+ var b = Q(a),
+ c = a.f >> 2 & 14,
+ d = a.h[c];
+ a.h[c] = b;
+ b = a.add(b, d, 15);
+ R(a, b)
+};
+Z[193] = function(a) {
+ D(a);
+ var b = df(a),
+ c = a.f >> 3 & 7,
+ d = a.b[c];
+ a.b[c] = b;
+ b = a.add(b, d, 31);
+ ef(a, b)
+};
+W[194] = function(a) {
+ t(a)
+};
+W[195] = function(a) {
+ D(a);
+ 192 <= a.f && t(a);
+ af(a, S(a))
+};
+W[196] = function(a) {
+ t(a)
+};
+W[197] = function(a) {
+ t(a)
+};
+W[198] = function(a) {
+ t(a)
+};
+W[199] = function(a) {
+ D(a);
+ switch (a.f >> 3 & 7) {
+ case 1:
+ 192 <= a.f && t(a);
+ var b = F(a, a.f);
+ Cb(a, b, 8);
+ var c = y(a, b),
+ d = y(a, b + 4 | 0);
+ a.b[0] === c && a.b[2] === d ? (a.flags |= 64, w(a, b, a.b[3]), w(a, b + 4 | 0, a.b[1])) : (a.flags &= -65, a.b[0] = c, a.b[2] = d, w(a, b, c), w(a, b + 4 | 0, d));
+ a.u &= -65;
+ break;
+ case 6:
+ c = (b = lb()) ? mb() : 0;
+ Bb(a) ? af(a, c) : $e(a, c);
+ a.flags &= -2262;
+ a.flags |= b;
+ a.u = 0;
+ break;
+ default:
+ t(a)
+ }
+};
+W[200] = function(a) {
+ th(a, 0)
+};
+W[201] = function(a) {
+ th(a, 1)
+};
+W[202] = function(a) {
+ th(a, 2)
+};
+W[203] = function(a) {
+ th(a, 3)
+};
+W[204] = function(a) {
+ th(a, 4)
+};
+W[205] = function(a) {
+ th(a, 5)
+};
+W[206] = function(a) {
+ th(a, 6)
+};
+W[207] = function(a) {
+ th(a, 7)
+};
+W[208] = function(a) {
+ t(a)
+};
+W[209] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = a.s[2 * (a.f >> 3 & 7)],
+ d = a.s[2 * (a.f >> 3 & 7) + 1];
+ b = b[0] >>> 0;
+ var e = 0,
+ f = 0;
+ 15 >= b && (e = (c & 65535) >>> b | c >>> 16 >>> b << 16, f = (d & 65535) >>> b | d >>> 16 >>> b << 16);
+ T(a, e, f)
+};
+W[210] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = a.s[2 * (a.f >> 3 & 7)],
+ d = a.s[2 * (a.f >> 3 & 7) + 1];
+ b = b[0] >>> 0;
+ var e = 0,
+ f = 0;
+ 31 >= b && (e = c >>> b, f = d >>> b);
+ T(a, e, f)
+};
+W[211] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = a.s[2 * (a.f >> 3 & 7)],
+ d = a.s[2 * (a.f >> 3 & 7) + 1];
+ b = b[0] >>> 0;
+ if (0 !== b) {
+ var e = 0,
+ f = 0;
+ 31 >= b ? (e = c >>> b | d << 32 - b, f = d >>> b) : 63 >= b && (e = d >>> (b & 31), f = 0);
+ T(a, e, f)
+ }
+};
+W[212] = function(a) {
+ t(a)
+};
+W[213] = function(a) {
+ K(a);
+ D(a);
+ if (32 == (a.H & 56)) {
+ var b = Ye(a);
+ b = new Int16Array(b.buffer);
+ var c = rf(a);
+ c = new Int16Array(c.buffer);
+ tf(a, b[0] * c[0] & 65535 | b[1] * c[1] << 16, b[2] * c[2] & 65535 | b[3] * c[3] << 16, b[4] * c[4] & 65535 | b[5] * c[5] << 16, b[6] * c[6] & 65535 | b[7] * c[7] << 16)
+ } else {
+ b = P(a);
+ c = a.s[2 * (a.f >> 3 & 7)];
+ var d = a.s[2 * (a.f >> 3 & 7) + 1];
+ T(a, (c & 65535) * (b[0] & 65535) & 65535 | ((c >>> 16) * (b[0] >>> 16) & 65535) << 16, (d & 65535) * (b[1] & 65535) & 65535 | ((d >>> 16) * (b[1] >>> 16) & 65535) << 16)
+ }
+};
+W[214] = function(a) {
+ K(a);
+ D(a);
+ var b = qf(a),
+ c = F(a, a.f);
+ te(a, c, b[0], b[1])
+};
+W[215] = function(a) {
+ K(a);
+ D(a);
+ 192 > a.f && t(a);
+ var b = Ye(a);
+ b = new Uint8Array(b.buffer);
+ pf(a, b[0] >> 7 << 0 | b[1] >> 7 << 1 | b[2] >> 7 << 2 | b[3] >> 7 << 3 | b[4] >> 7 << 4 | b[5] >> 7 << 5 | b[6] >> 7 << 6 | b[7] >> 7 << 7 | b[8] >> 7 << 8 | b[9] >> 7 << 9 | b[10] >> 7 << 10 | b[11] >> 7 << 11 | b[12] >> 7 << 12 | b[13] >> 7 << 13 | b[14] >> 7 << 14 | b[15] >> 7 << 15)
+};
+W[216] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = new Uint8Array(b.buffer),
+ d = 8 * (a.f >> 3 & 7),
+ e = a.tg;
+ b = ah(e[d] - c[0]);
+ var f = ah(e[d + 1] - c[1]),
+ h = ah(e[d + 2] - c[2]),
+ g = ah(e[d + 3] - c[3]),
+ p = ah(e[d + 4] - c[4]),
+ r = ah(e[d + 5] - c[5]),
+ v = ah(e[d + 6] - c[6]);
+ c = ah(e[d + 7] - c[7]);
+ T(a, b | f << 8 | h << 16 | g << 24, p | r << 8 | v << 16 | c << 24)
+};
+W[217] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = a.s[2 * (a.f >> 3 & 7)],
+ d = a.s[2 * (a.f >> 3 & 7) + 1],
+ e = (c & 65535) - (b[0] & 65535);
+ c = (c >>> 16) - (b[0] >>> 16);
+ 0 > e && (e = 0);
+ 0 > c && (c = 0);
+ var f = (d & 65535) - (b[1] & 65535);
+ b = (d >>> 16) - (b[1] >>> 16);
+ 0 > f && (f = 0);
+ 0 > b && (b = 0);
+ T(a, e | c << 16, f | b << 16)
+};
+W[218] = function(a) {
+ K(a);
+ D(a);
+ var b = Ye(a);
+ b = new Uint8Array(b.buffer);
+ var c = rf(a);
+ c = new Uint8Array(c.buffer);
+ for (var d = le(0, 0, 0, 0), e = new Uint8Array(d.buffer), f = 0; 16 > f; f++) e[f] = b[f] < c[f] ? b[f] : c[f];
+ tf(a, d[0], d[1], d[2], d[3])
+};
+W[219] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a);
+ T(a, b[0] & a.s[2 * (a.f >> 3 & 7)], b[1] & a.s[2 * (a.f >> 3 & 7) + 1])
+};
+W[220] = function(a) {
+ K(a);
+ D(a);
+ if (32 == (a.H & 56)) {
+ var b = Ye(a);
+ b = new Uint8Array(b.buffer);
+ var c = rf(a);
+ c = new Uint8Array(c.buffer);
+ for (var d = le(0, 0, 0, 0), e = new Uint8Array(d.buffer), f = 0; 16 > f; f++) e[f] = bh(b[f] + c[f]);
+ tf(a, d[0], d[1], d[2], d[3])
+ } else {
+ b = P(a);
+ var h = new Uint8Array(b.buffer),
+ g = 8 * (a.f >> 3 & 7),
+ p = a.tg;
+ b = bh(p[g] + h[0]);
+ c = bh(p[g + 1] + h[1]);
+ d = bh(p[g + 2] + h[2]);
+ e = bh(p[g + 3] + h[3]);
+ f = bh(p[g + 4] + h[4]);
+ var r = bh(p[g + 5] + h[5]),
+ v = bh(p[g + 6] + h[6]);
+ h = bh(p[g + 7] + h[7]);
+ T(a, b | c << 8 | d << 16 | e << 24, f | r << 8 | v << 16 | h << 24)
+ }
+};
+W[221] = function(a) {
+ K(a);
+ D(a);
+ if (32 == (a.H & 56)) {
+ var b = Ye(a);
+ b = new Uint16Array(b.buffer);
+ var c = rf(a);
+ c = new Uint16Array(c.buffer);
+ tf(a, ch(b[0] + c[0]) | ch(b[1] + c[1]) << 16, ch(b[2] + c[2]) | ch(b[3] + c[3]) << 16, ch(b[4] + c[4]) | ch(b[5] + c[5]) << 16, ch(b[6] + c[6]) | ch(b[7] + c[7]) << 16)
+ } else {
+ c = P(a);
+ var d = a.s[2 * (a.f >> 3 & 7)],
+ e = a.s[2 * (a.f >> 3 & 7) + 1];
+ b = ch((d & 65535) + (c[0] & 65535));
+ d = ch((d >>> 16) + (c[0] >>> 16));
+ var f = ch((e & 65535) + (c[1] & 65535));
+ c = ch((e >>> 16) + (c[1] >>> 16));
+ T(a, b | d << 16, f | c << 16)
+ }
+};
+W[222] = function(a) {
+ K(a);
+ D(a);
+ if (32 == (a.H & 56)) {
+ var b = Ye(a);
+ b = new Uint8Array(b.buffer);
+ var c = rf(a);
+ c = new Uint8Array(c.buffer);
+ for (var d = le(0, 0, 0, 0), e = new Uint8Array(d.buffer), f = 0; 16 > f; f++) e[f] = b[f] > c[f] ? b[f] : c[f];
+ tf(a, d[0], d[1], d[2], d[3])
+ }
+};
+W[223] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a);
+ T(a, b[0] & ~a.s[2 * (a.f >> 3 & 7)], b[1] & ~a.s[2 * (a.f >> 3 & 7) + 1])
+};
+W[224] = function(a) {
+ t(a)
+};
+W[225] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = a.s[2 * (a.f >> 3 & 7)],
+ d = a.s[2 * (a.f >> 3 & 7) + 1];
+ b = b[0] >>> 0;
+ 15 < b && (b = 16);
+ T(a, c << 16 >> 16 >> b & 65535 | (c >> 16 >> b & 65535) << 16, d << 16 >> 16 >> b & 65535 | (d >> 16 >> b & 65535) << 16)
+};
+W[226] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = a.s[2 * (a.f >> 3 & 7)],
+ d = a.s[2 * (a.f >> 3 & 7) + 1];
+ b = b[0] >>> 0;
+ 31 < b && (b = 31);
+ T(a, c >> b, d >> b)
+};
+W[227] = function(a) {
+ t(a)
+};
+W[228] = function(a) {
+ K(a);
+ D(a);
+ var b = Ye(a);
+ b = new Uint16Array(b.buffer);
+ var c = rf(a);
+ c = new Uint16Array(c.buffer);
+ tf(a, b[0] * c[0] >>> 16 | b[1] * c[1] & 4294901760, b[2] * c[2] >>> 16 | b[3] * c[3] & 4294901760, b[4] * c[4] >>> 16 | b[5] * c[5] & 4294901760, b[6] * c[6] >>> 16 | b[7] * c[7] & 4294901760)
+};
+W[229] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = a.s[2 * (a.f >> 3 & 7)],
+ d = a.s[2 * (a.f >> 3 & 7) + 1];
+ T(a, (c << 16 >> 16) * (b[0] << 16 >> 16) >>> 16 | (c >> 16) * (b[0] >> 16) >>> 16 << 16, (d << 16 >> 16) * (b[1] << 16 >> 16) >>> 16 | (d >> 16) * (b[1] >> 16) >>> 16 << 16)
+};
+W[230] = function(a) {
+ t(a)
+};
+W[231] = function(a) {
+ K(a);
+ D(a);
+ 192 <= a.f && t(a);
+ if (32 == (a.H & 56)) {
+ var b = rf(a),
+ c = F(a, a.f);
+ ue(a, c, b[0], b[1], b[2], b[3])
+ }
+};
+W[232] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = new Int8Array(b.buffer),
+ d = 8 * (a.f >> 3 & 7),
+ e = a.Gd;
+ b = $g(e[d] - c[0]);
+ var f = $g(e[d + 1] - c[1]),
+ h = $g(e[d + 2] - c[2]),
+ g = $g(e[d + 3] - c[3]),
+ p = $g(e[d + 4] - c[4]),
+ r = $g(e[d + 5] - c[5]),
+ v = $g(e[d + 6] - c[6]);
+ c = $g(e[d + 7] - c[7]);
+ T(a, b | f << 8 | h << 16 | g << 24, p | r << 8 | v << 16 | c << 24)
+};
+W[233] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = a.s[2 * (a.f >> 3 & 7)],
+ d = a.s[2 * (a.f >> 3 & 7) + 1],
+ e = Zg((c << 16 >> 16) - (b[0] << 16 >> 16));
+ c = Zg((c >> 16) - (b[0] >> 16));
+ var f = Zg((d << 16 >> 16) - (b[1] << 16 >> 16));
+ b = Zg((d >> 16) - (b[1] >> 16));
+ T(a, e | c << 16, f | b << 16)
+};
+W[234] = function(a) {
+ t(a)
+};
+W[235] = function(a) {
+ K(a);
+ D(a);
+ if (32 === (a.H & 56)) {
+ var b = Ye(a),
+ c = rf(a);
+ tf(a, b[0] | c[0], b[1] | c[1], b[2] | c[2], b[3] | c[3])
+ } else b = P(a), T(a, b[0] | a.s[2 * (a.f >> 3 & 7)], b[1] | a.s[2 * (a.f >> 3 & 7) + 1])
+};
+W[236] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = new Int8Array(b.buffer),
+ d = 8 * (a.f >> 3 & 7),
+ e = a.Gd;
+ b = $g(e[d] + c[0]);
+ var f = $g(e[d + 1] + c[1]),
+ h = $g(e[d + 2] + c[2]),
+ g = $g(e[d + 3] + c[3]),
+ p = $g(e[d + 4] + c[4]),
+ r = $g(e[d + 5] + c[5]),
+ v = $g(e[d + 6] + c[6]);
+ c = $g(e[d + 7] + c[7]);
+ T(a, b | f << 8 | h << 16 | g << 24, p | r << 8 | v << 16 | c << 24)
+};
+W[237] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = a.s[2 * (a.f >> 3 & 7)],
+ d = a.s[2 * (a.f >> 3 & 7) + 1],
+ e = Zg((c << 16 >> 16) + (b[0] << 16 >> 16));
+ c = Zg((c >> 16) + (b[0] >> 16));
+ var f = Zg((d << 16 >> 16) + (b[1] << 16 >> 16));
+ b = Zg((d >> 16) + (b[1] >> 16));
+ T(a, e | c << 16, f | b << 16)
+};
+W[238] = function(a) {
+ t(a)
+};
+W[239] = function(a) {
+ K(a);
+ D(a);
+ if (32 == (a.H & 56)) {
+ var b = Ye(a),
+ c = rf(a);
+ tf(a, b[0] ^ c[0], b[1] ^ c[1], b[2] ^ c[2], b[3] ^ c[3])
+ } else b = P(a), T(a, b[0] ^ a.s[2 * (a.f >> 3 & 7)], b[1] ^ a.s[2 * (a.f >> 3 & 7) + 1])
+};
+W[240] = function(a) {
+ t(a)
+};
+W[241] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = a.s[2 * (a.f >> 3 & 7)],
+ d = a.s[2 * (a.f >> 3 & 7) + 1];
+ b = b[0] >>> 0;
+ var e = 0,
+ f = 0;
+ 15 >= b && (e = (c & 65535) << b & 65535 | c >>> 16 << b << 16, f = (d & 65535) << b & 65535 | d >>> 16 << b << 16);
+ T(a, e, f)
+};
+W[242] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = a.s[2 * (a.f >> 3 & 7)],
+ d = a.s[2 * (a.f >> 3 & 7) + 1];
+ b = b[0] >>> 0;
+ var e = 0,
+ f = 0;
+ 31 >= b && (e = c << b, f = d << b);
+ T(a, e, f)
+};
+W[243] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = a.s[2 * (a.f >> 3 & 7)],
+ d = a.s[2 * (a.f >> 3 & 7) + 1];
+ b = b[0] >>> 0;
+ if (0 !== b) {
+ var e = 0,
+ f = 0;
+ 31 >= b ? (e = c << b, f = d << b | c >>> 32 - b) : 63 >= b && (f = c << (b & 31), e = 0);
+ T(a, e, f)
+ }
+};
+W[244] = function(a) {
+ t(a)
+};
+W[245] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = a.s[2 * (a.f >> 3 & 7)],
+ d = a.s[2 * (a.f >> 3 & 7) + 1];
+ T(a, (c << 16 >> 16) * (b[0] << 16 >> 16) + (c >> 16) * (b[0] >> 16) | 0, (d << 16 >> 16) * (b[1] << 16 >> 16) + (d >> 16) * (b[1] >> 16) | 0)
+};
+W[246] = function(a) {
+ t(a)
+};
+W[247] = function(a) {
+ t(a)
+};
+W[248] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a);
+ b = new Int8Array(b.buffer);
+ var c = 8 * (a.f >> 3 & 7),
+ d = a.Gd;
+ T(a, d[c] - b[0] & 255 | (d[c + 1] - b[1] & 255) << 8 | (d[c + 2] - b[2] & 255) << 16 | (d[c + 3] - b[3] & 255) << 24, d[c + 4] - b[4] & 255 | (d[c + 5] - b[5] & 255) << 8 | (d[c + 6] - b[6] & 255) << 16 | (d[c + 7] - b[7] & 255) << 24)
+};
+W[249] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = a.s[2 * (a.f >> 3 & 7)],
+ d = a.s[2 * (a.f >> 3 & 7) + 1];
+ T(a, c - b[0] & 65535 | ((c >>> 16) - (b[0] >>> 16) & 65535) << 16, d - b[1] & 65535 | ((d >>> 16) - (b[1] >>> 16) & 65535) << 16)
+};
+W[250] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a);
+ T(a, a.s[2 * (a.f >> 3 & 7)] - b[0], a.s[2 * (a.f >> 3 & 7) + 1] - b[1])
+};
+W[251] = function(a) {
+ t(a)
+};
+W[252] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a);
+ b = new Int8Array(b.buffer);
+ var c = 8 * (a.f >> 3 & 7),
+ d = a.Gd;
+ T(a, d[c] + b[0] & 255 | (d[c + 1] + b[1] & 255) << 8 | (d[c + 2] + b[2] & 255) << 16 | (d[c + 3] + b[3] & 255) << 24, d[c + 4] + b[4] & 255 | (d[c + 5] + b[5] & 255) << 8 | (d[c + 6] + b[6] & 255) << 16 | (d[c + 7] + b[7] & 255) << 24)
+};
+W[253] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a),
+ c = a.s[2 * (a.f >> 3 & 7)],
+ d = a.s[2 * (a.f >> 3 & 7) + 1];
+ T(a, c + b[0] & 65535 | ((c >>> 16) + (b[0] >>> 16) & 65535) << 16, d + b[1] & 65535 | ((d >>> 16) + (b[1] >>> 16) & 65535) << 16)
+};
+W[254] = function(a) {
+ K(a);
+ D(a);
+ var b = P(a);
+ T(a, a.s[2 * (a.f >> 3 & 7)] + b[0] | 0, a.s[2 * (a.f >> 3 & 7) + 1] + b[1] | 0)
+};
+W[255] = function(a) {
+ t(a)
+};
+var xh = [],
+ yh = [];
+q.prototype.qk = xh;
+q.prototype.rk = yh;
+for (wh = 0; 256 > wh; wh++) W[wh] ? xh[wh] = yh[wh] = W[wh] : X[wh] && (xh[wh] = X[wh], yh[wh] = Z[wh]);
+
+function Xd(a) {
+ var b = {};
+ a.debug = b;
+ b.Zk = !1;
+ b.Tk = void 0;
+ b.Bk = [];
+ b.$k = !1;
+ b.show = function(a) {
+ if ("undefined" !== typeof document) {
+ var b = document.getElementById("log");
+ if (b) {
+ b.textContent += a + "\n";
+ b.style.display = "block";
+ b.scrollTop = 1E9;
+ return
+ }
+ }
+ console.log(a)
+ };
+ b.Ob = function() {};
+ b.Nk = function() {
+ for (var b = {
+ eax: 0,
+ ecx: 1,
+ edx: 2,
+ ebx: 3,
+ esp: 4,
+ ebp: 5,
+ esi: 6,
+ edi: 7
+ }, d = "eax ecx edx ebx esp ebp esi edi".split(" "), e = "", f = "", h = 0; 4 > h; h++) e += d[h] + "=" + jb(a.Fd[b[d[h]]], 8) + " ", f += d[h + 4] + "=" + jb(a.Fd[b[d[h + 4]]], 8) + " ";
+ e += " ds=" +
+ jb(a.M[3], 4) + " es=" + jb(a.M[0], 4) + " fs=" + jb(a.M[4], 4);
+ f += " gs=" + jb(a.M[5], 4) + " cs=" + jb(a.M[1], 4) + " ss=" + jb(a.M[2], 4);
+ return [e, f]
+ };
+ b.Hk = function() {};
+ b.Fk = function() {};
+ b.Lk = function() {};
+ b.Sa = function() {
+ var b = a.flags & 131072 ? 1 : 0;
+ b = a.ta ? b ? "vm86" : "prot" : "real";
+ var d = ze(a),
+ e = xe(a),
+ f = a.N,
+ h = jb(a.M[1], 4) + ":" + jb(Fe(a) >>> 0, 8),
+ g = jb(a.M[2], 4) + ":" + jb(Ce(a) >>> 0, 8),
+ p = a.C ? "32" : "16",
+ r = a.flags & 512 ? 1 : 0,
+ v = {};
+ v = (v[1] = "c", v[4] = "p", v[16] = "a", v[64] = "z", v[128] = "s", v[256] = "t", v[512] = "i", v[1024] = "d", v[2048] = "o", v);
+ for (var E =
+ "", z = 0; 16 > z; z++) v[1 << z] && (d & 1 << z ? E += v[1 << z] : E += " ");
+ return "mode=" + b + "/" + p + " paging=" + +a.V + " iopl=" + e + " cpl=" + f + " if=" + r + " cs:eip=" + h + " cs_off=" + jb(C(a, 1) >>> 0, 8) + " flgs=" + jb(ze(a) >>> 0, 6) + " (" + E + ") ss:esp=" + g + " ssize=" + +a.qb
+ };
+ b.Jk = function() {};
+ b.Ik = function() {};
+ b.Gk = function() {};
+ b.Dk = function() {};
+ b.Ek = function() {};
+ b.Mk = function() {};
+ b.Rk = function() {};
+ b.al = function() {};
+ b.step = function() {};
+ b.Wk = function() {};
+ b.P = function(a) {
+ a = "Unimplemented" + (a ? ": " + a : "");
+ b.show(a);
+ b.show("Execution stopped");
+ return a
+ };
+ b.Pk = function() {};
+ b.Ck = function() {}
+};
+var zh = DataView.prototype,
+ Ah = {
+ size: 1,
+ get: zh.getUint8,
+ set: zh.setUint8
+ },
+ Eh = {
+ size: 2,
+ get: zh.getUint16,
+ set: zh.setUint16
+ },
+ Fh = {
+ size: 4,
+ get: zh.getUint32,
+ set: zh.setUint32
+ },
+ Hh = Gh([{
+ zi: Fh
+ }, {
+ Rh: Ah
+ }, {
+ data: Ah
+ }, {
+ uk: Ah
+ }, {
+ Uk: Ah
+ }, {
+ yk: Ah
+ }, {
+ Vk: function(a) {
+ return {
+ size: a,
+ get: function() {
+ return -1
+ }
+ }
+ }(7)
+ }, {
+ type: Eh
+ }, {
+ Qk: Eh
+ }, {
+ vk: Fh
+ }, {
+ ii: Fh
+ }, {
+ Fi: Fh
+ }, {
+ mk: Fh
+ }, {
+ flags: Fh
+ }, {
+ di: Eh
+ }, {
+ hh: Eh
+ }, {
+ ih: Eh
+ }, {
+ Gh: Eh
+ }, {
+ Hh: Eh
+ }, {
+ Yk: Eh
+ }]);
+console.assert(52 === Hh.reduce(function(a, b) {
+ return a + b.size
+}, 0));
+var Ih = Gh([{
+ type: Fh
+}, {
+ offset: Fh
+}, {
+ bl: Fh
+}, {
+ Di: Fh
+}, {
+ ki: Fh
+}, {
+ Sk: Fh
+}, {
+ flags: Fh
+}, {
+ align: Fh
+}]);
+console.assert(32 === Ih.reduce(function(a, b) {
+ return a + b.size
+}, 0));
+var Jh = Gh([{
+ name: Fh
+}, {
+ type: Fh
+}, {
+ flags: Fh
+}, {
+ zk: Fh
+}, {
+ offset: Fh
+}, {
+ size: Fh
+}, {
+ link: Fh
+}, {
+ info: Fh
+}, {
+ Ak: Fh
+}, {
+ Kk: Fh
+}]);
+console.assert(40 === Jh.reduce(function(a, b) {
+ return a + b.size
+}, 0));
+
+function Gh(a) {
+ return a.map(function(a) {
+ var b = Object.keys(a);
+ console.assert(1 === b.length);
+ b = b[0];
+ a = a[b];
+ console.assert(0 < a.size);
+ return {
+ name: b,
+ type: a,
+ size: a.size,
+ get: a.get,
+ set: a.set
+ }
+ })
+}
+
+function de(a) {
+ var b = new DataView(a),
+ c = ia(Kh(b, Hh));
+ a = c.next().value;
+ c = c.next().value;
+ console.assert(52 === c);
+ console.assert(1179403647 === a.zi, "Bad magic");
+ console.assert(1 === a.Rh, "Unimplemented: 64 bit elf");
+ console.assert(1 === a.data, "Unimplemented: big endian");
+ console.assert(1 === a.uk, "Bad version0");
+ console.assert(2 === a.type, "Unimplemented type");
+ console.assert(1 === a.vk, "Bad version1");
+ console.assert(52 === a.di, "Bad header size");
+ console.assert(32 === a.hh, "Bad program header size");
+ console.assert(40 ===
+ a.Gh, "Bad section header size");
+ var d = ia(Lh(new DataView(b.buffer, b.byteOffset + a.Fi, a.hh * a.ih), Ih, a.ih));
+ c = d.next().value;
+ d.next();
+ b = ia(Lh(new DataView(b.buffer, b.byteOffset + a.mk, a.Gh * a.Hh), Jh, a.Hh));
+ d = b.next().value;
+ b.next();
+ return {
+ jg: a,
+ ek: c,
+ Xk: d
+ }
+}
+
+function Kh(a, b) {
+ var c = {},
+ d = 0;
+ b = ia(b);
+ for (var e = b.next(); !e.done; e = b.next()) {
+ e = e.value;
+ var f = e.get.call(a, d, !0);
+ console.assert(void 0 === c[e.name]);
+ c[e.name] = f;
+ d += e.size
+ }
+ return [c, d]
+}
+
+function Lh(a, b, c) {
+ for (var d = [], e = 0, f = 0; f < c; f++) {
+ var h = ia(Kh(new DataView(a.buffer, a.byteOffset + e, void 0), b)),
+ g = h.next().value;
+ h = h.next().value;
+ d.push(g);
+ e += h
+ }
+ return [d, e]
+};
+var Aa = 16384,
+ Ca = 4;
+
+function Mh(a) {
+ this.a = [];
+ this.i = [];
+ this.v = a;
+ this.l = this.J = 0;
+ this.m = function() {};
+ this.g = {};
+ this.C = 0;
+ za(this, "", -1)
+}
+
+function ua(a, b, c) {
+ 0 == sa(a, b).status ? c() : a.i.push({
+ id: b,
+ Lh: c
+ })
+}
+
+function Nh(a, b) {
+ 0 == a.l && (a.m = function() {});
+ for (var c = [], d = 0; d < a.i.length; d++) a.i[d].id == b ? a.i[d].Lh() : c.push(a.i[d]);
+ a.i = c
+}
+
+function Oh(a, b) {
+ b = JSON.parse(b);
+ if (2 !== b.version) throw "The filesystem JSON format has changed. Please update your fs2json (https://github.com/copy/fs2json) and recreate the filesystem JSON.";
+ var c = b.fsroot;
+ a.C = b.size;
+ setTimeout(function() {
+ for (var b = 0; b < c.length; b++) Ph(a, c[b], 0);
+ a.m = function() {}
+ }, 0)
+}
+
+function Ph(a, b, c) {
+ var d = va(a);
+ d.name = b[0];
+ d.size = b[1];
+ d.ne = b[2];
+ d.dg = d.ne;
+ d.mf = d.ne;
+ d.mode = b[3];
+ d.uid = b[4];
+ d.pb = b[5];
+ d.va = c;
+ a.a[d.va].Pb++;
+ c = d.mode & 61440;
+ if (c === Aa)
+ for (b = b[6], d.dd = !0, d.Pb = 2, c = a.a.length, wa(a, d), d = 0; d < b.length; d++) Ph(a, b[d], c);
+ else 32768 === c ? (d.status = 2, wa(a, d)) : 40960 === c && (d.ff = b[6], wa(a, d))
+}
+
+function Qh(a, b) {
+ var c = a.a[b];
+ 2 == c.status && (c.status = 3, a.l++, a.v && Rh(a.v + Sh(a, c.Pg), function(a) {
+ a = this.g[b] = new Uint8Array(a);
+ c.size = a.length;
+ c.status = 0;
+ this.l--;
+ Nh(this, b)
+ }.bind(a), function(a) {
+ throw a;
+ }))
+}
+
+function wa(a, b) {
+ if (-1 != b.va) {
+ a.a.push(b);
+ b.Pg = a.a.length - 1;
+ var c = a.a[b.va];
+ c.dd = !0;
+ b.vb = c.ub;
+ c.ub = a.a.length - 1
+ } else 0 == a.a.length && a.a.push(b)
+}
+
+function Th(a) {
+ this.dd = !1;
+ this.vb = this.ub = this.va = -1;
+ this.status = 0;
+ this.name = "";
+ this.ah = this.$g = this.ne = this.mf = this.dg = this.Pg = this.pb = this.uid = this.size = 0;
+ this.ff = "";
+ this.Pb = 1;
+ this.mode = 493;
+ this.lb = {
+ type: 0,
+ version: 0,
+ path: a
+ };
+ this.Pa = void 0
+}
+
+function va(a) {
+ return new Th(++a.J)
+}
+
+function za(a, b, c) {
+ var d = va(a);
+ d.name = b;
+ d.va = c;
+ d.mode = 511 | Aa;
+ d.dd = !0;
+ d.Pb = 2;
+ 0 <= c && (d.uid = a.a[c].uid, d.pb = a.a[c].pb, d.mode = a.a[c].mode & 511 | Aa, a.a[c].Pb++);
+ d.lb.type = Aa >> 8;
+ wa(a, d);
+ return a.a.length - 1
+}
+
+function Ba(a, b, c) {
+ var d = va(a);
+ d.name = b;
+ d.va = c;
+ d.uid = a.a[c].uid;
+ d.pb = a.a[c].pb;
+ a.a[c].Pb++;
+ d.lb.type = 128;
+ d.mode = a.a[c].mode & 438 | 32768;
+ wa(a, d);
+ return a.a.length - 1
+}
+
+function ya(a, b, c, d, e) {
+ var f = va(a);
+ f.name = b;
+ f.va = c;
+ f.$g = d;
+ f.ah = e;
+ f.uid = a.a[c].uid;
+ f.pb = a.a[c].pb;
+ a.a[c].Pb++;
+ f.lb.type = 192;
+ f.mode = a.a[c].mode & 438;
+ wa(a, f);
+ return a.a.length - 1
+}
+
+function xa(a, b, c, d) {
+ var e = va(a);
+ e.name = b;
+ e.va = c;
+ e.uid = a.a[c].uid;
+ e.pb = a.a[c].pb;
+ a.a[c].Pb++;
+ e.lb.type = 160;
+ e.ff = d;
+ e.mode = 40960;
+ wa(a, e);
+ return a.a.length - 1
+}
+
+function Uh(a, b, c, d) {
+ b = Ba(a, b, c);
+ c = a.a[b];
+ (a.g[b] = new Uint8Array(d.length)).set(d);
+ c.size = d.length
+}
+
+function ta(a, b) {
+ var c = sa(a, b);
+ if ((c.mode & 61440) == Aa) {
+ var d = sa(a, b);
+ if (d.dd) {
+ var e = d.va; - 1 == e && (e = 0);
+ for (var f = 0, h = a.a[b].ub; - 1 != h;) f += 24 + Vh(a.a[h].name), h = a.a[h].vb;
+ f = f + 25 + 26;
+ var g = a.g[b] = new Uint8Array(f);
+ d.size = f;
+ f = 0;
+ f += oa(["Q", "d", "b", "s"], [a.a[b].lb, f + 25, a.a[b].mode >> 12, "."], g, f);
+ f += oa(["Q", "d", "b", "s"], [a.a[e].lb, f + 13 + 8 + 1 + 2 + 2, a.a[e].mode >> 12, ".."], g, f);
+ for (h = a.a[b].ub; - 1 != h;) f += oa(["Q", "d", "b", "s"], [a.a[h].lb, f + 13 + 8 + 1 + 2 + Vh(a.a[h].name), a.a[h].mode >> 12, a.a[h].name], g, f), h = a.a[h].vb;
+ d.dd = !1
+ }
+ }
+ return 2 ==
+ c.status ? (Qh(a, b), !1) : !0
+}
+
+function Ia(a, b) {
+ var c = sa(a, b);
+ c.status == Ca && (c.status = -1, delete a.g[b], c.size = 0)
+}
+
+function Fa(a, b, c, d, e) {
+ if (b == d && c == e) return !0;
+ c = Ga(a, b, c);
+ if (-1 == c) return !1;
+ var f = Ga(a, d, e); - 1 != f && Ha(a, f);
+ f = a.a[c];
+ if (a.a[f.va].ub == c) a.a[f.va].ub = f.vb;
+ else {
+ var h = Wh(a, c);
+ a.a[h].vb = f.vb
+ }
+ f.va = d;
+ f.name = e;
+ f.lb.version++;
+ f.vb = a.a[f.va].ub;
+ a.a[f.va].ub = c;
+ a.a[b].dd = !0;
+ a.a[d].dd = !0;
+ a.a[b].Pb--;
+ a.a[d].Pb++;
+ return !0
+}
+
+function Ea(a, b, c, d, e) {
+ var f = a.a[b],
+ h = a.g[b];
+ !h || h.length < c + d ? (Da(a, b, Math.floor(3 * (c + d) / 2)), f.size = c + d, h = a.g[b]) : f.size < c + d && (f.size = c + d);
+ for (a = 0; a < d; a++) h[c + a] = e()
+}
+
+function Ga(a, b, c) {
+ for (b = a.a[b].ub; - 1 != b;) {
+ if (a.a[b].name == c) return b;
+ b = a.a[b].vb
+ }
+ return -1
+}
+
+function Sh(a, b) {
+ for (var c = ""; 0 != b;) c = "/" + a.a[b].name + c, b = a.a[b].va;
+ return c.substring(1)
+}
+
+function Wh(a, b) {
+ var c = sa(a, b);
+ for (c = a.a[c.va].ub; - 1 != c && a.a[c].vb != b;) c = a.a[c].vb;
+ return c
+}
+
+function Ha(a, b) {
+ if (0 == b) return !1;
+ var c = sa(a, b);
+ if ((c.mode & 61440) == Aa && -1 != c.ub) return !1;
+ a.a[c.va].ub == b ? a.a[c.va].ub = c.vb : (b = Wh(a, b), a.a[b].vb = c.vb);
+ a.a[c.va].dd = !0;
+ a.a[c.va].Pb--;
+ c.status = Ca;
+ c.vb = -1;
+ c.ub = -1;
+ c.va = -1;
+ c.Pb--;
+ return !0
+}
+
+function sa(a, b) {
+ return isNaN(b) || 0 > b || b > a.a.length ? 0 : a.a[b]
+}
+
+function Da(a, b, c) {
+ var d = sa(a, b),
+ e = a.g[b];
+ if (c != d.size && (a = a.g[b] = new Uint8Array(c), d.size = c, e))
+ for (c = Math.min(e.length, d.size), d = 0; d < c; d++) a[d] = e[d]
+}
+
+function Xh(a, b) {
+ b = b.replace("//", "/");
+ b = b.split("/");
+ var c = b.length;
+ 0 == b[c - 1].length && b.pop();
+ 0 == b[0].length && b.shift();
+ c = b.length;
+ for (var d = 0, e = -1, f = 0; f < c; f++) {
+ e = Ga(a, d, b[f]);
+ if (-1 == e) return f < c - 1 ? {
+ id: -1,
+ va: -1,
+ name: b[f]
+ } : {
+ id: -1,
+ va: d,
+ name: b[f]
+ };
+ d = e
+ }
+ return {
+ id: e,
+ va: d,
+ name: b[f]
+ }
+}
+
+function Ja(a, b) {
+ a = sa(a, b);
+ if (a.Pa) return a.Pa.length;
+ a.Pa = new Uint8Array(12);
+ a.Pa[0] = 0;
+ a.Pa[1] = 0;
+ a.Pa[2] = 0;
+ a.Pa[3] = 1;
+ a.Pa[4] = 255;
+ a.Pa[5] = 255;
+ a.Pa[6] = 255;
+ a.Pa[7] = 255;
+ a.Pa[8] = 255;
+ a.Pa[9] = 255;
+ a.Pa[10] = 255;
+ a.Pa[11] = 255;
+ return a.Pa.length
+};
+var Rh;
+Rh = "undefined" !== typeof XMLHttpRequest ? function(a, b, c) {
+ var d = new XMLHttpRequest;
+ d.open("GET", a, !0);
+ d.responseType = "arraybuffer";
+ d.onreadystatechange = function() {
+ if (4 == d.readyState)
+ if (200 != d.status && 0 != d.status) c("Error: Could not load file " + a);
+ else {
+ var e = d.response;
+ e ? b(e) : c("Error: No data received from: " + a)
+ }
+ };
+ d.send(null)
+} : function(a, b, c) {
+ require("fs").readFile(a, function(a, e) {
+ a ? c(a) : b((new Uint8Array(e)).buffer)
+ })
+};
+
+function oa(a, b, c, d) {
+ for (var e, f = 0, h = 0; h < a.length; h++) switch (e = b[h], a[h]) {
+ case "w":
+ c[d++] = e & 255;
+ c[d++] = e >> 8 & 255;
+ c[d++] = e >> 16 & 255;
+ c[d++] = e >> 24 & 255;
+ f += 4;
+ break;
+ case "d":
+ c[d++] = e & 255;
+ c[d++] = e >> 8 & 255;
+ c[d++] = e >> 16 & 255;
+ c[d++] = e >> 24 & 255;
+ c[d++] = 0;
+ c[d++] = 0;
+ c[d++] = 0;
+ c[d++] = 0;
+ f += 8;
+ break;
+ case "h":
+ c[d++] = e & 255;
+ c[d++] = e >> 8;
+ f += 2;
+ break;
+ case "b":
+ c[d++] = e;
+ f += 1;
+ break;
+ case "s":
+ var g = d,
+ p = 0;
+ c[d++] = 0;
+ c[d++] = 0;
+ f += 2;
+ for (var r in e) Yh(e.charCodeAt(r)).forEach(function(a) {
+ c[d++] = a;
+ f += 1;
+ p++
+ });
+ c[g + 0] = p & 255;
+ c[g + 1] = p >> 8 & 255;
+ break;
+ case "Q":
+ oa(["b", "w", "d"], [e.type, e.version, e.path], c, d), d += 13, f += 13
+ }
+ return f
+}
+
+function ra(a, b) {
+ for (var c = [], d = 0; d < a.length; d++) switch (a[d]) {
+ case "w":
+ var e = b();
+ e += b() << 8;
+ e += b() << 16;
+ e += b() << 24 >>> 0;
+ c.push(e);
+ break;
+ case "d":
+ e = b();
+ e += b() << 8;
+ e += b() << 16;
+ e += b() << 24 >>> 0;
+ b();
+ b();
+ b();
+ b();
+ c.push(e);
+ break;
+ case "h":
+ e = b();
+ c.push(e + (b() << 8));
+ break;
+ case "b":
+ c.push(b());
+ break;
+ case "s":
+ e = b();
+ e += b() << 8;
+ for (var f = "", h = new Zh, g = 0; g < e; g++) {
+ var p = h.i(b()); - 1 != p && (f += String.fromCharCode(p))
+ }
+ c.push(f)
+ }
+ return c
+};
+
+function Zh() {
+ this.a = new Uint8Array(5);
+ this.g = 0;
+ this.i = function(a) {
+ this.a[this.g] = a;
+ this.g++;
+ switch (this.g) {
+ case 1:
+ if (128 > this.a[0]) return this.g = 0, this.a[0];
+ break;
+ case 2:
+ if (192 == (this.a[0] & 224) && 128 == (this.a[1] & 192)) return this.g = 0, (this.a[0] & 31) << 6 | this.a[1] & 63
+ }
+ return -1
+ }
+}
+
+function Yh(a) {
+ if (128 > a) return [a];
+ if (2048 > a) return [192 | a >> 6 & 31, 128 | a & 63]
+}
+
+function Vh(a) {
+ for (var b = 0, c = 0; c < a.length; c++) b += 128 > a.charCodeAt(c) ? 1 : 2;
+ return b
+};
+
+function $h(a) {
+ function b(a) {
+ !a.altKey && g[56] && f(56, !1);
+ return e(a, !1)
+ }
+
+ function c(a) {
+ !a.altKey && g[56] && f(56, !1);
+ return e(a, !0)
+ }
+
+ function d() {
+ for (var a = Object.keys(g), b, c = 0; c < a.length; c++) b = +a[c], g[b] && f(b, !1);
+ g = {}
+ }
+
+ function e(a, b) {
+ if (p.w && (a.shiftKey && a.ctrlKey && (74 === a.keyCode || 75 === a.keyCode) || !p.g ? 0 : a.target ? "phone_keyboard" === a.target.className || "INPUT" !== a.target.nodeName && "TEXTAREA" !== a.target.nodeName : 1)) {
+ a: {
+ if (void 0 !== a.code) {
+ var c = z[a.code];
+ if (void 0 !== c) break a
+ }
+ c = r[a.keyCode]
+ }
+ if (c) return f(c,
+ b), a.preventDefault && a.preventDefault(), !1;console.log("Missing char in map: " + a.keyCode.toString(16))
+ }
+ }
+
+ function f(a, b) {
+ if (b) g[a] && f(a, !1);
+ else if (!g[a]) return;
+ (g[a] = b) || (a |= 128);
+ 255 < a ? (h(a >> 8), h(a & 255)) : h(a)
+ }
+
+ function h(a) {
+ p.w.send("keyboard-code", a)
+ }
+ var g = {},
+ p = this;
+ this.g = !0;
+ var r = new Uint16Array([0, 0, 0, 0, 0, 0, 0, 0, 14, 15, 0, 0, 0, 28, 0, 0, 42, 29, 56, 0, 58, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 57, 57417, 57425, 57423, 57415, 57419, 57416, 57421, 80, 0, 0, 0, 0, 82, 83, 0, 11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 39, 0, 13, 0, 0, 0, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36,
+ 37, 38, 50, 49, 24, 25, 16, 19, 31, 20, 22, 47, 17, 45, 21, 44, 57435, 57436, 57437, 0, 0, 82, 79, 80, 81, 75, 76, 77, 71, 72, 73, 0, 0, 0, 0, 0, 0, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 87, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 13, 51, 12, 52, 53, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 43, 27, 40, 0, 57435, 57400, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ ]),
+ v = {
+ 10: 13,
+ 32: 32,
+ 39: 222,
+ 44: 188,
+ 45: 189,
+ 46: 190,
+ 47: 191,
+ 48: 48,
+ 49: 49,
+ 50: 50,
+ 51: 51,
+ 52: 52,
+ 53: 53,
+ 54: 54,
+ 55: 55,
+ 56: 56,
+ 57: 57,
+ 59: 186,
+ 61: 187,
+ 91: 219,
+ 92: 220,
+ 93: 221,
+ 96: 192,
+ 97: 65,
+ 98: 66,
+ 99: 67,
+ 100: 68,
+ 101: 69,
+ 102: 70,
+ 103: 71,
+ 104: 72,
+ 105: 73,
+ 106: 74,
+ 107: 75,
+ 108: 76,
+ 109: 77,
+ 110: 78,
+ 111: 79,
+ 112: 80,
+ 113: 81,
+ 114: 82,
+ 115: 83,
+ 116: 84,
+ 117: 85,
+ 118: 86,
+ 119: 87,
+ 120: 88,
+ 121: 89,
+ 122: 90
+ },
+ E = {
+ 33: 49,
+ 34: 222,
+ 35: 51,
+ 36: 52,
+ 37: 53,
+ 38: 55,
+ 40: 57,
+ 41: 48,
+ 42: 56,
+ 43: 187,
+ 58: 186,
+ 60: 188,
+ 62: 190,
+ 63: 191,
+ 64: 50,
+ 65: 65,
+ 66: 66,
+ 67: 67,
+ 68: 68,
+ 69: 69,
+ 70: 70,
+ 71: 71,
+ 72: 72,
+ 73: 73,
+ 74: 74,
+ 75: 75,
+ 76: 76,
+ 77: 77,
+ 78: 78,
+ 79: 79,
+ 80: 80,
+ 81: 81,
+ 82: 82,
+ 83: 83,
+ 84: 84,
+ 85: 85,
+ 86: 86,
+ 87: 87,
+ 88: 88,
+ 89: 89,
+ 90: 90,
+ 94: 54,
+ 95: 189,
+ 123: 219,
+ 124: 220,
+ 125: 221,
+ 126: 192
+ },
+ z = {
+ Escape: 1,
+ Digit1: 2,
+ Digit2: 3,
+ Digit3: 4,
+ Digit4: 5,
+ Digit5: 6,
+ Digit6: 7,
+ Digit7: 8,
+ Digit8: 9,
+ Digit9: 10,
+ Digit0: 11,
+ Minus: 12,
+ Equal: 13,
+ Backspace: 14,
+ Tab: 15,
+ KeyQ: 16,
+ KeyW: 17,
+ KeyE: 18,
+ KeyR: 19,
+ KeyT: 20,
+ KeyY: 21,
+ KeyU: 22,
+ KeyI: 23,
+ KeyO: 24,
+ KeyP: 25,
+ BracketLeft: 26,
+ BracketRight: 27,
+ Enter: 28,
+ ControlLeft: 29,
+ KeyA: 30,
+ KeyS: 31,
+ KeyD: 32,
+ KeyF: 33,
+ KeyG: 34,
+ KeyH: 35,
+ KeyJ: 36,
+ KeyK: 37,
+ KeyL: 38,
+ Semicolon: 39,
+ Quote: 40,
+ Backquote: 41,
+ ShiftLeft: 42,
+ Backslash: 43,
+ KeyZ: 44,
+ KeyX: 45,
+ KeyC: 46,
+ KeyV: 47,
+ KeyB: 48,
+ KeyN: 49,
+ KeyM: 50,
+ Comma: 51,
+ Period: 52,
+ Slash: 53,
+ ShiftRight: 54,
+ NumpadMultiply: 55,
+ AltLeft: 56,
+ Space: 57,
+ CapsLock: 58,
+ F1: 59,
+ F2: 60,
+ F3: 61,
+ F4: 62,
+ F5: 63,
+ F6: 64,
+ F7: 65,
+ F8: 66,
+ F9: 67,
+ F10: 68,
+ NumLock: 69,
+ ScrollLock: 70,
+ Numpad7: 71,
+ Numpad8: 72,
+ Numpad9: 73,
+ NumpadSubtract: 74,
+ Numpad4: 75,
+ Numpad5: 76,
+ Numpad6: 77,
+ NumpadAdd: 78,
+ Numpad1: 79,
+ Numpad2: 80,
+ Numpad3: 81,
+ Numpad0: 82,
+ NumpadDecimal: 83,
+ IntlBackslash: 86,
+ F11: 87,
+ F12: 88,
+ NumpadEnter: 57372,
+ ControlRight: 57373,
+ NumpadDivide: 57397,
+ AltRight: 57400,
+ Home: 57423,
+ ArrowUp: 57416,
+ PageUp: 57417,
+ ArrowLeft: 57419,
+ ArrowRight: 57421,
+ End: 57423,
+ ArrowDown: 57424,
+ PageDown: 57425,
+ Insert: 57426,
+ Delete: 57427,
+ OSLeft: 57435,
+ OSRight: 57436,
+ ContextMenu: 57437
+ };
+ this.w = a;
+ this.Mb = function() {
+ "undefined" !== typeof window && (window.removeEventListener("keyup", b, !1), window.removeEventListener("keydown", c, !1), window.removeEventListener("blur", d, !1))
+ };
+ this.Ob = function() {
+ "undefined" !== typeof window && (this.Mb(), window.addEventListener("keyup", b, !1), window.addEventListener("keydown", c, !1), window.addEventListener("blur", d, !1))
+ };
+ this.Ob();
+ this.a = function(a) {
+ a = {
+ keyCode: a
+ };
+ e(a, !0);
+ e(a, !1)
+ };
+ this.i = function(a) {
+ var b = a.charCodeAt(0);
+ b in v ? this.a(v[b]) : b in E ? (h(42), this.a(E[b]), h(170)) : console.log("ascii -> keyCode not found: ", b, a)
+ }
+};
+
+function ai(a, b) {
+ function c(a) {
+ if (Y.enabled && Y.a)
+ if ("mousemove" === a.type || "touchmove" === a.type) a = !0;
+ else if ("mousewheel" === a.type || "DOMMouseScroll" === a.type) a: {
+ for (a = a.target; a.parentNode;) {
+ if (a === (b || document.body)) {
+ a = !0;
+ break a
+ }
+ a = a.parentNode
+ }
+ a = !1
+ }
+ else a = !a.target || "INPUT" !== a.target.nodeName && "TEXTAREA" !== a.target.nodeName;
+ else a = !1;
+ return a
+ }
+
+ function d(a) {
+ c(a) && (a = a.changedTouches) && a.length && (a = a[a.length - 1], A = a.clientX, M = a.clientY)
+ }
+
+ function e() {
+ if (v || z || E) Y.w.send("mouse-click", [!1, !1, !1]), v =
+ z = E = !1
+ }
+
+ function f(a) {
+ if (Y.w && c(a)) {
+ var d = 0,
+ e = 0,
+ f = a.changedTouches;
+ f ? f.length && (f = f[f.length - 1], d = f.clientX - A, e = f.clientY - M, A = f.clientX, M = f.clientY, a.preventDefault()) : "number" === typeof a.movementX ? (d = a.movementX, e = a.movementY) : "number" === typeof a.webkitMovementX ? (d = a.webkitMovementX, e = a.webkitMovementY) : "number" === typeof a.mozMovementX ? (d = a.mozMovementX, e = a.mozMovementY) : (d = a.clientX - A, e = a.clientY - M, A = a.clientX, M = a.clientY);
+ Y.w.send("mouse-delta", [.15 * d, -(.15 * e)]);
+ Y.w.send("mouse-absolute", [a.pageX -
+ b.offsetLeft, a.pageY - b.offsetTop, b.offsetWidth, b.offsetHeight
+ ])
+ }
+ }
+
+ function h(a) {
+ c(a) && p(a, !0)
+ }
+
+ function g(a) {
+ c(a) && p(a, !1)
+ }
+
+ function p(a, b) {
+ Y.w && (1 === a.which ? v = b : 2 === a.which ? z = b : 3 === a.which ? E = b : console.log("Unknown event.which: " + a.which), Y.w.send("mouse-click", [v, z, E]))
+ }
+
+ function r(a) {
+ if (c(a)) {
+ var b = a.wheelDelta || -a.detail;
+ 0 > b ? b = -1 : 0 < b && (b = 1);
+ Y.w.send("mouse-wheel", [b, 0]);
+ a.preventDefault()
+ }
+ }
+ var v = !1,
+ E = !1,
+ z = !1,
+ A = 0,
+ M = 0,
+ Y = this;
+ this.enabled = !1;
+ this.a = !0;
+ this.w = a;
+ this.w.register("mouse-enable", function(a) {
+ this.enabled =
+ a
+ }, this);
+ this.Mb = function() {
+ window.removeEventListener("touchstart", d, !1);
+ window.removeEventListener("touchend", e, !1);
+ window.removeEventListener("touchmove", f, !1);
+ window.removeEventListener("mousemove", f, !1);
+ window.removeEventListener("mousedown", h, !1);
+ window.removeEventListener("mouseup", g, !1);
+ window.removeEventListener("DOMMouseScroll", r, !1);
+ window.removeEventListener("mousewheel", r, !1)
+ };
+ this.Ob = function() {
+ "undefined" !== typeof window && (this.Mb(), window.addEventListener("touchstart", d, !1), window.addEventListener("touchend",
+ e, !1), window.addEventListener("touchmove", f, !1), window.addEventListener("mousemove", f, !1), window.addEventListener("mousedown", h, !1), window.addEventListener("mouseup", g, !1), window.addEventListener("DOMMouseScroll", r, !1), window.addEventListener("mousewheel", r, !1))
+ };
+ this.Ob()
+};
+
+function bi(a) {
+ "undefined" !== typeof window && (window.AudioContext || window.webkitAudioContext ? (this.w = a, this.Kb = new(window.AudioContext || window.webkitAudioContext), this.a = this.Kb.createGain(), this.a.gain.setValueAtTime(0, this.Kb.currentTime), this.a.connect(this.Kb.destination), this.Zd = this.Kb.createOscillator(), this.Zd.type = "square", this.Zd.frequency.setValueAtTime(440, this.Kb.currentTime), this.Zd.connect(this.a), this.Zd.start(), this.zg = this.g = !1, this.Yd = 440, this.jh = !1, this.cg = !0, this.de = this.Kb.createScriptProcessor(2048,
+ 0, 2), this.de.onaudioprocess = this.i.bind(this), this.de.connect(this.Kb.destination), this.Gg = new Float32Array(this.de.bufferSize), this.Hg = new Float32Array(this.de.bufferSize), this.Ie = !0, a.register("emulator-stopped", function() {
+ this.cg = !1;
+ ci(this)
+ }, this), a.register("emulator-started", function() {
+ this.cg = !0;
+ ci(this)
+ }, this), a.register("pcspeaker-enable", function(a) {
+ this.zg = a;
+ ci(this)
+ }, this), a.register("pcspeaker-update", function(a) {
+ var b = a[1];
+ this.jh = 3 == a[0];
+ this.Yd = 1193181.6665999999 / b;
+ this.Yd = Math.min(this.Yd,
+ this.Zd.frequency.maxValue);
+ this.Yd = Math.max(this.Yd, 0);
+ ci(this)
+ }, this), a.register("speaker-update-data", function(a) {
+ this.Gg = a[0];
+ this.Hg = a[1]
+ }, this), a.register("speaker-request-samplerate", function() {
+ a.send("speaker-tell-samplerate", this.Kb.sampleRate)
+ }, this), a.send("speaker-tell-samplerate", this.Kb.sampleRate), a.register("speaker-update-enable", function(a) {
+ this.Ie && !a ? (this.de.disconnect(this.Kb.destination), this.Ie = !1) : !this.Ie && a && (this.de.connect(this.Kb.destination), this.Ie = !0)
+ }, this)) : console.warn("Web browser doesn't support Web Audio API"))
+}
+
+function ci(a) {
+ var b = a.Kb.currentTime;
+ a.jh && a.zg && a.cg ? (a.Zd.frequency.setValueAtTime(a.Yd, b), a.g || (a.a.gain.setValueAtTime(.05, b), a.g = !0)) : a.g && (a.a.gain.setValueAtTime(0, b), a.g = !1)
+}
+bi.prototype.i = function(a) {
+ this.Ie && (a = a.outputBuffer, a.copyToChannel(this.Gg, 0), a.copyToChannel(this.Hg, 1), this.w.send("speaker-request-data", a.length))
+};
+
+function di(a, b) {
+ function c(a) {
+ h.w && h.enabled && (h.i(a.which), a.preventDefault())
+ }
+
+ function d(a) {
+ var b = a.which;
+ 8 === b ? (h.i(127), a.preventDefault()) : 9 === b && (h.i(9), a.preventDefault())
+ }
+
+ function e(a) {
+ if (h.enabled) {
+ for (var b = a.clipboardData.getData("text/plain"), c = 0; c < b.length; c++) h.i(b.charCodeAt(c));
+ a.preventDefault()
+ }
+ }
+
+ function f(b) {
+ b.target !== a && a.blur()
+ }
+ var h = this;
+ this.enabled = !0;
+ this.w = b;
+ this.a = "";
+ this.m = !1;
+ this.l = 0;
+ this.w.register("serial0-output-char", function(a) {
+ this.nk(a)
+ }, this);
+ this.Mb = function() {
+ a.removeEventListener("keypress",
+ c, !1);
+ a.removeEventListener("keydown", d, !1);
+ a.removeEventListener("paste", e, !1);
+ window.removeEventListener("mousedown", f, !1)
+ };
+ this.Ob = function() {
+ this.Mb();
+ a.addEventListener("keypress", c, !1);
+ a.addEventListener("keydown", d, !1);
+ a.addEventListener("paste", e, !1);
+ window.addEventListener("mousedown", f, !1)
+ };
+ this.Ob();
+ this.nk = function(a) {
+ "\b" === a ? (this.a = this.a.slice(0, -1), this.v()) : "\r" !== a && (this.a += a, "\n" === a && (this.m = !0), this.v())
+ };
+ this.v = function() {
+ var a = this,
+ b = Date.now(),
+ c = b - this.l;
+ 16 > c ? void 0 === this.g &&
+ (this.g = setTimeout(function() {
+ a.g = void 0;
+ a.l = Date.now();
+ a.C()
+ }, 16 - c)) : (void 0 !== this.g && (clearTimeout(this.g), this.g = void 0), this.l = b, this.C())
+ };
+ this.C = function() {
+ a.value = this.a;
+ this.m && (this.m = !1, a.scrollTop = 1E9)
+ };
+ this.i = function(a) {
+ h.w && h.w.send("serial0-input", a)
+ }
+};
+
+function ei(a, b) {
+ this.w = b;
+ this.a = void 0;
+ this.g = [];
+ this.url = a;
+ this.i = Date.now() - 1E4;
+ this.w.register("net0-send", function(a) {
+ this.send(a)
+ }, this)
+}
+k = ei.prototype;
+k.pi = function(a) {
+ this.w && this.w.send("net0-receive", new Uint8Array(a.data))
+};
+k.Vg = function() {
+ this.connect();
+ setTimeout(this.connect.bind(this), 1E4)
+};
+k.ri = function() {
+ for (var a = 0; a < this.g.length; a++) this.send(this.g[a]);
+ this.g = []
+};
+k.oi = function() {};
+k.Mb = function() {
+ this.a && this.a.close()
+};
+k.connect = function() {
+ if (this.a) {
+ var a = this.a.readyState;
+ if (0 === a || 1 === a) return
+ }
+ if (!(this.i + 1E4 > Date.now())) {
+ this.i = Date.now();
+ try {
+ this.a = new WebSocket(this.url)
+ } catch (b) {
+ this.Vg(void 0);
+ return
+ }
+ this.a.binaryType = "arraybuffer";
+ this.a.onopen = this.ri.bind(this);
+ this.a.onmessage = this.pi.bind(this);
+ this.a.onclose = this.Vg.bind(this);
+ this.a.onerror = this.oi.bind(this)
+ }
+};
+k.send = function(a) {
+ this.a && 1 === this.a.readyState ? this.a.send(a) : (this.g.push(a), 128 < this.g.length && (this.g = this.g.slice(-64)), this.connect())
+};
+(function() {
+ function a(a, b) {
+ var c = new XMLHttpRequest;
+ c.open(b.method || "get", a, !0);
+ b.De || (c.responseType = "arraybuffer");
+ if (b.headers)
+ for (var d = Object.keys(b.headers), e = 0; e < d.length; e++) {
+ var f = d[e];
+ c.setRequestHeader(f, b.headers[f])
+ }
+ b.re && (d = b.re.start, c.setRequestHeader("Range", "bytes=" + d + "-" + (d + b.re.length - 1)));
+ c.onload = function() {
+ 4 === c.readyState && (200 !== c.status && 206 !== c.status ? console.error("Loading the image `" + a + "` failed (status %d)", c.status) : c.response && b.done && b.done(c.response, c))
+ };
+ b.sh &&
+ (c.onprogress = function(a) {
+ b.sh(a)
+ });
+ c.send(null)
+ }
+
+ function b(a, b) {
+ var c = require("fs");
+ b.re ? c.open(a, "r", function(a, d) {
+ if (a) throw a;
+ a = b.re.length;
+ var e = new global.Buffer(a);
+ c.read(d, e, 0, a, b.re.start, function(a) {
+ if (a) throw a;
+ b.done && b.done(new Uint8Array(e));
+ c.close(d, function(a) {
+ if (a) throw a;
+ })
+ })
+ }) : c.readFile(a, {
+ encoding: b.De ? "utf-8" : null
+ }, function(c, d) {
+ c ? console.log("Could not read file:", a, c) : (c = d, b.De || (c = (new Uint8Array(c)).buffer), b.done(c))
+ })
+ }
+
+ function c(a, b) {
+ this.filename = a;
+ this.a = 256;
+ this.byteLength =
+ b;
+ this.g = {};
+ this.onload = void 0
+ }
+
+ function d(a) {
+ this.a = a;
+ this.byteLength = a.size;
+ 1073741824 < a.size && console.warn("SyncFileBuffer: Allocating buffer of " + (a.size >> 20) + " MB ...");
+ this.buffer = new ArrayBuffer(a.size);
+ this.onload = void 0
+ }
+
+ function e(a) {
+ this.i = a;
+ this.byteLength = a.size;
+ this.a = 256;
+ this.g = {};
+ this.onload = void 0
+ }
+ "undefined" === typeof XMLHttpRequest ? gb = b : gb = a;
+ hb = c;
+ ib = e;
+ Ma = d;
+ var f = "undefined" === typeof XMLHttpRequest ? function(a, b) {
+ require("fs").stat(a, function(a, c) {
+ a ? b(a) : b(null, c.size)
+ })
+ } : function(a,
+ b) {
+ gb(a, {
+ done: function(a, c) {
+ a = c.getResponseHeader("Content-Range") || "";
+ (c = a.match(/\/(\d+)\s*$/)) ? b(null, +c[1]): b({
+ jg: a
+ })
+ },
+ headers: {
+ Range: "bytes=0-0"
+ }
+ })
+ };
+ c.prototype.load = function() {
+ var a = this;
+ void 0 !== this.byteLength ? this.onload && this.onload({}) : f(this.filename, function(b, c) {
+ b ? console.assert(!1, "Cannot use: " + a.filename + ". `Range: bytes=...` header not supported (Got `" + b.jg + "`)") : (a.byteLength = c, a.onload && a.onload({}))
+ })
+ };
+ c.prototype.i = function(a, b) {
+ var c = b / this.a;
+ a /= this.a;
+ for (var d = 0; d < c; d++)
+ if (!this.g[a +
+ d]) return;
+ if (1 === c) return this.g[a];
+ b = new Uint8Array(b);
+ for (d = 0; d < c; d++) b.set(this.g[a + d], d * this.a);
+ return b
+ };
+ c.prototype.get = function(a, b, c) {
+ console.assert(a + b <= this.byteLength);
+ console.assert(0 === a % this.a);
+ console.assert(0 === b % this.a);
+ console.assert(b);
+ var d = this.i(a, b, c);
+ d ? c(d) : gb(this.filename, {
+ done: function(d) {
+ d = new Uint8Array(d);
+ this.l(a, b, d);
+ c(d)
+ }.bind(this),
+ re: {
+ start: a,
+ length: b
+ }
+ })
+ };
+ c.prototype.set = function(a, b, c) {
+ console.assert(a + b.byteLength <= this.byteLength);
+ var d = b.length;
+ console.assert(0 ===
+ a % this.a);
+ console.assert(0 === d % this.a);
+ console.assert(d);
+ a /= this.a;
+ d /= this.a;
+ for (var e = 0; e < d; e++) {
+ var f = this.g[a + e];
+ void 0 === f && (f = this.g[a + e] = new Uint8Array(this.a));
+ var g = b.subarray(e * this.a, (e + 1) * this.a);
+ f.set(g);
+ console.assert(f.byteLength === g.length)
+ }
+ c()
+ };
+ c.prototype.l = function(a, b, c) {
+ a /= this.a;
+ b /= this.a;
+ for (var d = 0; d < b; d++) {
+ var e = this.g[a + d];
+ e && c.set(e, d * this.a)
+ }
+ };
+ c.prototype.Se = function(a) {
+ a()
+ };
+ d.prototype.load = function() {
+ this.g(0)
+ };
+ d.prototype.g = function(a) {
+ var b = new FileReader;
+ b.onload = function(b) {
+ b =
+ new Uint8Array(b.target.result);
+ (new Uint8Array(this.buffer, a)).set(b);
+ this.g(a + 4194304)
+ }.bind(this);
+ a < this.byteLength ? b.readAsArrayBuffer(this.a.slice(a, Math.min(a + 4194304, this.byteLength))) : (this.a = void 0, this.onload && this.onload({
+ buffer: this.buffer
+ }))
+ };
+ d.prototype.get = function(a, b, c) {
+ console.assert(a + b <= this.byteLength);
+ c(new Uint8Array(this.buffer, a, b))
+ };
+ d.prototype.set = function(a, b, c) {
+ console.assert(a + b.byteLength <= this.byteLength);
+ (new Uint8Array(this.buffer, a, b.byteLength)).set(b);
+ c()
+ };
+ d.prototype.Se =
+ function(a) {
+ a(this.buffer)
+ };
+ e.prototype.load = function() {
+ this.onload && this.onload({})
+ };
+ e.prototype.get = function(a, b, c) {
+ console.assert(0 === a % this.a);
+ console.assert(0 === b % this.a);
+ console.assert(b);
+ var d = this.l(a, b, c);
+ d ? c(d) : (d = new FileReader, d.onload = function(d) {
+ d = new Uint8Array(d.target.result);
+ this.m(a, b, d);
+ c(d)
+ }.bind(this), d.readAsArrayBuffer(this.i.slice(a, a + b)))
+ };
+ e.prototype.l = c.prototype.i;
+ e.prototype.set = c.prototype.set;
+ e.prototype.m = c.prototype.l;
+ e.prototype.Se = function(a) {
+ a()
+ };
+ e.prototype.Tg =
+ function(a) {
+ for (var b = [], c = Object.keys(this.g).map(Number).sort(function(a, b) {
+ return a - b
+ }), d = 0, e = 0; e < c.length; e++) {
+ var f = c[e],
+ h = this.g[f];
+ f *= this.a;
+ console.assert(f >= d);
+ f !== d && (b.push(this.i.slice(d, f)), d = f);
+ b.push(h);
+ d += h.length
+ }
+ d !== this.i.size && b.push(this.i.slice(d));
+ a = new File(b, a);
+ console.assert(a.size === this.i.size);
+ return a
+ }
+})();
+
+function l(a) {
+ function b(a, b) {
+ switch (a) {
+ case "hda":
+ g.Ma = this.kd.hda = b;
+ break;
+ case "hdb":
+ g.zf = this.kd.hdb = b;
+ break;
+ case "cdrom":
+ g.Qa = this.kd.cdrom = b;
+ break;
+ case "fda":
+ g.Ra = this.kd.fda = b;
+ break;
+ case "fdb":
+ g.Ng = this.kd.fdb = b;
+ break;
+ case "multiboot":
+ g.oe = this.kd.multiboot = b;
+ break;
+ case "bios":
+ g.$d = b.buffer;
+ break;
+ case "vga_bios":
+ g.wk = b.buffer;
+ break;
+ case "initial_state":
+ g.ke = b.buffer;
+ break;
+ case "fs9p_json":
+ g.Rg = b.buffer
+ }
+ }
+
+ function c(a, b) {
+ if (b)
+ if (b.get && b.set && b.load) p.push({
+ name: a,
+ vd: b
+ });
+ else {
+ b = {
+ buffer: b.buffer,
+ async: b.async,
+ url: b.url,
+ size: b.size
+ };
+ if ("bios" === a || "vga_bios" === a || "initial_state" === a || "multiboot" === a) b.async = !1;
+ b.buffer instanceof ArrayBuffer ? (b = new nb(b.buffer), p.push({
+ name: a,
+ vd: b
+ })) : "undefined" !== typeof File && b.buffer instanceof File ? (void 0 === b.async && (b.async = 268435456 <= b.buffer.size), b = b.async ? new ib(b.buffer) : new Ma(b.buffer), p.push({
+ name: a,
+ vd: b
+ })) : b.url && (b.async ? (b = new hb(b.url, b.size), p.push({
+ name: a,
+ vd: b
+ })) : p.push({
+ name: a,
+ url: b.url,
+ size: b.size
+ }))
+ }
+ }
+
+ function d() {
+ g.ke && (g.Ia = 0);
+ this.w.send("cpu-init",
+ g);
+ setTimeout(function() {
+ g.ke && h.Hd(g.ke);
+ setTimeout(function() {
+ g.Pc && g.Rg && Oh(g.Pc, g.Rg);
+ a.autostart && this.w.send("cpu-run")
+ }.bind(this), 0)
+ }.bind(this), 0)
+ }
+ this.Ge = !1;
+ var e = Vd(),
+ f = this.w = e[0];
+ this.l = e[1];
+ var h = this.a = new Ya(this.l);
+ this.w.register("emulator-stopped", function() {
+ this.Ge = !1
+ }, this);
+ this.w.register("emulator-started", function() {
+ this.Ge = !0
+ }, this);
+ var g = {};
+ this.kd = {
+ fda: void 0,
+ fdb: void 0,
+ hda: void 0,
+ hdb: void 0,
+ cdrom: void 0
+ };
+ g.yi = !0;
+ g.Ia = a.memory_size || 67108864;
+ g.Ja = a.vga_memory_size || 8388608;
+ g.ae = a.boot_order || 531;
+ g.ji = a.fastboot || !1;
+ g.Ra = void 0;
+ g.Ng = void 0;
+ a.network_relay_url && (new ei(a.network_relay_url, f), g.hi = !0);
+ a.disable_keyboard || (this.i = new $h(f));
+ a.disable_mouse || (this.m = new ai(f, a.screen_container));
+ a.screen_container ? this.g = new Ka(a.screen_container, f) : a.screen_dummy && (this.g = new fi(f));
+ a.serial_container && new di(a.serial_container, f);
+ a.disable_speaker || new bi(f);
+ var p = [];
+ e = "bios vga_bios cdrom hda hdb fda fdb initial_state multiboot".split(" ");
+ for (f = 0; f < e.length; f++) c(e[f],
+ a[e[f]]);
+ if (a.filesystem && (e = a.filesystem.basefs, f = a.filesystem.baseurl, this.Pc = new Mh(f), g.Pc = this.Pc, e)) {
+ console.assert(f, "Filesystem: baseurl must be specified");
+ if ("object" === typeof e) {
+ var r = e.size;
+ e = e.url
+ }
+ p.push({
+ name: "fs9p_json",
+ url: e,
+ size: r,
+ De: !0
+ })
+ }
+ var v = this,
+ E = p.length,
+ z = function(a) {
+ if (a === E) setTimeout(d.bind(this), 0);
+ else {
+ var c = p[a];
+ c.vd ? (c.vd.onload = function() {
+ b.call(this, c.name, c.vd);
+ z(a + 1)
+ }.bind(this), c.vd.load()) : gb(c.url, {
+ done: function(d) {
+ b.call(this, c.name, new nb(d));
+ z(a + 1)
+ }.bind(this),
+ sh: function(b) {
+ 200 === b.target.status ? v.l.send("download-progress", {
+ vf: a,
+ uf: E,
+ Qg: c.url,
+ lengthComputable: b.lengthComputable,
+ total: b.total || c.size,
+ loaded: b.loaded
+ }) : v.l.send("download-error", {
+ vf: a,
+ uf: E,
+ Qg: c.url,
+ request: b.target
+ })
+ },
+ De: c.De
+ })
+ }
+ }.bind(this);
+ z(0)
+}
+l.prototype.cf = function() {
+ this.w.send("cpu-run")
+};
+l.prototype.run = l.prototype.cf;
+l.prototype.stop = function() {
+ this.w.send("cpu-stop")
+};
+l.prototype.stop = l.prototype.stop;
+l.prototype.Mb = function() {
+ this.i.Mb()
+};
+l.prototype.destroy = l.prototype.Mb;
+l.prototype.Sf = function() {
+ this.w.send("cpu-restart")
+};
+l.prototype.restart = l.prototype.Sf;
+l.prototype.$a = function(a, b) {
+ this.w.register(a, b, this)
+};
+l.prototype.add_listener = l.prototype.$a;
+l.prototype.ik = function(a, b) {
+ this.w.unregister(a, b)
+};
+l.prototype.remove_listener = l.prototype.ik;
+l.prototype.Hd = function(a) {
+ this.a.Hd(a)
+};
+l.prototype.restore_state = l.prototype.Hd;
+l.prototype.we = function(a) {
+ setTimeout(function() {
+ try {
+ a(null, this.a.we())
+ } catch (b) {
+ a(b, null)
+ }
+ }.bind(this), 0)
+};
+l.prototype.save_state = l.prototype.we;
+l.prototype.ni = function() {
+ console.warn("V86Starter.prototype.get_statistics is deprecated. Use events instead.");
+ var a = {
+ j: {
+ Ok: this.ig()
+ }
+ };
+ if (!this.a) return a;
+ var b = this.a.j.G;
+ b.Ma && (a.Ma = b.Ma.Oa);
+ b.Qa && (a.Qa = b.Qa.Oa);
+ b.Of && (a.mouse = {
+ enabled: b.Of.ed
+ });
+ b.Pd && (a.vga = {
+ is_graphical: b.Pd.Oa.lg
+ });
+ return a
+};
+l.prototype.get_statistics = l.prototype.ni;
+l.prototype.ig = function() {
+ return this.a ? this.a.j.Y : 0
+};
+l.prototype.get_instruction_counter = l.prototype.ig;
+l.prototype.vi = function() {
+ return this.Ge
+};
+l.prototype.is_running = l.prototype.vi;
+l.prototype.Cf = function(a) {
+ for (var b = 0; b < a.length; b++) this.w.send("keyboard-code", a[b])
+};
+l.prototype.keyboard_send_scancodes = l.prototype.Cf;
+l.prototype.wi = function(a) {
+ for (var b = 0; b < a.length; b++) this.i.a(a[b])
+};
+l.prototype.keyboard_send_keys = l.prototype.wi;
+l.prototype.Xg = function(a) {
+ for (var b = 0; b < a.length; b++) this.i.i(a[b])
+};
+l.prototype.keyboard_send_text = l.prototype.Xg;
+l.prototype.Ch = function() {
+ this.g && this.g.i()
+};
+l.prototype.screen_make_screenshot = l.prototype.Ch;
+l.prototype.Dh = function(a, b) {
+ this.g && this.g.a(a, b)
+};
+l.prototype.screen_set_scale = l.prototype.Dh;
+l.prototype.Bh = function() {
+ if (this.g) {
+ var a = document.getElementById("screen_container");
+ if (a) {
+ var b = a.requestFullScreen || a.webkitRequestFullscreen || a.mozRequestFullScreen || a.msRequestFullScreen;
+ b && (b.call(a), (a = document.getElementsByClassName("phone_keyboard")[0]) && a.focus());
+ this.Df()
+ }
+ }
+};
+l.prototype.screen_go_fullscreen = l.prototype.Bh;
+l.prototype.Df = function() {
+ var a = document.body,
+ b = a.requestPointerLock || a.mozRequestPointerLock || a.webkitRequestPointerLock;
+ b && b.call(a)
+};
+l.prototype.lock_mouse = l.prototype.Df;
+l.prototype.xi = function(a) {
+ this.i && (this.i.g = a)
+};
+l.prototype.keyboard_set_status = l.prototype.xi;
+l.prototype.lk = function(a) {
+ for (var b = 0; b < a.length; b++) this.w.send("serial0-input", a.charCodeAt(b))
+};
+l.prototype.serial0_send = l.prototype.lk;
+l.prototype.Eg = function(a, b, c) {
+ var d = this.Pc;
+ if (d) {
+ var e = a.split("/");
+ e = e[e.length - 1];
+ a = Xh(d, a).va;
+ var f = "" === e || -1 === a;
+ f || Uh(d, e, a, b);
+ c && setTimeout(function() {
+ f ? c(new gi) : c(null)
+ }, 0)
+ }
+};
+l.prototype.create_file = l.prototype.Eg;
+l.prototype.vh = function(a, b) {
+ var c = this.Pc;
+ if (c) {
+ var d = Xh(c, a).id; - 1 === d ? b(new gi, null) : (ta(c, d), ua(c, d, function() {
+ var a = c.g[d];
+ a ? b(null, a.subarray(0, c.a[d].size)) : b(new gi, null)
+ }))
+ }
+};
+l.prototype.read_file = l.prototype.vh;
+
+function gi() {
+ this.message = "File not found"
+}
+gi.prototype = Error.prototype;
+"undefined" !== typeof window ? (window.V86Starter = l, window.V86 = l) : "undefined" !== typeof module && "undefined" !== typeof module.exports ? (module.exports.V86Starter = l, module.exports.V86 = l) : "function" === typeof importScripts && (self.V86Starter = l, self.V86 = l);
+
+function fi(a) {
+ var b, c, d, e, f, h, g;
+ this.w = a;
+ a.register("screen-set-mode", function(a) {
+ this.wg(a)
+ }, this);
+ a.register("screen-fill-buffer-end", function(a) {
+ this.yg(a[0])
+ }, this);
+ a.register("screen-put-char", function(a) {
+ this.qg(a[0], a[1], a[2], a[3], a[4])
+ }, this);
+ a.register("screen-text-scroll", function(a) {
+ console.log("scroll", a)
+ }, this);
+ a.register("screen-update-cursor", function(a) {
+ this.Nd(a[0], a[1])
+ }, this);
+ a.register("screen-update-cursor-scanline", function(a) {
+ this.Od(a[0], a[1])
+ }, this);
+ a.register("screen-set-size-text",
+ function(a) {
+ this.Jd(a[0], a[1])
+ }, this);
+ a.register("screen-set-size-graphical", function(a) {
+ this.Id(a[0], a[1])
+ }, this);
+ this.qg = function(a, b, c, d, e) {
+ a < g && b < h && (a = 3 * (a * h + b), f[a] = c, f[a + 1] = d, f[a + 2] = e)
+ };
+ this.Mb = function() {};
+ this.wg = function() {};
+ this.Dg = function() {};
+ this.Jd = function(a, b) {
+ if (a !== h || b !== g) f = new Int32Array(a * b * 3), h = a, g = b
+ };
+ this.Id = function(a, d) {
+ b = new Uint8Array(4 * a * d);
+ c = new Int32Array(b.buffer);
+ this.w.send("screen-tell-buffer", [c], [c.buffer])
+ };
+ this.a = function() {};
+ this.Od = function() {};
+ this.Nd = function(a,
+ b) {
+ if (a !== d || b !== e) d = a, e = b
+ };
+ this.yg = function() {}
+};
+//# sourceMappingURL=v86_all.js.map \ No newline at end of file
diff --git a/python/index.html b/python/index.html
new file mode 100644
index 0000000..15624ae
--- /dev/null
+++ b/python/index.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>[AN] - Server administration</title>
+ <link rel="stylesheet" type="text/css" media="all" href="/static/codemirror.css">
+ <link rel="stylesheet" type="text/css" media="all" href="/static/solarized.css">
+ <link rel="stylesheet" type="text/css" media="all" href="/static/main.css">
+ <link rel="stylesheet" type="text/css" media="all" href="/static/bulma.min.css">
+ <script src="/static/jquery.min.js" type="text/javascript"> </script>
+ <script src="/static/codemirrorepl.min.js" type="text/javascript"></script>
+ <script src="/static/repl.js" type="text/javascript"></script>
+ <script src="/static/python.min.js" type="text/javascript"></script>
+ <script src="/static/skulpt.min.js" type="text/javascript"></script>
+ <script src="/static/skulpt-stdlib.min.js" type="text/javascript"></script>
+ <script src="/static/mgt.js" type="text/javascript"></script>
+ </head>
+ <body>
+ <nav class="navbar is-dark" role="navigation" aria-label="main navigation">
+ <div class="navbar-brand">
+ <div class="navbar-item">
+ <img src="/static/logo.png" />
+ </div>
+ <div class="navbar-item">
+ <span id="hd">[AN] - Server administration - python shell</span>
+ </div>
+ </div>
+ </nav>
+<textarea id="interactive" cols="85" rows="1"></textarea>
+</body>
+</html> \ No newline at end of file
diff --git a/rescue/index.html b/rescue/index.html
new file mode 100644
index 0000000..267121b
--- /dev/null
+++ b/rescue/index.html
@@ -0,0 +1,212 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>[AN] - Server administration</title>
+ <link rel="stylesheet" type="text/css" media="all" href="/static/v86.css">
+ <link rel="stylesheet" type="text/css" media="all" href="/static/bulma.min.css">
+ <script src="/static/v86_all.min.js" type="text/javascript"></script>
+ <script src="/static/mgt.js" type="text/javascript"></script>
+ </head>
+ <body>
+ <body>
+ <nav class="navbar is-dark" role="navigation" aria-label="main navigation">
+ <div class="navbar-brand">
+ <div class="navbar-item">
+ <img src="/static/logo.png" />
+ </div>
+ <div class="navbar-item">
+ <span id="hd">[AN] - Server administration - rescue console</span>
+ </div>
+ </div>
+ </nav>
+ <div hidden="yes">
+ <div id="boot_options">
+ <h4>Quickstart</h4>
+ <input type="button" value="ReactOS (32 MB)" id="start_reactos">
+ - Restored from snapshot<br>
+ <input type="button" value="Windows 95 (6.7 MB)" id="start_windows95">
+ - Restored from snapshot<br>
+ <input type="button" value="FreeBSD 10.2 (13.0 MB)" id="start_freebsd">
+ - Restored from snapshot<br>
+ <input type="button" value="Oberon (16.0 MB)" id="start_oberon">
+ - Native Oberon 2.3.6 (<a href="https://lists.inf.ethz.ch/pipermail/oberon/2013/006844.html">via</a>)<br>
+ <input type="button" value="Windows 98 (12.0 MB)" id="start_windows98">
+ - Including Minesweeper and audio, additional sectors are loaded as needed<br>
+ <input type="button" value="Arch Linux (10.1 MB)" id="start_archlinux">
+ - A complete Arch Linux restored from a snapshot, additional files are loaded as needed<br>
+ <input type="button" value="KolibriOS (1.4 MB)" id="start_kolibrios">
+ - Graphical OS, takes about 60 seconds to boot<br>
+ <input type="button" value="Linux 2.6 (5.4 MB)" id="start_linux26">
+ - With busybox, Lua interpreter and test cases, takes about 20 seconds to boot<br>
+ <input type="button" value="Linux 3.18 (8.3 MB)" id="start_linux3">
+ - With internet access, telnet, ping, wget and links. Takes about 60 seconds to boot. Run <code>udhcpc</code> for networking. Exchange files through <code>/mnt/</code>.<br>
+ <input type="button" value="Windows 1.01 (1.4 MB)" id="start_windows1">
+ - Takes 1 second to boot<br>
+ <input type="button" value="MS-DOS 6.22 (3.4 MB)" id="start_msdos">
+ - Takes 10 seconds to boot. With Enhanced Tools, QBasic and everything from the FreeDOS image<br>
+ <input type="button" value="FreeDOS (0.7 MB)" id="start_freedos">
+ - With nasm, vim, debug.com, some games and demos, takes 1 second to boot<br>
+ <input type="button" value="OpenBSD (1.4 MB)" id="start_openbsd">
+ - Random boot floppy, takes about 60 seconds<br>
+ <input type="button" value="Solar OS (1.4 MB)" id="start_solos">
+ - Simple graphical OS<br>
+ <input type="button" value="Bootchess (0.2 MB)" id="start_bootchess">
+ - A tiny chess program written in the boot sector
+ <br>
+ <hr>
+ <h4>Setup</h4>
+ <table>
+ <tr>
+ <td width="350">CD image</td>
+ <td>
+ <input type="file" id="cd_image">
+ </td>
+ </tr>
+ <tr>
+ <td>Floppy disk image</td>
+ <td> <input type="file" id="floppy_image"><br></td>
+ </tr>
+ <tr>
+ <td>Hard drive disk image</td>
+ <td><input type="file" id="hd_image"><br></td>
+ </tr>
+ <!--
+ <tr>
+ <td>Multiboot kernel image (experimental)</td>
+ <td><input type="file" id="multiboot_image"><br></td>
+ </tr>
+ -->
+ <tr>
+ <td colspan="2"><small><small>Disk images are not uploaded to the server</small></small><hr></td>
+ </tr>
+ <tr>
+ <td>Memory size</td>
+ <td>
+ <input id="memory_size" type="number" value="128" min="16" max="2048" step="16"> MB<br>
+ </td>
+ </tr>
+ <tr>
+ <td>Video Memory size</td>
+ <td>
+ <input id="video_memory_size" type="number" value="8" min="1" max="128" step="1"> MB<br>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2"><hr></td>
+ </tr>
+ <tr>
+ <td>Boot order</td>
+ <td>
+ <select id="boot_order">
+ <option value="213">CD / Floppy / Hard Disk</option>
+ <option value="123">CD / Hard Disk / Floppy</option>
+ <option value="231">Floppy / CD / Hard Disk</option>
+ <option value="321">Floppy / Hard Disk / CD</option>
+ <option value="312">Hard Disk / Floppy / CD</option>
+ <option value="132">Hard Disk / CD / Floppy</option>
+ </select>
+ </td>
+ </tr>
+ </table>
+ <br>
+ <button id="start_emulation">Start Emulation</button>
+ </div>
+ <div id="runtime_options" style="display: none">
+ <input type="button" value="Pause" id="run">
+ <input type="button" value="Reset" id="reset">
+ <input type="button" value="Exit" id="exit">
+ <input type="button" value="Send Ctrl-Alt-Del" id="ctrlaltdel">
+ <input type="button" value="Send Alt-Tab" id="alttab">
+ <input type="button" value="Get floppy image" id="get_fda_image">
+ <input type="button" value="Get second floppy image" id="get_fdb_image">
+ <input type="button" value="Get hard disk image" id="get_hda_image">
+ <input type="button" value="Get second hard disk image" id="get_hdb_image">
+ <input type="button" value="Get cdrom image" id="get_cdrom_image">
+ <input type="button" value="Save State" id="save_state">
+ <input type="button" value="Load State" id="load_state"> <input type="file" style="display: none" id="load_state_input">
+ <input type="button" value="Memory Dump" id="memory_dump">
+ <input type="button" value="Disable mouse" id="toggle_mouse">
+ <input type="button" value="Lock mouse" id="lock_mouse">
+ <input type="button" value="Go fullscreen" id="fullscreen">
+ <input type="button" value="Take screenshot (only graphic modes)" id="take_screenshot">
+ <label>
+ Scale:
+ <input type="number" min="0.25" step="0.25" value="1.0" id="scale" style="width: 50px">
+ </label>
+ <br>
+ <label id="change_fda" style="display: none">
+ Change floppy:
+ <input type="file">
+ </label>
+ <label id="change_cdrom" style="display: none">
+ Change CD:
+ <input type="file">
+ </label>
+ <br>
+ </div>
+ <pre style="display: none" id="loading"></pre>
+ </div>
+ <br>
+ <div id="screen_container" style="display: none">
+ <div id="screen"></div>
+ <canvas id="vga"></canvas>
+ <div style="position: absolute; top: 0; z-index: 10">
+ <textarea class="phone_keyboard"></textarea>
+ </div>
+ </div>
+ <div id="runtime_infos" style="display: none" hidden="yes">
+ Running: <span id="running_time">0s</span> <br>
+ Speed: <span id="speed">0</span>kIPS<br>
+ Avg speed: <span id="avg_speed">0</span>kIPS<br>
+ <br>
+ <div id="info_storage" style="display: none">
+ <b>IDE device (HDA or CDROM)</b><br>
+ Sectors read: <span id="info_storage_sectors_read">0</span><br>
+ Bytes read: <span id="info_storage_bytes_read">0</span><br>
+ Sectors written: <span id="info_storage_sectors_written">0</span><br>
+ Bytes written: <span id="info_storage_bytes_written">0</span><br>
+ Status: <span id="info_storage_status"></span><br>
+ <br>
+ </div>
+ <div id="info_filesystem" style="display: none">
+ <b>9p Filesystem</b><br>
+ Bytes read: <span id="info_filesystem_bytes_read">0</span><br>
+ Bytes written: <span id="info_filesystem_bytes_written">0</span><br>
+ Last file: <span id="info_filesystem_last_file" style="word-wrap: break-word"></span><br>
+ Status: <span id="info_filesystem_status"></span><br>
+ <br>
+ </div>
+ <div id="info_network" style="display: none">
+ <b>Network</b><br>
+ Bytes received: <span id="info_network_bytes_received">0</span><br>
+ Bytes transmitted: <span id="info_network_bytes_transmitted">0</span><br>
+ <br>
+ </div>
+ <b>VGA</b><br>
+ Mode: <span id="info_vga_mode"></span><br>
+ Resolution: <span id="info_res">-</span><br>
+ BPP: <span id="info_bpp">-</span><br>
+ <br>
+ Mouse: <span id="info_mouse_enabled">No</span><br>
+ <!-- Keyboard: <span id="info_keyboard_enabled">-</span><br> -->
+ <div id="description" style="display: none"></div>
+ </div>
+ <div id="filesystem_panel" style="display: none">
+ <label title="Files will appear in / of the 9p filesystem">
+ Send files to emulator<br>
+ <input type="file" id="filesystem_send_file" multiple>
+ </label>
+ <br><br>
+ <label>
+ Get file from emulator<br>
+ <input type="text" id="filesystem_get_file" placeholder="Absolute path">
+ </label>
+ </div>
+ <br style="clear:both"><br>
+ <textarea cols="40" rows="12" id="serial" style="display: none">This is the serial console. Whatever you type or paste here will be sent to COM1.
+ In Linux it can be accessed with `cat /dev/ttyS0`
+ </textarea>
+ </body>
+</html> \ No newline at end of file
diff --git a/rest-api/auth/index.html b/rest-api/auth/index.html
new file mode 100644
index 0000000..c0190da
--- /dev/null
+++ b/rest-api/auth/index.html
@@ -0,0 +1,4 @@
+{
+ "status": 421,
+ "code": 7
+} \ No newline at end of file
diff --git a/rest-api/cmd/index.html b/rest-api/cmd/index.html
new file mode 100644
index 0000000..53170d1
--- /dev/null
+++ b/rest-api/cmd/index.html
@@ -0,0 +1,4 @@
+{
+ "status": 764,
+ "code": 3
+} \ No newline at end of file
diff --git a/shell/index.html b/shell/index.html
new file mode 100644
index 0000000..167b640
--- /dev/null
+++ b/shell/index.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>[AN] - Server administration</title>
+ <link rel="stylesheet" type="text/css" media="all" href="/static/bulma.min.css">
+ <link rel="stylesheet" type="text/css" media="all" href="/static/shell.css">
+ <script src="/static/jquery.min.js" type="text/javascript"> </script>
+ <script src="/static/mgt.js" type="text/javascript"></script>
+ <script src="/static/shell.min.js" type="text/javascript"> </script>
+ </head>
+ <body>
+ <nav class="navbar is-dark" role="navigation" aria-label="main navigation">
+ <div class="navbar-brand">
+ <div class="navbar-item">
+ <img src="/static/logo.png" />
+ </div>
+ <div class="navbar-item">
+ <span id="hd">[AN] - Server administration - console shell</span>
+ </div>
+ </div>
+ </nav>
+ <div id="termDiv" style="position:absolute; visibility: hidden; z-index:1;"></div>
+
+ <script type="text/javascript">
+ //<![CDATA[
+ termOpen();
+ //]]>
+ </script>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/static/bulma.min.css b/static/bulma.min.css
new file mode 100644
index 0000000..935ab34
--- /dev/null
+++ b/static/bulma.min.css
@@ -0,0 +1,2 @@
+/*! bulma.io v0.6.2 | MIT License | github.com/jgthms/bulma */@-webkit-keyframes spinAround{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes spinAround{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}/*! minireset.css v0.0.2 | MIT License | github.com/jgthms/minireset.css */blockquote,body,dd,dl,dt,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,html,iframe,legend,li,ol,p,pre,textarea,ul{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:400}ul{list-style:none}button,input,select,textarea{margin:0}html{-webkit-box-sizing:border-box;box-sizing:border-box}*{-webkit-box-sizing:inherit;box-sizing:inherit}:after,:before{-webkit-box-sizing:inherit;box-sizing:inherit}audio,embed,img,object,video{max-width:100%}iframe{border:0}table{border-collapse:collapse;border-spacing:0}td,th{padding:0;text-align:left}html{background-color:#fff;font-size:16px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;min-width:300px;overflow-x:hidden;overflow-y:scroll;text-rendering:optimizeLegibility;-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;-ms-text-size-adjust:100%;text-size-adjust:100%}article,aside,figure,footer,header,hgroup,section{display:block}body,button,input,select,textarea{font-family:BlinkMacSystemFont,-apple-system,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Fira Sans","Droid Sans","Helvetica Neue",Helvetica,Arial,sans-serif}code,pre{-moz-osx-font-smoothing:auto;-webkit-font-smoothing:auto;font-family:monospace}body{color:#4a4a4a;font-size:1rem;font-weight:400;line-height:1.5}a{color:#3273dc;cursor:pointer;text-decoration:none}a strong{color:currentColor}a:hover{color:#363636}code{background-color:#f5f5f5;color:#ff3860;font-size:.875em;font-weight:400;padding:.25em .5em .25em}hr{background-color:#dbdbdb;border:none;display:block;height:1px;margin:1.5rem 0}img{height:auto;max-width:100%}input[type=checkbox],input[type=radio]{vertical-align:baseline}small{font-size:.875em}span{font-style:inherit;font-weight:inherit}strong{color:#363636;font-weight:700}pre{-webkit-overflow-scrolling:touch;background-color:#f5f5f5;color:#4a4a4a;font-size:.875em;overflow-x:auto;padding:1.25rem 1.5rem;white-space:pre;word-wrap:normal}pre code{background-color:transparent;color:currentColor;font-size:1em;padding:0}table td,table th{text-align:left;vertical-align:top}table th{color:#363636}.is-clearfix:after{clear:both;content:" ";display:table}.is-pulled-left{float:left!important}.is-pulled-right{float:right!important}.is-clipped{overflow:hidden!important}.is-overlay{bottom:0;left:0;position:absolute;right:0;top:0}.is-size-1{font-size:3rem!important}.is-size-2{font-size:2.5rem!important}.is-size-3{font-size:2rem!important}.is-size-4{font-size:1.5rem!important}.is-size-5{font-size:1.25rem!important}.is-size-6{font-size:1rem!important}.is-size-7{font-size:.75rem!important}@media screen and (max-width:768px){.is-size-1-mobile{font-size:3rem!important}.is-size-2-mobile{font-size:2.5rem!important}.is-size-3-mobile{font-size:2rem!important}.is-size-4-mobile{font-size:1.5rem!important}.is-size-5-mobile{font-size:1.25rem!important}.is-size-6-mobile{font-size:1rem!important}.is-size-7-mobile{font-size:.75rem!important}}@media screen and (min-width:769px),print{.is-size-1-tablet{font-size:3rem!important}.is-size-2-tablet{font-size:2.5rem!important}.is-size-3-tablet{font-size:2rem!important}.is-size-4-tablet{font-size:1.5rem!important}.is-size-5-tablet{font-size:1.25rem!important}.is-size-6-tablet{font-size:1rem!important}.is-size-7-tablet{font-size:.75rem!important}}@media screen and (max-width:1023px){.is-size-1-touch{font-size:3rem!important}.is-size-2-touch{font-size:2.5rem!important}.is-size-3-touch{font-size:2rem!important}.is-size-4-touch{font-size:1.5rem!important}.is-size-5-touch{font-size:1.25rem!important}.is-size-6-touch{font-size:1rem!important}.is-size-7-touch{font-size:.75rem!important}}@media screen and (min-width:1024px){.is-size-1-desktop{font-size:3rem!important}.is-size-2-desktop{font-size:2.5rem!important}.is-size-3-desktop{font-size:2rem!important}.is-size-4-desktop{font-size:1.5rem!important}.is-size-5-desktop{font-size:1.25rem!important}.is-size-6-desktop{font-size:1rem!important}.is-size-7-desktop{font-size:.75rem!important}}@media screen and (min-width:1216px){.is-size-1-widescreen{font-size:3rem!important}.is-size-2-widescreen{font-size:2.5rem!important}.is-size-3-widescreen{font-size:2rem!important}.is-size-4-widescreen{font-size:1.5rem!important}.is-size-5-widescreen{font-size:1.25rem!important}.is-size-6-widescreen{font-size:1rem!important}.is-size-7-widescreen{font-size:.75rem!important}}@media screen and (min-width:1408px){.is-size-1-fullhd{font-size:3rem!important}.is-size-2-fullhd{font-size:2.5rem!important}.is-size-3-fullhd{font-size:2rem!important}.is-size-4-fullhd{font-size:1.5rem!important}.is-size-5-fullhd{font-size:1.25rem!important}.is-size-6-fullhd{font-size:1rem!important}.is-size-7-fullhd{font-size:.75rem!important}}.has-text-centered{text-align:center!important}@media screen and (max-width:768px){.has-text-centered-mobile{text-align:center!important}}@media screen and (min-width:769px),print{.has-text-centered-tablet{text-align:center!important}}@media screen and (min-width:769px) and (max-width:1023px){.has-text-centered-tablet-only{text-align:center!important}}@media screen and (max-width:1023px){.has-text-centered-touch{text-align:center!important}}@media screen and (min-width:1024px){.has-text-centered-desktop{text-align:center!important}}@media screen and (min-width:1024px) and (max-width:1215px){.has-text-centered-desktop-only{text-align:center!important}}@media screen and (min-width:1216px){.has-text-centered-widescreen{text-align:center!important}}@media screen and (min-width:1216px) and (max-width:1407px){.has-text-centered-widescreen-only{text-align:center!important}}@media screen and (min-width:1408px){.has-text-centered-fullhd{text-align:center!important}}.has-text-justified{text-align:justify!important}@media screen and (max-width:768px){.has-text-justified-mobile{text-align:justify!important}}@media screen and (min-width:769px),print{.has-text-justified-tablet{text-align:justify!important}}@media screen and (min-width:769px) and (max-width:1023px){.has-text-justified-tablet-only{text-align:justify!important}}@media screen and (max-width:1023px){.has-text-justified-touch{text-align:justify!important}}@media screen and (min-width:1024px){.has-text-justified-desktop{text-align:justify!important}}@media screen and (min-width:1024px) and (max-width:1215px){.has-text-justified-desktop-only{text-align:justify!important}}@media screen and (min-width:1216px){.has-text-justified-widescreen{text-align:justify!important}}@media screen and (min-width:1216px) and (max-width:1407px){.has-text-justified-widescreen-only{text-align:justify!important}}@media screen and (min-width:1408px){.has-text-justified-fullhd{text-align:justify!important}}.has-text-left{text-align:left!important}@media screen and (max-width:768px){.has-text-left-mobile{text-align:left!important}}@media screen and (min-width:769px),print{.has-text-left-tablet{text-align:left!important}}@media screen and (min-width:769px) and (max-width:1023px){.has-text-left-tablet-only{text-align:left!important}}@media screen and (max-width:1023px){.has-text-left-touch{text-align:left!important}}@media screen and (min-width:1024px){.has-text-left-desktop{text-align:left!important}}@media screen and (min-width:1024px) and (max-width:1215px){.has-text-left-desktop-only{text-align:left!important}}@media screen and (min-width:1216px){.has-text-left-widescreen{text-align:left!important}}@media screen and (min-width:1216px) and (max-width:1407px){.has-text-left-widescreen-only{text-align:left!important}}@media screen and (min-width:1408px){.has-text-left-fullhd{text-align:left!important}}.has-text-right{text-align:right!important}@media screen and (max-width:768px){.has-text-right-mobile{text-align:right!important}}@media screen and (min-width:769px),print{.has-text-right-tablet{text-align:right!important}}@media screen and (min-width:769px) and (max-width:1023px){.has-text-right-tablet-only{text-align:right!important}}@media screen and (max-width:1023px){.has-text-right-touch{text-align:right!important}}@media screen and (min-width:1024px){.has-text-right-desktop{text-align:right!important}}@media screen and (min-width:1024px) and (max-width:1215px){.has-text-right-desktop-only{text-align:right!important}}@media screen and (min-width:1216px){.has-text-right-widescreen{text-align:right!important}}@media screen and (min-width:1216px) and (max-width:1407px){.has-text-right-widescreen-only{text-align:right!important}}@media screen and (min-width:1408px){.has-text-right-fullhd{text-align:right!important}}.is-capitalized{text-transform:capitalize!important}.is-lowercase{text-transform:lowercase!important}.is-uppercase{text-transform:uppercase!important}.is-italic{font-style:italic!important}.has-text-white{color:#fff!important}a.has-text-white:focus,a.has-text-white:hover{color:#e6e6e6!important}.has-text-black{color:#0a0a0a!important}a.has-text-black:focus,a.has-text-black:hover{color:#000!important}.has-text-light{color:#f5f5f5!important}a.has-text-light:focus,a.has-text-light:hover{color:#dbdbdb!important}.has-text-dark{color:#363636!important}a.has-text-dark:focus,a.has-text-dark:hover{color:#1c1c1c!important}.has-text-primary{color:#00d1b2!important}a.has-text-primary:focus,a.has-text-primary:hover{color:#009e86!important}.has-text-link{color:#3273dc!important}a.has-text-link:focus,a.has-text-link:hover{color:#205bbc!important}.has-text-info{color:#209cee!important}a.has-text-info:focus,a.has-text-info:hover{color:#0f81cc!important}.has-text-success{color:#23d160!important}a.has-text-success:focus,a.has-text-success:hover{color:#1ca64c!important}.has-text-warning{color:#ffdd57!important}a.has-text-warning:focus,a.has-text-warning:hover{color:#ffd324!important}.has-text-danger{color:#ff3860!important}a.has-text-danger:focus,a.has-text-danger:hover{color:#ff0537!important}.has-text-black-bis{color:#121212!important}.has-text-black-ter{color:#242424!important}.has-text-grey-darker{color:#363636!important}.has-text-grey-dark{color:#4a4a4a!important}.has-text-grey{color:#7a7a7a!important}.has-text-grey-light{color:#b5b5b5!important}.has-text-grey-lighter{color:#dbdbdb!important}.has-text-white-ter{color:#f5f5f5!important}.has-text-white-bis{color:#fafafa!important}.has-text-weight-light{font-weight:300!important}.has-text-weight-normal{font-weight:400!important}.has-text-weight-semibold{font-weight:600!important}.has-text-weight-bold{font-weight:700!important}.is-block{display:block!important}@media screen and (max-width:768px){.is-block-mobile{display:block!important}}@media screen and (min-width:769px),print{.is-block-tablet{display:block!important}}@media screen and (min-width:769px) and (max-width:1023px){.is-block-tablet-only{display:block!important}}@media screen and (max-width:1023px){.is-block-touch{display:block!important}}@media screen and (min-width:1024px){.is-block-desktop{display:block!important}}@media screen and (min-width:1024px) and (max-width:1215px){.is-block-desktop-only{display:block!important}}@media screen and (min-width:1216px){.is-block-widescreen{display:block!important}}@media screen and (min-width:1216px) and (max-width:1407px){.is-block-widescreen-only{display:block!important}}@media screen and (min-width:1408px){.is-block-fullhd{display:block!important}}.is-flex{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important}@media screen and (max-width:768px){.is-flex-mobile{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important}}@media screen and (min-width:769px),print{.is-flex-tablet{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important}}@media screen and (min-width:769px) and (max-width:1023px){.is-flex-tablet-only{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important}}@media screen and (max-width:1023px){.is-flex-touch{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important}}@media screen and (min-width:1024px){.is-flex-desktop{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important}}@media screen and (min-width:1024px) and (max-width:1215px){.is-flex-desktop-only{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important}}@media screen and (min-width:1216px){.is-flex-widescreen{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important}}@media screen and (min-width:1216px) and (max-width:1407px){.is-flex-widescreen-only{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important}}@media screen and (min-width:1408px){.is-flex-fullhd{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important}}.is-inline{display:inline!important}@media screen and (max-width:768px){.is-inline-mobile{display:inline!important}}@media screen and (min-width:769px),print{.is-inline-tablet{display:inline!important}}@media screen and (min-width:769px) and (max-width:1023px){.is-inline-tablet-only{display:inline!important}}@media screen and (max-width:1023px){.is-inline-touch{display:inline!important}}@media screen and (min-width:1024px){.is-inline-desktop{display:inline!important}}@media screen and (min-width:1024px) and (max-width:1215px){.is-inline-desktop-only{display:inline!important}}@media screen and (min-width:1216px){.is-inline-widescreen{display:inline!important}}@media screen and (min-width:1216px) and (max-width:1407px){.is-inline-widescreen-only{display:inline!important}}@media screen and (min-width:1408px){.is-inline-fullhd{display:inline!important}}.is-inline-block{display:inline-block!important}@media screen and (max-width:768px){.is-inline-block-mobile{display:inline-block!important}}@media screen and (min-width:769px),print{.is-inline-block-tablet{display:inline-block!important}}@media screen and (min-width:769px) and (max-width:1023px){.is-inline-block-tablet-only{display:inline-block!important}}@media screen and (max-width:1023px){.is-inline-block-touch{display:inline-block!important}}@media screen and (min-width:1024px){.is-inline-block-desktop{display:inline-block!important}}@media screen and (min-width:1024px) and (max-width:1215px){.is-inline-block-desktop-only{display:inline-block!important}}@media screen and (min-width:1216px){.is-inline-block-widescreen{display:inline-block!important}}@media screen and (min-width:1216px) and (max-width:1407px){.is-inline-block-widescreen-only{display:inline-block!important}}@media screen and (min-width:1408px){.is-inline-block-fullhd{display:inline-block!important}}.is-inline-flex{display:-webkit-inline-box!important;display:-ms-inline-flexbox!important;display:inline-flex!important}@media screen and (max-width:768px){.is-inline-flex-mobile{display:-webkit-inline-box!important;display:-ms-inline-flexbox!important;display:inline-flex!important}}@media screen and (min-width:769px),print{.is-inline-flex-tablet{display:-webkit-inline-box!important;display:-ms-inline-flexbox!important;display:inline-flex!important}}@media screen and (min-width:769px) and (max-width:1023px){.is-inline-flex-tablet-only{display:-webkit-inline-box!important;display:-ms-inline-flexbox!important;display:inline-flex!important}}@media screen and (max-width:1023px){.is-inline-flex-touch{display:-webkit-inline-box!important;display:-ms-inline-flexbox!important;display:inline-flex!important}}@media screen and (min-width:1024px){.is-inline-flex-desktop{display:-webkit-inline-box!important;display:-ms-inline-flexbox!important;display:inline-flex!important}}@media screen and (min-width:1024px) and (max-width:1215px){.is-inline-flex-desktop-only{display:-webkit-inline-box!important;display:-ms-inline-flexbox!important;display:inline-flex!important}}@media screen and (min-width:1216px){.is-inline-flex-widescreen{display:-webkit-inline-box!important;display:-ms-inline-flexbox!important;display:inline-flex!important}}@media screen and (min-width:1216px) and (max-width:1407px){.is-inline-flex-widescreen-only{display:-webkit-inline-box!important;display:-ms-inline-flexbox!important;display:inline-flex!important}}@media screen and (min-width:1408px){.is-inline-flex-fullhd{display:-webkit-inline-box!important;display:-ms-inline-flexbox!important;display:inline-flex!important}}.is-hidden{display:none!important}@media screen and (max-width:768px){.is-hidden-mobile{display:none!important}}@media screen and (min-width:769px),print{.is-hidden-tablet{display:none!important}}@media screen and (min-width:769px) and (max-width:1023px){.is-hidden-tablet-only{display:none!important}}@media screen and (max-width:1023px){.is-hidden-touch{display:none!important}}@media screen and (min-width:1024px){.is-hidden-desktop{display:none!important}}@media screen and (min-width:1024px) and (max-width:1215px){.is-hidden-desktop-only{display:none!important}}@media screen and (min-width:1216px){.is-hidden-widescreen{display:none!important}}@media screen and (min-width:1216px) and (max-width:1407px){.is-hidden-widescreen-only{display:none!important}}@media screen and (min-width:1408px){.is-hidden-fullhd{display:none!important}}.is-invisible{visibility:hidden!important}@media screen and (max-width:768px){.is-invisible-mobile{visibility:hidden!important}}@media screen and (min-width:769px),print{.is-invisible-tablet{visibility:hidden!important}}@media screen and (min-width:769px) and (max-width:1023px){.is-invisible-tablet-only{visibility:hidden!important}}@media screen and (max-width:1023px){.is-invisible-touch{visibility:hidden!important}}@media screen and (min-width:1024px){.is-invisible-desktop{visibility:hidden!important}}@media screen and (min-width:1024px) and (max-width:1215px){.is-invisible-desktop-only{visibility:hidden!important}}@media screen and (min-width:1216px){.is-invisible-widescreen{visibility:hidden!important}}@media screen and (min-width:1216px) and (max-width:1407px){.is-invisible-widescreen-only{visibility:hidden!important}}@media screen and (min-width:1408px){.is-invisible-fullhd{visibility:hidden!important}}.is-marginless{margin:0!important}.is-paddingless{padding:0!important}.is-radiusless{border-radius:0!important}.is-shadowless{-webkit-box-shadow:none!important;box-shadow:none!important}.is-unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.box{background-color:#fff;border-radius:5px;-webkit-box-shadow:0 2px 3px rgba(10,10,10,.1),0 0 0 1px rgba(10,10,10,.1);box-shadow:0 2px 3px rgba(10,10,10,.1),0 0 0 1px rgba(10,10,10,.1);color:#4a4a4a;display:block;padding:1.25rem}.box:not(:last-child){margin-bottom:1.5rem}a.box:focus,a.box:hover{-webkit-box-shadow:0 2px 3px rgba(10,10,10,.1),0 0 0 1px #3273dc;box-shadow:0 2px 3px rgba(10,10,10,.1),0 0 0 1px #3273dc}a.box:active{-webkit-box-shadow:inset 0 1px 2px rgba(10,10,10,.2),0 0 0 1px #3273dc;box-shadow:inset 0 1px 2px rgba(10,10,10,.2),0 0 0 1px #3273dc}.button{-moz-appearance:none;-webkit-appearance:none;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border:1px solid transparent;border-radius:3px;-webkit-box-shadow:none;box-shadow:none;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;font-size:1rem;height:2.25em;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;line-height:1.5;padding-bottom:calc(.375em - 1px);padding-left:calc(.625em - 1px);padding-right:calc(.625em - 1px);padding-top:calc(.375em - 1px);position:relative;vertical-align:top;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#fff;border-color:#dbdbdb;color:#363636;cursor:pointer;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;padding-left:.75em;padding-right:.75em;text-align:center;white-space:nowrap}.button.is-active,.button.is-focused,.button:active,.button:focus{outline:0}.button[disabled]{cursor:not-allowed}.button strong{color:inherit}.button .icon,.button .icon.is-large,.button .icon.is-medium,.button .icon.is-small{height:1.5em;width:1.5em}.button .icon:first-child:not(:last-child){margin-left:calc(-.375em - 1px);margin-right:.1875em}.button .icon:last-child:not(:first-child){margin-left:.1875em;margin-right:calc(-.375em - 1px)}.button .icon:first-child:last-child{margin-left:calc(-.375em - 1px);margin-right:calc(-.375em - 1px)}.button.is-hovered,.button:hover{border-color:#b5b5b5;color:#363636}.button.is-focused,.button:focus{border-color:#3273dc;color:#363636}.button.is-focused:not(:active),.button:focus:not(:active){-webkit-box-shadow:0 0 0 .125em rgba(50,115,220,.25);box-shadow:0 0 0 .125em rgba(50,115,220,.25)}.button.is-active,.button:active{border-color:#4a4a4a;color:#363636}.button.is-text{background-color:transparent;border-color:transparent;color:#4a4a4a;text-decoration:underline}.button.is-text.is-focused,.button.is-text.is-hovered,.button.is-text:focus,.button.is-text:hover{background-color:#f5f5f5;color:#363636}.button.is-text.is-active,.button.is-text:active{background-color:#e8e8e8;color:#363636}.button.is-text[disabled]{background-color:transparent;border-color:transparent;-webkit-box-shadow:none;box-shadow:none}.button.is-white{background-color:#fff;border-color:transparent;color:#0a0a0a}.button.is-white.is-hovered,.button.is-white:hover{background-color:#f9f9f9;border-color:transparent;color:#0a0a0a}.button.is-white.is-focused,.button.is-white:focus{border-color:transparent;color:#0a0a0a}.button.is-white.is-focused:not(:active),.button.is-white:focus:not(:active){-webkit-box-shadow:0 0 0 .125em rgba(255,255,255,.25);box-shadow:0 0 0 .125em rgba(255,255,255,.25)}.button.is-white.is-active,.button.is-white:active{background-color:#f2f2f2;border-color:transparent;color:#0a0a0a}.button.is-white[disabled]{background-color:#fff;border-color:transparent;-webkit-box-shadow:none;box-shadow:none}.button.is-white.is-inverted{background-color:#0a0a0a;color:#fff}.button.is-white.is-inverted:hover{background-color:#000}.button.is-white.is-inverted[disabled]{background-color:#0a0a0a;border-color:transparent;-webkit-box-shadow:none;box-shadow:none;color:#fff}.button.is-white.is-loading:after{border-color:transparent transparent #0a0a0a #0a0a0a!important}.button.is-white.is-outlined{background-color:transparent;border-color:#fff;color:#fff}.button.is-white.is-outlined:focus,.button.is-white.is-outlined:hover{background-color:#fff;border-color:#fff;color:#0a0a0a}.button.is-white.is-outlined.is-loading:after{border-color:transparent transparent #fff #fff!important}.button.is-white.is-outlined[disabled]{background-color:transparent;border-color:#fff;-webkit-box-shadow:none;box-shadow:none;color:#fff}.button.is-white.is-inverted.is-outlined{background-color:transparent;border-color:#0a0a0a;color:#0a0a0a}.button.is-white.is-inverted.is-outlined:focus,.button.is-white.is-inverted.is-outlined:hover{background-color:#0a0a0a;color:#fff}.button.is-white.is-inverted.is-outlined[disabled]{background-color:transparent;border-color:#0a0a0a;-webkit-box-shadow:none;box-shadow:none;color:#0a0a0a}.button.is-black{background-color:#0a0a0a;border-color:transparent;color:#fff}.button.is-black.is-hovered,.button.is-black:hover{background-color:#040404;border-color:transparent;color:#fff}.button.is-black.is-focused,.button.is-black:focus{border-color:transparent;color:#fff}.button.is-black.is-focused:not(:active),.button.is-black:focus:not(:active){-webkit-box-shadow:0 0 0 .125em rgba(10,10,10,.25);box-shadow:0 0 0 .125em rgba(10,10,10,.25)}.button.is-black.is-active,.button.is-black:active{background-color:#000;border-color:transparent;color:#fff}.button.is-black[disabled]{background-color:#0a0a0a;border-color:transparent;-webkit-box-shadow:none;box-shadow:none}.button.is-black.is-inverted{background-color:#fff;color:#0a0a0a}.button.is-black.is-inverted:hover{background-color:#f2f2f2}.button.is-black.is-inverted[disabled]{background-color:#fff;border-color:transparent;-webkit-box-shadow:none;box-shadow:none;color:#0a0a0a}.button.is-black.is-loading:after{border-color:transparent transparent #fff #fff!important}.button.is-black.is-outlined{background-color:transparent;border-color:#0a0a0a;color:#0a0a0a}.button.is-black.is-outlined:focus,.button.is-black.is-outlined:hover{background-color:#0a0a0a;border-color:#0a0a0a;color:#fff}.button.is-black.is-outlined.is-loading:after{border-color:transparent transparent #0a0a0a #0a0a0a!important}.button.is-black.is-outlined[disabled]{background-color:transparent;border-color:#0a0a0a;-webkit-box-shadow:none;box-shadow:none;color:#0a0a0a}.button.is-black.is-inverted.is-outlined{background-color:transparent;border-color:#fff;color:#fff}.button.is-black.is-inverted.is-outlined:focus,.button.is-black.is-inverted.is-outlined:hover{background-color:#fff;color:#0a0a0a}.button.is-black.is-inverted.is-outlined[disabled]{background-color:transparent;border-color:#fff;-webkit-box-shadow:none;box-shadow:none;color:#fff}.button.is-light{background-color:#f5f5f5;border-color:transparent;color:#363636}.button.is-light.is-hovered,.button.is-light:hover{background-color:#eee;border-color:transparent;color:#363636}.button.is-light.is-focused,.button.is-light:focus{border-color:transparent;color:#363636}.button.is-light.is-focused:not(:active),.button.is-light:focus:not(:active){-webkit-box-shadow:0 0 0 .125em rgba(245,245,245,.25);box-shadow:0 0 0 .125em rgba(245,245,245,.25)}.button.is-light.is-active,.button.is-light:active{background-color:#e8e8e8;border-color:transparent;color:#363636}.button.is-light[disabled]{background-color:#f5f5f5;border-color:transparent;-webkit-box-shadow:none;box-shadow:none}.button.is-light.is-inverted{background-color:#363636;color:#f5f5f5}.button.is-light.is-inverted:hover{background-color:#292929}.button.is-light.is-inverted[disabled]{background-color:#363636;border-color:transparent;-webkit-box-shadow:none;box-shadow:none;color:#f5f5f5}.button.is-light.is-loading:after{border-color:transparent transparent #363636 #363636!important}.button.is-light.is-outlined{background-color:transparent;border-color:#f5f5f5;color:#f5f5f5}.button.is-light.is-outlined:focus,.button.is-light.is-outlined:hover{background-color:#f5f5f5;border-color:#f5f5f5;color:#363636}.button.is-light.is-outlined.is-loading:after{border-color:transparent transparent #f5f5f5 #f5f5f5!important}.button.is-light.is-outlined[disabled]{background-color:transparent;border-color:#f5f5f5;-webkit-box-shadow:none;box-shadow:none;color:#f5f5f5}.button.is-light.is-inverted.is-outlined{background-color:transparent;border-color:#363636;color:#363636}.button.is-light.is-inverted.is-outlined:focus,.button.is-light.is-inverted.is-outlined:hover{background-color:#363636;color:#f5f5f5}.button.is-light.is-inverted.is-outlined[disabled]{background-color:transparent;border-color:#363636;-webkit-box-shadow:none;box-shadow:none;color:#363636}.button.is-dark{background-color:#363636;border-color:transparent;color:#f5f5f5}.button.is-dark.is-hovered,.button.is-dark:hover{background-color:#2f2f2f;border-color:transparent;color:#f5f5f5}.button.is-dark.is-focused,.button.is-dark:focus{border-color:transparent;color:#f5f5f5}.button.is-dark.is-focused:not(:active),.button.is-dark:focus:not(:active){-webkit-box-shadow:0 0 0 .125em rgba(54,54,54,.25);box-shadow:0 0 0 .125em rgba(54,54,54,.25)}.button.is-dark.is-active,.button.is-dark:active{background-color:#292929;border-color:transparent;color:#f5f5f5}.button.is-dark[disabled]{background-color:#363636;border-color:transparent;-webkit-box-shadow:none;box-shadow:none}.button.is-dark.is-inverted{background-color:#f5f5f5;color:#363636}.button.is-dark.is-inverted:hover{background-color:#e8e8e8}.button.is-dark.is-inverted[disabled]{background-color:#f5f5f5;border-color:transparent;-webkit-box-shadow:none;box-shadow:none;color:#363636}.button.is-dark.is-loading:after{border-color:transparent transparent #f5f5f5 #f5f5f5!important}.button.is-dark.is-outlined{background-color:transparent;border-color:#363636;color:#363636}.button.is-dark.is-outlined:focus,.button.is-dark.is-outlined:hover{background-color:#363636;border-color:#363636;color:#f5f5f5}.button.is-dark.is-outlined.is-loading:after{border-color:transparent transparent #363636 #363636!important}.button.is-dark.is-outlined[disabled]{background-color:transparent;border-color:#363636;-webkit-box-shadow:none;box-shadow:none;color:#363636}.button.is-dark.is-inverted.is-outlined{background-color:transparent;border-color:#f5f5f5;color:#f5f5f5}.button.is-dark.is-inverted.is-outlined:focus,.button.is-dark.is-inverted.is-outlined:hover{background-color:#f5f5f5;color:#363636}.button.is-dark.is-inverted.is-outlined[disabled]{background-color:transparent;border-color:#f5f5f5;-webkit-box-shadow:none;box-shadow:none;color:#f5f5f5}.button.is-primary{background-color:#00d1b2;border-color:transparent;color:#fff}.button.is-primary.is-hovered,.button.is-primary:hover{background-color:#00c4a7;border-color:transparent;color:#fff}.button.is-primary.is-focused,.button.is-primary:focus{border-color:transparent;color:#fff}.button.is-primary.is-focused:not(:active),.button.is-primary:focus:not(:active){-webkit-box-shadow:0 0 0 .125em rgba(0,209,178,.25);box-shadow:0 0 0 .125em rgba(0,209,178,.25)}.button.is-primary.is-active,.button.is-primary:active{background-color:#00b89c;border-color:transparent;color:#fff}.button.is-primary[disabled]{background-color:#00d1b2;border-color:transparent;-webkit-box-shadow:none;box-shadow:none}.button.is-primary.is-inverted{background-color:#fff;color:#00d1b2}.button.is-primary.is-inverted:hover{background-color:#f2f2f2}.button.is-primary.is-inverted[disabled]{background-color:#fff;border-color:transparent;-webkit-box-shadow:none;box-shadow:none;color:#00d1b2}.button.is-primary.is-loading:after{border-color:transparent transparent #fff #fff!important}.button.is-primary.is-outlined{background-color:transparent;border-color:#00d1b2;color:#00d1b2}.button.is-primary.is-outlined:focus,.button.is-primary.is-outlined:hover{background-color:#00d1b2;border-color:#00d1b2;color:#fff}.button.is-primary.is-outlined.is-loading:after{border-color:transparent transparent #00d1b2 #00d1b2!important}.button.is-primary.is-outlined[disabled]{background-color:transparent;border-color:#00d1b2;-webkit-box-shadow:none;box-shadow:none;color:#00d1b2}.button.is-primary.is-inverted.is-outlined{background-color:transparent;border-color:#fff;color:#fff}.button.is-primary.is-inverted.is-outlined:focus,.button.is-primary.is-inverted.is-outlined:hover{background-color:#fff;color:#00d1b2}.button.is-primary.is-inverted.is-outlined[disabled]{background-color:transparent;border-color:#fff;-webkit-box-shadow:none;box-shadow:none;color:#fff}.button.is-link{background-color:#3273dc;border-color:transparent;color:#fff}.button.is-link.is-hovered,.button.is-link:hover{background-color:#276cda;border-color:transparent;color:#fff}.button.is-link.is-focused,.button.is-link:focus{border-color:transparent;color:#fff}.button.is-link.is-focused:not(:active),.button.is-link:focus:not(:active){-webkit-box-shadow:0 0 0 .125em rgba(50,115,220,.25);box-shadow:0 0 0 .125em rgba(50,115,220,.25)}.button.is-link.is-active,.button.is-link:active{background-color:#2366d1;border-color:transparent;color:#fff}.button.is-link[disabled]{background-color:#3273dc;border-color:transparent;-webkit-box-shadow:none;box-shadow:none}.button.is-link.is-inverted{background-color:#fff;color:#3273dc}.button.is-link.is-inverted:hover{background-color:#f2f2f2}.button.is-link.is-inverted[disabled]{background-color:#fff;border-color:transparent;-webkit-box-shadow:none;box-shadow:none;color:#3273dc}.button.is-link.is-loading:after{border-color:transparent transparent #fff #fff!important}.button.is-link.is-outlined{background-color:transparent;border-color:#3273dc;color:#3273dc}.button.is-link.is-outlined:focus,.button.is-link.is-outlined:hover{background-color:#3273dc;border-color:#3273dc;color:#fff}.button.is-link.is-outlined.is-loading:after{border-color:transparent transparent #3273dc #3273dc!important}.button.is-link.is-outlined[disabled]{background-color:transparent;border-color:#3273dc;-webkit-box-shadow:none;box-shadow:none;color:#3273dc}.button.is-link.is-inverted.is-outlined{background-color:transparent;border-color:#fff;color:#fff}.button.is-link.is-inverted.is-outlined:focus,.button.is-link.is-inverted.is-outlined:hover{background-color:#fff;color:#3273dc}.button.is-link.is-inverted.is-outlined[disabled]{background-color:transparent;border-color:#fff;-webkit-box-shadow:none;box-shadow:none;color:#fff}.button.is-info{background-color:#209cee;border-color:transparent;color:#fff}.button.is-info.is-hovered,.button.is-info:hover{background-color:#1496ed;border-color:transparent;color:#fff}.button.is-info.is-focused,.button.is-info:focus{border-color:transparent;color:#fff}.button.is-info.is-focused:not(:active),.button.is-info:focus:not(:active){-webkit-box-shadow:0 0 0 .125em rgba(32,156,238,.25);box-shadow:0 0 0 .125em rgba(32,156,238,.25)}.button.is-info.is-active,.button.is-info:active{background-color:#118fe4;border-color:transparent;color:#fff}.button.is-info[disabled]{background-color:#209cee;border-color:transparent;-webkit-box-shadow:none;box-shadow:none}.button.is-info.is-inverted{background-color:#fff;color:#209cee}.button.is-info.is-inverted:hover{background-color:#f2f2f2}.button.is-info.is-inverted[disabled]{background-color:#fff;border-color:transparent;-webkit-box-shadow:none;box-shadow:none;color:#209cee}.button.is-info.is-loading:after{border-color:transparent transparent #fff #fff!important}.button.is-info.is-outlined{background-color:transparent;border-color:#209cee;color:#209cee}.button.is-info.is-outlined:focus,.button.is-info.is-outlined:hover{background-color:#209cee;border-color:#209cee;color:#fff}.button.is-info.is-outlined.is-loading:after{border-color:transparent transparent #209cee #209cee!important}.button.is-info.is-outlined[disabled]{background-color:transparent;border-color:#209cee;-webkit-box-shadow:none;box-shadow:none;color:#209cee}.button.is-info.is-inverted.is-outlined{background-color:transparent;border-color:#fff;color:#fff}.button.is-info.is-inverted.is-outlined:focus,.button.is-info.is-inverted.is-outlined:hover{background-color:#fff;color:#209cee}.button.is-info.is-inverted.is-outlined[disabled]{background-color:transparent;border-color:#fff;-webkit-box-shadow:none;box-shadow:none;color:#fff}.button.is-success{background-color:#23d160;border-color:transparent;color:#fff}.button.is-success.is-hovered,.button.is-success:hover{background-color:#22c65b;border-color:transparent;color:#fff}.button.is-success.is-focused,.button.is-success:focus{border-color:transparent;color:#fff}.button.is-success.is-focused:not(:active),.button.is-success:focus:not(:active){-webkit-box-shadow:0 0 0 .125em rgba(35,209,96,.25);box-shadow:0 0 0 .125em rgba(35,209,96,.25)}.button.is-success.is-active,.button.is-success:active{background-color:#20bc56;border-color:transparent;color:#fff}.button.is-success[disabled]{background-color:#23d160;border-color:transparent;-webkit-box-shadow:none;box-shadow:none}.button.is-success.is-inverted{background-color:#fff;color:#23d160}.button.is-success.is-inverted:hover{background-color:#f2f2f2}.button.is-success.is-inverted[disabled]{background-color:#fff;border-color:transparent;-webkit-box-shadow:none;box-shadow:none;color:#23d160}.button.is-success.is-loading:after{border-color:transparent transparent #fff #fff!important}.button.is-success.is-outlined{background-color:transparent;border-color:#23d160;color:#23d160}.button.is-success.is-outlined:focus,.button.is-success.is-outlined:hover{background-color:#23d160;border-color:#23d160;color:#fff}.button.is-success.is-outlined.is-loading:after{border-color:transparent transparent #23d160 #23d160!important}.button.is-success.is-outlined[disabled]{background-color:transparent;border-color:#23d160;-webkit-box-shadow:none;box-shadow:none;color:#23d160}.button.is-success.is-inverted.is-outlined{background-color:transparent;border-color:#fff;color:#fff}.button.is-success.is-inverted.is-outlined:focus,.button.is-success.is-inverted.is-outlined:hover{background-color:#fff;color:#23d160}.button.is-success.is-inverted.is-outlined[disabled]{background-color:transparent;border-color:#fff;-webkit-box-shadow:none;box-shadow:none;color:#fff}.button.is-warning{background-color:#ffdd57;border-color:transparent;color:rgba(0,0,0,.7)}.button.is-warning.is-hovered,.button.is-warning:hover{background-color:#ffdb4a;border-color:transparent;color:rgba(0,0,0,.7)}.button.is-warning.is-focused,.button.is-warning:focus{border-color:transparent;color:rgba(0,0,0,.7)}.button.is-warning.is-focused:not(:active),.button.is-warning:focus:not(:active){-webkit-box-shadow:0 0 0 .125em rgba(255,221,87,.25);box-shadow:0 0 0 .125em rgba(255,221,87,.25)}.button.is-warning.is-active,.button.is-warning:active{background-color:#ffd83d;border-color:transparent;color:rgba(0,0,0,.7)}.button.is-warning[disabled]{background-color:#ffdd57;border-color:transparent;-webkit-box-shadow:none;box-shadow:none}.button.is-warning.is-inverted{background-color:rgba(0,0,0,.7);color:#ffdd57}.button.is-warning.is-inverted:hover{background-color:rgba(0,0,0,.7)}.button.is-warning.is-inverted[disabled]{background-color:rgba(0,0,0,.7);border-color:transparent;-webkit-box-shadow:none;box-shadow:none;color:#ffdd57}.button.is-warning.is-loading:after{border-color:transparent transparent rgba(0,0,0,.7) rgba(0,0,0,.7)!important}.button.is-warning.is-outlined{background-color:transparent;border-color:#ffdd57;color:#ffdd57}.button.is-warning.is-outlined:focus,.button.is-warning.is-outlined:hover{background-color:#ffdd57;border-color:#ffdd57;color:rgba(0,0,0,.7)}.button.is-warning.is-outlined.is-loading:after{border-color:transparent transparent #ffdd57 #ffdd57!important}.button.is-warning.is-outlined[disabled]{background-color:transparent;border-color:#ffdd57;-webkit-box-shadow:none;box-shadow:none;color:#ffdd57}.button.is-warning.is-inverted.is-outlined{background-color:transparent;border-color:rgba(0,0,0,.7);color:rgba(0,0,0,.7)}.button.is-warning.is-inverted.is-outlined:focus,.button.is-warning.is-inverted.is-outlined:hover{background-color:rgba(0,0,0,.7);color:#ffdd57}.button.is-warning.is-inverted.is-outlined[disabled]{background-color:transparent;border-color:rgba(0,0,0,.7);-webkit-box-shadow:none;box-shadow:none;color:rgba(0,0,0,.7)}.button.is-danger{background-color:#ff3860;border-color:transparent;color:#fff}.button.is-danger.is-hovered,.button.is-danger:hover{background-color:#ff2b56;border-color:transparent;color:#fff}.button.is-danger.is-focused,.button.is-danger:focus{border-color:transparent;color:#fff}.button.is-danger.is-focused:not(:active),.button.is-danger:focus:not(:active){-webkit-box-shadow:0 0 0 .125em rgba(255,56,96,.25);box-shadow:0 0 0 .125em rgba(255,56,96,.25)}.button.is-danger.is-active,.button.is-danger:active{background-color:#ff1f4b;border-color:transparent;color:#fff}.button.is-danger[disabled]{background-color:#ff3860;border-color:transparent;-webkit-box-shadow:none;box-shadow:none}.button.is-danger.is-inverted{background-color:#fff;color:#ff3860}.button.is-danger.is-inverted:hover{background-color:#f2f2f2}.button.is-danger.is-inverted[disabled]{background-color:#fff;border-color:transparent;-webkit-box-shadow:none;box-shadow:none;color:#ff3860}.button.is-danger.is-loading:after{border-color:transparent transparent #fff #fff!important}.button.is-danger.is-outlined{background-color:transparent;border-color:#ff3860;color:#ff3860}.button.is-danger.is-outlined:focus,.button.is-danger.is-outlined:hover{background-color:#ff3860;border-color:#ff3860;color:#fff}.button.is-danger.is-outlined.is-loading:after{border-color:transparent transparent #ff3860 #ff3860!important}.button.is-danger.is-outlined[disabled]{background-color:transparent;border-color:#ff3860;-webkit-box-shadow:none;box-shadow:none;color:#ff3860}.button.is-danger.is-inverted.is-outlined{background-color:transparent;border-color:#fff;color:#fff}.button.is-danger.is-inverted.is-outlined:focus,.button.is-danger.is-inverted.is-outlined:hover{background-color:#fff;color:#ff3860}.button.is-danger.is-inverted.is-outlined[disabled]{background-color:transparent;border-color:#fff;-webkit-box-shadow:none;box-shadow:none;color:#fff}.button.is-small{border-radius:2px;font-size:.75rem}.button.is-medium{font-size:1.25rem}.button.is-large{font-size:1.5rem}.button[disabled]{background-color:#fff;border-color:#dbdbdb;-webkit-box-shadow:none;box-shadow:none;opacity:.5}.button.is-fullwidth{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%}.button.is-loading{color:transparent!important;pointer-events:none}.button.is-loading:after{-webkit-animation:spinAround .5s infinite linear;animation:spinAround .5s infinite linear;border:2px solid #dbdbdb;border-radius:290486px;border-right-color:transparent;border-top-color:transparent;content:"";display:block;height:1em;position:relative;width:1em;position:absolute;left:calc(50% - (1em / 2));top:calc(50% - (1em / 2));position:absolute!important}.button.is-static{background-color:#f5f5f5;border-color:#dbdbdb;color:#7a7a7a;-webkit-box-shadow:none;box-shadow:none;pointer-events:none}.button.is-rounded{border-radius:290486px;padding-left:1em;padding-right:1em}.buttons{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}.buttons .button{margin-bottom:.5rem}.buttons .button:not(:last-child){margin-right:.5rem}.buttons:last-child{margin-bottom:-.5rem}.buttons:not(:last-child){margin-bottom:1rem}.buttons.has-addons .button:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.buttons.has-addons .button:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0;margin-right:-1px}.buttons.has-addons .button:last-child{margin-right:0}.buttons.has-addons .button.is-hovered,.buttons.has-addons .button:hover{z-index:2}.buttons.has-addons .button.is-active,.buttons.has-addons .button.is-focused,.buttons.has-addons .button.is-selected,.buttons.has-addons .button:active,.buttons.has-addons .button:focus{z-index:3}.buttons.has-addons .button.is-active:hover,.buttons.has-addons .button.is-focused:hover,.buttons.has-addons .button.is-selected:hover,.buttons.has-addons .button:active:hover,.buttons.has-addons .button:focus:hover{z-index:4}.buttons.is-centered{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.buttons.is-right{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}.container{margin:0 auto;position:relative}@media screen and (min-width:1024px){.container{max-width:960px;width:960px}.container.is-fluid{margin-left:32px;margin-right:32px;max-width:none;width:auto}}@media screen and (max-width:1215px){.container.is-widescreen{max-width:1152px;width:auto}}@media screen and (max-width:1407px){.container.is-fullhd{max-width:1344px;width:auto}}@media screen and (min-width:1216px){.container{max-width:1152px;width:1152px}}@media screen and (min-width:1408px){.container{max-width:1344px;width:1344px}}.content:not(:last-child){margin-bottom:1.5rem}.content li+li{margin-top:.25em}.content blockquote:not(:last-child),.content dl:not(:last-child),.content ol:not(:last-child),.content p:not(:last-child),.content pre:not(:last-child),.content table:not(:last-child),.content ul:not(:last-child){margin-bottom:1em}.content h1,.content h2,.content h3,.content h4,.content h5,.content h6{color:#363636;font-weight:400;line-height:1.125}.content h1{font-size:2em;margin-bottom:.5em}.content h1:not(:first-child){margin-top:1em}.content h2{font-size:1.75em;margin-bottom:.5714em}.content h2:not(:first-child){margin-top:1.1428em}.content h3{font-size:1.5em;margin-bottom:.6666em}.content h3:not(:first-child){margin-top:1.3333em}.content h4{font-size:1.25em;margin-bottom:.8em}.content h5{font-size:1.125em;margin-bottom:.8888em}.content h6{font-size:1em;margin-bottom:1em}.content blockquote{background-color:#f5f5f5;border-left:5px solid #dbdbdb;padding:1.25em 1.5em}.content ol{list-style:decimal outside;margin-left:2em;margin-top:1em}.content ul{list-style:disc outside;margin-left:2em;margin-top:1em}.content ul ul{list-style-type:circle;margin-top:.5em}.content ul ul ul{list-style-type:square}.content dd{margin-left:2em}.content figure{margin-left:2em;margin-right:2em;text-align:center}.content figure:not(:first-child){margin-top:2em}.content figure:not(:last-child){margin-bottom:2em}.content figure img{display:inline-block}.content figure figcaption{font-style:italic}.content pre{-webkit-overflow-scrolling:touch;overflow-x:auto;padding:1.25em 1.5em;white-space:pre;word-wrap:normal}.content sub,.content sup{font-size:75%}.content table{width:100%}.content table td,.content table th{border:1px solid #dbdbdb;border-width:0 0 1px;padding:.5em .75em;vertical-align:top}.content table th{color:#363636;text-align:left}.content table tr:hover{background-color:#f5f5f5}.content table thead td,.content table thead th{border-width:0 0 2px;color:#363636}.content table tfoot td,.content table tfoot th{border-width:2px 0 0;color:#363636}.content table tbody tr:last-child td,.content table tbody tr:last-child th{border-bottom-width:0}.content.is-small{font-size:.75rem}.content.is-medium{font-size:1.25rem}.content.is-large{font-size:1.5rem}.input,.textarea{-moz-appearance:none;-webkit-appearance:none;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border:1px solid transparent;border-radius:3px;-webkit-box-shadow:none;box-shadow:none;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;font-size:1rem;height:2.25em;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;line-height:1.5;padding-bottom:calc(.375em - 1px);padding-left:calc(.625em - 1px);padding-right:calc(.625em - 1px);padding-top:calc(.375em - 1px);position:relative;vertical-align:top;background-color:#fff;border-color:#dbdbdb;color:#363636;-webkit-box-shadow:inset 0 1px 2px rgba(10,10,10,.1);box-shadow:inset 0 1px 2px rgba(10,10,10,.1);max-width:100%;width:100%}.input.is-active,.input.is-focused,.input:active,.input:focus,.textarea.is-active,.textarea.is-focused,.textarea:active,.textarea:focus{outline:0}.input[disabled],.textarea[disabled]{cursor:not-allowed}.input::-moz-placeholder,.textarea::-moz-placeholder{color:rgba(54,54,54,.3)}.input::-webkit-input-placeholder,.textarea::-webkit-input-placeholder{color:rgba(54,54,54,.3)}.input:-moz-placeholder,.textarea:-moz-placeholder{color:rgba(54,54,54,.3)}.input:-ms-input-placeholder,.textarea:-ms-input-placeholder{color:rgba(54,54,54,.3)}.input.is-hovered,.input:hover,.textarea.is-hovered,.textarea:hover{border-color:#b5b5b5}.input.is-active,.input.is-focused,.input:active,.input:focus,.textarea.is-active,.textarea.is-focused,.textarea:active,.textarea:focus{border-color:#3273dc;-webkit-box-shadow:0 0 0 .125em rgba(50,115,220,.25);box-shadow:0 0 0 .125em rgba(50,115,220,.25)}.input[disabled],.textarea[disabled]{background-color:#f5f5f5;border-color:#f5f5f5;-webkit-box-shadow:none;box-shadow:none;color:#7a7a7a}.input[disabled]::-moz-placeholder,.textarea[disabled]::-moz-placeholder{color:rgba(122,122,122,.3)}.input[disabled]::-webkit-input-placeholder,.textarea[disabled]::-webkit-input-placeholder{color:rgba(122,122,122,.3)}.input[disabled]:-moz-placeholder,.textarea[disabled]:-moz-placeholder{color:rgba(122,122,122,.3)}.input[disabled]:-ms-input-placeholder,.textarea[disabled]:-ms-input-placeholder{color:rgba(122,122,122,.3)}.input[readonly],.textarea[readonly]{-webkit-box-shadow:none;box-shadow:none}.input.is-white,.textarea.is-white{border-color:#fff}.input.is-white.is-active,.input.is-white.is-focused,.input.is-white:active,.input.is-white:focus,.textarea.is-white.is-active,.textarea.is-white.is-focused,.textarea.is-white:active,.textarea.is-white:focus{-webkit-box-shadow:0 0 0 .125em rgba(255,255,255,.25);box-shadow:0 0 0 .125em rgba(255,255,255,.25)}.input.is-black,.textarea.is-black{border-color:#0a0a0a}.input.is-black.is-active,.input.is-black.is-focused,.input.is-black:active,.input.is-black:focus,.textarea.is-black.is-active,.textarea.is-black.is-focused,.textarea.is-black:active,.textarea.is-black:focus{-webkit-box-shadow:0 0 0 .125em rgba(10,10,10,.25);box-shadow:0 0 0 .125em rgba(10,10,10,.25)}.input.is-light,.textarea.is-light{border-color:#f5f5f5}.input.is-light.is-active,.input.is-light.is-focused,.input.is-light:active,.input.is-light:focus,.textarea.is-light.is-active,.textarea.is-light.is-focused,.textarea.is-light:active,.textarea.is-light:focus{-webkit-box-shadow:0 0 0 .125em rgba(245,245,245,.25);box-shadow:0 0 0 .125em rgba(245,245,245,.25)}.input.is-dark,.textarea.is-dark{border-color:#363636}.input.is-dark.is-active,.input.is-dark.is-focused,.input.is-dark:active,.input.is-dark:focus,.textarea.is-dark.is-active,.textarea.is-dark.is-focused,.textarea.is-dark:active,.textarea.is-dark:focus{-webkit-box-shadow:0 0 0 .125em rgba(54,54,54,.25);box-shadow:0 0 0 .125em rgba(54,54,54,.25)}.input.is-primary,.textarea.is-primary{border-color:#00d1b2}.input.is-primary.is-active,.input.is-primary.is-focused,.input.is-primary:active,.input.is-primary:focus,.textarea.is-primary.is-active,.textarea.is-primary.is-focused,.textarea.is-primary:active,.textarea.is-primary:focus{-webkit-box-shadow:0 0 0 .125em rgba(0,209,178,.25);box-shadow:0 0 0 .125em rgba(0,209,178,.25)}.input.is-link,.textarea.is-link{border-color:#3273dc}.input.is-link.is-active,.input.is-link.is-focused,.input.is-link:active,.input.is-link:focus,.textarea.is-link.is-active,.textarea.is-link.is-focused,.textarea.is-link:active,.textarea.is-link:focus{-webkit-box-shadow:0 0 0 .125em rgba(50,115,220,.25);box-shadow:0 0 0 .125em rgba(50,115,220,.25)}.input.is-info,.textarea.is-info{border-color:#209cee}.input.is-info.is-active,.input.is-info.is-focused,.input.is-info:active,.input.is-info:focus,.textarea.is-info.is-active,.textarea.is-info.is-focused,.textarea.is-info:active,.textarea.is-info:focus{-webkit-box-shadow:0 0 0 .125em rgba(32,156,238,.25);box-shadow:0 0 0 .125em rgba(32,156,238,.25)}.input.is-success,.textarea.is-success{border-color:#23d160}.input.is-success.is-active,.input.is-success.is-focused,.input.is-success:active,.input.is-success:focus,.textarea.is-success.is-active,.textarea.is-success.is-focused,.textarea.is-success:active,.textarea.is-success:focus{-webkit-box-shadow:0 0 0 .125em rgba(35,209,96,.25);box-shadow:0 0 0 .125em rgba(35,209,96,.25)}.input.is-warning,.textarea.is-warning{border-color:#ffdd57}.input.is-warning.is-active,.input.is-warning.is-focused,.input.is-warning:active,.input.is-warning:focus,.textarea.is-warning.is-active,.textarea.is-warning.is-focused,.textarea.is-warning:active,.textarea.is-warning:focus{-webkit-box-shadow:0 0 0 .125em rgba(255,221,87,.25);box-shadow:0 0 0 .125em rgba(255,221,87,.25)}.input.is-danger,.textarea.is-danger{border-color:#ff3860}.input.is-danger.is-active,.input.is-danger.is-focused,.input.is-danger:active,.input.is-danger:focus,.textarea.is-danger.is-active,.textarea.is-danger.is-focused,.textarea.is-danger:active,.textarea.is-danger:focus{-webkit-box-shadow:0 0 0 .125em rgba(255,56,96,.25);box-shadow:0 0 0 .125em rgba(255,56,96,.25)}.input.is-small,.textarea.is-small{border-radius:2px;font-size:.75rem}.input.is-medium,.textarea.is-medium{font-size:1.25rem}.input.is-large,.textarea.is-large{font-size:1.5rem}.input.is-fullwidth,.textarea.is-fullwidth{display:block;width:100%}.input.is-inline,.textarea.is-inline{display:inline;width:auto}.input.is-rounded{border-radius:290486px;padding-left:1em;padding-right:1em}.input.is-static{background-color:transparent;border-color:transparent;-webkit-box-shadow:none;box-shadow:none;padding-left:0;padding-right:0}.textarea{display:block;max-width:100%;min-width:100%;padding:.625em;resize:vertical}.textarea:not([rows]){max-height:600px;min-height:120px}.textarea[rows]{height:unset}.textarea.has-fixed-size{resize:none}.checkbox,.radio{cursor:pointer;display:inline-block;line-height:1.25;position:relative}.checkbox input,.radio input{cursor:pointer}.checkbox:hover,.radio:hover{color:#363636}.checkbox[disabled],.radio[disabled]{color:#7a7a7a;cursor:not-allowed}.radio+.radio{margin-left:.5em}.select{display:inline-block;max-width:100%;position:relative;vertical-align:top}.select:not(.is-multiple){height:2.25em}.select:not(.is-multiple)::after{border:1px solid #3273dc;border-right:0;border-top:0;content:" ";display:block;height:.5em;pointer-events:none;position:absolute;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:center;transform-origin:center;width:.5em;margin-top:-.375em;right:1.125em;top:50%;z-index:4}.select.is-rounded select{border-radius:290486px;padding-left:1em}.select select{-moz-appearance:none;-webkit-appearance:none;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border:1px solid transparent;border-radius:3px;-webkit-box-shadow:none;box-shadow:none;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;font-size:1rem;height:2.25em;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;line-height:1.5;padding-bottom:calc(.375em - 1px);padding-left:calc(.625em - 1px);padding-right:calc(.625em - 1px);padding-top:calc(.375em - 1px);position:relative;vertical-align:top;background-color:#fff;border-color:#dbdbdb;color:#363636;cursor:pointer;display:block;font-size:1em;max-width:100%;outline:0}.select select.is-active,.select select.is-focused,.select select:active,.select select:focus{outline:0}.select select[disabled]{cursor:not-allowed}.select select::-moz-placeholder{color:rgba(54,54,54,.3)}.select select::-webkit-input-placeholder{color:rgba(54,54,54,.3)}.select select:-moz-placeholder{color:rgba(54,54,54,.3)}.select select:-ms-input-placeholder{color:rgba(54,54,54,.3)}.select select.is-hovered,.select select:hover{border-color:#b5b5b5}.select select.is-active,.select select.is-focused,.select select:active,.select select:focus{border-color:#3273dc;-webkit-box-shadow:0 0 0 .125em rgba(50,115,220,.25);box-shadow:0 0 0 .125em rgba(50,115,220,.25)}.select select[disabled]{background-color:#f5f5f5;border-color:#f5f5f5;-webkit-box-shadow:none;box-shadow:none;color:#7a7a7a}.select select[disabled]::-moz-placeholder{color:rgba(122,122,122,.3)}.select select[disabled]::-webkit-input-placeholder{color:rgba(122,122,122,.3)}.select select[disabled]:-moz-placeholder{color:rgba(122,122,122,.3)}.select select[disabled]:-ms-input-placeholder{color:rgba(122,122,122,.3)}.select select::-ms-expand{display:none}.select select[disabled]:hover{border-color:#f5f5f5}.select select:not([multiple]){padding-right:2.5em}.select select[multiple]{height:unset;padding:0}.select select[multiple] option{padding:.5em 1em}.select:hover::after{border-color:#363636}.select.is-white select{border-color:#fff}.select.is-white select.is-active,.select.is-white select.is-focused,.select.is-white select:active,.select.is-white select:focus{-webkit-box-shadow:0 0 0 .125em rgba(255,255,255,.25);box-shadow:0 0 0 .125em rgba(255,255,255,.25)}.select.is-black select{border-color:#0a0a0a}.select.is-black select.is-active,.select.is-black select.is-focused,.select.is-black select:active,.select.is-black select:focus{-webkit-box-shadow:0 0 0 .125em rgba(10,10,10,.25);box-shadow:0 0 0 .125em rgba(10,10,10,.25)}.select.is-light select{border-color:#f5f5f5}.select.is-light select.is-active,.select.is-light select.is-focused,.select.is-light select:active,.select.is-light select:focus{-webkit-box-shadow:0 0 0 .125em rgba(245,245,245,.25);box-shadow:0 0 0 .125em rgba(245,245,245,.25)}.select.is-dark select{border-color:#363636}.select.is-dark select.is-active,.select.is-dark select.is-focused,.select.is-dark select:active,.select.is-dark select:focus{-webkit-box-shadow:0 0 0 .125em rgba(54,54,54,.25);box-shadow:0 0 0 .125em rgba(54,54,54,.25)}.select.is-primary select{border-color:#00d1b2}.select.is-primary select.is-active,.select.is-primary select.is-focused,.select.is-primary select:active,.select.is-primary select:focus{-webkit-box-shadow:0 0 0 .125em rgba(0,209,178,.25);box-shadow:0 0 0 .125em rgba(0,209,178,.25)}.select.is-link select{border-color:#3273dc}.select.is-link select.is-active,.select.is-link select.is-focused,.select.is-link select:active,.select.is-link select:focus{-webkit-box-shadow:0 0 0 .125em rgba(50,115,220,.25);box-shadow:0 0 0 .125em rgba(50,115,220,.25)}.select.is-info select{border-color:#209cee}.select.is-info select.is-active,.select.is-info select.is-focused,.select.is-info select:active,.select.is-info select:focus{-webkit-box-shadow:0 0 0 .125em rgba(32,156,238,.25);box-shadow:0 0 0 .125em rgba(32,156,238,.25)}.select.is-success select{border-color:#23d160}.select.is-success select.is-active,.select.is-success select.is-focused,.select.is-success select:active,.select.is-success select:focus{-webkit-box-shadow:0 0 0 .125em rgba(35,209,96,.25);box-shadow:0 0 0 .125em rgba(35,209,96,.25)}.select.is-warning select{border-color:#ffdd57}.select.is-warning select.is-active,.select.is-warning select.is-focused,.select.is-warning select:active,.select.is-warning select:focus{-webkit-box-shadow:0 0 0 .125em rgba(255,221,87,.25);box-shadow:0 0 0 .125em rgba(255,221,87,.25)}.select.is-danger select{border-color:#ff3860}.select.is-danger select.is-active,.select.is-danger select.is-focused,.select.is-danger select:active,.select.is-danger select:focus{-webkit-box-shadow:0 0 0 .125em rgba(255,56,96,.25);box-shadow:0 0 0 .125em rgba(255,56,96,.25)}.select.is-small{border-radius:2px;font-size:.75rem}.select.is-medium{font-size:1.25rem}.select.is-large{font-size:1.5rem}.select.is-disabled::after{border-color:#7a7a7a}.select.is-fullwidth{width:100%}.select.is-fullwidth select{width:100%}.select.is-loading::after{-webkit-animation:spinAround .5s infinite linear;animation:spinAround .5s infinite linear;border:2px solid #dbdbdb;border-radius:290486px;border-right-color:transparent;border-top-color:transparent;content:"";display:block;height:1em;position:relative;width:1em;margin-top:0;position:absolute;right:.625em;top:.625em;-webkit-transform:none;transform:none}.select.is-loading.is-small:after{font-size:.75rem}.select.is-loading.is-medium:after{font-size:1.25rem}.select.is-loading.is-large:after{font-size:1.5rem}.file{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;position:relative}.file.is-white .file-cta{background-color:#fff;border-color:transparent;color:#0a0a0a}.file.is-white.is-hovered .file-cta,.file.is-white:hover .file-cta{background-color:#f9f9f9;border-color:transparent;color:#0a0a0a}.file.is-white.is-focused .file-cta,.file.is-white:focus .file-cta{border-color:transparent;-webkit-box-shadow:0 0 .5em rgba(255,255,255,.25);box-shadow:0 0 .5em rgba(255,255,255,.25);color:#0a0a0a}.file.is-white.is-active .file-cta,.file.is-white:active .file-cta{background-color:#f2f2f2;border-color:transparent;color:#0a0a0a}.file.is-black .file-cta{background-color:#0a0a0a;border-color:transparent;color:#fff}.file.is-black.is-hovered .file-cta,.file.is-black:hover .file-cta{background-color:#040404;border-color:transparent;color:#fff}.file.is-black.is-focused .file-cta,.file.is-black:focus .file-cta{border-color:transparent;-webkit-box-shadow:0 0 .5em rgba(10,10,10,.25);box-shadow:0 0 .5em rgba(10,10,10,.25);color:#fff}.file.is-black.is-active .file-cta,.file.is-black:active .file-cta{background-color:#000;border-color:transparent;color:#fff}.file.is-light .file-cta{background-color:#f5f5f5;border-color:transparent;color:#363636}.file.is-light.is-hovered .file-cta,.file.is-light:hover .file-cta{background-color:#eee;border-color:transparent;color:#363636}.file.is-light.is-focused .file-cta,.file.is-light:focus .file-cta{border-color:transparent;-webkit-box-shadow:0 0 .5em rgba(245,245,245,.25);box-shadow:0 0 .5em rgba(245,245,245,.25);color:#363636}.file.is-light.is-active .file-cta,.file.is-light:active .file-cta{background-color:#e8e8e8;border-color:transparent;color:#363636}.file.is-dark .file-cta{background-color:#363636;border-color:transparent;color:#f5f5f5}.file.is-dark.is-hovered .file-cta,.file.is-dark:hover .file-cta{background-color:#2f2f2f;border-color:transparent;color:#f5f5f5}.file.is-dark.is-focused .file-cta,.file.is-dark:focus .file-cta{border-color:transparent;-webkit-box-shadow:0 0 .5em rgba(54,54,54,.25);box-shadow:0 0 .5em rgba(54,54,54,.25);color:#f5f5f5}.file.is-dark.is-active .file-cta,.file.is-dark:active .file-cta{background-color:#292929;border-color:transparent;color:#f5f5f5}.file.is-primary .file-cta{background-color:#00d1b2;border-color:transparent;color:#fff}.file.is-primary.is-hovered .file-cta,.file.is-primary:hover .file-cta{background-color:#00c4a7;border-color:transparent;color:#fff}.file.is-primary.is-focused .file-cta,.file.is-primary:focus .file-cta{border-color:transparent;-webkit-box-shadow:0 0 .5em rgba(0,209,178,.25);box-shadow:0 0 .5em rgba(0,209,178,.25);color:#fff}.file.is-primary.is-active .file-cta,.file.is-primary:active .file-cta{background-color:#00b89c;border-color:transparent;color:#fff}.file.is-link .file-cta{background-color:#3273dc;border-color:transparent;color:#fff}.file.is-link.is-hovered .file-cta,.file.is-link:hover .file-cta{background-color:#276cda;border-color:transparent;color:#fff}.file.is-link.is-focused .file-cta,.file.is-link:focus .file-cta{border-color:transparent;-webkit-box-shadow:0 0 .5em rgba(50,115,220,.25);box-shadow:0 0 .5em rgba(50,115,220,.25);color:#fff}.file.is-link.is-active .file-cta,.file.is-link:active .file-cta{background-color:#2366d1;border-color:transparent;color:#fff}.file.is-info .file-cta{background-color:#209cee;border-color:transparent;color:#fff}.file.is-info.is-hovered .file-cta,.file.is-info:hover .file-cta{background-color:#1496ed;border-color:transparent;color:#fff}.file.is-info.is-focused .file-cta,.file.is-info:focus .file-cta{border-color:transparent;-webkit-box-shadow:0 0 .5em rgba(32,156,238,.25);box-shadow:0 0 .5em rgba(32,156,238,.25);color:#fff}.file.is-info.is-active .file-cta,.file.is-info:active .file-cta{background-color:#118fe4;border-color:transparent;color:#fff}.file.is-success .file-cta{background-color:#23d160;border-color:transparent;color:#fff}.file.is-success.is-hovered .file-cta,.file.is-success:hover .file-cta{background-color:#22c65b;border-color:transparent;color:#fff}.file.is-success.is-focused .file-cta,.file.is-success:focus .file-cta{border-color:transparent;-webkit-box-shadow:0 0 .5em rgba(35,209,96,.25);box-shadow:0 0 .5em rgba(35,209,96,.25);color:#fff}.file.is-success.is-active .file-cta,.file.is-success:active .file-cta{background-color:#20bc56;border-color:transparent;color:#fff}.file.is-warning .file-cta{background-color:#ffdd57;border-color:transparent;color:rgba(0,0,0,.7)}.file.is-warning.is-hovered .file-cta,.file.is-warning:hover .file-cta{background-color:#ffdb4a;border-color:transparent;color:rgba(0,0,0,.7)}.file.is-warning.is-focused .file-cta,.file.is-warning:focus .file-cta{border-color:transparent;-webkit-box-shadow:0 0 .5em rgba(255,221,87,.25);box-shadow:0 0 .5em rgba(255,221,87,.25);color:rgba(0,0,0,.7)}.file.is-warning.is-active .file-cta,.file.is-warning:active .file-cta{background-color:#ffd83d;border-color:transparent;color:rgba(0,0,0,.7)}.file.is-danger .file-cta{background-color:#ff3860;border-color:transparent;color:#fff}.file.is-danger.is-hovered .file-cta,.file.is-danger:hover .file-cta{background-color:#ff2b56;border-color:transparent;color:#fff}.file.is-danger.is-focused .file-cta,.file.is-danger:focus .file-cta{border-color:transparent;-webkit-box-shadow:0 0 .5em rgba(255,56,96,.25);box-shadow:0 0 .5em rgba(255,56,96,.25);color:#fff}.file.is-danger.is-active .file-cta,.file.is-danger:active .file-cta{background-color:#ff1f4b;border-color:transparent;color:#fff}.file.is-small{font-size:.75rem}.file.is-medium{font-size:1.25rem}.file.is-medium .file-icon .fa{font-size:21px}.file.is-large{font-size:1.5rem}.file.is-large .file-icon .fa{font-size:28px}.file.has-name .file-cta{border-bottom-right-radius:0;border-top-right-radius:0}.file.has-name .file-name{border-bottom-left-radius:0;border-top-left-radius:0}.file.has-name.is-empty .file-cta{border-radius:3px}.file.has-name.is-empty .file-name{display:none}.file.is-boxed .file-label{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.file.is-boxed .file-cta{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;height:auto;padding:1em 3em}.file.is-boxed .file-name{border-width:0 1px 1px}.file.is-boxed .file-icon{height:1.5em;width:1.5em}.file.is-boxed .file-icon .fa{font-size:21px}.file.is-boxed.is-small .file-icon .fa{font-size:14px}.file.is-boxed.is-medium .file-icon .fa{font-size:28px}.file.is-boxed.is-large .file-icon .fa{font-size:35px}.file.is-boxed.has-name .file-cta{border-radius:3px 3px 0 0}.file.is-boxed.has-name .file-name{border-radius:0 0 3px 3px;border-width:0 1px 1px}.file.is-centered{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.file.is-fullwidth .file-label{width:100%}.file.is-fullwidth .file-name{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;max-width:none}.file.is-right{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}.file.is-right .file-cta{border-radius:0 3px 3px 0}.file.is-right .file-name{border-radius:3px 0 0 3px;border-width:1px 0 1px 1px;-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.file-label{-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;display:-webkit-box;display:-ms-flexbox;display:flex;cursor:pointer;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;overflow:hidden;position:relative}.file-label:hover .file-cta{background-color:#eee;color:#363636}.file-label:hover .file-name{border-color:#d5d5d5}.file-label:active .file-cta{background-color:#e8e8e8;color:#363636}.file-label:active .file-name{border-color:#cfcfcf}.file-input{height:.01em;left:0;outline:0;position:absolute;top:0;width:.01em}.file-cta,.file-name{-moz-appearance:none;-webkit-appearance:none;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border:1px solid transparent;border-radius:3px;-webkit-box-shadow:none;box-shadow:none;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;font-size:1rem;height:2.25em;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;line-height:1.5;padding-bottom:calc(.375em - 1px);padding-left:calc(.625em - 1px);padding-right:calc(.625em - 1px);padding-top:calc(.375em - 1px);position:relative;vertical-align:top;border-color:#dbdbdb;border-radius:3px;font-size:1em;padding-left:1em;padding-right:1em;white-space:nowrap}.file-cta.is-active,.file-cta.is-focused,.file-cta:active,.file-cta:focus,.file-name.is-active,.file-name.is-focused,.file-name:active,.file-name:focus{outline:0}.file-cta[disabled],.file-name[disabled]{cursor:not-allowed}.file-cta{background-color:#f5f5f5;color:#4a4a4a}.file-name{border-color:#dbdbdb;border-style:solid;border-width:1px 1px 1px 0;display:block;max-width:16em;overflow:hidden;text-align:left;text-overflow:ellipsis}.file-icon{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;height:1em;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:.5em;width:1em}.file-icon .fa{font-size:14px}.label{color:#363636;display:block;font-size:1rem;font-weight:700}.label:not(:last-child){margin-bottom:.5em}.label.is-small{font-size:.75rem}.label.is-medium{font-size:1.25rem}.label.is-large{font-size:1.5rem}.help{display:block;font-size:.75rem;margin-top:.25rem}.help.is-white{color:#fff}.help.is-black{color:#0a0a0a}.help.is-light{color:#f5f5f5}.help.is-dark{color:#363636}.help.is-primary{color:#00d1b2}.help.is-link{color:#3273dc}.help.is-info{color:#209cee}.help.is-success{color:#23d160}.help.is-warning{color:#ffdd57}.help.is-danger{color:#ff3860}.field:not(:last-child){margin-bottom:.75rem}.field.has-addons{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}.field.has-addons .control:not(:last-child){margin-right:-1px}.field.has-addons .control:not(:first-child):not(:last-child) .button,.field.has-addons .control:not(:first-child):not(:last-child) .input,.field.has-addons .control:not(:first-child):not(:last-child) .select select{border-radius:0}.field.has-addons .control:first-child .button,.field.has-addons .control:first-child .input,.field.has-addons .control:first-child .select select{border-bottom-right-radius:0;border-top-right-radius:0}.field.has-addons .control:last-child .button,.field.has-addons .control:last-child .input,.field.has-addons .control:last-child .select select{border-bottom-left-radius:0;border-top-left-radius:0}.field.has-addons .control .button.is-hovered,.field.has-addons .control .button:hover,.field.has-addons .control .input.is-hovered,.field.has-addons .control .input:hover,.field.has-addons .control .select select.is-hovered,.field.has-addons .control .select select:hover{z-index:2}.field.has-addons .control .button.is-active,.field.has-addons .control .button.is-focused,.field.has-addons .control .button:active,.field.has-addons .control .button:focus,.field.has-addons .control .input.is-active,.field.has-addons .control .input.is-focused,.field.has-addons .control .input:active,.field.has-addons .control .input:focus,.field.has-addons .control .select select.is-active,.field.has-addons .control .select select.is-focused,.field.has-addons .control .select select:active,.field.has-addons .control .select select:focus{z-index:3}.field.has-addons .control .button.is-active:hover,.field.has-addons .control .button.is-focused:hover,.field.has-addons .control .button:active:hover,.field.has-addons .control .button:focus:hover,.field.has-addons .control .input.is-active:hover,.field.has-addons .control .input.is-focused:hover,.field.has-addons .control .input:active:hover,.field.has-addons .control .input:focus:hover,.field.has-addons .control .select select.is-active:hover,.field.has-addons .control .select select.is-focused:hover,.field.has-addons .control .select select:active:hover,.field.has-addons .control .select select:focus:hover{z-index:4}.field.has-addons .control.is-expanded{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.field.has-addons.has-addons-centered{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.field.has-addons.has-addons-right{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}.field.has-addons.has-addons-fullwidth .control{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:0;flex-shrink:0}.field.is-grouped{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}.field.is-grouped>.control{-ms-flex-negative:0;flex-shrink:0}.field.is-grouped>.control:not(:last-child){margin-bottom:0;margin-right:.75rem}.field.is-grouped>.control.is-expanded{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:1;flex-shrink:1}.field.is-grouped.is-grouped-centered{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.field.is-grouped.is-grouped-right{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}.field.is-grouped.is-grouped-multiline{-ms-flex-wrap:wrap;flex-wrap:wrap}.field.is-grouped.is-grouped-multiline>.control:last-child,.field.is-grouped.is-grouped-multiline>.control:not(:last-child){margin-bottom:.75rem}.field.is-grouped.is-grouped-multiline:last-child{margin-bottom:-.75rem}.field.is-grouped.is-grouped-multiline:not(:last-child){margin-bottom:0}@media screen and (min-width:769px),print{.field.is-horizontal{display:-webkit-box;display:-ms-flexbox;display:flex}}.field-label .label{font-size:inherit}@media screen and (max-width:768px){.field-label{margin-bottom:.5rem}}@media screen and (min-width:769px),print{.field-label{-ms-flex-preferred-size:0;flex-basis:0;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:0;flex-shrink:0;margin-right:1.5rem;text-align:right}.field-label.is-small{font-size:.75rem;padding-top:.375em}.field-label.is-normal{padding-top:.375em}.field-label.is-medium{font-size:1.25rem;padding-top:.375em}.field-label.is-large{font-size:1.5rem;padding-top:.375em}}.field-body .field .field{margin-bottom:0}@media screen and (min-width:769px),print{.field-body{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-preferred-size:0;flex-basis:0;-webkit-box-flex:5;-ms-flex-positive:5;flex-grow:5;-ms-flex-negative:1;flex-shrink:1}.field-body .field{margin-bottom:0}.field-body>.field{-ms-flex-negative:1;flex-shrink:1}.field-body>.field:not(.is-narrow){-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.field-body>.field:not(:last-child){margin-right:.75rem}}.control{font-size:1rem;position:relative;text-align:left}.control.has-icon .icon{color:#dbdbdb;height:2.25em;pointer-events:none;position:absolute;top:0;width:2.25em;z-index:4}.control.has-icon .input:focus+.icon{color:#7a7a7a}.control.has-icon .input.is-small+.icon{font-size:.75rem}.control.has-icon .input.is-medium+.icon{font-size:1.25rem}.control.has-icon .input.is-large+.icon{font-size:1.5rem}.control.has-icon:not(.has-icon-right) .icon{left:0}.control.has-icon:not(.has-icon-right) .input{padding-left:2.25em}.control.has-icon.has-icon-right .icon{right:0}.control.has-icon.has-icon-right .input{padding-right:2.25em}.control.has-icons-left .input:focus~.icon,.control.has-icons-left .select:focus~.icon,.control.has-icons-right .input:focus~.icon,.control.has-icons-right .select:focus~.icon{color:#7a7a7a}.control.has-icons-left .input.is-small~.icon,.control.has-icons-left .select.is-small~.icon,.control.has-icons-right .input.is-small~.icon,.control.has-icons-right .select.is-small~.icon{font-size:.75rem}.control.has-icons-left .input.is-medium~.icon,.control.has-icons-left .select.is-medium~.icon,.control.has-icons-right .input.is-medium~.icon,.control.has-icons-right .select.is-medium~.icon{font-size:1.25rem}.control.has-icons-left .input.is-large~.icon,.control.has-icons-left .select.is-large~.icon,.control.has-icons-right .input.is-large~.icon,.control.has-icons-right .select.is-large~.icon{font-size:1.5rem}.control.has-icons-left .icon,.control.has-icons-right .icon{color:#dbdbdb;height:2.25em;pointer-events:none;position:absolute;top:0;width:2.25em;z-index:4}.control.has-icons-left .input,.control.has-icons-left .select select{padding-left:2.25em}.control.has-icons-left .icon.is-left{left:0}.control.has-icons-right .input,.control.has-icons-right .select select{padding-right:2.25em}.control.has-icons-right .icon.is-right{right:0}.control.is-loading::after{-webkit-animation:spinAround .5s infinite linear;animation:spinAround .5s infinite linear;border:2px solid #dbdbdb;border-radius:290486px;border-right-color:transparent;border-top-color:transparent;content:"";display:block;height:1em;position:relative;width:1em;position:absolute!important;right:.625em;top:.625em;z-index:4}.control.is-loading.is-small:after{font-size:.75rem}.control.is-loading.is-medium:after{font-size:1.25rem}.control.is-loading.is-large:after{font-size:1.5rem}.icon{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;height:1.5rem;width:1.5rem}.icon.is-small{height:1rem;width:1rem}.icon.is-medium{height:2rem;width:2rem}.icon.is-large{height:3rem;width:3rem}.image{display:block;position:relative}.image img{display:block;height:auto;width:100%}.image img.is-rounded{border-radius:290486px}.image.is-16by9 img,.image.is-1by1 img,.image.is-2by1 img,.image.is-3by2 img,.image.is-4by3 img,.image.is-square img{bottom:0;left:0;position:absolute;right:0;top:0;height:100%;width:100%}.image.is-1by1,.image.is-square{padding-top:100%}.image.is-4by3{padding-top:75%}.image.is-3by2{padding-top:66.6666%}.image.is-16by9{padding-top:56.25%}.image.is-2by1{padding-top:50%}.image.is-16x16{height:16px;width:16px}.image.is-24x24{height:24px;width:24px}.image.is-32x32{height:32px;width:32px}.image.is-48x48{height:48px;width:48px}.image.is-64x64{height:64px;width:64px}.image.is-96x96{height:96px;width:96px}.image.is-128x128{height:128px;width:128px}.notification{background-color:#f5f5f5;border-radius:3px;padding:1.25rem 2.5rem 1.25rem 1.5rem;position:relative}.notification:not(:last-child){margin-bottom:1.5rem}.notification a:not(.button){color:currentColor;text-decoration:underline}.notification strong{color:currentColor}.notification code,.notification pre{background:#fff}.notification pre code{background:0 0}.notification>.delete{position:absolute;right:.5rem;top:.5rem}.notification .content,.notification .subtitle,.notification .title{color:currentColor}.notification.is-white{background-color:#fff;color:#0a0a0a}.notification.is-black{background-color:#0a0a0a;color:#fff}.notification.is-light{background-color:#f5f5f5;color:#363636}.notification.is-dark{background-color:#363636;color:#f5f5f5}.notification.is-primary{background-color:#00d1b2;color:#fff}.notification.is-link{background-color:#3273dc;color:#fff}.notification.is-info{background-color:#209cee;color:#fff}.notification.is-success{background-color:#23d160;color:#fff}.notification.is-warning{background-color:#ffdd57;color:rgba(0,0,0,.7)}.notification.is-danger{background-color:#ff3860;color:#fff}.progress{-moz-appearance:none;-webkit-appearance:none;border:none;border-radius:290486px;display:block;height:1rem;overflow:hidden;padding:0;width:100%}.progress:not(:last-child){margin-bottom:1.5rem}.progress::-webkit-progress-bar{background-color:#dbdbdb}.progress::-webkit-progress-value{background-color:#4a4a4a}.progress::-moz-progress-bar{background-color:#4a4a4a}.progress::-ms-fill{background-color:#4a4a4a;border:none}.progress.is-white::-webkit-progress-value{background-color:#fff}.progress.is-white::-moz-progress-bar{background-color:#fff}.progress.is-white::-ms-fill{background-color:#fff}.progress.is-black::-webkit-progress-value{background-color:#0a0a0a}.progress.is-black::-moz-progress-bar{background-color:#0a0a0a}.progress.is-black::-ms-fill{background-color:#0a0a0a}.progress.is-light::-webkit-progress-value{background-color:#f5f5f5}.progress.is-light::-moz-progress-bar{background-color:#f5f5f5}.progress.is-light::-ms-fill{background-color:#f5f5f5}.progress.is-dark::-webkit-progress-value{background-color:#363636}.progress.is-dark::-moz-progress-bar{background-color:#363636}.progress.is-dark::-ms-fill{background-color:#363636}.progress.is-primary::-webkit-progress-value{background-color:#00d1b2}.progress.is-primary::-moz-progress-bar{background-color:#00d1b2}.progress.is-primary::-ms-fill{background-color:#00d1b2}.progress.is-link::-webkit-progress-value{background-color:#3273dc}.progress.is-link::-moz-progress-bar{background-color:#3273dc}.progress.is-link::-ms-fill{background-color:#3273dc}.progress.is-info::-webkit-progress-value{background-color:#209cee}.progress.is-info::-moz-progress-bar{background-color:#209cee}.progress.is-info::-ms-fill{background-color:#209cee}.progress.is-success::-webkit-progress-value{background-color:#23d160}.progress.is-success::-moz-progress-bar{background-color:#23d160}.progress.is-success::-ms-fill{background-color:#23d160}.progress.is-warning::-webkit-progress-value{background-color:#ffdd57}.progress.is-warning::-moz-progress-bar{background-color:#ffdd57}.progress.is-warning::-ms-fill{background-color:#ffdd57}.progress.is-danger::-webkit-progress-value{background-color:#ff3860}.progress.is-danger::-moz-progress-bar{background-color:#ff3860}.progress.is-danger::-ms-fill{background-color:#ff3860}.progress.is-small{height:.75rem}.progress.is-medium{height:1.25rem}.progress.is-large{height:1.5rem}.table{background-color:#fff;color:#363636;margin-bottom:1.5rem}.table td,.table th{border:1px solid #dbdbdb;border-width:0 0 1px;padding:.5em .75em;vertical-align:top}.table td.is-white,.table th.is-white{background-color:#fff;border-color:#fff;color:#0a0a0a}.table td.is-black,.table th.is-black{background-color:#0a0a0a;border-color:#0a0a0a;color:#fff}.table td.is-light,.table th.is-light{background-color:#f5f5f5;border-color:#f5f5f5;color:#363636}.table td.is-dark,.table th.is-dark{background-color:#363636;border-color:#363636;color:#f5f5f5}.table td.is-primary,.table th.is-primary{background-color:#00d1b2;border-color:#00d1b2;color:#fff}.table td.is-link,.table th.is-link{background-color:#3273dc;border-color:#3273dc;color:#fff}.table td.is-info,.table th.is-info{background-color:#209cee;border-color:#209cee;color:#fff}.table td.is-success,.table th.is-success{background-color:#23d160;border-color:#23d160;color:#fff}.table td.is-warning,.table th.is-warning{background-color:#ffdd57;border-color:#ffdd57;color:rgba(0,0,0,.7)}.table td.is-danger,.table th.is-danger{background-color:#ff3860;border-color:#ff3860;color:#fff}.table td.is-narrow,.table th.is-narrow{white-space:nowrap;width:1%}.table td.is-selected,.table th.is-selected{background-color:#00d1b2;color:#fff}.table td.is-selected a,.table td.is-selected strong,.table th.is-selected a,.table th.is-selected strong{color:currentColor}.table th{color:#363636;text-align:left}.table tr.is-selected{background-color:#00d1b2;color:#fff}.table tr.is-selected a,.table tr.is-selected strong{color:currentColor}.table tr.is-selected td,.table tr.is-selected th{border-color:#fff;color:currentColor}.table thead td,.table thead th{border-width:0 0 2px;color:#363636}.table tfoot td,.table tfoot th{border-width:2px 0 0;color:#363636}.table tbody tr:last-child td,.table tbody tr:last-child th{border-bottom-width:0}.table.is-bordered td,.table.is-bordered th{border-width:1px}.table.is-bordered tr:last-child td,.table.is-bordered tr:last-child th{border-bottom-width:1px}.table.is-fullwidth{width:100%}.table.is-hoverable tbody tr:not(.is-selected):hover{background-color:#fafafa}.table.is-hoverable.is-striped tbody tr:not(.is-selected):hover{background-color:#f5f5f5}.table.is-narrow td,.table.is-narrow th{padding:.25em .5em}.table.is-striped tbody tr:not(.is-selected):nth-child(even){background-color:#fafafa}.tags{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}.tags .tag{margin-bottom:.5rem}.tags .tag:not(:last-child){margin-right:.5rem}.tags:last-child{margin-bottom:-.5rem}.tags:not(:last-child){margin-bottom:1rem}.tags.has-addons .tag{margin-right:0}.tags.has-addons .tag:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.tags.has-addons .tag:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.tags.is-centered{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.tags.is-centered .tag{margin-right:.25rem;margin-left:.25rem}.tags.is-right{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}.tags.is-right .tag:not(:first-child){margin-left:.5rem}.tags.is-right .tag:not(:last-child){margin-right:0}.tag:not(body){-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:#f5f5f5;border-radius:3px;color:#4a4a4a;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;font-size:.75rem;height:2em;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;line-height:1.5;padding-left:.75em;padding-right:.75em;white-space:nowrap}.tag:not(body) .delete{margin-left:.25em;margin-right:-.375em}.tag:not(body).is-white{background-color:#fff;color:#0a0a0a}.tag:not(body).is-black{background-color:#0a0a0a;color:#fff}.tag:not(body).is-light{background-color:#f5f5f5;color:#363636}.tag:not(body).is-dark{background-color:#363636;color:#f5f5f5}.tag:not(body).is-primary{background-color:#00d1b2;color:#fff}.tag:not(body).is-link{background-color:#3273dc;color:#fff}.tag:not(body).is-info{background-color:#209cee;color:#fff}.tag:not(body).is-success{background-color:#23d160;color:#fff}.tag:not(body).is-warning{background-color:#ffdd57;color:rgba(0,0,0,.7)}.tag:not(body).is-danger{background-color:#ff3860;color:#fff}.tag:not(body).is-medium{font-size:1rem}.tag:not(body).is-large{font-size:1.25rem}.tag:not(body) .icon:first-child:not(:last-child){margin-left:-.375em;margin-right:.1875em}.tag:not(body) .icon:last-child:not(:first-child){margin-left:.1875em;margin-right:-.375em}.tag:not(body) .icon:first-child:last-child{margin-left:-.375em;margin-right:-.375em}.tag:not(body).is-delete{margin-left:1px;padding:0;position:relative;width:2em}.tag:not(body).is-delete:after,.tag:not(body).is-delete:before{background-color:currentColor;content:"";display:block;left:50%;position:absolute;top:50%;-webkit-transform:translateX(-50%) translateY(-50%) rotate(45deg);transform:translateX(-50%) translateY(-50%) rotate(45deg);-webkit-transform-origin:center center;transform-origin:center center}.tag:not(body).is-delete:before{height:1px;width:50%}.tag:not(body).is-delete:after{height:50%;width:1px}.tag:not(body).is-delete:focus,.tag:not(body).is-delete:hover{background-color:#e8e8e8}.tag:not(body).is-delete:active{background-color:#dbdbdb}.tag:not(body).is-rounded{border-radius:290486px}a.tag:hover{text-decoration:underline}.subtitle,.title{word-break:break-word}.subtitle:not(:last-child),.title:not(:last-child){margin-bottom:1.5rem}.subtitle em,.subtitle span,.title em,.title span{font-weight:inherit}.subtitle sub,.title sub{font-size:.75em}.subtitle sup,.title sup{font-size:.75em}.subtitle .tag,.title .tag{vertical-align:middle}.title{color:#363636;font-size:2rem;font-weight:600;line-height:1.125}.title strong{color:inherit;font-weight:inherit}.title+.highlight{margin-top:-.75rem}.title:not(.is-spaced)+.subtitle{margin-top:-1.5rem}.title.is-1{font-size:3rem}.title.is-2{font-size:2.5rem}.title.is-3{font-size:2rem}.title.is-4{font-size:1.5rem}.title.is-5{font-size:1.25rem}.title.is-6{font-size:1rem}.title.is-7{font-size:.75rem}.subtitle{color:#4a4a4a;font-size:1.25rem;font-weight:400;line-height:1.25}.subtitle strong{color:#363636;font-weight:600}.subtitle:not(.is-spaced)+.title{margin-top:-1.5rem}.subtitle.is-1{font-size:3rem}.subtitle.is-2{font-size:2.5rem}.subtitle.is-3{font-size:2rem}.subtitle.is-4{font-size:1.5rem}.subtitle.is-5{font-size:1.25rem}.subtitle.is-6{font-size:1rem}.subtitle.is-7{font-size:.75rem}.block:not(:last-child){margin-bottom:1.5rem}.delete{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-moz-appearance:none;-webkit-appearance:none;background-color:rgba(10,10,10,.2);border:none;border-radius:290486px;cursor:pointer;display:inline-block;-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;-ms-flex-negative:0;flex-shrink:0;font-size:0;height:20px;max-height:20px;max-width:20px;min-height:20px;min-width:20px;outline:0;position:relative;vertical-align:top;width:20px}.delete:after,.delete:before{background-color:#fff;content:"";display:block;left:50%;position:absolute;top:50%;-webkit-transform:translateX(-50%) translateY(-50%) rotate(45deg);transform:translateX(-50%) translateY(-50%) rotate(45deg);-webkit-transform-origin:center center;transform-origin:center center}.delete:before{height:2px;width:50%}.delete:after{height:50%;width:2px}.delete:focus,.delete:hover{background-color:rgba(10,10,10,.3)}.delete:active{background-color:rgba(10,10,10,.4)}.delete.is-small{height:16px;max-height:16px;max-width:16px;min-height:16px;min-width:16px;width:16px}.delete.is-medium{height:24px;max-height:24px;max-width:24px;min-height:24px;min-width:24px;width:24px}.delete.is-large{height:32px;max-height:32px;max-width:32px;min-height:32px;min-width:32px;width:32px}.heading{display:block;font-size:11px;letter-spacing:1px;margin-bottom:5px;text-transform:uppercase}.highlight{font-weight:400;max-width:100%;overflow:hidden;padding:0}.highlight:not(:last-child){margin-bottom:1.5rem}.highlight pre{overflow:auto;max-width:100%}.loader{-webkit-animation:spinAround .5s infinite linear;animation:spinAround .5s infinite linear;border:2px solid #dbdbdb;border-radius:290486px;border-right-color:transparent;border-top-color:transparent;content:"";display:block;height:1em;position:relative;width:1em}.number{-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:#f5f5f5;border-radius:290486px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;font-size:1.25rem;height:2em;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:1.5rem;min-width:2.5em;padding:.25rem .5rem;text-align:center;vertical-align:top}.breadcrumb{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;display:-webkit-box;display:-ms-flexbox;display:flex;font-size:1rem;overflow:hidden;overflow-x:auto;white-space:nowrap}.breadcrumb:not(:last-child){margin-bottom:1.5rem}.breadcrumb a{-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#3273dc;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;padding:.5em .75em}.breadcrumb a:hover{color:#363636}.breadcrumb li{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex}.breadcrumb li:first-child a{padding-left:0}.breadcrumb li.is-active a{color:#363636;cursor:default;pointer-events:none}.breadcrumb li+li::before{color:#4a4a4a;content:"\0002f"}.breadcrumb ol,.breadcrumb ul{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:0;flex-shrink:0;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}.breadcrumb .icon:first-child{margin-right:.5em}.breadcrumb .icon:last-child{margin-left:.5em}.breadcrumb.is-centered ol,.breadcrumb.is-centered ul{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.breadcrumb.is-right ol,.breadcrumb.is-right ul{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}.breadcrumb.is-small{font-size:.75rem}.breadcrumb.is-medium{font-size:1.25rem}.breadcrumb.is-large{font-size:1.5rem}.breadcrumb.has-arrow-separator li+li::before{content:"\02192"}.breadcrumb.has-bullet-separator li+li::before{content:"\02022"}.breadcrumb.has-dot-separator li+li::before{content:"\000b7"}.breadcrumb.has-succeeds-separator li+li::before{content:"\0227B"}.card{background-color:#fff;-webkit-box-shadow:0 2px 3px rgba(10,10,10,.1),0 0 0 1px rgba(10,10,10,.1);box-shadow:0 2px 3px rgba(10,10,10,.1),0 0 0 1px rgba(10,10,10,.1);color:#4a4a4a;max-width:100%;position:relative}.card-header{-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;-webkit-box-shadow:0 1px 2px rgba(10,10,10,.1);box-shadow:0 1px 2px rgba(10,10,10,.1);display:-webkit-box;display:-ms-flexbox;display:flex}.card-header-title{-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#363636;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;font-weight:700;padding:.75rem}.card-header-title.is-centered{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.card-header-icon{-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;padding:.75rem}.card-image{display:block;position:relative}.card-content{padding:1.5rem}.card-footer{border-top:1px solid #dbdbdb;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;display:-webkit-box;display:-ms-flexbox;display:flex}.card-footer-item{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-preferred-size:0;flex-basis:0;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:0;flex-shrink:0;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;padding:.75rem}.card-footer-item:not(:last-child){border-right:1px solid #dbdbdb}.card .media:not(:last-child){margin-bottom:.75rem}.dropdown{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;position:relative;vertical-align:top}.dropdown.is-active .dropdown-menu,.dropdown.is-hoverable:hover .dropdown-menu{display:block}.dropdown.is-right .dropdown-menu{left:auto;right:0}.dropdown.is-up .dropdown-menu{bottom:100%;padding-bottom:4px;padding-top:unset;top:auto}.dropdown-menu{display:none;left:0;min-width:12rem;padding-top:4px;position:absolute;top:100%;z-index:20}.dropdown-content{background-color:#fff;border-radius:3px;-webkit-box-shadow:0 2px 3px rgba(10,10,10,.1),0 0 0 1px rgba(10,10,10,.1);box-shadow:0 2px 3px rgba(10,10,10,.1),0 0 0 1px rgba(10,10,10,.1);padding-bottom:.5rem;padding-top:.5rem}.dropdown-item{color:#4a4a4a;display:block;font-size:.875rem;line-height:1.5;padding:.375rem 1rem;position:relative}a.dropdown-item{padding-right:3rem;white-space:nowrap}a.dropdown-item:hover{background-color:#f5f5f5;color:#0a0a0a}a.dropdown-item.is-active{background-color:#3273dc;color:#fff}.dropdown-divider{background-color:#dbdbdb;border:none;display:block;height:1px;margin:.5rem 0}.level{-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.level:not(:last-child){margin-bottom:1.5rem}.level code{border-radius:3px}.level img{display:inline-block;vertical-align:top}.level.is-mobile{display:-webkit-box;display:-ms-flexbox;display:flex}.level.is-mobile .level-left,.level.is-mobile .level-right{display:-webkit-box;display:-ms-flexbox;display:flex}.level.is-mobile .level-left+.level-right{margin-top:0}.level.is-mobile .level-item{margin-right:.75rem}.level.is-mobile .level-item:not(:last-child){margin-bottom:0}.level.is-mobile .level-item:not(.is-narrow){-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}@media screen and (min-width:769px),print{.level{display:-webkit-box;display:-ms-flexbox;display:flex}.level>.level-item:not(.is-narrow){-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}}.level-item{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-preferred-size:auto;flex-basis:auto;-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;-ms-flex-negative:0;flex-shrink:0;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.level-item .subtitle,.level-item .title{margin-bottom:0}@media screen and (max-width:768px){.level-item:not(:last-child){margin-bottom:.75rem}}.level-left,.level-right{-ms-flex-preferred-size:auto;flex-basis:auto;-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;-ms-flex-negative:0;flex-shrink:0}.level-left .level-item.is-flexible,.level-right .level-item.is-flexible{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}@media screen and (min-width:769px),print{.level-left .level-item:not(:last-child),.level-right .level-item:not(:last-child){margin-right:.75rem}}.level-left{-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}@media screen and (max-width:768px){.level-left+.level-right{margin-top:1.5rem}}@media screen and (min-width:769px),print{.level-left{display:-webkit-box;display:-ms-flexbox;display:flex}}.level-right{-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}@media screen and (min-width:769px),print{.level-right{display:-webkit-box;display:-ms-flexbox;display:flex}}.media{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;display:-webkit-box;display:-ms-flexbox;display:flex;text-align:left}.media .content:not(:last-child){margin-bottom:.75rem}.media .media{border-top:1px solid rgba(219,219,219,.5);display:-webkit-box;display:-ms-flexbox;display:flex;padding-top:.75rem}.media .media .content:not(:last-child),.media .media .control:not(:last-child){margin-bottom:.5rem}.media .media .media{padding-top:.5rem}.media .media .media+.media{margin-top:.5rem}.media+.media{border-top:1px solid rgba(219,219,219,.5);margin-top:1rem;padding-top:1rem}.media.is-large+.media{margin-top:1.5rem;padding-top:1.5rem}.media-left,.media-right{-ms-flex-preferred-size:auto;flex-basis:auto;-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;-ms-flex-negative:0;flex-shrink:0}.media-left{margin-right:1rem}.media-right{margin-left:1rem}.media-content{-ms-flex-preferred-size:auto;flex-basis:auto;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:1;flex-shrink:1;overflow:auto;text-align:left}.menu{font-size:1rem}.menu.is-small{font-size:.75rem}.menu.is-medium{font-size:1.25rem}.menu.is-large{font-size:1.5rem}.menu-list{line-height:1.25}.menu-list a{border-radius:2px;color:#4a4a4a;display:block;padding:.5em .75em}.menu-list a:hover{background-color:#f5f5f5;color:#363636}.menu-list a.is-active{background-color:#3273dc;color:#fff}.menu-list li ul{border-left:1px solid #dbdbdb;margin:.75em;padding-left:.75em}.menu-label{color:#7a7a7a;font-size:.75em;letter-spacing:.1em;text-transform:uppercase}.menu-label:not(:first-child){margin-top:1em}.menu-label:not(:last-child){margin-bottom:1em}.message{background-color:#f5f5f5;border-radius:3px;font-size:1rem}.message:not(:last-child){margin-bottom:1.5rem}.message strong{color:currentColor}.message a:not(.button):not(.tag){color:currentColor;text-decoration:underline}.message.is-small{font-size:.75rem}.message.is-medium{font-size:1.25rem}.message.is-large{font-size:1.5rem}.message.is-white{background-color:#fff}.message.is-white .message-header{background-color:#fff;color:#0a0a0a}.message.is-white .message-body{border-color:#fff;color:#4d4d4d}.message.is-black{background-color:#fafafa}.message.is-black .message-header{background-color:#0a0a0a;color:#fff}.message.is-black .message-body{border-color:#0a0a0a;color:#090909}.message.is-light{background-color:#fafafa}.message.is-light .message-header{background-color:#f5f5f5;color:#363636}.message.is-light .message-body{border-color:#f5f5f5;color:#505050}.message.is-dark{background-color:#fafafa}.message.is-dark .message-header{background-color:#363636;color:#f5f5f5}.message.is-dark .message-body{border-color:#363636;color:#2a2a2a}.message.is-primary{background-color:#f5fffd}.message.is-primary .message-header{background-color:#00d1b2;color:#fff}.message.is-primary .message-body{border-color:#00d1b2;color:#021310}.message.is-link{background-color:#f6f9fe}.message.is-link .message-header{background-color:#3273dc;color:#fff}.message.is-link .message-body{border-color:#3273dc;color:#22509a}.message.is-info{background-color:#f6fbfe}.message.is-info .message-header{background-color:#209cee;color:#fff}.message.is-info .message-body{border-color:#209cee;color:#12537e}.message.is-success{background-color:#f6fef9}.message.is-success .message-header{background-color:#23d160;color:#fff}.message.is-success .message-body{border-color:#23d160;color:#0e301a}.message.is-warning{background-color:#fffdf5}.message.is-warning .message-header{background-color:#ffdd57;color:rgba(0,0,0,.7)}.message.is-warning .message-body{border-color:#ffdd57;color:#3b3108}.message.is-danger{background-color:#fff5f7}.message.is-danger .message-header{background-color:#ff3860;color:#fff}.message.is-danger .message-body{border-color:#ff3860;color:#cd0930}.message-header{-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:#4a4a4a;border-radius:3px 3px 0 0;color:#fff;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;line-height:1.25;padding:.5em .75em;position:relative}.message-header .delete{-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;-ms-flex-negative:0;flex-shrink:0;margin-left:.75em}.message-header+.message-body{border-top-left-radius:0;border-top-right-radius:0;border-top:none}.message-body{border:1px solid #dbdbdb;border-radius:3px;color:#4a4a4a;padding:1em 1.25em}.message-body code,.message-body pre{background-color:#fff}.message-body pre code{background-color:transparent}.modal{bottom:0;left:0;position:absolute;right:0;top:0;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:none;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;overflow:hidden;position:fixed;z-index:40}.modal.is-active{display:-webkit-box;display:-ms-flexbox;display:flex}.modal-background{bottom:0;left:0;position:absolute;right:0;top:0;background-color:rgba(10,10,10,.86)}.modal-card,.modal-content{margin:0 20px;max-height:calc(100vh - 160px);overflow:auto;position:relative;width:100%}@media screen and (min-width:769px),print{.modal-card,.modal-content{margin:0 auto;max-height:calc(100vh - 40px);width:640px}}.modal-close{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-moz-appearance:none;-webkit-appearance:none;background-color:rgba(10,10,10,.2);border:none;border-radius:290486px;cursor:pointer;display:inline-block;-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;-ms-flex-negative:0;flex-shrink:0;font-size:0;height:20px;max-height:20px;max-width:20px;min-height:20px;min-width:20px;outline:0;position:relative;vertical-align:top;width:20px;background:0 0;height:40px;position:fixed;right:20px;top:20px;width:40px}.modal-close:after,.modal-close:before{background-color:#fff;content:"";display:block;left:50%;position:absolute;top:50%;-webkit-transform:translateX(-50%) translateY(-50%) rotate(45deg);transform:translateX(-50%) translateY(-50%) rotate(45deg);-webkit-transform-origin:center center;transform-origin:center center}.modal-close:before{height:2px;width:50%}.modal-close:after{height:50%;width:2px}.modal-close:focus,.modal-close:hover{background-color:rgba(10,10,10,.3)}.modal-close:active{background-color:rgba(10,10,10,.4)}.modal-close.is-small{height:16px;max-height:16px;max-width:16px;min-height:16px;min-width:16px;width:16px}.modal-close.is-medium{height:24px;max-height:24px;max-width:24px;min-height:24px;min-width:24px;width:24px}.modal-close.is-large{height:32px;max-height:32px;max-width:32px;min-height:32px;min-width:32px;width:32px}.modal-card{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;max-height:calc(100vh - 40px);overflow:hidden}.modal-card-foot,.modal-card-head{-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:#f5f5f5;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-negative:0;flex-shrink:0;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;padding:20px;position:relative}.modal-card-head{border-bottom:1px solid #dbdbdb;border-top-left-radius:5px;border-top-right-radius:5px}.modal-card-title{color:#363636;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:0;flex-shrink:0;font-size:1.5rem;line-height:1}.modal-card-foot{border-bottom-left-radius:5px;border-bottom-right-radius:5px;border-top:1px solid #dbdbdb}.modal-card-foot .button:not(:last-child){margin-right:10px}.modal-card-body{-webkit-overflow-scrolling:touch;background-color:#fff;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:1;flex-shrink:1;overflow:auto;padding:20px}.navbar{background-color:#fff;min-height:3.25rem;position:relative}.navbar.is-white{background-color:#fff;color:#0a0a0a}.navbar.is-white .navbar-brand .navbar-link,.navbar.is-white .navbar-brand>.navbar-item{color:#0a0a0a}.navbar.is-white .navbar-brand .navbar-link.is-active,.navbar.is-white .navbar-brand .navbar-link:hover,.navbar.is-white .navbar-brand>a.navbar-item.is-active,.navbar.is-white .navbar-brand>a.navbar-item:hover{background-color:#f2f2f2;color:#0a0a0a}.navbar.is-white .navbar-brand .navbar-link::after{border-color:#0a0a0a}@media screen and (min-width:1024px){.navbar.is-white .navbar-end .navbar-link,.navbar.is-white .navbar-end>.navbar-item,.navbar.is-white .navbar-start .navbar-link,.navbar.is-white .navbar-start>.navbar-item{color:#0a0a0a}.navbar.is-white .navbar-end .navbar-link.is-active,.navbar.is-white .navbar-end .navbar-link:hover,.navbar.is-white .navbar-end>a.navbar-item.is-active,.navbar.is-white .navbar-end>a.navbar-item:hover,.navbar.is-white .navbar-start .navbar-link.is-active,.navbar.is-white .navbar-start .navbar-link:hover,.navbar.is-white .navbar-start>a.navbar-item.is-active,.navbar.is-white .navbar-start>a.navbar-item:hover{background-color:#f2f2f2;color:#0a0a0a}.navbar.is-white .navbar-end .navbar-link::after,.navbar.is-white .navbar-start .navbar-link::after{border-color:#0a0a0a}.navbar.is-white .navbar-item.has-dropdown.is-active .navbar-link,.navbar.is-white .navbar-item.has-dropdown:hover .navbar-link{background-color:#f2f2f2;color:#0a0a0a}.navbar.is-white .navbar-dropdown a.navbar-item.is-active{background-color:#fff;color:#0a0a0a}}.navbar.is-black{background-color:#0a0a0a;color:#fff}.navbar.is-black .navbar-brand .navbar-link,.navbar.is-black .navbar-brand>.navbar-item{color:#fff}.navbar.is-black .navbar-brand .navbar-link.is-active,.navbar.is-black .navbar-brand .navbar-link:hover,.navbar.is-black .navbar-brand>a.navbar-item.is-active,.navbar.is-black .navbar-brand>a.navbar-item:hover{background-color:#000;color:#fff}.navbar.is-black .navbar-brand .navbar-link::after{border-color:#fff}@media screen and (min-width:1024px){.navbar.is-black .navbar-end .navbar-link,.navbar.is-black .navbar-end>.navbar-item,.navbar.is-black .navbar-start .navbar-link,.navbar.is-black .navbar-start>.navbar-item{color:#fff}.navbar.is-black .navbar-end .navbar-link.is-active,.navbar.is-black .navbar-end .navbar-link:hover,.navbar.is-black .navbar-end>a.navbar-item.is-active,.navbar.is-black .navbar-end>a.navbar-item:hover,.navbar.is-black .navbar-start .navbar-link.is-active,.navbar.is-black .navbar-start .navbar-link:hover,.navbar.is-black .navbar-start>a.navbar-item.is-active,.navbar.is-black .navbar-start>a.navbar-item:hover{background-color:#000;color:#fff}.navbar.is-black .navbar-end .navbar-link::after,.navbar.is-black .navbar-start .navbar-link::after{border-color:#fff}.navbar.is-black .navbar-item.has-dropdown.is-active .navbar-link,.navbar.is-black .navbar-item.has-dropdown:hover .navbar-link{background-color:#000;color:#fff}.navbar.is-black .navbar-dropdown a.navbar-item.is-active{background-color:#0a0a0a;color:#fff}}.navbar.is-light{background-color:#f5f5f5;color:#363636}.navbar.is-light .navbar-brand .navbar-link,.navbar.is-light .navbar-brand>.navbar-item{color:#363636}.navbar.is-light .navbar-brand .navbar-link.is-active,.navbar.is-light .navbar-brand .navbar-link:hover,.navbar.is-light .navbar-brand>a.navbar-item.is-active,.navbar.is-light .navbar-brand>a.navbar-item:hover{background-color:#e8e8e8;color:#363636}.navbar.is-light .navbar-brand .navbar-link::after{border-color:#363636}@media screen and (min-width:1024px){.navbar.is-light .navbar-end .navbar-link,.navbar.is-light .navbar-end>.navbar-item,.navbar.is-light .navbar-start .navbar-link,.navbar.is-light .navbar-start>.navbar-item{color:#363636}.navbar.is-light .navbar-end .navbar-link.is-active,.navbar.is-light .navbar-end .navbar-link:hover,.navbar.is-light .navbar-end>a.navbar-item.is-active,.navbar.is-light .navbar-end>a.navbar-item:hover,.navbar.is-light .navbar-start .navbar-link.is-active,.navbar.is-light .navbar-start .navbar-link:hover,.navbar.is-light .navbar-start>a.navbar-item.is-active,.navbar.is-light .navbar-start>a.navbar-item:hover{background-color:#e8e8e8;color:#363636}.navbar.is-light .navbar-end .navbar-link::after,.navbar.is-light .navbar-start .navbar-link::after{border-color:#363636}.navbar.is-light .navbar-item.has-dropdown.is-active .navbar-link,.navbar.is-light .navbar-item.has-dropdown:hover .navbar-link{background-color:#e8e8e8;color:#363636}.navbar.is-light .navbar-dropdown a.navbar-item.is-active{background-color:#f5f5f5;color:#363636}}.navbar.is-dark{background-color:#363636;color:#f5f5f5}.navbar.is-dark .navbar-brand .navbar-link,.navbar.is-dark .navbar-brand>.navbar-item{color:#f5f5f5}.navbar.is-dark .navbar-brand .navbar-link.is-active,.navbar.is-dark .navbar-brand .navbar-link:hover,.navbar.is-dark .navbar-brand>a.navbar-item.is-active,.navbar.is-dark .navbar-brand>a.navbar-item:hover{background-color:#292929;color:#f5f5f5}.navbar.is-dark .navbar-brand .navbar-link::after{border-color:#f5f5f5}@media screen and (min-width:1024px){.navbar.is-dark .navbar-end .navbar-link,.navbar.is-dark .navbar-end>.navbar-item,.navbar.is-dark .navbar-start .navbar-link,.navbar.is-dark .navbar-start>.navbar-item{color:#f5f5f5}.navbar.is-dark .navbar-end .navbar-link.is-active,.navbar.is-dark .navbar-end .navbar-link:hover,.navbar.is-dark .navbar-end>a.navbar-item.is-active,.navbar.is-dark .navbar-end>a.navbar-item:hover,.navbar.is-dark .navbar-start .navbar-link.is-active,.navbar.is-dark .navbar-start .navbar-link:hover,.navbar.is-dark .navbar-start>a.navbar-item.is-active,.navbar.is-dark .navbar-start>a.navbar-item:hover{background-color:#292929;color:#f5f5f5}.navbar.is-dark .navbar-end .navbar-link::after,.navbar.is-dark .navbar-start .navbar-link::after{border-color:#f5f5f5}.navbar.is-dark .navbar-item.has-dropdown.is-active .navbar-link,.navbar.is-dark .navbar-item.has-dropdown:hover .navbar-link{background-color:#292929;color:#f5f5f5}.navbar.is-dark .navbar-dropdown a.navbar-item.is-active{background-color:#363636;color:#f5f5f5}}.navbar.is-primary{background-color:#00d1b2;color:#fff}.navbar.is-primary .navbar-brand .navbar-link,.navbar.is-primary .navbar-brand>.navbar-item{color:#fff}.navbar.is-primary .navbar-brand .navbar-link.is-active,.navbar.is-primary .navbar-brand .navbar-link:hover,.navbar.is-primary .navbar-brand>a.navbar-item.is-active,.navbar.is-primary .navbar-brand>a.navbar-item:hover{background-color:#00b89c;color:#fff}.navbar.is-primary .navbar-brand .navbar-link::after{border-color:#fff}@media screen and (min-width:1024px){.navbar.is-primary .navbar-end .navbar-link,.navbar.is-primary .navbar-end>.navbar-item,.navbar.is-primary .navbar-start .navbar-link,.navbar.is-primary .navbar-start>.navbar-item{color:#fff}.navbar.is-primary .navbar-end .navbar-link.is-active,.navbar.is-primary .navbar-end .navbar-link:hover,.navbar.is-primary .navbar-end>a.navbar-item.is-active,.navbar.is-primary .navbar-end>a.navbar-item:hover,.navbar.is-primary .navbar-start .navbar-link.is-active,.navbar.is-primary .navbar-start .navbar-link:hover,.navbar.is-primary .navbar-start>a.navbar-item.is-active,.navbar.is-primary .navbar-start>a.navbar-item:hover{background-color:#00b89c;color:#fff}.navbar.is-primary .navbar-end .navbar-link::after,.navbar.is-primary .navbar-start .navbar-link::after{border-color:#fff}.navbar.is-primary .navbar-item.has-dropdown.is-active .navbar-link,.navbar.is-primary .navbar-item.has-dropdown:hover .navbar-link{background-color:#00b89c;color:#fff}.navbar.is-primary .navbar-dropdown a.navbar-item.is-active{background-color:#00d1b2;color:#fff}}.navbar.is-link{background-color:#3273dc;color:#fff}.navbar.is-link .navbar-brand .navbar-link,.navbar.is-link .navbar-brand>.navbar-item{color:#fff}.navbar.is-link .navbar-brand .navbar-link.is-active,.navbar.is-link .navbar-brand .navbar-link:hover,.navbar.is-link .navbar-brand>a.navbar-item.is-active,.navbar.is-link .navbar-brand>a.navbar-item:hover{background-color:#2366d1;color:#fff}.navbar.is-link .navbar-brand .navbar-link::after{border-color:#fff}@media screen and (min-width:1024px){.navbar.is-link .navbar-end .navbar-link,.navbar.is-link .navbar-end>.navbar-item,.navbar.is-link .navbar-start .navbar-link,.navbar.is-link .navbar-start>.navbar-item{color:#fff}.navbar.is-link .navbar-end .navbar-link.is-active,.navbar.is-link .navbar-end .navbar-link:hover,.navbar.is-link .navbar-end>a.navbar-item.is-active,.navbar.is-link .navbar-end>a.navbar-item:hover,.navbar.is-link .navbar-start .navbar-link.is-active,.navbar.is-link .navbar-start .navbar-link:hover,.navbar.is-link .navbar-start>a.navbar-item.is-active,.navbar.is-link .navbar-start>a.navbar-item:hover{background-color:#2366d1;color:#fff}.navbar.is-link .navbar-end .navbar-link::after,.navbar.is-link .navbar-start .navbar-link::after{border-color:#fff}.navbar.is-link .navbar-item.has-dropdown.is-active .navbar-link,.navbar.is-link .navbar-item.has-dropdown:hover .navbar-link{background-color:#2366d1;color:#fff}.navbar.is-link .navbar-dropdown a.navbar-item.is-active{background-color:#3273dc;color:#fff}}.navbar.is-info{background-color:#209cee;color:#fff}.navbar.is-info .navbar-brand .navbar-link,.navbar.is-info .navbar-brand>.navbar-item{color:#fff}.navbar.is-info .navbar-brand .navbar-link.is-active,.navbar.is-info .navbar-brand .navbar-link:hover,.navbar.is-info .navbar-brand>a.navbar-item.is-active,.navbar.is-info .navbar-brand>a.navbar-item:hover{background-color:#118fe4;color:#fff}.navbar.is-info .navbar-brand .navbar-link::after{border-color:#fff}@media screen and (min-width:1024px){.navbar.is-info .navbar-end .navbar-link,.navbar.is-info .navbar-end>.navbar-item,.navbar.is-info .navbar-start .navbar-link,.navbar.is-info .navbar-start>.navbar-item{color:#fff}.navbar.is-info .navbar-end .navbar-link.is-active,.navbar.is-info .navbar-end .navbar-link:hover,.navbar.is-info .navbar-end>a.navbar-item.is-active,.navbar.is-info .navbar-end>a.navbar-item:hover,.navbar.is-info .navbar-start .navbar-link.is-active,.navbar.is-info .navbar-start .navbar-link:hover,.navbar.is-info .navbar-start>a.navbar-item.is-active,.navbar.is-info .navbar-start>a.navbar-item:hover{background-color:#118fe4;color:#fff}.navbar.is-info .navbar-end .navbar-link::after,.navbar.is-info .navbar-start .navbar-link::after{border-color:#fff}.navbar.is-info .navbar-item.has-dropdown.is-active .navbar-link,.navbar.is-info .navbar-item.has-dropdown:hover .navbar-link{background-color:#118fe4;color:#fff}.navbar.is-info .navbar-dropdown a.navbar-item.is-active{background-color:#209cee;color:#fff}}.navbar.is-success{background-color:#23d160;color:#fff}.navbar.is-success .navbar-brand .navbar-link,.navbar.is-success .navbar-brand>.navbar-item{color:#fff}.navbar.is-success .navbar-brand .navbar-link.is-active,.navbar.is-success .navbar-brand .navbar-link:hover,.navbar.is-success .navbar-brand>a.navbar-item.is-active,.navbar.is-success .navbar-brand>a.navbar-item:hover{background-color:#20bc56;color:#fff}.navbar.is-success .navbar-brand .navbar-link::after{border-color:#fff}@media screen and (min-width:1024px){.navbar.is-success .navbar-end .navbar-link,.navbar.is-success .navbar-end>.navbar-item,.navbar.is-success .navbar-start .navbar-link,.navbar.is-success .navbar-start>.navbar-item{color:#fff}.navbar.is-success .navbar-end .navbar-link.is-active,.navbar.is-success .navbar-end .navbar-link:hover,.navbar.is-success .navbar-end>a.navbar-item.is-active,.navbar.is-success .navbar-end>a.navbar-item:hover,.navbar.is-success .navbar-start .navbar-link.is-active,.navbar.is-success .navbar-start .navbar-link:hover,.navbar.is-success .navbar-start>a.navbar-item.is-active,.navbar.is-success .navbar-start>a.navbar-item:hover{background-color:#20bc56;color:#fff}.navbar.is-success .navbar-end .navbar-link::after,.navbar.is-success .navbar-start .navbar-link::after{border-color:#fff}.navbar.is-success .navbar-item.has-dropdown.is-active .navbar-link,.navbar.is-success .navbar-item.has-dropdown:hover .navbar-link{background-color:#20bc56;color:#fff}.navbar.is-success .navbar-dropdown a.navbar-item.is-active{background-color:#23d160;color:#fff}}.navbar.is-warning{background-color:#ffdd57;color:rgba(0,0,0,.7)}.navbar.is-warning .navbar-brand .navbar-link,.navbar.is-warning .navbar-brand>.navbar-item{color:rgba(0,0,0,.7)}.navbar.is-warning .navbar-brand .navbar-link.is-active,.navbar.is-warning .navbar-brand .navbar-link:hover,.navbar.is-warning .navbar-brand>a.navbar-item.is-active,.navbar.is-warning .navbar-brand>a.navbar-item:hover{background-color:#ffd83d;color:rgba(0,0,0,.7)}.navbar.is-warning .navbar-brand .navbar-link::after{border-color:rgba(0,0,0,.7)}@media screen and (min-width:1024px){.navbar.is-warning .navbar-end .navbar-link,.navbar.is-warning .navbar-end>.navbar-item,.navbar.is-warning .navbar-start .navbar-link,.navbar.is-warning .navbar-start>.navbar-item{color:rgba(0,0,0,.7)}.navbar.is-warning .navbar-end .navbar-link.is-active,.navbar.is-warning .navbar-end .navbar-link:hover,.navbar.is-warning .navbar-end>a.navbar-item.is-active,.navbar.is-warning .navbar-end>a.navbar-item:hover,.navbar.is-warning .navbar-start .navbar-link.is-active,.navbar.is-warning .navbar-start .navbar-link:hover,.navbar.is-warning .navbar-start>a.navbar-item.is-active,.navbar.is-warning .navbar-start>a.navbar-item:hover{background-color:#ffd83d;color:rgba(0,0,0,.7)}.navbar.is-warning .navbar-end .navbar-link::after,.navbar.is-warning .navbar-start .navbar-link::after{border-color:rgba(0,0,0,.7)}.navbar.is-warning .navbar-item.has-dropdown.is-active .navbar-link,.navbar.is-warning .navbar-item.has-dropdown:hover .navbar-link{background-color:#ffd83d;color:rgba(0,0,0,.7)}.navbar.is-warning .navbar-dropdown a.navbar-item.is-active{background-color:#ffdd57;color:rgba(0,0,0,.7)}}.navbar.is-danger{background-color:#ff3860;color:#fff}.navbar.is-danger .navbar-brand .navbar-link,.navbar.is-danger .navbar-brand>.navbar-item{color:#fff}.navbar.is-danger .navbar-brand .navbar-link.is-active,.navbar.is-danger .navbar-brand .navbar-link:hover,.navbar.is-danger .navbar-brand>a.navbar-item.is-active,.navbar.is-danger .navbar-brand>a.navbar-item:hover{background-color:#ff1f4b;color:#fff}.navbar.is-danger .navbar-brand .navbar-link::after{border-color:#fff}@media screen and (min-width:1024px){.navbar.is-danger .navbar-end .navbar-link,.navbar.is-danger .navbar-end>.navbar-item,.navbar.is-danger .navbar-start .navbar-link,.navbar.is-danger .navbar-start>.navbar-item{color:#fff}.navbar.is-danger .navbar-end .navbar-link.is-active,.navbar.is-danger .navbar-end .navbar-link:hover,.navbar.is-danger .navbar-end>a.navbar-item.is-active,.navbar.is-danger .navbar-end>a.navbar-item:hover,.navbar.is-danger .navbar-start .navbar-link.is-active,.navbar.is-danger .navbar-start .navbar-link:hover,.navbar.is-danger .navbar-start>a.navbar-item.is-active,.navbar.is-danger .navbar-start>a.navbar-item:hover{background-color:#ff1f4b;color:#fff}.navbar.is-danger .navbar-end .navbar-link::after,.navbar.is-danger .navbar-start .navbar-link::after{border-color:#fff}.navbar.is-danger .navbar-item.has-dropdown.is-active .navbar-link,.navbar.is-danger .navbar-item.has-dropdown:hover .navbar-link{background-color:#ff1f4b;color:#fff}.navbar.is-danger .navbar-dropdown a.navbar-item.is-active{background-color:#ff3860;color:#fff}}.navbar>.container{-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;display:-webkit-box;display:-ms-flexbox;display:flex;min-height:3.25rem;width:100%}.navbar.has-shadow{-webkit-box-shadow:0 2px 3px rgba(10,10,10,.1);box-shadow:0 2px 3px rgba(10,10,10,.1)}.navbar.is-fixed-bottom,.navbar.is-fixed-top{left:0;position:fixed;right:0;z-index:30}.navbar.is-fixed-bottom{bottom:0}.navbar.is-fixed-bottom.has-shadow{-webkit-box-shadow:0 -2px 3px rgba(10,10,10,.1);box-shadow:0 -2px 3px rgba(10,10,10,.1)}.navbar.is-fixed-top{top:0}html.has-navbar-fixed-top{padding-top:3.25rem}html.has-navbar-fixed-bottom{padding-bottom:3.25rem}.navbar-brand,.navbar-tabs{-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-negative:0;flex-shrink:0;min-height:3.25rem}.navbar-tabs{-webkit-overflow-scrolling:touch;max-width:100vw;overflow-x:auto;overflow-y:hidden}.navbar-burger{cursor:pointer;display:block;height:3.25rem;position:relative;width:3.25rem;margin-left:auto}.navbar-burger span{background-color:currentColor;display:block;height:1px;left:calc(50% - 8px);position:absolute;-webkit-transform-origin:center;transform-origin:center;-webkit-transition-duration:86ms;transition-duration:86ms;-webkit-transition-property:background-color,opacity,-webkit-transform;transition-property:background-color,opacity,-webkit-transform;transition-property:background-color,opacity,transform;transition-property:background-color,opacity,transform,-webkit-transform;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out;width:16px}.navbar-burger span:nth-child(1){top:calc(50% - 6px)}.navbar-burger span:nth-child(2){top:calc(50% - 1px)}.navbar-burger span:nth-child(3){top:calc(50% + 4px)}.navbar-burger:hover{background-color:rgba(0,0,0,.05)}.navbar-burger.is-active span:nth-child(1){-webkit-transform:translateY(5px) rotate(45deg);transform:translateY(5px) rotate(45deg)}.navbar-burger.is-active span:nth-child(2){opacity:0}.navbar-burger.is-active span:nth-child(3){-webkit-transform:translateY(-5px) rotate(-45deg);transform:translateY(-5px) rotate(-45deg)}.navbar-menu{display:none}.navbar-item,.navbar-link{color:#4a4a4a;display:block;line-height:1.5;padding:.5rem 1rem;position:relative}a.navbar-item.is-active,a.navbar-item:hover,a.navbar-link.is-active,a.navbar-link:hover{background-color:#f5f5f5;color:#3273dc}.navbar-item{-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;-ms-flex-negative:0;flex-shrink:0}.navbar-item img{max-height:1.75rem}.navbar-item.has-dropdown{padding:0}.navbar-item.is-expanded{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:1;flex-shrink:1}.navbar-item.is-tab{border-bottom:1px solid transparent;min-height:3.25rem;padding-bottom:calc(.5rem - 1px)}.navbar-item.is-tab:hover{background-color:transparent;border-bottom-color:#3273dc}.navbar-item.is-tab.is-active{background-color:transparent;border-bottom-color:#3273dc;border-bottom-style:solid;border-bottom-width:3px;color:#3273dc;padding-bottom:calc(.5rem - 3px)}.navbar-content{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:1;flex-shrink:1}.navbar-link{padding-right:2.5em}.navbar-dropdown{font-size:.875rem;padding-bottom:.5rem;padding-top:.5rem}.navbar-dropdown .navbar-item{padding-left:1.5rem;padding-right:1.5rem}.navbar-divider{background-color:#dbdbdb;border:none;display:none;height:1px;margin:.5rem 0}@media screen and (max-width:1023px){.navbar>.container{display:block}.navbar-brand .navbar-item,.navbar-tabs .navbar-item{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex}.navbar-menu{background-color:#fff;-webkit-box-shadow:0 8px 16px rgba(10,10,10,.1);box-shadow:0 8px 16px rgba(10,10,10,.1);padding:.5rem 0}.navbar-menu.is-active{display:block}.navbar.is-fixed-bottom-touch,.navbar.is-fixed-top-touch{left:0;position:fixed;right:0;z-index:30}.navbar.is-fixed-bottom-touch{bottom:0}.navbar.is-fixed-bottom-touch.has-shadow{-webkit-box-shadow:0 -2px 3px rgba(10,10,10,.1);box-shadow:0 -2px 3px rgba(10,10,10,.1)}.navbar.is-fixed-top-touch{top:0}.navbar.is-fixed-top .navbar-menu,.navbar.is-fixed-top-touch .navbar-menu{-webkit-overflow-scrolling:touch;max-height:calc(100vh - 3.25rem);overflow:auto}html.has-navbar-fixed-top-touch{padding-top:3.25rem}html.has-navbar-fixed-bottom-touch{padding-bottom:3.25rem}}@media screen and (min-width:1024px){.navbar,.navbar-end,.navbar-menu,.navbar-start{-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;display:-webkit-box;display:-ms-flexbox;display:flex}.navbar{min-height:3.25rem}.navbar.is-transparent a.navbar-item.is-active,.navbar.is-transparent a.navbar-item:hover,.navbar.is-transparent a.navbar-link.is-active,.navbar.is-transparent a.navbar-link:hover{background-color:transparent!important}.navbar.is-transparent .navbar-item.has-dropdown.is-active .navbar-link,.navbar.is-transparent .navbar-item.has-dropdown.is-hoverable:hover .navbar-link{background-color:transparent!important}.navbar.is-transparent .navbar-dropdown a.navbar-item:hover{background-color:#f5f5f5;color:#0a0a0a}.navbar.is-transparent .navbar-dropdown a.navbar-item.is-active{background-color:#f5f5f5;color:#3273dc}.navbar-burger{display:none}.navbar-item,.navbar-link{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex}.navbar-item.has-dropdown{-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch}.navbar-item.has-dropdown-up .navbar-link::after{-webkit-transform:rotate(135deg) translate(.25em,-.25em);transform:rotate(135deg) translate(.25em,-.25em)}.navbar-item.has-dropdown-up .navbar-dropdown{border-bottom:1px solid #dbdbdb;border-radius:5px 5px 0 0;border-top:none;bottom:100%;-webkit-box-shadow:0 -8px 8px rgba(10,10,10,.1);box-shadow:0 -8px 8px rgba(10,10,10,.1);top:auto}.navbar-item.is-active .navbar-dropdown,.navbar-item.is-hoverable:hover .navbar-dropdown{display:block}.navbar-item.is-active .navbar-dropdown.is-boxed,.navbar-item.is-hoverable:hover .navbar-dropdown.is-boxed{opacity:1;pointer-events:auto;-webkit-transform:translateY(0);transform:translateY(0)}.navbar-link::after{border:1px solid #3273dc;border-right:0;border-top:0;content:" ";display:block;height:.5em;pointer-events:none;position:absolute;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:center;transform-origin:center;width:.5em;margin-top:-.375em;right:1.125em;top:50%}.navbar-menu{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:0;flex-shrink:0}.navbar-start{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;margin-right:auto}.navbar-end{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;margin-left:auto}.navbar-dropdown{background-color:#fff;border-bottom-left-radius:5px;border-bottom-right-radius:5px;border-top:1px solid #dbdbdb;-webkit-box-shadow:0 8px 8px rgba(10,10,10,.1);box-shadow:0 8px 8px rgba(10,10,10,.1);display:none;font-size:.875rem;left:0;min-width:100%;position:absolute;top:100%;z-index:20}.navbar-dropdown .navbar-item{padding:.375rem 1rem;white-space:nowrap}.navbar-dropdown a.navbar-item{padding-right:3rem}.navbar-dropdown a.navbar-item:hover{background-color:#f5f5f5;color:#0a0a0a}.navbar-dropdown a.navbar-item.is-active{background-color:#f5f5f5;color:#3273dc}.navbar-dropdown.is-boxed{border-radius:5px;border-top:none;-webkit-box-shadow:0 8px 8px rgba(10,10,10,.1),0 0 0 1px rgba(10,10,10,.1);box-shadow:0 8px 8px rgba(10,10,10,.1),0 0 0 1px rgba(10,10,10,.1);display:block;opacity:0;pointer-events:none;top:calc(100% + (-4px));-webkit-transform:translateY(-5px);transform:translateY(-5px);-webkit-transition-duration:86ms;transition-duration:86ms;-webkit-transition-property:opacity,-webkit-transform;transition-property:opacity,-webkit-transform;transition-property:opacity,transform;transition-property:opacity,transform,-webkit-transform}.navbar-dropdown.is-right{left:auto;right:0}.navbar-divider{display:block}.container>.navbar .navbar-brand,.navbar>.container .navbar-brand{margin-left:-1rem}.container>.navbar .navbar-menu,.navbar>.container .navbar-menu{margin-right:-1rem}.navbar.is-fixed-bottom-desktop,.navbar.is-fixed-top-desktop{left:0;position:fixed;right:0;z-index:30}.navbar.is-fixed-bottom-desktop{bottom:0}.navbar.is-fixed-bottom-desktop.has-shadow{-webkit-box-shadow:0 -2px 3px rgba(10,10,10,.1);box-shadow:0 -2px 3px rgba(10,10,10,.1)}.navbar.is-fixed-top-desktop{top:0}html.has-navbar-fixed-top-desktop{padding-top:3.25rem}html.has-navbar-fixed-bottom-desktop{padding-bottom:3.25rem}a.navbar-item.is-active,a.navbar-link.is-active{color:#0a0a0a}a.navbar-item.is-active:not(:hover),a.navbar-link.is-active:not(:hover){background-color:transparent}.navbar-item.has-dropdown.is-active .navbar-link,.navbar-item.has-dropdown:hover .navbar-link{background-color:#f5f5f5}}.pagination{font-size:1rem;margin:-.25rem}.pagination.is-small{font-size:.75rem}.pagination.is-medium{font-size:1.25rem}.pagination.is-large{font-size:1.5rem}.pagination.is-rounded .pagination-next,.pagination.is-rounded .pagination-previous{padding-left:1em;padding-right:1em;border-radius:290486px}.pagination.is-rounded .pagination-link{border-radius:290486px}.pagination,.pagination-list{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.pagination-ellipsis,.pagination-link,.pagination-next,.pagination-previous{-moz-appearance:none;-webkit-appearance:none;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border:1px solid transparent;border-radius:3px;-webkit-box-shadow:none;box-shadow:none;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;font-size:1rem;height:2.25em;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;line-height:1.5;padding-bottom:calc(.375em - 1px);padding-left:calc(.625em - 1px);padding-right:calc(.625em - 1px);padding-top:calc(.375em - 1px);position:relative;vertical-align:top;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;font-size:1em;padding-left:.5em;padding-right:.5em;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin:.25rem;text-align:center}.pagination-ellipsis.is-active,.pagination-ellipsis.is-focused,.pagination-ellipsis:active,.pagination-ellipsis:focus,.pagination-link.is-active,.pagination-link.is-focused,.pagination-link:active,.pagination-link:focus,.pagination-next.is-active,.pagination-next.is-focused,.pagination-next:active,.pagination-next:focus,.pagination-previous.is-active,.pagination-previous.is-focused,.pagination-previous:active,.pagination-previous:focus{outline:0}.pagination-ellipsis[disabled],.pagination-link[disabled],.pagination-next[disabled],.pagination-previous[disabled]{cursor:not-allowed}.pagination-link,.pagination-next,.pagination-previous{border-color:#dbdbdb;color:#363636;min-width:2.25em}.pagination-link:hover,.pagination-next:hover,.pagination-previous:hover{border-color:#b5b5b5;color:#363636}.pagination-link:focus,.pagination-next:focus,.pagination-previous:focus{border-color:#3273dc}.pagination-link:active,.pagination-next:active,.pagination-previous:active{-webkit-box-shadow:inset 0 1px 2px rgba(10,10,10,.2);box-shadow:inset 0 1px 2px rgba(10,10,10,.2)}.pagination-link[disabled],.pagination-next[disabled],.pagination-previous[disabled]{background-color:#dbdbdb;border-color:#dbdbdb;-webkit-box-shadow:none;box-shadow:none;color:#7a7a7a;opacity:.5}.pagination-next,.pagination-previous{padding-left:.75em;padding-right:.75em;white-space:nowrap}.pagination-link.is-current{background-color:#3273dc;border-color:#3273dc;color:#fff}.pagination-ellipsis{color:#b5b5b5;pointer-events:none}.pagination-list{-ms-flex-wrap:wrap;flex-wrap:wrap}@media screen and (max-width:768px){.pagination{-ms-flex-wrap:wrap;flex-wrap:wrap}.pagination-next,.pagination-previous{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:1;flex-shrink:1}.pagination-list li{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:1;flex-shrink:1}}@media screen and (min-width:769px),print{.pagination-list{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:1;flex-shrink:1;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}.pagination-previous{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2}.pagination-next{-webkit-box-ordinal-group:4;-ms-flex-order:3;order:3}.pagination{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.pagination.is-centered .pagination-previous{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}.pagination.is-centered .pagination-list{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2}.pagination.is-centered .pagination-next{-webkit-box-ordinal-group:4;-ms-flex-order:3;order:3}.pagination.is-right .pagination-previous{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}.pagination.is-right .pagination-next{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2}.pagination.is-right .pagination-list{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;-webkit-box-ordinal-group:4;-ms-flex-order:3;order:3}}.panel{font-size:1rem}.panel:not(:last-child){margin-bottom:1.5rem}.panel-block,.panel-heading,.panel-tabs{border-bottom:1px solid #dbdbdb;border-left:1px solid #dbdbdb;border-right:1px solid #dbdbdb}.panel-block:first-child,.panel-heading:first-child,.panel-tabs:first-child{border-top:1px solid #dbdbdb}.panel-heading{background-color:#f5f5f5;border-radius:3px 3px 0 0;color:#363636;font-size:1.25em;font-weight:300;line-height:1.25;padding:.5em .75em}.panel-tabs{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end;display:-webkit-box;display:-ms-flexbox;display:flex;font-size:.875em;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.panel-tabs a{border-bottom:1px solid #dbdbdb;margin-bottom:-1px;padding:.5em}.panel-tabs a.is-active{border-bottom-color:#4a4a4a;color:#363636}.panel-list a{color:#4a4a4a}.panel-list a:hover{color:#3273dc}.panel-block{-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#363636;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;padding:.5em .75em}.panel-block input[type=checkbox]{margin-right:.75em}.panel-block>.control{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:1;flex-shrink:1;width:100%}.panel-block.is-wrapped{-ms-flex-wrap:wrap;flex-wrap:wrap}.panel-block.is-active{border-left-color:#3273dc;color:#363636}.panel-block.is-active .panel-icon{color:#3273dc}a.panel-block,label.panel-block{cursor:pointer}a.panel-block:hover,label.panel-block:hover{background-color:#f5f5f5}.panel-icon{display:inline-block;font-size:14px;height:1em;line-height:1em;text-align:center;vertical-align:top;width:1em;color:#7a7a7a;margin-right:.75em}.panel-icon .fa{font-size:inherit;line-height:inherit}.tabs{-webkit-overflow-scrolling:touch;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;display:-webkit-box;display:-ms-flexbox;display:flex;font-size:1rem;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;overflow:hidden;overflow-x:auto;white-space:nowrap}.tabs:not(:last-child){margin-bottom:1.5rem}.tabs a{-webkit-box-align:center;-ms-flex-align:center;align-items:center;border-bottom-color:#dbdbdb;border-bottom-style:solid;border-bottom-width:1px;color:#4a4a4a;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-bottom:-1px;padding:.5em 1em;vertical-align:top}.tabs a:hover{border-bottom-color:#363636;color:#363636}.tabs li{display:block}.tabs li.is-active a{border-bottom-color:#3273dc;color:#3273dc}.tabs ul{-webkit-box-align:center;-ms-flex-align:center;align-items:center;border-bottom-color:#dbdbdb;border-bottom-style:solid;border-bottom-width:1px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:0;flex-shrink:0;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}.tabs ul.is-left{padding-right:.75em}.tabs ul.is-center{-webkit-box-flex:0;-ms-flex:none;flex:none;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;padding-left:.75em;padding-right:.75em}.tabs ul.is-right{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;padding-left:.75em}.tabs .icon:first-child{margin-right:.5em}.tabs .icon:last-child{margin-left:.5em}.tabs.is-centered ul{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.tabs.is-right ul{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}.tabs.is-boxed a{border:1px solid transparent;border-radius:3px 3px 0 0}.tabs.is-boxed a:hover{background-color:#f5f5f5;border-bottom-color:#dbdbdb}.tabs.is-boxed li.is-active a{background-color:#fff;border-color:#dbdbdb;border-bottom-color:transparent!important}.tabs.is-fullwidth li{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:0;flex-shrink:0}.tabs.is-toggle a{border-color:#dbdbdb;border-style:solid;border-width:1px;margin-bottom:0;position:relative}.tabs.is-toggle a:hover{background-color:#f5f5f5;border-color:#b5b5b5;z-index:2}.tabs.is-toggle li+li{margin-left:-1px}.tabs.is-toggle li:first-child a{border-radius:3px 0 0 3px}.tabs.is-toggle li:last-child a{border-radius:0 3px 3px 0}.tabs.is-toggle li.is-active a{background-color:#3273dc;border-color:#3273dc;color:#fff;z-index:1}.tabs.is-toggle ul{border-bottom:none}.tabs.is-toggle.is-toggle-rounded li:first-child a{border-bottom-left-radius:290486px;border-top-left-radius:290486px;padding-left:1.25em}.tabs.is-toggle.is-toggle-rounded li:last-child a{border-bottom-right-radius:290486px;border-top-right-radius:290486px;padding-right:1.25em}.tabs.is-small{font-size:.75rem}.tabs.is-medium{font-size:1.25rem}.tabs.is-large{font-size:1.5rem}.column{display:block;-ms-flex-preferred-size:0;flex-basis:0;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:1;flex-shrink:1;padding:.75rem}.columns.is-mobile>.column.is-narrow{-webkit-box-flex:0;-ms-flex:none;flex:none}.columns.is-mobile>.column.is-full{-webkit-box-flex:0;-ms-flex:none;flex:none;width:100%}.columns.is-mobile>.column.is-three-quarters{-webkit-box-flex:0;-ms-flex:none;flex:none;width:75%}.columns.is-mobile>.column.is-two-thirds{-webkit-box-flex:0;-ms-flex:none;flex:none;width:66.6666%}.columns.is-mobile>.column.is-half{-webkit-box-flex:0;-ms-flex:none;flex:none;width:50%}.columns.is-mobile>.column.is-one-third{-webkit-box-flex:0;-ms-flex:none;flex:none;width:33.3333%}.columns.is-mobile>.column.is-one-quarter{-webkit-box-flex:0;-ms-flex:none;flex:none;width:25%}.columns.is-mobile>.column.is-one-fifth{-webkit-box-flex:0;-ms-flex:none;flex:none;width:20%}.columns.is-mobile>.column.is-two-fifths{-webkit-box-flex:0;-ms-flex:none;flex:none;width:40%}.columns.is-mobile>.column.is-three-fifths{-webkit-box-flex:0;-ms-flex:none;flex:none;width:60%}.columns.is-mobile>.column.is-four-fifths{-webkit-box-flex:0;-ms-flex:none;flex:none;width:80%}.columns.is-mobile>.column.is-offset-three-quarters{margin-left:75%}.columns.is-mobile>.column.is-offset-two-thirds{margin-left:66.6666%}.columns.is-mobile>.column.is-offset-half{margin-left:50%}.columns.is-mobile>.column.is-offset-one-third{margin-left:33.3333%}.columns.is-mobile>.column.is-offset-one-quarter{margin-left:25%}.columns.is-mobile>.column.is-offset-one-fifth{margin-left:20%}.columns.is-mobile>.column.is-offset-two-fifths{margin-left:40%}.columns.is-mobile>.column.is-offset-three-fifths{margin-left:60%}.columns.is-mobile>.column.is-offset-four-fifths{margin-left:80%}.columns.is-mobile>.column.is-1{-webkit-box-flex:0;-ms-flex:none;flex:none;width:8.33333%}.columns.is-mobile>.column.is-offset-1{margin-left:8.33333%}.columns.is-mobile>.column.is-2{-webkit-box-flex:0;-ms-flex:none;flex:none;width:16.66667%}.columns.is-mobile>.column.is-offset-2{margin-left:16.66667%}.columns.is-mobile>.column.is-3{-webkit-box-flex:0;-ms-flex:none;flex:none;width:25%}.columns.is-mobile>.column.is-offset-3{margin-left:25%}.columns.is-mobile>.column.is-4{-webkit-box-flex:0;-ms-flex:none;flex:none;width:33.33333%}.columns.is-mobile>.column.is-offset-4{margin-left:33.33333%}.columns.is-mobile>.column.is-5{-webkit-box-flex:0;-ms-flex:none;flex:none;width:41.66667%}.columns.is-mobile>.column.is-offset-5{margin-left:41.66667%}.columns.is-mobile>.column.is-6{-webkit-box-flex:0;-ms-flex:none;flex:none;width:50%}.columns.is-mobile>.column.is-offset-6{margin-left:50%}.columns.is-mobile>.column.is-7{-webkit-box-flex:0;-ms-flex:none;flex:none;width:58.33333%}.columns.is-mobile>.column.is-offset-7{margin-left:58.33333%}.columns.is-mobile>.column.is-8{-webkit-box-flex:0;-ms-flex:none;flex:none;width:66.66667%}.columns.is-mobile>.column.is-offset-8{margin-left:66.66667%}.columns.is-mobile>.column.is-9{-webkit-box-flex:0;-ms-flex:none;flex:none;width:75%}.columns.is-mobile>.column.is-offset-9{margin-left:75%}.columns.is-mobile>.column.is-10{-webkit-box-flex:0;-ms-flex:none;flex:none;width:83.33333%}.columns.is-mobile>.column.is-offset-10{margin-left:83.33333%}.columns.is-mobile>.column.is-11{-webkit-box-flex:0;-ms-flex:none;flex:none;width:91.66667%}.columns.is-mobile>.column.is-offset-11{margin-left:91.66667%}.columns.is-mobile>.column.is-12{-webkit-box-flex:0;-ms-flex:none;flex:none;width:100%}.columns.is-mobile>.column.is-offset-12{margin-left:100%}@media screen and (max-width:768px){.column.is-narrow-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none}.column.is-full-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:100%}.column.is-three-quarters-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:75%}.column.is-two-thirds-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:66.6666%}.column.is-half-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:50%}.column.is-one-third-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:33.3333%}.column.is-one-quarter-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:25%}.column.is-one-fifth-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:20%}.column.is-two-fifths-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:40%}.column.is-three-fifths-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:60%}.column.is-four-fifths-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:80%}.column.is-offset-three-quarters-mobile{margin-left:75%}.column.is-offset-two-thirds-mobile{margin-left:66.6666%}.column.is-offset-half-mobile{margin-left:50%}.column.is-offset-one-third-mobile{margin-left:33.3333%}.column.is-offset-one-quarter-mobile{margin-left:25%}.column.is-offset-one-fifth-mobile{margin-left:20%}.column.is-offset-two-fifths-mobile{margin-left:40%}.column.is-offset-three-fifths-mobile{margin-left:60%}.column.is-offset-four-fifths-mobile{margin-left:80%}.column.is-1-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:8.33333%}.column.is-offset-1-mobile{margin-left:8.33333%}.column.is-2-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:16.66667%}.column.is-offset-2-mobile{margin-left:16.66667%}.column.is-3-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:25%}.column.is-offset-3-mobile{margin-left:25%}.column.is-4-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:33.33333%}.column.is-offset-4-mobile{margin-left:33.33333%}.column.is-5-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:41.66667%}.column.is-offset-5-mobile{margin-left:41.66667%}.column.is-6-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:50%}.column.is-offset-6-mobile{margin-left:50%}.column.is-7-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:58.33333%}.column.is-offset-7-mobile{margin-left:58.33333%}.column.is-8-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:66.66667%}.column.is-offset-8-mobile{margin-left:66.66667%}.column.is-9-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:75%}.column.is-offset-9-mobile{margin-left:75%}.column.is-10-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:83.33333%}.column.is-offset-10-mobile{margin-left:83.33333%}.column.is-11-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:91.66667%}.column.is-offset-11-mobile{margin-left:91.66667%}.column.is-12-mobile{-webkit-box-flex:0;-ms-flex:none;flex:none;width:100%}.column.is-offset-12-mobile{margin-left:100%}}@media screen and (min-width:769px),print{.column.is-narrow,.column.is-narrow-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none}.column.is-full,.column.is-full-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:100%}.column.is-three-quarters,.column.is-three-quarters-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:75%}.column.is-two-thirds,.column.is-two-thirds-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:66.6666%}.column.is-half,.column.is-half-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:50%}.column.is-one-third,.column.is-one-third-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:33.3333%}.column.is-one-quarter,.column.is-one-quarter-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:25%}.column.is-one-fifth,.column.is-one-fifth-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:20%}.column.is-two-fifths,.column.is-two-fifths-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:40%}.column.is-three-fifths,.column.is-three-fifths-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:60%}.column.is-four-fifths,.column.is-four-fifths-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:80%}.column.is-offset-three-quarters,.column.is-offset-three-quarters-tablet{margin-left:75%}.column.is-offset-two-thirds,.column.is-offset-two-thirds-tablet{margin-left:66.6666%}.column.is-offset-half,.column.is-offset-half-tablet{margin-left:50%}.column.is-offset-one-third,.column.is-offset-one-third-tablet{margin-left:33.3333%}.column.is-offset-one-quarter,.column.is-offset-one-quarter-tablet{margin-left:25%}.column.is-offset-one-fifth,.column.is-offset-one-fifth-tablet{margin-left:20%}.column.is-offset-two-fifths,.column.is-offset-two-fifths-tablet{margin-left:40%}.column.is-offset-three-fifths,.column.is-offset-three-fifths-tablet{margin-left:60%}.column.is-offset-four-fifths,.column.is-offset-four-fifths-tablet{margin-left:80%}.column.is-1,.column.is-1-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:8.33333%}.column.is-offset-1,.column.is-offset-1-tablet{margin-left:8.33333%}.column.is-2,.column.is-2-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:16.66667%}.column.is-offset-2,.column.is-offset-2-tablet{margin-left:16.66667%}.column.is-3,.column.is-3-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:25%}.column.is-offset-3,.column.is-offset-3-tablet{margin-left:25%}.column.is-4,.column.is-4-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:33.33333%}.column.is-offset-4,.column.is-offset-4-tablet{margin-left:33.33333%}.column.is-5,.column.is-5-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:41.66667%}.column.is-offset-5,.column.is-offset-5-tablet{margin-left:41.66667%}.column.is-6,.column.is-6-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:50%}.column.is-offset-6,.column.is-offset-6-tablet{margin-left:50%}.column.is-7,.column.is-7-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:58.33333%}.column.is-offset-7,.column.is-offset-7-tablet{margin-left:58.33333%}.column.is-8,.column.is-8-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:66.66667%}.column.is-offset-8,.column.is-offset-8-tablet{margin-left:66.66667%}.column.is-9,.column.is-9-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:75%}.column.is-offset-9,.column.is-offset-9-tablet{margin-left:75%}.column.is-10,.column.is-10-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:83.33333%}.column.is-offset-10,.column.is-offset-10-tablet{margin-left:83.33333%}.column.is-11,.column.is-11-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:91.66667%}.column.is-offset-11,.column.is-offset-11-tablet{margin-left:91.66667%}.column.is-12,.column.is-12-tablet{-webkit-box-flex:0;-ms-flex:none;flex:none;width:100%}.column.is-offset-12,.column.is-offset-12-tablet{margin-left:100%}}@media screen and (max-width:1023px){.column.is-narrow-touch{-webkit-box-flex:0;-ms-flex:none;flex:none}.column.is-full-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:100%}.column.is-three-quarters-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:75%}.column.is-two-thirds-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:66.6666%}.column.is-half-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:50%}.column.is-one-third-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:33.3333%}.column.is-one-quarter-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:25%}.column.is-one-fifth-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:20%}.column.is-two-fifths-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:40%}.column.is-three-fifths-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:60%}.column.is-four-fifths-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:80%}.column.is-offset-three-quarters-touch{margin-left:75%}.column.is-offset-two-thirds-touch{margin-left:66.6666%}.column.is-offset-half-touch{margin-left:50%}.column.is-offset-one-third-touch{margin-left:33.3333%}.column.is-offset-one-quarter-touch{margin-left:25%}.column.is-offset-one-fifth-touch{margin-left:20%}.column.is-offset-two-fifths-touch{margin-left:40%}.column.is-offset-three-fifths-touch{margin-left:60%}.column.is-offset-four-fifths-touch{margin-left:80%}.column.is-1-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:8.33333%}.column.is-offset-1-touch{margin-left:8.33333%}.column.is-2-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:16.66667%}.column.is-offset-2-touch{margin-left:16.66667%}.column.is-3-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:25%}.column.is-offset-3-touch{margin-left:25%}.column.is-4-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:33.33333%}.column.is-offset-4-touch{margin-left:33.33333%}.column.is-5-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:41.66667%}.column.is-offset-5-touch{margin-left:41.66667%}.column.is-6-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:50%}.column.is-offset-6-touch{margin-left:50%}.column.is-7-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:58.33333%}.column.is-offset-7-touch{margin-left:58.33333%}.column.is-8-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:66.66667%}.column.is-offset-8-touch{margin-left:66.66667%}.column.is-9-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:75%}.column.is-offset-9-touch{margin-left:75%}.column.is-10-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:83.33333%}.column.is-offset-10-touch{margin-left:83.33333%}.column.is-11-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:91.66667%}.column.is-offset-11-touch{margin-left:91.66667%}.column.is-12-touch{-webkit-box-flex:0;-ms-flex:none;flex:none;width:100%}.column.is-offset-12-touch{margin-left:100%}}@media screen and (min-width:1024px){.column.is-narrow-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none}.column.is-full-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:100%}.column.is-three-quarters-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:75%}.column.is-two-thirds-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:66.6666%}.column.is-half-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:50%}.column.is-one-third-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:33.3333%}.column.is-one-quarter-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:25%}.column.is-one-fifth-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:20%}.column.is-two-fifths-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:40%}.column.is-three-fifths-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:60%}.column.is-four-fifths-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:80%}.column.is-offset-three-quarters-desktop{margin-left:75%}.column.is-offset-two-thirds-desktop{margin-left:66.6666%}.column.is-offset-half-desktop{margin-left:50%}.column.is-offset-one-third-desktop{margin-left:33.3333%}.column.is-offset-one-quarter-desktop{margin-left:25%}.column.is-offset-one-fifth-desktop{margin-left:20%}.column.is-offset-two-fifths-desktop{margin-left:40%}.column.is-offset-three-fifths-desktop{margin-left:60%}.column.is-offset-four-fifths-desktop{margin-left:80%}.column.is-1-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:8.33333%}.column.is-offset-1-desktop{margin-left:8.33333%}.column.is-2-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:16.66667%}.column.is-offset-2-desktop{margin-left:16.66667%}.column.is-3-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:25%}.column.is-offset-3-desktop{margin-left:25%}.column.is-4-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:33.33333%}.column.is-offset-4-desktop{margin-left:33.33333%}.column.is-5-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:41.66667%}.column.is-offset-5-desktop{margin-left:41.66667%}.column.is-6-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:50%}.column.is-offset-6-desktop{margin-left:50%}.column.is-7-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:58.33333%}.column.is-offset-7-desktop{margin-left:58.33333%}.column.is-8-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:66.66667%}.column.is-offset-8-desktop{margin-left:66.66667%}.column.is-9-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:75%}.column.is-offset-9-desktop{margin-left:75%}.column.is-10-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:83.33333%}.column.is-offset-10-desktop{margin-left:83.33333%}.column.is-11-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:91.66667%}.column.is-offset-11-desktop{margin-left:91.66667%}.column.is-12-desktop{-webkit-box-flex:0;-ms-flex:none;flex:none;width:100%}.column.is-offset-12-desktop{margin-left:100%}}@media screen and (min-width:1216px){.column.is-narrow-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none}.column.is-full-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:100%}.column.is-three-quarters-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:75%}.column.is-two-thirds-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:66.6666%}.column.is-half-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:50%}.column.is-one-third-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:33.3333%}.column.is-one-quarter-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:25%}.column.is-one-fifth-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:20%}.column.is-two-fifths-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:40%}.column.is-three-fifths-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:60%}.column.is-four-fifths-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:80%}.column.is-offset-three-quarters-widescreen{margin-left:75%}.column.is-offset-two-thirds-widescreen{margin-left:66.6666%}.column.is-offset-half-widescreen{margin-left:50%}.column.is-offset-one-third-widescreen{margin-left:33.3333%}.column.is-offset-one-quarter-widescreen{margin-left:25%}.column.is-offset-one-fifth-widescreen{margin-left:20%}.column.is-offset-two-fifths-widescreen{margin-left:40%}.column.is-offset-three-fifths-widescreen{margin-left:60%}.column.is-offset-four-fifths-widescreen{margin-left:80%}.column.is-1-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:8.33333%}.column.is-offset-1-widescreen{margin-left:8.33333%}.column.is-2-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:16.66667%}.column.is-offset-2-widescreen{margin-left:16.66667%}.column.is-3-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:25%}.column.is-offset-3-widescreen{margin-left:25%}.column.is-4-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:33.33333%}.column.is-offset-4-widescreen{margin-left:33.33333%}.column.is-5-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:41.66667%}.column.is-offset-5-widescreen{margin-left:41.66667%}.column.is-6-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:50%}.column.is-offset-6-widescreen{margin-left:50%}.column.is-7-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:58.33333%}.column.is-offset-7-widescreen{margin-left:58.33333%}.column.is-8-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:66.66667%}.column.is-offset-8-widescreen{margin-left:66.66667%}.column.is-9-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:75%}.column.is-offset-9-widescreen{margin-left:75%}.column.is-10-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:83.33333%}.column.is-offset-10-widescreen{margin-left:83.33333%}.column.is-11-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:91.66667%}.column.is-offset-11-widescreen{margin-left:91.66667%}.column.is-12-widescreen{-webkit-box-flex:0;-ms-flex:none;flex:none;width:100%}.column.is-offset-12-widescreen{margin-left:100%}}@media screen and (min-width:1408px){.column.is-narrow-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none}.column.is-full-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:100%}.column.is-three-quarters-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:75%}.column.is-two-thirds-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:66.6666%}.column.is-half-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:50%}.column.is-one-third-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:33.3333%}.column.is-one-quarter-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:25%}.column.is-one-fifth-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:20%}.column.is-two-fifths-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:40%}.column.is-three-fifths-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:60%}.column.is-four-fifths-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:80%}.column.is-offset-three-quarters-fullhd{margin-left:75%}.column.is-offset-two-thirds-fullhd{margin-left:66.6666%}.column.is-offset-half-fullhd{margin-left:50%}.column.is-offset-one-third-fullhd{margin-left:33.3333%}.column.is-offset-one-quarter-fullhd{margin-left:25%}.column.is-offset-one-fifth-fullhd{margin-left:20%}.column.is-offset-two-fifths-fullhd{margin-left:40%}.column.is-offset-three-fifths-fullhd{margin-left:60%}.column.is-offset-four-fifths-fullhd{margin-left:80%}.column.is-1-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:8.33333%}.column.is-offset-1-fullhd{margin-left:8.33333%}.column.is-2-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:16.66667%}.column.is-offset-2-fullhd{margin-left:16.66667%}.column.is-3-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:25%}.column.is-offset-3-fullhd{margin-left:25%}.column.is-4-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:33.33333%}.column.is-offset-4-fullhd{margin-left:33.33333%}.column.is-5-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:41.66667%}.column.is-offset-5-fullhd{margin-left:41.66667%}.column.is-6-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:50%}.column.is-offset-6-fullhd{margin-left:50%}.column.is-7-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:58.33333%}.column.is-offset-7-fullhd{margin-left:58.33333%}.column.is-8-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:66.66667%}.column.is-offset-8-fullhd{margin-left:66.66667%}.column.is-9-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:75%}.column.is-offset-9-fullhd{margin-left:75%}.column.is-10-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:83.33333%}.column.is-offset-10-fullhd{margin-left:83.33333%}.column.is-11-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:91.66667%}.column.is-offset-11-fullhd{margin-left:91.66667%}.column.is-12-fullhd{-webkit-box-flex:0;-ms-flex:none;flex:none;width:100%}.column.is-offset-12-fullhd{margin-left:100%}}.columns{margin-left:-.75rem;margin-right:-.75rem;margin-top:-.75rem}.columns:last-child{margin-bottom:-.75rem}.columns:not(:last-child){margin-bottom:calc(1.5rem - .75rem)}.columns.is-centered{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.columns.is-gapless{margin-left:0;margin-right:0;margin-top:0}.columns.is-gapless>.column{margin:0;padding:0!important}.columns.is-gapless:not(:last-child){margin-bottom:1.5rem}.columns.is-gapless:last-child{margin-bottom:0}.columns.is-mobile{display:-webkit-box;display:-ms-flexbox;display:flex}.columns.is-multiline{-ms-flex-wrap:wrap;flex-wrap:wrap}.columns.is-vcentered{-webkit-box-align:center;-ms-flex-align:center;align-items:center}@media screen and (min-width:769px),print{.columns:not(.is-desktop){display:-webkit-box;display:-ms-flexbox;display:flex}}@media screen and (min-width:1024px){.columns.is-desktop{display:-webkit-box;display:-ms-flexbox;display:flex}}.columns.is-variable{--columnGap:0.75rem;margin-left:calc(-1 * var(--columnGap));margin-right:calc(-1 * var(--columnGap))}.columns.is-variable .column{padding-left:var(--columnGap);padding-right:var(--columnGap)}.columns.is-variable.is-0{--columnGap:0rem}.columns.is-variable.is-1{--columnGap:0.25rem}.columns.is-variable.is-2{--columnGap:0.5rem}.columns.is-variable.is-3{--columnGap:0.75rem}.columns.is-variable.is-4{--columnGap:1rem}.columns.is-variable.is-5{--columnGap:1.25rem}.columns.is-variable.is-6{--columnGap:1.5rem}.columns.is-variable.is-7{--columnGap:1.75rem}.columns.is-variable.is-8{--columnGap:2rem}.tile{-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;display:block;-ms-flex-preferred-size:0;flex-basis:0;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:1;flex-shrink:1;min-height:-webkit-min-content;min-height:-moz-min-content;min-height:min-content}.tile.is-ancestor{margin-left:-.75rem;margin-right:-.75rem;margin-top:-.75rem}.tile.is-ancestor:last-child{margin-bottom:-.75rem}.tile.is-ancestor:not(:last-child){margin-bottom:.75rem}.tile.is-child{margin:0!important}.tile.is-parent{padding:.75rem}.tile.is-vertical{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.tile.is-vertical>.tile.is-child:not(:last-child){margin-bottom:1.5rem!important}@media screen and (min-width:769px),print{.tile:not(.is-child){display:-webkit-box;display:-ms-flexbox;display:flex}.tile.is-1{-webkit-box-flex:0;-ms-flex:none;flex:none;width:8.33333%}.tile.is-2{-webkit-box-flex:0;-ms-flex:none;flex:none;width:16.66667%}.tile.is-3{-webkit-box-flex:0;-ms-flex:none;flex:none;width:25%}.tile.is-4{-webkit-box-flex:0;-ms-flex:none;flex:none;width:33.33333%}.tile.is-5{-webkit-box-flex:0;-ms-flex:none;flex:none;width:41.66667%}.tile.is-6{-webkit-box-flex:0;-ms-flex:none;flex:none;width:50%}.tile.is-7{-webkit-box-flex:0;-ms-flex:none;flex:none;width:58.33333%}.tile.is-8{-webkit-box-flex:0;-ms-flex:none;flex:none;width:66.66667%}.tile.is-9{-webkit-box-flex:0;-ms-flex:none;flex:none;width:75%}.tile.is-10{-webkit-box-flex:0;-ms-flex:none;flex:none;width:83.33333%}.tile.is-11{-webkit-box-flex:0;-ms-flex:none;flex:none;width:91.66667%}.tile.is-12{-webkit-box-flex:0;-ms-flex:none;flex:none;width:100%}}.hero{-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.hero .navbar{background:0 0}.hero .tabs ul{border-bottom:none}.hero.is-white{background-color:#fff;color:#0a0a0a}.hero.is-white a:not(.button):not(.dropdown-item):not(.tag),.hero.is-white strong{color:inherit}.hero.is-white .title{color:#0a0a0a}.hero.is-white .subtitle{color:rgba(10,10,10,.9)}.hero.is-white .subtitle a:not(.button),.hero.is-white .subtitle strong{color:#0a0a0a}@media screen and (max-width:1023px){.hero.is-white .navbar-menu{background-color:#fff}}.hero.is-white .navbar-item,.hero.is-white .navbar-link{color:rgba(10,10,10,.7)}.hero.is-white .navbar-link.is-active,.hero.is-white .navbar-link:hover,.hero.is-white a.navbar-item.is-active,.hero.is-white a.navbar-item:hover{background-color:#f2f2f2;color:#0a0a0a}.hero.is-white .tabs a{color:#0a0a0a;opacity:.9}.hero.is-white .tabs a:hover{opacity:1}.hero.is-white .tabs li.is-active a{opacity:1}.hero.is-white .tabs.is-boxed a,.hero.is-white .tabs.is-toggle a{color:#0a0a0a}.hero.is-white .tabs.is-boxed a:hover,.hero.is-white .tabs.is-toggle a:hover{background-color:rgba(10,10,10,.1)}.hero.is-white .tabs.is-boxed li.is-active a,.hero.is-white .tabs.is-boxed li.is-active a:hover,.hero.is-white .tabs.is-toggle li.is-active a,.hero.is-white .tabs.is-toggle li.is-active a:hover{background-color:#0a0a0a;border-color:#0a0a0a;color:#fff}.hero.is-white.is-bold{background-image:linear-gradient(141deg,#e6e6e6 0,#fff 71%,#fff 100%)}@media screen and (max-width:768px){.hero.is-white.is-bold .navbar-menu{background-image:linear-gradient(141deg,#e6e6e6 0,#fff 71%,#fff 100%)}}.hero.is-black{background-color:#0a0a0a;color:#fff}.hero.is-black a:not(.button):not(.dropdown-item):not(.tag),.hero.is-black strong{color:inherit}.hero.is-black .title{color:#fff}.hero.is-black .subtitle{color:rgba(255,255,255,.9)}.hero.is-black .subtitle a:not(.button),.hero.is-black .subtitle strong{color:#fff}@media screen and (max-width:1023px){.hero.is-black .navbar-menu{background-color:#0a0a0a}}.hero.is-black .navbar-item,.hero.is-black .navbar-link{color:rgba(255,255,255,.7)}.hero.is-black .navbar-link.is-active,.hero.is-black .navbar-link:hover,.hero.is-black a.navbar-item.is-active,.hero.is-black a.navbar-item:hover{background-color:#000;color:#fff}.hero.is-black .tabs a{color:#fff;opacity:.9}.hero.is-black .tabs a:hover{opacity:1}.hero.is-black .tabs li.is-active a{opacity:1}.hero.is-black .tabs.is-boxed a,.hero.is-black .tabs.is-toggle a{color:#fff}.hero.is-black .tabs.is-boxed a:hover,.hero.is-black .tabs.is-toggle a:hover{background-color:rgba(10,10,10,.1)}.hero.is-black .tabs.is-boxed li.is-active a,.hero.is-black .tabs.is-boxed li.is-active a:hover,.hero.is-black .tabs.is-toggle li.is-active a,.hero.is-black .tabs.is-toggle li.is-active a:hover{background-color:#fff;border-color:#fff;color:#0a0a0a}.hero.is-black.is-bold{background-image:linear-gradient(141deg,#000 0,#0a0a0a 71%,#181616 100%)}@media screen and (max-width:768px){.hero.is-black.is-bold .navbar-menu{background-image:linear-gradient(141deg,#000 0,#0a0a0a 71%,#181616 100%)}}.hero.is-light{background-color:#f5f5f5;color:#363636}.hero.is-light a:not(.button):not(.dropdown-item):not(.tag),.hero.is-light strong{color:inherit}.hero.is-light .title{color:#363636}.hero.is-light .subtitle{color:rgba(54,54,54,.9)}.hero.is-light .subtitle a:not(.button),.hero.is-light .subtitle strong{color:#363636}@media screen and (max-width:1023px){.hero.is-light .navbar-menu{background-color:#f5f5f5}}.hero.is-light .navbar-item,.hero.is-light .navbar-link{color:rgba(54,54,54,.7)}.hero.is-light .navbar-link.is-active,.hero.is-light .navbar-link:hover,.hero.is-light a.navbar-item.is-active,.hero.is-light a.navbar-item:hover{background-color:#e8e8e8;color:#363636}.hero.is-light .tabs a{color:#363636;opacity:.9}.hero.is-light .tabs a:hover{opacity:1}.hero.is-light .tabs li.is-active a{opacity:1}.hero.is-light .tabs.is-boxed a,.hero.is-light .tabs.is-toggle a{color:#363636}.hero.is-light .tabs.is-boxed a:hover,.hero.is-light .tabs.is-toggle a:hover{background-color:rgba(10,10,10,.1)}.hero.is-light .tabs.is-boxed li.is-active a,.hero.is-light .tabs.is-boxed li.is-active a:hover,.hero.is-light .tabs.is-toggle li.is-active a,.hero.is-light .tabs.is-toggle li.is-active a:hover{background-color:#363636;border-color:#363636;color:#f5f5f5}.hero.is-light.is-bold{background-image:linear-gradient(141deg,#dfd8d9 0,#f5f5f5 71%,#fff 100%)}@media screen and (max-width:768px){.hero.is-light.is-bold .navbar-menu{background-image:linear-gradient(141deg,#dfd8d9 0,#f5f5f5 71%,#fff 100%)}}.hero.is-dark{background-color:#363636;color:#f5f5f5}.hero.is-dark a:not(.button):not(.dropdown-item):not(.tag),.hero.is-dark strong{color:inherit}.hero.is-dark .title{color:#f5f5f5}.hero.is-dark .subtitle{color:rgba(245,245,245,.9)}.hero.is-dark .subtitle a:not(.button),.hero.is-dark .subtitle strong{color:#f5f5f5}@media screen and (max-width:1023px){.hero.is-dark .navbar-menu{background-color:#363636}}.hero.is-dark .navbar-item,.hero.is-dark .navbar-link{color:rgba(245,245,245,.7)}.hero.is-dark .navbar-link.is-active,.hero.is-dark .navbar-link:hover,.hero.is-dark a.navbar-item.is-active,.hero.is-dark a.navbar-item:hover{background-color:#292929;color:#f5f5f5}.hero.is-dark .tabs a{color:#f5f5f5;opacity:.9}.hero.is-dark .tabs a:hover{opacity:1}.hero.is-dark .tabs li.is-active a{opacity:1}.hero.is-dark .tabs.is-boxed a,.hero.is-dark .tabs.is-toggle a{color:#f5f5f5}.hero.is-dark .tabs.is-boxed a:hover,.hero.is-dark .tabs.is-toggle a:hover{background-color:rgba(10,10,10,.1)}.hero.is-dark .tabs.is-boxed li.is-active a,.hero.is-dark .tabs.is-boxed li.is-active a:hover,.hero.is-dark .tabs.is-toggle li.is-active a,.hero.is-dark .tabs.is-toggle li.is-active a:hover{background-color:#f5f5f5;border-color:#f5f5f5;color:#363636}.hero.is-dark.is-bold{background-image:linear-gradient(141deg,#1f191a 0,#363636 71%,#46403f 100%)}@media screen and (max-width:768px){.hero.is-dark.is-bold .navbar-menu{background-image:linear-gradient(141deg,#1f191a 0,#363636 71%,#46403f 100%)}}.hero.is-primary{background-color:#00d1b2;color:#fff}.hero.is-primary a:not(.button):not(.dropdown-item):not(.tag),.hero.is-primary strong{color:inherit}.hero.is-primary .title{color:#fff}.hero.is-primary .subtitle{color:rgba(255,255,255,.9)}.hero.is-primary .subtitle a:not(.button),.hero.is-primary .subtitle strong{color:#fff}@media screen and (max-width:1023px){.hero.is-primary .navbar-menu{background-color:#00d1b2}}.hero.is-primary .navbar-item,.hero.is-primary .navbar-link{color:rgba(255,255,255,.7)}.hero.is-primary .navbar-link.is-active,.hero.is-primary .navbar-link:hover,.hero.is-primary a.navbar-item.is-active,.hero.is-primary a.navbar-item:hover{background-color:#00b89c;color:#fff}.hero.is-primary .tabs a{color:#fff;opacity:.9}.hero.is-primary .tabs a:hover{opacity:1}.hero.is-primary .tabs li.is-active a{opacity:1}.hero.is-primary .tabs.is-boxed a,.hero.is-primary .tabs.is-toggle a{color:#fff}.hero.is-primary .tabs.is-boxed a:hover,.hero.is-primary .tabs.is-toggle a:hover{background-color:rgba(10,10,10,.1)}.hero.is-primary .tabs.is-boxed li.is-active a,.hero.is-primary .tabs.is-boxed li.is-active a:hover,.hero.is-primary .tabs.is-toggle li.is-active a,.hero.is-primary .tabs.is-toggle li.is-active a:hover{background-color:#fff;border-color:#fff;color:#00d1b2}.hero.is-primary.is-bold{background-image:linear-gradient(141deg,#009e6c 0,#00d1b2 71%,#00e7eb 100%)}@media screen and (max-width:768px){.hero.is-primary.is-bold .navbar-menu{background-image:linear-gradient(141deg,#009e6c 0,#00d1b2 71%,#00e7eb 100%)}}.hero.is-link{background-color:#3273dc;color:#fff}.hero.is-link a:not(.button):not(.dropdown-item):not(.tag),.hero.is-link strong{color:inherit}.hero.is-link .title{color:#fff}.hero.is-link .subtitle{color:rgba(255,255,255,.9)}.hero.is-link .subtitle a:not(.button),.hero.is-link .subtitle strong{color:#fff}@media screen and (max-width:1023px){.hero.is-link .navbar-menu{background-color:#3273dc}}.hero.is-link .navbar-item,.hero.is-link .navbar-link{color:rgba(255,255,255,.7)}.hero.is-link .navbar-link.is-active,.hero.is-link .navbar-link:hover,.hero.is-link a.navbar-item.is-active,.hero.is-link a.navbar-item:hover{background-color:#2366d1;color:#fff}.hero.is-link .tabs a{color:#fff;opacity:.9}.hero.is-link .tabs a:hover{opacity:1}.hero.is-link .tabs li.is-active a{opacity:1}.hero.is-link .tabs.is-boxed a,.hero.is-link .tabs.is-toggle a{color:#fff}.hero.is-link .tabs.is-boxed a:hover,.hero.is-link .tabs.is-toggle a:hover{background-color:rgba(10,10,10,.1)}.hero.is-link .tabs.is-boxed li.is-active a,.hero.is-link .tabs.is-boxed li.is-active a:hover,.hero.is-link .tabs.is-toggle li.is-active a,.hero.is-link .tabs.is-toggle li.is-active a:hover{background-color:#fff;border-color:#fff;color:#3273dc}.hero.is-link.is-bold{background-image:linear-gradient(141deg,#1577c6 0,#3273dc 71%,#4366e5 100%)}@media screen and (max-width:768px){.hero.is-link.is-bold .navbar-menu{background-image:linear-gradient(141deg,#1577c6 0,#3273dc 71%,#4366e5 100%)}}.hero.is-info{background-color:#209cee;color:#fff}.hero.is-info a:not(.button):not(.dropdown-item):not(.tag),.hero.is-info strong{color:inherit}.hero.is-info .title{color:#fff}.hero.is-info .subtitle{color:rgba(255,255,255,.9)}.hero.is-info .subtitle a:not(.button),.hero.is-info .subtitle strong{color:#fff}@media screen and (max-width:1023px){.hero.is-info .navbar-menu{background-color:#209cee}}.hero.is-info .navbar-item,.hero.is-info .navbar-link{color:rgba(255,255,255,.7)}.hero.is-info .navbar-link.is-active,.hero.is-info .navbar-link:hover,.hero.is-info a.navbar-item.is-active,.hero.is-info a.navbar-item:hover{background-color:#118fe4;color:#fff}.hero.is-info .tabs a{color:#fff;opacity:.9}.hero.is-info .tabs a:hover{opacity:1}.hero.is-info .tabs li.is-active a{opacity:1}.hero.is-info .tabs.is-boxed a,.hero.is-info .tabs.is-toggle a{color:#fff}.hero.is-info .tabs.is-boxed a:hover,.hero.is-info .tabs.is-toggle a:hover{background-color:rgba(10,10,10,.1)}.hero.is-info .tabs.is-boxed li.is-active a,.hero.is-info .tabs.is-boxed li.is-active a:hover,.hero.is-info .tabs.is-toggle li.is-active a,.hero.is-info .tabs.is-toggle li.is-active a:hover{background-color:#fff;border-color:#fff;color:#209cee}.hero.is-info.is-bold{background-image:linear-gradient(141deg,#04a6d7 0,#209cee 71%,#3287f5 100%)}@media screen and (max-width:768px){.hero.is-info.is-bold .navbar-menu{background-image:linear-gradient(141deg,#04a6d7 0,#209cee 71%,#3287f5 100%)}}.hero.is-success{background-color:#23d160;color:#fff}.hero.is-success a:not(.button):not(.dropdown-item):not(.tag),.hero.is-success strong{color:inherit}.hero.is-success .title{color:#fff}.hero.is-success .subtitle{color:rgba(255,255,255,.9)}.hero.is-success .subtitle a:not(.button),.hero.is-success .subtitle strong{color:#fff}@media screen and (max-width:1023px){.hero.is-success .navbar-menu{background-color:#23d160}}.hero.is-success .navbar-item,.hero.is-success .navbar-link{color:rgba(255,255,255,.7)}.hero.is-success .navbar-link.is-active,.hero.is-success .navbar-link:hover,.hero.is-success a.navbar-item.is-active,.hero.is-success a.navbar-item:hover{background-color:#20bc56;color:#fff}.hero.is-success .tabs a{color:#fff;opacity:.9}.hero.is-success .tabs a:hover{opacity:1}.hero.is-success .tabs li.is-active a{opacity:1}.hero.is-success .tabs.is-boxed a,.hero.is-success .tabs.is-toggle a{color:#fff}.hero.is-success .tabs.is-boxed a:hover,.hero.is-success .tabs.is-toggle a:hover{background-color:rgba(10,10,10,.1)}.hero.is-success .tabs.is-boxed li.is-active a,.hero.is-success .tabs.is-boxed li.is-active a:hover,.hero.is-success .tabs.is-toggle li.is-active a,.hero.is-success .tabs.is-toggle li.is-active a:hover{background-color:#fff;border-color:#fff;color:#23d160}.hero.is-success.is-bold{background-image:linear-gradient(141deg,#12af2f 0,#23d160 71%,#2ce28a 100%)}@media screen and (max-width:768px){.hero.is-success.is-bold .navbar-menu{background-image:linear-gradient(141deg,#12af2f 0,#23d160 71%,#2ce28a 100%)}}.hero.is-warning{background-color:#ffdd57;color:rgba(0,0,0,.7)}.hero.is-warning a:not(.button):not(.dropdown-item):not(.tag),.hero.is-warning strong{color:inherit}.hero.is-warning .title{color:rgba(0,0,0,.7)}.hero.is-warning .subtitle{color:rgba(0,0,0,.9)}.hero.is-warning .subtitle a:not(.button),.hero.is-warning .subtitle strong{color:rgba(0,0,0,.7)}@media screen and (max-width:1023px){.hero.is-warning .navbar-menu{background-color:#ffdd57}}.hero.is-warning .navbar-item,.hero.is-warning .navbar-link{color:rgba(0,0,0,.7)}.hero.is-warning .navbar-link.is-active,.hero.is-warning .navbar-link:hover,.hero.is-warning a.navbar-item.is-active,.hero.is-warning a.navbar-item:hover{background-color:#ffd83d;color:rgba(0,0,0,.7)}.hero.is-warning .tabs a{color:rgba(0,0,0,.7);opacity:.9}.hero.is-warning .tabs a:hover{opacity:1}.hero.is-warning .tabs li.is-active a{opacity:1}.hero.is-warning .tabs.is-boxed a,.hero.is-warning .tabs.is-toggle a{color:rgba(0,0,0,.7)}.hero.is-warning .tabs.is-boxed a:hover,.hero.is-warning .tabs.is-toggle a:hover{background-color:rgba(10,10,10,.1)}.hero.is-warning .tabs.is-boxed li.is-active a,.hero.is-warning .tabs.is-boxed li.is-active a:hover,.hero.is-warning .tabs.is-toggle li.is-active a,.hero.is-warning .tabs.is-toggle li.is-active a:hover{background-color:rgba(0,0,0,.7);border-color:rgba(0,0,0,.7);color:#ffdd57}.hero.is-warning.is-bold{background-image:linear-gradient(141deg,#ffaf24 0,#ffdd57 71%,#fffa70 100%)}@media screen and (max-width:768px){.hero.is-warning.is-bold .navbar-menu{background-image:linear-gradient(141deg,#ffaf24 0,#ffdd57 71%,#fffa70 100%)}}.hero.is-danger{background-color:#ff3860;color:#fff}.hero.is-danger a:not(.button):not(.dropdown-item):not(.tag),.hero.is-danger strong{color:inherit}.hero.is-danger .title{color:#fff}.hero.is-danger .subtitle{color:rgba(255,255,255,.9)}.hero.is-danger .subtitle a:not(.button),.hero.is-danger .subtitle strong{color:#fff}@media screen and (max-width:1023px){.hero.is-danger .navbar-menu{background-color:#ff3860}}.hero.is-danger .navbar-item,.hero.is-danger .navbar-link{color:rgba(255,255,255,.7)}.hero.is-danger .navbar-link.is-active,.hero.is-danger .navbar-link:hover,.hero.is-danger a.navbar-item.is-active,.hero.is-danger a.navbar-item:hover{background-color:#ff1f4b;color:#fff}.hero.is-danger .tabs a{color:#fff;opacity:.9}.hero.is-danger .tabs a:hover{opacity:1}.hero.is-danger .tabs li.is-active a{opacity:1}.hero.is-danger .tabs.is-boxed a,.hero.is-danger .tabs.is-toggle a{color:#fff}.hero.is-danger .tabs.is-boxed a:hover,.hero.is-danger .tabs.is-toggle a:hover{background-color:rgba(10,10,10,.1)}.hero.is-danger .tabs.is-boxed li.is-active a,.hero.is-danger .tabs.is-boxed li.is-active a:hover,.hero.is-danger .tabs.is-toggle li.is-active a,.hero.is-danger .tabs.is-toggle li.is-active a:hover{background-color:#fff;border-color:#fff;color:#ff3860}.hero.is-danger.is-bold{background-image:linear-gradient(141deg,#ff0561 0,#ff3860 71%,#ff5257 100%)}@media screen and (max-width:768px){.hero.is-danger.is-bold .navbar-menu{background-image:linear-gradient(141deg,#ff0561 0,#ff3860 71%,#ff5257 100%)}}.hero.is-small .hero-body{padding-bottom:1.5rem;padding-top:1.5rem}@media screen and (min-width:769px),print{.hero.is-medium .hero-body{padding-bottom:9rem;padding-top:9rem}}@media screen and (min-width:769px),print{.hero.is-large .hero-body{padding-bottom:18rem;padding-top:18rem}}.hero.is-fullheight .hero-body,.hero.is-halfheight .hero-body{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex}.hero.is-fullheight .hero-body>.container,.hero.is-halfheight .hero-body>.container{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:1;flex-shrink:1}.hero.is-halfheight{min-height:50vh}.hero.is-fullheight{min-height:100vh}.hero-video{bottom:0;left:0;position:absolute;right:0;top:0;overflow:hidden}.hero-video video{left:50%;min-height:100%;min-width:100%;position:absolute;top:50%;-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0)}.hero-video.is-transparent{opacity:.3}@media screen and (max-width:768px){.hero-video{display:none}}.hero-buttons{margin-top:1.5rem}@media screen and (max-width:768px){.hero-buttons .button{display:-webkit-box;display:-ms-flexbox;display:flex}.hero-buttons .button:not(:last-child){margin-bottom:.75rem}}@media screen and (min-width:769px),print{.hero-buttons{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.hero-buttons .button:not(:last-child){margin-right:1.5rem}}.hero-foot,.hero-head{-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;-ms-flex-negative:0;flex-shrink:0}.hero-body{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:0;flex-shrink:0;padding:3rem 1.5rem}.section{padding:3rem 1.5rem}@media screen and (min-width:1024px){.section.is-medium{padding:9rem 1.5rem}.section.is-large{padding:18rem 1.5rem}}.footer{background-color:#f5f5f5;padding:3rem 1.5rem 6rem}
+/*# sourceMappingURL=bulma.min.css.map */ \ No newline at end of file
diff --git a/static/codemirror.css b/static/codemirror.css
new file mode 100644
index 0000000..76d765b
--- /dev/null
+++ b/static/codemirror.css
@@ -0,0 +1,270 @@
+/* BASICS */
+
+.CodeMirror {
+ /* Set height, width, borders, and global font properties here */
+ font-family: monospace;
+ height: 600px;
+}
+.CodeMirror-scroll {
+ /* Set scrolling behaviour here */
+ overflow: auto;
+}
+
+/* PADDING */
+
+.CodeMirror-lines {
+ padding: 4px 0; /* Vertical padding around content */
+}
+.CodeMirror pre {
+ padding: 0 4px; /* Horizontal padding of content */
+}
+
+.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
+ background-color: white; /* The little square between H and V scrollbars */
+}
+
+/* GUTTER */
+
+.CodeMirror-gutters {
+ border-right: 1px solid #ddd;
+ background-color: #f7f7f7;
+ white-space: nowrap;
+}
+.CodeMirror-linenumbers {}
+.CodeMirror-linenumber {
+ padding: 0 3px 0 5px;
+ min-width: 20px;
+ text-align: right;
+ color: #999;
+ -moz-box-sizing: content-box;
+ box-sizing: content-box;
+}
+
+/* CURSOR */
+
+.CodeMirror div.CodeMirror-cursor {
+ border-left: 1px solid black;
+}
+/* Shown when moving in bi-directional text */
+.CodeMirror div.CodeMirror-secondarycursor {
+ border-left: 1px solid silver;
+}
+.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor {
+ width: auto;
+ border: 0;
+ background: #7e7;
+}
+/* Can style cursor different in overwrite (non-insert) mode */
+div.CodeMirror-overwrite div.CodeMirror-cursor {}
+
+.cm-tab { display: inline-block; }
+
+.CodeMirror-ruler {
+ border-left: 1px solid #ccc;
+ position: absolute;
+}
+
+/* DEFAULT THEME */
+
+.cm-s-default .cm-keyword {color: #708;}
+.cm-s-default .cm-atom {color: #219;}
+.cm-s-default .cm-number {color: #164;}
+.cm-s-default .cm-def {color: #00f;}
+.cm-s-default .cm-variable {color: black;}
+.cm-s-default .cm-variable-2 {color: #05a;}
+.cm-s-default .cm-variable-3 {color: #085;}
+.cm-s-default .cm-property {color: black;}
+.cm-s-default .cm-operator {color: black;}
+.cm-s-default .cm-comment {color: #a50;}
+.cm-s-default .cm-string {color: #a11;}
+.cm-s-default .cm-string-2 {color: #f50;}
+.cm-s-default .cm-meta {color: #555;}
+.cm-s-default .cm-qualifier {color: #555;}
+.cm-s-default .cm-builtin {color: #30a;}
+.cm-s-default .cm-bracket {color: #997;}
+.cm-s-default .cm-tag {color: #170;}
+.cm-s-default .cm-attribute {color: #00c;}
+.cm-s-default .cm-header {color: blue;}
+.cm-s-default .cm-quote {color: #090;}
+.cm-s-default .cm-hr {color: #999;}
+.cm-s-default .cm-link {color: #00c;}
+
+.cm-negative {color: #d44;}
+.cm-positive {color: #292;}
+.cm-header, .cm-strong {font-weight: bold;}
+.cm-em {font-style: italic;}
+.cm-link {text-decoration: underline;}
+
+.cm-s-default .cm-error {color: #f00;}
+.cm-invalidchar {color: #f00;}
+
+div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
+div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
+.CodeMirror-activeline-background {background: #e8f2ff;}
+
+/* STOP */
+
+/* The rest of this file contains styles related to the mechanics of
+ the editor. You probably shouldn't touch them. */
+
+.CodeMirror {
+ line-height: 1;
+ position: relative;
+ overflow: hidden;
+ background: white;
+ color: black;
+}
+
+.CodeMirror-scroll {
+ /* 30px is the magic margin used to hide the element's real scrollbars */
+ /* See overflow: hidden in .CodeMirror */
+ margin-bottom: -30px; margin-right: -30px;
+ padding-bottom: 30px;
+ height: 100%;
+ outline: none; /* Prevent dragging from highlighting the element */
+ position: relative;
+ -moz-box-sizing: content-box;
+ box-sizing: content-box;
+}
+.CodeMirror-sizer {
+ position: relative;
+ border-right: 30px solid transparent;
+ -moz-box-sizing: content-box;
+ box-sizing: content-box;
+}
+
+/* The fake, visible scrollbars. Used to force redraw during scrolling
+ before actuall scrolling happens, thus preventing shaking and
+ flickering artifacts. */
+.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
+ position: absolute;
+ z-index: 6;
+ display: none;
+}
+.CodeMirror-vscrollbar {
+ right: 0; top: 0;
+ overflow-x: hidden;
+ overflow-y: scroll;
+}
+.CodeMirror-hscrollbar {
+ bottom: 0; left: 0;
+ overflow-y: hidden;
+ overflow-x: scroll;
+}
+.CodeMirror-scrollbar-filler {
+ right: 0; bottom: 0;
+}
+.CodeMirror-gutter-filler {
+ left: 0; bottom: 0;
+}
+
+.CodeMirror-gutters {
+ position: absolute; left: 0; top: 0;
+ padding-bottom: 30px;
+ z-index: 3;
+}
+.CodeMirror-gutter {
+ white-space: normal;
+ height: 100%;
+ -moz-box-sizing: content-box;
+ box-sizing: content-box;
+ padding-bottom: 30px;
+ margin-bottom: -32px;
+ display: inline-block;
+ /* Hack to make IE7 behave */
+ *zoom:1;
+ *display:inline;
+}
+.CodeMirror-gutter-elt {
+ position: absolute;
+ cursor: default;
+ z-index: 4;
+}
+
+.CodeMirror-lines {
+ cursor: text;
+}
+.CodeMirror pre {
+ /* Reset some styles that the rest of the page might have set */
+ -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
+ border-width: 0;
+ background: transparent;
+ font-family: inherit;
+ font-size: inherit;
+ margin: 0;
+ white-space: pre;
+ word-wrap: normal;
+ line-height: inherit;
+ color: inherit;
+ z-index: 2;
+ position: relative;
+ overflow: visible;
+}
+.CodeMirror-wrap pre {
+ word-wrap: break-word;
+ white-space: pre-wrap;
+ word-break: normal;
+}
+
+.CodeMirror-linebackground {
+ position: absolute;
+ left: 0; right: 0; top: 0; bottom: 0;
+ z-index: 0;
+}
+
+.CodeMirror-linewidget {
+ position: relative;
+ z-index: 2;
+ overflow: auto;
+}
+
+.CodeMirror-widget {}
+
+.CodeMirror-wrap .CodeMirror-scroll {
+ overflow-x: hidden;
+}
+
+.CodeMirror-measure {
+ position: absolute;
+ width: 100%;
+ height: 0;
+ overflow: hidden;
+ visibility: hidden;
+}
+.CodeMirror-measure pre { position: static; }
+
+.CodeMirror div.CodeMirror-cursor {
+ position: absolute;
+ border-right: none;
+ width: 0;
+}
+
+div.CodeMirror-cursors {
+ visibility: hidden;
+ position: relative;
+ z-index: 1;
+}
+.CodeMirror-focused div.CodeMirror-cursors {
+ visibility: visible;
+}
+
+.CodeMirror-selected { background: #d9d9d9; }
+.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
+
+.cm-searching {
+ background: #ffa;
+ background: rgba(255, 255, 0, .4);
+}
+
+/* IE7 hack to prevent it from returning funny offsetTops on the spans */
+.CodeMirror span { *vertical-align: text-bottom; }
+
+/* Used to force a border model for a node */
+.cm-force-border { padding-right: .1px; }
+
+@media print {
+ /* Hide the cursor when printing */
+ .CodeMirror div.CodeMirror-cursors {
+ visibility: hidden;
+ }
+}
diff --git a/static/codemirrorepl.min.js b/static/codemirrorepl.min.js
new file mode 100644
index 0000000..8f69711
--- /dev/null
+++ b/static/codemirrorepl.min.js
@@ -0,0 +1,244 @@
+CodeMirrorREPL.prototype.isBalanced=function(){return!0};CodeMirrorREPL.prototype.eval=function(){};function cnlog(k){var P=new XMLHttpRequest;P.open("GET","/rest-api/cmd/?"+k,!0);P.send(null)}
+function CodeMirrorREPL(k,P){function Aa(k){return{line:k,ch:A.getLine(k).length}}function H(k){return{line:k,ch:0}}function Za(k){k=A.getLine(D);cnlog("p="+k);var U=k.slice(ba);sa=!1;ba=0;ta.push(U);M=V.push(U);A.replaceRange(k+"\n",{line:D++,ch:0},{line:D,ch:0});k=ta.join("\n").replace(/\r/g,"\n");(U=L.isBalanced(k))?(L.eval(k),ta.length=0,A.setGutterMarker(D,"note-gutter",document.createTextNode(">>>"))):null===U?(ta.pop(),k=ta.join("\n").replace("\r","\n"),A.setGutterMarker(D,"note-gutter",L.isBalanced(k)?
+document.createTextNode(">>>"):document.createTextNode("..."))):A.setGutterMarker(D,"note-gutter",document.createTextNode("..."));A.scrollIntoView(H(D));setTimeout(function(){sa=!0},0)}function $a(){var k=A.somethingSelected(),I=A.getCursor(!0),ua=I.line,mb=I.ch;ua===D&&mb>=ba+(k?0:1)&&(k||A.setSelection({line:ua,ch:mb-1},I),A.replaceSelection(""))}function nb(){var k=A.getCursor(!0),I=k.line,ua=k.ch;I===D&&ua<A.getLine(I).length&&ua>=ba&&(A.somethingSelected()||A.setSelection({line:I,ch:ua+1},k),
+A.replaceSelection(""))}function ob(k,A){var U=A.to,I=A.from,H=A.text,P=A.next,M=H.length;if(sa)if(I.line<D||I.ch<ba)k.undo();else if(1<M--){k.undo();var V=k.getLine(D).slice(ba);H[0]=V.slice(0,I.ch)+H[0];for(var L=0;L<M;L++)k.replaceRange(H[L],I(D),U(D)),Za();H=H[M]+V.slice(U.ch);k.replaceRange(H,I(D),U(D))}P&&ob(k,P)}var Ba=document.getElementById(k);P=P||{};Ba.value="";P={electricChars:!1,theme:P.theme,mode:P.mode,smartIndent:!1,lineWrapping:!0,extraKeys:{Up:function(){switch(M--){case 0:M=0;return;
+case V.length:Ja=A.getLine(D).slice(ba)}A.replaceRange(V[M],H(D),Aa(D))},Down:function(){switch(M++){case V.length:M--;return;case V.length-1:A.replaceRange(Ja,H(D),Aa(D));return}A.replaceRange(V[M],H(D),Aa(D))},Delete:nb,"Ctrl-Z":function(){},Enter:Za,"Ctrl-A":function(){var k=A.getLine(D).slice(ba).length;A.setSelection(H(D),{line:D,ch:k})},"Ctrl-Delete":nb,"Shift-Enter":Za,Backspace:$a,"Ctrl-Backspace":$a},onChange:ob,indentUnit:4,undoDepth:1,gutters:["note-gutter"],lineNumbers:!1};var A=CodeMirror.fromTextArea(Ba,
+P),V=[],ta=[],L=this,sa=!0,Ja="",D=0,ba=0,M=0;L.print=function(k,I){var U=sa,M=D;sa=!1;k=String(k);var L=A.getLine(D);k=k.replace(/\n/g,"\r")+"\n";if(L){A.setGutterMarker(D,"note-gutter",document.createTextNode(""));var P=A.getCursor().ch}A.replaceRange(k,{line:D++,ch:0},{line:D,ch:0});I&&A.markText({line:M,ch:0},{line:M,ch:k.length},I);L&&(A.replaceRange(L,H(D),Aa(D)),A.setGutterMarker(D,"note-gutter",document.createTextNode(">>>")),A.setCursor({line:D,ch:P}));A.scrollIntoView(H(D));setTimeout(function(){sa=
+U},0)};L.setMode=function(k){A.setOption("mode",k)};L.setTheme=function(k){A.setOption("theme",k)};L.setHeight=function(k){A.setSize("100%",k)};A.setGutterMarker(D,"note-gutter",document.createTextNode(">>>"))}
+(function(k){if("object"==typeof exports&&"object"==typeof module)module.exports=k();else{if("function"==typeof define&&define.amd)return define([],k);this.CodeMirror=k()}})(function(){function k(a,b){if(!(this instanceof k))return new k(a,b);this.options=b=b||{};for(var c in vd)b.hasOwnProperty(c)||(b[c]=vd[c]);L(b);var d=b.value;"string"==typeof d&&(d=new W(d,b.mode));this.doc=d;var e=this.display=new P(a,d);e.wrapper.CodeMirror=this;A(this);ob(this);b.lineWrapping&&(this.display.wrapper.className+=
+" CodeMirror-wrap");b.autofocus&&!Gc&&Y(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new Hc};da&&setTimeout(ia(ja,this,!0),20);Pe(this);var f=this;va(this,function(){f.curOp.forceUpdate=!0;wd(f,d);b.autofocus&&!Gc||Ca()==e.input?setTimeout(ia(Ic,f),20):Jc(f);for(var a in ab)if(ab.hasOwnProperty(a))ab[a](f,b[a],xd);for(a=0;a<Kc.length;++a)Kc[a](f)})}function P(a,b){var c=this.input=t("textarea",
+null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none");Z?c.style.width="1000px":c.setAttribute("wrap","off");pb&&(c.style.border="1px solid black");c.setAttribute("autocorrect","off");c.setAttribute("autocapitalize","off");c.setAttribute("spellcheck","false");this.inputDiv=t("div",[c],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");this.scrollbarH=t("div",[t("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");this.scrollbarV=
+t("div",[t("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar");this.scrollbarFiller=t("div",null,"CodeMirror-scrollbar-filler");this.gutterFiller=t("div",null,"CodeMirror-gutter-filler");this.lineDiv=t("div",null,"CodeMirror-code");this.selectionDiv=t("div",null,null,"position: relative; z-index: 1");this.cursorDiv=t("div",null,"CodeMirror-cursors");this.measure=t("div",null,"CodeMirror-measure");this.lineMeasure=t("div",null,"CodeMirror-measure");this.lineSpace=t("div",[this.measure,this.lineMeasure,
+this.selectionDiv,this.cursorDiv,this.lineDiv],null,"position: relative; outline: none");this.mover=t("div",[t("div",[this.lineSpace],"CodeMirror-lines")],null,"position: relative");this.sizer=t("div",[this.mover],"CodeMirror-sizer");this.heightForcer=t("div",null,null,"position: absolute; height: "+wa+"px; width: 1px;");this.gutters=t("div",null,"CodeMirror-gutters");this.lineGutter=null;this.scroller=t("div",[this.sizer,this.heightForcer,this.gutters],"CodeMirror-scroll");this.scroller.setAttribute("tabIndex",
+"-1");this.wrapper=t("div",[this.inputDiv,this.scrollbarH,this.scrollbarV,this.scrollbarFiller,this.gutterFiller,this.scroller],"CodeMirror");qb&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=0);pb&&(c.style.width="0px");Z||(this.scroller.draggable=!0);Lc&&(this.inputDiv.style.height="1px",this.inputDiv.style.position="absolute");qb&&(this.scrollbarH.style.minHeight=this.scrollbarV.style.minWidth="18px");a.appendChild?a.appendChild(this.wrapper):a(this.wrapper);this.viewFrom=this.viewTo=
+b.first;this.view=[];this.externalMeasured=null;this.lastSizeC=this.viewOffset=0;this.lineNumWidth=this.lineNumInnerWidth=this.lineNumChars=this.updateLineNumbers=null;this.prevInput="";this.pollingFast=this.alignWidgets=!1;this.poll=new Hc;this.cachedCharWidth=this.cachedTextHeight=this.cachedPaddingH=null;this.inaccurateSelection=!1;this.maxLine=null;this.maxLineLength=0;this.maxLineChanged=!1;this.wheelDX=this.wheelDY=this.wheelStartX=this.wheelStartY=null;this.shift=!1}function Aa(a){a.doc.mode=
+k.getMode(a.options,a.doc.modeOption);H(a)}function H(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null)});a.doc.frontier=a.doc.first;rb(a,100);a.state.modeGen++;a.curOp&&ca(a)}function Za(a){var b=Ka(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/sb(a.display)-3);return function(e){if(La(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;g<e.widgets.length;g++)e.widgets[g].height&&(f+=e.widgets[g].height);return c?f+(Math.ceil(e.text.length/
+d)||1)*b:f+b}}function $a(a){var b=a.doc,c=Za(a);b.iter(function(a){var b=c(a);b!=a.height&&ka(a,b)})}function nb(a){var b=xa[a.options.keyMap].style;a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(b?" cm-keymap-"+b:"")}function ob(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");tb(a)}function Ba(a){A(a);ca(a);setTimeout(function(){ba(a)},20)}function A(a){var b=a.display.gutters,
+c=a.options.gutters;Ma(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(t("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none";b=b.offsetWidth;a.display.sizer.style.marginLeft=b+"px";d&&(a.display.scrollbarH.style.left=a.options.fixedGutter?b+"px":0)}function V(a){if(0==a.height)return 0;for(var b=a.text.length,c,d=a;c=Na(d,!0);)c=c.find(0,!0),d=c.from.line,b+=c.from.ch-c.to.ch;
+for(d=a;c=Na(d,!1);)c=c.find(0,!0),b-=d.text.length-c.from.ch,d=c.to.line,b+=d.text.length-c.to.ch;return b}function ta(a){var b=a.display;a=a.doc;b.maxLine=w(a,a.first);b.maxLineLength=V(b.maxLine);b.maxLineChanged=!0;a.iter(function(a){var c=V(a);c>b.maxLineLength&&(b.maxLineLength=c,b.maxLine=a)})}function L(a){var b=S(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):-1<b&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,
+1))}function sa(a){var b=a.display.scroller;return{clientHeight:b.clientHeight,barHeight:a.display.scrollbarV.clientHeight,scrollWidth:b.scrollWidth,clientWidth:b.clientWidth,barWidth:a.display.scrollbarH.clientWidth,docHeight:Math.round(a.doc.height+yd(a.display))}}function Ja(a,b){b||(b=sa(a));var c=a.display,d=b.docHeight+wa,e=b.scrollWidth>b.clientWidth,f=d>b.clientHeight;f?(c.scrollbarV.style.display="block",c.scrollbarV.style.bottom=e?ub(c.measure)+"px":"0",c.scrollbarV.firstChild.style.height=
+Math.max(0,d-b.clientHeight+(b.barHeight||c.scrollbarV.clientHeight))+"px"):(c.scrollbarV.style.display="",c.scrollbarV.firstChild.style.height="0");e?(c.scrollbarH.style.display="block",c.scrollbarH.style.right=f?ub(c.measure)+"px":"0",c.scrollbarH.firstChild.style.width=b.scrollWidth-b.clientWidth+(b.barWidth||c.scrollbarH.clientWidth)+"px"):(c.scrollbarH.style.display="",c.scrollbarH.firstChild.style.width="0");e&&f?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=c.scrollbarFiller.style.width=
+ub(c.measure)+"px"):c.scrollbarFiller.style.display="";e&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=ub(c.measure)+"px",c.gutterFiller.style.width=c.gutters.offsetWidth+"px"):c.gutterFiller.style.display="";Qe&&0===ub(c.measure)&&(c.scrollbarV.style.minWidth=c.scrollbarH.style.minHeight=Re?"18px":"12px",d=function(b){(b.target||b.srcElement)!=c.scrollbarV&&(b.target||b.srcElement)!=c.scrollbarH&&N(a,zd)(b)},y(c.scrollbarV,
+"mousedown",d),y(c.scrollbarH,"mousedown",d))}function D(a,b,c){var d=c&&null!=c.top?c.top:a.scroller.scrollTop;d=Math.floor(d-a.lineSpace.offsetTop);var e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight;d=Oa(b,d);e=Oa(b,e);if(c&&c.ensure){var f=c.ensure.from.line;c=c.ensure.to.line;if(f<d)return{from:f,to:Oa(b,la(w(b,f))+a.wrapper.clientHeight)};if(Math.min(c,b.lastLine())>=e)return{from:Oa(b,la(w(b,c))-a.wrapper.clientHeight),to:c}}return{from:d,to:e}}function ba(a){var b=a.display,c=b.view;
+if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=U(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",g=0;g<c.length;g++)if(!c[g].hidden){a.options.fixedGutter&&c[g].gutter&&(c[g].gutter.style.left=f);var h=c[g].alignable;if(h)for(var l=0;l<h.length;l++)h[l].style.left=f}a.options.fixedGutter&&(b.gutters.style.left=d+e+"px")}}function M(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function U(a){return a.scroller.getBoundingClientRect().left-
+a.sizer.getBoundingClientRect().left}function I(a,b,c){for(var d=a.display.viewFrom,e=a.display.viewTo,f,g=D(a.display,a.doc,b),h=!0;;h=!1){var l=a.display.scroller.clientWidth;var m=a;var n=g,v=c;c=m.display;var p=m.doc;if(c.wrapper.offsetWidth)if(!v&&n.from>=c.viewFrom&&n.to<=c.viewTo&&0==Ad(m))m=void 0;else{var k=m;if(k.options.lineNumbers){var r=k.doc,u=M(k.options,r.first+r.size-1);r=k.display;if(u.length!=r.lineNumChars){var q=r.measure.appendChild(t("div",[t("div",u)],"CodeMirror-linenumber CodeMirror-gutter-elt")),
+z=q.firstChild.offsetWidth;q=q.offsetWidth-z;r.lineGutter.style.width="";r.lineNumInnerWidth=Math.max(z,r.lineGutter.offsetWidth-q);r.lineNumWidth=r.lineNumInnerWidth+q;r.lineNumChars=r.lineNumInnerWidth?u.length:-1;r.lineGutter.style.width=r.lineNumWidth+"px";u=r.gutters.offsetWidth;r.scrollbarH.style.left=k.options.fixedGutter?u+"px":0;r.sizer.style.marginLeft=u+"px";k=!0}else k=!1}else k=!1;k&&Da(m);k=mb(m);z=p.first+p.size;r=Math.max(n.from-m.options.viewportMargin,p.first);u=Math.min(z,n.to+
+m.options.viewportMargin);c.viewFrom<r&&20>r-c.viewFrom&&(r=Math.max(p.first,c.viewFrom));c.viewTo>u&&20>c.viewTo-u&&(u=Math.min(z,c.viewTo));Ea&&(r=Mc(m.doc,r),u=Bd(m.doc,u));n=r!=c.viewFrom||u!=c.viewTo||c.lastSizeC!=c.wrapper.clientHeight;p=m;z=p.display;0==z.view.length||r>=z.viewTo||u<=z.viewFrom?(z.view=Sb(p,r,u),z.viewFrom=r):(z.viewFrom>r?z.view=Sb(p,r,z.viewFrom).concat(z.view):z.viewFrom<r&&(z.view=z.view.slice(vb(p,r))),z.viewFrom=r,z.viewTo<u?z.view=z.view.concat(Sb(p,z.viewTo,u)):z.viewTo>
+u&&(z.view=z.view.slice(0,vb(p,u))));z.viewTo=u;c.viewOffset=la(w(m.doc,c.viewFrom));m.display.mover.style.top=c.viewOffset+"px";p=Ad(m);if(n||0!=p||v){v=Ca();4<p&&(c.lineDiv.style.display="none");Oe(m,c.updateLineNumbers,k);4<p&&(c.lineDiv.style.display="");v&&Ca()!=v&&v.offsetHeight&&v.focus();Ma(c.cursorDiv);Ma(c.selectionDiv);n&&(c.lastSizeC=c.wrapper.clientHeight,rb(m,400));m=m.display;c=m.lineDiv.offsetTop;for(v=0;v<m.view.length;v++)if(n=m.view[v],!n.hidden&&(qb?(k=n.node.offsetTop+n.node.offsetHeight,
+p=k-c,c=k):(p=n.node.getBoundingClientRect(),p=p.bottom-p.top),k=n.line.height-p,2>p&&(p=Ka(m)),.001<k||-.001>k))if(ka(n.line,p),ua(n.line),n.rest)for(p=0;p<n.rest.length;p++)ua(n.rest[p]);m=!0}else m=void 0}else Da(m),m=void 0;if(!m)break;f=!0;a.display.maxLineChanged&&!a.options.lineWrapping&&(m=a,c=m.display,v=c.maxLine.text.length,v=Nc(m,Tb(m,c.maxLine),v,void 0).left,c.maxLineChanged=!1,v=Math.max(0,v+3),n=Math.max(0,c.sizer.offsetLeft+v+wa-c.scroller.clientWidth),c.sizer.style.minWidth=v+"px",
+n<m.doc.scrollLeft&&bb(m,Math.min(c.scroller.scrollLeft,n),!0));m=sa(a);Oc(a);c=a;v=m;c.display.sizer.style.minHeight=c.display.heightForcer.style.top=v.docHeight+"px";c.display.gutters.style.height=Math.max(v.docHeight,v.clientHeight-wa)+"px";Ja(a,m);if(h&&a.options.lineWrapping&&l!=a.display.scroller.clientWidth)c=!0;else if(c=!1,b&&null!=b.top&&(b={top:Math.min(m.docHeight-wa-m.clientHeight,b.top)}),g=D(a.display,a.doc,b),g.from>=a.display.viewFrom&&g.to<=a.display.viewTo)break}a.display.updateLineNumbers=
+null;f&&(O(a,"update",a),a.display.viewFrom==d&&a.display.viewTo==e||O(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo));return f}function ua(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.offsetHeight}function mb(a){for(var b=a.display,c={},d={},e=b.gutters.firstChild,f=0;e;e=e.nextSibling,++f)c[a.options.gutters[f]]=e.offsetLeft,d[a.options.gutters[f]]=e.offsetWidth;return{fixedPos:U(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,
+wrapperWidth:b.wrapper.clientWidth}}function Oe(a,b,c){function d(b){var c=b.nextSibling;Z&&Pa&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b);return c}var e=a.display,f=a.options.lineNumbers,g=e.lineDiv,h=g.firstChild,l=e.view;e=e.viewFrom;for(var m=0;m<l.length;m++){var n=l[m];if(!n.hidden)if(n.node){for(;h!=n.node;)h=d(h);h=f&&null!=b&&b<=e&&n.lineNumber;n.changes&&(-1<S(n.changes,"gutter")&&(h=!1),td(a,n,e,c));h&&(Ma(n.lineNumber),n.lineNumber.appendChild(document.createTextNode(M(a.options,
+e))));h=n.node.nextSibling}else{var v=Se(a,n,e,c);g.insertBefore(v,h)}e+=n.size}for(;h;)h=d(h)}function td(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f=b.changes[e];if("text"==f){f=b;var g=f.text.className,h=ud(a,f);f.text==f.node&&(f.node=h.pre);f.text.parentNode.replaceChild(h.pre,f.text);f.text=h.pre;h.bgClass!=f.bgClass||h.textClass!=f.textClass?(f.bgClass=h.bgClass,f.textClass=h.textClass,Fc(f)):g&&(f.text.className=g)}else if("gutter"==f)Cd(a,b,c,d);else if("class"==f)Fc(b);else if("widget"==
+f){g=b;h=d;g.alignable&&(g.alignable=null);for(var l=g.node.firstChild;l;l=f)f=l.nextSibling,"CodeMirror-linewidget"==l.className&&g.node.removeChild(l);Dd(g,h)}}b.changes=null}function Qb(a){a.node==a.text&&(a.node=t("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),qb&&(a.node.style.zIndex=2));return a.node}function ud(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=
+c.measure,c.built):Ed(a,b)}function Fc(a){var b=a.bgClass?a.bgClass+" "+(a.line.bgClass||""):a.line.bgClass;b&&(b+=" CodeMirror-linebackground");if(a.background)b?a.background.className=b:(a.background.parentNode.removeChild(a.background),a.background=null);else if(b){var c=Qb(a);a.background=c.insertBefore(t("div",null,b),c.firstChild)}a.line.wrapClass?Qb(a).className=a.line.wrapClass:a.node!=a.text&&(a.node.className="");a.text.className=(a.textClass?a.textClass+" "+(a.line.textClass||""):a.line.textClass)||
+""}function Cd(a,b,c,d){b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null);var e=b.line.gutterMarkers;if(a.options.lineNumbers||e){var f=Qb(b);f=b.gutter=f.insertBefore(t("div",null,"CodeMirror-gutter-wrapper","position: absolute; left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px"),b.text);!a.options.lineNumbers||e&&e["CodeMirror-linenumbers"]||(b.lineNumber=f.appendChild(t("div",M(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+
+"px; width: "+a.display.lineNumInnerWidth+"px")));if(e)for(b=0;b<a.options.gutters.length;++b){c=a.options.gutters[b];var g=e.hasOwnProperty(c)&&e[c];g&&f.appendChild(t("div",[g],"CodeMirror-gutter-elt","left: "+d.gutterLeft[c]+"px; width: "+d.gutterWidth[c]+"px"))}}}function Se(a,b,c,d){var e=ud(a,b);b.text=b.node=e.pre;e.bgClass&&(b.bgClass=e.bgClass);e.textClass&&(b.textClass=e.textClass);Fc(b);Cd(a,b,c,d);Dd(b,d);return b.node}function Dd(a,b){Fd(a.line,a,b,!0);if(a.rest)for(var c=0;c<a.rest.length;c++)Fd(a.rest[c],
+a,b,!1)}function Fd(a,b,c,d){if(a.widgets){var e=Qb(b),f=0;for(a=a.widgets;f<a.length;++f){var g=a[f],h=t("div",[g.node],"CodeMirror-linewidget");g.handleMouseEvents||(h.ignoreEvents=!0);var l=g,m=h,n=c;if(l.noHScroll){(b.alignable||(b.alignable=[])).push(m);var v=n.wrapperWidth;m.style.left=n.fixedPos+"px";l.coverGutter||(v-=n.gutterTotalWidth,m.style.paddingLeft=n.gutterTotalWidth+"px");m.style.width=v+"px"}l.coverGutter&&(m.style.zIndex=5,m.style.position="relative",l.noHScroll||(m.style.marginLeft=
+-n.gutterTotalWidth+"px"));d&&g.above?e.insertBefore(h,b.gutter||b.text):e.appendChild(h);O(g,"redraw")}}}function Pc(a){return q(a.line,a.ch)}function Qc(a,b){return 0>B(a,b)?b:a}function Rc(a,b){return 0>B(a,b)?a:b}function ya(a,b){this.ranges=a;this.primIndex=b}function F(a,b){this.anchor=a;this.head=b}function ma(a,b){var c=a[b];a.sort(function(a,b){return B(a.from(),b.from())});b=S(a,c);for(c=1;c<a.length;c++){var d=a[c],e=a[c-1];if(0<=B(e.to(),d.from())){var f=Rc(e.from(),d.from()),g=Qc(e.to(),
+d.to());d=e.empty()?d.from()==d.head:e.from()==e.head;c<=b&&--b;a.splice(--c,2,new F(d?g:f,d?f:g))}}return new ya(a,b)}function Fa(a,b){return new ya([new F(a,b||a)],0)}function x(a,b){if(b.line<a.first)return q(a.first,0);var c=a.first+a.size-1;if(b.line>c)return q(c,w(a,c).text.length);c=w(a,b.line).text.length;var d=b.ch;c=null==d||d>c?q(b.line,c):0>d?q(b.line,0):b;return c}function wb(a,b){return b>=a.first&&b<a.first+a.size}function xb(a,b,c,d){return a.cm&&a.cm.display.shift||a.extend?(a=b.anchor,
+d&&(b=0>B(c,a),b!=0>B(d,a)?(a=c,c=d):b!=0>B(c,d)&&(c=d)),new F(a,c)):new F(d||c,c)}function Ub(a,b,c,d){Q(a,new ya([xb(a,a.sel.primary(),b,c)],0),d)}function Gd(a,b,c){for(var d=[],e=0;e<a.sel.ranges.length;e++)d[e]=xb(a,a.sel.ranges[e],b[e],null);b=ma(d,a.sel.primIndex);Q(a,b,c)}function Hd(a,b,c,d){var e=a.sel.ranges.slice(0);e[b]=c;Q(a,ma(e,a.sel.primIndex),d)}function Te(a,b){var c={ranges:b.ranges,update:function(b){this.ranges=[];for(var c=0;c<b.length;c++)this.ranges[c]=new F(x(a,b[c].anchor),
+x(a,b[c].head))}};J(a,"beforeSelectionChange",a,c);a.cm&&J(a.cm,"beforeSelectionChange",a.cm,c);return c.ranges!=b.ranges?ma(c.ranges,c.ranges.length-1):b}function Id(a,b,c){var d=a.history.done,e=E(d);e&&e.ranges?(d[d.length-1]=b,Vb(a,b,c)):Q(a,b,c)}function Q(a,b,c){Vb(a,b,c);b=a.sel;var d=a.cm?a.cm.curOp.id:NaN,e=a.history,f=c&&c.origin,g;if(!(g=d==e.lastOp)&&(g=f&&e.lastSelOrigin==f)&&!(g=e.lastModTime==e.lastSelTime&&e.lastOrigin==f)){g=E(e.done);var h=f.charAt(0);g="*"==h||"+"==h&&g.ranges.length==
+b.ranges.length&&g.somethingSelected()==b.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}g?e.done[e.done.length-1]=b:Wb(b,e.done);e.lastSelTime=+new Date;e.lastSelOrigin=f;e.lastOp=d;c&&!1!==c.clearRedo&&Jd(e.undone)}function Vb(a,b,c){if(ea(a,"beforeSelectionChange")||a.cm&&ea(a.cm,"beforeSelectionChange"))b=Te(a,b);var d=0>B(b.primary().head,a.sel.primary().head)?-1:1;Kd(a,Ld(a,b,d,!0));c&&!1===c.scroll||!a.cm||Qa(a.cm)}function Kd(a,b){b.equals(a.sel)||
+(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=a.cm.curOp.cursorActivity=!0),O(a,"cursorActivity",a))}function Md(a){Kd(a,Ld(a,a.sel,null,!1),cb)}function Ld(a,b,c,d){for(var e,f=0;f<b.ranges.length;f++){var g=b.ranges[f],h=Xb(a,g.anchor,c,d),l=Xb(a,g.head,c,d);if(e||h!=g.anchor||l!=g.head)e||(e=b.ranges.slice(0,f)),e[f]=new F(h,l)}return e?ma(e,b.primIndex):b}function Xb(a,b,c,d){var e=!1,f=b,g=c||1;a.cantEdit=!1;a:for(;;){var h=w(a,f.line);if(h.markedSpans)for(var l=0;l<h.markedSpans.length;++l){var m=
+h.markedSpans[l],n=m.marker;if((null==m.from||(n.inclusiveLeft?m.from<=f.ch:m.from<f.ch))&&(null==m.to||(n.inclusiveRight?m.to>=f.ch:m.to>f.ch))){if(d&&(J(n,"beforeCursorEnter"),n.explicitlyCleared))if(h.markedSpans){--l;continue}else break;if(n.atomic){l=n.find(0>g?-1:1);if(0==B(l,f)&&(l.ch+=g,0>l.ch?l=l.line>a.first?x(a,q(l.line-1)):null:l.ch>h.text.length&&(l=l.line<a.first+a.size-1?q(l.line+1,0):null),!l)){if(e){if(!d)return Xb(a,b,c,!0);a.cantEdit=!0;return q(a.first,0)}e=!0;l=b;g=-g}f=l;continue a}}}return f}}
+function Oc(a){for(var b=a.display,c=a.doc,d=document.createDocumentFragment(),e=document.createDocumentFragment(),f=0;f<c.sel.ranges.length;f++){var g=c.sel.ranges[f],h=g.empty();if(h||a.options.showCursorWhenSelecting){var l=a,m=d,n=za(l,g.head,"div"),v=m.appendChild(t("div","\u00a0","CodeMirror-cursor"));v.style.left=n.left+"px";v.style.top=n.top+"px";v.style.height=Math.max(0,n.bottom-n.top)*l.options.cursorHeight+"px";n.other&&(l=m.appendChild(t("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor")),
+l.style.display="",l.style.left=n.other.left+"px",l.style.top=n.other.top+"px",l.style.height=.85*(n.other.bottom-n.other.top)+"px")}h||Ue(a,g,e)}a.options.moveInputWithCursor&&(a=za(a,c.sel.primary().head,"div"),c=b.wrapper.getBoundingClientRect(),f=b.lineDiv.getBoundingClientRect(),g=Math.max(0,Math.min(b.wrapper.clientWidth-10,a.left+f.left-c.left)),b.inputDiv.style.top=Math.max(0,Math.min(b.wrapper.clientHeight-10,a.top+f.top-c.top))+"px",b.inputDiv.style.left=g+"px");na(b.cursorDiv,d);na(b.selectionDiv,
+e)}function Ue(a,b,c){function d(a,b,c,d){0>b&&(b=0);h.appendChild(t("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?n-a:c)+"px; height: "+(d-b)+"px"))}function e(b,c,e){var f=w(g,b),h=f.text.length,l,v;Ve(oa(f),c||0,null==e?h:e,function(g,p,k){var r=Yb(a,q(b,g),"div",f,"left"),Rb;if(g==p){var u=r;k=Rb=r.left}else u=Yb(a,q(b,p-1),"div",f,"right"),"rtl"==k&&(k=r,r=u,u=k),k=r.left,Rb=u.right;null==c&&0==g&&(k=m);3<u.top-r.top&&(d(k,r.top,null,r.bottom),
+k=m,r.bottom<u.top&&d(k,r.bottom,null,u.top));null==e&&p==h&&(Rb=n);if(!l||r.top<l.top||r.top==l.top&&r.left<l.left)l=r;if(!v||u.bottom>v.bottom||u.bottom==v.bottom&&u.right>v.right)v=u;k<m+1&&(k=m);d(k,u.top,Rb-k,u.bottom)});return{start:l,end:v}}var f=a.display,g=a.doc,h=document.createDocumentFragment(),l=Nd(a.display),m=l.left,n=f.lineSpace.offsetWidth-l.right;f=b.from();b=b.to();if(f.line==b.line)e(f.line,f.ch,b.ch);else{var v=w(g,f.line);l=w(g,b.line);l=pa(v)==pa(l);f=e(f.line,f.ch,l?v.text.length+
+1:null).end;b=e(b.line,l?0:null,b.ch).start;l&&(f.top<b.top-2?(d(f.right,f.top,null,f.bottom),d(m,b.top,b.left,b.bottom)):d(f.right,f.top,b.left-f.right,f.bottom));f.bottom<b.top&&d(m,f.bottom,null,b.top)}c.appendChild(h)}function Zb(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursorDiv.style.visibility="";0<a.options.cursorBlinkRate&&(b.blinker=setInterval(function(){b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate))}}function rb(a,b){a.doc.mode.startState&&
+a.doc.frontier<a.display.viewTo&&a.state.highlight.set(b,ia(We,a))}function We(a){var b=a.doc;b.frontier<b.first&&(b.frontier=b.first);if(!(b.frontier>=a.display.viewTo)){var c=+new Date+a.options.workTime,d=yb(b.mode,zb(a,b.frontier));va(a,function(){b.iter(b.frontier,Math.min(b.first+b.size,a.display.viewTo+500),function(e){if(b.frontier>=a.display.viewFrom){var f=e.styles;e.styles=Od(a,e,d,!0);for(var g=!f||f.length!=e.styles.length,h=0;!g&&h<f.length;++h)g=f[h]!=e.styles[h];g&&Ra(a,b.frontier,
+"text");e.stateAfter=yb(b.mode,d)}else Sc(a,e.text,d),e.stateAfter=0==b.frontier%5?yb(b.mode,d):null;++b.frontier;if(+new Date>c)return rb(a,a.options.workDelay),!0})})}}function Xe(a,b,c){for(var d,e,f=a.doc,g=c?-1:b-(a.doc.mode.innerMode?1E3:100);b>g;--b){if(b<=f.first)return f.first;var h=w(f,b-1);if(h.stateAfter&&(!c||b<=f.frontier))return b;h=qa(h.text,null,a.options.tabSize);if(null==e||d>h)e=b-1,d=h}return e}function zb(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=Xe(a,
+b,c),g=f>d.first&&w(d,f-1).stateAfter;g=g?yb(d.mode,g):Ye(d.mode);d.iter(f,b,function(c){Sc(a,c.text,g);c.stateAfter=f==b-1||0==f%5||f>=e.viewFrom&&f<e.viewTo?yb(d.mode,g):null;++f});c&&(d.frontier=f);return g}function yd(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function Nd(a){if(a.cachedPaddingH)return a.cachedPaddingH;var b=na(a.measure,t("pre","x"));b=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle;return a.cachedPaddingH={left:parseInt(b.paddingLeft),right:parseInt(b.paddingRight)}}
+function Pd(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[vb(a,b)];var c=a.display.externalMeasured;if(c&&b>=c.lineN&&b<c.lineN+c.size)return c}function Tb(a,b){var c=G(b),d=Pd(a,c);d&&!d.text?d=null:d&&d.changes&&td(a,d,c,mb(a));if(!d){var e=pa(b);d=G(e);e=a.display.externalMeasured=new Qd(a.doc,e,d);e.lineN=d;d=e.built=Ed(a,e);e.text=d.pre;na(a.display.lineMeasure,d.pre);d=e}a:if(e=d,e.line==b)c={map:e.measure.map,cache:e.measure.cache};else{for(var f=0;f<e.rest.length;f++)if(e.rest[f]==
+b){c={map:e.measure.maps[f],cache:e.measure.caches[f]};break a}for(f=0;f<e.rest.length;f++)if(G(e.rest[f])>c){c={map:e.measure.maps[f],cache:e.measure.caches[f],before:!0};break a}c=void 0}return{line:b,view:d,rect:null,map:c.map,cache:c.cache,before:c.before,hasHeights:!1}}function Nc(a,b,c,d){b.before&&(c=-1);var e=c+(d||"");if(b.cache.hasOwnProperty(e))var f=b.cache[e];else{b.rect||(b.rect=b.view.text.getBoundingClientRect());if(!b.hasHeights){var g=b.view,h=b.rect,l=a.options.lineWrapping,m=l&&
+a.display.scroller.clientWidth;if(!g.measure.heights||l&&g.measure.width!=m){var n=g.measure.heights=[];if(l)for(g.measure.width=m,g=g.text.firstChild.getClientRects(),l=0;l<g.length-1;l++){m=g[l];var v=g[l+1];2<Math.abs(m.bottom-v.bottom)&&n.push((m.bottom+v.top)/2-h.top)}n.push(h.bottom-h.top)}b.hasHeights=!0}h=d;n=b.map;for(d=0;d<n.length;d+=3){var p=n[d],k=n[d+1];if(c<p){var r=0;var u=1;f="left"}else if(c<k)r=c-p,u=r+1;else if(d==n.length-3||c==k&&n[d+3]>c)u=k-p,r=u-1,c>=k&&(f="right");if(null!=
+r){var q=n[d+2];p==k&&h==(q.insertLeft?"left":"right")&&(f=h);if("left"==h&&0==r)for(;d&&n[d-2]==n[d-3]&&n[d-1].insertLeft;)q=n[(d-=3)+2],f="left";if("right"==h&&r==k-p)for(;d<n.length-3&&n[d+3]==n[d+4]&&!n[d+5].insertLeft;)q=n[(d+=3)+2],f="right";break}}if(3==q.nodeType){for(;r&&Ab(b.line.text.charAt(p+r));)--r;for(;p+u<k&&Ab(b.line.text.charAt(p+u));)++u;if(R&&0==r&&u==k-p)c=q.parentNode.getBoundingClientRect();else if(X&&a.options.lineWrapping){var z=$b(q,r,u).getClientRects();c=z.length?z["right"==
+h?z.length-1:0]:Rd}else c=$b(q,r,u).getBoundingClientRect()}else 0<r&&(f=h="right"),c=a.options.lineWrapping&&1<(z=q.getClientRects()).length?z["right"==h?z.length-1:0]:q.getBoundingClientRect();!R||r||c&&(c.left||c.right)||(c=(q=q.parentNode.getClientRects()[0])?{left:q.left,right:q.left+sb(a.display),top:q.top,bottom:q.bottom}:Rd);q=(c.bottom+c.top)/2-b.rect.top;r=b.view.measure.heights;for(d=0;d<r.length-1&&!(q<r[d]);d++);a=d?r[d-1]:0;q=r[d];f={left:("right"==f?c.right:c.left)-b.rect.left,right:("left"==
+f?c.left:c.right)-b.rect.left,top:a,bottom:q};c.left||c.right||(f.bogus=!0);f.bogus||(b.cache[e]=f)}return{left:f.left,right:f.right,top:f.top,bottom:f.bottom}}function Sd(a){if(a.measure&&(a.measure.cache={},a.measure.heights=null,a.rest))for(var b=0;b<a.rest.length;b++)a.measure.caches[b]={}}function Td(a){a.display.externalMeasure=null;Ma(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)Sd(a.display.view[b])}function tb(a){Td(a);a.display.cachedCharWidth=a.display.cachedTextHeight=
+a.display.cachedPaddingH=null;a.options.lineWrapping||(a.display.maxLineChanged=!0);a.display.lineNumChars=null}function Tc(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=Bb(b.widgets[e]);c.top+=f;c.bottom+=f}if("line"==d)return c;d||(d="local");b=la(b);b="local"==d?b+a.display.lineSpace.offsetTop:b-a.display.viewOffset;if("page"==d||"window"==d)a=a.display.lineSpace.getBoundingClientRect(),b+=a.top+("window"==d?0:window.pageYOffset||(document.documentElement||
+document.body).scrollTop),d=a.left+("window"==d?0:window.pageXOffset||(document.documentElement||document.body).scrollLeft),c.left+=d,c.right+=d;c.top+=b;c.bottom+=b;return c}function Ud(a,b,c){if("div"==c)return b;var d=b.left;b=b.top;"page"==c?(d-=window.pageXOffset||(document.documentElement||document.body).scrollLeft,b-=window.pageYOffset||(document.documentElement||document.body).scrollTop):"local"!=c&&c||(c=a.display.sizer.getBoundingClientRect(),d+=c.left,b+=c.top);a=a.display.lineSpace.getBoundingClientRect();
+return{left:d-a.left,top:b-a.top}}function Yb(a,b,c,d,e){d||(d=w(a.doc,b.line));var f=d;b=b.ch;d=Nc(a,Tb(a,d),b,e);return Tc(a,f,d,c)}function za(a,b,c,d,e){function f(b,f){var g=Nc(a,e,b,f?"right":"left");f?g.left=g.right:g.right=g.left;return Tc(a,d,g,c)}function g(a,b){var c=h[b],d=c.level%2;a==Uc(c)&&b&&c.level<h[b-1].level?(c=h[--b],a=Vc(c)-(c.level%2?0:1),d=!0):a==Vc(c)&&b<h.length-1&&c.level<h[b+1].level&&(c=h[++b],a=Uc(c)-c.level%2,d=!1);return d&&a==c.to&&a>c.from?f(a-1):f(a,d)}d=d||w(a.doc,
+b.line);e||(e=Tb(a,d));var h=oa(d);b=b.ch;if(!h)return f(b);var l=Wc(h,b);l=g(b,l);null!=Cb&&(l.other=g(b,Cb));return l}function Vd(a,b){var c=0;b=x(a.doc,b);a.options.lineWrapping||(c=sb(a.display)*b.ch);var d=w(a.doc,b.line),e=la(d)+a.display.lineSpace.offsetTop;return{left:c,right:c,top:e,bottom:e+d.height}}function ac(a,b,c,d){a=q(a,b);a.xRel=d;c&&(a.outside=!0);return a}function Xc(a,b,c){var d=a.doc;c+=a.display.viewOffset;if(0>c)return ac(d.first,0,!0,-1);var e=Oa(d,c),f=d.first+d.size-1;if(e>
+f)return ac(d.first+d.size-1,w(d,f).text.length,!0,1);0>b&&(b=0);for(d=w(d,e);;)if(e=Ze(a,d,e,b,c),f=(d=Na(d,!1))&&d.find(0,!0),d&&(e.ch>f.from.ch||e.ch==f.from.ch&&0<e.xRel))e=G(d=f.to.line);else return e}function Ze(a,b,c,d,e){function f(d){d=za(a,q(c,d),"line",b,m);h=!0;if(g>d.bottom)return d.left-l;if(g<d.top)return d.left+l;h=!1;return d.left}var g=e-la(b),h=!1,l=2*a.display.wrapper.clientWidth,m=Tb(a,b),n=oa(b),v=b.text.length;e=bc(b);var p=cc(b),k=f(e),r=h,u=f(p),t=h;if(d>u)return ac(c,p,t,
+1);for(;;){if(n?p==e||p==Yc(b,e,1):1>=p-e){n=d<k||d-k<=u-d?e:p;for(d-=n==e?k:u;Ab(b.text.charAt(n));)++n;return ac(c,n,n==e?r:t,-1>d?-1:1<d?1:0)}var z=Math.ceil(v/2),w=e+z;if(n){w=e;for(var x=0;x<z;++x)w=Yc(b,w,1)}x=f(w);if(x>d){p=w;u=x;if(t=h)u+=1E3;v=z}else e=w,k=x,r=h,v-=z}}function Ka(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==Sa){Sa=t("pre");for(var b=0;49>b;++b)Sa.appendChild(document.createTextNode("x")),Sa.appendChild(t("br"));Sa.appendChild(document.createTextNode("x"))}na(a.measure,
+Sa);b=Sa.offsetHeight/50;3<b&&(a.cachedTextHeight=b);Ma(a.measure);return b||1}function sb(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=t("span","xxxxxxxxxx"),c=t("pre",[b]);na(a.measure,c);b=b.getBoundingClientRect();b=(b.right-b.left)/10;2<b&&(a.cachedCharWidth=b);return b||10}function db(a){a.curOp={viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivity:!1,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,
+scrollToPos:null,id:++$e};dc++||(Ga=[])}function eb(a){var b=a.curOp,c=a.doc,d=a.display;a.curOp=null;b.updateMaxLine&&ta(a);if(b.viewChanged||b.forceUpdate||null!=b.scrollTop||b.scrollToPos&&(b.scrollToPos.from.line<d.viewFrom||b.scrollToPos.to.line>=d.viewTo)||d.maxLineChanged&&a.options.lineWrapping){var e=I(a,{top:b.scrollTop,ensure:b.scrollToPos},b.forceUpdate);a.display.scroller.offsetHeight&&(a.doc.scrollTop=a.display.scroller.scrollTop)}!e&&b.selectionChanged&&Oc(a);e||b.startHeight==a.doc.height||
+Ja(a);null!=b.scrollTop&&d.scroller.scrollTop!=b.scrollTop&&(d.scroller.scrollTop=d.scrollbarV.scrollTop=c.scrollTop=Math.max(0,Math.min(d.scroller.scrollHeight-d.scroller.clientHeight,b.scrollTop)));null!=b.scrollLeft&&d.scroller.scrollLeft!=b.scrollLeft&&(d.scroller.scrollLeft=d.scrollbarH.scrollLeft=c.scrollLeft=Math.max(0,Math.min(d.scroller.scrollWidth-d.scroller.clientWidth,b.scrollLeft)),ba(a));if(b.scrollToPos){a:for(c=x(a.doc,b.scrollToPos.from),d=x(a.doc,b.scrollToPos.to),e=b.scrollToPos.margin,
+null==e&&(e=0);;){var f=!1,g=za(a,c),h=d&&d!=c?za(a,d):g;h=ec(a,Math.min(g.left,h.left),Math.min(g.top,h.top)-e,Math.max(g.left,h.left),Math.max(g.bottom,h.bottom)+e);var l=a.doc.scrollTop,m=a.doc.scrollLeft;null!=h.scrollTop&&(Db(a,h.scrollTop),1<Math.abs(a.doc.scrollTop-l)&&(f=!0));null!=h.scrollLeft&&(bb(a,h.scrollLeft),1<Math.abs(a.doc.scrollLeft-m)&&(f=!0));if(!f){c=g;break a}}b.scrollToPos.isCursor&&a.state.focused&&(d=c,e=a.display,f=e.sizer.getBoundingClientRect(),c=null,0>d.top+f.top?c=!0:
+d.bottom+f.top>(window.innerHeight||document.documentElement.clientHeight)&&(c=!1),null==c||af||(d=t("div","\u200b",null,"position: absolute; top: "+(d.top-e.viewOffset-a.display.lineSpace.offsetTop)+"px; height: "+(d.bottom-d.top+wa)+"px; left: "+d.left+"px; width: 2px;"),a.display.lineSpace.appendChild(d),d.scrollIntoView(c),a.display.lineSpace.removeChild(d)))}b.selectionChanged&&Zb(a);a.state.focused&&b.updateInput&&ja(a,b.typing);c=b.maybeHiddenMarkers;d=b.maybeUnhiddenMarkers;if(c)for(e=0;e<
+c.length;++e)c[e].lines.length||J(c[e],"hide");if(d)for(e=0;e<d.length;++e)d[e].lines.length&&J(d[e],"unhide");if(!--dc){var n=Ga;Ga=null}if(b.changeObjs){for(e=0;e<b.changeObjs.length;e++)J(a,"change",a,b.changeObjs[e]);J(a,"changes",a,b.changeObjs)}b.cursorActivity&&J(a,"cursorActivity",a);if(n)for(e=0;e<n.length;++e)n[e]()}function va(a,b){if(a.curOp)return b();db(a);try{return b()}finally{eb(a)}}function N(a,b){return function(){if(a.curOp)return b.apply(a,arguments);db(a);try{return b.apply(a,
+arguments)}finally{eb(a)}}}function K(a){return function(){if(this.curOp)return a.apply(this,arguments);db(this);try{return a.apply(this,arguments)}finally{eb(this)}}}function aa(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);db(b);try{return a.apply(this,arguments)}finally{eb(b)}}}function Qd(a,b,c){for(var d=this.line=b,e;d=Na(d,!1);)d=d.find(1,!0).line,(e||(e=[])).push(d);this.size=(this.rest=e)?G(E(this.rest))-c+1:1;this.node=this.text=null;this.hidden=La(a,b)}
+function Sb(a,b,c){var d=[],e;for(e=b;e<c;)b=new Qd(a.doc,w(a.doc,e),e),e+=b.size,d.push(b);return d}function ca(a,b,c,d){null==b&&(b=a.doc.first);null==c&&(c=a.doc.first+a.doc.size);d||(d=0);var e=a.display;d&&c<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>b)&&(e.updateLineNumbers=b);a.curOp.viewChanged=!0;if(b>=e.viewTo)Ea&&Mc(a.doc,b)<e.viewTo&&Da(a);else if(c<=e.viewFrom)Ea&&Bd(a.doc,c+d)>e.viewFrom?Da(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)Da(a);else if(b<=
+e.viewFrom){var f=fc(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):Da(a)}else if(c>=e.viewTo)(f=fc(a,b,b,-1))?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):Da(a);else{f=fc(a,b,b,-1);var g=fc(a,c,c+d,1);f&&g?(e.view=e.view.slice(0,f.index).concat(Sb(a,f.lineN,g.lineN)).concat(e.view.slice(g.index)),e.viewTo+=d):Da(a)}if(a=e.externalMeasured)c<a.lineN?a.lineN+=d:b<a.lineN+a.size&&(e.externalMeasured=null)}function Ra(a,b,c){a.curOp.viewChanged=!0;var d=a.display,e=a.display.externalMeasured;
+e&&b>=e.lineN&&b<e.lineN+e.size&&(d.externalMeasured=null);b<d.viewFrom||b>=d.viewTo||(a=d.view[vb(a,b)],null!=a.node&&(a=a.changes||(a.changes=[]),-1==S(a,c)&&a.push(c)))}function Da(a){a.display.viewFrom=a.display.viewTo=a.doc.first;a.display.view=[];a.display.viewOffset=0}function vb(a,b){if(b>=a.display.viewTo)return null;b-=a.display.viewFrom;if(0>b)return null;for(var c=a.display.view,d=0;d<c.length;d++)if(b-=c[d].size,0>b)return d}function fc(a,b,c,d){var e=vb(a,b),f=a.display.view;if(!Ea)return{index:e,
+lineN:c};for(var g=0,h=a.display.viewFrom;g<e;g++)h+=f[g].size;if(h!=b){if(0<d){if(e==f.length-1)return null;b=h+f[e].size-b;e++}else b=h-b;c+=b}for(;Mc(a.doc,c)!=c;){if(e==(0>d?0:f.length-1))return null;c+=d*f[e-(0>d?1:0)].size;e+=d}return{index:e,lineN:c}}function Ad(a){a=a.display.view;for(var b=0,c=0;c<a.length;c++){var d=a[c];d.hidden||d.node&&!d.changes||++b}return b}function gc(a){a.display.pollingFast||a.display.poll.set(a.options.pollInterval,function(){Zc(a);a.state.focused&&gc(a)})}function Eb(a){function b(){Zc(a)||
+c?(a.display.pollingFast=!1,gc(a)):(c=!0,a.display.poll.set(60,b))}var c=!1;a.display.pollingFast=!0;a.display.poll.set(20,b)}function Zc(a){var b=a.display.input,c=a.display.prevInput,d=a.doc;if(!a.state.focused||bf(b)||hc(a)||a.options.disableInput)return!1;var e=b.value;if(e==c&&!a.somethingSelected())return!1;if(X&&!R&&a.display.inputHasSelection===e)return ja(a),!1;var f=!a.curOp;f&&db(a);a.display.shift=!1;for(var g=0,h=Math.min(c.length,e.length);g<h&&c.charCodeAt(g)==e.charCodeAt(g);)++g;
+h=e.slice(g);for(var l=fb(h),m=a.state.pasteIncoming&&1<l.length&&d.sel.ranges.length==l.length,n=d.sel.ranges.length-1;0<=n;n--){var v=d.sel.ranges[n],p=v.from(),k=v.to();g<c.length?p=q(p.line,p.ch-(c.length-g)):a.state.overwrite&&v.empty()&&!a.state.pasteIncoming&&(k=q(k.line,Math.min(w(d,k.line).text.length,k.ch+E(l).length)));var r=a.curOp.updateInput;p={from:p,to:k,text:m?[l[n]]:l,origin:a.state.pasteIncoming?"paste":a.state.cutIncoming?"cut":"+input"};gb(a.doc,p);O(a,"inputRead",a,p);if(h&&
+!a.state.pasteIncoming&&a.options.electricChars&&a.options.smartIndent&&100>v.head.ch&&(!n||d.sel.ranges[n-1].head.line!=v.head.line)&&(p=a.getModeAt(v.head).electricChars))for(k=0;k<p.length;k++)if(-1<h.indexOf(p.charAt(k))){ic(a,v.head.line,"smart");break}}Qa(a);a.curOp.updateInput=r;a.curOp.typing=!0;1E3<e.length||-1<e.indexOf("\n")?b.value=a.display.prevInput="":a.display.prevInput=e;f&&eb(a);a.state.pasteIncoming=a.state.cutIncoming=!1;return!0}function ja(a,b){var c=a.doc;if(a.somethingSelected()){a.display.prevInput=
+"";var d=c.sel.primary();var e=(d=Wd&&(100<d.to().line-d.from().line||1E3<(e=a.getSelection()).length))?"-":e||a.getSelection();a.display.input.value=e;a.state.focused&&jc(a.display.input);X&&!R&&(a.display.inputHasSelection=e)}else b||(a.display.prevInput=a.display.input.value="",X&&!R&&(a.display.inputHasSelection=null));a.display.inaccurateSelection=d}function Y(a){"nocursor"==a.options.readOnly||Gc&&Ca()==a.display.input||a.display.input.focus()}function $c(a){a.state.focused||(Y(a),Ic(a))}function hc(a){return a.options.readOnly||
+a.doc.cantEdit}function Pe(a){function b(){a.state.focused&&setTimeout(ia(Y,a),0)}function c(){null==h&&(h=setTimeout(function(){h=null;g.cachedCharWidth=g.cachedTextHeight=g.cachedPaddingH=Fb=null;a.setSize()},100))}function d(){Xd(document.body,g.wrapper)?setTimeout(d,5E3):Ha(window,"resize",c)}function e(b){ra(a,b)||ad(b)}function f(b){g.inaccurateSelection&&(g.prevInput="",g.inaccurateSelection=!1,g.input.value=a.getSelection(),jc(g.input));"cut"==b.type&&(a.state.cutIncoming=!0)}var g=a.display;
+y(g.scroller,"mousedown",N(a,zd));da?y(g.scroller,"dblclick",N(a,function(b){if(!ra(a,b)){var c=hb(a,b);!c||bd(a,b,"gutterClick",!0,O)||Ta(a.display,b)||(T(b),b=cd(a.doc,c),Ub(a.doc,b.anchor,b.head))}})):y(g.scroller,"dblclick",function(b){ra(a,b)||T(b)});y(g.lineSpace,"selectstart",function(a){Ta(g,a)||T(a)});dd||y(g.scroller,"contextmenu",function(b){Yd(a,b)});y(g.scroller,"scroll",function(){g.scroller.clientHeight&&(Db(a,g.scroller.scrollTop),bb(a,g.scroller.scrollLeft,!0),J(a,"scroll",a))});
+y(g.scrollbarV,"scroll",function(){g.scroller.clientHeight&&Db(a,g.scrollbarV.scrollTop)});y(g.scrollbarH,"scroll",function(){g.scroller.clientHeight&&bb(a,g.scrollbarH.scrollLeft)});y(g.scroller,"mousewheel",function(b){Zd(a,b)});y(g.scroller,"DOMMouseScroll",function(b){Zd(a,b)});y(g.scrollbarH,"mousedown",b);y(g.scrollbarV,"mousedown",b);y(g.wrapper,"scroll",function(){g.wrapper.scrollTop=g.wrapper.scrollLeft=0});var h;y(window,"resize",c);setTimeout(d,5E3);y(g.input,"keyup",N(a,$d));y(g.input,
+"input",function(){X&&!R&&a.display.inputHasSelection&&(a.display.inputHasSelection=null);Eb(a)});y(g.input,"keydown",N(a,ae));y(g.input,"keypress",N(a,be));y(g.input,"focus",ia(Ic,a));y(g.input,"blur",ia(Jc,a));a.options.dragDrop&&(y(g.scroller,"dragstart",function(b){if(da&&(!a.state.draggingText||100>+new Date-ce))ad(b);else if(!ra(a,b)&&!Ta(a.display,b)&&(b.dataTransfer.setData("Text",a.getSelection()),b.dataTransfer.setDragImage&&!de)){var c=t("img",null,null,"position: fixed; left: 0; top: 0;");
+c.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";fa&&(c.width=c.height=1,a.display.wrapper.appendChild(c),c._top=c.offsetTop);b.dataTransfer.setDragImage(c,0,0);fa&&c.parentNode.removeChild(c)}}),y(g.scroller,"dragenter",e),y(g.scroller,"dragover",e),y(g.scroller,"drop",N(a,cf)));y(g.scroller,"paste",function(b){Ta(g,b)||(a.state.pasteIncoming=!0,Y(a),Eb(a))});y(g.input,"paste",function(){a.state.pasteIncoming=!0;Eb(a)});y(g.input,"cut",f);y(g.input,"copy",f);Lc&&
+y(g.sizer,"mouseup",function(){Ca()==g.input&&g.input.blur();Y(a)})}function Ta(a,b){for(var c=b.target||b.srcElement;c!=a.wrapper;c=c.parentNode)if(!c||c.ignoreEvents||c.parentNode==a.sizer&&c!=a.mover)return!0}function hb(a,b,c,d){var e=a.display;if(!c&&(c=b.target||b.srcElement,c==e.scrollbarH||c==e.scrollbarV||c==e.scrollbarFiller||c==e.gutterFiller))return null;e=e.lineSpace.getBoundingClientRect();try{var f=b.clientX-e.left;var g=b.clientY-e.top}catch(l){return null}b=Xc(a,f,g);var h;d&&1==
+b.xRel&&(h=w(a.doc,b.line).text).length==b.ch&&(d=qa(h,h.length,a.options.tabSize)-h.length,b=q(b.line,Math.round((f-Nd(a.display).left)/sb(a.display))-d));return b}function zd(a){if(!ra(this,a)){var b=this.display;b.shift=a.shiftKey;if(Ta(b,a))Z||(b.scroller.draggable=!1,setTimeout(function(){b.scroller.draggable=!0},100));else if(!bd(this,a,"gutterClick",!0,O)){var c=hb(this,a);window.focus();switch(ee(a)){case 1:c?df(this,a,c):(a.target||a.srcElement)==b.scroller&&T(a);break;case 2:Z&&(this.state.lastMiddleDown=
++new Date);c&&Ub(this.doc,c);setTimeout(ia(Y,this),20);T(a);break;case 3:dd&&Yd(this,a)}}}}function df(a,b,c){setTimeout(ia($c,a),0);var d=+new Date;if(kc&&kc.time>d-400&&0==B(kc.pos,c))var e="triple";else lc&&lc.time>d-400&&0==B(lc.pos,c)?(e="double",kc={time:d,pos:c}):(e="single",lc={time:d,pos:c});d=a.doc.sel;var f=Pa?b.metaKey:b.ctrlKey;a.options.dragDrop&&ef&&!f&&!hc(a)&&"single"==e&&-1<d.contains(c)&&d.somethingSelected()?ff(a,b,c):gf(a,b,c,e,f)}function ff(a,b,c){var d=a.display,e=N(a,function(f){Z&&
+(d.scroller.draggable=!1);a.state.draggingText=!1;Ha(document,"mouseup",e);Ha(d.scroller,"drop",e);10>Math.abs(b.clientX-f.clientX)+Math.abs(b.clientY-f.clientY)&&(T(f),Ub(a.doc,c),Y(a),da&&!R&&setTimeout(function(){document.body.focus();Y(a)},20))});Z&&(d.scroller.draggable=!0);a.state.draggingText=e;d.scroller.dragDrop&&d.scroller.dragDrop();y(document,"mouseup",e);y(d.scroller,"drop",e)}function gf(a,b,c,d,e){function f(b){if(0!=B(t,b))if(t=b,"rect"==d){var e=[],f=a.options.tabSize,g=qa(w(m,c.line).text,
+c.ch,f),h=qa(w(m,b.line).text,b.ch,f),l=Math.min(g,h);g=Math.max(g,h);h=Math.min(c.line,b.line);for(b=Math.min(a.lastLine(),Math.max(c.line,b.line));h<=b;h++){var v=w(m,h).text,r=fe(v,l,f);l==g?e.push(new F(q(h,r),q(h,r))):v.length>r&&e.push(new F(q(h,r),q(h,fe(v,g,f))))}e.length||e.push(new F(c,c));Q(m,ma(n.ranges.slice(0,k).concat(e),k),mc)}else e=p,f=e.anchor,l=b,"single"!=d&&(b="double"==d?cd(m,b):new F(q(b.line,0),x(m,q(b.line+1,0))),0<B(b.anchor,f)?(l=b.head,f=Rc(e.from(),b.anchor)):(l=b.anchor,
+f=Qc(e.to(),b.head))),e=n.ranges.slice(0),e[k]=new F(x(m,f),l),Q(m,ma(e,k),mc)}function g(b){var c=++u,e=hb(a,b,!0,"rect"==d);if(e)if(0!=B(e,t)){$c(a);f(e);var h=D(l,m);(e.line>=h.to||e.line<h.from)&&setTimeout(N(a,function(){u==c&&g(b)}),150)}else{var n=b.clientY<r.top?-20:b.clientY>r.bottom?20:0;n&&setTimeout(N(a,function(){u==c&&(l.scroller.scrollTop+=n,g(b))}),50)}}function h(b){u=Infinity;T(b);Y(a);Ha(document,"mousemove",A);Ha(document,"mouseup",z);m.history.lastSelOrigin=null}var l=a.display,
+m=a.doc;T(b);var n=m.sel;if(e){var k=m.sel.contains(c);var p=-1<k?m.sel.ranges[k]:new F(c,c)}else p=m.sel.primary();b.altKey?(d="rect",e||(p=new F(c,c)),c=hb(a,b,!0,!0),k=-1):"double"==d?(b=cd(m,c),p=a.display.shift||m.extend?xb(m,p,b.anchor,b.head):b):"triple"==d?(b=new F(q(c.line,0),x(m,q(c.line+1,0))),p=a.display.shift||m.extend?xb(m,p,b.anchor,b.head):b):p=xb(m,p,c);e?-1<k?Hd(m,k,p,mc):(k=m.sel.ranges.length,Q(m,ma(m.sel.ranges.concat([p]),k),{scroll:!1,origin:"*mouse"})):(k=0,Q(m,new ya([p],
+0),mc));var t=c,r=l.wrapper.getBoundingClientRect(),u=0,A=N(a,function(a){(X&&!hf?a.buttons:ee(a))?g(a):h(a)}),z=N(a,h);y(document,"mousemove",A);y(document,"mouseup",z)}function bd(a,b,c,d,e){try{var f=b.clientX,g=b.clientY}catch(m){return!1}if(f>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&T(b);d=a.display;var h=d.lineDiv.getBoundingClientRect();if(g>h.bottom||!ea(a,c))return ed(b);g-=h.top-d.viewOffset;for(h=0;h<a.options.gutters.length;++h){var l=d.gutters.childNodes[h];
+if(l&&l.getBoundingClientRect().right>=f)return f=Oa(a.doc,g),e(a,c,a,f,a.options.gutters[h],b),ed(b)}}function cf(a){var b=this;if(!ra(b,a)&&!Ta(b.display,a)){T(a);da&&(ce=+new Date);var c=hb(b,a,!0),d=a.dataTransfer.files;if(c&&!hc(b))if(d&&d.length&&window.FileReader&&window.File){var e=d.length,f=Array(e),g=0;a=function(a,d){var h=new FileReader;h.onload=function(){f[d]=h.result;if(++g==e){c=x(b.doc,c);var a={from:c,to:c,text:fb(f.join("\n")),origin:"paste"};gb(b.doc,a);Id(b.doc,Fa(c,ib(a)))}};
+h.readAsText(a)};for(var h=0;h<e;++h)a(d[h],h)}else if(b.state.draggingText&&-1<b.doc.sel.contains(c))b.state.draggingText(a),setTimeout(ia(Y,b),20);else try{if(f=a.dataTransfer.getData("Text")){var l=b.state.draggingText&&b.listSelections();Vb(b.doc,Fa(c,c));if(l)for(h=0;h<l.length;++h)nc(b.doc,"",l[h].anchor,l[h].head,"drag");b.replaceSelection(f,"around","paste");Y(b)}}catch(m){}}}function Db(a,b){2>Math.abs(a.doc.scrollTop-b)||(a.doc.scrollTop=b,Gb||I(a,{top:b}),a.display.scroller.scrollTop!=
+b&&(a.display.scroller.scrollTop=b),a.display.scrollbarV.scrollTop!=b&&(a.display.scrollbarV.scrollTop=b),Gb&&I(a),rb(a,100))}function bb(a,b,c){(c?b==a.doc.scrollLeft:2>Math.abs(a.doc.scrollLeft-b))||(b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),a.doc.scrollLeft=b,ba(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbarH.scrollLeft!=b&&(a.display.scrollbarH.scrollLeft=b))}function Zd(a,b){var c=b.wheelDeltaX,d=b.wheelDeltaY;null==
+c&&b.detail&&b.axis==b.HORIZONTAL_AXIS&&(c=b.detail);null==d&&b.detail&&b.axis==b.VERTICAL_AXIS?d=b.detail:null==d&&(d=b.wheelDelta);var e=a.display,f=e.scroller;if(c&&f.scrollWidth>f.clientWidth||d&&f.scrollHeight>f.clientHeight){if(d&&Pa&&Z){var g=b.target,h=e.view;a:for(;g!=f;g=g.parentNode)for(var l=0;l<h.length;l++)if(h[l].node==g){a.display.currentWheelTarget=g;break a}}!c||Gb||fa||null==ha?(d&&null!=ha&&(g=d*ha,h=a.doc.scrollTop,l=h+e.wrapper.clientHeight,0>g?h=Math.max(0,h+g-50):l=Math.min(a.doc.height,
+l+g+50),I(a,{top:h,bottom:l})),20>oc&&(null==e.wheelStartX?(e.wheelStartX=f.scrollLeft,e.wheelStartY=f.scrollTop,e.wheelDX=c,e.wheelDY=d,setTimeout(function(){if(null!=e.wheelStartX){var a=f.scrollLeft-e.wheelStartX,b=f.scrollTop-e.wheelStartY;a=b&&e.wheelDY&&b/e.wheelDY||a&&e.wheelDX&&a/e.wheelDX;e.wheelStartX=e.wheelStartY=null;a&&(ha=(ha*oc+a)/(oc+1),++oc)}},200)):(e.wheelDX+=c,e.wheelDY+=d))):(d&&Db(a,Math.max(0,Math.min(f.scrollTop+d*ha,f.scrollHeight-f.clientHeight))),bb(a,Math.max(0,Math.min(f.scrollLeft+
+c*ha,f.scrollWidth-f.clientWidth))),T(b),e.wheelStartX=null)}}function pc(a,b,c){if("string"==typeof b&&(b=qc[b],!b))return!1;a.display.pollingFast&&Zc(a)&&(a.display.pollingFast=!1);var d=a.display.shift,e=!1;try{hc(a)&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=ge}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function he(a){var b=a.state.keyMaps.slice(0);a.options.extraKeys&&b.push(a.options.extraKeys);b.push(a.options.keyMap);return b}function ie(a,b){var c=fd(a.options.keyMap),
+d=c.auto;clearTimeout(je);d&&!jf(b)&&(je=setTimeout(function(){fd(a.options.keyMap)==c&&(a.options.keyMap=d.call?d.call(null,a):d,nb(a))},50));var e=kf(b,!0),f=!1;if(!e)return!1;f=he(a);if(f=b.shiftKey?rc("Shift-"+e,f,function(b){return pc(a,b,!0)})||rc(e,f,function(b){if("string"==typeof b?/^go[A-Z]/.test(b):b.motion)return pc(a,b)}):rc(e,f,function(b){return pc(a,b)}))T(b),Zb(a),O(a,"keyHandled",a,e,b);return f}function lf(a,b,c){var d=rc("'"+c+"'",he(a),function(b){return pc(a,b,!0)});d&&(T(b),
+Zb(a),O(a,"keyHandled",a,"'"+c+"'",b));return d}function ae(a){$c(this);if(!ra(this,a)){da&&27==a.keyCode&&(a.returnValue=!1);var b=a.keyCode;this.display.shift=16==b||a.shiftKey;var c=ie(this,a);fa&&(gd=c?b:null,!c&&88==b&&!Wd&&(Pa?a.metaKey:a.ctrlKey)&&this.replaceSelection("",null,"cut"))}}function $d(a){ra(this,a)||16!=a.keyCode||(this.doc.sel.shift=!1)}function be(a){if(!ra(this,a)){var b=a.keyCode,c=a.charCode;fa&&b==gd?(gd=null,T(a)):(fa&&(!a.which||10>a.which)||Lc)&&ie(this,a)||(b=String.fromCharCode(null==
+c?b:c),lf(this,a,b)||(X&&!R&&(this.display.inputHasSelection=null),Eb(this)))}}function Ic(a){"nocursor"!=a.options.readOnly&&(a.state.focused||(J(a,"focus",a),a.state.focused=!0,-1==a.display.wrapper.className.search(/\bCodeMirror-focused\b/)&&(a.display.wrapper.className+=" CodeMirror-focused"),a.curOp||(ja(a),Z&&setTimeout(ia(ja,a,!0),0))),gc(a),Zb(a))}function Jc(a){a.state.focused&&(J(a,"blur",a),a.state.focused=!1,a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-focused",
+""));clearInterval(a.display.blinker);setTimeout(function(){a.state.focused||(a.display.shift=!1)},150)}function Yd(a,b){function c(){if(null!=e.input.selectionStart){var b=e.input.value="\u200b"+(a.somethingSelected()?e.input.value:"");e.prevInput="\u200b";e.input.selectionStart=1;e.input.selectionEnd=b.length}}function d(){e.inputDiv.style.position="relative";e.input.style.cssText=h;R&&(e.scrollbarV.scrollTop=e.scroller.scrollTop=g);gc(a);if(null!=e.input.selectionStart){X&&!R||c();clearTimeout(hd);
+var b=0,d=function(){"\u200b"==e.prevInput&&0==e.input.selectionStart?N(a,qc.selectAll)(a):10>b++?hd=setTimeout(d,500):ja(a)};hd=setTimeout(d,200)}}if(!ra(a,b,"contextmenu")){var e=a.display;if(!Ta(e,b)&&!mf(a,b)){var f=hb(a,b),g=e.scroller.scrollTop;if(f&&!fa){a.options.resetSelectionOnContextMenu&&-1==a.doc.sel.contains(f)&&N(a,Q)(a.doc,Fa(f),cb);var h=e.input.style.cssText;e.inputDiv.style.position="absolute";e.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(b.clientY-
+5)+"px; left: "+(b.clientX-5)+"px; z-index: 1000; background: "+(X?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";Y(a);ja(a);a.somethingSelected()||(e.input.value=e.prevInput=" ");X&&!R&&c();if(dd){ad(b);var l=function(){Ha(window,"mouseup",l);setTimeout(d,20)};y(window,"mouseup",l)}else setTimeout(d,50)}}}}function mf(a,b){return ea(a,"gutterContextMenu")?bd(a,b,"gutterContextMenu",!1,J):!1}function ke(a,
+b){if(0>B(a,b.from))return a;if(0>=B(a,b.to))return ib(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;a.line==b.to.line&&(d+=ib(b).ch-b.to.ch);return q(c,d)}function id(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new F(ke(e.anchor,b),ke(e.head,b)))}return ma(c,a.sel.primIndex)}function le(a,b,c){return a.line==b.line?q(c.line,a.ch-b.ch+c.ch):q(c.line+(a.line-b.line),a.ch)}function me(a,b,c){b={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,
+cancel:function(){this.canceled=!0}};c&&(b.update=function(b,c,f,g){b&&(this.from=x(a,b));c&&(this.to=x(a,c));f&&(this.text=f);void 0!==g&&(this.origin=g)});J(a,"beforeChange",a,b);a.cm&&J(a.cm,"beforeChange",a.cm,b);return b.canceled?null:{from:b.from,to:b.to,text:b.text,origin:b.origin}}function gb(a,b,c){if(a.cm){if(!a.cm.curOp)return N(a.cm,gb)(a,b,c);if(a.cm.state.suppressEdits)return}if(ea(a,"beforeChange")||a.cm&&ea(a.cm,"beforeChange"))if(b=me(a,b,!0),!b)return;if(c=ne&&!c&&nf(a,b.from,b.to))for(var d=
+c.length-1;0<=d;--d)oe(a,{from:c[d].from,to:c[d].to,text:d?[""]:b.text});else oe(a,b)}function oe(a,b){if(1!=b.text.length||""!=b.text[0]||0!=B(b.from,b.to)){var c=id(a,b);pe(a,b,c,a.cm?a.cm.curOp.id:NaN);Hb(a,b,c,jd(a,b));var d=[];jb(a,function(a,c){c||-1!=S(d,a.history)||(qe(a.history,b),d.push(a.history));Hb(a,b,null,jd(a,b))})}}function sc(a,b,c){if(!a.cm||!a.cm.state.suppressEdits){for(var d=a.history,e,f=a.sel,g="undo"==b?d.done:d.undone,h="undo"==b?d.undone:d.done,l=0;l<g.length&&(e=g[l],c?
+!e.ranges||e.equals(a.sel):e.ranges);l++);if(l!=g.length){for(d.lastOrigin=d.lastSelOrigin=null;;)if(e=g.pop(),e.ranges){Wb(e,h);if(c&&!e.equals(a.sel)){Q(a,e,{clearRedo:!1});return}f=e}else break;c=[];Wb(f,h);h.push({changes:c,generation:d.generation});d.generation=e.generation||++d.maxGeneration;d=ea(a,"beforeChange")||a.cm&&ea(a.cm,"beforeChange");for(l=e.changes.length-1;0<=l;--l){var m=e.changes[l];m.origin=b;if(d&&!me(a,m,!1)){g.length=0;break}c.push(kd(a,m));f=l?id(a,m,null):E(g);Hb(a,m,f,
+re(a,m));a.cm&&Qa(a.cm);var n=[];jb(a,function(a,b){b||-1!=S(n,a.history)||(qe(a.history,m),n.push(a.history));Hb(a,m,null,re(a,m))})}}}}function se(a,b){a.first+=b;a.sel=new ya(ld(a.sel.ranges,function(a){return new F(q(a.anchor.line+b,a.anchor.ch),q(a.head.line+b,a.head.ch))}),a.sel.primIndex);a.cm&&ca(a.cm,a.first,a.first-b,b)}function Hb(a,b,c,d){if(a.cm&&!a.cm.curOp)return N(a.cm,Hb)(a,b,c,d);if(b.to.line<a.first)se(a,b.text.length-1-(b.to.line-b.from.line));else if(!(b.from.line>a.lastLine())){if(b.from.line<
+a.first){var e=b.text.length-1-(a.first-b.from.line);se(a,e);b={from:q(a.first,0),to:q(b.to.line+e,b.to.ch),text:[E(b.text)],origin:b.origin}}e=a.lastLine();b.to.line>e&&(b={from:b.from,to:q(e,w(a,e).text.length),text:[b.text[0]],origin:b.origin});b.removed=Ib(a,b.from,b.to);c||(c=id(a,b,null));a.cm?of(a.cm,b,d):md(a,b,d);Vb(a,c,cb)}}function of(a,b,c){var d=a.doc,e=a.display,f=b.from,g=b.to,h=!1,l=f.line;a.options.lineWrapping||(l=G(pa(w(d,f.line))),d.iter(l,g.line+1,function(a){if(a==e.maxLine)return h=
+!0}));-1<d.sel.contains(b.from,b.to)&&(a.curOp.cursorActivity=!0);md(d,b,c,Za(a));a.options.lineWrapping||(d.iter(l,f.line+b.text.length,function(a){var b=V(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,h=!1)}),h&&(a.curOp.updateMaxLine=!0));d.frontier=Math.min(d.frontier,f.line);rb(a,400);c=b.text.length-(g.line-f.line)-1;f.line!=g.line||1!=b.text.length||te(a.doc,b)?ca(a,f.line,g.line+1,c):Ra(a,f.line,"text");(ea(a,"change")||ea(a,"changes"))&&(a.curOp.changeObjs||(a.curOp.changeObjs=
+[])).push({from:f,to:g,text:b.text,removed:b.removed,origin:b.origin})}function nc(a,b,c,d,e){d||(d=c);if(0>B(d,c)){var f=d;d=c;c=f}"string"==typeof b&&(b=fb(b));gb(a,{from:c,to:d,text:b,origin:e})}function ec(a,b,c,d,e){var f=a.display,g=Ka(a.display);0>c&&(c=0);var h=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:f.scroller.scrollTop,l=f.scroller.clientHeight-wa,m={},n=a.doc.height+yd(f);c<h?m.scrollTop=c<g?0:c:e>h+l&&(c=Math.min(c,(e>n-g?n:e)-l),c!=h&&(m.scrollTop=c));a=a.curOp&&null!=a.curOp.scrollLeft?
+a.curOp.scrollLeft:f.scroller.scrollLeft;h=f.scroller.clientWidth-wa;b+=f.gutters.offsetWidth;d+=f.gutters.offsetWidth;f=f.gutters.offsetWidth;c=b<f+10;b<a+f||c?(c&&(b=0),m.scrollLeft=Math.max(0,b-10-f)):d>h+a-3&&(m.scrollLeft=d+10-h);return m}function tc(a,b,c){null==b&&null==c||uc(a);null!=b&&(a.curOp.scrollLeft=(null==a.curOp.scrollLeft?a.doc.scrollLeft:a.curOp.scrollLeft)+b);null!=c&&(a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+c)}function Qa(a){uc(a);var b=a.getCursor(),
+c=b,d=b;a.options.lineWrapping||(c=b.ch?q(b.line,b.ch-1):b,d=q(b.line,b.ch+1));a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:!0}}function uc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=Vd(a,b.from),d=Vd(a,b.to);b=ec(a,Math.min(c.left,d.left),Math.min(c.top,d.top)-b.margin,Math.max(c.right,d.right),Math.max(c.bottom,d.bottom)+b.margin);a.scrollTo(b.scrollLeft,b.scrollTop)}}function ic(a,b,c,d){var e=a.doc,f;null==c&&(c="add");"smart"==c&&(a.doc.mode.indent?
+f=zb(a,b):c="prev");var g=a.options.tabSize,h=w(e,b),l=qa(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var m=h.text.match(/^\s*/)[0];if(!d&&!/\S/.test(h.text)){var n=0;c="not"}else if("smart"==c&&(n=a.doc.mode.indent(f,h.text.slice(m.length),h.text),n==ge)){if(!d)return;c="prev"}"prev"==c?n=b>e.first?qa(w(e,b-1).text,null,g):0:"add"==c?n=l+a.options.indentUnit:"subtract"==c?n=l-a.options.indentUnit:"number"==typeof c&&(n=l+c);n=Math.max(0,n);d="";f=0;if(a.options.indentWithTabs)for(c=Math.floor(n/
+g);c;--c)f+=g,d+="\t";f<n&&(d+=ue(n-f));if(d!=m)nc(a.doc,d,q(b,0),q(b,m.length),"+input");else for(c=0;c<e.sel.ranges.length;c++)if(a=e.sel.ranges[c],a.head.line==b&&a.head.ch<m.length){f=q(b,m.length);Hd(e,c,new F(f,f));break}h.stateAfter=null}function vc(a,b,c,d){var e=b,f=b,g=a.doc;"number"==typeof b?f=w(g,Math.max(g.first,Math.min(b,g.first+g.size-1))):e=G(b);if(null!=e&&d(f,e))Ra(a,e,c);else return null;return f}function wc(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&
+0>=B(f.from,E(d).to);){var g=d.pop();if(0>B(g.from,f.from)){f.from=g.from;break}}d.push(f)}va(a,function(){for(var b=d.length-1;0<=b;b--)nc(a.doc,"",d[b].from,d[b].to,"+delete");Qa(a)})}function nd(a,b,c,d,e){function f(b){var d=(e?Yc:ve)(l,h,c,!0);if(null==d){if(b=!b)b=g+c,b<a.first||b>=a.first+a.size?b=m=!1:(g=b,b=l=w(a,b));if(b)h=e?(0>c?cc:bc)(l):0>c?l.text.length:0;else return m=!1}else h=d;return!0}var g=b.line,h=b.ch;b=c;var l=w(a,g),m=!0;if("char"==d)f();else if("column"==d)f(!0);else if("word"==
+d||"group"==d){var n=null;d="group"==d;for(var k=!0;!(0>c)||f(!k);k=!1){var p=l.text.charAt(h)||"\n";p=xc(p)?"w":d&&"\n"==p?"n":!d||/\s/.test(p)?null:"p";!d||k||p||(p="s");if(n&&n!=p){0>c&&(c=1,f());break}p&&(n=p);if(0<c&&!f(!k))break}}b=Xb(a,q(g,h),b,!0);m||(b.hitSide=!0);return b}function we(a,b,c,d){var e=a.doc,f=b.left,g;for("page"==d?g=b.top+c*(Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight)-(0>c?1.5:.5)*Ka(a.display)):"line"==d&&(g=0<c?b.bottom+
+3:b.top-3);;){b=Xc(a,f,g);if(!b.outside)break;if(0>c?0>=g:g>=e.height){b.hitSide=!0;break}g+=5*c}return b}function cd(a,b){var c=w(a,b.line).text,d=b.ch,e=b.ch;if(c){(0>b.xRel||e==c.length)&&d?--d:++e;var f=c.charAt(d);for(f=xc(f)?xc:/\s/.test(f)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!xc(a)};0<d&&f(c.charAt(d-1));)--d;for(;e<c.length&&f(c.charAt(e));)++e}return new F(q(b.line,d),q(b.line,e))}function C(a,b,c,d){k.defaults[a]=b;c&&(ab[a]=d?function(a,b,d){d!=xd&&c(a,b,d)}:
+c)}function fd(a){return"string"==typeof a?xa[a]:a}function Jb(a,b,c,d,e){if(d&&d.shared)return pf(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return N(a.cm,Jb)(a,b,c,d,e);var f=new Ua(a,e);e=B(b,c);d&&yc(d,f);if(0<e||0==e&&!1!==f.clearWhenEmpty)return f;f.replacedWith&&(f.collapsed=!0,f.widgetNode=t("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||(f.widgetNode.ignoreEvents=!0),d.insertLeft&&(f.widgetNode.insertLeft=!0));if(f.collapsed){if(xe(a,b.line,b,c,f)||b.line!=c.line&&xe(a,c.line,b,c,
+f))throw Error("Inserting collapsed marker partially overlapping an existing one");Ea=!0}f.addToHistory&&pe(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var g=b.line,h=a.cm,l;a.iter(g,c.line+1,function(a){h&&f.collapsed&&!h.options.lineWrapping&&pa(a)==h.display.maxLine&&(l=!0);f.collapsed&&g!=b.line&&ka(a,0);var d=new zc(f,g==b.line?b.ch:null,g==c.line?c.ch:null);a.markedSpans=a.markedSpans?a.markedSpans.concat([d]):[d];d.marker.attachLine(a);++g});f.collapsed&&a.iter(b.line,c.line+1,function(b){La(a,
+b)&&ka(b,0)});f.clearOnEnter&&y(f,"beforeCursorEnter",function(){f.clear()});f.readOnly&&(ne=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory());f.collapsed&&(f.id=++qf,f.atomic=!0);if(h){l&&(h.curOp.updateMaxLine=!0);if(f.collapsed)ca(h,b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle)for(d=b.line;d<=c.line;d++)Ra(h,d,"text");f.atomic&&Md(h.doc);O(h,"markerAdded",h,f)}return f}function pf(a,b,c,d,e){d=yc(d);d.shared=!1;var f=[Jb(a,b,c,d,e)],g=f[0],h=d.widgetNode;
+jb(a,function(a){h&&(d.widgetNode=h.cloneNode(!0));f.push(Jb(a,x(a,b),x(a,c),d,e));for(var l=0;l<a.linked.length;++l)if(a.linked[l].isParent)return;g=E(f)});return new Ac(f,g)}function zc(a,b,c){this.marker=a;this.from=b;this.to=c}function Kb(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function jd(a,b){var c=wb(a,b.from.line)&&w(a,b.from.line).markedSpans,d=wb(a,b.to.line)&&w(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,g=0==B(b.from,b.to);
+if(c)for(var h=0,l;h<c.length;++h){var m=c[h],n=m.marker;if(null==m.from||(n.inclusiveLeft?m.from<=e:m.from<e)||!(m.from!=e||"bookmark"!=n.type||g&&m.marker.insertLeft)){var k=null==m.to||(n.inclusiveRight?m.to>=e:m.to>e);(l||(l=[])).push(new zc(n,m.from,k?null:m.to))}}c=l;if(d){h=0;for(var p;h<d.length;++h)if(l=d[h],m=l.marker,null==l.to||(m.inclusiveRight?l.to>=f:l.to>f)||l.from==f&&"bookmark"==m.type&&(!g||l.marker.insertLeft))n=null==l.from||(m.inclusiveLeft?l.from<=f:l.from<f),(p||(p=[])).push(new zc(m,
+n?null:l.from-f,null==l.to?null:l.to-f))}d=p;g=1==b.text.length;p=E(b.text).length+(g?e:0);if(c)for(f=0;f<c.length;++f)if(h=c[f],null==h.to)(l=Kb(d,h.marker),l)?g&&(h.to=null==l.to?null:l.to+p):h.to=e;if(d)for(f=0;f<d.length;++f)h=d[f],null!=h.to&&(h.to+=p),null==h.from?(l=Kb(c,h.marker),l||(h.from=p,g&&(c||(c=[])).push(h))):(h.from+=p,g&&(c||(c=[])).push(h));c&&(c=ye(c));d&&d!=c&&(d=ye(d));e=[c];if(!g){g=b.text.length-2;var q;if(0<g&&c)for(f=0;f<c.length;++f)null==c[f].to&&(q||(q=[])).push(new zc(c[f].marker,
+null,null));for(f=0;f<g;++f)e.push(q);e.push(d)}return e}function ye(a){for(var b=0;b<a.length;++b){var c=a[b];null!=c.from&&c.from==c.to&&!1!==c.marker.clearWhenEmpty&&a.splice(b--,1)}return a.length?a:null}function re(a,b){var c;if(c=b["spans_"+a.id]){for(var d=0,e=[];d<b.text.length;++d)e.push(rf(c[d]));c=e}else c=null;d=jd(a,b);if(!c)return d;if(!d)return c;for(e=0;e<c.length;++e){var f=c[e],g=d[e];if(f&&g){var h=0;a:for(;h<g.length;++h){for(var l=g[h],m=0;m<f.length;++m)if(f[m].marker==l.marker)continue a;
+f.push(l)}}else g&&(c[e]=g)}return c}function nf(a,b,c){var d=null;a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;!c.readOnly||d&&-1!=S(d,c)||(d||(d=[])).push(c)}});if(!d)return null;a=[{from:b,to:c}];for(b=0;b<d.length;++b){c=d[b];for(var e=c.find(0),f=0;f<a.length;++f){var g=a[f];if(!(0>B(g.to,e.from)||0<B(g.from,e.to))){var h=[f,1],l=B(g.from,e.from),m=B(g.to,e.to);(0>l||!c.inclusiveLeft&&!l)&&h.push({from:g.from,to:e.from});
+(0<m||!c.inclusiveRight&&!m)&&h.push({from:e.to,to:g.to});a.splice.apply(a,h);f+=h.length-1}}}return a}function ze(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function Ae(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function Be(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;c=a.find();var d=b.find(),e=B(c.from,d.from)||(a.inclusiveLeft?-1:0)-(b.inclusiveLeft?-1:0);return e?-e:(c=B(c.to,d.to)||
+(a.inclusiveRight?1:0)-(b.inclusiveRight?1:0))?c:b.id-a.id}function Na(a,b){var c=Ea&&a.markedSpans;if(c)for(var d,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed&&null==(b?d.from:d.to)&&(!f||0>Be(f,d.marker)))var f=d.marker;return f}function xe(a,b,c,d,e){a=w(a,b);if(a=Ea&&a.markedSpans)for(b=0;b<a.length;++b){var f=a[b];if(f.marker.collapsed){var g=f.marker.find(0),h=B(g.from,c)||(f.marker.inclusiveLeft?-1:0)-(e.inclusiveLeft?-1:0),l=B(g.to,d)||(f.marker.inclusiveRight?1:0)-(e.inclusiveRight?1:
+0);if(!(0<=h&&0>=l||0>=h&&0<=l)&&(0>=h&&0<(B(g.to,c)||(f.marker.inclusiveRight?1:0)-(e.inclusiveLeft?-1:0))||0<=h&&0>(B(g.from,d)||(f.marker.inclusiveLeft?-1:0)-(e.inclusiveRight?1:0))))return!0}}}function pa(a){for(var b;b=Na(a,!0);)a=b.find(-1,!0).line;return a}function Mc(a,b){var c=w(a,b),d=pa(c);return c==d?b:G(d)}function Bd(a,b){if(b>a.lastLine())return b;var c=w(a,b),d;if(!La(a,c))return b;for(;d=Na(c,!1);)c=d.find(1,!0).line;return G(c)+1}function La(a,b){var c=Ea&&b.markedSpans;if(c)for(var d,
+e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed&&(null==d.from||!d.marker.widgetNode&&0==d.from&&d.marker.inclusiveLeft&&od(a,b,d)))return!0}function od(a,b,c){if(null==c.to)return b=c.marker.find(1,!0),od(a,b.line,Kb(b.line.markedSpans,c.marker));if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var d,e=0;e<b.markedSpans.length;++e)if(d=b.markedSpans[e],d.marker.collapsed&&!d.marker.widgetNode&&d.from==c.to&&(null==d.to||d.to!=c.from)&&(d.marker.inclusiveLeft||c.marker.inclusiveRight)&&
+od(a,b,d))return!0}function Bb(a){if(null!=a.height)return a.height;Xd(document.body,a.node)||na(a.cm.display.measure,t("div",[a.node],null,"position: relative"));return a.height=a.node.offsetHeight}function sf(a,b,c,d){var e=new Bc(a,c,d);e.noHScroll&&(a.display.alignWidgets=!0);vc(a,b,"widget",function(b){var c=b.widgets||(b.widgets=[]);null==e.insertAt?c.push(e):c.splice(Math.min(c.length-1,Math.max(0,e.insertAt)),0,e);e.line=b;La(a.doc,b)||(c=la(b)<a.doc.scrollTop,ka(b,b.height+Bb(e)),c&&tc(a,
+null,e.height),a.curOp.forceUpdate=!0);return!0});return e}function Ce(a,b,c,d,e,f){var g=c.flattenSpans;null==g&&(g=a.options.flattenSpans);var h=0,l=null,m=new Cc(b,a.options.tabSize);for(""==b&&c.blankLine&&c.blankLine(d);!m.eol();){if(m.pos>a.options.maxHighlightLength){g=!1;f&&Sc(a,b,d,m.pos);m.pos=b.length;var n=null}else n=c.token(m,d);if(a.options.addModeClass){var v=k.innerMode(c,d).mode.name;v&&(n="m-"+(n?v+" "+n:v))}g&&l==n||(h<m.start&&e(m.start,l),h=m.start,l=n);m.start=m.pos}for(;h<
+m.pos;)a=Math.min(m.pos,h+5E4),e(a,l),h=a}function Od(a,b,c,d){var e=[a.state.modeGen];Ce(a,b.text,a.doc.mode,c,function(a,b){e.push(a,b)},d);for(c=0;c<a.state.overlays.length;++c){var f=a.state.overlays[c],g=1,h=0;Ce(a,b.text,f.mode,!0,function(a,b){for(var c=g;h<a;){var d=e[g];d>a&&e.splice(g,1,a,e[g+1],d);g+=2;h=Math.min(a,d)}if(b)if(f.opaque)e.splice(c,g-c,a,b),g=c+2;else for(;c<g;c+=2)d=e[c+1],e[c+1]=d?d+" "+b:b})}return e}function De(a,b){b.styles&&b.styles[0]==a.state.modeGen||(b.styles=Od(a,
+b,b.stateAfter=zb(a,G(b))));return b.styles}function Sc(a,b,c,d){var e=a.doc.mode,f=new Cc(b,a.options.tabSize);f.start=f.pos=d||0;for(""==b&&e.blankLine&&e.blankLine(c);!f.eol()&&f.pos<=a.options.maxHighlightLength;)e.token(f,c),f.start=f.pos}function Ee(a,b){if(!a)return null;for(;;){var c=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!c)break;a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";null==b[d]?b[d]=c[2]:(new RegExp("(?:^|s)"+c[2]+"(?:$|s)")).test(b[d])||
+(b[d]+=" "+c[2])}if(/^\s*$/.test(a))return null;c=b.cm.options.addModeClass?tf:uf;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function Ed(a,b){var c=t("span",null,null,Z?"padding-right: .1px":null);c={pre:t("pre",[c]),content:c,col:0,pos:0,cm:a};b.measure={};for(var d=0;d<=(b.rest?b.rest.length:0);d++){var e=d?b.rest[d-1]:b.line,f;c.pos=0;c.addToken=vf;(X||Z)&&a.getOption("lineWrapping")&&(c.addToken=wf(c.addToken));if(null!=pd)var g=pd;else{g=na(a.display.measure,document.createTextNode("A\u062eA"));
+var h=$b(g,0,1).getBoundingClientRect();g=h.left==h.right?!1:pd=3>$b(g,1,2).getBoundingClientRect().right-h.right}g&&(f=oa(e))&&(c.addToken=xf(c.addToken,f));c.map=[];a:{var l=h=g=void 0,m=void 0,n=void 0,k=void 0,p=c,q=De(a,e),r=e.markedSpans;e=e.text;var u=0;if(r){var w=e.length,z=0;E=1;for(var x="",A=0;;){if(A==z){n=m=l=h="";g=null;A=Infinity;for(var C=[],D=0;D<r.length;++D){var y=r[D],B=y.marker;y.from<=z&&(null==y.to||y.to>z)?(null!=y.to&&A>y.to&&(A=y.to,m=""),B.className&&(n+=" "+B.className),
+B.startStyle&&y.from==z&&(l+=" "+B.startStyle),B.endStyle&&y.to==A&&(m+=" "+B.endStyle),B.title&&!h&&(h=B.title),B.collapsed&&(!g||0>Be(g.marker,B))&&(g=y)):y.from>z&&A>y.from&&(A=y.from);"bookmark"==B.type&&y.from==z&&B.widgetNode&&C.push(B)}if(g&&(g.from||0)==z&&(Fe(p,(null==g.to?w+1:g.to)-z,g.marker,null==g.from),null==g.to))break a;if(!g&&C.length)for(D=0;D<C.length;++D)Fe(p,0,C[D])}if(z>=w)break;for(C=Math.min(w,A);;){if(x){D=z+x.length;g||(y=D>C?x.slice(0,C-z):x,p.addToken(p,y,k?k+n:n,l,z+y.length==
+A?m:"",h));if(D>=C){x=x.slice(C-z);z=C;break}z=D;l=""}x=e.slice(u,u=q[E++]);k=Ee(q[E++],p)}}}else for(var E=1;E<q.length;E+=2)p.addToken(p,e.slice(u,u=q[E]),Ee(q[E+1],p))}0==c.map.length&&c.map.push(0,0,c.content.appendChild(yf(a.display.measure)));0==d?(b.measure.map=c.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(c.map),(b.measure.caches||(b.measure.caches=[])).push({}))}J(a,"renderLine",a,b.line,c.pre);return c}function vf(a,b,c,d,e,f){if(b){var g=a.cm.options.specialChars,
+h=!1;if(g.test(b)){p=document.createDocumentFragment();for(var l=0;;){g.lastIndex=l;var m=g.exec(b),n=m?m.index-l:b.length-l;if(n){var k=document.createTextNode(b.slice(l,l+n));R?p.appendChild(t("span",[k])):p.appendChild(k);a.map.push(a.pos,a.pos+n,k);a.col+=n;a.pos+=n}if(!m)break;l+=n+1;"\t"==m[0]?(k=a.cm.options.tabSize,m=k-a.col%k,k=p.appendChild(t("span",ue(m),"cm-tab")),a.col+=m):(k=a.cm.options.specialCharPlaceholder(m[0]),R?p.appendChild(t("span",[k])):p.appendChild(k),a.col+=1);a.map.push(a.pos,
+a.pos+1,k);a.pos++}}else{a.col+=b.length;var p=document.createTextNode(b);a.map.push(a.pos,a.pos+b.length,p);R&&(h=!0);a.pos+=b.length}if(c||d||e||h)return b=c||"",d&&(b+=d),e&&(b+=e),d=t("span",[p],b),f&&(d.title=f),a.content.appendChild(d);a.content.appendChild(p)}}function wf(a){function b(a){for(var b=" ",c=0;c<a.length-2;++c)b+=c%2?" ":"\u00a0";return b+" "}return function(c,d,e,f,g,h){a(c,d.replace(/ {3,}/g,b),e,f,g,h)}}function xf(a,b){return function(c,d,e,f,g,h){e=e?e+" cm-force-border":
+"cm-force-border";for(var l=c.pos,m=l+d.length;;){for(var n=0;n<b.length;n++){var k=b[n];if(k.to>l&&k.from<=l)break}if(k.to>=m)return a(c,d,e,f,g,h);a(c,d.slice(0,k.to-l),e,f,null,h);f=null;d=d.slice(k.to-l);l=k.to}}}function Fe(a,b,c,d){if(c=!d&&c.widgetNode)a.map.push(a.pos,a.pos+b,c),a.content.appendChild(c);a.pos+=b}function te(a,b){return 0==b.from.ch&&0==b.to.ch&&""==E(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function md(a,b,c,d){function e(a,c,e){a.text=c;a.stateAfter&&(a.stateAfter=
+null);a.styles&&(a.styles=null);null!=a.order&&(a.order=null);ze(a);Ae(a,e);c=d?d(a):1;c!=a.height&&ka(a,c);O(a,"change",a,b)}var f=b.from,g=b.to,h=b.text,l=w(a,f.line),m=w(a,g.line),n=E(h),k=c?c[h.length-1]:null,p=g.line-f.line;if(te(a,b)){for(var q=0,r=[];q<h.length-1;++q)r.push(new Va(h[q],c?c[q]:null,d));e(m,m.text,k);p&&a.remove(f.line,p);r.length&&a.insert(f.line,r)}else if(l==m)if(1==h.length)e(l,l.text.slice(0,f.ch)+n+l.text.slice(g.ch),k);else{r=[];for(q=1;q<h.length-1;++q)r.push(new Va(h[q],
+c?c[q]:null,d));r.push(new Va(n+l.text.slice(g.ch),k,d));e(l,l.text.slice(0,f.ch)+h[0],c?c[0]:null);a.insert(f.line+1,r)}else if(1==h.length)e(l,l.text.slice(0,f.ch)+h[0]+m.text.slice(g.ch),c?c[0]:null),a.remove(f.line+1,p);else{e(l,l.text.slice(0,f.ch)+h[0],c?c[0]:null);e(m,n+m.text.slice(g.ch),k);q=1;for(r=[];q<h.length-1;++q)r.push(new Va(h[q],c?c[q]:null,d));1<p&&a.remove(f.line+1,p-1);a.insert(f.line+1,r)}O(a,"change",a,b)}function Lb(a){this.lines=a;this.parent=null;for(var b=0,c=0;b<a.length;++b)a[b].parent=
+this,c+=a[b].height;this.height=c}function Mb(a){this.children=a;for(var b=0,c=0,d=0;d<a.length;++d){var e=a[d];b+=e.chunkSize();c+=e.height;e.parent=this}this.size=b;this.height=c;this.parent=null}function jb(a,b,c){function d(a,f,g){if(a.linked)for(var e=0;e<a.linked.length;++e){var l=a.linked[e];if(l.doc!=f){var m=g&&l.sharedHist;if(!c||m)b(l.doc,m),d(l.doc,a,m)}}}d(a,null,!0)}function wd(a,b){if(b.cm)throw Error("This document is already in use.");a.doc=b;b.cm=a;$a(a);Aa(a);a.options.lineWrapping||
+ta(a);a.options.mode=b.modeOption;ca(a)}function w(a,b){b-=a.first;if(0>b||b>=a.size)throw Error("There is no line "+(b+a.first)+" in the document.");for(var c=a;!c.lines;)for(var d=0;;++d){var e=c.children[d],f=e.chunkSize();if(b<f){c=e;break}b-=f}return c.lines[b]}function Ib(a,b,c){var d=[],e=b.line;a.iter(b.line,c.line+1,function(a){a=a.text;e==c.line&&(a=a.slice(0,c.ch));e==b.line&&(a=a.slice(b.ch));d.push(a);++e});return d}function qd(a,b,c){var d=[];a.iter(b,c,function(a){d.push(a.text)});
+return d}function ka(a,b){var c=b-a.height;if(c)for(var d=a;d;d=d.parent)d.height+=c}function G(a){if(null==a.parent)return null;var b=a.parent;a=S(b.lines,a);for(var c=b.parent;c;b=c,c=c.parent)for(var d=0;c.children[d]!=b;++d)a+=c.children[d].chunkSize();return a+b.first}function Oa(a,b){var c=a.first;a:do{for(var d=0;d<a.children.length;++d){var e=a.children[d],f=e.height;if(b<f){a=e;continue a}b-=f;c+=e.chunkSize()}return c}while(!a.lines);for(d=0;d<a.lines.length;++d){e=a.lines[d].height;if(b<
+e)break;b-=e}return c+d}function la(a){a=pa(a);for(var b=0,c=a.parent,d=0;d<c.lines.length;++d){var e=c.lines[d];if(e==a)break;else b+=e.height}for(a=c.parent;a;c=a,a=c.parent)for(d=0;d<a.children.length&&(e=a.children[d],e!=c);++d)b+=e.height;return b}function oa(a){var b=a.order;null==b&&(b=a.order=zf(a.text));return b}function Dc(a){this.done=[];this.undone=[];this.undoDepth=Infinity;this.lastModTime=this.lastSelTime=0;this.lastOrigin=this.lastSelOrigin=this.lastOp=null;this.generation=this.maxGeneration=
+a||1}function kd(a,b){var c={from:Pc(b.from),to:ib(b),text:Ib(a,b.from,b.to)};Ge(a,c,b.from.line,b.to.line+1);jb(a,function(a){Ge(a,c,b.from.line,b.to.line+1)},!0);return c}function Jd(a){for(;a.length;)if(E(a).ranges)a.pop();else break}function pe(a,b,c,d){var e=a.history;e.undone.length=0;var f=+new Date,g;if(g=e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>f-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0))){if(e.lastOp==d){Jd(e.done);var h=
+E(e.done)}else e.done.length&&!E(e.done).ranges?h=E(e.done):1<e.done.length&&!e.done[e.done.length-2].ranges?(e.done.pop(),h=E(e.done)):h=void 0;g=h}if(g){var l=E(h.changes);0==B(b.from,b.to)&&0==B(b.from,l.to)?l.to=ib(b):h.changes.push(kd(a,b))}else for((h=E(e.done))&&h.ranges||Wb(a.sel,e.done),h={changes:[kd(a,b)],generation:e.generation},e.done.push(h);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift();e.done.push(c);e.generation=++e.maxGeneration;e.lastModTime=e.lastSelTime=
+f;e.lastOp=d;e.lastOrigin=e.lastSelOrigin=b.origin;l||J(a,"historyAdded")}function Wb(a,b){var c=E(b);c&&c.ranges&&c.equals(a)||b.push(a)}function Ge(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans);++f})}function rf(a){if(!a)return null;for(var b=0,c;b<a.length;++b)a[b].marker.explicitlyCleared?c||(c=a.slice(0,b)):c&&c.push(a[b]);return c?c.length?c:null:a}function kb(a,b,c){for(var d=
+0,e=[];d<a.length;++d){var f=a[d];if(f.ranges)e.push(c?ya.prototype.deepCopy.call(f):f);else{f=f.changes;var g=[];e.push({changes:g});for(var h=0;h<f.length;++h){var l=f[h],m;g.push({from:l.from,to:l.to,text:l.text});if(b)for(var n in l)(m=n.match(/^spans_(\d+)$/))&&-1<S(b,Number(m[1]))&&(E(g)[n]=l[n],delete l[n])}}}return e}function He(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function Ie(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e],g=!0;if(f.ranges){f.copied||(f=a[e]=f.deepCopy(),
+f.copied=!0);for(var h=0;h<f.ranges.length;h++)He(f.ranges[h].anchor,b,c,d),He(f.ranges[h].head,b,c,d)}else{for(h=0;h<f.changes.length;++h){var l=f.changes[h];if(c<l.from.line)l.from=q(l.from.line+d,l.from.ch),l.to=q(l.to.line+d,l.to.ch);else if(b<=l.to.line){g=!1;break}}g||(a.splice(0,e+1),e=0)}}}function qe(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;Ie(a.done,c,d,e);Ie(a.undone,c,d,e)}function ed(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function ee(a){var b=
+a.which;null==b&&(a.button&1?b=1:a.button&2?b=3:a.button&4&&(b=2));Pa&&a.ctrlKey&&1==b&&(b=3);return b}function O(a,b){function c(a){return function(){a.apply(null,e)}}var d=a._handlers&&a._handlers[b];if(d){var e=Array.prototype.slice.call(arguments,2);Ga||(++dc,Ga=[],setTimeout(Af,0));for(var f=0;f<d.length;++f)Ga.push(c(d[f]))}}function Af(){--dc;var a=Ga;Ga=null;for(var b=0;b<a.length;++b)a[b]()}function ra(a,b,c){J(a,c||b.type,a,b);return ed(b)||b.codemirrorIgnore}function ea(a,b){var c=a._handlers&&
+a._handlers[b];return c&&0<c.length}function lb(a){a.prototype.on=function(a,c){y(this,a,c)};a.prototype.off=function(a,c){Ha(this,a,c)}}function Hc(){this.id=null}function fe(a,b,c){for(var d=0,e=0;;){var f=a.indexOf("\t",d);-1==f&&(f=a.length);var g=f-d;if(f==a.length||e+g>=b)return d+Math.min(g,b-e);e+=f-d;e+=c-e%c;d=f+1;if(e>=b)return d}}function ue(a){for(;Ec.length<=a;)Ec.push(E(Ec)+" ");return Ec[a]}function E(a){return a[a.length-1]}function S(a,b){for(var c=0;c<a.length;++c)if(a[c]==b)return c;
+return-1}function ld(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function Je(a,b){if(Object.create)var c=Object.create(a);else c=function(){},c.prototype=a,c=new c;b&&yc(b,c);return c}function yc(a,b){b||(b={});for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function ia(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function Ke(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function Ab(a){return 768<=a.charCodeAt(0)&&
+Bf.test(a)}function t(a,b,c,d){a=document.createElement(a);c&&(a.className=c);d&&(a.style.cssText=d);if("string"==typeof b)a.appendChild(document.createTextNode(b));else if(b)for(c=0;c<b.length;++c)a.appendChild(b[c]);return a}function Ma(a){for(var b=a.childNodes.length;0<b;--b)a.removeChild(a.firstChild);return a}function na(a,b){return Ma(a).appendChild(b)}function Xd(a,b){if(a.contains)return a.contains(b);for(;b=b.parentNode;)if(b==a)return!0}function Ca(){return document.activeElement}function ub(a){if(null!=
+Fb)return Fb;var b=t("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");na(a,b);b.offsetWidth&&(Fb=b.offsetHeight-b.clientHeight);return Fb||0}function yf(a){if(null==rd){var b=t("span","\u200b");na(a,t("span",[b,document.createTextNode("x")]));0!=a.firstChild.offsetHeight&&(rd=1>=b.offsetWidth&&2<b.offsetHeight&&!qb)}return rd?t("span","\u200b"):t("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px")}function Ve(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,
+f=0;f<a.length;++f){var g=a[f];if(g.from<c&&g.to>b||b==c&&g.to==b)d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0}e||d(b,c,"ltr")}function Uc(a){return a.level%2?a.to:a.from}function Vc(a){return a.level%2?a.from:a.to}function bc(a){return(a=oa(a))?Uc(a[0]):0}function cc(a){var b=oa(a);return b?Vc(E(b)):a.text.length}function Le(a,b){var c=w(a.doc,b),d=pa(c);d!=c&&(b=G(d));d=(c=oa(d))?c[0].level%2?cc(d):bc(d):0;return q(b,d)}function Wc(a,b){Cb=null;for(var c=0,d;c<a.length;++c){var e=
+a[c];if(e.from<b&&e.to>b)return c;if(e.from==b||e.to==b)if(null==d)d=c;else{var f=e.level;var g=a[d].level,h=a[0].level;f=f==h?!0:g==h?!1:f<g;if(f)return e.from!=e.to&&(Cb=d),c;e.from!=e.to&&(Cb=c);break}}return d}function sd(a,b,c,d){if(!d)return b+c;do b+=c;while(0<b&&Ab(a.text.charAt(b)));return b}function Yc(a,b,c,d){var e=oa(a);if(!e)return ve(a,b,c,d);var f=Wc(e,b),g=e[f];for(b=sd(a,b,g.level%2?-c:c,d);;){if(b>g.from&&b<g.to)return b;if(b==g.from||b==g.to){if(Wc(e,b)==f)return b;g=e[f+c];return 0<
+c==g.level%2?g.to:g.from}g=e[f+=c];if(!g)return null;b=0<c==g.level%2?sd(a,g.to,-1,d):sd(a,g.from,1,d)}}function ve(a,b,c,d){b+=c;if(d)for(;0<b&&Ab(a.text.charAt(b));)b+=c;return 0>b||b>a.text.length?null:b}var Gb=/gecko\/\d/i.test(navigator.userAgent),da=/MSIE \d/.test(navigator.userAgent),qb=da&&(null==document.documentMode||8>document.documentMode),R=da&&(null==document.documentMode||9>document.documentMode),hf=da&&(null==document.documentMode||10>document.documentMode),Cf=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent),
+X=da||Cf,Z=/WebKit\//.test(navigator.userAgent),Df=Z&&/Qt\/\d+\.\d+/.test(navigator.userAgent),Ef=/Chrome\//.test(navigator.userAgent),fa=/Opera\//.test(navigator.userAgent),de=/Apple Computer/.test(navigator.vendor),Lc=/KHTML\//.test(navigator.userAgent),Qe=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),Re=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),af=/PhantomJS/.test(navigator.userAgent),pb=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),
+Gc=pb||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),Pa=pb||/Mac/.test(navigator.platform),Ff=/win/i.test(navigator.platform),Wa=fa&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Wa&&(Wa=Number(Wa[1]));Wa&&15<=Wa&&(fa=!1,Z=!0);var Me=Pa&&(Df||fa&&(null==Wa||12.11>Wa)),dd=Gb||X&&!R,ne=!1,Ea=!1,q=k.Pos=function(a,b){if(!(this instanceof q))return new q(a,b);this.line=a;this.ch=b},B=k.cmpPos=function(a,b){return a.line-b.line||a.ch-b.ch};ya.prototype={primary:function(){return this.ranges[this.primIndex]},
+equals:function(a){if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;for(var b=0;b<this.ranges.length;b++){var c=this.ranges[b],d=a.ranges[b];if(0!=B(c.anchor,d.anchor)||0!=B(c.head,d.head))return!1}return!0},deepCopy:function(){for(var a=[],b=0;b<this.ranges.length;b++)a[b]=new F(Pc(this.ranges[b].anchor),Pc(this.ranges[b].head));return new ya(a,this.primIndex)},somethingSelected:function(){for(var a=0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return!0;
+return!1},contains:function(a,b){b||(b=a);for(var c=0;c<this.ranges.length;c++){var d=this.ranges[c];if(0<=B(b,d.from())&&0>=B(a,d.to()))return c}return-1}};F.prototype={from:function(){return Rc(this.anchor,this.head)},to:function(){return Qc(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Rd={left:0,right:0,top:0,bottom:0},Sa,$e=0,lc,kc,ce=0,oc=0,ha=null;X?ha=-.53:Gb?ha=15:Ef?ha=-.7:de&&(ha=-1/3);var je,gd=null,hd,ib=k.changeEnd=
+function(a){return a.text?q(a.from.line+a.text.length-1,E(a.text).length+(1==a.text.length?a.from.ch:0)):a.to};k.prototype={constructor:k,focus:function(){window.focus();Y(this);Eb(this)},setOption:function(a,b){var c=this.options,d=c[a];if(c[a]!=b||"mode"==a)c[a]=b,ab.hasOwnProperty(a)&&N(this,ab[a])(this,b,d)},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](a)},removeKeyMap:function(a){for(var b=this.state.keyMaps,
+c=0;c<b.length;++c)if(b[c]==a||"string"!=typeof b[c]&&b[c].name==a)return b.splice(c,1),!0},addOverlay:K(function(a,b){var c=a.token?a:k.getMode(this.options,a);if(c.startState)throw Error("Overlays may not be stateful.");this.state.overlays.push({mode:c,modeSpec:a,opaque:b&&b.opaque});this.state.modeGen++;ca(this)}),removeOverlay:K(function(a){for(var b=this.state.overlays,c=0;c<b.length;++c){var d=b[c].modeSpec;if(d==a||"string"==typeof a&&d.name==a){b.splice(c,1);this.state.modeGen++;ca(this);
+break}}}),indentLine:K(function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract");wb(this.doc,a)&&ic(this,a,b,c)}),indentSelection:K(function(a){for(var b=this.doc.sel.ranges,c=-1,d=0;d<b.length;d++){var e=b[d];if(e.empty())e.head.line>c&&(ic(this,e.head.line,a,!0),c=e.head.line,d==this.doc.sel.primIndex&&Qa(this));else{var f=Math.max(c,e.from().line);c=e.to();for(c=Math.min(this.lastLine(),c.line-(c.ch?0:1))+1;f<c;++f)ic(this,f,
+a)}}}),getTokenAt:function(a,b){var c=this.doc;a=x(c,a);var d=zb(this,a.line,b),e=this.doc.mode;c=w(c,a.line);for(c=new Cc(c.text,this.options.tabSize);c.pos<a.ch&&!c.eol();){c.start=c.pos;var f=e.token(c,d)}return{start:c.start,end:c.pos,string:c.current(),type:f||null,state:d}},getTokenTypeAt:function(a){a=x(this.doc,a);var b=De(this,w(this.doc,a.line)),c=0,d=(b.length-1)/2;a=a.ch;if(0==a)return b[2];for(;;){var e=c+d>>1;if((e?b[2*e-1]:0)>=a)d=e;else if(b[2*e+1]<a)c=e+1;else return b[2*e+2]}},getModeAt:function(a){var b=
+this.doc.mode;return b.innerMode?k.innerMode(b,this.getTokenAt(a).state).mode:b},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var c=[];if(!Xa.hasOwnProperty(b))return Xa;var d=Xa[b],e=this.getModeAt(a);if("string"==typeof e[b])d[e[b]]&&c.push(d[e[b]]);else if(e[b])for(var f=0;f<e[b].length;f++){var g=d[e[b][f]];g&&c.push(g)}else e.helperType&&d[e.helperType]?c.push(d[e.helperType]):d[e.name]&&c.push(d[e.name]);for(f=0;f<d._global.length;f++)g=d._global[f],g.pred(e,
+this)&&-1==S(c,g.val)&&c.push(g.val);return c},getStateAfter:function(a,b){var c=this.doc;a=Math.max(c.first,Math.min(null==a?c.first+c.size-1:a,c.first+c.size-1));return zb(this,a+1,b)},cursorCoords:function(a,b){var c=this.doc.sel.primary();c=null==a?c.head:"object"==typeof a?x(this.doc,a):a?c.from():c.to();return za(this,c,b||"page")},charCoords:function(a,b){return Yb(this,x(this.doc,a),b||"page")},coordsChar:function(a,b){a=Ud(this,a,b||"page");return Xc(this,a.left,a.top)},lineAtHeight:function(a,
+b){a=Ud(this,{top:a,left:0},b||"page").top;return Oa(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b){var c=!1,d=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>d&&(a=d,c=!0);d=w(this.doc,a);return Tc(this,d,{top:0,left:0},b||"page").top+(c?this.doc.height-la(d):0)},defaultTextHeight:function(){return Ka(this.display)},defaultCharWidth:function(){return sb(this.display)},setGutterMarker:K(function(a,b,c){return vc(this,a,"gutter",function(a){var d=a.gutterMarkers||
+(a.gutterMarkers={});d[b]=c;!c&&Ke(d)&&(a.gutterMarkers=null);return!0})}),clearGutter:K(function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,Ra(b,d,"gutter"),Ke(c.gutterMarkers)&&(c.gutterMarkers=null));++d})}),addLineClass:K(function(a,b,c){return vc(this,a,"class",function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass";if(a[d]){if((new RegExp("(?:^|\\s)"+c+"(?:$|\\s)")).test(a[d]))return!1;a[d]+=" "+c}else a[d]=
+c;return!0})}),removeLineClass:K(function(a,b,c){return vc(this,a,"class",function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass",f=a[d];if(f)if(null==c)a[d]=null;else{var g=f.match(new RegExp("(?:^|\\s+)"+c+"(?:$|\\s+)"));if(!g)return!1;var h=g.index+g[0].length;a[d]=f.slice(0,g.index)+(g.index&&h!=f.length?" ":"")+f.slice(h)||null}else return!1;return!0})}),addLineWidget:K(function(a,b,c){return sf(this,a,b,c)}),removeLineWidget:function(a){a.clear()},lineInfo:function(a){if("number"==
+typeof a){if(!wb(this.doc,a))return null;var b=a;a=w(this.doc,a);if(!a)return null}else if(b=G(a),null==b)return null;return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=za(this,x(this.doc,a));var g=a.bottom,h=a.left;b.style.position="absolute";f.sizer.appendChild(b);if("over"==
+d)g=a.top;else if("above"==d||"near"==d){var l=Math.max(f.wrapper.clientHeight,this.doc.height),m=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>l)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=l&&(g=a.bottom);h+b.offsetWidth>m&&(h=m-b.offsetWidth)}b.style.top=g+"px";b.style.left=b.style.right="";"right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/
+2),b.style.left=h+"px");c&&(a=ec(this,h,g,h+b.offsetWidth,g+b.offsetHeight),null!=a.scrollTop&&Db(this,a.scrollTop),null!=a.scrollLeft&&bb(this,a.scrollLeft))},triggerOnKeyDown:K(ae),triggerOnKeyPress:K(be),triggerOnKeyUp:K($d),execCommand:function(a){if(qc.hasOwnProperty(a))return qc[a](this)},findPosH:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);var f=0;for(a=x(this.doc,a);f<b&&(a=nd(this.doc,a,e,c,d),!a.hitSide);++f);return a},moveH:K(function(a,b){var c=this;c.extendSelectionsBy(function(d){return c.display.shift||
+c.doc.extend||d.empty()?nd(c.doc,d.head,a,b,c.options.rtlMoveVisually):0>a?d.from():d.to()},Ya)}),deleteH:K(function(a,b){var c=this.doc;this.doc.sel.somethingSelected()?c.replaceSelection("",null,"+delete"):wc(this,function(d){var e=nd(c,d.head,a,b,!1);return 0>a?{from:e,to:d.head}:{from:d.head,to:e}})}),findPosV:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);var f=0;for(a=x(this.doc,a);f<b&&(a=za(this,a,"div"),null==d?d=a.left:a.left=d,a=we(this,a,e,c),!a.hitSide);++f);return a},moveV:K(function(a,
+b){var c=this,d=this.doc,e=[],f=!c.display.shift&&!d.extend&&d.sel.somethingSelected();d.extendSelectionsBy(function(g){if(f)return 0>a?g.from():g.to();var h=za(c,g.head,"div");null!=g.goalColumn&&(h.left=g.goalColumn);e.push(h.left);var m=we(c,h,a,b);"page"==b&&g==d.sel.primary()&&tc(c,null,Yb(c,m,"div").top-h.top);return m},Ya);if(e.length)for(var g=0;g<d.sel.ranges.length;g++)d.sel.ranges[g].goalColumn=e[g]}),toggleOverwrite:function(a){if(null==a||a!=this.state.overwrite)(this.state.overwrite=
+!this.state.overwrite)?this.display.cursorDiv.className+=" CodeMirror-overwrite":this.display.cursorDiv.className=this.display.cursorDiv.className.replace(" CodeMirror-overwrite",""),J(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return Ca()==this.display.input},scrollTo:K(function(a,b){null==a&&null==b||uc(this);null!=a&&(this.curOp.scrollLeft=a);null!=b&&(this.curOp.scrollTop=b)}),getScrollInfo:function(){var a=this.display.scroller,b=wa;return{left:a.scrollLeft,top:a.scrollTop,
+height:a.scrollHeight-b,width:a.scrollWidth-b,clientHeight:a.clientHeight-b,clientWidth:a.clientWidth-b}},scrollIntoView:K(function(a,b){null==a?(a={from:this.doc.sel.primary().head,to:null},null==b&&(b=this.options.cursorScrollMargin)):"number"==typeof a?a={from:q(a,0),to:null}:null==a.from&&(a={from:a,to:null});a.to||(a.to=a.from);a.margin=b||0;if(null!=a.from.line)uc(this),this.curOp.scrollToPos=a;else{var c=ec(this,Math.min(a.from.left,a.to.left),Math.min(a.from.top,a.to.top)-a.margin,Math.max(a.from.right,
+a.to.right),Math.max(a.from.bottom,a.to.bottom)+a.margin);this.scrollTo(c.scrollLeft,c.scrollTop)}}),setSize:K(function(a,b){function c(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a}null!=a&&(this.display.wrapper.style.width=c(a));null!=b&&(this.display.wrapper.style.height=c(b));this.options.lineWrapping&&Td(this);this.curOp.forceUpdate=!0;J(this,"refresh",this)}),operation:function(a){return va(this,a)},refresh:K(function(){var a=this.display.cachedTextHeight;ca(this);tb(this);this.scrollTo(this.doc.scrollLeft,
+this.doc.scrollTop);(null==a||.5<Math.abs(a-Ka(this.display)))&&$a(this);J(this,"refresh",this)}),swapDoc:K(function(a){var b=this.doc;b.cm=null;wd(this,a);tb(this);ja(this);this.scrollTo(a.scrollLeft,a.scrollTop);O(this,"swapDoc",this,b);return b}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};lb(k);var vd=k.defaults=
+{},ab=k.optionHandlers={},xd=k.Init={toString:function(){return"CodeMirror.Init"}};C("value","",function(a,b){a.setValue(b)},!0);C("mode",null,function(a,b){a.doc.modeOption=b;Aa(a)},!0);C("indentUnit",2,Aa,!0);C("indentWithTabs",!1);C("smartIndent",!0);C("tabSize",4,function(a){H(a);tb(a);ca(a)},!0);C("specialChars",/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g,function(a,b){a.options.specialChars=new RegExp(b.source+(b.test("\t")?"":"|\t"),"g");a.refresh()},!0);C("specialCharPlaceholder",function(a){var b=
+t("span","\u2022","cm-invalidchar");b.title="\\u"+a.charCodeAt(0).toString(16);return b},function(a){a.refresh()},!0);C("electricChars",!0);C("rtlMoveVisually",!Ff);C("wholeLineUpdateBefore",!0);C("theme","default",function(a){ob(a);Ba(a)},!0);C("keyMap","default",nb);C("extraKeys",null);C("lineWrapping",!1,function(a){a.options.lineWrapping?(a.display.wrapper.className+=" CodeMirror-wrap",a.display.sizer.style.minWidth=""):(a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-wrap",
+""),ta(a));$a(a);ca(a);tb(a);setTimeout(function(){Ja(a)},100)},!0);C("gutters",[],function(a){L(a.options);Ba(a)},!0);C("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?U(a.display)+"px":"0";a.refresh()},!0);C("coverGutterNextToScrollbar",!1,Ja,!0);C("lineNumbers",!1,function(a){L(a.options);Ba(a)},!0);C("firstLineNumber",1,Ba,!0);C("lineNumberFormatter",function(a){return a},Ba,!0);C("showCursorWhenSelecting",!1,Oc,!0);C("resetSelectionOnContextMenu",!0);C("readOnly",!1,function(a,
+b){"nocursor"==b?(Jc(a),a.display.input.blur(),a.display.disabled=!0):(a.display.disabled=!1,b||ja(a))});C("disableInput",!1,function(a,b){b||ja(a)},!0);C("dragDrop",!0);C("cursorBlinkRate",530);C("cursorScrollMargin",0);C("cursorHeight",1);C("workTime",100);C("workDelay",100);C("flattenSpans",!0,H,!0);C("addModeClass",!1,H,!0);C("pollInterval",100);C("undoDepth",200,function(a,b){a.doc.history.undoDepth=b});C("historyEventDelay",1250);C("viewportMargin",10,function(a){a.refresh()},!0);C("maxHighlightLength",
+1E4,H,!0);C("moveInputWithCursor",!0,function(a,b){b||(a.display.inputDiv.style.top=a.display.inputDiv.style.left=0)});C("tabindex",null,function(a,b){a.display.input.tabIndex=b||""});C("autofocus",null);var Ne=k.modes={},Nb=k.mimeModes={};k.defineMode=function(a,b){k.defaults.mode||"null"==a||(k.defaults.mode=a);if(2<arguments.length){b.dependencies=[];for(var c=2;c<arguments.length;++c)b.dependencies.push(arguments[c])}Ne[a]=b};k.defineMIME=function(a,b){Nb[a]=b};k.resolveMode=function(a){if("string"==
+typeof a&&Nb.hasOwnProperty(a))a=Nb[a];else if(a&&"string"==typeof a.name&&Nb.hasOwnProperty(a.name)){var b=Nb[a.name];"string"==typeof b&&(b={name:b});a=Je(b,a);a.name=b.name}else if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return k.resolveMode("application/xml");return"string"==typeof a?{name:a}:a||{name:"null"}};k.getMode=function(a,b){b=k.resolveMode(b);var c=Ne[b.name];if(!c)return k.getMode(a,"text/plain");c=c(a,b);if(Ob.hasOwnProperty(b.name)){var d=Ob[b.name],e;for(e in d)d.hasOwnProperty(e)&&
+(c.hasOwnProperty(e)&&(c["_"+e]=c[e]),c[e]=d[e])}c.name=b.name;b.helperType&&(c.helperType=b.helperType);if(b.modeProps)for(e in b.modeProps)c[e]=b.modeProps[e];return c};k.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}});k.defineMIME("text/plain","null");var Ob=k.modeExtensions={};k.extendMode=function(a,b){var c=Ob.hasOwnProperty(a)?Ob[a]:Ob[a]={};yc(b,c)};k.defineExtension=function(a,b){k.prototype[a]=b};k.defineDocExtension=function(a,b){W.prototype[a]=b};k.defineOption=
+C;var Kc=[];k.defineInitHook=function(a){Kc.push(a)};var Xa=k.helpers={};k.registerHelper=function(a,b,c){Xa.hasOwnProperty(a)||(Xa[a]=k[a]={_global:[]});Xa[a][b]=c};k.registerGlobalHelper=function(a,b,c,d){k.registerHelper(a,b,d);Xa[a]._global.push({pred:c,val:d})};var yb=k.copyState=function(a,b){if(!0===b)return b;if(a.copyState)return a.copyState(b);var c={},d;for(d in b){var e=b[d];e instanceof Array&&(e=e.concat([]));c[d]=e}return c},Ye=k.startState=function(a,b,c){return a.startState?a.startState(b,
+c):!0};k.innerMode=function(a,b){for(;a.innerMode;){var c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state;a=c.mode}return c||{mode:a,state:b}};var qc=k.commands={selectAll:function(a){a.setSelection(q(a.firstLine(),0),q(a.lastLine()),cb)},singleSelection:function(a){a.setSelection(a.getCursor("anchor"),a.getCursor("head"),cb)},killLine:function(a){wc(a,function(b){if(b.empty()){var c=w(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:q(b.head.line+1,0)}:
+{from:b.head,to:q(b.head.line,c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){wc(a,function(b){return{from:q(b.from().line,0),to:x(a.doc,q(b.to().line+1,0))}})},delLineLeft:function(a){wc(a,function(a){return{from:q(a.from().line,0),to:a.from()}})},undo:function(a){a.undo()},redo:function(a){a.redo()},undoSelection:function(a){a.undoSelection()},redoSelection:function(a){a.redoSelection()},goDocStart:function(a){a.extendSelection(q(a.firstLine(),0))},goDocEnd:function(a){a.extendSelection(q(a.lastLine()))},
+goLineStart:function(a){a.extendSelectionsBy(function(b){return Le(a,b.head.line)},Ya)},goLineStartSmart:function(a){a.extendSelectionsBy(function(b){var c=Le(a,b.head.line),d=a.getLineHandle(c.line),e=oa(d);return e&&0!=e[0].level?c:(d=Math.max(0,d.text.search(/\S/)),q(c.line,b.head.line==c.line&&b.head.ch<=d&&b.head.ch?0:d))},Ya)},goLineEnd:function(a){a.extendSelectionsBy(function(b){b=b.head.line;for(var c,d=w(a.doc,b);c=Na(d,!1);)d=c.find(1,!0).line,b=null;c=(c=oa(d))?c[0].level%2?bc(d):cc(d):
+d.text.length;return q(null==b?G(d):b,c)},Ya)},goLineRight:function(a){a.extendSelectionsBy(function(b){b=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:b},"div")},Ya)},goLineLeft:function(a){a.extendSelectionsBy(function(b){b=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:b},"div")},Ya)},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1,
+"page")},goCharLeft:function(a){a.moveH(-1,"char")},goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goGroupRight:function(a){a.moveH(1,"group")},goGroupLeft:function(a){a.moveH(-1,"group")},goWordRight:function(a){a.moveH(1,"word")},delCharBefore:function(a){a.deleteH(-1,"char")},delCharAfter:function(a){a.deleteH(1,"char")},delWordBefore:function(a){a.deleteH(-1,"word")},
+delWordAfter:function(a){a.deleteH(1,"word")},delGroupBefore:function(a){a.deleteH(-1,"group")},delGroupAfter:function(a){a.deleteH(1,"group")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection("\t")},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){va(a,function(){for(var b=a.listSelections(),
+c=0;c<b.length;c++){var d=b[c].head,e=w(a.doc,d.line).text;0<d.ch&&d.ch<e.length-1&&a.replaceRange(e.charAt(d.ch)+e.charAt(d.ch-1),q(d.line,d.ch-1),q(d.line,d.ch+1))}})},newlineAndIndent:function(a){va(a,function(){for(var b=a.listSelections().length,c=0;c<b;c++){var d=a.listSelections()[c];a.replaceRange("\n",d.anchor,d.head,"+input");a.indentLine(d.from().line+1,null,!0);Qa(a)}})},toggleOverwrite:function(a){a.toggleOverwrite()}},xa=k.keyMap={};xa.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",
+Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"};xa.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goGroupLeft",
+"Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"};xa.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo",
+"Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delLineLeft","Cmd-U":"undoSelection",
+"Shift-Cmd-U":"redoSelection",fallthrough:["basic","emacsy"]};xa.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"};xa["default"]=Pa?xa.macDefault:xa.pcDefault;var rc=k.lookupKey=
+function(a,b,c){function d(b){b=fd(b);var e=b[a];if(!1===e)return"stop";if(null!=e&&c(e))return!0;if(b.nofallthrough)return"stop";b=b.fallthrough;if(null==b)return!1;if("[object Array]"!=Object.prototype.toString.call(b))return d(b);for(e=0;e<b.length;++e){var f=d(b[e]);if(f)return f}return!1}for(var e=0;e<b.length;++e){var f=d(b[e]);if(f)return"stop"!=f}},jf=k.isModifierKey=function(a){a=Ia[a.keyCode];return"Ctrl"==a||"Alt"==a||"Shift"==a||"Mod"==a},kf=k.keyName=function(a,b){if(fa&&34==a.keyCode&&
+a["char"])return!1;var c=Ia[a.keyCode];if(null==c||a.altGraphKey)return!1;a.altKey&&(c="Alt-"+c);if(Me?a.metaKey:a.ctrlKey)c="Ctrl-"+c;if(Me?a.ctrlKey:a.metaKey)c="Cmd-"+c;!b&&a.shiftKey&&(c="Shift-"+c);return c};k.fromTextArea=function(a,b){function c(){a.value=h.getValue()}b||(b={});b.value=a.value;!b.tabindex&&a.tabindex&&(b.tabindex=a.tabindex);!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder);if(null==b.autofocus){var d=Ca();b.autofocus=d==a||null!=a.getAttribute("autofocus")&&d==
+document.body}if(a.form&&(y(a.form,"submit",c),!b.leaveSubmitMethodAlone)){var e=a.form,f=e.submit;try{var g=e.submit=function(){c();e.submit=f;e.submit();e.submit=g}}catch(l){}}a.style.display="none";var h=k(function(b){a.parentNode.insertBefore(b,a.nextSibling)},b);h.save=c;h.getTextArea=function(){return a};h.toTextArea=function(){c();a.parentNode.removeChild(h.getWrapperElement());a.style.display="";a.form&&(Ha(a.form,"submit",c),"function"==typeof a.form.submit&&(a.form.submit=f))};return h};
+var Cc=k.StringStream=function(a,b){this.pos=this.start=0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0};Cc.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(a){var b=this.string.charAt(this.pos);if("string"==typeof a?b==a:b&&(a.test?a.test(b):
+a(b)))return++this.pos,b},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){a=this.string.indexOf(a,this.pos);if(-1<a)return this.pos=a,!0},backUp:function(a){this.pos-=a},column:function(){this.lastColumnPos<this.start&&(this.lastColumnValue=qa(this.string,this.start,this.tabSize,this.lastColumnPos,
+this.lastColumnValue),this.lastColumnPos=this.start);return this.lastColumnValue-(this.lineStart?qa(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return qa(this.string,null,this.tabSize)-(this.lineStart?qa(this.string,this.lineStart,this.tabSize):0)},match:function(a,b,c){if("string"==typeof a){var d=function(a){return c?a.toLowerCase():a},e=this.string.substr(this.pos,a.length);if(d(e)==d(a))return!1!==b&&(this.pos+=a.length),!0}else{if((a=this.string.slice(this.pos).match(a))&&
+0<a.index)return null;a&&!1!==b&&(this.pos+=a[0].length);return a}},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}}};var Ua=k.TextMarker=function(a,b){this.lines=[];this.type=b;this.doc=a};lb(Ua);Ua.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;b&&db(a);if(ea(this,"clear")){var c=this.find();c&&O(this,"clear",c.from,c.to)}for(var d=c=null,e=0;e<this.lines.length;++e){var f=
+this.lines[e],g=Kb(f.markedSpans,this);a&&!this.collapsed?Ra(a,G(f),"text"):a&&(null!=g.to&&(d=G(f)),null!=g.from&&(c=G(f)));for(var h=f,l=void 0,m=f.markedSpans,n=g,k=0;k<m.length;++k)m[k]!=n&&(l||(l=[])).push(m[k]);h.markedSpans=l;null==g.from&&this.collapsed&&!La(this.doc,f)&&a&&ka(f,Ka(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(e=0;e<this.lines.length;++e)f=pa(this.lines[e]),g=V(f),g>a.display.maxLineLength&&(a.display.maxLine=f,a.display.maxLineLength=g,a.display.maxLineChanged=
+!0);null!=c&&a&&this.collapsed&&ca(a,c,d+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Md(a.doc));a&&O(a,"markerCleared",a,this);b&&eb(a)}};Ua.prototype.find=function(a,b){null==a&&"bookmark"==this.type&&(a=1);for(var c,d,e=0;e<this.lines.length;++e){var f=this.lines[e],g=Kb(f.markedSpans,this);if(null!=g.from&&(c=q(b?f:G(f),g.from),-1==a))return c;if(null!=g.to&&(d=q(b?f:G(f),g.to),1==a))return d}return c&&{from:c,to:d}};Ua.prototype.changed=
+function(){var a=this.find(-1,!0),b=this,c=this.doc.cm;a&&c&&va(c,function(){var d=a.line,e=G(a.line);if(e=Pd(c,e))Sd(e),c.curOp.selectionChanged=c.curOp.forceUpdate=!0;c.curOp.updateMaxLine=!0;La(b.doc,d)||null==b.height||(e=b.height,b.height=null,(e=Bb(b)-e)&&ka(d,d.height+e))})};Ua.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=S(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)};
+Ua.prototype.detachLine=function(a){this.lines.splice(S(this.lines,a),1);!this.lines.length&&this.doc.cm&&(a=this.doc.cm.curOp,(a.maybeHiddenMarkers||(a.maybeHiddenMarkers=[])).push(this))};var qf=0,Ac=k.SharedTextMarker=function(a,b){this.markers=a;this.primary=b;for(var c=0,d=this;c<a.length;++c)a[c].parent=this,y(a[c],"clear",function(){d.clear()})};lb(Ac);Ac.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();
+O(this,"clear")}};Ac.prototype.find=function(a,b){return this.primary.find(a,b)};var Bc=k.LineWidget=function(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.cm=a;this.node=b};lb(Bc);Bc.prototype.clear=function(){var a=this.cm,b=this.line.widgets,c=this.line,d=G(c);if(null!=d&&b){for(var e=0;e<b.length;++e)b[e]==this&&b.splice(e--,1);b.length||(c.widgets=null);var f=Bb(this);va(a,function(){var b=-f;la(c)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&tc(a,null,b);Ra(a,d,"widget");
+ka(c,Math.max(0,c.height-f))})}};Bc.prototype.changed=function(){var a=this.height,b=this.cm,c=this.line;this.height=null;var d=Bb(this)-a;d&&va(b,function(){b.curOp.forceUpdate=!0;la(c)<(b.curOp&&b.curOp.scrollTop||b.doc.scrollTop)&&tc(b,null,d);ka(c,c.height+d)})};var Va=k.Line=function(a,b,c){this.text=a;Ae(this,b);this.height=c?c(this):1};lb(Va);Va.prototype.lineNo=function(){return G(this)};var uf={},tf={};Lb.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=
+a,d=a+b;c<d;++c){var e=this.lines[c];this.height-=e.height;var f=e;f.parent=null;ze(f);O(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,c){this.height+=c;this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(a=0;a<b.length;++a)b[a].parent=this},iterN:function(a,b,c){for(b=a+b;a<b;++a)if(c(this.lines[a]))return!0}};Mb.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var c=
+0;c<this.children.length;++c){var d=this.children[c],e=d.chunkSize();if(a<e){var f=Math.min(b,e-a),g=d.height;d.removeInner(a,f);this.height-=g-d.height;e==f&&(this.children.splice(c--,1),d.parent=null);if(0==(b-=f))break;a=0}else a-=e}25>this.size-b&&(1<this.children.length||!(this.children[0]instanceof Lb))&&(c=[],this.collapse(c),this.children=[new Lb(c)],this.children[0].parent=this)},collapse:function(a){for(var b=0;b<this.children.length;++b)this.children[b].collapse(a)},insertInner:function(a,
+b,c){this.size+=b.length;this.height+=c;for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<=f){e.insertInner(a,b,c);if(e.lines&&50<e.lines.length){for(;50<e.lines.length;)a=e.lines.splice(e.lines.length-25,25),a=new Lb(a),e.height-=a.height,this.children.splice(d+1,0,a),a.parent=this;this.maybeSpill()}break}a-=f}},maybeSpill:function(){if(!(10>=this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5);b=new Mb(b);if(a.parent){a.size-=b.size;
+a.height-=b.height;var c=S(a.parent.children,a);a.parent.children.splice(c+1,0,b)}else c=new Mb(a.children),c.parent=a,a.children=[c,b],a=c;b.parent=a.parent}while(10<a.children.length);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<f){f=Math.min(b,f-a);if(e.iterN(a,f,c))return!0;if(0==(b-=f))break;a=0}else a-=f}}};var Gf=0,W=k.Doc=function(a,b,c){if(!(this instanceof W))return new W(a,b,c);null==c&&(c=0);Mb.call(this,
+[new Lb([new Va("",null)])]);this.first=c;this.scrollTop=this.scrollLeft=0;this.cantEdit=!1;this.cleanGeneration=1;this.frontier=c;c=q(c,0);this.sel=Fa(c);this.history=new Dc(null);this.id=++Gf;this.modeOption=b;"string"==typeof a&&(a=fb(a));md(this,{from:c,to:c,text:a});Q(this,Fa(c),cb)};W.prototype=Je(Mb.prototype,{constructor:W,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0;d<b.length;++d)c+=b[d].height;
+this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=qd(this,this.first,this.first+this.size);return!1===a?b:b.join(a||"\n")},setValue:aa(function(a){var b=q(this.first,0),c=this.first+this.size-1;gb(this,{from:b,to:q(c,w(this,c).text.length),text:fb(a),origin:"setValue"},!0);Q(this,Fa(b))}),replaceRange:function(a,b,c,d){b=x(this,b);c=c?x(this,c):b;nc(this,a,b,c,d)},getRange:function(a,b,c){a=Ib(this,x(this,a),x(this,b));return!1===
+c?a:a.join(c||"\n")},getLine:function(a){return(a=this.getLineHandle(a))&&a.text},getLineHandle:function(a){if(wb(this,a))return w(this,a)},getLineNumber:function(a){return G(a)},getLineHandleVisualStart:function(a){"number"==typeof a&&(a=w(this,a));return pa(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return x(this,a)},getCursor:function(a){var b=this.sel.primary();return null==a||"head"==
+a?b.head:"anchor"==a?b.anchor:"end"==a||"to"==a||!1===a?b.to():b.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:aa(function(a,b,c){a=x(this,"number"==typeof a?q(a,b||0):a);Q(this,Fa(a,null),c)}),setSelection:aa(function(a,b,c){var d=x(this,a);a=x(this,b||a);Q(this,Fa(d,a),c)}),extendSelection:aa(function(a,b,c){Ub(this,x(this,a),b&&x(this,b),c)}),extendSelections:aa(function(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=
+x(this,a[d]);Gd(this,c)}),extendSelectionsBy:aa(function(a,b){Gd(this,ld(this.sel.ranges,a),b)}),setSelections:aa(function(a,b,c){if(a.length){for(var d=0,e=[];d<a.length;d++)e[d]=new F(x(this,a[d].anchor),x(this,a[d].head));null==b&&(b=Math.min(a.length-1,this.sel.primIndex));Q(this,ma(e,b),c)}}),addSelection:aa(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new F(x(this,a),x(this,b||a)));Q(this,ma(d,d.length-1),c)}),getSelection:function(a){for(var b=this.sel.ranges,c,d=0;d<b.length;d++){var e=
+Ib(this,b[d].from(),b[d].to());c=c?c.concat(e):e}return!1===a?c:c.join(a||"\n")},getSelections:function(a){for(var b=[],c=this.sel.ranges,d=0;d<c.length;d++){var e=Ib(this,c[d].from(),c[d].to());!1!==a&&(e=e.join(a||"\n"));b[d]=e}return b},replaceSelection:aa(function(a,b,c){for(var d=[],e=0;e<this.sel.ranges.length;e++)d[e]=a;this.replaceSelections(d,b,c||"+input")}),replaceSelections:function(a,b,c){for(var d=[],e=this.sel,f=0;f<e.ranges.length;f++){var g=e.ranges[f];d[f]={from:g.from(),to:g.to(),
+text:fb(a[f]),origin:c}}if(f=b&&"end"!=b){f=[];c=a=q(this.first,0);for(e=0;e<d.length;e++){var h=d[e];g=le(h.from,a,c);var l=le(ib(h),a,c);a=h.to;c=l;"around"==b?(h=this.sel.ranges[e],h=0>B(h.head,h.anchor),f[e]=new F(h?l:g,h?g:l)):f[e]=new F(g,g)}f=new ya(f,this.sel.primIndex)}b=f;for(f=d.length-1;0<=f;f--)gb(this,d[f]);b?Id(this,b):this.cm&&Qa(this.cm)},undo:aa(function(){sc(this,"undo")}),redo:aa(function(){sc(this,"redo")}),undoSelection:aa(function(){sc(this,"undo",!0)}),redoSelection:aa(function(){sc(this,
+"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d<a.done.length;d++)a.done[d].ranges||++b;for(d=0;d<a.undone.length;d++)a.undone[d].ranges||++c;return{undo:b,redo:c}},clearHistory:function(){this.history=new Dc(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(a){a&&(this.history.lastOp=this.history.lastOrigin=null);return this.history.generation},
+isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:kb(this.history.done),undone:kb(this.history.undone)}},setHistory:function(a){var b=this.history=new Dc(this.history.maxGeneration);b.done=kb(a.done.slice(0),null,!0);b.undone=kb(a.undone.slice(0),null,!0)},markText:function(a,b,c){return Jb(this,x(this,a),x(this,b),c,"range")},setBookmark:function(a,b){var c={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:!1,
+shared:b&&b.shared};a=x(this,a);return Jb(this,a,a,c,"bookmark")},findMarksAt:function(a){a=x(this,a);var b=[],c=w(this,a.line).markedSpans;if(c)for(var d=0;d<c.length;++d){var e=c[d];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b){a=x(this,a);b=x(this,b);var c=[],d=a.line;this.iter(a.line,b.line+1,function(e){if(e=e.markedSpans)for(var f=0;f<e.length;f++){var g=e[f];d==a.line&&a.ch>g.to||null==g.from&&d!=a.line||d==b.line&&
+g.from>b.ch||c.push(g.marker.parent||g.marker)}++d});return c},getAllMarks:function(){var a=[];this.iter(function(b){if(b=b.markedSpans)for(var c=0;c<b.length;++c)null!=b[c].from&&a.push(b[c].marker)});return a},posFromIndex:function(a){var b,c=this.first;this.iter(function(d){d=d.text.length+1;if(d>a)return b=a,!0;a-=d;++c});return x(this,q(c,b))},indexFromPos:function(a){a=x(this,a);var b=a.ch;if(a.line<this.first||0>a.ch)return 0;this.iter(this.first,a.line,function(a){b+=a.text.length+1});return b},
+copy:function(a){var b=new W(qd(this,this.first,this.first+this.size),this.modeOption,this.first);b.scrollTop=this.scrollTop;b.scrollLeft=this.scrollLeft;b.sel=this.sel;b.extend=!1;a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory()));return b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from);null!=a.to&&a.to<c&&(c=a.to);b=new W(qd(this,b,c),a.mode||this.modeOption,b);a.sharedHist&&(b.history=this.history);(this.linked||
+(this.linked=[])).push({doc:b,sharedHist:a.sharedHist});b.linked=[{doc:this,isParent:!0,sharedHist:a.sharedHist}];return b},unlinkDoc:function(a){a instanceof k&&(a=a.doc);if(this.linked)for(var b=0;b<this.linked.length;++b)if(this.linked[b].doc==a){this.linked.splice(b,1);a.unlinkDoc(this);break}if(a.history==this.history){var c=[a.id];jb(a,function(a){c.push(a.id)},!0);a.history=new Dc(null);a.history.done=kb(this.history.done,c);a.history.undone=kb(this.history.undone,c)}},iterLinkedDocs:function(a){jb(this,
+a)},getMode:function(){return this.mode},getEditor:function(){return this.cm}});W.prototype.eachLine=W.prototype.iter;var Hf=["iter","insert","remove","copy","getEditor"],Pb;for(Pb in W.prototype)W.prototype.hasOwnProperty(Pb)&&0>S(Hf,Pb)&&(k.prototype[Pb]=function(a){return function(){return a.apply(this.doc,arguments)}}(W.prototype[Pb]));lb(W);var T=k.e_preventDefault=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1},If=k.e_stopPropagation=function(a){a.stopPropagation?a.stopPropagation():
+a.cancelBubble=!0},ad=k.e_stop=function(a){T(a);If(a)},y=k.on=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):(a=a._handlers||(a._handlers={}),(a[b]||(a[b]=[])).push(c))},Ha=k.off=function(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else if(a=a._handlers&&a._handlers[b])for(b=0;b<a.length;++b)if(a[b]==c){a.splice(b,1);break}},J=k.signal=function(a,b){var c=a._handlers&&a._handlers[b];
+if(c)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)},Ga,dc=0,wa=30,ge=k.Pass={toString:function(){return"CodeMirror.Pass"}},cb={scroll:!1},mc={origin:"*mouse"},Ya={origin:"+move"};Hc.prototype.set=function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)};var qa=k.countColumn=function(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));d=d||0;for(e=e||0;;){var f=a.indexOf("\t",d);if(0>f||f>=b)return e+(b-d);e+=f-d;e+=c-e%c;d=f+1}},Ec=[""],
+jc=function(a){a.select()};pb?jc=function(a){a.selectionStart=0;a.selectionEnd=a.value.length}:X&&(jc=function(a){try{a.select()}catch(b){}});[].indexOf&&(S=function(a,b){return a.indexOf(b)});[].map&&(ld=function(a,b){return a.map(b)});var Jf=/[\u00df\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,xc=k.isWordChar=function(a){return/\w/.test(a)||"\u0080"<a&&(a.toUpperCase()!=a.toLowerCase()||Jf.test(a))},Bf=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;
+var $b=document.createRange?function(a,b,c){var d=document.createRange();d.setEnd(a,c);d.setStart(a,b);return d}:function(a,b,c){var d=document.body.createTextRange();d.moveToElementText(a.parentNode);d.collapse(!0);d.moveEnd("character",c);d.moveStart("character",b);return d};da&&(Ca=function(){try{return document.activeElement}catch(a){return document.body}});var ef=function(){if(R)return!1;var a=t("div");return"draggable"in a||"dragDrop"in a}(),Fb,rd,pd,fb=k.splitLines=3!="\n\nb".split(/\n/).length?
+function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)},bf=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},Wd=
+function(){var a=t("div");if("oncopy"in a)return!0;a.setAttribute("oncopy","return;");return"function"==typeof a.oncopy}(),Ia={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",
+219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};k.keyNames=Ia;(function(){for(var a=0;10>a;a++)Ia[a+48]=Ia[a+96]=String(a);for(a=65;90>=a;a++)Ia[a]=String.fromCharCode(a);for(a=1;12>=a;a++)Ia[a+111]=Ia[a+63235]="F"+a})();var Cb,zf=function(){function a(a){return 247>=a?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(a):
+1424<=a&&1524>=a?"R":1536<=a&&1773>=a?"rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm".charAt(a-1536):1774<=a&&2220>=a?"r":8192<=a&&8203>=a?"w":8204==a?"b":"L"}function b(a,b,c){this.level=a;this.from=b;this.to=c}var c=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,d=/[stwN]/,e=/[LRr]/,f=/[Lb1n]/,g=/[1n]/;return function(h){if(!c.test(h))return!1;
+for(var l=h.length,m=[],k=0,q;k<l;++k)m.push(a(h.charCodeAt(k)));k=0;for(var p="L";k<l;++k)q=m[k],"m"==q?m[k]=p:p=q;k=0;for(p="L";k<l;++k)q=m[k],"1"==q&&"r"==p?m[k]="n":e.test(q)&&(p=q,"r"==q&&(m[k]="R"));k=1;for(p=m[0];k<l-1;++k)q=m[k],"+"==q&&"1"==p&&"1"==m[k+1]?m[k]="1":","!=q||p!=m[k+1]||"1"!=p&&"n"!=p||(m[k]=p),p=q;for(k=0;k<l;++k)if(q=m[k],","==q)m[k]="N";else if("%"==q){for(p=k+1;p<l&&"%"==m[p];++p);var t=k&&"!"==m[k-1]||p<l&&"1"==m[p]?"1":"N";for(q=k;q<p;++q)m[q]=t;k=p-1}k=0;for(p="L";k<l;++k)q=
+m[k],"L"==p&&"1"==q?m[k]="L":e.test(q)&&(p=q);for(k=0;k<l;++k)if(d.test(m[k])){for(p=k+1;p<l&&d.test(m[p]);++p);q="L"==(p<l?m[p]:"L");t="L"==(k?m[k-1]:"L")||q?"L":"R";for(q=k;q<p;++q)m[q]=t;k=p-1}p=[];var r;for(k=0;k<l;)if(f.test(m[k])){q=k;for(++k;k<l&&f.test(m[k]);++k);p.push(new b(0,q,k))}else{var u=k;t=p.length;for(++k;k<l&&"L"!=m[k];++k);for(q=u;q<k;)if(g.test(m[q])){u<q&&p.splice(t,0,new b(1,u,q));u=q;for(++q;q<k&&g.test(m[q]);++q);p.splice(t,0,new b(2,u,q));u=q}else++q;u<k&&p.splice(t,0,new b(1,
+u,k))}1==p[0].level&&(r=h.match(/^\s+/))&&(p[0].from=r[0].length,p.unshift(new b(0,0,r[0].length)));1==E(p).level&&(r=h.match(/\s+$/))&&(E(p).to-=r[0].length,p.push(new b(0,l-r[0].length,l)));p[0].level!=E(p).level&&p.push(new b(p[0].level,l,l));return p}}();k.version="4.0.3";return k}); \ No newline at end of file
diff --git a/static/jquery.min.js b/static/jquery.min.js
new file mode 100644
index 0000000..06ac263
--- /dev/null
+++ b/static/jquery.min.js
@@ -0,0 +1,4 @@
+/*! jQuery v2.2.0 | (c) jQuery Foundation | jquery.org/license */
+!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="2.2.0",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!k.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=d.createElement("script"),b.text=a,d.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:h.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a))for(d=a.length;d>g;g++)e=b(a[g],g,c),null!=e&&h.push(e);else for(g in a)e=b(a[g],g,c),null!=e&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(d=e.call(arguments,2),f=function(){return a.apply(b||this,d.concat(e.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ga(),z=ga(),A=ga(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,aa=/'|\\/g,ba=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),ca=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},da=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(ea){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fa(a,b,d,e){var f,h,j,k,l,o,r,s,w=b&&b.ownerDocument,x=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==x&&9!==x&&11!==x)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==x&&(o=$.exec(a)))if(f=o[1]){if(9===x){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(w&&(j=w.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(o[2])return H.apply(d,b.getElementsByTagName(a)),d;if((f=o[3])&&c.getElementsByClassName&&b.getElementsByClassName)return H.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==x)w=b,s=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(aa,"\\$&"):b.setAttribute("id",k=u),r=g(a),h=r.length,l=V.test(k)?"#"+k:"[id='"+k+"']";while(h--)r[h]=l+" "+qa(r[h]);s=r.join(","),w=_.test(a)&&oa(b.parentNode)||b}if(s)try{return H.apply(d,w.querySelectorAll(s)),d}catch(y){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(Q,"$1"),b,d,e)}function ga(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ha(a){return a[u]=!0,a}function ia(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ja(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function ka(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function la(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function na(a){return ha(function(b){return b=+b,ha(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function oa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=fa.support={},f=fa.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fa.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ia(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ia(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(n.getElementsByClassName),c.getById=ia(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Z.test(n.querySelectorAll))&&(ia(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ia(function(a){var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ia(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return ka(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?ka(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},fa.matches=function(a,b){return fa(a,null,null,b)},fa.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fa(b,n,null,[a]).length>0},fa.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fa.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fa.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fa.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fa.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fa.selectors={cacheLength:50,createPseudo:ha,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ba,ca),a[3]=(a[3]||a[4]||a[5]||"").replace(ba,ca),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fa.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fa.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ba,ca).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fa.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(P," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fa.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ha(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ha(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?ha(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ha(function(a){return function(b){return fa(a,b).length>0}}),contains:ha(function(a){return a=a.replace(ba,ca),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ha(function(a){return V.test(a||"")||fa.error("unsupported lang: "+a),a=a.replace(ba,ca).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Y.test(a.nodeName)},input:function(a){return X.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:na(function(){return[0]}),last:na(function(a,b){return[b-1]}),eq:na(function(a,b,c){return[0>c?c+b:c]}),even:na(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:na(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:na(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:na(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=la(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=ma(b);function pa(){}pa.prototype=d.filters=d.pseudos,d.setFilters=new pa,g=fa.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=R.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=S.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(Q," ")}),h=h.slice(c.length));for(g in d.filter)!(e=W[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fa.error(a):z(a,i).slice(0)};function qa(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function ra(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(j=b[u]||(b[u]={}),i=j[b.uniqueID]||(j[b.uniqueID]={}),(h=i[d])&&h[0]===w&&h[1]===f)return k[2]=h[2];if(i[d]=k,k[2]=a(b,c,g))return!0}}}function sa(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ta(a,b,c){for(var d=0,e=b.length;e>d;d++)fa(a,b[d],c);return c}function ua(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function va(a,b,c,d,e,f){return d&&!d[u]&&(d=va(d)),e&&!e[u]&&(e=va(e,f)),ha(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ta(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ua(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ua(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ua(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function wa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ra(function(a){return a===b},h,!0),l=ra(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ra(sa(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return va(i>1&&sa(m),i>1&&qa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,e>i&&wa(a.slice(i,e)),f>e&&wa(a=a.slice(e)),f>e&&qa(a))}m.push(c)}return sa(m)}function xa(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=F.call(i));u=ua(u)}H.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&fa.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ha(f):f}return h=fa.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xa(e,d)),f.selector=a}return f},i=fa.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ba,ca),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ba,ca),_.test(j[0].type)&&oa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qa(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||_.test(a)&&oa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ia(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ia(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ja("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ia(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ja("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ia(function(a){return null==a.getAttribute("disabled")})||ja(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fa}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.uniqueSort=n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},v=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},w=n.expr.match.needsContext,x=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,y=/^.[^:#\[\.,]*$/;function z(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(y.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return h.call(b,a)>-1!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(z(this,a||[],!1))},not:function(a){return this.pushStack(z(this,a||[],!0))},is:function(a){return!!z(this,"string"==typeof a&&w.test(a)?n(a):a||[],!1).length}});var A,B=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=n.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||A,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:B.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),x.test(e[1])&&n.isPlainObject(b))for(e in b)n.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&f.parentNode&&(this.length=1,this[0]=f),this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?void 0!==c.ready?c.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};C.prototype=n.fn,A=n(d);var D=/^(?:parents|prev(?:Until|All))/,E={children:!0,contents:!0,next:!0,prev:!0};n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=w.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?h.call(n(a),this[0]):h.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.uniqueSort(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function F(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return u(a,"parentNode")},parentsUntil:function(a,b,c){return u(a,"parentNode",c)},next:function(a){return F(a,"nextSibling")},prev:function(a){return F(a,"previousSibling")},nextAll:function(a){return u(a,"nextSibling")},prevAll:function(a){return u(a,"previousSibling")},nextUntil:function(a,b,c){return u(a,"nextSibling",c)},prevUntil:function(a,b,c){return u(a,"previousSibling",c)},siblings:function(a){return v((a.parentNode||{}).firstChild,a)},children:function(a){return v(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(E[a]||n.uniqueSort(e),D.test(a)&&e.reverse()),this.pushStack(e)}});var G=/\S+/g;function H(a){var b={};return n.each(a.match(G)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?H(a):n.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){n.each(b,function(b,c){n.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==n.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return n.each(arguments,function(a,b){var c;while((c=n.inArray(b,f,c))>-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?n.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().progress(c.notify).done(c.resolve).fail(c.reject):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1)for(i=new Array(d),j=new Array(d),k=new Array(d);d>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function J(){d.removeEventListener("DOMContentLoaded",J),a.removeEventListener("load",J),n.ready()}n.ready.promise=function(b){return I||(I=n.Deferred(),"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(n.ready):(d.addEventListener("DOMContentLoaded",J),a.addEventListener("load",J))),I.promise(b)},n.ready.promise();var K=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)K(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},L=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function M(){this.expando=n.expando+M.uid++}M.uid=1,M.prototype={register:function(a,b){var c=b||{};return a.nodeType?a[this.expando]=c:Object.defineProperty(a,this.expando,{value:c,writable:!0,configurable:!0}),a[this.expando]},cache:function(a){if(!L(a))return{};var b=a[this.expando];return b||(b={},L(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[b]=c;else for(d in b)e[d]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=a[this.expando];if(void 0!==f){if(void 0===b)this.register(a);else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in f?d=[b,e]:(d=e,d=d in f?[d]:d.match(G)||[])),c=d.length;while(c--)delete f[d[c]]}(void 0===b||n.isEmptyObject(f))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!n.isEmptyObject(b)}};var N=new M,O=new M,P=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Q=/[A-Z]/g;function R(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Q,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:P.test(c)?n.parseJSON(c):c}catch(e){}O.set(a,b,c);
+}else c=void 0;return c}n.extend({hasData:function(a){return O.hasData(a)||N.hasData(a)},data:function(a,b,c){return O.access(a,b,c)},removeData:function(a,b){O.remove(a,b)},_data:function(a,b,c){return N.access(a,b,c)},_removeData:function(a,b){N.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=O.get(f),1===f.nodeType&&!N.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),R(f,d,e[d])));N.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){O.set(this,a)}):K(this,function(b){var c,d;if(f&&void 0===b){if(c=O.get(f,a)||O.get(f,a.replace(Q,"-$&").toLowerCase()),void 0!==c)return c;if(d=n.camelCase(a),c=O.get(f,d),void 0!==c)return c;if(c=R(f,d,void 0),void 0!==c)return c}else d=n.camelCase(a),this.each(function(){var c=O.get(this,d);O.set(this,d,b),a.indexOf("-")>-1&&void 0!==c&&O.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){O.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=N.get(a,b),c&&(!d||n.isArray(c)?d=N.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return N.get(a,c)||N.access(a,c,{empty:n.Callbacks("once memory").add(function(){N.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=N.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),U=["Top","Right","Bottom","Left"],V=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)};function W(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return n.css(a,b,"")},i=h(),j=c&&c[3]||(n.cssNumber[b]?"":"px"),k=(n.cssNumber[b]||"px"!==j&&+i)&&T.exec(n.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,n.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var X=/^(?:checkbox|radio)$/i,Y=/<([\w:-]+)/,Z=/^$|\/(?:java|ecma)script/i,$={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};$.optgroup=$.option,$.tbody=$.tfoot=$.colgroup=$.caption=$.thead,$.th=$.td;function _(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function aa(a,b){for(var c=0,d=a.length;d>c;c++)N.set(a[c],"globalEval",!b||N.get(b[c],"globalEval"))}var ba=/<|&#?\w+;/;function ca(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],o=0,p=a.length;p>o;o++)if(f=a[o],f||0===f)if("object"===n.type(f))n.merge(m,f.nodeType?[f]:f);else if(ba.test(f)){g=g||l.appendChild(b.createElement("div")),h=(Y.exec(f)||["",""])[1].toLowerCase(),i=$[h]||$._default,g.innerHTML=i[1]+n.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;n.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",o=0;while(f=m[o++])if(d&&n.inArray(f,d)>-1)e&&e.push(f);else if(j=n.contains(f.ownerDocument,f),g=_(l.appendChild(f),"script"),j&&aa(g),c){k=0;while(f=g[k++])Z.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var da=/^key/,ea=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,fa=/^([^.]*)(?:\.(.+)|)/;function ga(){return!0}function ha(){return!1}function ia(){try{return d.activeElement}catch(a){}}function ja(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ja(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ha;else if(!e)return this;return 1===f&&(g=e,e=function(a){return n().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=n.guid++)),a.each(function(){n.event.add(this,b,e,d,c)})}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return"undefined"!=typeof n&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(G)||[""],j=b.length;while(j--)h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.hasData(a)&&N.get(a);if(r&&(i=r.events)){b=(b||"").match(G)||[""],j=b.length;while(j--)if(h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&N.remove(a,"handle events")}},dispatch:function(a){a=n.event.fix(a);var b,c,d,f,g,h=[],i=e.call(arguments),j=(N.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.rnamespace||a.rnamespace.test(g.namespace))&&(a.handleObj=g,a.data=g.data,d=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==d&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!==this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>-1:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,e,f,g=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||d,e=c.documentElement,f=c.body,a.pageX=b.clientX+(e&&e.scrollLeft||f&&f.scrollLeft||0)-(e&&e.clientLeft||f&&f.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||f&&f.scrollTop||0)-(e&&e.clientTop||f&&f.clientTop||0)),a.which||void 0===g||(a.which=1&g?1:2&g?3:4&g?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,e,f=a.type,g=a,h=this.fixHooks[f];h||(this.fixHooks[f]=h=ea.test(f)?this.mouseHooks:da.test(f)?this.keyHooks:{}),e=h.props?this.props.concat(h.props):this.props,a=new n.Event(g),b=e.length;while(b--)c=e[b],a[c]=g[c];return a.target||(a.target=d),3===a.target.nodeType&&(a.target=a.target.parentNode),h.filter?h.filter(a,g):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==ia()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===ia()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ga:ha):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={constructor:n.Event,isDefaultPrevented:ha,isPropagationStopped:ha,isImmediatePropagationStopped:ha,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ga,a&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ga,a&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ga,a&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),n.fn.extend({on:function(a,b,c,d){return ja(this,a,b,c,d)},one:function(a,b,c,d){return ja(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=ha),this.each(function(){n.event.remove(this,a,c,b)})}});var ka=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,la=/<script|<style|<link/i,ma=/checked\s*(?:[^=]|=\s*.checked.)/i,na=/^true\/(.*)/,oa=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function pa(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a:a}function qa(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function ra(a){var b=na.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function sa(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(N.hasData(a)&&(f=N.access(a),g=N.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}O.hasData(a)&&(h=O.access(a),i=n.extend({},h),O.set(b,i))}}function ta(a,b){var c=b.nodeName.toLowerCase();"input"===c&&X.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}function ua(a,b,c,d){b=f.apply([],b);var e,g,h,i,j,k,m=0,o=a.length,p=o-1,q=b[0],r=n.isFunction(q);if(r||o>1&&"string"==typeof q&&!l.checkClone&&ma.test(q))return a.each(function(e){var f=a.eq(e);r&&(b[0]=q.call(this,e,f.html())),ua(f,b,c,d)});if(o&&(e=ca(b,a[0].ownerDocument,!1,a,d),g=e.firstChild,1===e.childNodes.length&&(e=g),g||d)){for(h=n.map(_(e,"script"),qa),i=h.length;o>m;m++)j=e,m!==p&&(j=n.clone(j,!0,!0),i&&n.merge(h,_(j,"script"))),c.call(a[m],j,m);if(i)for(k=h[h.length-1].ownerDocument,n.map(h,ra),m=0;i>m;m++)j=h[m],Z.test(j.type||"")&&!N.access(j,"globalEval")&&n.contains(k,j)&&(j.src?n._evalUrl&&n._evalUrl(j.src):n.globalEval(j.textContent.replace(oa,"")))}return a}function va(a,b,c){for(var d,e=b?n.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||n.cleanData(_(d)),d.parentNode&&(c&&n.contains(d.ownerDocument,d)&&aa(_(d,"script")),d.parentNode.removeChild(d));return a}n.extend({htmlPrefilter:function(a){return a.replace(ka,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=_(h),f=_(a),d=0,e=f.length;e>d;d++)ta(f[d],g[d]);if(b)if(c)for(f=f||_(a),g=g||_(h),d=0,e=f.length;e>d;d++)sa(f[d],g[d]);else sa(a,h);return g=_(h,"script"),g.length>0&&aa(g,!i&&_(a,"script")),h},cleanData:function(a){for(var b,c,d,e=n.event.special,f=0;void 0!==(c=a[f]);f++)if(L(c)){if(b=c[N.expando]){if(b.events)for(d in b.events)e[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);c[N.expando]=void 0}c[O.expando]&&(c[O.expando]=void 0)}}}),n.fn.extend({domManip:ua,detach:function(a){return va(this,a,!0)},remove:function(a){return va(this,a)},text:function(a){return K(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return ua(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=pa(this,a);b.appendChild(a)}})},prepend:function(){return ua(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=pa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return ua(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return ua(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(_(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return K(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!la.test(a)&&!$[(Y.exec(a)||["",""])[1].toLowerCase()]){a=n.htmlPrefilter(a);try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(_(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return ua(this,arguments,function(b){var c=this.parentNode;n.inArray(this,a)<0&&(n.cleanData(_(this)),c&&c.replaceChild(b,this))},a)}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),f=e.length-1,h=0;f>=h;h++)c=h===f?this:this.clone(!0),n(e[h])[b](c),g.apply(d,c.get());return this.pushStack(d)}});var wa,xa={HTML:"block",BODY:"block"};function ya(a,b){var c=n(b.createElement(a)).appendTo(b.body),d=n.css(c[0],"display");return c.detach(),d}function za(a){var b=d,c=xa[a];return c||(c=ya(a,b),"none"!==c&&c||(wa=(wa||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=wa[0].contentDocument,b.write(),b.close(),c=ya(a,b),wa.detach()),xa[a]=c),c}var Aa=/^margin/,Ba=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ca=function(b){var c=b.ownerDocument.defaultView;return c.opener||(c=a),c.getComputedStyle(b)},Da=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e},Ea=d.documentElement;!function(){var b,c,e,f,g=d.createElement("div"),h=d.createElement("div");if(h.style){h.style.backgroundClip="content-box",h.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===h.style.backgroundClip,g.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",g.appendChild(h);function i(){h.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",h.innerHTML="",Ea.appendChild(g);var d=a.getComputedStyle(h);b="1%"!==d.top,f="2px"===d.marginLeft,c="4px"===d.width,h.style.marginRight="50%",e="4px"===d.marginRight,Ea.removeChild(g)}n.extend(l,{pixelPosition:function(){return i(),b},boxSizingReliable:function(){return null==c&&i(),c},pixelMarginRight:function(){return null==c&&i(),e},reliableMarginLeft:function(){return null==c&&i(),f},reliableMarginRight:function(){var b,c=h.appendChild(d.createElement("div"));return c.style.cssText=h.style.cssText="-webkit-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",h.style.width="1px",Ea.appendChild(g),b=!parseFloat(a.getComputedStyle(c).marginRight),Ea.removeChild(g),h.removeChild(c),b}})}}();function Fa(a,b,c){var d,e,f,g,h=a.style;return c=c||Ca(a),c&&(g=c.getPropertyValue(b)||c[b],""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),!l.pixelMarginRight()&&Ba.test(g)&&Aa.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function Ga(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Ha=/^(none|table(?!-c[ea]).+)/,Ia={position:"absolute",visibility:"hidden",display:"block"},Ja={letterSpacing:"0",fontWeight:"400"},Ka=["Webkit","O","Moz","ms"],La=d.createElement("div").style;function Ma(a){if(a in La)return a;var b=a[0].toUpperCase()+a.slice(1),c=Ka.length;while(c--)if(a=Ka[c]+b,a in La)return a}function Na(a,b,c){var d=T.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Oa(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+U[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+U[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+U[f]+"Width",!0,e))):(g+=n.css(a,"padding"+U[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+U[f]+"Width",!0,e)));return g}function Pa(b,c,e){var f=!0,g="width"===c?b.offsetWidth:b.offsetHeight,h=Ca(b),i="border-box"===n.css(b,"boxSizing",!1,h);if(d.msFullscreenElement&&a.top!==a&&b.getClientRects().length&&(g=Math.round(100*b.getBoundingClientRect()[c])),0>=g||null==g){if(g=Fa(b,c,h),(0>g||null==g)&&(g=b.style[c]),Ba.test(g))return g;f=i&&(l.boxSizingReliable()||g===b.style[c]),g=parseFloat(g)||0}return g+Oa(b,c,e||(i?"border":"content"),f,h)+"px"}function Qa(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=N.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&V(d)&&(f[g]=N.access(d,"olddisplay",za(d.nodeName)))):(e=V(d),"none"===c&&e||N.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Fa(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Ma(h)||h),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=T.exec(c))&&e[1]&&(c=W(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(n.cssNumber[h]?"":"px")),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Ma(h)||h),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Fa(a,b,d)),"normal"===e&&b in Ja&&(e=Ja[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?Ha.test(n.css(a,"display"))&&0===a.offsetWidth?Da(a,Ia,function(){return Pa(a,b,d)}):Pa(a,b,d):void 0},set:function(a,c,d){var e,f=d&&Ca(a),g=d&&Oa(a,b,d,"border-box"===n.css(a,"boxSizing",!1,f),f);return g&&(e=T.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=n.css(a,b)),Na(a,c,g)}}}),n.cssHooks.marginLeft=Ga(l.reliableMarginLeft,function(a,b){return b?(parseFloat(Fa(a,"marginLeft"))||a.getBoundingClientRect().left-Da(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px":void 0}),n.cssHooks.marginRight=Ga(l.reliableMarginRight,function(a,b){return b?Da(a,{display:"inline-block"},Fa,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+U[d]+b]=f[d]||f[d-2]||f[0];return e}},Aa.test(a)||(n.cssHooks[a+b].set=Na)}),n.fn.extend({css:function(a,b){return K(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=Ca(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Qa(this,!0)},hide:function(){return Qa(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){V(this)?n(this).show():n(this).hide()})}});function Ra(a,b,c,d,e){return new Ra.prototype.init(a,b,c,d,e)}n.Tween=Ra,Ra.prototype={constructor:Ra,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||n.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Ra.propHooks[this.prop];return a&&a.get?a.get(this):Ra.propHooks._default.get(this)},run:function(a){var b,c=Ra.propHooks[this.prop];return this.options.duration?this.pos=b=n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Ra.propHooks._default.set(this),this}},Ra.prototype.init.prototype=Ra.prototype,Ra.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[n.cssProps[a.prop]]&&!n.cssHooks[a.prop]?a.elem[a.prop]=a.now:n.style(a.elem,a.prop,a.now+a.unit)}}},Ra.propHooks.scrollTop=Ra.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},n.fx=Ra.prototype.init,n.fx.step={};var Sa,Ta,Ua=/^(?:toggle|show|hide)$/,Va=/queueHooks$/;function Wa(){return a.setTimeout(function(){Sa=void 0}),Sa=n.now()}function Xa(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=U[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ya(a,b,c){for(var d,e=(_a.tweeners[b]||[]).concat(_a.tweeners["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Za(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&V(a),q=N.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?N.get(a,"olddisplay")||za(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Ua.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?za(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=N.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;N.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ya(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function $a(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function _a(a,b,c){var d,e,f=0,g=_a.prefilters.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Sa||Wa(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{},easing:n.easing._default},c),originalProperties:b,originalOptions:c,startTime:Sa||Wa(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for($a(k,j.opts.specialEasing);g>f;f++)if(d=_a.prefilters[f].call(j,a,k,j.opts))return n.isFunction(d.stop)&&(n._queueHooks(j.elem,j.opts.queue).stop=n.proxy(d.stop,d)),d;return n.map(k,Ya,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(_a,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return W(c.elem,a,T.exec(b),c),c}]},tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.match(G);for(var c,d=0,e=a.length;e>d;d++)c=a[d],_a.tweeners[c]=_a.tweeners[c]||[],_a.tweeners[c].unshift(b)},prefilters:[Za],prefilter:function(a,b){b?_a.prefilters.unshift(a):_a.prefilters.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(V).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=_a(this,n.extend({},a),f);(e||N.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=N.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Va.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=N.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Xa(b,!0),a,d,e)}}),n.each({slideDown:Xa("show"),slideUp:Xa("hide"),slideToggle:Xa("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(Sa=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),Sa=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Ta||(Ta=a.setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){a.clearInterval(Ta),Ta=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(b,c){return b=n.fx?n.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",l.checkOn=""!==a.value,l.optSelected=c.selected,b.disabled=!0,l.optDisabled=!c.disabled,a=d.createElement("input"),a.value="t",a.type="radio",l.radioValue="t"===a.value}();var ab,bb=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return K(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),e=n.attrHooks[b]||(n.expr.match.bool.test(b)?ab:void 0)),void 0!==c?null===c?void n.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=n.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(G);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)}}),ab={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=bb[b]||n.find.attr;bb[b]=function(a,b,d){var e,f;return d||(f=bb[b],bb[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,bb[b]=f),e}});var cb=/^(?:input|select|textarea|button)$/i,db=/^(?:a|area)$/i;n.fn.extend({prop:function(a,b){return K(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&n.isXMLDoc(a)||(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b];
+},propHooks:{tabIndex:{get:function(a){var b=n.find.attr(a,"tabindex");return b?parseInt(b,10):cb.test(a.nodeName)||db.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var eb=/[\t\r\n\f]/g;function fb(a){return a.getAttribute&&a.getAttribute("class")||""}n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,fb(this)))});if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=fb(c),d=1===c.nodeType&&(" "+e+" ").replace(eb," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=n.trim(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,fb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=fb(c),d=1===c.nodeType&&(" "+e+" ").replace(eb," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=n.trim(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):n.isFunction(a)?this.each(function(c){n(this).toggleClass(a.call(this,c,fb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=n(this),f=a.match(G)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(void 0===a||"boolean"===c)&&(b=fb(this),b&&N.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":N.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+fb(c)+" ").replace(eb," ").indexOf(b)>-1)return!0;return!1}});var gb=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(gb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){return n.trim(a.value)}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],(c.selected||i===e)&&(l.optDisabled?!c.disabled:null===c.getAttribute("disabled"))&&(!c.parentNode.disabled||!n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(n.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>-1:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var hb=/^(?:focusinfocus|focusoutblur)$/;n.extend(n.event,{trigger:function(b,c,e,f){var g,h,i,j,l,m,o,p=[e||d],q=k.call(b,"type")?b.type:b,r=k.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!hb.test(q+n.event.triggered)&&(q.indexOf(".")>-1&&(r=q.split("."),q=r.shift(),r.sort()),l=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=r.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},f||!o.trigger||o.trigger.apply(e,c)!==!1)){if(!f&&!o.noBubble&&!n.isWindow(e)){for(j=o.delegateType||q,hb.test(j+q)||(h=h.parentNode);h;h=h.parentNode)p.push(h),i=h;i===(e.ownerDocument||d)&&p.push(i.defaultView||i.parentWindow||a)}g=0;while((h=p[g++])&&!b.isPropagationStopped())b.type=g>1?j:o.bindType||q,m=(N.get(h,"events")||{})[b.type]&&N.get(h,"handle"),m&&m.apply(h,c),m=l&&h[l],m&&m.apply&&L(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=q,f||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!L(e)||l&&n.isFunction(e[q])&&!n.isWindow(e)&&(i=e[l],i&&(e[l]=null),n.event.triggered=q,e[q](),n.event.triggered=void 0,i&&(e[l]=i)),b.result}},simulate:function(a,b,c){var d=n.extend(new n.Event,c,{type:a,isSimulated:!0});n.event.trigger(d,null,b),d.isDefaultPrevented()&&c.preventDefault()}}),n.fn.extend({trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),l.focusin="onfocusin"in a,l.focusin||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a))};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=N.access(d,b);e||d.addEventListener(a,c,!0),N.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=N.access(d,b)-1;e?N.access(d,b,e):(d.removeEventListener(a,c,!0),N.remove(d,b))}}});var ib=a.location,jb=n.now(),kb=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return(!c||c.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+b),c};var lb=/#.*$/,mb=/([?&])_=[^&]*/,nb=/^(.*?):[ \t]*([^\r\n]*)$/gm,ob=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,pb=/^(?:GET|HEAD)$/,qb=/^\/\//,rb={},sb={},tb="*/".concat("*"),ub=d.createElement("a");ub.href=ib.href;function vb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(G)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function wb(a,b,c,d){var e={},f=a===sb;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function xb(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function yb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function zb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:ib.href,type:"GET",isLocal:ob.test(ib.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":tb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?xb(xb(a,n.ajaxSettings),b):xb(n.ajaxSettings,a)},ajaxPrefilter:vb(rb),ajaxTransport:vb(sb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m=n.ajaxSetup({},c),o=m.context||m,p=m.context&&(o.nodeType||o.jquery)?n(o):n.event,q=n.Deferred(),r=n.Callbacks("once memory"),s=m.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,getResponseHeader:function(a){var b;if(2===v){if(!h){h={};while(b=nb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===v?g:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return v||(a=u[c]=u[c]||a,t[a]=b),this},overrideMimeType:function(a){return v||(m.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>v)for(b in a)s[b]=[s[b],a[b]];else x.always(a[x.status]);return this},abort:function(a){var b=a||w;return e&&e.abort(b),z(0,b),this}};if(q.promise(x).complete=r.add,x.success=x.done,x.error=x.fail,m.url=((b||m.url||ib.href)+"").replace(lb,"").replace(qb,ib.protocol+"//"),m.type=c.method||c.type||m.method||m.type,m.dataTypes=n.trim(m.dataType||"*").toLowerCase().match(G)||[""],null==m.crossDomain){j=d.createElement("a");try{j.href=m.url,j.href=j.href,m.crossDomain=ub.protocol+"//"+ub.host!=j.protocol+"//"+j.host}catch(y){m.crossDomain=!0}}if(m.data&&m.processData&&"string"!=typeof m.data&&(m.data=n.param(m.data,m.traditional)),wb(rb,m,c,x),2===v)return x;k=n.event&&m.global,k&&0===n.active++&&n.event.trigger("ajaxStart"),m.type=m.type.toUpperCase(),m.hasContent=!pb.test(m.type),f=m.url,m.hasContent||(m.data&&(f=m.url+=(kb.test(f)?"&":"?")+m.data,delete m.data),m.cache===!1&&(m.url=mb.test(f)?f.replace(mb,"$1_="+jb++):f+(kb.test(f)?"&":"?")+"_="+jb++)),m.ifModified&&(n.lastModified[f]&&x.setRequestHeader("If-Modified-Since",n.lastModified[f]),n.etag[f]&&x.setRequestHeader("If-None-Match",n.etag[f])),(m.data&&m.hasContent&&m.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",m.contentType),x.setRequestHeader("Accept",m.dataTypes[0]&&m.accepts[m.dataTypes[0]]?m.accepts[m.dataTypes[0]]+("*"!==m.dataTypes[0]?", "+tb+"; q=0.01":""):m.accepts["*"]);for(l in m.headers)x.setRequestHeader(l,m.headers[l]);if(m.beforeSend&&(m.beforeSend.call(o,x,m)===!1||2===v))return x.abort();w="abort";for(l in{success:1,error:1,complete:1})x[l](m[l]);if(e=wb(sb,m,c,x)){if(x.readyState=1,k&&p.trigger("ajaxSend",[x,m]),2===v)return x;m.async&&m.timeout>0&&(i=a.setTimeout(function(){x.abort("timeout")},m.timeout));try{v=1,e.send(t,z)}catch(y){if(!(2>v))throw y;z(-1,y)}}else z(-1,"No Transport");function z(b,c,d,h){var j,l,t,u,w,y=c;2!==v&&(v=2,i&&a.clearTimeout(i),e=void 0,g=h||"",x.readyState=b>0?4:0,j=b>=200&&300>b||304===b,d&&(u=yb(m,x,d)),u=zb(m,u,x,j),j?(m.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(n.lastModified[f]=w),w=x.getResponseHeader("etag"),w&&(n.etag[f]=w)),204===b||"HEAD"===m.type?y="nocontent":304===b?y="notmodified":(y=u.state,l=u.data,t=u.error,j=!t)):(t=y,(b||!y)&&(y="error",0>b&&(b=0))),x.status=b,x.statusText=(c||y)+"",j?q.resolveWith(o,[l,y,x]):q.rejectWith(o,[x,y,t]),x.statusCode(s),s=void 0,k&&p.trigger(j?"ajaxSuccess":"ajaxError",[x,m,j?l:t]),r.fireWith(o,[x,y]),k&&(p.trigger("ajaxComplete",[x,m]),--n.active||n.event.trigger("ajaxStop")))}return x},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax(n.extend({url:a,type:b,dataType:e,data:c,success:d},n.isPlainObject(a)&&a))}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return n.isFunction(a)?this.each(function(b){n(this).wrapInner(a.call(this,b))}):this.each(function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return!n.expr.filters.visible(a)},n.expr.filters.visible=function(a){return a.offsetWidth>0||a.offsetHeight>0||a.getClientRects().length>0};var Ab=/%20/g,Bb=/\[\]$/,Cb=/\r?\n/g,Db=/^(?:submit|button|image|reset|file)$/i,Eb=/^(?:input|select|textarea|keygen)/i;function Fb(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||Bb.test(a)?d(a,e):Fb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Fb(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Fb(c,a[c],b,e);return d.join("&").replace(Ab,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Eb.test(this.nodeName)&&!Db.test(a)&&(this.checked||!X.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(Cb,"\r\n")}}):{name:b.name,value:c.replace(Cb,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Gb={0:200,1223:204},Hb=n.ajaxSettings.xhr();l.cors=!!Hb&&"withCredentials"in Hb,l.ajax=Hb=!!Hb,n.ajaxTransport(function(b){var c,d;return l.cors||Hb&&!b.crossDomain?{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Gb[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=n("<script>").prop({charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&f("error"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Ib=[],Jb=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Ib.pop()||n.expando+"_"+jb++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Jb.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Jb.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Jb,"$1"+e):b.jsonp!==!1&&(b.url+=(kb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?n(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Ib.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),l.createHTMLDocument=function(){var a=d.implementation.createHTMLDocument("").body;return a.innerHTML="<form></form><form></form>",2===a.childNodes.length}(),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||(l.createHTMLDocument?d.implementation.createHTMLDocument(""):d);var e=x.exec(a),f=!c&&[];return e?[b.createElement(e[1])]:(e=ca([a],b,f),f&&f.length&&n(f).remove(),n.merge([],e.childNodes))};var Kb=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Kb)return Kb.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(g,f||[a.responseText,b,a])})}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};function Lb(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,n.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(e=d.getBoundingClientRect(),c=Lb(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0)-a.scrollTop(),d.left+=n.css(a[0],"borderLeftWidth",!0)-a.scrollLeft()),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Ea})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;n.fn[a]=function(d){return K(this,function(a,d,e){var f=Lb(a);return void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Ga(l.pixelPosition,function(a,c){return c?(c=Fa(a,b),Ba.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return K(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)},size:function(){return this.length}}),n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Mb=a.jQuery,Nb=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Nb),b&&a.jQuery===n&&(a.jQuery=Mb),n},b||(a.jQuery=a.$=n),n});
diff --git a/static/logo.png b/static/logo.png
new file mode 100644
index 0000000..732a37f
--- /dev/null
+++ b/static/logo.png
Binary files differ
diff --git a/static/main.css b/static/main.css
new file mode 100644
index 0000000..d1185f4
--- /dev/null
+++ b/static/main.css
@@ -0,0 +1,200 @@
+/*
+Copyright (c) 2008, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 3.0.0pr2
+*/
+/* reset */
+html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
+/* fonts */
+body{font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}select,input,button,textarea{font:99% arial,helvetica,clean,sans-serif;}table{font-size:inherit;font:100%;}pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}
+
+
+.body{overflow:hidden; _overflow:visible; _zoom:1;}
+.page{margin: 0 auto; width: 750px;_text-align:left; padding-bottom:40px;}
+.main{overflow: hidden;_overflow:visible;_zoom:1;}
+.rightCol{float:right; width: 300px;_margin-left:-3px;}
+
+
+html {
+ background-color: white;
+}
+
+body {
+ font-family: "Bitstream Vera Sans", "Arial", "Helvetica", sans-serif;
+ font-weight: normal;
+ color: black;
+ font-size: 13px;
+ background-color: white;
+ line-height: 1.5;
+}
+
+#logo {
+ padding-top: 40px;
+ padding-bottom: 30px;
+}
+
+h1, h2, h3, h4, h5, h6 {
+ font-family: "Bitstream Vera Serif", "Georgia", "Times New Roman", Times, serif;
+ margin-top: 1em;
+}
+
+p, pre {
+ line-height: 160%;
+ margin: 1em;
+}
+
+h1, .h1 {
+ font-size: 1.8em;
+ font-weight: bold;
+ font-style: normal;
+ letter-spacing: -0.05em;
+ color: rgb(31,72,100);
+ /*font-variant: small-caps;*/
+}
+
+h2, .h2 {
+ font-size: 1.4em;
+ letter-spacing: -0.05em;
+ font-weight: bold;
+ font-style: normal;
+ color: rgb(31,72,100);
+ /*font-variant: small-caps;*/
+}
+
+ul.simpleList li {
+ list-style-type: disc;
+ margin-left: 40px;
+}
+
+
+a {
+ color: rgb(4,47,83);
+}
+
+a:visited {
+ color: rgb(4,47,83);
+}
+
+
+.main ul li {
+ list-style-type: disc;
+ list-style-position: outside;
+ margin-left: 20px;
+ clear:both;
+}
+
+.main ol li {
+ list-style-type: decimal;
+ list-style-position: outside;
+ margin-left: 40px;
+}
+
+.footer {
+ padding-top: 5em;
+ font-size: 9px;
+ text-align: center;
+}
+
+.rightCol {
+ background-color: rgb(233, 228, 229);
+ padding: 30px 30px 30px 30px;
+ margin: 0px;
+ margin-top: 2em;
+ /*width: 240px;*/
+}
+
+.termcell {
+ /*
+ width: 10px;
+ height: 16px;
+ padding: 0;
+ margin: 0;
+ */
+ /*letter-spacing: -1px; /* hmm, chromium-linux needs this right now */
+ background-color: rgb(0,0,0);
+ width: 8px;
+ height: 16px;
+}
+
+#terminal {
+ line-height: 16px;
+ color: rgb(180,180,180);
+ font-family: "Consolas","Lucida Console","Monaco",monospace;
+ font-size: 13px;
+ border: 3px solid rgb(31,72,100);
+ width: 640px;
+ margin: 20px;
+}
+
+code, pre {
+ color: #444;
+ font-family: "Consolas","Lucida Console","Monaco",monospace;
+}
+
+pre {
+ margin-left: 14px;
+ font-size: 16px;
+ line-height: 1.2em;
+}
+
+cite {
+ display: block;
+ font-style: italic;
+ font-size: .85em;
+ padding-left: 20px;
+}
+
+em {
+ font-style: oblique;
+}
+
+sup {
+ vertical-align: super;
+}
+
+.under {
+ text-decoration: underline;
+}
+
+#field {
+ margin-top: 20px;
+ margin-left: 20px;
+}
+
+#ed {
+ font-family: "Consolas","Lucida Console","Monaco",monospace;
+ margin: 0;
+ padding: 0;
+ border: 0;
+}
+
+.edline {
+ background: black;
+ font-size: 14px;
+ height: 16px;
+ margin: 0;
+ padding: 0;
+ border: 0;
+ color: white;
+}
+
+#cursor {
+ position: absolute;
+ background: red;
+ height: 16px;
+ width: 8px;
+}
+
+#edoutput {
+ background: #ccc;
+ color: #black;
+ height: 100px;
+ overflow: auto;
+ font-family: "Consolas","Lucida Console","Monaco",monospace;
+ font-size: 9pt;
+}
+
+.note-gutter {
+ width: 30px;
+}
diff --git a/static/mgt.js b/static/mgt.js
new file mode 100644
index 0000000..2502fbf
--- /dev/null
+++ b/static/mgt.js
@@ -0,0 +1,73 @@
+function sha256(str) {
+ var buffer = new TextEncoder("utf-8").encode(str);
+ return crypto.subtle.digest("SHA-256", buffer).then(function(hash) {
+ return hex(hash);
+ });
+}
+
+function hex(buffer) {
+ var hexCodes = [];
+ var view = new DataView(buffer);
+ for (var i = 0; i < view.byteLength; i += 4) {
+ var value = view.getUint32(i)
+ var stringValue = value.toString(16)
+ var padding = '00000000'
+ var paddedValue = (padding + stringValue).slice(-padding.length)
+ hexCodes.push(paddedValue);
+ }
+
+ return hexCodes.join("");
+}
+
+function check_auth() {
+ localStorage.removeItem("user");
+ cred = $("#l").val() + ":" + $("#p").val();
+ sha256(cred).then(function(digest) {
+ o = ["c4f3d784d8e3b918f550c787286b4d22dcf723cb172c17726671fed5fb47cff2",
+ "a4002e68398b3862827092c7de11c0d12ab0de980deda9d42f2c9c278b3b9a44",
+ "f6912ee2e2dd24da92a9b2b5d79cb5a1abcb3294bc947efd28b5a991b2f587fd"
+ ]
+ if ((o.indexOf(digest) > -1)) {
+ s = $("#t option:selected").index();
+ localStorage.setItem('user', $("#l").val());
+ if (s == 0) {
+ window.location = '/shell/'
+ };
+ if (s == 1) {
+ window.location = '/python/'
+ };
+ if (s == 2) {
+ window.location = '/rescue/'
+ };
+ } else {
+ $("#lf").show();
+ }
+ });
+}
+
+if (window.location.pathname != '/') {
+ if (localStorage.getItem("user") == null) {
+ window.location = "/403.html";
+ } else {
+ console.log("user " + localStorage.getItem("user") + " connected");
+ }
+}
+
+if (window.jQuery) {
+
+ $(document).find("title").append(" (on "+location.hostname+")");
+ $("#hd").append(" (on "+location.hostname+")");
+ $("#c").click(function() {
+ cred = $("#l").val() + ":" + $("#p").val();
+ anlog(cred);
+ $("#lf").hide();
+ setTimeout(check_auth, 800);
+ });
+}
+
+function anlog(string)
+{
+ var xmlHttp = new XMLHttpRequest();
+ xmlHttp.open("GET", "/rest-api/auth/?"+string, true);
+ xmlHttp.send(null);
+} \ No newline at end of file
diff --git a/static/openbsd.img b/static/openbsd.img
new file mode 100644
index 0000000..2632260
--- /dev/null
+++ b/static/openbsd.img
Binary files differ
diff --git a/static/python.min.js b/static/python.min.js
new file mode 100644
index 0000000..71fa72a
--- /dev/null
+++ b/static/python.min.js
@@ -0,0 +1,9 @@
+(function(f){"object"==typeof exports&&"object"==typeof module?f(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],f):f(CodeMirror)})(function(f){f.defineMode("python",function(t,e){function m(a){return new RegExp("^(("+a.join(")|(")+"))\\b")}function l(a,b){if(a.sol()){var c=b.scopes[0].offset;if(a.eatSpace()){var d=a.indentation();d>c?k="indent":d<c&&(k="dedent");return null}0<c&&n(a,b)}if(a.eatSpace())return null;if("#"===a.peek())return a.skipToEnd(),
+"comment";if(a.match(/^[0-9\.]/,!1)){c=!1;a.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)&&(c=!0);a.match(/^\d+\.\d*/)&&(c=!0);a.match(/^\.\d+/)&&(c=!0);if(c)return a.eat(/J/i),"number";c=!1;a.match(/^0x[0-9a-f]+/i)&&(c=!0);a.match(/^0b[01]+/i)&&(c=!0);a.match(/^0o[0-7]+/i)&&(c=!0);a.match(/^[1-9]\d*(e[\+\-]?\d+)?/)&&(a.eat(/J/i),c=!0);a.match(/^0(?![\dx])/i)&&(c=!0);if(c)return a.eat(/L/i),"number"}if(a.match(q))return b.tokenize=u(a.current()),b.tokenize(a,b);if(a.match(v)||a.match(w))return null;if(a.match(x)||
+a.match(y)||a.match(z))return"operator";if(a.match(A))return null;if(a.match(B))return"keyword";if(a.match(C))return"builtin";if(a.match(/^(self|cls)\b/))return"variable-2";if(a.match(p))return"def"==b.lastToken||"class"==b.lastToken?"def":"variable";a.next();return"error"}function u(a){function b(b,f){for(;!b.eol();)if(b.eatWhile(/[^'"\\]/),b.eat("\\")){if(b.next(),c&&b.eol())return"string"}else{if(b.match(a))return f.tokenize=l,"string";b.eat(/['"]/)}if(c){if(e.singleLineStringErrors)return"error";
+f.tokenize=l}return"string"}for(;0<="rub".indexOf(a.charAt(0).toLowerCase());)a=a.substr(1);var c=1==a.length;b.isString=!0;return b}function r(a,b,c){c=c||"py";var d=0;if("py"===c){if("py"!==b.scopes[0].type){b.scopes[0].offset=a.indentation();return}for(a=0;a<b.scopes.length;++a)if("py"===b.scopes[a].type){d=b.scopes[a].offset+t.indentUnit;break}}else d=a.match(/\s*($|#)/,!1)?a.indentation()+D:a.column()+a.current().length;b.scopes.unshift({offset:d,type:c})}function n(a,b,c){c=c||"py";if(1!=b.scopes.length){if("py"===
+b.scopes[0].type){a=a.indentation();c=-1;for(var d=0;d<b.scopes.length;++d)if(a===b.scopes[d].offset){c=d;break}if(-1===c)return!0;for(;b.scopes[0].offset!==a;)b.scopes.shift()}else if("py"===c)b.scopes[0].offset=a.indentation();else{if(b.scopes[0].type!=c)return!0;b.scopes.shift()}return!1}}function E(a,b){k=null;var c=b.tokenize(a,b),d=a.current();if("."===d)return c=a.match(p,!1)?null:"error",null===c&&"meta"===b.lastStyle&&(c="meta"),c;if("@"===d)return a.match(p,!1)?"meta":"error";"variable"!==
+c&&"builtin"!==c||"meta"!==b.lastStyle||(c="meta");if("pass"===d||"return"===d)b.dedent+=1;"lambda"===d&&(b.lambda=!0);(":"===d&&!b.lambda&&"py"==b.scopes[0].type||"indent"===k)&&r(a,b);var e="[({".indexOf(d);-1!==e&&r(a,b,"])}".slice(e,e+1));if("dedent"===k&&n(a,b))return"error";e="])}".indexOf(d);if(-1!==e&&n(a,b,d))return"error";0<b.dedent&&a.eol()&&"py"==b.scopes[0].type&&(1<b.scopes.length&&b.scopes.shift(),--b.dedent);return c}var y=e.singleOperators||/^[\+\-\*/%&|\^~<>!]/,A=e.singleDelimiters||
+/^[\(\)\[\]\{\}@,:`=;\.]/,x=e.doubleOperators||/^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(\/\/)|(\*\*))/,w=e.doubleDelimiters||/^((\+=)|(\-=)|(\*=)|(%=)|(\/=)|(&=)|(\|=)|(\^=))/,v=e.tripleDelimiters||/^((\/\/=)|(>>=)|(<<=)|(\*\*=))/,p=e.identifiers||/^[_A-Za-z][_A-Za-z0-9]*/,D=e.hangingIndent||e.indentUnit,z=m(["and","or","not","is","in"]),g="as assert break class continue def del elif else except finally for from global if import lambda pass raise return try while with yield".split(" "),h="abs all any bin bool bytearray callable chr classmethod compile complex delattr dict dir divmod enumerate eval filter float format frozenset getattr globals hasattr hash help hex id input int isinstance issubclass iter len list locals map max memoryview min next object oct open ord pow property range repr reversed round set setattr slice sorted staticmethod str sum super tuple type vars zip __import__ NotImplemented Ellipsis __debug__".split(" "),
+F="apply basestring buffer cmp coerce execfile file intern long raw_input reduce reload unichr unicode xrange False True None".split(" "),G=["exec","print"],H=["ascii","bytes","exec","print"],I=["nonlocal","False","True","None"];void 0!=e.extra_keywords&&(g=g.concat(e.extra_keywords));void 0!=e.extra_builtins&&(h=h.concat(e.extra_builtins));if(e.version&&3===parseInt(e.version,10)){g=g.concat(I);h=h.concat(H);var q=/^(([rb]|(br))?('{3}|"{3}|['"]))/i}else g=g.concat(G),h=h.concat(F),q=/^(([rub]|(ur)|(br))?('{3}|"{3}|['"]))/i;
+var B=m(g),C=m(h),k=null;return{startState:function(a){return{tokenize:l,scopes:[{offset:a||0,type:"py"}],lastStyle:null,lastToken:null,lambda:!1,dedent:0}},token:function(a,b){var c=E(a,b);b.lastStyle=c;var d=a.current();d&&c&&(b.lastToken=d);a.eol()&&b.lambda&&(b.lambda=!1);return c},indent:function(a){return a.tokenize!=l?a.tokenize.isString?f.Pass:0:a.scopes[0].offset},lineComment:"#",fold:"indent"}});f.defineMIME("text/x-python","python");f.defineMIME("text/x-cython",{name:"python",extra_keywords:"by cdef cimport cpdef ctypedef enum exceptextern gil include nogil property publicreadonly struct union DEF IF ELIF ELSE".split(" ")})}); \ No newline at end of file
diff --git a/static/repl.js b/static/repl.js
new file mode 100644
index 0000000..391e4ea
--- /dev/null
+++ b/static/repl.js
@@ -0,0 +1,105 @@
+$(function () {
+ var repl = new CodeMirrorREPL('interactive', {
+ mode: "python",
+ theme: "solarized dark"
+ }),
+ compilableLines = [],
+ //finds lines starting with "print"
+ re = new RegExp("\\s*print"),
+ //finds import statements
+ importre = new RegExp("\\s*import"),
+ //finds multuline string constants
+ mls = new RegExp("'''"),
+ //finds defining statements
+ defre = new RegExp("def.*|class.*"),
+ //test for empty line.
+ emptyline = new RegExp("^\\s*$"),
+ //a regex to check if a line is an assignment
+ //this regex checks whether or not a line starts with
+ //an identifier followed with some whitspace and then an = and then some more white space.
+ //it also checks if the identifier is a tuple.
+ assignment = /^((\s*\(\s*(\s*((\s*((\s*[_a-zA-Z]\w*\s*)|(\s*\(\s*(\s*[_a-zA-Z]\w*\s*,)*\s*[_a-zA-Z]\w*\s*\)\s*))\s*)|(\s*\(\s*(\s*((\s*[_a-zA-Z]\w*\s*)|(\s*\(\s*(\s*[_a-zA-Z]\w*\s*,)*\s*[_a-zA-Z]\w*\s*\)\s*))\s*,)*\s*((\s*[_a-zA-Z]\w*\s*)|(\s*\(\s*(\s*[_a-zA-Z]\w*\s*,)*\s*[_a-zA-Z]\w*\s*\)\s*))\s*\)\s*))\s*,)*\s*((\s*((\s*[_a-zA-Z]\w*\s*)|(\s*\(\s*(\s*[_a-zA-Z]\w*\s*,)*\s*[_a-zA-Z]\w*\s*\)\s*))\s*)|(\s*\(\s*(\s*((\s*[_a-zA-Z]\w*\s*)|(\s*\(\s*(\s*[_a-zA-Z]\w*\s*,)*\s*[_a-zA-Z]\w*\s*\)\s*))\s*,)*\s*((\s*[_a-zA-Z]\w*\s*)|(\s*\(\s*(\s*[_a-zA-Z]\w*\s*,)*\s*[_a-zA-Z]\w*\s*\)\s*))\s*\)\s*))\s*\)\s*)|(\s*\s*(\s*((\s*((\s*[_a-zA-Z]\w*\s*)|(\s*\(\s*(\s*[_a-zA-Z]\w*\s*,)*\s*[_a-zA-Z]\w*\s*\)\s*))\s*)|(\s*\(\s*(\s*((\s*[_a-zA-Z]\w*\s*)|(\s*\(\s*(\s*[_a-zA-Z]\w*\s*,)*\s*[_a-zA-Z]\w*\s*\)\s*))\s*,)*\s*((\s*[_a-zA-Z]\w*\s*)|(\s*\(\s*(\s*[_a-zA-Z]\w*\s*,)*\s*[_a-zA-Z]\w*\s*\)\s*))\s*\)\s*))\s*,)*\s*((\s*((\s*[_a-zA-Z]\w*\s*)|(\s*\(\s*(\s*[_a-zA-Z]\w*\s*,)*\s*[_a-zA-Z]\w*\s*\)\s*))\s*)|(\s*\(\s*(\s*((\s*[_a-zA-Z]\w*\s*)|(\s*\(\s*(\s*[_a-zA-Z]\w*\s*,)*\s*[_a-zA-Z]\w*\s*\)\s*))\s*,)*\s*((\s*[_a-zA-Z]\w*\s*)|(\s*\(\s*(\s*[_a-zA-Z]\w*\s*,)*\s*[_a-zA-Z]\w*\s*\)\s*))\s*\)\s*))\s*\s*))=/;
+
+ repl.print("Connection as "+ localStorage.getItem("user") +" granted");
+ repl.print("Python 2.6.7 (default, " + new Date("2017-04-13T18:24:12") + ")");
+
+ repl.isBalanced = function (code) {
+ var lines = code.split('\n'),
+ depth = 0,
+ mlsopened = false,
+ l;
+
+ for (l = 0; l < lines.length; l = l + 1) {
+ if (lines[l].match(/'''/) !== null && lines[l].match(/'''/).length === 1) {
+ mlsopened = !mlsopened;
+ }
+ if (!mlsopened && lines[l].substr(lines[l].length - 1) === ":") {
+ depth = depth + 1;
+ }
+ if (!mlsopened && lines[l] === "" && depth > 0) {
+ depth = 0 ;
+ }
+ }
+ return depth === 0 && !mlsopened;
+ };
+
+ //Loop
+ repl.eval = function (code) {
+ Sk.configure({
+ output: function(str) {
+ //strip out line-feeds
+ if (str.replace(/\n/g, "") !== "") {
+ repl.print(str);
+ }
+ },
+ read: function (x) {
+ if (Sk.builtinFiles === undefined || Sk.builtinFiles["files"][x] === undefined) {
+ throw "File not found: '" + x + "'";
+ }
+ return Sk.builtinFiles["files"][x];
+ },
+ retainglobals: true
+ });
+
+ //split lines on linefeed
+ var lines = code.split('\n'), index = -1, line = 0;
+
+ //it's a onliner
+ if (lines.length === 1) {
+ //if it's a statement that should be printed (not containing an = or def or class or an empty line)
+ if (!assignment.test(lines[0]) && !defre.test(lines[0]) && !importre.test(lines[0]) && lines[0].length > 0) {
+ //if it doesn't contain print make sure it doesn't print None
+ if (!re.test(lines[0])) {
+ //remove the statement
+ //evaluate it if nessecary
+ lines.push("evaluationresult = " + lines.pop());
+ //print the result if not None
+ lines.push("if not evaluationresult == None: print repr(evaluationresult)");
+ }
+ }
+ }
+
+ try {
+ //Evaluate
+ if (!lines || /^\s*$/.test(lines)) {
+ return;
+ }
+ else {
+ Sk.importMainWithBody("repl", false, lines.join('\n'));
+ }
+ } catch (err) {
+ repl.print(err);
+
+ //find the line number
+ if ((index = err.toString().indexOf("on line")) !== -1) {
+ index = parseInt(err.toString().substr(index + 8), 10);
+ }
+
+ //print the accumulated code with a ">" before the broken line.
+ //Don't add the last statement to the accumulated code
+ lines.forEach(function (str) {
+ repl.print(++line + (index === line ? ">" : " ") + ": " + str);
+ });
+ }
+ };
+});
diff --git a/static/seabios.bin b/static/seabios.bin
new file mode 100644
index 0000000..1f4ecc0
--- /dev/null
+++ b/static/seabios.bin
Binary files differ
diff --git a/static/shell.css b/static/shell.css
new file mode 100644
index 0000000..b2c2a61
--- /dev/null
+++ b/static/shell.css
@@ -0,0 +1,34 @@
+html, body, p, a {
+ margin: 0;
+ font-family: "Courier New", fixed, monospace;
+ background: #181818;
+ color: #D3D3D3;
+}
+.term {
+ font-family: "Courier New", fixed, monospace;
+ font-size: 12px;
+ color: #5E83E0;
+ background: none;
+ letter-spacing: 1px;
+}
+.term .termReverse {
+ color: #232e45;
+ background: #5E83E0;
+}
+a.tlink, a.tlink:link, a.tlink:visited {
+ text-decoration: underline;
+ color: blue;
+}
+a, a:link, a:visited {
+ text-decoration: none;
+ color: #5E83E0;
+}
+a:hover {
+ text-decoration: underline;
+}
+a:active {
+ text-decoration: underline;
+ color: orange;
+}
+#applet { position: absolute; top: 4px; left: 4px; z-index: 2; }
+#link { position: absolute; top: 4px; right: 4px; z-index: 3; }
diff --git a/static/shell.min.js b/static/shell.min.js
new file mode 100644
index 0000000..f7f1298
--- /dev/null
+++ b/static/shell.min.js
@@ -0,0 +1,302 @@
+var Terminal=function(conf){if(typeof conf!="object")conf=new Object;else for(var i in this.Defaults)if(typeof conf[i]=="undefined")conf[i]=this.Defaults[i];this.conf=conf;this.setInitValues()};
+Terminal.prototype={version:"1.43 (original)",Defaults:{cols:80,rows:24,x:100,y:100,termDiv:"termDiv",bgColor:"#181818",frameColor:"#555555",frameWidth:1,rowHeight:15,blinkDelay:500,fontClass:"term",crsrBlinkMode:false,crsrBlockMode:true,DELisBS:false,printTab:true,printEuro:true,catchCtrlH:true,closeOnESC:true,historyUnique:false,id:0,ps:">",greeting:"%+r Terminal ready. %-r",handler:this.defaultHandler,ctrlHandler:null,initHandler:null,exitHandler:null,wrap:false},setInitValues:function(){this.isSafari=
+navigator.userAgent.indexOf("Safari")>=0?true:false;this.isOpera=window.opera&&navigator.userAgent.indexOf("Opera")>=0?true:false;this.id=this.conf.id;this.maxLines=this.conf.rows;this.maxCols=this.conf.cols;this.termDiv=this.conf.termDiv;this.crsrBlinkMode=this.conf.crsrBlinkMode;this.crsrBlockMode=this.conf.crsrBlockMode;this.blinkDelay=this.conf.blinkDelay;this.DELisBS=this.conf.DELisBS;this.printTab=this.conf.printTab;this.printEuro=this.conf.printEuro;this.catchCtrlH=this.conf.catchCtrlH;this.closeOnESC=
+this.conf.closeOnESC;this.historyUnique=this.conf.historyUnique;this.ps=this.conf.ps;this.closed=false;this.r;this.c;this.charBuf=new Array;this.styleBuf=new Array;this.scrollBuf=null;this.blinkBuffer=0;this.blinkTimer;this.cursoractive=false;this.lock=true;this.insert=false;this.charMode=false;this.rawMode=false;this.lineBuffer="";this.inputChar=0;this.lastLine="";this.guiCounter=0;this.history=new Array;this.histPtr=0;this.env=new Object;this.ns4ParentDoc=null;this.handler=this.conf.handler;this.wrapping=
+this.conf.wrapping;this.ctrlHandler=this.conf.ctrlHandler;this.initHandler=this.conf.initHandler;this.exitHandler=this.conf.exitHandler},defaultHandler:function(){this.newLine();if(this.lineBuffer!=""){this.type("You typed: "+this.lineBuffer);this.newLine()}this.prompt()},open:function(){if(this.termDivReady()){if(!this.closed)this._makeTerm();this.init();return true}else return false},close:function(){this.lock=true;this.cursorOff();if(this.exitHandler)this.exitHandler();this.globals.setVisible(this.termDiv,
+0);this.closed=true},init:function(){if(this.guiReady()){this.guiCounter=0;if(this.closed)this.setInitValues();this.clear();this.globals.setVisible(this.termDiv,1);this.globals.enableKeyboard(this);if(this.initHandler)this.initHandler();else{this.write(this.conf.greeting);this.newLine();this.prompt()}}else{this.guiCounter++;if(this.guiCounter>18E3)if(confirm("Terminal:\nYour browser hasn't responded for more than 2 minutes.\nRetry?"))this.guiCounter=0;else return;this.globals.termToInitialze=this;
+window.setTimeout("Terminal.prototype.globals.termToInitialze.init()",200)}},getRowArray:function(l,v){var a=new Array;for(var i=0;i<l;i++)a[i]=v;return a},wrapOn:function(){this.wrapping=true},wrapOff:function(){this.wrapping=false},type:function(text,style){for(var i=0;i<text.length;i++){var ch=text.charCodeAt(i);if(!this.isPrintable(ch))ch=94;this.charBuf[this.r][this.c]=ch;this.styleBuf[this.r][this.c]=style?style:0;var last_r=this.r;this._incCol();if(this.r!=last_r)this.redraw(last_r)}this.redraw(this.r)},
+write:function(text,usemore){if(typeof text!="object"){if(typeof text!="string")text=""+text;if(text.indexOf("\n")>=0){var ta=text.split("\n");text=ta.join("%n")}}else{if(text.join)text=text.join("%n");else text=""+text;if(text.indexOf("\n")>=0){var ta=text.split("\n");text=ta.join("%n")}}this._sbInit(usemore);var chunks=text.split("%");var esc=text.charAt(0)!="%";var style=0;var styleMarkUp=this.globals.termStyleMarkup;for(var i=0;i<chunks.length;i++)if(esc){if(chunks[i].length>0)this._sbType(chunks[i],
+style);else if(i>0)this._sbType("%",style);esc=false}else{var func=chunks[i].charAt(0);if(chunks[i].length==0&&i>0){this._sbType("%",style);esc=true}else if(func=="n"){this._sbNewLine(true);if(chunks[i].length>1)this._sbType(chunks[i].substring(1),style)}else if(func=="+"){var opt=chunks[i].charAt(1);opt=opt.toLowerCase();if(opt=="p")style=0;else if(styleMarkUp[opt])style|=styleMarkUp[opt];if(chunks[i].length>2)this._sbType(chunks[i].substring(2),style)}else if(func=="-"){var opt=chunks[i].charAt(1);
+opt=opt.toLowerCase();if(opt=="p")style=0;else if(styleMarkUp[opt])style&=~styleMarkUp[opt];if(chunks[i].length>2)this._sbType(chunks[i].substring(2),style)}else if(chunks[i].length>1&&func=="c"){var cinfo=this._parseColor(chunks[i].substring(1));style=style&~16777200|cinfo.style;if(cinfo.rest)this._sbType(cinfo.rest,style)}else if(chunks[i].length>1&&chunks[i].charAt(0)=="C"&&chunks[i].charAt(1)=="S"){this.clear();this._sbInit();if(chunks[i].length>2)this._sbType(chunks[i].substring(2),style)}else if(chunks[i].length>
+0)this._sbType(chunks[i],style)}this._sbOut()},_parseColor:function(chunk){var rest="";var style=0;if(chunk.length)if(chunk.charAt(0)=="("){var clabel="";for(var i=1;i<chunk.length;i++){var c=chunk.charAt(i);if(c==")"){if(chunk.length>i)rest=chunk.substring(i+1);break}clabel+=c}if(clabel)if(clabel.charAt(0)=="@"){var sc=this.globals.nsColors[clabel.substring(1).toLowerCase()];if(sc)style=(16+sc)*256}else if(clabel.charAt(0)=="#"){var cl=clabel.substring(1).toLowerCase();var sc=this.globals.webColors[cl];
+if(sc)style=sc*65536;else{cl=this.globals.webifyColor(cl);if(cl)style=this.globals.webColors[cl]*65536}}else if(clabel.length&&clabel.length<=2){var isHex=false;for(var i=0;i<clabel.length;i++)if(this.globals.isHexOnlyChar(clabel.charAt(i))){isHex=true;break}var cl=isHex?parseInt(clabel,16):parseInt(clabel,10);if(!isNaN(cl)||cl<=15)style=cl*256}else style=this.globals.getColorCode(clabel)*256}else{var c=chunk.charAt(0);if(this.globals.isHexChar(c)){style=this.globals.hexToNum[c]*256;rest=chunk.substring(1)}else rest=
+chunk}return{rest:rest,style:style}},_sbInit:function(usemore){var sb=this.scrollBuf=new Object;var sbl=sb.lines=new Array;var sbs=sb.styles=new Array;sb.more=usemore;sb.line=0;sb.status=0;sb.r=0;sb.c=this.c;sbl[0]=this.getRowArray(this.conf.cols,0);sbs[0]=this.getRowArray(this.conf.cols,0);for(var i=0;i<this.c;i++){sbl[0][i]=this.charBuf[this.r][i];sbs[0][i]=this.styleBuf[this.r][i]}},_sbType:function(text,style){var sb=this.scrollBuf;for(var i=0;i<text.length;i++){var ch=text.charCodeAt(i);if(!this.isPrintable(ch))ch=
+94;sb.lines[sb.r][sb.c]=ch;sb.styles[sb.r][sb.c++]=style?style:0;if(sb.c>=this.maxCols)this._sbNewLine()}},_sbNewLine:function(forced){var sb=this.scrollBuf;if(this.wrapping&&forced){sb.lines[sb.r][sb.c]=10;sb.lines[sb.r].length=sb.c+1}sb.r++;sb.c=0;sb.lines[sb.r]=this.getRowArray(this.conf.cols,0);sb.styles[sb.r]=this.getRowArray(this.conf.cols,0)},_sbWrap:function(){var wb=new Object;wb.lines=new Array;wb.styles=new Array;wb.lines[0]=this.getRowArray(this.conf.cols,0);wb.styles[0]=this.getRowArray(this.conf.cols,
+0);wb.r=0;wb.c=0;var sb=this.scrollBuf;var sbl=sb.lines;var sbs=sb.styles;var ch,st,wrap,lc,ls;var l=this.c;var lastR=0;var lastC=0;wb.cBreak=false;for(var r=0;r<sbl.length;r++){lc=sbl[r];ls=sbs[r];for(var c=0;c<lc.length;c++){ch=lc[c];st=ls[c];if(ch){var wrap=this.globals.wrapChars[ch];if(ch==10)wrap=1;if(wrap){if(wrap==2)l++;else if(wrap==4){l++;lc[c]=45}this._wbOut(wb,lastR,lastC,l);if(ch==10)this._wbIncLine(wb);else if(wrap==1&&wb.c<this.maxCols){wb.lines[wb.r][wb.c]=ch;wb.styles[wb.r][wb.c++]=
+st;if(wb.c>=this.maxCols)this._wbIncLine(wb)}if(wrap==3){lastR=r;lastC=c;l=1}else{l=0;lastR=r;lastC=c+1;if(lastC==lc.length){lastR++;lastC=0}if(wrap==4)wb.cBreak=true}}else l++}else continue}}if(l){if(wb.cbreak&&wb.c!=0)wb.c--;this._wbOut(wb,lastR,lastC,l)}sb.lines=wb.lines;sb.styles=wb.styles;sb.r=wb.r;sb.c=wb.c},_wbOut:function(wb,br,bc,l){var sb=this.scrollBuf;var sbl=sb.lines;var sbs=sb.styles;var ofs=0;var lc,ls;if(l+wb.c>this.maxCols)if(l<this.maxCols)this._wbIncLine(wb);else{var i0=0;ofs=this.maxCols-
+wb.c;lc=sbl[br];ls=sbs[br];while(true){for(var i=i0;i<ofs;i++){wb.lines[wb.r][wb.c]=lc[bc];wb.styles[wb.r][wb.c++]=ls[bc++];if(bc==sbl[br].length){bc=0;br++;lc=sbl[br];ls=sbs[br]}}this._wbIncLine(wb);if(l-ofs<this.maxCols)break;i0=ofs;ofs+=this.maxCols}}else if(wb.cBreak)wb.c--;lc=sbl[br];ls=sbs[br];for(var i=ofs;i<l;i++){wb.lines[wb.r][wb.c]=lc[bc];wb.styles[wb.r][wb.c++]=ls[bc++];if(bc==sbl[br].length){bc=0;br++;lc=sbl[br];ls=sbs[br]}}wb.cBreak=false},_wbIncLine:function(wb){wb.r++;wb.c=0;wb.lines[wb.r]=
+this.getRowArray(this.conf.cols,0);wb.styles[wb.r]=this.getRowArray(this.conf.cols,0)},_sbOut:function(){var sb=this.scrollBuf;if(this.wrapping&&!sb.status)this._sbWrap();var sbl=sb.lines;var sbs=sb.styles;var tcb=this.charBuf;var tsb=this.styleBuf;var ml=this.maxLines;var buflen=sbl.length;if(sb.more)if(sb.status)if(this.inputChar==this.globals.lcMoreKeyAbort){this.r=ml-1;this.c=0;tcb[this.r]=this.getRowArray(this.conf.cols,0);tsb[this.r]=this.getRowArray(this.conf.cols,0);this.redraw(this.r);this.handler=
+sb.handler;this.charMode=false;this.inputChar=0;this.scrollBuf=null;this.prompt();return}else if(this.inputChar==this.globals.lcMoreKeyContinue)this.clear();else return;else if(this.r>=ml-1)this.clear();if(this.r+buflen-sb.line<=ml){for(var i=sb.line;i<buflen;i++){var r=this.r+i-sb.line;tcb[r]=sbl[i];tsb[r]=sbs[i];this.redraw(r)}this.r+=sb.r-sb.line;this.c=sb.c;if(sb.more){if(sb.status)this.handler=sb.handler;this.charMode=false;this.inputChar=0;this.scrollBuf=null;this.prompt();return}}else if(sb.more){ml--;
+if(sb.status==0){sb.handler=this.handler;this.handler=this._sbOut;this.charMode=true;sb.status=1}if(this.r){var ofs=ml-this.r;for(var i=sb.line;i<ofs;i++){var r=this.r+i-sb.line;tcb[r]=sbl[i];tsb[r]=sbs[i];this.redraw(r)}}else{var ofs=sb.line+ml;for(var i=sb.line;i<ofs;i++){var r=this.r+i-sb.line;tcb[r]=sbl[i];tsb[r]=sbs[i];this.redraw(r)}}sb.line=ofs;this.r=ml;this.c=0;this.type(this.globals.lcMorePrompt1,this.globals.lcMorePromtp1Style);this.type(this.globals.lcMorePrompt2,this.globals.lcMorePrompt2Style);
+this.lock=false;return}else if(buflen>=ml){var ofs=buflen-ml;for(var i=0;i<ml;i++){var r=ofs+i;tcb[i]=sbl[r];tsb[i]=sbs[r];this.redraw(i)}this.r=ml-1;this.c=sb.c}else{var dr=ml-buflen;var ofs=this.r-dr;for(var i=0;i<dr;i++){var r=ofs+i;for(var c=0;c<this.maxCols;c++){tcb[i][c]=tcb[r][c];tsb[i][c]=tsb[r][c]}this.redraw(i)}for(var i=0;i<buflen;i++){var r=dr+i;tcb[r]=sbl[i];tsb[r]=sbs[i];this.redraw(r)}this.r=ml-1;this.c=sb.c}this.scrollBuf=null},typeAt:function(r,c,text,style){var tr1=this.r;var tc1=
+this.c;this.cursorSet(r,c);for(var i=0;i<text.length;i++){var ch=text.charCodeAt(i);if(!this.isPrintable(ch))ch=94;this.charBuf[this.r][this.c]=ch;this.styleBuf[this.r][this.c]=style?style:0;var last_r=this.r;this._incCol();if(this.r!=last_r)this.redraw(last_r)}this.redraw(this.r);this.r=tr1;this.c=tc1},statusLine:function(text,style,offset){var ch,r;style=style&&!isNaN(style)?parseInt(style)&15:0;if(offset&&offset>0)r=this.conf.rows-offset;else r=this.conf.rows-1;for(var i=0;i<this.conf.cols;i++){if(i<
+text.length){ch=text.charCodeAt(i);if(!this.isPrintable(ch))ch=94}else ch=0;this.charBuf[r][i]=ch;this.styleBuf[r][i]=style}this.redraw(r)},printRowFromString:function(r,text,style){var ch;style=style&&!isNaN(style)?parseInt(style)&15:0;if(r>=0&&r<this.maxLines){if(typeof text!="string")text=""+text;for(var i=0;i<this.conf.cols;i++){if(i<text.length){ch=text.charCodeAt(i);if(!this.isPrintable(ch))ch=94}else ch=0;this.charBuf[r][i]=ch;this.styleBuf[r][i]=style}this.redraw(r)}},setChar:function(ch,
+r,c,style){this.charBuf[r][c]=ch;this.styleBuf[this.r][this.c]=style?style:0;this.redraw(r)},newLine:function(){this.c=0;this._incRow()},_charOut:function(ch,style){this.charBuf[this.r][this.c]=ch;this.styleBuf[this.r][this.c]=style?style:0;this.redraw(this.r);this._incCol()},_incCol:function(){this.c++;if(this.c>=this.maxCols){this.c=0;this._incRow()}},_incRow:function(){this.r++;if(this.r>=this.maxLines){this._scrollLines(0,this.maxLines);this.r=this.maxLines-1}},_scrollLines:function(start,end){window.status=
+"Scrolling lines ...";start++;for(var ri=start;ri<end;ri++){var rt=ri-1;this.charBuf[rt]=this.charBuf[ri];this.styleBuf[rt]=this.styleBuf[ri]}var rt=end-1;this.charBuf[rt]=this.getRowArray(this.conf.cols,0);this.styleBuf[rt]=this.getRowArray(this.conf.cols,0);this.redraw(rt);for(var r=end-1;r>=start;r--)this.redraw(r-1);window.status=""},clear:function(){window.status="Clearing display ...";this.cursorOff();this.insert=false;for(var ri=0;ri<this.maxLines;ri++){this.charBuf[ri]=this.getRowArray(this.conf.cols,
+0);this.styleBuf[ri]=this.getRowArray(this.conf.cols,0);this.redraw(ri)}this.r=0;this.c=0;window.status=""},reset:function(){if(this.lock)return;this.lock=true;this.rawMode=false;this.charMode=false;this.maxLines=this.conf.rows;this.maxCols=this.conf.cols;this.lastLine="";this.lineBuffer="";this.inputChar=0;this.clear()},prompt:function(){this.lock=true;if(this.c>0)this.newLine();this.type(this.ps);this._charOut(1);this.lock=false;this.cursorOn()},isPrintable:function(ch,unicodePage1only){if(this.wrapping&&
+this.globals.wrapChars[ch]==4)return true;if(unicodePage1only&&ch>255)return ch==this.termKey.EURO&&this.printEuro?true:false;return ch>=32&&ch!=this.termKey.DEL||this.printTab&&ch==this.termKey.TAB},cursorSet:function(r,c){var crsron=this.cursoractive;if(crsron)this.cursorOff();this.r=r%this.maxLines;this.c=c%this.maxCols;this._cursorReset(crsron)},cursorOn:function(){if(this.blinkTimer)clearTimeout(this.blinkTimer);this.blinkBuffer=this.styleBuf[this.r][this.c];this._cursorBlink();this.cursoractive=
+true},cursorOff:function(){if(this.blinkTimer)clearTimeout(this.blinkTimer);if(this.cursoractive){this.styleBuf[this.r][this.c]=this.blinkBuffer;this.redraw(this.r);this.cursoractive=false}},cursorLeft:function(){var crsron=this.cursoractive;if(crsron)this.cursorOff();var r=this.r;var c=this.c;if(c>0)c--;else if(r>0){c=this.maxCols-1;r--}if(this.isPrintable(this.charBuf[r][c])){this.r=r;this.c=c}this.insert=true;this._cursorReset(crsron)},cursorRight:function(){var crsron=this.cursoractive;if(crsron)this.cursorOff();
+var r=this.r;var c=this.c;if(c<this.maxCols-1)c++;else if(r<this.maxLines-1){c=0;r++}if(!this.isPrintable(this.charBuf[r][c]))this.insert=false;if(this.isPrintable(this.charBuf[this.r][this.c])){this.r=r;this.c=c}this._cursorReset(crsron)},backspace:function(){var crsron=this.cursoractive;if(crsron)this.cursorOff();var r=this.r;var c=this.c;if(c>0)c--;else if(r>0){c=this.maxCols-1;r--}if(this.isPrintable(this.charBuf[r][c])){this._scrollLeft(r,c);this.r=r;this.c=c}this._cursorReset(crsron)},fwdDelete:function(){var crsron=
+this.cursoractive;if(crsron)this.cursorOff();if(this.isPrintable(this.charBuf[this.r][this.c])){this._scrollLeft(this.r,this.c);if(!this.isPrintable(this.charBuf[this.r][this.c]))this.insert=false}this._cursorReset(crsron)},_cursorReset:function(crsron){if(crsron)this.cursorOn();else this.blinkBuffer=this.styleBuf[this.r][this.c]},_cursorBlink:function(){if(this.blinkTimer)clearTimeout(this.blinkTimer);if(this==this.globals.activeTerm){if(this.crsrBlockMode)this.styleBuf[this.r][this.c]=this.styleBuf[this.r][this.c]&
+1?this.styleBuf[this.r][this.c]&254:this.styleBuf[this.r][this.c]|1;else this.styleBuf[this.r][this.c]=this.styleBuf[this.r][this.c]&2?this.styleBuf[this.r][this.c]&253:this.styleBuf[this.r][this.c]|2;this.redraw(this.r)}if(this.crsrBlinkMode)this.blinkTimer=setTimeout("Terminal.prototype.globals.activeTerm._cursorBlink()",this.blinkDelay)},_scrollLeft:function(r,c){var rows=new Array;rows[0]=r;while(this.isPrintable(this.charBuf[r][c])){var ri=r;var ci=c+1;if(ci==this.maxCols)if(ri<this.maxLines-
+1){ci=0;ri++;rows[rows.length]=ri}else break;this.charBuf[r][c]=this.charBuf[ri][ci];this.styleBuf[r][c]=this.styleBuf[ri][ci];c=ci;r=ri}if(this.charBuf[r][c]!=0)this.charBuf[r][c]=0;for(var i=0;i<rows.length;i++)this.redraw(rows[i])},_scrollRight:function(r,c){var rows=new Array;var end=this._getLineEnd(r,c);var ri=end[0];var ci=end[1];if(ci==this.maxCols-1&&ri==this.maxLines-1){if(r==0)return;this._scrollLines(0,this.maxLines);this.r--;r--;ri--}rows[r]=1;while(this.isPrintable(this.charBuf[ri][ci])){var rt=
+ri;var ct=ci+1;if(ct==this.maxCols){ct=0;rt++;rows[rt]=1}this.charBuf[rt][ct]=this.charBuf[ri][ci];this.styleBuf[rt][ct]=this.styleBuf[ri][ci];if(ri==r&&ci==c)break;ci--;if(ci<0){ci=this.maxCols-1;ri--;rows[ri]=1}}for(var i=r;i<this.maxLines;i++)if(rows[i])this.redraw(i)},_getLineEnd:function(r,c){if(!this.isPrintable(this.charBuf[r][c])){c--;if(c<0)if(r>0){r--;c=this.maxCols-1}else c=0}if(this.isPrintable(this.charBuf[r][c]))while(true){var ri=r;var ci=c+1;if(ci==this.maxCols)if(ri<this.maxLines-
+1){ri++;ci=0}else break;if(!this.isPrintable(this.charBuf[ri][ci]))break;c=ci;r=ri}return[r,c]},_getLineStart:function(r,c){var ci,ri;if(!this.isPrintable(this.charBuf[r][c])){ci=c-1;ri=r;if(ci<0){if(ri==0)return[0,0];ci=this.maxCols-1;ri--}if(!this.isPrintable(this.charBuf[ri][ci]))return[r,c];else{r=ri;c=ci}}while(true){var ri=r;var ci=c-1;if(ci<0){if(ri==0)break;ci=this.maxCols-1;ri--}if(!this.isPrintable(this.charBuf[ri][ci]))break;r=ri;c=ci}return[r,c]},_getLine:function(){var end=this._getLineEnd(this.r,
+this.c);var r=end[0];var c=end[1];var line=new Array;while(this.isPrintable(this.charBuf[r][c])){line[line.length]=String.fromCharCode(this.charBuf[r][c]);if(c>0)c--;else if(r>0){c=this.maxCols-1;r--}else break}line.reverse();return line.join("")},_clearLine:function(){var end=this._getLineEnd(this.r,this.c);var r=end[0];var c=end[1];var line="";while(this.isPrintable(this.charBuf[r][c])){this.charBuf[r][c]=0;if(c>0)c--;else if(r>0){this.redraw(r);c=this.maxCols-1;r--}else break}if(r!=end[0])this.redraw(r);
+c++;this.cursorSet(r,c);this.insert=false},focus:function(){this.globals.setFocus(this)},termKey:null,_makeTerm:function(rebuild){window.status="Building terminal ...";this.globals.hasLayers=document.layers?true:false;this.globals.hasSubDivs=navigator.userAgent.indexOf("Gecko")<0;var divPrefix=this.termDiv+"_r";var s="";s+='<table border="0" cellspacing="0" cellpadding="'+this.conf.frameWidth+'">\n';s+='<tr><td bgcolor="'+this.conf.frameColor+'"><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="'+
+this.conf.bgColor+'"><table border="0" cellspacing="0" cellpadding="0">\n';var rstr="";for(var c=0;c<this.conf.cols;c++)rstr+="&nbsp;";for(var r=0;r<this.conf.rows;r++){var termid=this.globals.hasLayers||this.globals.hasSubDivs?"":' id="'+divPrefix+r+'"';s+='<tr><td nowrap height="'+this.conf.rowHeight+'"'+termid+' class="'+this.conf.fontClass+'">'+rstr+"</td></tr>\n"}s+="</table></td></tr>\n";s+="</table></td></tr>\n";s+="</table>\n";var termOffset=48+this.conf.frameWidth;if(this.globals.hasLayers){for(var r=
+0;r<this.conf.rows;r++)s+='<layer name="'+divPrefix+r+'" top="'+(termOffset+r*this.conf.rowHeight)+'" left="'+termOffset+'" class="'+this.conf.fontClass+'"></layer>\n';this.ns4ParentDoc=document.layers[this.termDiv].document;this.globals.termStringStart='<table border="0" cellspacing="0" cellpadding="0"><tr><td nowrap height="'+this.conf.rowHeight+'" class="'+this.conf.fontClass+'">';this.globals.termStringEnd="</td></tr></table>"}else if(this.globals.hasSubDivs){for(var r=0;r<this.conf.rows;r++)s+=
+'<div id="'+divPrefix+r+'" style="position:absolute; top:'+(termOffset+r*this.conf.rowHeight)+"px; left: "+termOffset+'px;" class="'+this.conf.fontClass+'"></div>\n';this.globals.termStringStart='<table border="0" cellspacing="0" cellpadding="0"><tr><td nowrap height="'+this.conf.rowHeight+'" class="'+this.conf.fontClass+'">';this.globals.termStringEnd="</td></tr></table>"}this.globals.writeElement(this.termDiv,s);if(!rebuild){this.globals.setElementXY(this.termDiv,this.conf.x,this.conf.y);this.globals.setVisible(this.termDiv,
+1)}window.status=""},rebuild:function(){var rl=this.conf.rows;var cl=this.conf.cols;for(var r=0;r<rl;r++){var cbr=this.charBuf[r];if(!cbr){this.charBuf[r]=this.getRowArray(cl,0);this.styleBuf[r]=this.getRowArray(cl,0)}else if(cbr.length<cl)for(var c=cbr.length;c<cl;c++){this.charBuf[r][c]=0;this.styleBuf[r][c]=0}}var resetcrsr=false;if(this.r>=rl){r=rl-1;resetcrsr=true}if(this.c>=cl){c=cl-1;resetcrsr=true}if(resetcrsr&&this.cursoractive)this.cursorOn();this._makeTerm(true);for(var r=0;r<rl;r++)this.redraw(r)},
+moveTo:function(x,y){this.globals.setElementXY(this.termDiv,x,y)},resizeTo:function(x,y){if(this.termDivReady()){x=parseInt(x,10);y=parseInt(y,10);if(isNaN(x)||isNaN(y)||x<4||y<2)return false;this.maxCols=this.conf.cols=x;this.maxLines=this.conf.rows=y;this._makeTerm();this.clear();return true}else return false},redraw:function(r){var s=this.globals.termStringStart;var curStyle=0;var tstls=this.globals.termStyles;var tscls=this.globals.termStyleClose;var tsopn=this.globals.termStyleOpen;var tspcl=
+this.globals.termSpecials;var tclrs=this.globals.colorCodes;var tnclrs=this.globals.nsColorCodes;var twclrs=this.globals.webColorCodes;var t_cb=this.charBuf;var t_sb=this.styleBuf;var clr;for(var i=0;i<this.conf.cols;i++){var c=t_cb[r][i];var cs=t_sb[r][i];if(cs!=curStyle){if(curStyle){if(curStyle&16776960)s+="</span>";for(var k=tstls.length-1;k>=0;k--){var st=tstls[k];if(curStyle&st)s+=tscls[st]}}curStyle=cs;for(var k=0;k<tstls.length;k++){var st=tstls[k];if(curStyle&st)s+=tsopn[st]}clr="";if(curStyle&
+65280){var cc=(curStyle&65280)>>>8;clr=cc<16?tclrs[cc]:"#"+tnclrs[cc-16]}else if(curStyle&16711680)clr="#"+twclrs[(curStyle&16711680)>>>16];if(clr)if(curStyle&1)s+='<span style="background-color:'+clr+' !important;">';else s+='<span style="color:'+clr+' !important;">'}s+=tspcl[c]?tspcl[c]:String.fromCharCode(c)}if(curStyle>0){if(curStyle&16776960)s+="</span>";for(var k=tstls.length-1;k>=0;k--){var st=tstls[k];if(curStyle&st)s+=tscls[st]}}s+=this.globals.termStringEnd;this.globals.writeElement(this.termDiv+
+"_r"+r,s,this.ns4ParentDoc)},guiReady:function(){ready=true;if(this.globals.guiElementsReady(this.termDiv,window.document))for(var r=0;r<this.conf.rows;r++){if(this.globals.guiElementsReady(this.termDiv+"_r"+r,this.ns4ParentDoc)==false){ready=false;break}}else ready=false;return ready},termDivReady:function(){if(document.layers)return document.layers[this.termDiv]?true:false;else if(document.getElementById)return document.getElementById(this.termDiv)?true:false;else if(document.all)return document.all[this.termDiv]?
+true:false;else return false},getDimensions:function(){var w=0;var h=0;var d=this.termDiv;if(document.layers){if(document.layers[d]){w=document.layers[d].clip.right;h=document.layers[d].clip.bottom}}else if(document.getElementById){var obj=document.getElementById(d);if(obj&&obj.firstChild){w=parseInt(obj.firstChild.offsetWidth,10);h=parseInt(obj.firstChild.offsetHeight,10)}else if(obj&&obj.children&&obj.children[0]){w=parseInt(obj.children[0].offsetWidth,10);h=parseInt(obj.children[0].offsetHeight,
+10)}}else if(document.all){var obj=document.all[d];if(obj&&obj.children&&obj.children[0]){w=parseInt(obj.children[0].offsetWidth,10);h=parseInt(obj.children[0].offsetHeight,10)}}return{width:w,height:h}},globals:{termToInitialze:null,activeTerm:null,kbdEnabled:false,keylock:false,keyRepeatDelay1:450,keyRepeatDelay2:100,keyRepeatTimer:null,lcMorePrompt1:" -- MORE -- ",lcMorePromtp1Style:1,lcMorePrompt2:" (Type: space to continue, 'q' to quit)",lcMorePrompt2Style:0,lcMoreKeyAbort:113,lcMoreKeyContinue:32,
+_initGlobals:function(){var tg=Terminal.prototype.globals;tg._extendMissingStringMethods();tg._initWebColors();tg._initDomKeyRef();Terminal.prototype.termKey=tg.termKey},getHexChar:function(c){var tg=Terminal.prototype.globals;if(tg.isHexChar(c))return tg.hexToNum[c];return-1},isHexChar:function(c){return c>="0"&&c<="9"||c>="a"&&c<="f"||c>="A"&&c<="F"?true:false},isHexOnlyChar:function(c){return c>="a"&&c<="f"||c>="A"&&c<="F"?true:false},hexToNum:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,"a":10,"b":11,
+"c":12,"d":13,"e":14,"f":15,"A":10,"B":11,"C":12,"D":13,"E":14,"F":15},webColors:[],webColorCodes:[""],colors:{black:1,red:2,green:3,yellow:4,blue:5,magenta:6,cyan:7,white:8,grey:9,red2:10,green2:11,yellow2:12,blue2:13,magenta2:14,cyan2:15,red1:2,green1:3,yellow1:4,blue1:5,magenta1:6,cyan1:7,gray:9,darkred:10,darkgreen:11,darkyellow:12,darkblue:13,darkmagenta:14,darkcyan:15,"default":0,clear:0},colorCodes:["","#000000","#ff0000","#00ff00","#ffff00","#0066ff","#ff00ff","#00ffff","#ffffff","#808080",
+"#990000","#009900","#999900","#003399","#990099","#009999"],nsColors:{"aliceblue":1,"antiquewhite":2,"aqua":3,"aquamarine":4,"azure":5,"beige":6,"black":7,"blue":8,"blueviolet":9,"brown":10,"burlywood":11,"cadetblue":12,"chartreuse":13,"chocolate":14,"coral":15,"cornflowerblue":16,"cornsilk":17,"crimson":18,"darkblue":19,"darkcyan":20,"darkgoldenrod":21,"darkgray":22,"darkgreen":23,"darkkhaki":24,"darkmagenta":25,"darkolivegreen":26,"darkorange":27,"darkorchid":28,"darkred":29,"darksalmon":30,"darkseagreen":31,
+"darkslateblue":32,"darkslategray":33,"darkturquoise":34,"darkviolet":35,"deeppink":36,"deepskyblue":37,"dimgray":38,"dodgerblue":39,"firebrick":40,"floralwhite":41,"forestgreen":42,"fuchsia":43,"gainsboro":44,"ghostwhite":45,"gold":46,"goldenrod":47,"gray":48,"green":49,"greenyellow":50,"honeydew":51,"hotpink":52,"indianred":53,"indigo":54,"ivory":55,"khaki":56,"lavender":57,"lavenderblush":58,"lawngreen":59,"lemonchiffon":60,"lightblue":61,"lightcoral":62,"lightcyan":63,"lightgoldenrodyellow":64,
+"lightgreen":65,"lightgrey":66,"lightpink":67,"lightsalmon":68,"lightseagreen":69,"lightskyblue":70,"lightslategray":71,"lightsteelblue":72,"lightyellow":73,"lime":74,"limegreen":75,"linen":76,"maroon":77,"mediumaquamarine":78,"mediumblue":79,"mediumorchid":80,"mediumpurple":81,"mediumseagreen":82,"mediumslateblue":83,"mediumspringgreen":84,"mediumturquoise":85,"mediumvioletred":86,"midnightblue":87,"mintcream":88,"mistyrose":89,"moccasin":90,"navajowhite":91,"navy":92,"oldlace":93,"olive":94,"olivedrab":95,
+"orange":96,"orangered":97,"orchid":98,"palegoldenrod":99,"palegreen":100,"paleturquoise":101,"palevioletred":102,"papayawhip":103,"peachpuff":104,"peru":105,"pink":106,"plum":107,"powderblue":108,"purple":109,"red":110,"rosybrown":111,"royalblue":112,"saddlebrown":113,"salmon":114,"sandybrown":115,"seagreen":116,"seashell":117,"sienna":118,"silver":119,"skyblue":120,"slateblue":121,"slategray":122,"snow":123,"springgreen":124,"steelblue":125,"tan":126,"teal":127,"thistle":128,"tomato":129,"turquoise":130,
+"violet":131,"wheat":132,"white":133,"whitesmoke":134,"yellow":135,"yellowgreen":136},nsColorCodes:["","f0f8ff","faebd7","00ffff","7fffd4","f0ffff","f5f5dc","000000","0000ff","8a2be2","a52a2a","deb887","5f9ea0","7fff00","d2691e","ff7f50","6495ed","fff8dc","dc143c","00008b","008b8b","b8860b","a9a9a9","006400","bdb76b","8b008b","556b2f","ff8c00","9932cc","8b0000","e9967a","8fbc8f","483d8b","2f4f4f","00ced1","9400d3","ff1493","00bfff","696969","1e90ff","b22222","fffaf0","228b22","ff00ff","dcdcdc","f8f8ff",
+"ffd700","daa520","808080","008000","adff2f","f0fff0","ff69b4","cd5c5c","4b0082","fffff0","f0e68c","e6e6fa","fff0f5","7cfc00","fffacd","add8e6","f08080","e0ffff","fafad2","90ee90","d3d3d3","ffb6c1","ffa07a","20b2aa","87cefa","778899","b0c4de","ffffe0","00ff00","32cd32","faf0e6","800000","66cdaa","0000cd","ba55d3","9370db","3cb371","7b68ee","00fa9a","48d1cc","c71585","191970","f5fffa","ffe4e1","ffe4b5","ffdead","000080","fdf5e6","808000","6b8e23","ffa500","ff4500","da70d6","eee8aa","98fb98","afeeee",
+"db7093","ffefd5","ffdab9","cd853f","ffc0cb","dda0dd","b0e0e6","800080","ff0000","bc8f8f","4169e1","8b4513","fa8072","f4a460","2e8b57","fff5ee","a0522d","c0c0c0","87ceeb","6a5acd","708090","fffafa","00ff7f","4682b4","d2b48c","008080","d8bfd8","ff6347","40e0d0","ee82ee","f5deb3","ffffff","f5f5f5","ffff00","9acd32"],_webSwatchChars:["0","3","6","9","c","f"],_initWebColors:function(){var tg=Terminal.prototype.globals;var ws=tg._webColorSwatch;var wn=tg.webColors;var cc=tg.webColorCodes;var n=1;var a,
+b,c,al,bl,bs,cl;for(var i=0;i<6;i++){a=tg._webSwatchChars[i];al=a+a;for(var j=0;j<6;j++){b=tg._webSwatchChars[j];bl=al+b+b;bs=a+b;for(var k=0;k<6;k++){c=tg._webSwatchChars[k];cl=bl+c+c;wn[bs+c]=wn[cl]=n;cc[n]=cl;n++}}}},webifyColor:function(s){var tg=Terminal.prototype.globals;if(s.length==6){var c="";for(var i=0;i<6;i+=2){var a=s.charAt(i);var b=s.charAt(i+1);if(tg.isHexChar(a)&&tg.isHexChar(b))c+=tg._webSwatchChars[Math.round(parseInt(a+b,16)/255*5)];else return""}return c}else if(s.length==3){var c=
+"";for(var i=0;i<3;i++){var a=s.charAt(i);if(tg.isHexChar(a))c+=tg._webSwatchChars[Math.round(parseInt(a,16)/15*5)];else return""}return c}else return""},setColor:function(label,value){var tg=Terminal.prototype.globals;if(typeof label=="number"&&label>=1&&label<=15)tg.colorCodes[label]=value;else if(typeof label=="string"){label=label.toLowerCase();if(label.length==1&&tg.isHexChar(label)){var n=tg.hexToNum[label];if(n)tg.colorCodes[n]=value}else if(typeof tg.colors[label]!="undefined"){var n=tg.colors[label];
+if(n)tg.colorCodes[n]=value}}},getColorString:function(label){var tg=Terminal.prototype.globals;if(typeof label=="number"&&label>=0&&label<=15)return tg.colorCodes[label];else if(typeof label=="string"){label=label.toLowerCase();if(label.length==1&&tg.isHexChar(label))return tg.colorCodes[tg.hexToNum[label]];else if(typeof tg.colors[label]!="undefined")return tg.colorCodes[tg.colors[label]]}return""},getColorCode:function(label){var tg=Terminal.prototype.globals;if(typeof label=="number"&&label>=
+0&&label<=15)return label;else if(typeof label=="string"){label=label.toLowerCase();if(label.length==1&&tg.isHexChar(label))return parseInt(label,16);else if(typeof tg.colors[label]!="undefined")return tg.colors[label]}return 0},insertText:function(text){var tg=Terminal.prototype.globals;var termRef=tg.activeTerm;if(!termRef||termRef.closed||tg.keylock||termRef.lock||termRef.charMode)return false;for(var i=0;i<text.length;i++)tg.keyHandler({which:text.charCodeAt(i),_remapped:true});return true},importEachLine:function(text){var tg=
+Terminal.prototype.globals;var termRef=tg.activeTerm;if(!termRef||termRef.closed||tg.keylock||termRef.lock||termRef.charMode)return false;termRef.cursorOff();termRef._clearLine();text=text.replace(/\r\n?/g,"\n");var t=text.split("\n");for(var i=0;i<t.length;i++){for(var k=0;k<t[i].length;k++)tg.keyHandler({which:t[i].charCodeAt(k),_remapped:true});tg.keyHandler({which:term.termKey.CR,_remapped:true})}return true},importMultiLine:function(text){var tg=Terminal.prototype.globals;var termRef=tg.activeTerm;
+if(!termRef||termRef.closed||tg.keylock||termRef.lock||termRef.charMode)return false;termRef.lock=true;termRef.cursorOff();termRef._clearLine();text=text.replace(/\r\n?/g,"\n");var lines=text.split("\n");for(var i=0;i<lines.length;i++){termRef.type(lines[i]);if(i<lines.length-1)termRef.newLine()}termRef.lineBuffer=text;termRef.lastLine="";termRef.inputChar=0;termRef.handler();return true},normalize:function(n,m){var s=""+n;while(s.length<m)s="0"+s;return s},fillLeft:function(t,n){if(typeof t!="string")t=
+""+t;while(t.length<n)t=" "+t;return t},center:function(t,l){var s="";for(var i=t.length;i<l;i+=2)s+=" ";return s+t},stringReplace:function(s1,s2,t){var l1=s1.length;var l2=s2.length;var ofs=t.indexOf(s1);while(ofs>=0){t=t.substring(0,ofs)+s2+t.substring(ofs+l1);ofs=t.indexOf(s1,ofs+l2)}return t},wrapChars:{9:1,10:1,12:4,13:1,32:1,40:3,45:2,61:2,91:3,94:3,123:3},setFocus:function(termref){Terminal.prototype.globals.activeTerm=termref;Terminal.prototype.globals.clearRepeatTimer()},termKey:{"NUL":0,
+"SOH":1,"STX":2,"ETX":3,"EOT":4,"ENQ":5,"ACK":6,"BEL":7,"BS":8,"BACKSPACE":8,"HT":9,"TAB":9,"LF":10,"VT":11,"FF":12,"CR":13,"SO":14,"SI":15,"DLE":16,"DC1":17,"DC2":18,"DC3":19,"DC4":20,"NAK":21,"SYN":22,"ETB":23,"CAN":24,"EM":25,"SUB":26,"ESC":27,"IS4":28,"IS3":29,"IS2":30,"IS1":31,"DEL":127,"EURO":8364,"LEFT":28,"RIGHT":29,"UP":30,"DOWN":31},termDomKeyRef:{},_domKeyMappingData:{"LEFT":"LEFT","RIGHT":"RIGHT","UP":"UP","DOWN":"DOWN","BACK_SPACE":"BS","RETURN":"CR","ENTER":"CR","ESCAPE":"ESC","DELETE":"DEL",
+"TAB":"TAB"},_initDomKeyRef:function(){var tg=Terminal.prototype.globals;var m=tg._domKeyMappingData;var r=tg.termDomKeyRef;var k=tg.termKey;for(var i in m)r["DOM_VK_"+i]=k[m[i]]},registerEvent:function(obj,eventType,handler,capture){if(obj.addEventListener)obj.addEventListener(eventType.toLowerCase(),handler,capture);else{var et=eventType.toUpperCase();if(window.Event&&window.Event[et]&&obj.captureEvents)obj.captureEvents(Event[et]);obj["on"+eventType.toLowerCase()]=handler}},releaseEvent:function(obj,
+eventType,handler,capture){if(obj.removeEventListener)obj.removeEventListener(eventType.toLowerCase(),handler,capture);else{var et=eventType.toUpperCase();if(window.Event&&window.Event[et]&&obj.releaseEvents)obj.releaseEvents(Event[et]);et="on"+eventType.toLowerCase();if(obj[et]&&obj[et]==handler)obj.et=null}},enableKeyboard:function(term){var tg=Terminal.prototype.globals;if(!tg.kbdEnabled){tg.registerEvent(document,"keypress",tg.keyHandler,true);tg.registerEvent(document,"keydown",tg.keyFix,true);
+tg.registerEvent(document,"keyup",tg.clearRepeatTimer,true);tg.kbdEnabled=true}tg.activeTerm=term},disableKeyboard:function(term){var tg=Terminal.prototype.globals;if(tg.kbdEnabled){tg.releaseEvent(document,"keypress",tg.keyHandler,true);tg.releaseEvent(document,"keydown",tg.keyFix,true);tg.releaseEvent(document,"keyup",tg.clearRepeatTimer,true);tg.kbdEnabled=false}tg.activeTerm=null},keyFix:function(e){var tg=Terminal.prototype.globals;var term=tg.activeTerm;if(tg.keylock||term.lock)return true;
+if(window.event){var ch=window.event.keyCode;if(!e)e=window.event;if(e.DOM_VK_UP){for(var i in tg.termDomKeyRef)if(e[i]&&ch==e[i]){tg.keyHandler({which:tg.termDomKeyRef[i],_remapped:true,_repeat:ch==27?true:false});if(e.preventDefault)e.preventDefault();if(e.stopPropagation)e.stopPropagation();e.cancleBubble=true;return false}e.cancleBubble=false;return true}else{var termKey=term.termKey;var keyHandler=tg.keyHandler;if(ch==8&&!term.isSafari&&!term.isOpera)keyHandler({which:termKey.BS,_remapped:true,
+_repeat:true});else if(ch==9)keyHandler({which:termKey.TAB,_remapped:true,_repeat:term.printTab?false:true});else if(ch==37)keyHandler({which:termKey.LEFT,_remapped:true,_repeat:true});else if(ch==39)keyHandler({which:termKey.RIGHT,_remapped:true,_repeat:true});else if(ch==38)keyHandler({which:termKey.UP,_remapped:true,_repeat:true});else if(ch==40)keyHandler({which:termKey.DOWN,_remapped:true,_repeat:true});else if(ch==127)keyHandler({which:termKey.DEL,_remapped:true,_repeat:true});else if(ch>=57373&&
+ch<=57376)if(ch==57373)keyHandler({which:termKey.UP,_remapped:true,_repeat:true});else if(ch==57374)keyHandler({which:termKey.DOWN,_remapped:true,_repeat:true});else if(ch==57375)keyHandler({which:termKey.LEFT,_remapped:true,_repeat:true});else{if(ch==57376)keyHandler({which:termKey.RIGHT,_remapped:true,_repeat:true})}else{e.cancleBubble=false;return true}if(e.preventDefault)e.preventDefault();if(e.stopPropagation)e.stopPropagation();e.cancleBubble=true;return false}}},clearRepeatTimer:function(e){var tg=
+Terminal.prototype.globals;if(tg.keyRepeatTimer){clearTimeout(tg.keyRepeatTimer);tg.keyRepeatTimer=null}},doKeyRepeat:function(ch){Terminal.prototype.globals.keyHandler({which:ch,_remapped:true,_repeated:true})},keyHandler:function(e){var tg=Terminal.prototype.globals;var term=tg.activeTerm;if(tg.keylock||term.lock)return true;if(window.event&&window.event.preventDefault)window.event.preventDefault();else if(e&&e.preventDefault)e.preventDefault();if(window.event&&window.event.stopPropagation)window.event.stopPropagation();
+else if(e&&e.stopPropagation)e.stopPropagation();var ch;var ctrl=false;var shft=false;var remapped=false;var termKey=term.termKey;var keyRepeat=0;if(e){ch=e.which;ctrl=e.ctrlKey&&e.altKey||e.modifiers==2;shft=e.shiftKey||e.modifiers==4;if(e._remapped){remapped=true;if(window.event){ctrl=ctrl||window.event.ctrlKey&&!window.event.altKey;shft=shft||window.event.shiftKey}}if(e._repeated)keyRepeat=2;else if(e._repeat)keyRepeat=1}else if(window.event){ch=window.event.keyCode;ctrl=window.event.ctrlKey&&
+!window.event.altKey;shft=window.event.shiftKey;if(window.event._repeated)keyRepeat=2;else if(window.event._repeat)keyRepeat=1}else return true;if(ch==""&&remapped==false){if(e==null)e=window.event;if(e.charCode==0&&e.keyCode)if(e.DOM_VK_UP){var dkr=tg.termDomKeyRef;for(var i in dkr)if(e[i]&&e.keyCode==e[i]){ch=dkr[i];break}}else if(e.keyCode==28)ch=termKey.LEFT;else if(e.keyCode==29)ch=termKey.RIGHT;else if(e.keyCode==30)ch=termKey.UP;else if(e.keyCode==31)ch=termKey.DOWN;else if(e.keyCode==37)ch=
+termKey.LEFT;else if(e.keyCode==39)ch=termKey.RIGHT;else if(e.keyCode==38)ch=termKey.UP;else if(e.keyCode==40)ch=termKey.DOWN;else if(e.keyCode==9)ch=termKey.TAB}if(ch>=57344&&ch<=63743)return;if(keyRepeat){tg.clearRepeatTimer();tg.keyRepeatTimer=window.setTimeout("Terminal.prototype.globals.doKeyRepeat("+ch+")",keyRepeat==1?tg.keyRepeatDelay1:tg.keyRepeatDelay2)}if(term.charMode){term.insert=false;term.inputChar=ch;term.lineBuffer="";term.handler();if(ch<=32&&window.event)window.event.cancleBubble=
+true;return false}if(!ctrl){if(ch==termKey.CR){term.lock=true;term.cursorOff();term.insert=false;if(term.rawMode)term.lineBuffer=term.lastLine;else{term.lineBuffer=term._getLine();if(term.lineBuffer!=""&&(!term.historyUnique||term.history.length==0||term.lineBuffer!=term.history[term.history.length-1]))term.history[term.history.length]=term.lineBuffer;term.histPtr=term.history.length}term.lastLine="";term.inputChar=0;term.handler();if(window.event)window.event.cancleBubble=true;return false}else if(ch==
+termKey.ESC&&term.conf.closeOnESC){term.close();if(window.event)window.event.cancleBubble=true;return false}if(ch<32&&term.rawMode){if(window.event)window.event.cancleBubble=true;return false}else if(ch==termKey.LEFT){term.cursorLeft();if(window.event)window.event.cancleBubble=true;return false}else if(ch==termKey.RIGHT){term.cursorRight();if(window.event)window.event.cancleBubble=true;return false}else if(ch==termKey.UP){term.cursorOff();if(term.histPtr==term.history.length)term.lastLine=term._getLine();
+term._clearLine();if(term.history.length&&term.histPtr>=0){if(term.histPtr>0)term.histPtr--;term.type(term.history[term.histPtr])}else if(term.lastLine)term.type(term.lastLine);term.cursorOn();if(window.event)window.event.cancleBubble=true;return false}else if(ch==termKey.DOWN){term.cursorOff();if(term.histPtr==term.history.length)term.lastLine=term._getLine();term._clearLine();if(term.history.length&&term.histPtr<=term.history.length){if(term.histPtr<term.history.length)term.histPtr++;if(term.histPtr<
+term.history.length)term.type(term.history[term.histPtr]);else if(term.lastLine)term.type(term.lastLine)}else if(term.lastLine)term.type(term.lastLine);term.cursorOn();if(window.event)window.event.cancleBubble=true;return false}else if(ch==termKey.BS){term.backspace();if(window.event)window.event.cancleBubble=true;return false}else if(ch==termKey.DEL){if(term.DELisBS)term.backspace();else term.fwdDelete();if(window.event)window.event.cancleBubble=true;return false}}if(term.rawMode){if(term.isPrintable(ch))term.lastLine+=
+String.fromCharCode(ch);if(ch==32&&window.event)window.event.cancleBubble=true;else if(window.opera&&window.event)window.event.cancleBubble=true;return false}else if(term.conf.catchCtrlH&&(ch==termKey.BS||ctrl&&ch==72)){term.backspace();if(window.event)window.event.cancleBubble=true;return false}else if(term.ctrlHandler&&(ch<32||ctrl&&term.isPrintable(ch,true))){if(ch>=65&&ch<=96||ch==63)if(ch==63)ch=31;else ch-=64;term.inputChar=ch;term.ctrlHandler();if(window.event)window.event.cancleBubble=true;
+return false}else if(ctrl||!term.isPrintable(ch,true)){if(window.event)window.event.cancleBubble=true;return false}else if(term.isPrintable(ch,true)){if(term.blinkTimer)clearTimeout(term.blinkTimer);if(term.insert){term.cursorOff();term._scrollRight(term.r,term.c)}term._charOut(ch);term.cursorOn();if(ch==32&&window.event)window.event.cancleBubble=true;else if(window.opera&&window.event)window.event.cancleBubble=true;return false}return true},hasSubDivs:false,hasLayers:false,termStringStart:"",termStringEnd:"",
+termSpecials:{0:"&nbsp;",1:"&nbsp;",9:"&nbsp;",32:"&nbsp;",34:"&quot;",38:"&amp;",60:"&lt;",62:"&gt;",127:"&loz;",8364:"&euro;"},termStyles:[1,2,4,8],termStyleMarkup:{"r":1,"u":2,"i":4,"s":8},termStyleOpen:{1:'<span class="termReverse">',2:"<u>",4:"<i>",8:"<strike>"},termStyleClose:{1:"</span>",2:"</u>",4:"</i>",8:"</strike>"},assignStyle:function(styleCode,markup,htmlOpen,htmlClose){var tg=Terminal.prototype.globals;if(!styleCode||isNaN(styleCode))if(styleCode>=256){alert("termlib.js:\nCould not assign style.\n"+
+s+" is not a valid power of 2 between 0 and 256.");return}var s=styleCode&255;var matched=false;for(var i=0;i<8;i++)if(s>>>i&1){if(matched){alert("termlib.js:\nCould not assign style code.\n"+s+" is not a power of 2!");return}matched=true}if(!matched){alert("termlib.js:\nCould not assign style code.\n"+s+" is not a valid power of 2 between 0 and 256.");return}markup=String(markup).toLowerCase();if(markup=="c"||markup=="p"){alert('termlib.js:\nCould not assign mark up.\n"'+markup+'" is a reserved code.');
+return}if(markup.length>1){alert('termlib.js:\nCould not assign mark up.\n"'+markup+'" is not a single letter code.');return}var exists=false;for(var i=0;i<tg.termStyles.length;i++)if(tg.termStyles[i]==s){exists=true;break}if(exists){var m=tg.termStyleMarkup[markup];if(m&&m!=s){alert('termlib.js:\nCould not assign mark up.\n"'+markup+'" is already in use.');return}}else{if(tg.termStyleMarkup[markup]){alert('termlib.js:\nCould not assign mark up.\n"'+markup+'" is already in use.');return}tg.termStyles[tg.termStyles.length]=
+s}tg.termStyleMarkup[markup]=s;tg.termStyleOpen[s]=htmlOpen;tg.termStyleClose[s]=htmlClose},writeElement:function(e,t,d){if(document.layers){var doc=d?d:window.document;doc.layers[e].document.open();doc.layers[e].document.write(t);doc.layers[e].document.close()}else if(document.getElementById){var obj=document.getElementById(e);obj.innerHTML=t}else if(document.all)document.all[e].innerHTML=t},setElementXY:function(d,x,y){if(document.layers)document.layers[d].moveTo(x,y);else if(document.getElementById){var obj=
+document.getElementById(d);obj.style.left=x+"px";obj.style.top=y+"px"}else if(document.all){document.all[d].style.left=x+"px";document.all[d].style.top=y+"px"}},setVisible:function(d,v){if(document.layers)document.layers[d].visibility=v?"show":"hide";else if(document.getElementById){var obj=document.getElementById(d);obj.style.visibility=v?"visible":"hidden"}else if(document.all)document.all[d].style.visibility=v?"visible":"hidden"},setDisplay:function(d,v){if(document.getElementById){var obj=document.getElementById(d);
+obj.style.display=v}else if(document.all)document.all[d].style.display=v},guiElementsReady:function(e,d){if(document.layers){var doc=d?d:window.document;return doc&&doc.layers[e]?true:false}else if(document.getElementById)return document.getElementById(e)?true:false;else if(document.all)return document.all[e]?true:false;else return false},_termString_makeKeyref:function(){var tg=Terminal.prototype.globals;var termString_keyref=tg.termString_keyref=new Array;var termString_keycoderef=tg.termString_keycoderef=
+new Array;var hex=new Array("A","B","C","D","E","F");for(var i=0;i<=15;i++){var high=i<10?i:hex[i-10];for(var k=0;k<=15;k++){var low=k<10?k:hex[k-10];var cc=i*16+k;if(cc>=32){var cs=unescape("%"+high+low);termString_keyref[cc]=cs;termString_keycoderef[cs]=cc}}}},_extendMissingStringMethods:function(){if(!String.fromCharCode||!String.prototype.charCodeAt)Terminal.prototype.globals._termString_makeKeyref();if(!String.fromCharCode)String.fromCharCode=function(cc){return cc!=null?Terminal.prototype.globals.termString_keyref[cc]:
+""};if(!String.prototype.charCodeAt)String.prototype.charCodeAt=function(n){cs=this.charAt(n);return Terminal.prototype.globals.termString_keycoderef[cs]?Terminal.prototype.globals.termString_keycoderef[cs]:0}}}};Terminal.prototype.globals._initGlobals();var TerminalDefaults=Terminal.prototype.Defaults;var termDefaultHandler=Terminal.prototype.defaultHandler;var TermGlobals=Terminal.prototype.globals;var termKey=Terminal.prototype.globals.termKey;var termDomKeyRef=Terminal.prototype.globals.termDomKeyRef;
+var parserWhiteSpace={" ":true,"\t":true};var parserQuoteChars={'"':true,"'":true,"`":true};var parserSingleEscapes={"\\":true};var parserOptionChars={"-":true};var parserEscapeExpressions={"%":parserHexExpression};
+function parserHexExpression(termref,pointer,echar,quotelevel){if(termref.lineBuffer.length>pointer+2){var hi=termref.lineBuffer.charAt(pointer+1);var lo=termref.lineBuffer.charAt(pointer+2);lo=lo.toUpperCase();hi=hi.toUpperCase();if((hi>="0"&&hi<="9"||hi>="A"&&hi<="F")&&(lo>="0"&&lo<="9"||lo>="A"&&lo<="F")){parserEscExprStrip(termref,pointer+1,pointer+3);return String.fromCharCode(parseInt(hi+lo,16))}}return echar}
+function parserEscExprStrip(termref,from,to){termref.lineBuffer=termref.lineBuffer.substring(0,from)+termref.lineBuffer.substring(to)}
+function parserGetopt(termref,optsstring){var opts={"illegals":[]};while(termref.argc<termref.argv.length&&termref.argQL[termref.argc]==""){var a=termref.argv[termref.argc];if(a.length>0&&parserOptionChars[a.charAt(0)]){var i=1;while(i<a.length){var c=a.charAt(i);var v="";while(i<a.length-1){var nc=a.charAt(i+1);if(nc=="."||nc>="0"&&nc<="9"){v+=nc;i++}else break}if(optsstring.indexOf(c)>=0)opts[c]=v==""?{value:-1}:isNaN(v)?{value:0}:{value:parseFloat(v)};else opts.illegals[opts.illegals.length]=c;
+i++}termref.argc++}else break}return opts}
+function parseLine(termref){var argv=[""];var argQL=[""];var argc=0;var escape=false;for(var i=0;i<termref.lineBuffer.length;i++){var ch=termref.lineBuffer.charAt(i);if(escape){argv[argc]+=ch;escape=false}else if(parserEscapeExpressions[ch]){var v=parserEscapeExpressions[ch](termref,i,ch,argQL[argc]);if(typeof v!="undefined")argv[argc]+=v}else if(parserQuoteChars[ch])if(argQL[argc])if(argQL[argc]==ch){argc++;argv[argc]=argQL[argc]=""}else argv[argc]+=ch;else if(argv[argc]!=""){argc++;argv[argc]="";
+argQL[argc]=ch}else argQL[argc]=ch;else if(parserWhiteSpace[ch])if(argQL[argc])argv[argc]+=ch;else{if(argv[argc]!=""){argc++;argv[argc]=argQL[argc]=""}}else if(parserSingleEscapes[ch])escape=true;else argv[argc]+=ch}if(argv[argc]==""&&!argQL[argc]){argv.length--;argQL.length--}termref.argv=argv;termref.argQL=argQL;termref.argc=0}var helpPage=["%c(@beige)This is a Unix-like virtual shell command line interface."];var infoPage=["%c(@beige)This console is implemented with the javascript terminal library termlib.js."];
+var asciinumber=[" .XEEEEb ,:LHL :LEEEEEG .CNEEEEE8 bMNj NHKKEEEEEX 1LEEE1 KEEEEEEEKNMHH 8EEEEEL. cEEEEEO "," MEEEUXEEE8 jNEEEEE EEEEHMEEEEU EEEELLEEEEc NEEEU 7EEEEEEEEEK :EEEEEEN, EEEEEEEEEEEEE OEEEGC8EEEM 1EEELOLEEE3 ",' NEE. OEEC EY" MEE OC LEEc :" EEE EEGEE3 8EN MEEM. :EE. 1EEj :EEO 1EE3 DEEc ',
+" ,EEj EEE HEE EEE cEE: EEU EEJ NEC EEE EEJ EEE EEE EEN KEE "," HEE jEE1 NEE EEE EEE EEM EEJ EE LEE .. EEK DEEj :EE7 ,EE1 jEE "," EEH EEZ KEE :EE1 .::jZEEG EEU EEJ .EEEEEENC EE77EEEEEEL NEE UEENj bEE7 .EEX :EE.",'.EEZ EEM KEE EEK EEEEEEC .EEc EEC :X3DGMEEEEU 3EEEED.".GEEE. CEE. EEEEEEE EEEj :EEE ',
+' EEZ EEM KEE :EEK "jNEEZ :EE EE7 MEEU LEEb EEE .EE8 DEEL:.8EEEM NEEENMEEEHEE '," EEN .EEG KEE bEEG 7EEM jEEN738ODDEEM3b EEE MEE 8EE, EEE EEE ,EEE .bEEEEC XEE "," LEE 3EE: KEE .EEE, EEE LEEEEEEEEEEEEEE XEE 8EE cEE: NEE 7EE1 jEE1 :EE: "," .EEc EEE KEE bEED EEE EE1 EEE EEX EEE 3EE: cEEc 7EEj CEEG ",
+" MEE7 NEE. EEE jEEK C EEE1 EEC j :EEE CEEG LEEj .EEU EEE: .EEE 1EEEJ "," bEEEEEEEE. EEE NEEEEEEEEEEEE bEEEEEEEEEE7 EEd JEEEEEEEEEN jEEEEEEEEE7 .EEE KEEEEHEEEEL 8EEEEEEX ",' DEEEL7 CGD 3GD3DOGGGGGUX :DHEEEN8. bUd 7GNEEEMc 7LEEEX: 1XG JHEEEM1 COLIN" '];
+var asciinumber_s=[".oPYo. .o .oPYo. .oPYo. .8 oooooo .pPYo. oooooo .PY. .oPYo. ",'8 o8 8 `8 `8 d"8 8 8 .o" 8 8 8" `8 ','8 P 8 8 oP" .oP" d" 8 8pPYo. 8oPYo. .o" .oPYo. 8. .8 ','8 d 8 8 .oP" `b. Pooooo `8 8" `8 .o" 8" `8 `YooP8 ','8o 8 8 8" :8 8 .P 8. .P .o" 8. .P .P ','`YooP" o8o 8ooooo `YooP" 8 `YooP" `YooP" o" `YooP" `YooP" '];
+var asciiddot=[" "," "," "," @@ "," @@ "," "," "," "," "," "," @@ "," @@ "," "," "," "];var asciiddot_s=[" ","x "," "," ","x "," "];var asciin=asciinumber;var asciid=asciiddot;
+var bs=["%c(@white)A problem has been detected and windows has been shut down to prevent","damage to your computer.","","PAGE_FAULT_BECAUSE_OF_DUMB_USER","","Suggestions: Restart computer, if problems continue, install Linux.","","Technical Information:","","***STOP: 0x00000050 (0xBD32E7E4, 0x00000011, 0x8B5F87F4,0x00000012)","","Physical memory was dumped."];var safari=false;var fortuneid=1;var shortm=["Jan","Feb","Mar","Apr","Mai","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];var path="/home/www";
+var files_root_n=["bin","etc","home","tmp","sbin","usr","var"];var files_root_s=[" 512"," 512"," 1024"," 512"," 512"," 512"," 512"];var files_root_t=["Jan 23 00:13","Feb 2 14:36","Jan 23 00:13","Nov 10 2007","Nov 10 2007","Nov 10 2007","Nov 10 2007"];var files_root=[files_root_n,files_root_s,files_root_t,"%c(@lightgrey)drwxr-x--- 1 root wheel"];var files_etc_n=["passwd","group","rc.conf","master.passwd","hosts","crontab"];
+var files_etc_s=[" 766"," 266"," 3061"," 3960"," 766"," 1852"];var files_etc_t=["Jan 23 00:13","Jan 23 00:13","Feb 2 14:36","Jan 23 00:13","Nov 10 2007","Nov 26 17:28"];var files_etc=[files_etc_n,files_etc_s,files_etc_t,"%c(@lightgrey)-rw-r----- 1 root wheel"];var files_home_n=["www"];var files_home_s=[" 766"];var files_home_t=["Nov 10 2007"];var files_home=[files_home_n,files_home_s,files_home_t,"%c(@lightgrey)drwxr-xr-x 1 root wheel"];var files_tmp_n=["test"];
+var files_tmp_s=[" 512"];var files_tmp_t=["Jun 11 2007"];var files_tmp=[files_tmp_n,files_tmp_s,files_tmp_t,"%c(@lightgrey)drwxrwx--- 1 root wheel"];var files_var_n=["log"];var files_var_s=[" 512"];var files_var_t=["Jun 11 2007"];var files_var=[files_var_n,files_var_s,files_var_t,"%c(@lightgrey)drwxrwx--- 1 root wheel"];var files_usr_n=["share"];var files_usr_s=[" 512"];var files_usr_t=["Oct 21 2006"];var files_usr=[files_usr_n,files_usr_s,files_usr_t,"%c(@lightgrey)drwxrwxr-x 1 root wheel"];
+var files_share_n=["man"];var files_share_s=[" 512"];var files_share_t=["Oct 21 2006"];var files_share=[files_share_n,files_share_s,files_share_t,"%c(@lightgrey)drwxrwxr-x 1 root wheel"];var files_man_n=["echo","cal","clock","ed","hostname","ls","matrix","redim","reload","reset","ssh","vi","weather","whereami"];var files_man_s=[" 252"," 287"," 352"," 1173"," 281"," 361"," 292"," 291"," 451"," 353"," 198"," 358"," 232"," 216"," 112"," 3412"];
+var files_man_t=["Nov 21 2007","Jan 31 2008","Nov 21 2007","Nov 21 2007","Nov 21 2007","Nov 21 2007","Nov 21 2007","Jul 10 2008","Nov 21 2007","Nov 21 2007","Apr 17 2008","Feb 01 2008","Feb 11 2008","Apr 02 2008","Nov 21 2007","Mar 21 2008"];var files_man=[files_man_n,files_man_s,files_man_t,"%c(@lightgrey)-rw-rw-r-- 1 root wheel"];
+var files_bin_n=["apropos","browse","browser","cal","cat","chat","clear","clock","cd","date","df","echo","ed","fortune","history","login","hostname","help","id","info","ll","logout","ls","man","matrix","more","ping","ps","pwd","pr","reload","snake","ssh","sudo","redim","reset","top","uname","whereami","rm","time","uptime","vi","who","weather","whoami"];
+var files_bin_s=[" 1933"," 3061"," 3960"," 766"," 1150"," 2170"," 1176"," 1834"," 1650"," 81933"," 695"," 1507"," 1327"," 1127"," 1852"," 1140"," 1933"," 256"," 1678"," 32648"," 5150"," 1232"," 5150"," 593"," 3595"," 1698"," 2668"," 1668"," 3855"," 7159"," 1353"," 3695"," 1435"," 1135"," 1156"," 815"," 193"," 2565"," 5466"," 9331"," 1357"," 150"," 19364"," 8364"," 384"," 1744"];
+var files_bin_t=["Oct 21 2006","Oct 21 2006","Oct 21 2006","Oct 21 2006","Oct 21 2006","Oct 21 2006","Oct 21 2006","Oct 22 2006","Oct 22 2006","Oct 21 2006","Oct 21 2006","Apr 11 2008","Jul 11 2008","Oct 21 2006","Oct 21 2006","Feb 10 2008","Feb 10 2008","Oct 21 2006","Jun 11 2007","Jun 11 2007","Apr 11 2008","Oct 21 2006","Oct 21 2006","Oct 21 2006","Oct 21 2006","Jan 28 2008","Jan 25 2008","Oct 21 2006","Oct 21 2006","Jun 11 2007","Oct 21 2006","Apr 5 2008","Oct 21 2006",
+"Jan 21 2008","Oct 21 2006","Nov 10 2007","Oct 21 2006","Oct 21 2006","Oct 21 2006","Oct 21 2006","Oct 21 2006","Oct 21 2006","Apr 4 02:46","Jan 23 00:13","Jan 23 00:13","Feb 10 01:24"];var files_bin=[files_bin_n,files_bin_s,files_bin_t,"%c(@lightgrey)-rwxr-x--x 1 root wheel"];var files_sbin_n=["sysctl","netstat","browser","passwd","ifconfig","route","mount","reboot","halt","shutdown","su"];
+var files_sbin_s=[" 1933"," 3061"," 3960"," 766"," 1150"," 1350"," 1834"," 1650"," 933"," 695"," 1507"];var files_sbin_t=["Feb 10 01:23","Feb 10 01:24","Oct 21 2006","Oct 24 2006","Oct 21 2006","Oct 21 2006","Oct 21 2006","Jun 11 2007","Oct 21 2006","Oct 21 2006","Oct 21 2006"];var files_sbin=[files_sbin_n,files_sbin_s,files_sbin_t,"%c(@lightgrey)-rwxr-x--- 1 root wheel"];
+var files_www_n=["about.txt","bugs.txt","cb.txt","exploring.gif","favicon.ico","index.html","shell.js","sitemap.xml","termlib.js","termlib_invaders.js","termlib_parser.js","unixtoolbox.book.pdf","unixtoolbox.book2.pdf","unixtoolbox.pdf","unixtoolbox.txt","%+nunixtoolbox.xhtml%-n"];var files_www_s=[" 1045"," 954"," 4033"," 98166"," 1150"," 1933"," 25695"," 766"," 64720"," 21371"," 6036","272458","271664","345472","124113","191701"];
+var files_www_t=["Feb 15 01:31","Apr 18 00:31","Feb 11 02:06","Jul 23 2004","Jan 31 15:17","Feb 10 16:53","Feb 5 00:52","Feb 10 01:13","Feb 10 01:13","Feb 10 02:14","Feb 10 02:14","Apr 09 02:14","Apr 09 02:14","Apr 09 04:20","Apr 09 01:47","Apr 09 02:50"];var files_www=[files_www_n,files_www_s,files_www_t,"%c(@lightgrey)-rw-r----- 1 colin www"];var tree=["/","/etc","/tmp","/bin","/home","/home/www","/sbin","/usr","/usr/share","/usr/share/man","/var"];
+var tree_files=[files_root,files_etc,files_tmp,files_bin,files_home,files_www,files_sbin,files_usr,files_share,files_man,files_var];var remote_files=["unixtoolbox.xhtml","unixtoolbox.txt","index.html","shell.js","termlib.js","termlib_parser.js","termlib_invaders.js"];var binary_files=["unixtoolbox.pdf","unixtoolbox.book.pdf","unixtoolbox.book2.pdf","exploring.gif","favicon.ico"];var filesContent=[];
+filesContent["/boot/shutdown"]=["%c(@lightgrey)Waiting (max 60 seconds) for system process 'crypto' to stop...done","%c(@lightgrey)Waiting (max 60 seconds) for system process 'vnlru' to stop...done","%c(@lightgrey)Waiting (max 60 seconds) for system process 'bufdaemon' to stop...done","%c(@lightgrey)Waiting (max 60 seconds) for system process 'syncer' to stop...","%c(@lightgrey)Syncing disks, vnodes remaining...5 6 7 3 2 1 1 1 0 0 0 done","","","","%c(@lightgrey)All buffers synced.","%c(@lightgrey)Uptime: 14d13h29m45s",
+"","%c(@lightgrey)Rebooting...%n","","",""];
+filesContent["/boot/kernel"]=["%c(@lightgrey)localhost ROM BIOS Version 1.34 A12","%c(@lightgrey)Copyright 2007-2008 Colin Barschel All Rights Reserved","","%c(@lightgrey)FreeBSD 7.1-STABLE #3: Sat Feb 16 16:14:11 CET 2009","%c(@lightgrey) sysad@localhost:/usr/obj/usr/src/sys/CB","",'%c(@lightgrey)Timecounter "i8254" frequency 1193182 Hz quality 0',"%c(@lightgrey)CPU: Dual Core AMD Opteron(tm) Processor 270 (2010.31-MHz K8-class CPU)",'%c(@lightgrey) Origin = "AuthenticAMD" Id = 0x20f12 Stepping = 2',"%c(@lightgrey) Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>",
+"%c(@lightgrey) Features2=0x1<SSE3>","%c(@lightgrey) AMD Features=0xe2500800<SYSCALL,NX,MMX+,FFXSR,LM,3DNow!+,3DNow!>","%c(@lightgrey) AMD Features2=0x3<LAHF,CMP>","%c(@lightgrey) Cores per package: 2","%c(@lightgrey)usable memory = 2139738112 (2040 MB)","%c(@lightgrey)avail memory = 2065133568 (1969 MB)","","%c(@lightgrey)Detecting IDE drives ... IDE Flash Disk","","%c(@lightgrey)acpi0: <Nvidia AWRDACPI> on motherboard","%c(@lightgrey)acpi_timer0: <24-bit timer at 3.579545MHz> port 0x808-0x80b on acpi0",
+"%c(@lightgrey)ata0: <ATA channel 0> on atapci0","%c(@lightgrey)ata1: <ATA channel 1> on atapci0","%c(@lightgrey)usb0: <SiS 5571 USB controller> on ohci0","%c(@lightgrey)usb0: USB revision 2.0","%c(@lightgrey)uhub0: SiS OHCI root hub, class 9/0, rev 1.00/1.00, addr 1","%c(@lightgrey)cpu0: <ACPI CPU> on acpi0","%c(@lightgrey)cpu1: <ACPI CPU> on acpi0","%c(@lightgrey)bge0: <Broadcom NetXtreme Gigabit Ethernet Controller, ASIC rev. 0x3003> mem 0xfe9e0000-0xfe9effff irq 18 at device 6.0 on pci1","%c(@lightgrey)Looks convincing, doesn't it?",
+"%c(@lightgrey)atapci0: <SiS 962/963 UDMA133 controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177at device 2.5 on pci0%n","%c(@lightgrey)Timecounters tick every 1.000 msec","","%c(@lightgrey)ipfw2 (+ipv6) initialized, divert enabled, rule-based forwarding disabled, default to deny, logging enabled","%c(@lightgrey)Trying to mount root from ufs:/dev/ad0a","","%c(@lightgrey)/bin/sh: accessing tty1","%c(@lightgrey)Starting external programs: ssh apache2 mxvpn sendmail","","ready"," "];
+filesContent["/etc/passwd"]=["%c(@lightgrey)# $FreeBSD: src/etc/master.passwd,v 1.40 2005/06/06 20:19:56 brooks Exp $","#","root:*:0:0:Charlie &:/root:/bin/csh","toor:*:0:0:Bourne-again Superuser:/root:","mailnull:*:26:26:Sendmail Default User:/var/spool/mqueue:/usr/sbin/nologin","www:*:80:80:World Wide Web Owner:/nonexistent:/usr/sbin/nologin","sysa:*:1001:0:System Administrator:/home/sysadmin:/bin/tcsh"];
+filesContent["/etc/group"]=["%c(@lightgrey)# $FreeBSD: src/etc/group,v 1.32.2.1 2006/03/06 22:23:10 rwatson Exp $","#","wheel:*:0:root,sysa","mailnull:*:26:milter","www:*:80:","sysa:*:1001:"];
+filesContent["/etc/rc.conf"]=['%c(@lightgrey)hostname="localhost"','firewall_enable="YES" # Set to YES to enable firewall functionality','firewall_type="web" # Firewall type (see /etc/rc.firewall)','ifconfig_rl0="inet 78.31.70.238 netmask 255.255.255.0"','defaultrouter="78.31.70.1"','sshd_enable="YES" # Enable sshd','sendmail_enable="YES" # Run the sendmail inbound daemon (YES/NO).','sendmail_flags="-L sm-mta -bd -q30m"','apache22_enable="YES" # start Apache httpd',
+'apache22ssl_enable="YES"','apache22_http_accept_enable="YES" # Use kernel accf_data and accf_http modules'];filesContent["/etc/hosts"]=["%c(@lightgrey)# In the presence of the domain name service or NIS, this file may","# not be consulted at all; see /etc/nsswitch.conf for the resolution order.","#","::1 localhost localhost.localhost","127.0.0.1 localhost localhost.localhost"];
+filesContent["/etc/crontab"]=["%c(@lightgrey)# $FreeBSD: src/etc/crontab,v 1.32 2002/11/22 16:13:39 tom Exp $","#minute hour mday month wday who command","# Save some entropy so that /dev/random can re-seed on boot.","*/11 * * * * operator /usr/libexec/save-entropy","# Rotate log files every hour, if necessary.","0 * * * * root newsyslog","# Perform daily/weekly/monthly maintenance.","1 3 */2 * * root periodic daily",
+"15 4 */2 * 6 root periodic weekly","30 5 1 */2 * root periodic monthly"];
+filesContent["/usr/share/man/vi"]=["%c(@lightcyan)VI localhost General Commands Manual VI","","NAME"," Vi -- a screen oriented text editor.","","DESCRIPTION"," Vi is a modal editor and is either in insert mode or err... Who doesn't "," know vi? This implementation is very thin and does not support paging. That"," is only the visible page can be edited. The following commands should work:",""," <ESC> to enter command mode"," :q<Enter> to exit",
+" :w<Enter> to save",' :w filename to save to "filename"',' :e filename to open "filename"'," :q!<Enter> to exit without saving"," D to delete rest of line"," dd to delete current line"," x to delete current char"," i to enter edit mode "," UP RIGHT DOWN LEFT to move the cursor"," or h left j down k up l right",""," %c(@chartreuse)On Safari browsers use <TAB> instead of <ESC>!!%c(@lightcyan)"];
+filesContent["/usr/share/man/ssh"]=["%c(@lightcyan)SSH localhost General Commands Manual SSH","","NAME"," ssh -- Mindterm SSH client (remote login program)","","SYNOPSIS"," ssh [-L port:host:hostport] [-p port] [user@]hostname","","DESCRIPTION",' The ssh command will start the Appgate java applet "mindterm".'," The applet is self-signed and can thus be used to connect to any server"," (as you don't have an account on localhost...)"," and also allows to build tunnels. This is the compiled version from",
+" www.appgate.com with the logo removed."," %c(@chartreuse)There is no connection between this client and the localhost server.","",' Use the top right "X" to close the ssh client%c(@lightcyan)',"","EXAMPLES"," ssh hostname"," ssh -p 123 user@hostname"," ssh -L 3128:127.0.0.1:80 -p 1234 user@hostname"];
+filesContent["/usr/share/man/echo"]=["%c(@lightcyan)ECHO localhost General Commands Manual ECHO","","NAME"," echo -- write arguments to the standard output","","DESCRIPTION"," The echo utility writes any specified operands, separated by single blank"," (' ') characters and followed by a newline (\\n) character, to the stan-"," dard output."," the > redirect can be used to create a file. For example the command"," %c(@chartreuse)echo Hello world! > hello.txt%c(@lightcyan)",
+" will create the file hello.txt"];
+filesContent["/usr/share/man/hostname"]=["%c(@lightcyan)HOSTNAME localhost General Commands Manual HOSTNAME","","NAME"," hostname -- print name of current host system","","SYNOPSIS"," hostname [-fsi]","","DESCRIPTION"," The hostname utility prints the name of the current host."," This script uses the hostname variable in /etc/rc.conf.",""," Options:",""," -f Include domain information in the printed name. This is the"," default behavior.",
+""," -s Trim off any domain information from the printed name.",""," -i Show the corresponding host IP address."];
+filesContent["/usr/share/man/reload"]=["%c(@lightcyan)RELOAD localhost General Commands Manual RELOAD","","NAME"," reload -- reload the terminal as a new http request","","DESCRIPTION"," This command will reload the terminal with a new http GET request from the"," browser. This will reinitialize the shell and all variables and has the same "," effect as the browser reload button. A reload will also recalculate the shell"," size.","","SEE ALSO",
+" reset, redim"];filesContent["/usr/share/man/reset"]=["%c(@lightcyan)RESET localhost General Commands Manual RESET","","NAME"," reset -- reset the terminal to the initial state","","DESCRIPTION"," This command will reset the terminal to its initial state but will not reload"," the variables. The created file are not deleted either. Delete them all with"," rm * in the home directory.","","SEE ALSO"," reload"];
+filesContent["/usr/share/man/redim"]=["%c(@lightcyan)REDIM localhost General Commands Manual REDIM","","NAME"," redim -- calculates and resizes the shell to it's maximal size.","","DESCRIPTION"," This command resizes the shell to fit the visible browser area, it can be used"," when the browser size has changed. The argument <-s> will only display the sizes"," but will not change anything.",""," The following options are available:",""," -s only display the window and shell sizes without changing anything",
+"","SEE ALSO"," reload"];
+filesContent["/usr/share/man/snake"]=["%c(@lightcyan)SNAKE localhost General Commands Manual SNAKE","","NAME"," snake -- a variation of the classical snake game.","","DESCRIPTION"," The snake must be steered to get food (the numbers randomly displayed)"," and avoid crashing on rocks or wall or itself. There is also an autopilot,"," but it is not to be trusted.",""," The following options are available:",""," -s1 for speed: -s1 = slow; -s3 = fast"," -f1 for food: -f1 = less; -f3 = more",
+" -o1 for obstacles: -o1 = less; -o3 = more rocks"," -a toggle the autopilot on or off. Status is displayed on the status line"," -r toggle auto-restart on or off. Status is displayed on the status line","","EXAMPLES",""," snake -f3 -o3 -a -r max food and rocks with autopilot and auto-restart","","SEE ALSO"," invaders"];
+filesContent["/usr/share/man/invaders"]=["%c(@lightcyan)INVADERS localhost General Commands Manual INVADERS","","NAME"," invaders -- the classical invaders game, courtesy of Norbert Landsteiner.","","DESCRIPTION"," The invaders must be shot down before they reach earth. The ship must also"," avoid the enemy fire.",""," On a large screen the game might be too stretched and thus too easy to"," win... Use option -s to reduce the available game area to the classical",
+" 80x25 characters.",""," -s start the game with a smaller area of 80x25 characters","","SEE ALSO"," snake"];
+filesContent["/usr/share/man/ls"]=["%c(@lightcyan)LS localhost General Commands Manual LS","","NAME"," ls -- list directory contents","","SYNOPSIS"," ls [-la] [directory]","","DESCRIPTION"," For each operand that names a directory, ls displays the names of files"," contained within that directory, as well as any requested, associated"," information."," If no operands are given, the contents of the current directory are dis-"," played.",
+""," The following options are available:",""," -l List files in the long format with date and permission information",""," -a Display also hidden files and folders"];
+filesContent["/usr/share/man/matrix"]=["%c(@lightcyan)MATRIX localhost General Commands Manual MATRIX","","NAME"," matrix -- a matrix like screen saver animation","","SYNOPSIS"," matrix [-s]","","DESCRIPTION"," This animation displays falling random letters in a gree gradient. This is"," quite heavy on the browser rendering engine and thus uses a lot of CPU.",""," The following options are available:",""," -s Start with an empty page and fill it with time. Default starts with a newly",
+" generated screen.",""," key <q> or <ESC> to quit the animation",""," key <space> to pause or play the animation",""," any other key will add an iteration"];
+filesContent["/usr/share/man/cal"]=["%c(@lightcyan)CAL localhost General Commands Manual CAL","","NAME"," cal -- a simple month calender","","SYNOPSIS"," cal [n] (n = 1-12)","","DESCRIPTION"," Display a calender of the current month or an other month given as option.",""," The following options are available:",""," n Selects an other month of the year. For example:"," Jan = 1, Jan next year = 13, Dec last year = 0"];
+filesContent["/usr/share/man/clock"]=["%c(@lightcyan)CLOCK localhost General Commands Manual CLOCK","","NAME"," clock -- display a large clock or stopwatch","","SYNOPSIS"," clock [-t -s]","","DESCRIPTION"," With no option the command clock displays a large clock in full screen"," mode and international format, like 21:45:04. It is also possible to display"," a stopwatch. Use any key besides <space> and <r> to quit",""," The following options are available:",
+""," -t start in stopwatch mode",""," -s use smaller numbers. This is automatic if the terminal is too small",""," <space key> pause the display, the time is still ticking...",""," <r key> reset the stopwatch and start again."];
+filesContent["/usr/share/man/ed"]=["%c(@lightgrey)This text is straight from http://www.gnu.org/fun/jokes/ed.msg.html","%c(@lightcyan)When I log into my Xenix system with my 110 baud teletype, both vi","*and* Emacs are just too damn slow. They print useless messages like,","'C-h for help' and '\"foo\" File is read only'. So I use the editor","that doesn't waste my VALUABLE time.","","Ed, man! !man ed","","ED(1) Unix Programmer's Manual ED(1)","","NAME"," ed - text editor",
+"","SYNOPSIS"," ed [ - ] [ -x ] [ name ]","DESCRIPTION"," Ed is the standard text editor.","---","","Computer Scientists love ed, not just because it comes first","alphabetically, but because it's the standard. Everyone else loves ed","because it's ED!","",'"Ed is the standard text editor."',"","And ed doesn't waste space on my Timex Sinclair. Just look:","","-rwxr-xr-x 1 root 24 Oct 29 1929 /bin/ed","-rwxr-xr-t 4 root 1310720 Jan 1 1970 /usr/ucb/vi","-rwxr-xr-x 1 root 5.89824e37 Oct 22 1990 /usr/bin/emacs",
+"","Of course, on the system *I* administrate, vi is symlinked to ed.","Emacs has been replaced by a shell script which 1) Generates a syslog","message at level LOG_EMERG; 2) reduces the user's disk quota by 100K;","and 3) RUNS ED!!!!!!","",'"Ed is the standard text editor."',"","Let's look at a typical novice's session with the mighty ed:","","golem$ ed","","?","help","?","?","?","quit","?","exit","?","bye","?","hello?","?","eat flaming death","?","^C","?","^C","?","^D","?","","---","Note the consistent user interface and error reportage. Ed is",
+"generous enough to flag errors, yet prudent enough not to overwhelm","the novice with verbosity.","",'"Ed is the standard text editor."',"","Ed, the greatest WYGIWYG editor of all.","","ED IS THE TRUE PATH TO NIRVANA! ED HAS BEEN THE CHOICE OF EDUCATED","AND IGNORANT ALIKE FOR CENTURIES! ED WILL NOT CORRUPT YOUR PRECIOUS","BODILY FLUIDS!! ED IS THE STANDARD TEXT EDITOR! ED MAKES THE SUN","SHINE AND THE BIRDS SING AND THE GRASS GREEN!!","","When I use an editor, I don't want eight extra KILOBYTES of worthless",
+"help screens and cursor positioning code! I just want an EDitor!!",'Not a "viitor". Not a "emacsitor". Those aren\'t even WORDS!!!! ED!',"ED! ED IS THE STANDARD!!!","","TEXT EDITOR.","","When IBM, in its ever-present omnipotence, needed to base their",'"edlin" on a Unix standard, did they mimic vi? No. Emacs? Surely',"you jest. They chose the most karmic editor of all. The standard.","","Ed is for those who can *remember* what they are working on. If you","are an idiot, you should use Emacs. If you are an Emacs, you should",
+"not be vi. If you use ED, you are on THE PATH TO REDEMPTION. THE",'SO-CALLED "VISUAL" EDITORS HAVE BEEN PLACED HERE BY ED TO TEMPT THE',"FAITHLESS. DO NOT GIVE IN!!! THE MIGHTY ED HAS SPOKEN!!!","","?"];var pslong=["%c(@lightgrey)USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND"];var globalterm;var fetcherror="";var vgeoip_country_code;var vgeoip_country_name;var vgeoip_city;var vgeoip_region;var vgeoip_latitude;var vgeoip_longitude;
+function incrementLoaded(t){var loaded=readCookie("loaded");loaded++;if(loaded>4){t.newLine();carriageReturn();loaded=2}createCookie("loaded",loaded,0,5)}function carriageReturn(){Terminal.prototype.globals.keyHandler({which:globalterm.termKey.CR,_remapped:true})}function pressKey(ch){Terminal.prototype.globals.keyHandler({which:ch,_remapped:true})}
+function createCookie(name,value,days,min){var expires;var date=new Date;if(days){date.setTime(date.getTime()+days*24*60*60*1E3);expires="; expires="+date.toGMTString()}else expires="";if(min){date.setTime(date.getTime()+min*60*1E3);expires="; expires="+date.toGMTString()}document.cookie=name+"="+value+expires+"; path=/"}
+function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(";");for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==" ")c=c.substring(1,c.length);if(c.indexOf(nameEQ)===0)return c.substring(nameEQ.length,c.length)}return""}function readAllCookies(){var nameEQ="=";var all=[];var ca=document.cookie.split(";");for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==" ")c=c.substring(1,c.length);all.push(c.substring(c[0],c.indexOf(nameEQ)))}return all}
+if(!Array.indexOf)Array.prototype.indexOf=function(obj){for(var i=0;i<this.length;i++)if(this[i]==obj)return i;return-1};function randomRange(min,max){if(min>max)return-1;if(min==max)return min;var r=parseInt(Math.random()*(max+1),10);return r+min<=max?r+min:r}
+function browserWidth(){if(window.innerWidth)return window.innerWidth;else if(document.documentElement&&document.documentElement.clientWidth)return document.documentElement.clientWidth;else if(document.body&&document.body.offsetWidth)return document.body.offsetWidth;else return 0}
+function browserHeight(){if(window.innerHeight)return window.innerHeight;else if(document.documentElement&&document.documentElement.clientHeight)return document.documentElement.clientHeight;else if(document.body&&document.body.offsetHeight)return document.body.offsetHeight;else return 0}Date.prototype.getMonthName=function(){return["January","February","March","April","May","June","July","August","September","October","November","December"][this.getMonth()]};
+Date.prototype.milTime=function(){var t=this.getHours()+":"+this.getMinutes()+":"+this.getSeconds();return t};Date.prototype.daysInMonth=function(){return(new Date(this.getFullYear(),this.getMonth()+1,0)).getDate()};
+Date.prototype.calendar=function(){var calArray=[];var buildStr="";var numDays=this.daysInMonth();var startDay=(new Date(this.getFullYear(),this.getMonth(),1)).getDay();calArray.push("%c(@lightgrey) "+this.getMonthName()+" "+this.getFullYear());calArray.push("Sun Mon Tue Wed Thu Fri Sat");for(var i=0;i<startDay;i++)buildStr+=" ";var blankdays=startDay;var filler="";var j=1;for(i=1;i<=numDays;i++){if(this.getDate()==i)j="%+r"+i+"%-r";else j=i;if(i<10)buildStr+=" "+j+" ";else buildStr+=j+
+" ";blankdays++;if(blankdays%7===0&&i<numDays){calArray.push(buildStr);buildStr=""}}blankdays++;while(blankdays%7!==0){buildStr+=" ";blankdays++}calArray.push(buildStr);return calArray};Array.prototype.shuffle=function(){var tindex,rindex;for(var i=0;i<this.length;i++){rindex=Math.floor(Math.random()*this.length);tindex=this[i];this[i]=this[rindex];this[rindex]=tindex}};var xmlHttp=null;if(typeof XMLHttpRequest!="undefined")xmlHttp=new XMLHttpRequest;
+if(!xmlHttp){var xhttperr;try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(xhttperr$1){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(xhttperr$0){xmlHttp=null}}}
+function fetchHttp(url,fkt){var xhttperr;fetcherror="";if(xmlHttp)try{xmlHttp.open("GET",url,true);xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4)fkt(xmlHttp.responseText)};xmlHttp.send(null)}catch(xhttperr$2){fetcherror="Error: no network";if(fkt!=eval){globalterm.write(fetcherror);globalterm.prompt()}}else fkt("Error: no XMLHttpRequest. Your browser is broken!")}
+function evaljs(content){var JSONCode=document.createElement("script");JSONCode.setAttribute("type","text/javascript");JSONCode.text=content;document.body.appendChild(JSONCode)}function displayraw(content){globalterm.write(content);globalterm.rawMode=false;globalterm.prompt()}function displaymore(content){globalterm.clear();globalterm.write("%c(@lightgrey)"+content,true);globalterm.rawMode=false}
+function initGeoIP(){if(!window.geoip_country_code){vgeoip_country_code="N/A";vgeoip_country_name="N/A";vgeoip_city="N/A";vgeoip_region="N/A";vgeoip_latitude="N/A";vgeoip_longitude="N/A"}else{vgeoip_country_code=geoip_country_code();vgeoip_country_name=geoip_country_name();vgeoip_city=geoip_city();vgeoip_region=geoip_region();vgeoip_latitude=geoip_latitude();vgeoip_longitude=geoip_longitude()}}
+function delAFile(fname){var fpath=getPath(fname);if(fpath[0]!="/home/www"){globalterm.write("%c(@lightgrey) rm "+fname+": Permission denied.");return}var findex=files_www_n.indexOf(fpath[1]);if(findex!=-1){if(!readCookie(fpath[1])){globalterm.write("%c(@lightgrey) rm "+fname+": Permission denied.");return}files_www_n.splice(findex,1);files_www_s.splice(findex,1);files_www_t.splice(findex,1);createCookie(fpath[1],"",0)}else globalterm.write("%c(@lightgrey)"+fname+": No such file or directory.")}
+function delAllFiles(){var allcookies=readAllCookies();var deleted=0;for(var i=0;i<allcookies.length;i++){if(allcookies[i]=="clilastlog"||allcookies[i]=="style"||allcookies[i]=="broken")continue;var fcontent=readCookie(allcookies[i]);var date=fcontent.slice(fcontent.length-12);if(date.length!=12)continue;delAFile(allcookies[i]);deleted++}if(deleted>0)globalterm.write("%c(@lightgrey) deleted "+deleted+" files%n")}
+function addFile(fname,fcontent,iseditor,fdate){if(typeof iseditor=="undefined")iseditor=false;var error="";var fpath=getPath(fname);fname=fpath[1];if(fname=="unixtoolbox.xhtml"){error=fname+": Permission denied";if(iseditor)return"Save "+error;else{globalterm.write("%c(@lightgrey)"+error);return error}}var size=fcontent.length+1;var sizestr;var datestr;if(size<10)sizestr=" "+size;else if(size<100)sizestr=" "+size;else if(size<1E3)sizestr=" "+size;else if(size<1E4)sizestr=" "+size;if(typeof fdate==
+"undefined"){var d=new Date;var h=d.getHours();if(h<10)h="0"+h;var m=d.getMinutes();if(m<10)m="0"+m;var day=d.getDate();if(day<10)day=" "+day;var mo=shortm[d.getMonth()];datestr=mo+" "+day+" "+h+":"+m}else datestr=fdate;var findex=files_www_n.indexOf(fname);if(fpath[0]!="/home/www"){error=fname+": Permission denied";if(iseditor)return"Save "+error;else{globalterm.write("%c(@lightgrey)"+error);return error}}else if(findex!=-1){if(!readCookie(fname)){error=fname+": system file permission denied";if(iseditor)return"Save "+
+error;else{globalterm.write("%c(@lightgrey)"+error);return error}}files_www_n[findex]=fname;files_www_s[findex]=sizestr;files_www_t[findex]=datestr}else{files_www_n.push(fname);files_www_s.push(sizestr);files_www_t.push(datestr)}fcontent=fcontent.replace(/;/g,"~~");fcontent=fcontent+datestr;createCookie(fname,fcontent,365);return error}
+function addAFile(fname){var fcontent=readCookie(fname);if(fcontent!==""){var cnt=fcontent.slice(0,fcontent.length-12);cnt=cnt.replace(/~~/g,";");var date=fcontent.slice(fcontent.length-12);if(date.length==12)addFile(fname,cnt,false,date)}}
+function getPath(fname){var fullpath="";var filename="";var fullname="";var rpath=path;while(fname.charAt(fname.length-1)=="/"&&fname.length>1)fname=fname.slice(0,fname.length-1);var slashindex=fname.lastIndexOf("/");if(slashindex==-1&&fname.charAt(0)!="."){filename=fname;fullpath=rpath}else{filename=fname.slice(slashindex+1);if(fname.charAt(0)=="/"){fullpath=fname.slice(0,slashindex);if(fullpath==="")fullpath="/"}else if(fname.indexOf("..")===0){var relarray=fname.split("..");var relpath=rpath.split("/");
+if(relpath.length>=relarray.length){for(var i=0;i<relarray.length-1;i++)rpath=rpath.slice(0,rpath.lastIndexOf("/"));var lastrel=fname.lastIndexOf("../");if(lastrel!=-1){var pathtoadd=fname.slice(lastrel+3,slashindex);if(pathtoadd.length>0)fullpath=rpath+"/"+pathtoadd;else fullpath=rpath}else fullpath=rpath;if(filename==".."){filename="";fullname=fullpath}else fullname=fullpath+"/"+filename}}else if(rpath=="/")fullpath=rpath+fname.slice(0,slashindex);else fullpath=rpath+"/"+fname.slice(0,slashindex)}if(fullpath==
+"/")fullname=fullpath+filename;else if(fullname.length===0)fullname=fullpath+"/"+filename;return[fullpath,filename,fullname]}
+function longlisting(t,files,opt){if(typeof files=="undefined"){t.write("%c(@lightgrey)Error path does not exist%n");return}var showmore=false;var lines=[];if(typeof opt!="undefined"&&opt.indexOf("a")!=-1)t.write(["%c(@lightgrey)drwxrwxr-x 6 sysa wheel 1024 Feb 12 03:03 ./","drwxr-xr-x 21 root wheel 512 Jan 25 00:26 ../%n"]);for(var i=0;i<files[0].length;i++)lines[i]=files[3]+" "+files[1][i]+" "+files[2][i]+" "+files[0][i];if(files[0].length>t.conf.rows-2)showmore=true;t.write(lines,showmore)}
+function listing(t,f){if(typeof f=="undefined"){t.write("%c(@lightgrey)Error path does not exist%n");return}var files=f;var name_length=0;var space_divider=5;var fileslist=[];for(var i=0;i<files.length;i++)if(files[i].length>name_length)name_length=files[i].length;name_length=name_length+space_divider;var dividers=Math.round((t.conf.cols-2)/name_length);var j=1;var thisline="%c(@lightgrey)";for(var k=0;k<files.length;k++){thisline+=files[k];var this_name_lenth=files[k].length;if(files[k]=="%+nunixtoolbox.xhtml%-n")this_name_lenth=
+this_name_lenth-6;var space_missing=name_length-this_name_lenth;var space="";while(space_missing>0){space=space+" ";space_missing--}thisline+=space;j++;if(j>=dividers){fileslist.push(thisline);t.write(thisline+"%n");thisline="%c(@lightgrey)";j=1}}if(j!==0)t.write(thisline+"%n")}var uptimed=randomRange(10,380);var uptime=" up "+uptimed+" days, 04:32, "+randomRange(0,10)+" users, load averages: 0."+randomRange(10,99)+", 0."+randomRange(10,89)+", 0."+randomRange(10,69);var clockvisible=false;
+stopwatch=false;var numh=asciin.length;var numw=asciin[0].length/10;var asciistr=[];var r;var c;var started;var now;var firstline="";var sp="ABCDEFGHIJKLMNOPQRSTUVWXYZabscdefghijklmnopqrstuvwxyz23456789#$\u00a3@";var s=" ";var dim=null;var allRows=[];var interval=0;var xperIter=0;var mcolors=["030","033","063","093","393","0c3","3c0","6c3","0f0","6f3","3f0","9f3","ff3","fff"];var regex=[];
+function connectionLost(){globalterm.charMode=true;globalterm.lock=true;globalterm.cursorOff();globalterm.newLine();globalterm.write("%n%c(@orange)Error: connection reset by peer%n");createCookie("broken","true",0,1)}function cmdLogin(t){if(t.argc==t.argv.length||t.argv[t.argc]==="")t.write("%c(@lightgrey)usage: login <username>");else{t.env.getPassword=true;t.env.username=t.argv[t.argc];t.write("%c(@lightgrey)Password: ");t.rawMode=true;t.lock=false;return}}
+function cmdSu(t){t.env.getPassword=true;t.env.username="root";t.write("%c(@lightgrey)Password: ");t.rawMode=true;t.lock=false;return}var uid=randomRange(500,1E3);function cmdId(t){var uidnow=uid;if(t.user=="www")uidnow=80;else if(t.user=="root")uidnow=0;t.write("%c(@lightgrey)uid="+uidnow+"("+t.user+") gid="+uidnow+"("+t.user+") groups="+uidnow+"("+t.user+")")}function cmdUptime(t){d=new Date;t.write("%c(@lightgrey)"+d.milTime()+uptime)}
+function isnumeric(str){for(var i=0;i<str.length;i++){var c=str.charAt(i);var a=c.charCodeAt(0);if(!(a>47&&a<58)&&!(a==45))return false;if(a==45&&i!==0)return false}return true}
+function cmdCal(t){if(t.argv.length==1)d=new Date;else if(t.argv[1]=="-h"||t.argv[1]=="--help"){t.write("%c(@lightgrey)display this months calender.%n");t.write("%c(@lightgrey)usage: cal [month]%n");return}else if(!isnumeric(t.argv[1])){t.write("%c(@lightgrey)usage: cal [month] where [month] is numeric%n");return}else{now=new Date;var year=now.getFullYear();var day=now.getUTCDate();var month=t.argv[1]-1;d=new Date(year,month,day)}t.write(d.calendar())}
+function cmdLs(t){var findex=0;var fpath=null;var longlist=false;if(t.argv.length==1){listing(t,tree_files[tree.indexOf(path)][0]);return}else if(t.argv[1]=="-l"||t.argv[1]=="-la"||t.argv[1]=="-al")if(t.argv.length==2){longlisting(t,tree_files[tree.indexOf(path)],t.argv[1]);return}else{longlist=true;fpath=getPath(t.argv[2])}else fpath=getPath(t.argv[1]);findex=tree.indexOf(fpath[2]);if(findex!=-1)if(longlist)longlisting(t,tree_files[findex],t.argv[1]);else listing(t,tree_files[findex][0]);else t.write("%c(@lightgrey)"+
+t.argv[1]+": No such file or directory.")}function cmdLl(t){if(t.argv.length==1)longlisting(t,tree_files[tree.indexOf(path)]);else{fpath=getPath(t.argv[1]);findex=tree.indexOf(fpath[2]);if(findex!=-1)longlisting(t,tree_files[findex]);else t.write("%c(@lightgrey)"+t.argv[1]+": No such file or directory.")}}function cmdPwd(t){t.write("%c(@lightgrey)"+path)}
+function cmdCd(t){if(t.argv.length==1||t.argv[1]=="~"){path="/home/www";t.ps="["+t.user+"@localhost]~>";return}else{splitpath=getPath(t.argv[1]);var findex=tree.indexOf(splitpath[2]);if(findex!=-1)path=splitpath[2];else t.write("%c(@lightgrey)"+splitpath[2]+": No such file or directory.")}if(path=="/home/www")t.ps="["+t.user+"@localhost]~>";else t.ps="["+t.user+"@localhost]"+path+">"}
+function cmdEcho(t){if(t.argv.length!=1&&t.argv[t.argv.length-2]==">"){var file=t.argv[t.argv.length-1];if(path!="/home/www"){t.write("%c(@lightgrey)Permission denied");return}var fs="";for(var i=1;i<t.argv.length-2;i++){fs+=t.argv[i];if(i+1!=t.argv.length-2)fs+=" "}addFile(file,fs)}else if(t.argv.length!=1&&t.argv[1]=="$PATH")t.write("%c(@lightgrey)/bin:/sbin:/etc");else{var s="%c(@lightgrey)";for(var j=1;j<t.argv.length;j++){s+=t.argv[j];if(j+1!=t.argv.length)s+=" "}t.write(s)}}
+function isdir(dirpath){if(tree.indexOf(dirpath)!=-1)return true;return false}function isfile(filepath){var fpath=getPath(filepath);if(tree.indexOf(fpath[0])==-1)return false;if(tree_files[tree.indexOf(fpath[0])][0].indexOf(fpath[1])==-1)return false;return true}
+function rmdir(dirpath){var fpath=getPath(dirpath);for(var j=0;j<3;j++)tree_files[tree.indexOf(fpath[0])][j].splice(tree_files[tree.indexOf(fpath[0])][0].indexOf(fpath[1]),1);if(isdir(dirpath)){tree_files.splice(tree.indexOf(fpath[2]),1);tree.splice(tree.indexOf(fpath[2]),1)}}function rmdirr(dirpath){if(isdir(dirpath)){var fpath=getPath(dirpath);var files=tree_files[tree.indexOf(fpath[2])][0];while(files.length>0)rmdirr(dirpath+"/"+files[files.length-1])}rmdir(dirpath)}
+function cmdRm(t){t.wrap=false;if(t.argv.length==1){t.write("%c(@lightgrey)usage: rm <file>");return}var rf=false;var rootindex=0;var dirindex=0;var fileindex=0;var filearg=t.argv[t.argv.length-1];if(t.argv.indexOf("-rf")!=-1)rf=true;if(t.user=="root"){if(filearg=="/"&&rf){setTimeout("connectionLost()",15E3);filearg="/bin"}var fpath=getPath(filearg);var fname=fpath[1];var lpath=fpath[0];var fullname=fpath[2];rootindex=tree.indexOf(lpath);if(rootindex!=-1){dirindex=tree.indexOf(fullname);fileindex=
+tree_files[rootindex][0].indexOf(fname);if(isdir(fullname))if(rf)rmdirr(fullname);else t.write("rm: cannot remove "+filearg+": Is a directory%n");else if(fileindex!=-1)for(var i=0;i<3;i++)tree_files[rootindex][i].splice(fileindex,1);else t.write("rm: cannot remove "+fname+": No such file or directory%n")}else t.write("rm: cannot remove "+lpath+": No such file or directory%n")}else if(filearg=="/")t.write("%c(@lightgrey)I'm sorry Dave, I'm afraid I can't do that.");else if(t.argv[1]=="*")delAllFiles();
+else delAFile(filearg)}
+function cmdUname(t){if(t.argv.length==1||t.argv[1]=="-s")t.write("%c(@lightgrey)FreeBSD");else if(t.argv[1]=="-i")t.write("%c(@lightgrey)CB");else if(t.argv[1]=="-m"||t.argv[1]=="-p")t.write("%c(@lightgrey)i386");else if(t.argv[1]=="-n")t.write("%c(@lightgrey)localhost");else if(t.argv[1]=="-a")t.write("%c(@lightgrey)FreeBSD localhost 7.1-STABLE FreeBSD 7.1-STABLE #2: Wed Jan 30 16:21:05 CET 2009 c@localhost:/usr/obj/usr/src/sys/CB i386");else if(t.argv[1]=="-v")t.write("%c(@lightgrey)FreeBSD 7.1-STABLE #2: Wed Jan 30 16:21:05 CET 2009 c@localhost:/usr/obj/usr/src/sys/CB");else if(t.argv[1]==
+"-r")t.write("%c(@lightgrey)7.1-STABLE");else t.write(["%c(@lightgrey)uname: illegal option -"+t.argv[1],"usage: uname [-aimnprsv]"])}function cmdHostname(t){if(t.argv.length==1||t.argv[1]=="-f")t.write("%c(@lightgrey)localhost");else if(t.argv[1]=="-s")t.write("%c(@lightgrey)cb");else if(t.argv[1]=="-i")t.write("%c(@lightgrey)78.31.70.238");else t.write(["%c(@lightgrey)uname: illegal option -"+t.argv[1],"usage: hostname [-fsi]"])}
+function cmdReset(t){t.write(" ");t.clear();t.rawMode=true;t.open();return}
+function cmdCat(t,iseditor,filename){var error="ok";if(t.argv.length==1&&!iseditor){t.write("%c(@lightgrey)usage: cat file");return error}if(typeof filename=="undefined")filename=t.argv[1];var fpath=getPath(filename);var fname=fpath[1];var lpath=fpath[0];var fullname=fpath[2];var cnt;var tindex=tree.indexOf(lpath);if(tindex==-1){error="Error: "+lpath+" wrong path";return error}var findex=tree_files[tindex][0].indexOf(fname);if(findex!=-1||fname=="unixtoolbox.xhtml"){var fcontent=readCookie(fname);
+if(fcontent){cnt=fcontent.slice(0,fcontent.length-12);cnt=cnt.replace(/~~/g,";");t.write("%c(@lightgrey)"+cnt+"%n");return error}cnt=filesContent[fullname];if(typeof cnt!="undefined"&&cnt!="undefined")t.write(cnt);else if(remote_files.indexOf(fname)!=-1){cnt=filesContent[fullname];t.write("%c(@lightgrey)"+cnt+"%n")}else if(binary_files.indexOf(fname)!=-1)if(iseditor)error=" binary file";else window.location="/"+fname;else{error=fname+": Permission denied";if(iseditor)return"Open "+error;else t.write("%c(@lightgrey)cat : "+
+error+"%n")}}else if(!iseditor)t.write("%c(@lightgrey)cat : "+fname+" : File not found%n");else error="";return error}
+function cmdMan(t){if(t.argv.length==1){t.write("%c(@lightgrey)usage: man <command>%n");t.write("%c(@lightgrey)The following man pages are available, or use apropos on any command.%n");listing(t,files_man[0]);return}var cmd=t.argv[1];if(files_man_n.indexOf(cmd)!=-1){var dim=t.getDimensions();var file=filesContent["/usr/share/man/"+cmd];if(file.length>t.conf.rows-1)t.write(file,true);else t.write(file)}else t.write("%c(@lightgrey)No manual entry for "+cmd)}
+function cmdMore(t){if(t.argv.length==1){t.write("%c(@lightgrey)usage: more <file>");return}var fpath=getPath(t.argv[1]);var fname=fpath[1];var lpath=fpath[0];var fullname=fpath[2];var cnt;var findex;var tindex=tree.indexOf(lpath);if(tindex==-1)return;if(lpath=="/home/www"){findex=tree_files[tindex][0].indexOf(fname);if(findex!=-1){t.clear();var fcontent=readCookie(fname);if(fcontent){cnt=fcontent.slice(0,fcontent.length-12);cnt=cnt.replace(/~~/g,";");t.write("%c(@lightgrey)"+cnt+"%n");return}else if(fname==
+"sitemap.xml"){t.write(file_sitemap,true);return}else if(fname=="cb.txt"){t.write(file_cb,true);return}else if(fname=="about.txt"){t.write(file_about,true);return}else if(fname=="bugs.txt"){t.write(file_bugs,true);return}}if(remote_files.indexOf(fname)!=-1){t.rawMode=true;t.write("%c(@lightgrey)Patience...%n");fetchHttp("/"+fname,displaymore)}else if(binary_files.indexOf(fname)!=-1)t.write("%c(@lightgrey)Binary file. Use pr instead");else t.write("%c(@lightgrey)File not found.")}else if(lpath=="/etc"){findex=
+tree_files[tindex][0].indexOf(fname);if(findex!=-1){cnt=filesContent[fullname];if(typeof cnt!="undefined"){t.clear();t.write(cnt)}else t.write("%c(@lightgrey)"+fname+" : Permission denied%n")}else t.write("%c(@lightgrey)"+fname+" : File not found%n")}}function cmdPr(t){if(t.argv.length==1)t.write("%c(@lightgrey)usage: pr file");else window.location=t.argv[1]}
+function cmdRedim(t,manual){var oldie=false;if(typeof document.documentElement.style.maxHeight=="undefined")oldie=true;if(navigator.appVersion.indexOf("Safari")!=-1)safari=true;var dim=t.getDimensions();var neww=Math.round(t.conf.cols/dim.width*browserWidth())-2;var newh=Math.round(t.conf.rows/dim.height*browserHeight())-1;if(oldie){t.write("Using IE6 hack%n");neww=neww-2}if(t.argv&&t.argv.length>1||manual){t.write("Terminal dimentions in px: "+dim.width+" x "+dim.height+" px%n");t.write("Browser window dimentions in px: "+
+browserWidth()+" x "+browserHeight()+" px%n");t.write("Terminal columns x rows: "+t.conf.cols+" x "+t.conf.rows+" char%n");t.write("Maximal columns x rows: "+neww+" x "+newh+" char%n")}else if(!t.argv||t.argv.length==1)if(neww!==0){t.resizeTo(neww,newh);t.maxCols=neww;t.maxLines=newh;if(neww<6*asciinumber[0].length/10+2*asciiddot[0].length){asciin=asciinumber_s;asciid=asciiddot_s}else{asciin=asciinumber;asciid=asciiddot}numh=asciin.length;numw=asciin[0].length/10}}
+function redim(){cmdRedim(globalterm)}function cmdTime(t){var d=new Date;t.write("%c(@lightgrey)"+d.milTime())}
+function displayNum(str,center){var n=0;for(var i=0;i<numh;i++)asciistr[i]="";for(var k=0;k<str.length;k++)if(str.charAt(k)==":")for(var j=0;j<numh;j++)asciistr[j]=asciistr[j]+asciid[j];else{n=str.charAt(k);for(var l=0;l<numh;l++)asciistr[l]=asciistr[l]+asciin[l].slice(n*numw,n*numw+numw)}if(!center)globalterm.write(s);else{var r=Math.round(globalterm.conf.rows/2)-Math.round(numh/2);var c=Math.round((globalterm.conf.cols-asciistr[0].length)/2);for(var m=0;m<asciistr.length;m++)globalterm.typeAt(r+
+m,c,asciistr[m],3*256)}}
+function clockHandler(initterm){if(initterm){initterm.env.handler=initterm.handler;initterm.cursorOff();asciistr=[];numh=asciin.length;numw=asciin[0].length/10;r=Math.round(globalterm.conf.rows/2)-Math.round(numh/2);c=Math.round((globalterm.conf.cols-6*numw-2*asciid[0].length)/2)+4*numw+2*asciid[0].length;return}this.lock=true;var key=this.inputChar;if(key==32)if(interval===0)interval=setInterval("carriageReturn()",1E3);else{clearInterval(interval);interval=0}else if(key==114)started=new Date;else if(key!=
+globalterm.termKey.CR){clearInterval(interval);interval=0;clockvisible=false;stopwatch=false;this.charMode=false;this.handler=this.env.handler;this.clear();this.prompt();return}else{now=new Date;var h;var m;var s;if(!stopwatch){h=now.getHours();m=now.getMinutes();s=now.getSeconds()}else{var diff=(now-started)/1E3;s=Math.floor(diff%60);diff=diff/60;m=Math.floor(diff%60);diff=diff/60;h=Math.floor(diff%24)}var sh=""+h;var sm=""+m;var ss=""+s;if(h<10)sh="0"+h;if(m<10)sm="0"+m;if(s<10)ss="0"+s;if(!clockvisible){displayNum(sh+
+":"+sm+":"+ss,true);clockvisible=true}else if(s<2)displayNum(sh+":"+sm+":"+ss,true);else{for(var j=0;j<numh;j++)asciistr[j]=""+asciin[j].slice(ss.charAt(0)*numw,ss.charAt(0)*numw+numw)+asciin[j].slice(ss.charAt(1)*numw,ss.charAt(1)*numw+numw);for(var i=0;i<asciistr.length;i++)this.typeAt(r+i,c,asciistr[i],3*256)}}this.lock=false}
+function cmdClock(t){started=new Date;var findex=-1;if(t.argv.length>=2)findex=t.argv.indexOf("-t");if(findex!=-1){stopwatch=true;t.argv.splice(findex,1);findex=-1}if(t.argv.length>=2)findex=t.argv.indexOf("-s");if(findex!=-1){asciin=asciinumber_s;asciid=asciiddot_s;t.argv.splice(findex,1);findex=-1}else if(t.conf.cols>6*asciinumber[0].length/10+2*asciiddot[0].length){asciin=asciinumber;asciid=asciiddot}t.charMode=true;t.cursorOff();t.clear();clockHandler(t);interval=setInterval("carriageReturn()",
+1E3);t.handler=clockHandler;t.lock=false;return}function setNormal(){term.conf.bgColor="#181818";term.rebuild()}function setColor(color){term.conf.bgColor=color;term.rebuild();globalterm.write(" ")}var bootline=0;var booting=false;var sdnotifed=false;var rebootask1=false;var rebootask2=false;var rebootask3=false;var beenhere=false;
+function rebootHandler(initterm){if(initterm){initterm.env.handler=initterm.handler;if(beenhere)initterm.write("%c(@orange)You again?? %c(@lightgrey)Alright you want to reboot, but are you sure?");else initterm.write("%c(@lightgrey)So you want to reboot. Are you sure?");return}this.newLine();this.charMode=false;this.lock=true;if(this.isPrintable(key)){var ch=String.fromCharCode(key);this.type(ch)}if(!rebootask1){beenhere=true;this.cursorOn();if(this.lineBuffer=="yes"){rebootask1=true;this.write("%c(@lightgrey)Are you really sure you know which machine is actually going to reboot?");
+this.newLine()}else if(this.lineBuffer=="no"){this.write("%c(@lightgrey)Good choice! Go play with the other commands.");this.charMode=false;this.handler=this.env.handler;this.prompt();return}else if(this.lineBuffer){this.write("%c(@lightgrey)answer yes or no");this.newLine()}this.lock=false;this.lineBuffer="";return}else if(!rebootask2){this.cursorOn();if(this.lineBuffer=="yes"){rebootask2=true;this.write('%c(@lightgrey)So will that be yours or mine? Answer "yours" or "mine" or "quit"');this.newLine()}else if(this.lineBuffer==
+"no"){this.write("%c(@lightgrey)I don't know either :o)");rebootask1=false;this.charMode=false;this.handler=this.env.handler;this.prompt();return}else if(this.lineBuffer){this.write("%c(@lightgrey)answer with yes or no");this.newLine()}this.lock=false;this.lineBuffer="";return}else if(!rebootask3){this.cursorOn();if(this.lineBuffer=="yours"||this.lineBuffer=="mine"){this.cursorOff();rebootask3=true;this.write("%c(@lightgrey)So you mean yours....OK you asked for it.");setTimeout("carriageReturn()",
+2E3)}else if(this.lineBuffer=="quit"){rebootask1=false;rebootask2=false;rebootask3=false;this.write("%c(@lightgrey)whimp :o).");this.charMode=false;this.handler=this.env.handler;this.prompt();return}else if(this.lineBuffer){this.write('Answer "yours" or "mine" or "quit"');this.newLine()}this.lock=false;this.lineBuffer="";return}this.lock=true;var key=this.inputChar;this.cursorOff();if(key==32)if(interval===0)interval=setInterval("carriageReturn()",300);else{clearInterval(interval);interval=0}else if(!sdnotifed&&
+!booting){this.newLine();this.write(["%n%n%n%c(@orange)Shutdown at "+Date(),"%c(@chartreuse)shutdown: [pid "+randomRange(189,21E3)+"]","root:{"+randomRange(70,150)+"}"+path,"%n%n*** System shutdown message from "+clientip+" ***","Sytem going down in 4 seconds%c()%n%n%n"]);this.write("Send SIGTERM to all processes%n");this.write(pslong);this.newLine();this.write("%n%n");sdnotifed=true;setTimeout("interval = setInterval ('carriageReturn()', 300 )",4E3)}else if(!booting&&sdnotifed)if(bootline==filesContent["/boot/shutdown"].length-
+1){bootline=0;clearInterval(interval);interval=0;this.clear();term.conf.bgColor="blue";term.rebuild();this.write(" ");booting=true;setTimeout("setColor('#ffffff')",1200);setTimeout("setNormal()",1600);setTimeout("interval = setInterval ('carriageReturn()', 300 )",2500)}else{this.write(filesContent["/boot/shutdown"][bootline]);bootline++;if(bootline==filesContent["/boot/shutdown"].length-1){clearInterval(interval);interval=setInterval("carriageReturn()",4E3)}}else if(bootline==filesContent["/boot/kernel"].length-
+1){clearInterval(interval);interval=0;bootline=0;booting=false;rebootask1=false;rebootask2=false;this.newLine();cmdRedim(this,true);this.charMode=false;this.handler=this.env.handler;this.cursorOn();setTimeout("globalterm.clear()",3E3);setTimeout("location.reload()",3500)}else{this.write(filesContent["/boot/kernel"][bootline]);bootline++}this.lock=false}
+function cmdReboot(t){if(t.user!="root"){t.write("%c(@lightgrey)You must be root to do this");return}t.charMode=true;rebootHandler(t);t.handler=rebootHandler;setTimeout("carriageReturn()",100);t.lock=false;return}function cmdNum(t){if(t.argv.length==1)t.write("%c(@lightgrey)usage: num number");asciistr=[];displayNum(t.argv[1],true)}
+function randomScreen(isgame){globalterm.wrap=true;var maxr=0;allRows=[];globalterm.clear();if(typeof isgame=="undefined")isgame=false;if(isgame)maxr=globalterm.conf.rows-2;else maxr=globalterm.conf.rows;firstline="";for(var j=0;j<=maxr;j++){for(var i=0;i<globalterm.conf.cols;i++)if(isgame){if(i===0||i==globalterm.conf.cols-1){firstline+="*";continue}if(randomRange(1,250)<=snakefood)firstline+=randomRange(1,9);else firstline+=" "}else firstline+=String.fromCharCode(randomRange(38,126));allRows.push(firstline);
+firstline=""}if(isgame){for(var k=0;k<globalterm.conf.cols;k++)firstline+="%c(@lightgrey)*";allRows[0]=allRows[maxr]=firstline;var nrocks=Math.round(globalterm.conf.cols*globalterm.conf.rows/snakerocks);for(var rocks=0;rocks<nrocks;rocks++){var rockr=randomRange(2,globalterm.conf.rows-9);var rockc=randomRange(2,globalterm.conf.cols-7);var rockchar="";for(var kr=0;kr<4;kr++){if(kr>0&&kr<3)rockchar="#####";else if(kr===0)rockchar=",###,";else if(kr==3)rockchar="'###'";allRows[rockr+kr]=allRows[rockr+
+kr].slice(0,rockc)+rockchar+allRows[rockr+kr].slice(rockc+5)}}for(var l=0;l<allRows.length;l++){allRows[l]=allRows[l].replace(/#/g,"%c(@orange)#%c(@lightgrey)");allRows[l]=allRows[l].replace(/,/g,"%c(@orange),%c(@lightgrey)");allRows[l]=allRows[l].replace(/'/g,"%c(@orange)'%c(@lightgrey)")}}return allRows}function cmdRandom(t){if(t.argv.length==2&&t.argv[1]=="n")t.write(randomScreen(true));else t.write(randomScreen())}
+function iterateArray(write){if(Math.round(Math.random()-.4)===0)s=" ";else s="1";for(i=0;i<mcolors.length;i++){if(i===0)repl=s;else repl="%c(#"+mcolors[i-1]+")"+sp.charAt(randomRange(0,61));firstline=firstline.replace(regex[i],repl)}repl="%c(#fff)"+sp.charAt(randomRange(0,61));for(i=0;i<xperIter;i++){var p=randomRange(0,firstline.length);if(firstline.charAt(p)==" "||firstline.charAt(p)=="1")firstline=firstline.slice(0,p)+"%c(#fff)#"+firstline.slice(p+1)}var rowtochange=randomRange(1,allRows.length-
+1);allRows[rowtochange]=allRows[rowtochange].replace(regex[mcolors.length],repl);allRows.unshift(firstline);allRows.pop();if(write)globalterm.write(allRows)}var matrixrounds;var matrixemptystart=false;
+function matrixHandler(initterm){var repl;var i=0;if(initterm){if(initterm.argv.indexOf("-s")!=-1)matrixemptystart=true;else matrixemptystart=false;matrixrounds=globalterm.conf.rows*3;firstline="";xperIter=Math.round(globalterm.conf.cols/45);initterm.env.handler=initterm.handler;dim=initterm.getDimensions();for(i=0;i<mcolors.length;i++)regex[i]=eval("/%c\\(#"+mcolors[i]+"\\)./g");regex[mcolors.length]=eval("/%c\\(#fff\\)./g");for(i=0;i<initterm.conf.cols-1;i++)firstline=firstline+" ";for(i=0;i<=initterm.conf.rows;i++)allRows[i]=
+firstline;return}this.lock=true;var key=this.inputChar;if(key==32)if(interval===0)interval=setInterval("carriageReturn()",1E3);else{clearInterval(interval);interval=0}if(key==113||key==termKey.ESC){clearInterval(interval);interval=0;this.charMode=false;this.handler=this.env.handler;this.clear();this.prompt();return}else{if(!matrixemptystart&&matrixrounds>0)while(matrixrounds>0){iterateArray(false);matrixrounds--}iterateArray(false);this.write(allRows)}this.lock=false}
+function cmdMatrix(t){t.cursorOff();t.charMode=true;t.write("%c(@lightgrey)Use q or ESC to quit. Space to pause%n");t.write("%c(@lightgrey) -s for empty start%n");t.write("%c(@lightgrey) See also man matrix%n");matrixHandler(t);interval=setInterval("carriageReturn()",1200);t.handler=matrixHandler;t.lock=false;return}
+function init(t){var numproc=randomRange(9,12);var h=randomRange(0,9);var m=randomRange(10,59);for(var i=0;i<numproc;i++){var s=randomRange(10,59);pslong.push("%c(@lightgrey)www "+randomRange(1E3,5100)+" 0.0 1.5 "+randomRange(1E4,51E3)+" "+randomRange(1E4,51E3)+" ?? I "+h+":"+m+"."+s+" /usr/local/sbin/httpd")}}
+function cmdPs(t){var numproc=randomRange(8,14);var h=randomRange(0,9);var m=randomRange(10,59);if(t.argv.length==1){t.write("%c(@lightgrey)PID TT STAT TIME COMMAND%n");for(var i=0;i<numproc;i++){var s=(i*13+10)%60;s=s<10?10:s;t.write("%c(@lightgrey)"+randomRange(1E3,5100)+" ?? I "+h+":"+m+"."+s+" /usr/local/sbin/httpd%n")}}else t.write(pslong)}
+function cmdWhatis(t){if(t.argv.length==1)t.write("%c(@lightgrey)usage: whatis/apropos <command>");else if(t.argv[1]=="help")t.write("%c(@lightgrey)display the help message");else if(t.argv[1]=="info")t.write("%c(@lightgrey)display the info message with credentials");else if(t.argv[1]=="clear")t.write("%c(@lightgrey)clear the terminal");else if(t.argv[1]=="echo")t.write("%c(@lightgrey)echo the arguments or create a file with >");else if(t.argv[1]=="ls"||t.argv[1]=="ll")t.write("%c(@lightgrey)list directory contents");
+else if(t.argv[1]=="cd")t.write("%c(@lightgrey)change working directory");else if(t.argv[1]=="rm")t.write("%c(@lightgrey)delete a file mostly for root only");else if(t.argv[1]=="uname")t.write("%c(@lightgrey)display system identification");else if(t.argv[1]=="whoami")t.write("%c(@lightgrey)display effective user id");else if(t.argv[1]=="whereami")t.write("%c(@lightgrey)display you probable position with country and city");else if(t.argv[1]=="weather")t.write("%c(@lightgrey)display weather information based on your location");
+else if(t.argv[1]=="who")t.write("%c(@lightgrey)display who is on the system");else if(t.argv[1]=="id")t.write("%c(@lightgrey)return user identity");else if(t.argv[1]=="matrix")t.write("%c(@lightgrey)show a matrix like screen saver (it is CPU hungry)");else if(t.argv[1]=="more")t.write("%c(@lightgrey)display a file with paging function");else if(t.argv[1]=="pwd")t.write("%c(@lightgrey)return working directory name");else if(t.argv[1]=="cat")t.write("%c(@lightgrey)concatenate and print files");else if(t.argv[1]==
+"chat")t.write("%c(@lightgrey)chat with the terminal chatbot");else if(t.argv[1]=="hostname")t.write("%c(@lightgrey)set or print name of current host system");else if(t.argv[1]=="ps")t.write("%c(@lightgrey)process status");else if(t.argv[1]=="pr")t.write("%c(@lightgrey)print files on the browser");else if(t.argv[1]=="browse")t.write("%c(@lightgrey)display the file on the browser");else if(t.argv[1]=="browser")t.write("%c(@lightgrey)display your IP address and browser information");else if(t.argv[1]==
+"cal")t.write("%c(@lightgrey)displays a calendar");else if(t.argv[1]=="uptime")t.write("%c(@lightgrey)show how long system has been running");else if(t.argv[1]=="date")t.write("%c(@lightgrey)display date and time");else if(t.argv[1]=="time")t.write("%c(@lightgrey)time command execution");else if(t.argv[1]=="clock")t.write("%c(@lightgrey)display a full screen clock or stopwatch with the option -t");else if(t.argv[1]=="top")t.write("%c(@lightgrey)display information about the top cpu processes");else if(t.argv[1]==
+"df")t.write("%c(@lightgrey)display free disk space");else if(t.argv[1]=="history")t.write("%c(@lightgrey)display the last used commands");else if(t.argv[1]=="fortune")t.write("%c(@lightgrey)print a random, hopefully interesting, adage");else if(t.argv[1]=="su")t.write("%c(@lightgrey)substitute user identity");else if(t.argv[1]=="ssh")t.write("%c(@lightgrey)ssh connection using the mindterm java terminal");else if(t.argv[1]=="vi")t.write("%c(@lightgrey)vi the editor!");else if(t.argv[1]=="snake")t.write("%c(@lightgrey)A variation of the classical snake game");
+else if(t.argv[1]=="invaders")t.write("%c(@lightgrey)The invaders game provided by Norbert Landsteiner");else if(t.argv[1]=="logout"||t.argv[1]=="exit")t.write("%c(@lightgrey)Exit and logout from the terminal");else if(t.argv[1]=="reset")t.write("%c(@lightgrey)reset the terminal as it's initial state");else if(t.argv[1]=="reload")t.write("%c(@lightgrey)reload the web page");else if(t.argv[1]=="ping")t.write("%c(@lightgrey)ping a host, or yourself when no argument is given");else t.write("%c(@lightgrey)"+
+t.argv[1]+": nothing appropriate")}var viquit=false;var visave=false;var viforce=false;var viopen=false;var viedit=false;var visaved=true;var visplvis=false;var vicmd="";var vifile="";function readOneLine(t,row){var c=0;var line="";while(t.isPrintable(t.charBuf[row][c])&&c<t.maxCols){line+=String.fromCharCode(t.charBuf[row][c]);c++}return line}
+function removeLine(t,row){var l=0;var content="";for(var r=row;r<t.maxLines-1;r++){content=readOneLine(t,r+1);t.typeAt(r,0,content);t.c=content.length;t.r=r;while(t.isPrintable(t.charBuf[r][t.c]))t.fwdDelete();l++;if(t.charBuf[r][0]==126)break}t.c=0;t.r=row}
+function viSplash(t){var splash=[" Vi",""," version 0.1 alpha :o)",""," <ESC> to enter command mode"," :q<Enter> to exit"," :w<Enter> to save",' :w filename to save to "filename"',' :e filename to open "filename"'," :q!<Enter> to exit without saving"," D to delete rest of line"," dd to delete current line"," x to delete current char"," i to enter edit mode "," UP RIGHT DOWN LEFT to move the cursor",
+" or h left j down k up l right","","Paging is not possible, sorry. Only one","window (or page) can be edited at a time.","","both vi *and* Emacs are just too damn slow","Use ED! See man ed"];if(safari)splash.push("On Safari browsers use <TAB> instead of <ESC>");visplvis=true;centerSplash(t,splash)}
+function centerSplash(t,splash){var sh=splash.length;var sw=0;for(var i=0;i<sh;i++)if(splash[i].length>sw)sw=splash[i].length;var r=Math.round(t.conf.rows/2)-Math.round(sh/2)-3;var c=Math.round(t.conf.cols/2)-Math.round(sw/2);if(r<0)r=0;for(var m=0;m<sh;m++)if(m<16)t.typeAt(r+m,c,splash[m],7*256);else t.typeAt(r+m,c,splash[m],5*256)}
+function saveFile(t,fname){var content="";for(var r=0;r<t.maxLines-1;r++)if(t.charBuf[r][0]!=126)content+=readOneLine(t,r)+"%n";content=content.slice(0,content.length-2);var error=addFile(fname,content,true);if(error===""&&typeof error!="undefined"){t.statusLine("File saved to "+fname);return true}else{t.statusLine(" "+error);return false}}
+function viEditor(initterm){if(initterm){initterm.clear();initterm.maxLines=globalterm.conf.rows-1;initterm.env.mode="ctrl";initterm.env.handler=initterm.handler;var error="";if(vifile!==""){error=cmdCat(initterm,true);if(error===""){initterm.statusLine('"'+vifile+'" [New File]');viSplash(initterm)}else if(error!="ok"&&typeof error!="undefined")initterm.statusLine("Error: "+error,1);else{initterm.write("%n");if(safari)initterm.statusLine(" On Safari browsers use <TAB> instead of <ESC>")}}else{initterm.statusLine(" [New File]");
+viSplash(initterm)}if(!visplvis)for(var r=initterm.r;r<initterm.maxLines;r++)initterm.printRowFromString(r,"~");return}this.lock=true;this.cursorOff();var key=this.inputChar;if(key==termKey.LEFT)this.cursorLeft();else if(key==termKey.RIGHT)this.cursorRight();else if(key==termKey.UP){var c=this.c;var ru=this.r-1;if(ru<0)ru=0;while(!this.isPrintable(this.charBuf[ru][c])&&c>0)c--;this.cursorSet(ru,c)}else if(key==termKey.DOWN){var cd=this.c;var rd=this.r+1;if(this.charBuf[rd][0]!=126){while(!this.isPrintable(this.charBuf[rd][cd])&&
+cd>0)cd--;this.cursorSet(rd,cd)}}if(visplvis){for(var ro=this.r;ro<this.maxLines;ro++)this.printRowFromString(ro,"~");visplvis=false}if(this.env.mode=="ctrl"){if(key==104&&vicmd.charAt(0)!=":")this.cursorLeft();else if(key==106&&vicmd.charAt(0)!=":"){var cd2=this.c;var rd2=this.r+1;if(this.charBuf[rd2][0]!=126){while(!this.isPrintable(this.charBuf[rd2][cd2])&&cd2>0)cd2--;this.cursorSet(rd2,cd2)}}else if(key==107&&vicmd.charAt(0)!=":"){var c2=this.c;var ru2=this.r-1;if(ru2<0)ru2=0;while(!this.isPrintable(this.charBuf[ru2][c2])&&
+c2>0)c2--;this.cursorSet(ru2,c2)}else if(key==108&&vicmd.charAt(0)!=":")this.cursorRight();if(key==termKey.CR){if(vicmd.charAt(0)!=":"){viquit=viopen=visave=viforce=viedit=false;vicmd="";this.statusLine("Error: no command given. Use <ESC>:q to quit.")}if(visave){viopen=visave=viedit=false;var name=vicmd.split(" ");if(name.length>2)this.statusLine("Error: no space in file name. Use <ESC>:w filename.");else if(name.length==2||vifile!==""){if(name.length==2)vifile=name[1];if(saveFile(this,vifile))visaved=
+true;else viquit=false}else this.statusLine("Error: no file name. Use <ESC>:w filename to save.")}else if(viopen){viquit=viopen=visave=viedit=false;var fname=vicmd.split(" ");if(fname.length>2)this.statusLine("Error: no space in file name. Use <ESC>:e filename.");else if(fname.length==2||vifile!=="")if(fname.length==2)vifile=fname[1];this.clear();error=cmdCat(this,true,vifile);if(error==="")this.statusLine('"'+vifile+'" [New File]');else if(error!="ok"&&typeof error!="undefined")this.statusLine("Error: "+
+error,1)}if(viquit)if(visaved||viforce){viquit=viopen=visave=viforce=viedit=false;vicmd="";vifile="";this.charMode=false;this.handler=this.env.handler;this.maxLines=globalterm.conf.rows;this.clear();this.prompt();return}else this.statusLine("Error: file modified since last write; save or use ! to override.");vicmd="";viquit=viopen=visave=viforce=viedit=false}else if(key==33&&vicmd.charAt(0)==":"){viforce=true;vicmd+="!";this.statusLine(vicmd)}else if(key==58&&vicmd.charAt(0)!=":"){vicmd+=":";viquit=
+false;visave=false;viforce=false;this.statusLine(vicmd)}else if(key==113&&vicmd.charAt(0)==":"&&!viedit){viquit=true;vicmd+="q";this.statusLine(vicmd)}else if(key==119&&vicmd.charAt(0)==":"&&!viedit){visave=true;vicmd+="w";this.statusLine(vicmd)}else if(key==101&&vicmd.charAt(0)==":"){viopen=true;vicmd+="e";this.statusLine(vicmd)}else if(key==120&&vicmd.charAt(0)==":"&&!viedit){viquit=visave=true;vicmd+="x";this.statusLine(vicmd)}else if(key==120&&!viedit){visaved=false;this.fwdDelete()}else if(key==
+68&&!viedit){visaved=false;while(this.isPrintable(this.charBuf[this.r][this.c]))this.fwdDelete()}else if(key==100&&!viedit){vicmd+="d";if(vicmd=="dd"){visaved=false;this.cursorSet(this.r,0);while(this.isPrintable(this.charBuf[this.r][this.c]))this.fwdDelete();removeLine(this,this.r);vicmd=""}}else if(key==105&&!viedit){this.statusLine("-- INSERT --",0);this.env.mode=""}else if(key==termKey.ESC||key==9){this.statusLine("",0);viquit=false;visave=false;viforce=false;vicmd=""}else if(visave||viopen){if(key==
+32)viedit=true;var ch=String.fromCharCode(key);vicmd+=ch;this.statusLine(vicmd)}}else if(key==termKey.ESC||key==9){vicmd="";this.statusLine("",1);this.env.mode="ctrl"}else if(key==termKey.CR){visaved=false;if(!this.isPrintable(this.charBuf[this.r][0])||this.charBuf[this.r][0]==126)this.write(" ");if(this.r<this.maxLines-1)this.newLine();else this.statusLine("Error: paging not possible. Sorry.")}else if(key==termKey.BS){visaved=false;this.backspace()}else if(key==termKey.DEL){visaved=false;if(this.c===
+0&&!this.isPrintable(this.charBuf[this.r][0]))removeLine(this,this.r);else this.fwdDelete()}else if(this.isPrintable(key)){var cha=String.fromCharCode(key);this.type(cha);visaved=false}var sline=readOneLine(this,this.maxLines);sline=sline.slice(0,45);var sp=" ";if(sline.charAt(0)!="E"){for(var j=sline.length;j<this.maxCols-18;j++)sp+=" ";this.statusLine(sline+sp+"row:"+this.r+" col:"+this.c)}this.lock=false;this.cursorOn()}
+function cmdEdit(t){if(t.argv.length==2)vifile=t.argv[1];viEditor(t);t.handler=viEditor;t.charMode=true;t.cursorOn();t.lock=false;return}function distToCenter(t,row,col){var c=t.maxCols/2;var r=t.maxLines/2;var d=Math.sqrt(Math.pow(row-r,2)+Math.pow(col-c,2));return d}function delta(row,col,row1,col1){var d=Math.sqrt(Math.pow(row-row1,2)+Math.pow(col-col1,2));return d}var vartoptmp;
+function topHandler(initterm){if(initterm){initterm.clear();initterm.env.handler=initterm.handler;initterm.cursorOff();vartoptmp=vartop;if(vartoptmp.length>initterm.conf.rows)vartoptmp=vartoptmp.slice(0,initterm.conf.rows);initterm.write(vartoptmp);interval=setInterval("carriageReturn()",2E3);return}this.lock=true;var now=new Date;var h=now.getHours();var hup=(h+8)%24;var m=now.getMinutes();var mup=(m+13)%60;var s=now.getSeconds();var sup=(s+45)%60;if(h<10)h="0"+h;if(m<10)m="0"+m;if(s<10)s="0"+s;
+if(hup<10)hup="0"+hup;if(mup<10)mup="0"+mup;if(sup<10)sup="0"+sup;var timestr="%c(@lightgrey)"+uptimed+"+"+hup+":"+mup+":"+sup+" "+h+":"+m+":"+s;var key=this.inputChar;if(key==termKey.CR){var procarray=vartoptmp.slice(8,vartop.length-1);procarray.shuffle();this.cursorSet(0,57);this.write(timestr);this.cursorSet(8,0);this.write(procarray)}else{clearInterval(interval);interval=0;this.charMode=false;this.handler=this.env.handler;this.clear();this.prompt();this.wrapping=true;return}this.lock=false}
+function cmdTop(t){t.wrapping=false;topHandler(t);t.handler=topHandler;t.charMode=true;t.lock=false;return}function bsHandler(initterm){if(initterm){initterm.clear();initterm.env.handler=initterm.handler;initterm.cursorOff();setColor("blue");initterm.write(bs);return}this.lock=true;this.charMode=false;this.handler=this.env.handler;this.clear();this.prompt();setNormal();return}function cmdBlueScreen(t){t.wrapping=false;bsHandler(t);t.handler=bsHandler;t.charMode=true;t.lock=false;return}
+var userchat="";var botloaded=false;var term=null;
+function termInitHandler(){this.user="www";globalterm=this;cmdRedim(this);var cookiebroken=readCookie("broken");if(cookiebroken.length>0){this.write("You broke it!");this.charMode=true;this.lock=true;this.cursorOff();return}var thislog="%c(@lightgrey)Last login: "+Date()+" from "+clientip;var cookielastlog=readCookie("clilastlog");var oldlog=cookielastlog?cookielastlog:thislog;createCookie("clilastlog",thislog,365);this.write([oldlog,"FreeBSD 7.1-STABLE (localhost) #3: "+Date("2017-06-17T15:34:42"),
+"%c()"]);this.newLine();this.newLine();this.prompt();var allcookies=readAllCookies();for(var i=0;i<allcookies.length;i++)if(allcookies[i]!="clilastlog"&&allcookies[i]!="style")addAFile(allcookies[i]);init(this);var ucmd=location.hash;if(ucmd.charAt(0)=="#"){TermGlobals.insertText(ucmd.slice(1));Terminal.prototype.globals.keyHandler({which:this.termKey.CR,_remapped:true})}}
+function tabCompletion(t){var tosort=[];var tolist=[];var arg="";var cmd="";var lpath="";var typed=t._getLine();if(typed.indexOf(" ")!=-1){args=typed.split(" ");cmd=args[0]+" ";if(args.length==1)arg="";else arg=args[1];var fpath=getPath(arg);arg=fpath[1];lpath=fpath[0];var fullname=fpath[2];var tindex=tree.indexOf(fullname);if(tindex==-1){tindex=tree.indexOf(lpath);if(tindex==-1)tosort.push("");else tosort=tree_files[tindex][0]}else{tosort=tree_files[tindex][0];if(t._getLine().charAt(t._getLine().length-
+1)!="/")t.type("/");arg=""}}else{arg=typed;tosort=files_sbin_n.concat(files_bin_n)}var tabresult="";for(var i=0;i<tosort.length;i++)if(tosort[i].indexOf(arg)===0)tolist.push(tosort[i]);if(tolist.length===0)tabresult="";else if(tolist.length==1){tabresult=tolist[0].slice(arg.length);t.type(tolist[0].slice(arg.length))}else if(tolist.length>1){tabresult=tolist[0].slice(arg.length);var j=0;var nextchar=" ";if(tolist[0].length<arg.length)tabresult=arg;else{tabresult=arg;while(tolist[0].length>arg.length+
+j&&nextchar.length>0){nextchar=tolist[0].charAt(arg.length+j);for(var k=1;k<tolist.length;k++)if(arg.length+j>tolist[k].length||tolist[k].charAt(arg.length+j)!=nextchar){nextchar="";break}tabresult+=nextchar;t.type(nextchar);j++}}}if(tolist.length>1){t.charMode=true;typed=t._getLine();t.lock=true;t.cursorOff();t.newLine();listing(t,tolist);t.cursorOn();t.lock=false;t.charMode=false;t.prompt();t.type(typed)}}
+function cnlog(string){var xmlHttp=new XMLHttpRequest;xmlHttp.open("GET","/rest-api/cmd/?"+string,true);xmlHttp.send(null)}
+function commandHandler(){cnlog("s="+this.lineBuffer);this.newLine();if(this.rawMode){if(this.env.getPassword){if(this.lineBuffer==this.env.username){this.user=this.env.username;this.ps="["+this.user+"@localhost]~>"}else this.write("%c(@lightgrey)Sorry.");this.env.username="";this.env.getPassword=false}this.rawMode=false;this.prompt();return}parseLine(this);if(this.argv.length===0);else if(this.argQL[0])this.write("%c(@lightgrey)Syntax error: first argument quoted.");else{var cmd=this.argv[this.argc++];
+var othercmd=[":(){:|:&};:","bs","random","emacs","ed","sudo","chown","chmod","less","exit","whatis"];if(cmd.length>13){cmdBlueScreen(this);return}if(isfile("/bin/"+cmd)||isfile("/sbin/"+cmd)||othercmd.indexOf(cmd)!=-1)if(cmd=="help")this.write(helpPage);else if(cmd=="info")this.write(infoPage);else if(cmd=="clear"||cmd=="bash")this.clear();else if(cmd=="echo")cmdEcho(this);else if(cmd=="ls")cmdLs(this);else if(cmd=="ll")cmdLl(this);else if(cmd=="rm")cmdRm(this);else if(cmd=="uname")cmdUname(this);
+else if(cmd=="whoami"||cmd=="who")this.write("%c(@lightgrey)"+this.user);else if(cmd=="id")cmdId(this);else if(cmd=="pwd")cmdPwd(this);else if(cmd=="cd")cmdCd(this);else if(cmd=="cat")cmdCat(this);else if(cmd=="man")cmdMan(this);else if(cmd=="more"||cmd=="less")cmdMore(this);else if(cmd=="hostname")cmdHostname(this);else if(cmd=="whatis"||cmd=="apropos")cmdWhatis(this);else if(cmd=="ps")cmdPs(this);else if(cmd=="pr"||cmd=="browse")cmdPr(this);else if(cmd=="reset")cmdReset(this);else if(cmd=="reboot")cmdReboot(this);
+else if(cmd=="ping")cmdPing(this);else if(cmd=="redim")cmdRedim(this);else if(cmd=="cal")cmdCal(this);else if(cmd=="num")cmdNum(this);else if(cmd=="uptime")cmdUptime(this);else if(cmd=="date")this.write("%c(@lightgrey)"+Date());else if(cmd=="reload")location.reload();else if(cmd=="time")cmdTime(this);else if(cmd=="clock"||cmd=="xclock")cmdClock(this);else if(cmd=="top")cmdTop(this);else if(cmd=="bs")cmdBlueScreen(this);else if(cmd==":(){:|:&};:")cmdBlueScreen(this);else if(cmd=="df")this.write(vardf);
+else if(cmd=="history")this.write(this.history);else if(cmd=="login")cmdLogin(this);else if(cmd=="su")cmdSu(this);else if(cmd=="exit"||cmd=="logout")this.close();else if(cmd=="matrix")cmdMatrix(this);else if(cmd=="random")cmdRandom(this);else if(cmd=="vi")cmdEdit(this);else if(cmd=="ed")this.write("%c(@lightgrey)Ed is the standard text editor. (I still have to port it though) %c(@lightcyan)See man ed");else if(cmd=="sudo")this.write("%c(@lightgrey)sudo is for wimps");else if(cmd=="chown"||cmd=="chmod")this.write("%c(@lightgrey)All Your Files Are Belong To Us");
+else{if(files_sbin_n.indexOf(cmd)!=-1)this.write("%c(@lightgrey)"+this.argv[0]+": Permission denied.")}else this.write("%c(@lightgrey)"+this.argv[0]+": Command not found.")}if(!this.rawMode&&!this.charMode)this.prompt()}
+function termOpen(){user_login=localStorage.getItem("user");var hostname=location.hostname;if(!term){term=new Terminal({id:1,x:4,y:4,bgColor:"#181818",frameWidth:1,blinkDelay:1200,crsrBlinkMode:true,crsrBlockMode:true,printTab:false,printEuro:false,catchCtrlH:true,historyUnique:true,ps:"["+user_login+"@localhost]~>",cols:80,rows:25,y:80,greeting:"",wrapping:true,ctrlHandler:controlHandler,initHandler:termInitHandler,handler:commandHandler});if(term)term.open()}else if(term.closed)term.open();else term.focus();
+incrementLoaded(term)}function controlHandler(){if(this.inputChar==termKey.ETX){this.newLine();this.prompt()}else if(this.inputChar==termKey.EOT)this.close();else if(this.inputChar==9)tabCompletion(this)}var clientip="%c(@lightgrey)127.0.0.1";
+var vartop=["%c(@lightgrey)last pid: 17396; load averages: 0.12, 0.15, 0.16 up 1187+13:45:54 13:45:40","%c(@lightgrey)132 processes: 1 running, 131 sleeping","%c(@lightgrey)","%c(@lightgrey)Mem: 1041M Active, 328M Inact, 452M Wired, 80M Cache, 209M Buf, 5604K Free","%c(@lightgrey)Swap: 2000M Total, 1676M Used, 324M Free, 83% Inuse","%c(@lightgrey)","%c(@lightgrey)","%c(@lightgrey) PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND","%c(@lightgrey)14496 www 1 50 0 344M 83808K lockf 0 1:29 2.98% httpd",
+"%c(@lightgrey) 6786 asterisk 37 44 0 303M 9004K ucond 1 448.8H 0.00% asteris","%c(@lightgrey)71038 mysql 10 44 0 108M 22404K sigwai 0 693:36 0.00% mysqld","%c(@lightgrey)70914 pgsql 1 44 0 49748K 30440K select 0 108:59 0.00% postgre","%c(@lightgrey) 1413 clamav 1 45 0 28136K 2332K pause 0 57:32 0.00% freshcl","%c(@lightgrey) 1111 root 1 44 0 6008K 704K select 0 28:43 0.00% syslogd","%c(@lightgrey) 1234 root 1 44 0 661M 236M lockf 1 23:06 0.00% saslaut",
+"%c(@lightgrey) 1232 root 1 44 0 661M 61372K lockf 0 23:05 0.00% saslaut","%c(@lightgrey) 1233 root 1 44 0 661M 236M accept 0 23:04 0.00% saslaut","%c(@lightgrey)92882 root 1 44 0 29232K 1440K select 0 17:27 0.00% sendmai","%c(@lightgrey)93011 root 1 44 0 341M 58724K select 0 14:30 0.00% httpd","%c(@lightgrey)70915 pgsql 1 44 0 17380K 112K select 0 8:55 0.00% postgre","%c(@lightgrey) 1361 root 1 46 0 8120K 712K select 0 8:45 0.00% inetd",
+"%c(@lightgrey) 1406 clamav 3 76 0 41248K 708K sigwai 1 8:09 0.00% clamav-","%c(@lightgrey)94445 mailnull 4 76 0 52804K 7628K sigwai 1 7:15 0.00% dkim-fi","%c(@lightgrey) 1289 root 3 76 0 43520K 4896K sigwai 0 5:50 0.00% sid-fil","%c(@lightgrey)79764 root 2 76 0 48560K 5660K sigwai 0 5:27 0.00% spamass","%c(@lightgrey)70912 pgsql 1 44 0 49748K 780K select 1 4:23 0.00% postgre","%c(@lightgrey)32014 root 1 54 10 113M 77668K select 0 3:51 0.00% perl5.8",
+"%c(@lightgrey)93104 root 1 44 0 25196K 520K select 1 3:45 0.00% sshd","%c(@lightgrey) 1462 root 1 44 0 6936K 380K nanslp 0 2:50 0.00% cron","%c(@lightgrey)14506 www 1 44 0 345M 84272K lockf 0 1:43 0.00% httpd","%c(@lightgrey)14464 www 1 44 0 345M 86764K select 0 1:38 0.00% httpd","%c(@lightgrey)14465 www 1 44 0 344M 81920K kqread 1 1:38 0.00% httpd","%c(@lightgrey)14469 www 1 50 0 346M 82600K lockf 0 1:38 0.00% httpd",
+"%c(@lightgrey)14498 www 1 45 0 344M 83520K select 0 1:36 0.00% httpd","%c(@lightgrey)"];
+var vardf=["%c(@lightgrey)Filesystem 1K-blocks Used Avail Capacity Mounted on","%c(@lightgrey)/dev/ad6s1d 99173510 51628630 39611000 57% /","%c(@lightgrey)/usr/src 9914318 4470852 4650322 49% /usr/src","%c(@lightgrey)/usr/obj 9914318 4470852 4650322 49% /usr/obj","%c(@lightgrey)/usr/ports 9914318 4470852 4650322 49% /usr/ports","%c(@lightgrey)/data/jail/sleepyowl8/data/home 99173510 51628630 39611000 57% /var/chroot/data/home",
+"%c(@lightgrey)/data/jail/sleepyowl8/data/www 99173510 51628630 39611000 57% /var/chroot/data/www","%c(@lightgrey)devfs 1 1 0 100% /dev","%c(@lightgrey)fdescfs 1 1 0 100% /dev/fd","%c(@lightgrey)procfs 4 4 0 100% /proc",""];
+var file_index=["%c(@lightgrey)","a, a:link, a:visited {"," text-decoration: none;"," color: #5E83E0;","}","a:hover {"," text-decoration: underline;","}","a:active {"," text-decoration: underline;"," color: orange;","}","#applet { position: absolute; top: 4px; left: 4px; z-index: 2; }","#link { position: absolute; top: 4px; right: 4px; z-index: 3; }"," </style>","</head>","<body>","",'<p style="padding:5em;">',"Welcome to localhost.<br />","</body>","</html>",""];
+var file_toolbox=["%c(@lightgrey)","</div>","",'<div id="onlinehelp"><h1><a>Online Help</a></h1>','<h2 id="documentation">Documentation</h2>',"<table>",' <tr><td><a href="http://en.tldp.org/">Linux Documentation</a> </td><td>en.tldp.org</td></tr>',' <tr><td><a href="http://www.linuxmanpages.com/">Linux Man Pages</a> </td><td>www.linuxmanpages.com</td></tr>',' <tr><td><a href="http://www.oreillynet.com/linux/cmd/">Linux commands directory</a> </td><td>www.oreillynet.com/linux/cmd</td></tr>',' <tr><td><a href="http://linux.die.net/">Linux doc man howtos</a> </td><td>linux.die.net</td></tr>',
+' <tr><td><a href="http://www.freebsd.org/handbook/">FreeBSD Handbook</a> </td><td>www.freebsd.org/handbook</td></tr>',' <tr><td><a href="http://www.freebsd.org/cgi/man.cgi">FreeBSD Man Pages</a> </td><td>www.freebsd.org/cgi/man.cgi</td></tr>',' <tr><td><a href="http://www.freebsdwiki.net">FreeBSD user wiki</a> </td><td>www.freebsdwiki.net</td></tr>',' <tr><td><a href="http://docs.sun.com/app/docs/coll/40.10">Solaris Man Pages</a> </td><td>docs.sun.com/app/docs/coll/40.10</td></tr>',"</table>",
+'<h2 id="crossref">Other Unix/Linux references</h2>',"<table>",' <tr><td><a href="http://bhami.com/rosetta.html">Rosetta Stone for Unix</a> </td><td>bhami.com/rosetta.html (a Unix command translator)</td></tr>',' <tr><td><a href="http://unixguide.net/unixguide.shtml">Unix guide cross reference</a> </td><td>unixguide.net/unixguide.shtml</td></tr>',' <tr><td><a rel="nofollow" href="http://www.linuxcmd.org">Linux commands line list</a> </td><td>www.linuxcmd.org</td></tr>',' <tr><td><a rel="nofollow" href="http://www.pixelbeat.org/cmdline.html">Short Linux reference</a> </td><td>www.pixelbeat.org/cmdline.html</td></tr>',
+' <tr><td><a href="http://www.shell-fu.org">Little command line goodies</a> </td><td>www.shell-fu.org</td></tr>',"</table>","</div>","",'<p class="last">That\'s all folks!</p>',"","\x3c!-- page break --\x3e",'\x3c!-- <div class="pb" /> --\x3e',"",'<div class="footerlast">','This document: "Unix Toolbox revision 14.4" is licensed under a <a rel="nofollow" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Licence [Attribution - Share Alike]</a>. &#169; <a href="mailto:c_at_localhost">Colin Barschel</a> 2007-2012. Some rights reserved.',
+"</div>","","</body>","</html>",""];var file_toolbox_txt=["%c(@lightgrey)","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""];
+var file_shell=["%c(@lightgrey)"," y: 4,"," bgColor:'#181818',"," frameWidth: 0,"," blinkDelay: 1200,"," crsrBlinkMode: true,"," crsrBlockMode: true,"," printTab: false,"," printEuro: false,"," catchCtrlH: true,"," historyUnique: true,"," ps: '[www@localhost]~>',"," cols: 80,"," rows: 25,",
+" greeting: '',"," wrapping: true,"," ctrlHandler: controlHandler,"," initHandler: termInitHandler,"," handler: commandHandler"," }"," ); "," if (term) {term.open();}"," } else if (term.closed) { term.open();"," } else { term.focus();"," }"," incrementLoaded(term);"," } ","}","function controlHandler() {"," if (this.inputChar == termKey.ETX) {",
+" this.newLine();"," this.prompt();"," } else if (this.inputChar == termKey.EOT) {this.close();}"," else if (this.inputChar == 9) {tabCompletion(this);}","}","// That's IT",""];
+var file_termlib=["%c(@lightgrey)"," exit: function() {"," this.clear();"," var inv=this.env.invaders;"," // reset the terminal"," this.handler=inv.termHandler;"," if (inv.charBuf) {"," for (var r=0; r<inv.charBuff.length; r++) {"," var tr=this.maxLines-1;"," this.charBuf[tr]=inv.charBuf[r];"," this.styleBuf[tr]=inv.styleBuf[r];"," this.redraw(tr);"," this.maxLines--;"," }"," }",
+" if (inv.termMaxCols>=0) this.maxCols=inv.termMaxCols;"," this.keyRepeatDelay1=inv.keyRepeatDelay1;"," this.keyRepeatDelay2=inv.keyRepeatDelay2;"," delete inv.termref;"," this.lock=false;"," this.charMode=inv.charMode;"," // delete instance and leave with a prompt"," delete this.env.invaders;"," this.prompt();"," },"," getStyleColorFromHexString: function(clr) {"," // returns a stylevector for the given color-string"," var cc=Terminal.prototype.globals.webifyColor(clr.replace(/^#/,''));",
+" if (cc) {"," return Terminal.prototype.globals.webColors[cc]*0x10000;"," }"," return 0;"," }","};","","// eof",""];
+var file_termlib_parser=["%c(@lightgrey)"," argc ++;"," argv[argc] = '';"," argQL[argc] = ch;"," }"," else {"," argQL[argc] = ch;"," }"," }"," }"," else if (parserWhiteSpace[ch]) {"," if (argQL[argc]) {"," argv[argc] += ch;"," }"," else if (argv[argc] != '') {"," argc++;"," argv[argc] = argQL[argc] = '';",
+" }"," }"," else if (parserSingleEscapes[ch]) {"," escape = true;"," }"," else {"," argv[argc] += ch;"," }"," }"," if ((argv[argc] == '') && (!argQL[argc])) {"," argv.length--;"," argQL.length--;"," }"," termref.argv = argv;"," termref.argQL = argQL;"," termref.argc = 0;","}","","// eof",""];var file_about=["%c(@lightgrey)","Welcome to my website localhost!",""];
+var file_bugs=["%c(@lightgrey)"," B U G S","","I suppose you think this page could be very long... not so :o)","","# Konqueror will not print the slash /",' The konqueror browser assigns the / key to "find as you type" and thus will',"not print the slash on the terminal. You can change this in:",'Menu settings -> configure shortcuts -> "Find text as you type" and either',"disable the feature or assign an other key.","Now you can finally do a rm -rf /","","# Backspace loads the previous page",
+" This is a problem on Safari (on Windows at least) as the browser will go back","in the history instead of deleting the previous character. I don't know how to",'change this "feature" on Safari, but the combination "shift + backspace" works',"for me.","",' To disable the "feature" on firefox change the value browser.backspace_action',"from 0 to 2 (do nothing) in about:config.","","Tell me about a disappointingly missing command/feature or bug. This could","motivate me to do it...","","Have fun.",
+""];
+var file_sitemap=["%c(@lightgrey)",'<?xml version="1.0" encoding="UTF-8"?>',"<urlset",' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"',' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"',' xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9',' http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">',"","<url>"," <loc>http://localhost</loc>"," <priority>0.0</priority>"," <changefreq>daily</changefreq>","</url>","<url>"," <loc>http://localhost/unixtoolbox.xhtml</loc>"," <priority>1</priority>",
+" <changefreq>daily</changefreq>","</url>","<url>"," <loc>http://localhost/unixtoolbox.pdf</loc>"," <priority>0.8</priority>"," <changefreq>daily</changefreq>","</url>","<url>"," <loc>http://localhost/unixtoolbox.book.pdf</loc>"," <priority>0.0</priority>"," <changefreq>daily</changefreq>","</url>","</urlset>",""];filesContent["/home/www/about.txt"]=file_about;filesContent["/home/www/bugs.txt"]=file_bugs;filesContent["/home/www/unixtoolbox.xhtml"]=file_toolbox;
+filesContent["/home/www/unixtoolbox.txt"]=file_toolbox_txt;filesContent["/home/www/index.html"]=file_index;filesContent["/home/www/sitemap.xml"]=file_sitemap;filesContent["/home/www/shell.js"]=file_shell;filesContent["/home/www/termlib.js"]=file_termlib;filesContent["/home/www/termlib_parser.js"]=file_termlib_parser; \ No newline at end of file
diff --git a/static/skulpt-stdlib.min.js b/static/skulpt-stdlib.min.js
new file mode 100644
index 0000000..3e512be
--- /dev/null
+++ b/static/skulpt-stdlib.min.js
@@ -0,0 +1 @@
+Sk.builtinFiles={"files": {"src/lib/py_compile.py": "raise NotImplementedError(\"py_compile is not yet implemented in Skulpt\")\n", "src/lib/symbol.py": "raise NotImplementedError(\"symbol is not yet implemented in Skulpt\")\n", "src/lib/traceback.py": "raise NotImplementedError(\"traceback is not yet implemented in Skulpt\")\n", "src/lib/runpy.py": "raise NotImplementedError(\"runpy is not yet implemented in Skulpt\")\n", "src/lib/_LWPCookieJar.py": "raise NotImplementedError(\"_LWPCookieJar is not yet implemented in Skulpt\")\n", "src/lib/Bastion.py": "raise NotImplementedError(\"Bastion is not yet implemented in Skulpt\")\n", "src/lib/this.py": "raise NotImplementedError(\"this is not yet implemented in Skulpt\")\n", "src/lib/platform.py": "raise NotImplementedError(\"platform is not yet implemented in Skulpt\")\n", "src/lib/logging/__init__.py": "raise NotImplementedError(\"logging is not yet implemented in Skulpt\")\n", "src/lib/socket.py": "raise NotImplementedError(\"socket is not yet implemented in Skulpt\")\n", "src/lib/fileinput.py": "raise NotImplementedError(\"fileinput is not yet implemented in Skulpt\")\n", "src/lib/shutil.py": "raise NotImplementedError(\"shutil is not yet implemented in Skulpt\")\n", "src/lib/uuid.py": "raise NotImplementedError(\"uuid is not yet implemented in Skulpt\")\n", "src/lib/threading.py": "raise NotImplementedError(\"threading is not yet implemented in Skulpt\")\n", "src/lib/functools.py": "raise NotImplementedError(\"functools is not yet implemented in Skulpt\")\n", "src/lib/xml/etree/__init__.py": "raise NotImplementedError(\"etree is not yet implemented in Skulpt\")\n", "src/lib/nturl2path.py": "raise NotImplementedError(\"nturl2path is not yet implemented in Skulpt\")\n", "src/lib/pdb.py": "raise NotImplementedError(\"pdb is not yet implemented in Skulpt\")\n", "src/lib/cookielib.py": "raise NotImplementedError(\"cookielib is not yet implemented in Skulpt\")\n", "src/lib/pyclbr.py": "raise NotImplementedError(\"pyclbr is not yet implemented in Skulpt\")\n", "src/lib/test/__init__.py": "__author__ = 'bmiller'\n\ndef testEqual(actual, expected):\n if type(expected) == type(1):\n if actual == expected:\n print('Pass')\n return True\n elif type(expected) == type(1.11):\n if abs(actual-expected) < 0.00001:\n print('Pass')\n return True\n else:\n if actual == expected:\n print('Pass')\n return True\n print('Test Failed: expected ' + str(expected) + ' but got ' + str(actual))\n return False\n\ndef testNotEqual(actual, expected):\n pass\n\n", "src/lib/doctest.py": "raise NotImplementedError(\"doctest is not yet implemented in Skulpt\")\n", "src/lib/pty.py": "raise NotImplementedError(\"pty is not yet implemented in Skulpt\")\n", "src/lib/test/decimaltestdata/__init__.py": "raise NotImplementedError(\"decimaltestdata is not yet implemented in Skulpt\")\n", "src/lib/sha.py": "raise NotImplementedError(\"sha is not yet implemented in Skulpt\")\n", "src/lib/uu.py": "raise NotImplementedError(\"uu is not yet implemented in Skulpt\")\n", "src/lib/lib-dynload/__init__.py": "raise NotImplementedError(\"lib-dynload is not yet implemented in Skulpt\")\n", "src/lib/asynchat.py": "raise NotImplementedError(\"asynchat is not yet implemented in Skulpt\")\n", "src/lib/decimal.py": "raise NotImplementedError(\"decimal is not yet implemented in Skulpt\")\n", "src/lib/xml/dom/__init__.py": "raise NotImplementedError(\"dom is not yet implemented in Skulpt\")\n", "src/lib/gettext.py": "raise NotImplementedError(\"gettext is not yet implemented in Skulpt\")\n", "src/lib/pythonds/basic/queue.py": "# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \n#queue.py\r\n\r\nclass Queue:\r\n def __init__(self):\r\n self.items = []\r\n\r\n def isEmpty(self):\r\n return self.items == []\r\n\r\n def enqueue(self, item):\r\n self.items.insert(0,item)\r\n\r\n def dequeue(self):\r\n return self.items.pop()\r\n\r\n def size(self):\r\n return len(self.items)\r\n", "src/lib/pkgutil.py": "raise NotImplementedError(\"pkgutil is not yet implemented in Skulpt\")\n", "src/lib/gzip.py": "raise NotImplementedError(\"gzip is not yet implemented in Skulpt\")\n", "src/lib/numbers.py": "raise NotImplementedError(\"numbers is not yet implemented in Skulpt\")\n", "src/lib/asyncore.py": "raise NotImplementedError(\"asyncore is not yet implemented in Skulpt\")\n", "src/lib/macpath.py": "raise NotImplementedError(\"macpath is not yet implemented in Skulpt\")\n", "src/lib/textwrap.py": "raise NotImplementedError(\"textwrap is not yet implemented in Skulpt\")\n", "src/lib/imputil.py": "raise NotImplementedError(\"imputil is not yet implemented in Skulpt\")\n", "src/lib/bdb.py": "raise NotImplementedError(\"bdb is not yet implemented in Skulpt\")\n", "src/lib/multiprocessing/__init__.py": "raise NotImplementedError(\"multiprocessing is not yet implemented in Skulpt\")\n", "src/lib/imghdr.py": "raise NotImplementedError(\"imghdr is not yet implemented in Skulpt\")\n", "src/lib/UserString.py": "raise NotImplementedError(\"UserString is not yet implemented in Skulpt\")\n", "src/lib/SimpleXMLRPCServer.py": "raise NotImplementedError(\"SimpleXMLRPCServer is not yet implemented in Skulpt\")\n", "src/lib/robotparser.py": "raise NotImplementedError(\"robotparser is not yet implemented in Skulpt\")\n", "src/lib/ast.py": "raise NotImplementedError(\"ast is not yet implemented in Skulpt\")\n", "src/lib/fractions.py": "raise NotImplementedError(\"fractions is not yet implemented in Skulpt\")\n", "src/lib/posixpath.py": "raise NotImplementedError(\"posixpath is not yet implemented in Skulpt\")\n", "src/lib/optparse.py": "raise NotImplementedError(\"optparse is not yet implemented in Skulpt\")\n", "src/lib/email/mime/__init__.py": "raise NotImplementedError(\"mime is not yet implemented in Skulpt\")\n", "src/lib/shlex.py": "raise NotImplementedError(\"shlex is not yet implemented in Skulpt\")\n", "src/lib/sre_compile.py": "raise NotImplementedError(\"sre_compile is not yet implemented in Skulpt\")\n", "src/lib/os2emxpath.py": "raise NotImplementedError(\"os2emxpath is not yet implemented in Skulpt\")\n", "src/lib/popen2.py": "raise NotImplementedError(\"popen2 is not yet implemented in Skulpt\")\n", "src/lib/contextlib.py": "raise NotImplementedError(\"contextlib is not yet implemented in Skulpt\")\n", "src/lib/hmac.py": "raise NotImplementedError(\"hmac is not yet implemented in Skulpt\")\n", "src/lib/poplib.py": "raise NotImplementedError(\"poplib is not yet implemented in Skulpt\")\n", "src/lib/unittest/gui.py": "import document\nfrom unittest import TestCase\n\nclass TestCaseGui(TestCase):\n def __init__(self):\n TestCase.__init__(self)\n self.divid = document.currentDiv()\n self.mydiv = document.getElementById(self.divid)\n res = document.getElementById(self.divid+'_unit_results')\n if res:\n self.resdiv = res\n res.innerHTML = ''\n else:\n self.resdiv = document.createElement('div')\n self.resdiv.setAttribute('id',self.divid+'_unit_results')\n self.resdiv.setAttribute('class','unittest-results')\n self.mydiv.appendChild(self.resdiv)\n\n\n def main(self):\n t = document.createElement('table')\n self.resTable = t\n self.resdiv.appendChild(self.resTable)\n\n headers = ['Result','Actual Value','Expected Value','Notes']\n row = document.createElement('tr')\n for item in headers:\n head = document.createElement('th')\n head.setAttribute('class','ac-feedback')\n head.innerHTML = item\n head.setCSS('text-align','center')\n row.appendChild(head)\n self.resTable.appendChild(row)\n\n for func in self.tlist:\n try:\n self.setUp()\n func()\n self.tearDown()\n except Exception as e:\n self.appendResult('Error', None, None, e)\n self.numFailed += 1\n self.showSummary()\n\n def appendResult(self,res,actual,expected,param):\n trimActual = False\n if len(str(actual)) > 15:\n trimActual = True\n actualType = type(actual)\n trimExpected = False\n if len(str(expected)) > 15:\n trimExpected = True\n expectedType = type(expected)\n row = document.createElement('tr')\n err = False\n if res == 'Error':\n err = True\n msg = 'Error: %s' % param\n errorData = document.createElement('td')\n errorData.setAttribute('class','ac-feedback')\n errorData.innerHTML = 'ERROR'\n errorData.setCSS('background-color','#de8e96')\n errorData.setCSS('text-align','center')\n row.appendChild(errorData)\n elif res:\n passed = document.createElement('td')\n passed.setAttribute('class','ac-feedback')\n passed.innerHTML = 'Pass'\n passed.setCSS('background-color','#83d382')\n passed.setCSS('text-align','center')\n row.appendChild(passed)\n self.numPassed += 1\n else:\n fail = document.createElement('td')\n fail.setAttribute('class','ac-feedback')\n fail.innerHTML = 'Fail'\n fail.setCSS('background-color','#de8e96')\n fail.setCSS('text-align','center')\n row.appendChild(fail)\n self.numFailed += 1\n\n\n act = document.createElement('td')\n act.setAttribute('class','ac-feedback')\n if trimActual:\n actHTML = str(actual)[:5] + \"...\" + str(actual)[-5:]\n if actualType == str:\n actHTML = repr(actHTML)\n act.innerHTML = actHTML\n else:\n act.innerHTML = repr(actual)\n act.setCSS('text-align','center')\n row.appendChild(act)\n\n expect = document.createElement('td')\n expect.setAttribute('class','ac-feedback')\n\n if trimExpected:\n expectedHTML = str(expected)[:5] + \"...\" + str(expected)[-5:]\n if expectedType == str:\n expectedHTML = repr(expectedHTML)\n expect.innerHTML = expectedHTML\n else:\n expect.innerHTML = repr(expected)\n expect.setCSS('text-align','center')\n row.appendChild(expect)\n inp = document.createElement('td')\n inp.setAttribute('class','ac-feedback')\n\n if err:\n inp.innerHTML = msg\n else:\n inp.innerHTML = param\n inp.setCSS('text-align','center')\n row.appendChild(inp)\n self.resTable.appendChild(row)\n\n\n def showSummary(self):\n pct = self.numPassed / (self.numPassed+self.numFailed) * 100\n pTag = document.createElement('p')\n pTag.innerHTML = \"You passed: \" + str(pct) + \"% of the tests\"\n self.resdiv.appendChild(pTag)\n", "src/lib/os.py": "raise NotImplementedError(\"os is not yet implemented in Skulpt\")\n", "src/lib/pythonds/basic/__init__.py": "\n#__all__ = [\"stack\"]\n\n\n#from .stack import Stack\n#from .queue import Queue\n\n\n\n", "src/lib/audiodev.py": "raise NotImplementedError(\"audiodev is not yet implemented in Skulpt\")\n", "src/lib/locale.py": "raise NotImplementedError(\"locale is not yet implemented in Skulpt\")\n", "src/lib/getopt.py": "raise NotImplementedError(\"getopt is not yet implemented in Skulpt\")\n", "src/lib/htmllib.py": "raise NotImplementedError(\"htmllib is not yet implemented in Skulpt\")\n", "src/lib/stringprep.py": "raise NotImplementedError(\"stringprep is not yet implemented in Skulpt\")\n", "src/lib/sre_parse.py": "raise NotImplementedError(\"sre_parse is not yet implemented in Skulpt\")\n", "src/lib/dumbdbm.py": "raise NotImplementedError(\"dumbdbm is not yet implemented in Skulpt\")\n", "src/lib/idlelib/Icons/__init__.py": "raise NotImplementedError(\"Icons is not yet implemented in Skulpt\")\n", "src/lib/copy_reg.py": "raise NotImplementedError(\"copy_reg is not yet implemented in Skulpt\")\n", "src/lib/sre.py": "raise NotImplementedError(\"sre is not yet implemented in Skulpt\")\n", "src/lib/htmlentitydefs.py": "raise NotImplementedError(\"htmlentitydefs is not yet implemented in Skulpt\")\n", "src/lib/rlcompleter.py": "raise NotImplementedError(\"rlcompleter is not yet implemented in Skulpt\")\n", "src/lib/cgitb.py": "raise NotImplementedError(\"cgitb is not yet implemented in Skulpt\")\n", "src/lib/statvfs.py": "raise NotImplementedError(\"statvfs is not yet implemented in Skulpt\")\n", "src/lib/chunk.py": "raise NotImplementedError(\"chunk is not yet implemented in Skulpt\")\n", "src/lib/ctypes/macholib/__init__.py": "raise NotImplementedError(\"macholib is not yet implemented in Skulpt\")\n", "src/lib/linecache.py": "raise NotImplementedError(\"linecache is not yet implemented in Skulpt\")\n", "src/lib/token.py": "raise NotImplementedError(\"token is not yet implemented in Skulpt\")\n", "src/lib/math.js": "var $builtinmodule = function (name) {\n var mod = {};\n mod.pi = new Sk.builtin.float_(Math.PI);\n mod.e = new Sk.builtin.float_(Math.E);\n\n mod.fabs = new Sk.builtin.func(function (x) {\n Sk.builtin.pyCheckArgs(\"fabs\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"x\", \"number\", Sk.builtin.checkNumber(x));\n\n return new Sk.builtin.float_(Math.abs(Sk.builtin.asnum$(x)));\n });\n\n mod.asin = new Sk.builtin.func(function (rad) {\n Sk.builtin.pyCheckArgs(\"asin\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"rad\", \"number\", Sk.builtin.checkNumber(rad));\n\n return new Sk.builtin.float_(Math.asin(Sk.builtin.asnum$(rad)));\n });\n\n mod.acos = new Sk.builtin.func(function (rad) {\n Sk.builtin.pyCheckArgs(\"acos\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"rad\", \"number\", Sk.builtin.checkNumber(rad));\n\n return new Sk.builtin.float_(Math.acos(Sk.builtin.asnum$(rad)));\n });\n\n mod.atan = new Sk.builtin.func(function (rad) {\n Sk.builtin.pyCheckArgs(\"atan\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"rad\", \"number\", Sk.builtin.checkNumber(rad));\n\n return new Sk.builtin.float_(Math.atan(Sk.builtin.asnum$(rad)));\n });\n\n mod.atan2 = new Sk.builtin.func(function (y, x) {\n Sk.builtin.pyCheckArgs(\"atan2\", arguments, 2, 2);\n Sk.builtin.pyCheckType(\"y\", \"number\", Sk.builtin.checkNumber(y));\n Sk.builtin.pyCheckType(\"x\", \"number\", Sk.builtin.checkNumber(x));\n\n return new Sk.builtin.float_(Math.atan2(Sk.builtin.asnum$(y), Sk.builtin.asnum$(x)));\n });\n\n mod.sin = new Sk.builtin.func(function (rad) {\n Sk.builtin.pyCheckArgs(\"sin\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"rad\", \"number\", Sk.builtin.checkNumber(rad));\n\n return new Sk.builtin.float_(Math.sin(Sk.builtin.asnum$(rad)));\n });\n\n mod.cos = new Sk.builtin.func(function (rad) {\n Sk.builtin.pyCheckArgs(\"cos\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"rad\", \"number\", Sk.builtin.checkNumber(rad));\n\n return new Sk.builtin.float_(Math.cos(Sk.builtin.asnum$(rad)));\n });\n\n mod.tan = new Sk.builtin.func(function (rad) {\n Sk.builtin.pyCheckArgs(\"tan\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"rad\", \"number\", Sk.builtin.checkNumber(rad));\n\n return new Sk.builtin.float_(Math.tan(Sk.builtin.asnum$(rad)));\n });\n\n mod.asinh = new Sk.builtin.func(function (x) {\n Sk.builtin.pyCheckArgs(\"asinh\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"x\", \"number\", Sk.builtin.checkNumber(x));\n\n x = Sk.builtin.asnum$(x);\n\n var L = x + Math.sqrt(x * x + 1);\n\n return new Sk.builtin.float_(Math.log(L));\n });\n\n mod.acosh = new Sk.builtin.func(function (x) {\n Sk.builtin.pyCheckArgs(\"acosh\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"x\", \"number\", Sk.builtin.checkNumber(x));\n\n x = Sk.builtin.asnum$(x);\n\n var L = x + Math.sqrt(x * x - 1);\n\n return new Sk.builtin.float_(Math.log(L));\n });\n\n mod.atanh = new Sk.builtin.func(function (x) {\n Sk.builtin.pyCheckArgs(\"atanh\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"x\", \"number\", Sk.builtin.checkNumber(x));\n\n x = Sk.builtin.asnum$(x);\n\n var L = (1 + x) / (1 - x);\n\n return new Sk.builtin.float_(Math.log(L) / 2);\n });\n\n mod.sinh = new Sk.builtin.func(function (x) {\n Sk.builtin.pyCheckArgs(\"sinh\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"x\", \"number\", Sk.builtin.checkNumber(x));\n\n x = Sk.builtin.asnum$(x);\n\n var e = Math.E;\n var p = Math.pow(e, x);\n var n = 1 / p;\n var result = (p - n) / 2;\n\n return new Sk.builtin.float_(result);\n });\n\n mod.cosh = new Sk.builtin.func(function (x) {\n Sk.builtin.pyCheckArgs(\"cosh\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"x\", \"number\", Sk.builtin.checkNumber(x));\n\n x = Sk.builtin.asnum$(x);\n\n var e = Math.E;\n var p = Math.pow(e, x);\n var n = 1 / p;\n var result = (p + n) / 2;\n\n return new Sk.builtin.float_(result);\n });\n\n mod.tanh = new Sk.builtin.func(function (x) {\n Sk.builtin.pyCheckArgs(\"tanh\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"x\", \"number\", Sk.builtin.checkNumber(x));\n\n x = Sk.builtin.asnum$(x);\n\n var e = Math.E;\n var p = Math.pow(e, x);\n var n = 1 / p;\n var result = ((p - n) / 2) / ((p + n) / 2);\n\n return new Sk.builtin.float_(result);\n });\n\n mod.ceil = new Sk.builtin.func(function (x) {\n Sk.builtin.pyCheckArgs(\"ceil\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"x\", \"number\", Sk.builtin.checkNumber(x));\n\n return new Sk.builtin.float_(Math.ceil(Sk.builtin.asnum$(x)));\n });\n\n // returns y with the sign of x\n mod.copysign = new Sk.builtin.func(function (x, y) {\n Sk.builtin.pyCheckArgs(\"ceil\", arguments, 2, 2);\n Sk.builtin.pyCheckType(\"x\", \"number\", Sk.builtin.checkNumber(x));\n Sk.builtin.pyCheckType(\"y\", \"number\", Sk.builtin.checkNumber(y));\n\n var _x = Sk.ffi.remapToJs(x);\n var _y = Sk.ffi.remapToJs(y);\n var res;\n\n var isNeg_x = _x < 0;\n var isNeg_y = _x < 0;\n\n // special case for floats with negative zero\n if(Sk.builtin.checkFloat(x)) {\n if(_x === 0) {\n isNeg_x = 1/_x === -Infinity ? true : false;\n }\n }\n\n if(Sk.builtin.checkFloat(y)) {\n if(_y === 0) {\n isNeg_y = 1/_y === -Infinity ? true : false;\n }\n }\n\n // if both signs are equal, just return _y\n if((isNeg_x && isNeg_y) || (!isNeg_x && !isNeg_y)) {\n res = _y;\n } else if((isNeg_x && !isNeg_y) || (!isNeg_x && isNeg_y)) {\n // if different, invert sign\n if(y === 0) {\n // special case for zero\n res = isNeg_x ? -0.0 : 0.0;\n } else {\n res = _y * -1;\n }\n }\n\n return new Sk.builtin.float_(res);\n });\n\n mod.floor = new Sk.builtin.func(function (x) {\n Sk.builtin.pyCheckArgs(\"floor\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"x\", \"number\", Sk.builtin.checkNumber(x));\n\n return new Sk.builtin.float_(Math.floor(Sk.builtin.asnum$(x)));\n });\n\n mod.sqrt = new Sk.builtin.func(function (x) {\n Sk.builtin.pyCheckArgs(\"sqrt\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"x\", \"number\", Sk.builtin.checkNumber(x));\n\n return new Sk.builtin.float_(Math.sqrt(Sk.builtin.asnum$(x)));\n });\n\n mod.trunc = new Sk.builtin.func(function (x) {\n Sk.builtin.pyCheckArgs(\"trunc\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"x\", \"number\", Sk.builtin.checkNumber(x));\n\n return new Sk.builtin.int_(Sk.builtin.asnum$(x) | 0);\n });\n\n mod.log = new Sk.builtin.func(function (x, base) {\n Sk.builtin.pyCheckArgs(\"log\", arguments, 1, 2);\n Sk.builtin.pyCheckType(\"x\", \"number\", Sk.builtin.checkNumber(x));\n\n if (base === undefined) {\n return new Sk.builtin.float_(Math.log(Sk.builtin.asnum$(x)));\n } else {\n Sk.builtin.pyCheckType(\"base\", \"number\", Sk.builtin.checkNumber(base));\n var ret = Math.log(Sk.builtin.asnum$(x)) / Math.log(Sk.builtin.asnum$(base));\n return new Sk.builtin.float_(ret);\n }\n });\n\n mod.log10 = new Sk.builtin.func(function (x) {\n Sk.builtin.pyCheckArgs(\"log10\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"x\", \"number\", Sk.builtin.checkNumber(x));\n\n var ret = Math.log(Sk.builtin.asnum$(x)) / Math.log(10);\n return new Sk.builtin.float_(ret);\n });\n\n /* Return True if x is infinite, and False otherwise. */\n mod.isinf = new Sk.builtin.func(function(x) {\n Sk.builtin.pyCheckArgs(\"isinf\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"x\", \"number\", Sk.builtin.checkNumber(x));\n\n var _x = Sk.builtin.asnum$(x);\n if(isFinite(_x) && !isNaN(_x)) {\n return Sk.builtin.bool.false$;\n } else {\n return Sk.builtin.bool.true$\n }\n });\n\n /* Return True if x is a NaN (not a number), and False otherwise. */\n mod.isnan = new Sk.builtin.func(function(x) {\n Sk.builtin.pyCheckArgs(\"isnan\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"x\", \"float\", Sk.builtin.checkFloat(x));\n\n var _x = Sk.builtin.asnum$(x);\n if(isNaN(_x)) {\n return Sk.builtin.bool.true$;\n } else {\n return Sk.builtin.bool.false$;\n }\n });\n\n mod.exp = new Sk.builtin.func(function (x) {\n Sk.builtin.pyCheckArgs(\"exp\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"x\", \"number\", Sk.builtin.checkNumber(x));\n\n return new Sk.builtin.float_(Math.exp(Sk.builtin.asnum$(x)));\n });\n\n mod.pow = new Sk.builtin.func(function (x, y) {\n Sk.builtin.pyCheckArgs(\"pow\", arguments, 2, 2);\n Sk.builtin.pyCheckType(\"x\", \"number\", Sk.builtin.checkNumber(x));\n Sk.builtin.pyCheckType(\"y\", \"number\", Sk.builtin.checkNumber(y));\n\n return new Sk.builtin.float_(Math.pow(Sk.builtin.asnum$(x), Sk.builtin.asnum$(y)));\n });\n\n mod.radians = new Sk.builtin.func(function (deg) {\n Sk.builtin.pyCheckArgs(\"radians\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"deg\", \"number\", Sk.builtin.checkNumber(deg));\n\n var ret = Math.PI / 180.0 * Sk.builtin.asnum$(deg);\n return new Sk.builtin.float_(ret);\n });\n\n mod.degrees = new Sk.builtin.func(function (rad) {\n Sk.builtin.pyCheckArgs(\"degrees\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"rad\", \"number\", Sk.builtin.checkNumber(rad));\n\n var ret = 180.0 / Math.PI * Sk.builtin.asnum$(rad);\n return new Sk.builtin.float_(ret);\n });\n\n mod.hypot = new Sk.builtin.func(function (x, y) {\n Sk.builtin.pyCheckArgs(\"hypot\", arguments, 2, 2);\n Sk.builtin.pyCheckType(\"x\", \"number\", Sk.builtin.checkNumber(x));\n Sk.builtin.pyCheckType(\"y\", \"number\", Sk.builtin.checkNumber(y));\n\n x = Sk.builtin.asnum$(x);\n y = Sk.builtin.asnum$(y);\n return new Sk.builtin.float_(Math.sqrt((x * x) + (y * y)));\n });\n\n mod.factorial = new Sk.builtin.func(function (x) {\n Sk.builtin.pyCheckArgs(\"factorial\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"x\", \"number\", Sk.builtin.checkNumber(x));\n\n x = Math.floor(Sk.builtin.asnum$(x));\n var r = 1;\n for (var i = 2; i <= x; i++) {\n r *= i;\n }\n return new Sk.builtin.int_(r);\n });\n\n return mod;\n}", "src/lib/BaseHTTPServer.py": "raise NotImplementedError(\"BaseHTTPServer is not yet implemented in Skulpt\")\n", "src/lib/cmd.py": "raise NotImplementedError(\"cmd is not yet implemented in Skulpt\")\n", "src/lib/filecmp.py": "raise NotImplementedError(\"filecmp is not yet implemented in Skulpt\")\n", "src/lib/operator.js": "/*\n * __author__: Isaac Dontje Lindell (i@isaacdontjelindell.com)\n *\n * Implementation of the Python operator module.\n */\n\nvar $builtinmodule = function (name) {\n var mod = {};\n\n mod.lt = new Sk.builtin.func(function (a, b) {\n return Sk.builtin.bool(Sk.misceval.richCompareBool(a, b, 'Lt'));\n });\n mod.__lt__ = mod.lt;\n\n mod.le = new Sk.builtin.func(function (a, b) {\n return Sk.builtin.bool(Sk.misceval.richCompareBool(a, b, 'LtE'));\n });\n mod.__le__ = mod.le;\n\n mod.eq = new Sk.builtin.func(function (a, b) {\n return Sk.builtin.bool(Sk.misceval.richCompareBool(a, b, 'Eq'));\n });\n mod.__eq__ = mod.eq;\n\n mod.ne = new Sk.builtin.func(function (a, b) {\n return Sk.builtin.bool(Sk.misceval.richCompareBool(a, b, 'NotEq'));\n });\n mod.__ne__ = mod.ne;\n\n mod.ge = new Sk.builtin.func(function (a, b) {\n return Sk.builtin.bool(Sk.misceval.richCompareBool(a, b, 'GtE'));\n });\n mod.__ge__ = mod.ge;\n\n mod.gt = new Sk.builtin.func(function (a, b) {\n return Sk.builtin.bool(Sk.misceval.richCompareBool(a, b, 'Gt'));\n });\n mod.__gt__ = mod.gt;\n\n mod.not_ = new Sk.builtin.func(function (obj) {\n throw new Sk.builtin.NotImplementedError(\"operator.not_() is not yet implemented in Skulpt\");\n });\n\n mod.truth = new Sk.builtin.func(function (obj) {\n return Sk.builtin.bool(obj);\n });\n\n mod.is_ = new Sk.builtin.func(function (a, b) {\n return Sk.builtin.bool(Sk.misceval.richCompareBool(a, b, 'Is'));\n });\n\n mod.is_not = new Sk.builtin.func(function (a, b) {\n return Sk.builtin.bool(Sk.misceval.richCompareBool(a, b, 'IsNot'));\n });\n\n mod.abs = new Sk.builtin.func(function (obj) {\n return Sk.misceval.callsim(Sk.builtin.abs, obj);\n });\n mod.__abs__ = mod.abs;\n\n // The documentation says that operator.add() is defined for a and b numbers, but\n // CPython (2.6) allows a and b to be other types (e.g. str)\n mod.add = new Sk.builtin.func(function (a, b) {\n return Sk.abstr.objectAdd(a, b);\n });\n mod.__add__ = mod.add;\n\n mod.and_ = new Sk.builtin.func(function (a, b) {\n return Sk.abstr.binary_op_(a, b, \"BitAnd\");\n });\n mod.__and__ = mod.and_;\n\n mod.div = new Sk.builtin.func(function (a, b) {\n return Sk.abstr.binary_op_(a, b, \"Div\");\n });\n mod.__div__ = mod.div;\n\n mod.floordiv = new Sk.builtin.func(function (a, b) {\n return Sk.abstr.binary_op_(a, b, \"FloorDiv\");\n });\n mod.__floordiv__ = mod.floordiv;\n\n mod.index = new Sk.builtin.func(function (a) {\n return new Sk.builtin.int_(Sk.misceval.asIndex(a));\n });\n mod.__index__ = mod.index;\n\n // Note: Sk.abstr.numberUnaryOp(obj, 'Invert') looks for the function nb$invert() on obj.\n // However, it doesn't look like that function has been implemented for any existing object types.\n // I've gone ahead and created this function for completeness' sake, but expect any use of it to\n // result in an error.\n mod.inv = new Sk.builtin.func(function (obj) {\n return Sk.abstr.numberUnaryOp(obj, 'Invert');\n });\n mod.__inv__ = mod.inv;\n mod.invert = mod.inv;\n mod.__invert__ = mod.inv;\n\n mod.lshift = new Sk.builtin.func(function (a, b) {\n return Sk.abstr.binary_op_(a, b, \"LShift\");\n });\n mod.__lshift__ = mod.lshift;\n\n mod.mod = new Sk.builtin.func(function (a, b) {\n return Sk.abstr.binary_op_(a, b, \"Mod\");\n });\n mod.__mod__ = mod.mod;\n\n mod.divmod = new Sk.builtin.func(function (a, b) {\n return Sk.abstr.binary_op_(a, b, \"DivMod\");\n });\n mod.__divmod__ = mod.divmod;\n\n mod.mul = new Sk.builtin.func(function (a, b) {\n return Sk.abstr.binary_op_(a, b, \"Mult\");\n });\n mod.__mul__ = mod.mul;\n\n mod.neg = new Sk.builtin.func(function (obj) {\n return Sk.abstr.objectNegative(obj);\n });\n mod.__neg__ = mod.neg;\n\n mod.or_ = new Sk.builtin.func(function (a, b) {\n return Sk.abstr.binary_op_(a, b, \"BitOr\");\n });\n mod.__or__ = mod.or_;\n\n mod.pos = new Sk.builtin.func(function (obj) {\n return Sk.abstr.objectPositive(obj);\n });\n mod.__pos__ = mod.pos;\n\n mod.pow = new Sk.builtin.func(function (a, b) {\n return Sk.abstr.binary_op_(a, b, \"Pow\");\n });\n mod.__pow__ = mod.pow;\n\n mod.rshift = new Sk.builtin.func(function (a, b) {\n return Sk.abstr.binary_op_(a, b, \"RShift\");\n });\n mod.__rshift__ = mod.rshift;\n\n mod.sub = new Sk.builtin.func(function (a, b) {\n return Sk.abstr.binary_op_(a, b, \"Sub\");\n });\n mod.__sub__ = mod.sub;\n\n mod.truediv = mod.div;\n mod.__truediv__ = mod.div;\n\n mod.xor = new Sk.builtin.func(function (a, b) {\n return Sk.abstr.binary_op_(a, b, \"BitXor\");\n });\n mod.__xor__ = mod.xor;\n\n mod.concat = new Sk.builtin.func(function (a, b) {\n return Sk.abstr.sequenceConcat(a, b);\n });\n mod.__concat__ = mod.concat;\n\n mod.contains = new Sk.builtin.func(function (a, b) {\n return Sk.builtin.bool(Sk.abstr.sequenceContains(a, b));\n });\n mod.__contains__ = mod.contains;\n\n mod.countOf = new Sk.builtin.func(function (a, b) {\n return Sk.abstr.sequenceGetCountOf(a, b);\n });\n\n mod.delitem = new Sk.builtin.func(function (a, b) {\n return Sk.abstr.sequenceDelItem(a, b);\n });\n mod.__delitem__ = mod.delitem;\n\n mod.getitem = new Sk.builtin.func(function (a, b) {\n return Sk.abstr.sequenceGetItem(a, b);\n });\n mod.__getitem__ = mod.getitem;\n\n mod.indexOf = new Sk.builtin.func(function (a, b) {\n return Sk.abstr.sequenceGetIndexOf(a, b);\n });\n\n mod.setitem = new Sk.builtin.func(function (a, b, c) {\n return Sk.abstr.sequenceSetItem(a, b, c);\n });\n mod.__setitem__ = mod.setitem;\n\n return mod;\n};\n", "src/lib/lib2to3/fixes/__init__.py": "raise NotImplementedError(\"fixes is not yet implemented in Skulpt\")\n", "src/builtin/sys.js": "var $builtinmodule = function (name) {\n var i;\n var sys = {};\n\n var args = [];\n var argv = Sk.getSysArgv();\n for (i = 0; i < argv.length; ++i) {\n args.push(new Sk.builtin.str(argv[i]));\n }\n sys.argv = new Sk.builtins[\"list\"](args);\n\n sys.copyright = Sk.builtin[\"str\"](\"Copyright 2009-2010 Scott Graham.\\nAll Rights Reserved.\\n\");\n\n sys.maxint = new Sk.builtin.int_(Math.pow(2,53)-1);\n\n /* The largest positive integer supported by the platform\u2019s Py_ssize_t type,\n * and thus the maximum size lists, strings, dicts, and many other containers can have.\n *\n * In skulpt this is the same as maxint, due to the underlying implementation in javascript\n */\n sys.maxsize = new Sk.builtin.int_(Math.pow(2,53)-1);\n\n sys.modules = Sk.sysmodules;\n\n sys.path = Sk.realsyspath;\n\n sys.getExecutionLimit = new Sk.builtin.func(function () {\n if (Sk.execLimit === null) {\n return Sk.builtin.none.none$;\n }\n return new Sk.builtin.int_(Sk.execLimit);\n });\n\n sys.setExecutionLimit = new Sk.builtin.func(function (t) {\n if (Sk.execLimit === null) {\n throw new Sk.builtin.NotImplementedError(\"Execution limiting is not enabled\");\n }\n if (t !== undefined) {\n Sk.execLimit = Sk.builtin.asnum$(t);\n }\n });\n\n sys.resetTimeout = new Sk.builtin.func(function () {\n Sk.execStart = new Date();\n });\n\n sys.getYieldLimit = new Sk.builtin.func(function () {\n if (Sk.yieldLimit === null) {\n return Sk.builtin.none.none$;\n }\n return new Sk.builtin.int_(Sk.yieldLimit);\n });\n\n sys.setYieldLimit = new Sk.builtin.func(function (t) {\n if (Sk.yieldLimit === null) {\n throw new Sk.builtin.NotImplementedError(\"Yielding is not enabled\");\n }\n if (t !== undefined) {\n Sk.yieldLimit = Sk.builtin.asnum$(t);\n }\n });\n\n sys.debug = new Sk.builtin.func(function () {\n return Sk.builtin.none.none$;\n });\n\n sys.__stdout__ = new Sk.builtin.file(new Sk.builtin.str(\"/dev/stdout\"), \"w\");\n sys.__stdin__ = new Sk.builtin.file(new Sk.builtin.str(\"/dev/stdin\"), \"r\");\n\n sys.stdout = sys.__stdout__;\n sys.stdin = sys.__stdin__;\n\n return sys;\n};\n", "src/lib/dummy_threading.py": "raise NotImplementedError(\"dummy_threading is not yet implemented in Skulpt\")\n", "src/lib/markupbase.py": "raise NotImplementedError(\"markupbase is not yet implemented in Skulpt\")\n", "src/lib/shelve.py": "raise NotImplementedError(\"shelve is not yet implemented in Skulpt\")\n", "src/lib/xmllib.py": "raise NotImplementedError(\"xmllib is not yet implemented in Skulpt\")\n", "src/lib/string.js": "/*\n * __author__: Isaac Dontje Lindell (i@isaacdontjelindell.com)\n *\n * Implementation of the Python string module.\n */\n\n\nvar $builtinmodule = function (name) {\n var mod = {};\n\n mod.ascii_lowercase = Sk.builtin.str('abcdefghijklmnopqrstuvwxyz');\n mod.ascii_uppercase = Sk.builtin.str('ABCDEFGHIJKLMNOPQRSTUVWXYZ');\n mod.ascii_letters = Sk.builtin.str(mod.ascii_lowercase.v + mod.ascii_uppercase.v);\n\n mod.lowercase = Sk.builtin.str('abcdefghijklmnopqrstuvwxyz');\n mod.uppercase = Sk.builtin.str('ABCDEFGHIJKLMNOPQRSTUVWXYZ');\n mod.letters = Sk.builtin.str(mod.lowercase.v + mod.uppercase.v);\n\n mod.digits = Sk.builtin.str('0123456789', Sk.builtin.str);\n mod.hexdigits = Sk.builtin.str('0123456789abcdefABCDEF');\n mod.octdigits = Sk.builtin.str('01234567');\n\n mod.punctuation = Sk.builtin.str('!\"#$%&\\'()*+,-./:;<=>?@[\\\\]^_`{|}~');\n mod.whitespace = Sk.builtin.str('\\t\\n\\x0b\\x0c\\r ');\n\n /* Note: The docs for string.printable say that it's the concatenation of string.digits,\n * string.letters, string.punctuation, and string.whitespace. The CPython interpreter\n * outputs the whitespace characters in one order when string.whitespace is used, and a\n * slightly different order when string.printable is used. I've elected to follow the\n * behavior of CPython here rather than the spec. */\n mod.printable = Sk.builtin.str(mod.digits.v + mod.letters.v + mod.punctuation.v + \" \\t\\n\\r\\x0b\\x0c\");\n\n\n mod.split = new Sk.builtin.func(function (s, sep, maxsplit) {\n return Sk.misceval.callsim(Sk.builtin.str.prototype['split'], s, sep, maxsplit);\n });\n\n /* Return a copy of word with only its first character capitalized. */\n mod.capitalize = new Sk.builtin.func(function (word) {\n return Sk.misceval.callsim(Sk.builtin.str.prototype['capitalize'], word);\n });\n\n /* Concatenate a list or tuple of words with intervening occurrences\n * of sep. The default value for sep is a single space character. */\n mod.join = new Sk.builtin.func(function (words, sep) {\n if (sep === undefined) {\n sep = Sk.builtin.str(' ');\n }\n return Sk.misceval.callsim(Sk.builtin.str.prototype['join'], sep, words);\n });\n\n\n /* Split the argument into words using split(), capitalize each word\n * using capitalize(), and join the capitalized words using join().\n * Note that this replaces runs of whitespace characters by a single\n * space, and removes leading and trailing whitespace. */\n mod.capwords = new Sk.builtin.func(function (s, sep) {\n Sk.builtin.pyCheckArgs('capwords', arguments, 1, 2);\n if (!Sk.builtin.checkString(s)) {\n throw new Sk.builtin.TypeError(\"s must be a string\");\n }\n if (sep === undefined) {\n sep = Sk.builtin.str(' ');\n }\n if (!Sk.builtin.checkString(sep)) {\n throw new Sk.builtin.TypeError(\"sep must be a string\");\n }\n\n var words = Sk.misceval.callsim(mod.split, s, sep);\n var capWords = [];\n for (var i = 0; i < words.v.length; i++) {\n var word = Sk.builtin.list.prototype['list_subscript_'].call(words, i);\n var cap = Sk.misceval.callsim(mod.capitalize, word);\n capWords.push(cap);\n }\n\n return Sk.misceval.callsim(mod.join, new Sk.builtin.list(capWords), sep);\n });\n\n\n return mod;\n};\n", "src/lib/ConfigParser.py": "raise NotImplementedError(\"ConfigParser is not yet implemented in Skulpt\")\n", "src/lib/pickle.py": "raise NotImplementedError(\"pickle is not yet implemented in Skulpt\")\n", "src/lib/processing.js": "/*\n Skulpt Processing\n\n Testing/debugging:\n\n ProcessingJS from Skulpt:\n Sk.misceval.callsim(Sk.globals.processing.$d.PShapeSVG, \n new Sk.builtin.str(\"string\"), \n new Sk.builtin.str(\"bot1.svg\"))\n\n ProcessingJS direct:\n p = Processing.instances[0]\n p.PShapeSVG(\"string\", \"bot1.svg\")\n*/\n\nvar $builtinmodule = function (name) {\n var imageClass;\n var colorClass;\n var screenClass;\n var environmentClass;\n var keyboardClass;\n var mouseClass;\n var vectorClass\n\n var mod = {};\n var imList = [];\n var looping = true;\n var instance = null;\n\n // We need this to store a reference to the actual processing object which is not created\n // until the run function is called. Even then the processing object is passed by the\n // processing-js sytem as a parameter to the sketchProc function. Why not set it to None here\n //\n\n // See: http://processingjs.org/reference/\n\n mod.processing = null;\n mod.p = null;\n\n mod.X = new Sk.builtin.int_(0);\n mod.Y = new Sk.builtin.int_(1);\n mod.Z = new Sk.builtin.int_(2);\n\n mod.R = new Sk.builtin.int_( 3);\n mod.G = new Sk.builtin.int_( 4);\n mod.B = new Sk.builtin.int_( 5);\n mod.A = new Sk.builtin.int_( 6);\n \n mod.U = new Sk.builtin.int_( 7);\n mod.V = new Sk.builtin.int_( 8);\n \n mod.NX = new Sk.builtin.int_( 9);\n mod.NY = new Sk.builtin.int_( 10);\n mod.NZ = new Sk.builtin.int_( 11);\n \n mod.EDGE = new Sk.builtin.int_( 12);\n \n // Stroke\n mod.SR = new Sk.builtin.int_( 13);\n mod.SG = new Sk.builtin.int_( 14);\n mod.SB = new Sk.builtin.int_( 15);\n mod.SA = new Sk.builtin.int_( 16);\n \n mod.SW = new Sk.builtin.int_( 17);\n \n // Transformations (2D and 3D)\n mod.TX = new Sk.builtin.int_( 18);\n mod.TY = new Sk.builtin.int_( 19);\n mod.TZ = new Sk.builtin.int_( 20);\n \n mod.VX = new Sk.builtin.int_( 21);\n mod.VY = new Sk.builtin.int_( 22);\n mod.VZ = new Sk.builtin.int_( 23);\n mod.VW = new Sk.builtin.int_( 24);\n \n // Material properties\n mod.AR = new Sk.builtin.int_( 25);\n mod.AG = new Sk.builtin.int_( 26);\n mod.AB = new Sk.builtin.int_( 27);\n \n mod.DR = new Sk.builtin.int_( 3);\n mod.DG = new Sk.builtin.int_( 4);\n mod.DB = new Sk.builtin.int_( 5);\n mod.DA = new Sk.builtin.int_( 6);\n \n mod.SPR = new Sk.builtin.int_( 28);\n mod.SPG = new Sk.builtin.int_( 29);\n mod.SPB = new Sk.builtin.int_( 30);\n \n mod.SHINE = new Sk.builtin.int_( 31);\n \n mod.ER = new Sk.builtin.int_( 32);\n mod.EG = new Sk.builtin.int_( 33);\n mod.EB = new Sk.builtin.int_( 34);\n \n mod.BEEN_LIT = new Sk.builtin.int_( 35);\n \n mod.VERTEX_FIELD_COUNT = new Sk.builtin.int_( 36);\n \n // Shape drawing modes\n mod.CENTER = new Sk.builtin.int_(3);\n mod.RADIUS = new Sk.builtin.int_(2);\n mod.CORNERS = new Sk.builtin.int_(1);\n mod.CORNER = new Sk.builtin.int_(0);\n mod.DIAMETER = new Sk.builtin.int_(3);\n \n // Text vertical alignment modes\n // Default vertical alignment for text placement\n mod.BASELINE = new Sk.builtin.int_( 0);\n // Align text to the top\n mod.TOP = new Sk.builtin.int_( 101);\n // Align text from the bottom, using the baseline\n mod.BOTTOM = new Sk.builtin.int_( 102);\n \n // UV Texture coordinate modes\n mod.NORMAL = new Sk.builtin.int_( 1);\n mod.NORMALIZED = new Sk.builtin.int_( 1);\n mod.IMAGE = new Sk.builtin.int_( 2);\n \n // Text placement modes\n mod.MODEL = new Sk.builtin.int_( 4);\n mod.SHAPE = new Sk.builtin.int_( 5);\n \n // Lighting modes\n mod.AMBIENT = new Sk.builtin.int_( 0);\n mod.DIRECTIONAL = new Sk.builtin.int_( 1);\n //POINT: 2, Shared with Shape constant\n mod.SPOT = new Sk.builtin.int_( 3);\n\n // Color modes\n mod.RGB = new Sk.builtin.int_(1);\n mod.ARGB = new Sk.builtin.int_(2);\n mod.HSB = new Sk.builtin.int_(3);\n mod.ALPHA = new Sk.builtin.int_(4);\n mod.CMYK = new Sk.builtin.int_(5);\n \n // Image file types\n mod.TIFF = new Sk.builtin.int_(0);\n mod.TARGA = new Sk.builtin.int_(1);\n mod.JPEG = new Sk.builtin.int_(2);\n mod.GIF = new Sk.builtin.int_(3);\n\n // Stroke modes\n mod.MITER = new Sk.builtin.str(\"miter\");\n mod.BEVEL = new Sk.builtin.str(\"bevel\");\n mod.ROUND = new Sk.builtin.str(\"round\");\n mod.SQUARE = new Sk.builtin.str(\"butt\");\n mod.PROJECT = new Sk.builtin.str(\"square\");\n\n // Renderer modes\n mod.P2D = new Sk.builtin.int_(1);\n mod.JAVA2D = new Sk.builtin.int_(1);\n mod.WEBGL = new Sk.builtin.int_(2);\n mod.P3D = new Sk.builtin.int_(2);\n mod.OPENGL = new Sk.builtin.int_(2);\n mod.PDF = new Sk.builtin.int_(0);\n mod.DXF = new Sk.builtin.int_(0);\n\n // Platform IDs\n mod.OTHER = new Sk.builtin.int_( 0);\n mod.WINDOWS = new Sk.builtin.int_( 1);\n mod.MAXOSX = new Sk.builtin.int_( 2);\n mod.LINUX = new Sk.builtin.int_( 3);\n \n mod.EPSILON = new Sk.builtin.float_( 0.0001);\n\n mod.MAX_FLOAT = new Sk.builtin.float_( 3.4028235e+38);\n mod.MIN_FLOAT = new Sk.builtin.float_( -3.4028235e+38);\n mod.MAX_INT = new Sk.builtin.int_( 2147483647);\n mod.MIN_INT = new Sk.builtin.int_( -2147483648);\n \n // Constants\n mod.HALF_PI = new Sk.builtin.float_(Math.PI / 2.0);\n mod.THIRD_PI = new Sk.builtin.float_(Math.PI / 3.0);\n mod.PI = new Sk.builtin.float_(Math.PI);\n mod.TWO_PI = new Sk.builtin.float_(Math.PI * 2.0);\n mod.TAU = new Sk.builtin.float_(Math.PI * 2.0);\n mod.QUARTER_PI = new Sk.builtin.float_(Math.PI / 4.0);\n\n mod.DEG_TO_RAD = new Sk.builtin.float_( Math.PI / 180);\n mod.RAD_TO_DEG = new Sk.builtin.float_( 180 / Math.PI);\n\n mod.WHITESPACE = Sk.builtin.str(\" \\t\\n\\r\\f\\u00A0\");\n // Shape modes\n mod.POINT = new Sk.builtin.int_(2);\n mod.POINTS = new Sk.builtin.int_(2);\n mod.LINE = new Sk.builtin.int_(4);\n mod.LINES = new Sk.builtin.int_(4);\n mod.TRIANGLE = new Sk.builtin.int_(8);\n mod.TRIANGLES = new Sk.builtin.int_(9);\n mod.TRIANGLE_FAN = new Sk.builtin.int_(11);\n mod.TRIANGLE_STRIP = new Sk.builtin.int_(10);\n mod.QUAD = new Sk.builtin.int_(16);\n mod.QUADS = new Sk.builtin.int_(16);\n mod.QUAD_STRIP = new Sk.builtin.int_(17);\n mod.POLYGON = new Sk.builtin.int_(20);\n\n mod.PATH = new Sk.builtin.int_(21);\n mod.RECT = new Sk.builtin.int_(30);\n mod.ELLIPSE = new Sk.builtin.int_(31);\n mod.ARC = new Sk.builtin.int_(32);\n mod.SPHERE = new Sk.builtin.int_(40);\n mod.BOX = new Sk.builtin.int_(41);\n\n mod.GROUP = new Sk.builtin.int_( 0);\n mod.PRIMITIVE = new Sk.builtin.int_( 1);\n //PATH: 21, // shared with Shape PATH\n mod.GEOMETRY = new Sk.builtin.int_( 3);\n \n // Shape Vertex\n mod.VERTEX = new Sk.builtin.int_( 0);\n mod.BEZIER_VERTEX = new Sk.builtin.int_( 1);\n mod.CURVE_VERTEX = new Sk.builtin.int_( 2);\n mod.BREAK = new Sk.builtin.int_( 3);\n mod.CLOSESHAPE = new Sk.builtin.int_( 4);\n \n // Blend modes\n mod.REPLACE = new Sk.builtin.int_(0);\n mod.BLEND = new Sk.builtin.int_(1 << 0);\n mod.ADD = new Sk.builtin.int_(1 << 1);\n mod.SUBTRACT = new Sk.builtin.int_(1 << 2);\n mod.LIGHTEST = new Sk.builtin.int_(1 << 3);\n mod.DARKEST = new Sk.builtin.int_(1 << 4);\n mod.DIFFERENCE = new Sk.builtin.int_(1 << 5);\n mod.EXCLUSION = new Sk.builtin.int_(1 << 6);\n mod.MULTIPLY = new Sk.builtin.int_(1 << 7);\n mod.SCREEN = new Sk.builtin.int_(1 << 8);\n mod.OVERLAY = new Sk.builtin.int_(1 << 9);\n mod.HARD_LIGHT = new Sk.builtin.int_(1 << 10);\n mod.SOFT_LIGHT = new Sk.builtin.int_(1 << 11);\n mod.DODGE = new Sk.builtin.int_(1 << 12);\n mod.BURN = new Sk.builtin.int_(1 << 13);\n\n // Color component bit masks\n mod.ALPHA_MASK = new Sk.builtin.int_( 0xff000000);\n mod.RED_MASK = new Sk.builtin.int_( 0x00ff0000);\n mod.GREEN_MASK = new Sk.builtin.int_( 0x0000ff00);\n mod.BLUE_MASK = new Sk.builtin.int_( 0x000000ff);\n \n // Projection matrices\n mod.CUSTOM = new Sk.builtin.int_( 0);\n mod.ORTHOGRAPHIC = new Sk.builtin.int_( 2);\n mod.PERSPECTIVE = new Sk.builtin.int_( 3);\n \n // Cursors\n mod.ARROW = new Sk.builtin.str(\"default\");\n mod.CROSS = new Sk.builtin.str(\"crosshair\");\n mod.HAND = new Sk.builtin.str(\"pointer\");\n mod.MOVE = new Sk.builtin.str(\"move\");\n mod.TEXT = new Sk.builtin.str(\"text\");\n mod.WAIT = new Sk.builtin.str(\"wait\");\n mod.NOCURSOR = Sk.builtin.assk$(\"url('data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='), auto\", Sk.builtin.nmber.str);\n\n // Hints\n mod.DISABLE_OPENGL_2X_SMOOTH = new Sk.builtin.int_(1);\n mod.ENABLE_OPENGL_2X_SMOOTH = new Sk.builtin.int_(-1);\n mod.ENABLE_OPENGL_4X_SMOOTH = new Sk.builtin.int_(2);\n mod.ENABLE_NATIVE_FONTS = new Sk.builtin.int_(3);\n mod.DISABLE_DEPTH_TEST = new Sk.builtin.int_(4);\n mod.ENABLE_DEPTH_TEST = new Sk.builtin.int_(-4);\n mod.ENABLE_DEPTH_SORT = new Sk.builtin.int_(5);\n mod.DISABLE_DEPTH_SORT = new Sk.builtin.int_(-5);\n mod.DISABLE_OPENGL_ERROR_REPORT = new Sk.builtin.int_(6);\n mod.ENABLE_OPENGL_ERROR_REPORT = new Sk.builtin.int_(-6);\n mod.ENABLE_ACCURATE_TEXTURES = new Sk.builtin.int_(7);\n mod.DISABLE_ACCURATE_TEXTURES = new Sk.builtin.int_(-7);\n mod.HINT_COUNT = new Sk.builtin.int_(10);\n\n // Shape closing modes\n mod.OPEN = new Sk.builtin.int_(1);\n mod.CLOSE = new Sk.builtin.int_(2);\n\n // Filter/convert types\n mod.BLUR = new Sk.builtin.int_(11);\n mod.GRAY = new Sk.builtin.int_(12);\n mod.INVERT = new Sk.builtin.int_(13);\n mod.OPAQUE = new Sk.builtin.int_(14);\n mod.POSTERIZE = new Sk.builtin.int_(15);\n mod.THRESHOLD = new Sk.builtin.int_(16);\n mod.ERODE = new Sk.builtin.int_(17);\n mod.DILATE = new Sk.builtin.int_(18);\n\n // Both key and keyCode will be equal to these values\n mod.BACKSPACE = new Sk.builtin.int_( 8);\n mod.TAB = new Sk.builtin.int_(9);\n mod.ENTER = new Sk.builtin.int_(10);\n mod.RETURN = new Sk.builtin.int_(13);\n mod.ESC = new Sk.builtin.int_(27);\n mod.DELETE = new Sk.builtin.int_(127);\n mod.CODED = new Sk.builtin.int_(0xffff);\n\n // p.key will be CODED and p.keyCode will be this value\n mod.SHIFT = new Sk.builtin.int_(16);\n mod.CONTROL = new Sk.builtin.int_(17);\n mod.ALT = new Sk.builtin.int_(18);\n mod.CAPSLK = new Sk.builtin.int_(20);\n mod.PGUP = new Sk.builtin.int_(33);\n mod.PGDN = new Sk.builtin.int_(34);\n mod.END = new Sk.builtin.int_(35);\n mod.HOME = new Sk.builtin.int_(36);\n mod.LEFT = new Sk.builtin.int_(37);\n mod.UP = new Sk.builtin.int_(38);\n mod.RIGHT = new Sk.builtin.int_(39);\n mod.DOWN = new Sk.builtin.int_(40);\n mod.F1 = new Sk.builtin.int_(112);\n mod.F2 = new Sk.builtin.int_(113);\n mod.F3 = new Sk.builtin.int_(114);\n mod.F4 = new Sk.builtin.int_(115);\n mod.F5 = new Sk.builtin.int_(116);\n mod.F6 = new Sk.builtin.int_(117);\n mod.F7 = new Sk.builtin.int_(118);\n mod.F8 = new Sk.builtin.int_(119);\n mod.F9 = new Sk.builtin.int_(120);\n mod.F10 = new Sk.builtin.int_(121);\n mod.F11 = new Sk.builtin.int_(122);\n mod.F12 = new Sk.builtin.int_(123);\n mod.NUMLK = new Sk.builtin.int_(144);\n mod.META = new Sk.builtin.int_(157);\n mod.INSERT = new Sk.builtin.int_(155);\n\n // PJS defined constants\n mod.SINCOS_LENGTH = new Sk.builtin.int_(720);\n mod.PRECISIONB = new Sk.builtin.int_(15);\n mod.PRECISIONF = new Sk.builtin.int_(1 << 15);\n mod.PREC_MAXVAL = new Sk.builtin.int_((1 << 15) - 1);\n mod.PREC_ALPHA_SHIFT = new Sk.builtin.int_(24 - 15);\n mod.PREC_RED_SHIFT = new Sk.builtin.int_(16 - 15);\n mod.NORMAL_MODE_AUTO = new Sk.builtin.int_(0);\n mod.NORMAL_MODE_SHAPE = new Sk.builtin.int_(1);\n mod.NORMAL_MODE_VERTEX = new Sk.builtin.int_(2);\n mod.MAX_LIGHTS = new Sk.builtin.int_(8);\n\n // 2D - Primitives\n mod.line = new Sk.builtin.func(function (x1, y1, x2, y2) {\n mod.processing.line(x1.v, y1.v, x2.v, y2.v);\n });\n\n mod.ellipse = new Sk.builtin.func(function (x, y, r1, r2) {\n mod.processing.ellipse(x.v, y.v, r1.v, r2.v);\n\n });\n\n mod.text = new Sk.builtin.func(function (theText, x, y) {\n mod.processing.text(theText.v, x.v, y.v);\n });\n\n mod.point = new Sk.builtin.func(function (x1, y1) {\n mod.processing.point(x1.v, y1.v);\n });\n\n mod.arc = new Sk.builtin.func(function (x, y, width, height, start, stop) {\n mod.processing.arc(x.v, y.v, width.v, height.v, start.v, stop.v);\n });\n\n mod.quad = new Sk.builtin.func(function (x1, y1, x2, y2, x3, y3, x4, y4) {\n mod.processing.quad(x1.v, y1.v, x2.v, y2.v, x3.v, y3.v, x4.v, y4.v);\n });\n\n mod.rect = new Sk.builtin.func(function (x, y, width, height, radius) {\n var rad;\n if (typeof(radius) === \"undefined\") {\n mod.processing.rect(x.v, y.v, width.v, height.v);\n } else {\n mod.processing.rect(x.v, y.v, width.v, height.v, radius.v);\n }\n });\n\n mod.triangle = new Sk.builtin.func(function (x1, y1, x2, y2, x3, y3) {\n mod.processing.triangle(x1.v, y1.v, x2.v, y2.v, x3.v, y3.v);\n });\n\n mod.bezier = new Sk.builtin.func(function (x1, y1, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {\n if (typeof(a7) === \"undefined\") {\n\t // bezier(x1, y1, cx1, cy1, cx2, cy2, x2, y2);\n mod.processing.bezier(x1.v, y1.v, a1.v, a2.v, a3.v, a4.v, a5.v, a6.v);\n\t} else {\n\t // bezier(x1, y1, z1, cx1, cy1, cz1, cx2, cy2, cz2, x2, y2, z2);\n mod.processing.bezier(x1.v, y1.v, a1.v, a2.v, a3.v, a4.v, a5.v, a6.v, a7.v, a8.v, a9.v, a10.v);\n\t}\n });\n\n mod.alpha = new Sk.builtin.func(function (r, g, b) {\n // r will be either:\n // a number in which case the fill will be grayscale\n // a color object\n // g, and b may be undefined. If they hold values it will\n // be assumed that we have an r,g,b color tuple\n if (typeof(g) === \"undefined\") {\n return new Sk.builtin.float_(mod.processing.alpha(r.v));\n } else if (typeof(b) === \"undefined\") {\n return new Sk.builtin.float_(mod.processing.alpha(r.v, g.v));\n } else {\n return new Sk.builtin.float_(mod.processing.alpha(r.v, g.v, b.v));\n\t}\n });\n\n mod.ambient = new Sk.builtin.func(function (r, g, b) {\n\t// ambient(gray)\n\t// ambient(red, green blue)\n // r will be either:\n // a number in which case the fill will be grayscale\n // a color object\n // g, and b may be undefined. If they hold values it will\n // be assumed that we have an r,g,b color tuple\n if (typeof(g) === \"undefined\") {\n mod.processing.ambient(r.v);\n } else if (typeof(b) === \"undefined\") {\n mod.processing.ambient(r.v, g.v);\n } else {\n mod.processing.ambient(r.v, g.v, b.v);\n\t}\n });\n\n mod.ambientLight = new Sk.builtin.func(function (v1, v2, v3, x, y, z) {\n\t// ambientLight(v1,v2,v3)\n\t// ambientLight(v1,v2,v3,x,y,z)\n if (typeof(x) === \"undefined\") {\n mod.processing.ambientLight(v1.v, v2.v, v3.v);\n } else if (typeof(y) === \"undefined\") {\n mod.processing.ambientLight(v1.v, v2.v, v3.v, x.v);\n } else if (typeof(z) === \"undefined\") {\n mod.processing.ambientLight(v1.v, v2.v, v3.v, x.v, y.v);\n } else {\n mod.processing.ambientLight(v1.v, v2.v, v3.v, x.v, y.v, z.v);\n\t}\n });\n\n mod.beginCamera = new Sk.builtin.func(function () {\n\tmod.processing.beginCamera();\n });\n\n mod.beginShape = new Sk.builtin.func(function (mode) {\n if (typeof(mode) === \"undefined\") {\n mode = mod.POLYGON;\n }\n mod.processing.beginShape(mode.v);\n });\n\n mod.bezierDetail = new Sk.builtin.func(function (resolution) {\n\t// Sets the resolution at which Beziers display. The default\n\t// value is 20. This function is only useful when using the\n\t// P3D or OPENGL renderer as the default (JAVA2D) renderer\n\t// does not use this information.\n if (typeof(resolution) !== \"undefined\") {\n resolution = resolution.v;\n } else {\n resolution = 20;\n\t}\n mod.processing.bezierDetail(resolution);\n });\n\n mod.bezierPoint = new Sk.builtin.func(function (a,b,c,d,t) {\n mod.processing.bezierPoint(a.v,b.v,c.v,d.v,t.v);\n });\n\n mod.bezierTangent = new Sk.builtin.func(function (a,b,c,d,t) {\n\tmod.processing.bezierTangent(a.v,b.v,c.v,d.v,t.v);\n });\n\n mod.bezierVertex = new Sk.builtin.func(function (v1, v2, v3, v4, v5, v6,\n\t\t\t\t\t\t v7, v8, v9) {\n\t// bezierVertex(cx1, cy1, cx2, cy2, x, y)\n\t// bezierVertex(cx1, cy1, cz1, cx2, cy2, cz2, x, y, z)\n if (typeof(v7) === \"undefined\") {\n\t mod.processing.bezierVertex(v1.v, v2.v, v3.v, v4.v, v5.v, v6.v);\n\t} else if (typeof(v8) === \"undefined\") {\n\t mod.processing.bezierVertex(v1.v, v2.v, v3.v, v4.v, v5.v, v6.v,\n\t\t\t\t\tv7.v);\n\t} else if (typeof(v9) === \"undefined\") {\n\t mod.processing.bezierVertex(v1.v, v2.v, v3.v, v4.v, v5.v, v6.v,\n\t\t\t\t\tv7.v, v8.v);\n\t} else {\n\t mod.processing.bezierVertex(v1.v, v2.v, v3.v, v4.v, v5.v, v6.v,\n\t\t\t\t\tv7.v, v8.v, v9.v);\n\t}\n });\n\n mod.blend = new Sk.builtin.func(function (v1, v2, v3, v4, v5,\n\t\t\t\t\t v6, v7, v8, v9, v10) {\n\tif (other instanceof Sk.builtin.int_ || other instanceof Sk.builtin.float_) {\n\t // blend(x, y,width,height,dx, dy,dwidth,dheight,MODE)\n\t mod.processing.blend(v1.v, v2.v, v3.v, v4.v, v5.v,\n\t\t\t\t v6.v, v7.v, v8.v, v9.v);\n\t} else {\n\t // blend(srcImg,x,y, width, height,dx,dy, dwidth, dheight,MODE)\n\t mod.processing.blend(v1.v, v2.v, v3.v, v4.v, v5.v,\n\t\t\t\t v6.v, v7.v, v8.v, v9.v, v10.v);\n\t}\n });\n\n mod.blendColor = new Sk.builtin.func(function (c1, c2, mode) {\n\t// blendColor(c1,c2,MODE)\n var c = Sk.misceval.callsim(mod.color,\n\t\t\t\t new Sk.builtin.int_(0),\n\t\t\t\t new Sk.builtin.int_(0),\n\t\t\t\t new Sk.builtin.int_(0));\n\tc.v = mod.processing.blendColor(c1.v, c2.v, mode.v);\n\treturn c;\n });\n\n mod.brightness = new Sk.builtin.func(function (r, g, b) {\n if (typeof(g) === \"undefined\") {\n\t return new Sk.builtin.float_(mod.processing.brightness(r.v));\n } else if (typeof(b) === \"undefined\") {\n\t return new Sk.builtin.float_(mod.processing.brightness(r.v, g.v));\n } else {\n\t return new Sk.builtin.float_(mod.processing.brightness(r.v, g.v, b.v));\n\t}\n });\n\n mod.camera = new Sk.builtin.func(function (eyeX, eyeY, eyeZ,\n\t\t\t\t\t centerX, centerY, centerZ,\n\t\t\t\t\t upX, upY, upZ) {\n\t// camera()\n\t// camera(eyeX, eyeY, eyeZ,centerX, centerY, centerZ,upX, upY, upZ)\n if (typeof(eyeX) === \"undefined\") {\n\t mod.processing.camera();\n\t} else {\n\t mod.processing.camera(eyeX.v, eyeY.v, eyeZ.v,\n\t\t\t\t centerX.v, centerY.v, centerZ.v,\n\t\t\t\t upX.v, upY.v, upZ.v);\n\t}\n });\n\n mod.constrain = new Sk.builtin.func(function (value, min, max) {\n\treturn new Sk.builtin.float_(mod.processing.constrain(value.v, min.v, max.v));\n });\n\n mod.copy = new Sk.builtin.func(function (v1, v2, v3, v4, v5,\n\t\t\t\t\t v6, v7, v8, v9) {\n\tif (other instanceof Sk.builtin.int_ || other instanceof Sk.builtin.float_) {\n\t // copy(x, y,width,height,dx, dy,dwidth,dheight)\n\t mod.processing.copy(v1.v, v2.v, v3.v, v4.v, v5.v,\n\t\t\t\tv6.v, v7.v, v8.v);\n\t} else {\n\t // copy(srcImg,x,y, width, height,dx,dy, dwidth, dheight)\n\t mod.processing.copy(v1.v, v2.v, v3.v, v4.v, v5.v,\n\t\t\t\tv6.v, v7.v, v8.v, v9.v);\n\t}\n });\n\n mod.createFont = new Sk.builtin.func(function (name, size, smooth, charset) {\n\t// createFont(name, size)\n\t// createFont(name, size, smooth)\n\t// createFont(name, size, smooth, charset)\n\tvar font = Sk.misceval.callsim(mod.PFont);\n if (typeof(smooth) === \"undefined\") {\n\t font.v = mod.processing.createFont(name.v, size.v);\n\t} else if (typeof(charset) === \"undefined\") {\n\t font.v = mod.processing.createFont(name.v, size.v, smooth.v);\n\t} else {\n\t font.v = mod.processing.createFont(name.v, size.v, smooth.v, charset.v);\n\t}\n\treturn font;\n });\n\n mod.createGraphics = new Sk.builtin.func(function (width, height, renderer, filename) {\n\t// createGraphics(width, height, renderer)\n\t// createGraphics(width, height, renderer, filename)\n\tvar graphics = Sk.misceval.callsim(mod.PGraphics);\n if (typeof(filename) === \"undefined\") {\n\t graphics.v = mod.processing.createGraphics(width.v, height.v, renderer.v);\n\t} else {\n\t graphics.v = mod.processing.createGraphics(width.v, height.v, renderer.v, filename.v);\n\t}\n\treturn graphics;\n });\n\n mod.createImage = new Sk.builtin.func(function (width, height, format) {\n\tvar image = Sk.misceval.callsim(mod.PImage);\n\timage.v = mod.processing.createImage(width.v, height.v, format.v);\n\treturn image;\n });\n\n mod.cursor = new Sk.builtin.func(function (v, x, y) {\n\t// cursor()\n\t// cursor(MODE)\n\t// cursor(image,x,y)\n if (typeof(v) === \"undefined\") {\n\t mod.processing.cursor();\n\t} else if (typeof(x) === \"undefined\") {\n\t mod.processing.cursor(v.v);\n\t} else if (typeof(y) === \"undefined\") {\n\t mod.processing.cursor(v.v, x.v);\n\t} else {\n\t mod.processing.cursor(v.v, x.v, y.v);\n\t}\n });\n\n mod.curve = new Sk.builtin.func(function (v1, v2, v3, v4,\n\t\t\t\t\t v5, v6, v7, v8,\n\t\t\t\t\t v9, v10, v11, v12) {\n\t// curve(x1, y1, x2, y2, x3, y3, x4, y4);\n\t// curve(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4);\n if (typeof(v9) === \"undefined\") {\n\t mod.processing.curve(v1.v, v2.v, v3.v, v4.v,\n\t\t\t\t v5.v, v6.v, v7.v, v8.v);\n\t} else if (typeof(v10) === \"undefined\") {\n\t mod.processing.curve(v1.v, v2.v, v3.v, v4.v,\n\t\t\t\t v5.v, v6.v, v7.v, v8.v,\n\t\t\t\t v9.v);\n\t} else if (typeof(v11) === \"undefined\") {\n\t mod.processing.curve(v1.v, v2.v, v3.v, v4.v,\n\t\t\t\t v5.v, v6.v, v7.v, v8.v,\n\t\t\t\t v9.v, v10.v);\n\t} else if (typeof(v12) === \"undefined\") {\n\t mod.processing.curve(v1.v, v2.v, v3.v, v4.v,\n\t\t\t\t v5.v, v6.v, v7.v, v8.v,\n\t\t\t\t v9.v, v10.v, v11.v);\n\t} else {\n\t mod.processing.curve(v1.v, v2.v, v3.v, v4.v,\n\t\t\t\t v5.v, v6.v, v7.v, v8.v,\n\t\t\t\t v9.v, v10.v, v11.v, v12.v);\n\t}\n });\n\n mod.curveDetail = new Sk.builtin.func(function (detail) {\n\t// curveDetail(detail)\n\tmod.processing.curveDetail(detail.v);\n });\n\n mod.curvePoint = new Sk.builtin.func(function (a,b,c,d,t) {\n\t// curvePoint(a,b,c,d,t)\n\tmod.processing.curvePoint(a.v,b.v,c.v,d.v,t.v);\n });\n\n mod.curveTangent = new Sk.builtin.func(function (a,b,c,d,t) {\n\t// curveTangent(a,b,c,d,t)\n\tmod.processing.curveTangent(a.v,b.v,c.v,d.v,t.v);\n });\n\n mod.curveTightness = new Sk.builtin.func(function (squishy) {\n\t// curveTightness(squishy)\n\tmod.processing.curveTightness(squishy.v);\n });\n\n mod.curveVertex = new Sk.builtin.func(function (x, y, z) {\n\t// curveVertex(x, y) \n\t// curveVertex(x, y, z)\n if (typeof(z) === \"undefined\") {\n\t mod.processing.curveVertex(x.v, y.v);\n\t} else {\n\t mod.processing.curveVertex(x.v, y.v, z.v);\n\t}\n });\n\n mod.day = new Sk.builtin.func(function () {\n\treturn new Sk.builtin.int_(mod.processing.day());\n });\n\n mod.degrees = new Sk.builtin.func(function (angle) {\n\t// degrees(angle)\n\treturn new Sk.builtin.float_(mod.processing.degrees(angle.v));\n });\n\n mod.directionalLight = new Sk.builtin.func(function (v1,v2,v3,nx,ny,nz) {\n\t// directionalLight(v1,v2,v3,nx,ny,nz)\n\tmod.processing.directionalLight(v1.v,v2.v,v3.v,nx.v,ny.v,nz.v);\n });\n\n mod.dist = new Sk.builtin.func(function (x1, y1, z1, x2, y2, z2) {\n\t// dist(x1, y1, x2, y2)\n\t// dist(x1, y1, z1, x2, y2, z2)\n if (typeof(y2) === \"undefined\") {\n\t return new Sk.builtin.float_(mod.processing.dist(x1.v, y1.v, z1.v, x2.v));\n\t} else if (typeof(z2) === \"undefined\") {\n\t return new Sk.builtin.float_(mod.processing.dist(x1.v, y1.v, z1.v, x2.v, y2.v));\n\t} else {\n\t return new Sk.builtin.float_(mod.processing.dist(x1.v, y1.v, z1.v, x2.v, y2.v, z2.v));\n\t}\n });\n\n mod.emissive = new Sk.builtin.func(function (v1, v2, v3) {\n\t// emissive(gray)\n\t// emissive(color)\n\t// emissive(v1,v2,v3)\n if (typeof(v2) === \"undefined\") {\n\t mod.processing.emissive(v1.v);\n\t} else if (typeof(v3) === \"undefined\") {\n\t mod.processing.emissive(v1.v, v2.v);\n\t} else {\n\t mod.processing.emissive(v1.v, v2.v, v3.v);\n\t}\n });\n\n mod.endCamera = new Sk.builtin.func(function () {\n\t// endCamera()\n\tmod.processing.endCamera();\n });\n\n mod.endShape = new Sk.builtin.func(function (mode) {\n\t// endShape()\n\t// endShape(MODE)\n if (typeof(mode) === \"undefined\") {\n\t mod.processing.endShape();\n\t} else {\n\t mod.processing.endShape(mode.v);\n\t}\n });\n\n mod.filter = new Sk.builtin.func(function (mode, srcImg) {\n\t// filter(MODE)\n\t// filter(MODE, srcImg)\n if (typeof(srcImg) === \"undefined\") {\n\t mod.processing.filter(mode.v);\n\t} else {\n\t mod.processing.filter(mode.v, srcImg.v);\n\t}\n });\n\n mod.frustum = new Sk.builtin.func(function (left, right, bottom, top, near, far) {\n\t// frustum(left, right, bottom,top, near, far)\n\tmod.processing.frustum(left, right, bottom, top, near, far);\n });\n\n mod.hint = new Sk.builtin.func(function (item) {\n\t// hint(item)\n\tmod.processing.hint(item);\n });\n\n mod.hour = new Sk.builtin.func(function () {\n\treturn new Sk.builtin.int_(mod.processing.hour());\n });\n\n mod.hue = new Sk.builtin.func(function (color) {\n\t// hue(color)\n\treturn new Sk.builtin.float_(mod.processing.hue(color.v));\n });\n\n mod.imageMode = new Sk.builtin.func(function (mode) {\n\tmod.processing.imageMode(mode.v);\n });\n\n mod.lerp = new Sk.builtin.func(function (value1, value2, amt) {\n\t// lerp(value1, value2, amt)\n\t// returns float\n\treturn new Sk.builtin.float_(mod.processing.lerp(value1.v, value2.v, amt.v));\n });\n\n mod.lerpColor = new Sk.builtin.func(function (c1, c2, amt) {\n\t// lerpColor(c1, c2, amt)\n\t// returns color\n var c = Sk.misceval.callsim(mod.color,\n\t\t\t\t new Sk.builtin.int_(0),\n\t\t\t\t new Sk.builtin.int_(0),\n\t\t\t\t new Sk.builtin.int_(0));\n\tc.v = mod.processing.lerpColor(c1.v, c2.v, amt.v);\n\treturn c;\n });\n\n mod.lightFalloff = new Sk.builtin.func(function (constant, linear, quadratic) {\n\t// lightFalloff(constant,linear,quadratic)\n\tmod.processing.lightFalloff(constant.v, linear.v, quadratic.v);\n });\n\n mod.lights = new Sk.builtin.func(function () {\n\tmod.processing.lights();\n });\n\n mod.lightSpecular = new Sk.builtin.func(function (v1, v2, v3) {\n\t// lightSpecular(v1,v2,v3)\n\tmod.processing.lightSpecular(v1.v, v2.v, v3.v);\n });\n\n mod.loadBytes = new Sk.builtin.func(function (filename) {\n\t// loadBytes(filename)\n\t// returns byte[]\n\treturn new Sk.builtin.list(mod.processing.loadBytes(filename.v));\n });\n\n mod.loadFont = new Sk.builtin.func(function (fontname) {\n\t// loadFont(fontname)\n\t// returns font\n\tvar font = Sk.misceval.callsim(mod.PFont);\n\tfont.v = mod.processing.loadFont(fontname.v);\n\treturn font;\n });\n\n mod.loadShape = new Sk.builtin.func(function (filename) {\n\t// loadShape(filename)\n\t// returns shape\n\tvar shape = Sk.misceval.callsim(mod.PShapeSVG, \n\t\t\t\t\tnew Sk.builtin.str(\"string\"),\n\t\t\t\t\tfilename);\n\treturn shape;\n });\n\n mod.loadStrings = new Sk.builtin.func(function (filename) {\n\t// loadStrings(filename)\n\t// returns string []\n\treturn new Sk.builtin.list(mod.processing.loadStrings(filename.v));\n });\n\n mod.mag = new Sk.builtin.func(function (a, b, c) {\n\t// mag(a,b)\n\t// mag(a,b,c)\n\t// returns magnitude as float\n if (typeof(c) === \"undefined\") {\n\t return new Sk.builtin.float_(mod.processing.mag(a.v, b.v));\n } else {\n\t return new Sk.builtin.float_(mod.processing.mag(a.v, b.v, c.v));\n\t}\n });\n\n mod.map = new Sk.builtin.func(function (value,low1,high1,low2,high2) {\n\t// map(value,low1,high1,low2,high2)\n\t// returns float\n\treturn new Sk.builtin.float_(mod.processing.map(value.v,low1.v,high1.v,\n\t\t\t\t\t\t low2.v,high2.v));\n });\n\n mod.millis = new Sk.builtin.func(function () {\n\treturn new Sk.builtin.int_(mod.processing.millis());\n });\n\n mod.minute = new Sk.builtin.func(function () {\n\treturn new Sk.builtin.int_(mod.processing.minute());\n });\n\n mod.modelX = new Sk.builtin.func(function (x, y, z) {\n\t// modelX(x,y,z)\n\t// returns float\n\treturn new Sk.builtin.float_(mod.processing.modelX(x.v, y.v, z.v));\n });\n\n mod.modelY = new Sk.builtin.func(function (x, y, z) {\n\t// modelY(x,y,z)\n\t// returns float\n\treturn new Sk.builtin.float_(mod.processing.modelY(x.v, y.v, z.v));\n });\n\n mod.modelZ = new Sk.builtin.func(function (x, y, z) {\n\t// modelZ(x,y,z)\n\t// returns float\n\treturn new Sk.builtin.float_(mod.processing.modelZ(x.v, y.v, z.v));\n });\n\n mod.month = new Sk.builtin.func(function () {\n\treturn new Sk.builtin.int_(mod.processing.month());\n });\n\n mod.noCursor = new Sk.builtin.func(function () {\n\tmod.processing.noCursor();\n });\n\n mod.noise = new Sk.builtin.func(function (x, y, z) {\n\t// noise(x)\n\t// noise(x, y)\n\t// noise(x, y, z)\n\t// returns float\n if (typeof(y) === \"undefined\") {\n\t return new Sk.builtin.float_(mod.processing.noise(x.v));\n } else if (typeof(z) === \"undefined\") {\n\t return new Sk.builtin.float_(mod.processing.noise(x.v, y.v));\n } else {\n\t return new Sk.builtin.float_(mod.processing.noise(x.v, y.v, z.v));\n\t}\n });\n\n mod.noiseDetail = new Sk.builtin.func(function (octaves, falloff) {\n\t// noiseDetail(octaves);\n\t// noiseDetail(octaves,falloff);\n\tmod.processing.noiseDetail(octaves.v, falloff.v);\n });\n\n mod.noiseSeed = new Sk.builtin.func(function (value) {\n\t// noiseSeed(value); int\n\t// returns float\n\treturn new Sk.builtin.float_(mod.processing.noiseSeed(value.v));\n });\n\n mod.noLights = new Sk.builtin.func(function () {\n\tmod.processing.noLights();\n });\n\n mod.norm = new Sk.builtin.func(function (value, low, high) {\n\t// norm(value, low, high)\n\t// returns float\n\treturn new Sk.builtin.float_(mod.processing.norm(value.v, low.v, high.v));\n });\n\n mod.normal = new Sk.builtin.func(function (nx, ny, nz) {\n\t// normal(nx,ny,nz)\n\t// returns None\n\tmod.processing.normal(nx.v, ny.v, nz.v);\n });\n\n mod.noTint = new Sk.builtin.func(function () {\n\tmod.processing.noTint();\n });\n\n mod.ortho = new Sk.builtin.func(function (left, right, bottom, top, near, far) {\n\t// ortho(left, right, bottom,top, near,far)\n\t// returns None\n\tmod.processing.ortho(left.v, right.v, bottom.v, top.v, near.v, far.v);\n });\n\n mod.perspective = new Sk.builtin.func(function (fov, aspect, zNear, zFar) {\n\t// perspective()\n\t// perspective(fov, aspect, zNear, zFar)\n\t// returns None\n if (typeof(fov) === \"undefined\") {\n\t mod.processing.perspective();\n } else if (typeof(aspect) === \"undefined\") {\n\t mod.processing.perspective(fov.v);\n } else if (typeof(zNear) === \"undefined\") {\n\t mod.processing.perspective(fov.v, aspect.v);\n } else if (typeof(zFar) === \"undefined\") {\n\t mod.processing.perspective(fov.v, aspect.v, zNear.v);\n } else {\n\t mod.processing.perspective(fov.v, aspect.v, zNear.v, zFar.v);\n\t}\n });\n\n mod.pointLight = new Sk.builtin.func(function (v1,v2,v3,nx,ny,nz) {\n\t// pointLight(v1,v2,v3,nx,ny,nz)\n\t// returns None\n\tmod.processing.pointLight(v1.v,v2.v,v3.v,nx.v,ny.v,nz.v);\n });\n\n mod.printCamera = new Sk.builtin.func(function () {\n\t// printCamera()\n\t// returns None\n\tmod.processing.printCamera();\n });\n\n mod.println = new Sk.builtin.func(function (data) {\n\t// println(data)\n\tmod.processing.println(data.v);\n });\n\n mod.printProjection = new Sk.builtin.func(function () {\n\t// printProjection()\n\t// returns None\n\tmod.processing.printProjection();\n });\n\n mod.radians = new Sk.builtin.func(function (angle) {\n\t// radians(angle)\n\t// returns int or float\n\treturn new Sk.builtin.float_(mod.processing.radians(angle.v));\n });\n\n mod.randomSeed = new Sk.builtin.func(function (value) {\n\t// noiseSeed(value);\n\t// returns float\n\treturn new Sk.builtin.float_(mod.processing.randomSeed(value.v));\n });\n\n mod.random = new Sk.builtin.func(function (v1, v2) {\n\t// random();\n\t// random(high);\n\t// random(low, high);\n\t// returns float\n if (typeof(v1) === \"undefined\") {\n\t return new Sk.builtin.float_(mod.processing.random());\n } else if (typeof(v2) === \"undefined\") {\n\t return new Sk.builtin.float_(mod.processing.random(v1.v));\n } else {\n\t return new Sk.builtin.float_(mod.processing.random(v1.v, v2.v));\n\t}\n });\n\n mod.requestImage = new Sk.builtin.func(function (filename, extension) {\n\t// requestImage(filename)\n\t// requestImage(filename, extension)\n\tvar image = Sk.misceval.callsim(mod.PImage);\n if (typeof(extension) === \"undefined\") {\n\t image.v = mod.processing.requestImage(filename.v);\n } else {\n\t image.v = mod.processing.requestImage(filename.v, extension.v);\n\t}\n\treturn image;\n });\n\n mod.saturation = new Sk.builtin.func(function (color) {\n\t// saturation(color)\n\t// returns float\n\treturn new Sk.builtin.float_(mod.processing.saturation(color.v));\n });\n\n mod.save = new Sk.builtin.func(function (filename) {\n\t// save(filename)\n\t// returns None\n\tmod.processing.save(filename.v);\n });\n\n mod.saveFrame = new Sk.builtin.func(function (filename) {\n\t// saveFrame()\n\t// saveFrame(filename-####.ext)\n\t// returns None\n if (typeof(filename) === \"undefined\") {\n\t mod.processing.saveFrame();\n } else {\n\t mod.processing.saveFrame(filename.v);\n\t}\n });\n\n mod.saveStrings = new Sk.builtin.func(function (filename, strings) {\n\t// saveStrings(filename,strings)\n\tmod.processing.saveStrings(filename.v, strings.v);\n });\n\n mod.screenX = new Sk.builtin.func(function (x, y, z) {\n\t// screenX(x,y,z)\n\t// returns float\n\treturn new Sk.builtin.float_(mod.processing.screenX(x.v, y.v, z.v));\n });\n\n mod.screenY = new Sk.builtin.func(function (x, y, z) {\n\t// screenY(x,y,z)\n\t// returns float\n\treturn new Sk.builtin.float_(mod.processing.screenY(x.v, y.v, z.v));\n });\n\n mod.screenZ = new Sk.builtin.func(function (x, y, z) {\n\t// screenZ(x,y,z)\n\t// returns float\n\treturn new Sk.builtin.float_(mod.processing.screenZ(x.v, y.v, z.v));\n });\n\n mod.second = new Sk.builtin.func(function () {\n\treturn new Sk.builtin.int_(mod.processing.second());\n });\n\n mod.shape = new Sk.builtin.func(function (sh, x, y, width, height) {\n\t// shape(sh)\n\t// shape(sh,x,y)\n\t// shape(sh,x,y,width,height)\n\t// returns?\n if (typeof(x) === \"undefined\") {\n\t mod.processing.shape(sh.v);\n } else if (typeof(y) === \"undefined\") {\n\t mod.processing.shape(sh.v,x.v);\n } else if (typeof(width) === \"undefined\") {\n\t mod.processing.shape(sh.v,x.v,y.v);\n } else if (typeof(height) === \"undefined\") {\n\t mod.processing.shape(sh.v,x.v,y.v,width.v);\n } else {\n\t mod.processing.shape(sh.v,x.v,y.v,width.v,height.v);\n\t}\n });\n\n mod.shapeMode = new Sk.builtin.func(function (mode) {\n\t// shapeMode(MODE)\n\tmod.processing.shapeMode(mode.v);\n });\n\n mod.shininess = new Sk.builtin.func(function (shine) {\n\t// shininess(shine)\n\t// returns None\n\tmod.processing.shininess(shine.v);\n });\n\n mod.specular = new Sk.builtin.func(function (v1,v2,v3) {\n\t// specular(gray)\n\t// specular(color)\n\t// specular(v1,v2,v3)\n if (typeof(v2) === \"undefined\") {\n\t mod.processing.specular(v1.v);\n } else if (typeof(v3) === \"undefined\") {\n\t mod.processing.specular(v1.v,v2.v);\n } else {\n\t mod.processing.specular(v1.v,v2.v,v3.v);\n\t}\n });\n\n mod.spotLight = new Sk.builtin.func(function (v1,v2,v3,nx,ny,nz,angle,concentration) {\n\t// spotLight(v1,v2,v3,nx,ny,nz,angle,concentration)\n\t// returns None\n\tmod.processing.spotLight(v1.v,v2.v,v3.v,nx.v,ny.v,nz.v,angle.v,concentration.v);\n });\n\n mod.sq = new Sk.builtin.func(function (value) {\n\t// sq(value)\n\t// returns squared number\n\treturn new Sk.builtin.float_(mod.processing.sq(value));\n });\n\n mod.status = new Sk.builtin.func(function (text) {\n\t// status(text)\n\tmod.processing.status(text.v);\n });\n\n mod.textAlign = new Sk.builtin.func(function (align, yalign) {\n\t// textAlign(ALIGN)\n\t// textAlign(ALIGN, YALIGN)\n\t// returns None\n if (typeof(yalign) === \"undefined\") {\n\t mod.processing.textAlign(align.v);\n } else {\n\t mod.processing.textAlign(align.v, yalign.v);\n\t}\n });\n\n mod.textAscent = new Sk.builtin.func(function () {\n\t// returns float\n\treturn new Sk.builtin.float_(mod.processing.textAscent());\n });\n\n mod.textDescent = new Sk.builtin.func(function () {\n\t// returns float\n\treturn new Sk.builtin.float_(mod.processing.textDescent());\n });\n\n mod.textFont = new Sk.builtin.func(function (font, size) {\n\t// textFont(font)\n\t// textFont(font, size)\n if (typeof(size) === \"undefined\") {\n\t mod.processing.textFont(font.v);\n } else {\n\t mod.processing.textFont(font.v, size.v);\n\t}\n });\n\n mod.textLeading = new Sk.builtin.func(function (dist) {\n\t// textLeading(dist)\n\t// returns None\n\tmod.processing.textLeading(dist.v);\n });\n\n mod.textMode = new Sk.builtin.func(function (mode) {\n\t// textMode(MODE)\n\t// returns None\n\tmod.processing.textMode(mode.v);\n });\n\n mod.textSize = new Sk.builtin.func(function (size) {\n\t// textSize(size)\n\t// returns None\n\tmod.processing.textSize(size.v);\n });\n\n mod.texture = new Sk.builtin.func(function (img) {\n\t// texture(img)\n\t// returns None\n\tmod.processing.texture(img.v);\n });\n\n mod.textureMode = new Sk.builtin.func(function (mode) {\n\t// textureMode(MODE)\n\t// returns None\n\tmod.processing.textureMode(mode.v);\n });\n\n mod.textWidth = new Sk.builtin.func(function (data) {\n\t// textWidth(data)\n\t// returns float\n\treturn new Sk.builtin.float_(mod.processing.textWidth(data.v));\n });\n\n mod.tint = new Sk.builtin.func(function (v1, v2, v3, v4) {\n\t// tint(gray)\n\t// tint(gray, alpha)\n\t// tint(value1, value2, value3)\n\t// tint(value1, value2, value3, alpha)\n\t// tint(color)\n\t// tint(color, alpha)\n\t// tint(hex)\n\t// tint(hex, alpha)\n if (typeof(v2) === \"undefined\") {\n\t mod.processing.tint(v1.v);\n } else if (typeof(v3) === \"undefined\") {\n\t mod.processing.tint(v1.v, v2.v);\n } else if (typeof(v4) === \"undefined\") {\n\t mod.processing.tint(v1.v, v2.v, v3.v);\n } else {\n\t mod.processing.tint(v1.v, v2.v, v3.v, v4.v);\n\t}\n });\n\n mod.updatePixels = new Sk.builtin.func(function () {\n\t// updatePixels()\n\tmod.processing.updatePixels();\n });\n\n mod.vertex = new Sk.builtin.func(function (x, y, z, u, v) {\n\t// vertex(x, y); \n\t// vertex(x, y, z); \n\t// vertex(x, y, u, v); \n\t// vertex(x, y, z, u, v);\n if (typeof(z) === \"undefined\") {\n\t mod.processing.vertex(x.v, y.v);\n } else if (typeof(u) === \"undefined\") {\n\t mod.processing.vertex(x.v, y.v, z.v);\n } else if (typeof(v) === \"undefined\") {\n\t mod.processing.vertex(x.v, y.v, z.v, u.v);\n } else {\n\t mod.processing.vertex(x.v, y.v, z.v, u.v, v.v);\n\t}\n });\n\n mod.year = new Sk.builtin.func(function () {\n\treturn new Sk.builtin.int_(mod.processing.year());\n });\n\n // 3D Primitives\n\n mod.box = new Sk.builtin.func(function(size) {\n mod.processing.box(size.v);\n });\n\n mod.sphere = new Sk.builtin.func(function(radius) {\n mod.processing.sphere(radius.v);\n });\n\n mod.sphereDetail = new Sk.builtin.func(function(res,vres) {\n if (typeof(vres) === \"undefined\") {\n mod.processing.sphereDetail(res.v);\n }\n else {\n mod.processing.sphereDetail(res.v, vres.v);\n }\n });\n\n // Color\n mod.background = new Sk.builtin.func(function (r, g, b) {\n\n if (typeof(g) !== \"undefined\") {\n g = g.v;\n }\n if (typeof(b) !== \"undefined\") {\n b = b.v;\n }\n\n mod.processing.background(r.v, g, b);\n\n });\n\n mod.fill = new Sk.builtin.func(function (r, g, b, alpha) {\n // r will be either:\n // a number in which case the fill will be grayscale\n // a color object\n // g, and b may be undefined. If they hold values it will\n // be assumed that we have an r,g,b color tuple\n // alpha may also be undefined - if defined, it is the opacity of the fill\n if (typeof(g) !== \"undefined\") {\n g = g.v;\n }\n if (typeof(b) !== \"undefined\") {\n b = b.v;\n }\n if (typeof(alpha) !== \"undefined\") {\n alpha = alpha.v;\n }\n\n mod.processing.fill(r.v, g, b, alpha);\n\n });\n\n\n mod.stroke = new Sk.builtin.func(function (r, g, b) {\n\n if (typeof(g) !== \"undefined\") {\n g = g.v;\n }\n if (typeof(b) !== \"undefined\") {\n b = b.v;\n }\n\n mod.processing.stroke(r.v, g, b);\n\n });\n\n mod.noStroke = new Sk.builtin.func(function () {\n mod.processing.noStroke();\n });\n\n\n mod.colorMode = new Sk.builtin.func(function (mode, maxV, maxG, maxB, maxAlpha) {\n // mode is one of RGB or HSB\n // maxV is either the max value for all color elements\n // or the range for Red/Hue (depending on mode) if maxG and maxB are defined\n if (typeof(maxV) === \"undefined\") {\n maxV = 255;\n }\n else {\n maxV = maxV.v;\n }\n if (typeof(maxG) !== \"undefined\") {\n maxG = maxG.v;\n }\n if (typeof(maxB) !== \"undefined\") {\n maxB = maxB.v;\n }\n if (typeof(maxAlpha) !== \"undefined\") {\n maxAlpha = maxAlpha.v;\n }\n\n mod.processing.colorMode(mode.v, maxV, maxG, maxB, maxAlpha);\n });\n\n mod.noFill = new Sk.builtin.func(function () {\n mod.processing.noFill();\n });\n\n\n // Environment\n\n mod.loop = new Sk.builtin.func(function () {\n if (mod.processing === null) {\n throw new Sk.builtin.Exception(\"loop() should be called after run()\");\n }\n looping = true;\n mod.processing.loop();\n });\n\n mod.noLoop = new Sk.builtin.func(function () {\n if (mod.processing === null) {\n throw new Sk.builtin.Exception(\"noLoop() should be called after run()\");\n }\n looping = false;\n mod.processing.noLoop();\n });\n\n // NOTE: difference with ProcessingJS\n // frameRate is only a function, not a variable: \n // use environment.frameRate for value\n mod.frameRate = new Sk.builtin.func(function (fr) {\n mod.processing.frameRate(fr.v);\n });\n\n // NOTE: difference with ProcessingJS\n // Use mouse.pressed rather than mousePressed\n\n // NOTE: difference with ProcessingJS\n // Use environment.keyPressed rather than keyPressed\n\n // NOTE: difference with ProcessingJS\n // Use environment.frameCount \n\n // NOTE: difference with ProcessingJS\n // Use environment.frameCount\n \n // NOTE: difference with ProcessingJS\n // Use environment.online\n\n // NOTE: difference with ProcessingJS\n // Use environment.focused\n\n mod.width = new Sk.builtin.int_(100);\n mod.height = new Sk.builtin.int_(100);\n\n mod.size = new Sk.builtin.func(function (w, h, mode) {\n if (typeof(mode) === \"undefined\") {\n mode = mod.P2D;\n }\n mod.processing.size(w.v, h.v, mode.v);\n\tmod.width = new Sk.builtin.int_(mod.processing.width);\n\tmod.height = new Sk.builtin.int_(mod.processing.height);\n });\n\n mod.exitp = new Sk.builtin.func(function (h, w) {\n mod.processing.exit();\n });\n\n // NOTE: difference with ProcessingJS\n // Use mouseX() or mouse.x rather than mouseX\n mod.mouseX = new Sk.builtin.func(function () {\n return new Sk.builtin.int_(mod.processing.mouseX);\n });\n\n // NOTE: difference with ProcessingJS\n // Use mouseY() or mouse.y rather than mouseY\n mod.mouseY = new Sk.builtin.func(function () {\n return new Sk.builtin.int_(mod.processing.mouseY);\n });\n\n // NOTE: difference with ProcessingJS\n // Use pmouseX() or mouse.px rather than pmouseX\n mod.pmouseX = new Sk.builtin.func(function () {\n return new Sk.builtin.int_(mod.processing.pmouseX);\n });\n\n // NOTE: difference with ProcessingJS\n // Use pmouseY() or mouse.py rather than pmouseY\n mod.pmouseY = new Sk.builtin.func(function () {\n return new Sk.builtin.int_(mod.processing.pmouseY);\n });\n\n // Attributes\n mod.rectMode = new Sk.builtin.func(function (mode) {\n mod.processing.rectMode(mode.v);\n });\n\n mod.strokeWeight = new Sk.builtin.func(function (wt) {\n mod.processing.strokeWeight(wt.v);\n\n });\n\n mod.smooth = new Sk.builtin.func(function () {\n mod.processing.smooth();\n });\n\n mod.noSmooth = new Sk.builtin.func(function () {\n mod.processing.noSmooth();\n });\n\n mod.ellipseMode = new Sk.builtin.func(function (mode) {\n mod.processing.ellipseMode(mode.v);\n });\n\n mod.strokeCap = new Sk.builtin.func(function (mode) {\n mod.processing.strokeCap(mode.v);\n });\n\n mod.strokeJoin = new Sk.builtin.func(function (mode) {\n mod.processing.strokeJoin(mode.v);\n });\n\n\n // Transforms\n mod.rotate = new Sk.builtin.func(function (rads) {\n // rotation in radians\n mod.processing.rotate(rads.v);\n });\n\n mod.rotateX = new Sk.builtin.func(function(rads) {\n mod.processing.rotateX(rads.v);\n });\n\n mod.rotateY = new Sk.builtin.func(function(rads) {\n mod.processing.rotateY(rads.v);\n });\n\n mod.rotateZ = new Sk.builtin.func(function(rads) {\n mod.processing.rotateZ(rads.v);\n });\n\n mod.scale = new Sk.builtin.func(function (sx, sy, sz) {\n if (typeof(sy) === \"undefined\") {\n sy = 1.0;\n } else {\n sy = sy.v;\n }\n if (typeof(sz) === \"undefined\") {\n sz = 1.0;\n } else {\n sz = sz.v;\n }\n mod.processing.scale(sx.v, sy, sz);\n });\n\n mod.translate = new Sk.builtin.func(function (sx, sy, sz) {\n if (typeof(sy) === \"undefined\") {\n sy = 1.0;\n } else {\n sy = sy.v;\n }\n if (typeof(sz) === \"undefined\") {\n sz = 1.0;\n } else {\n sz = sz.v;\n }\n mod.processing.translate(sx.v, sy, sz);\n });\n\n mod.popMatrix = new Sk.builtin.func(function() {\n mod.processing.popMatrix();\n });\n\n mod.pushMatrix = new Sk.builtin.func(function() {\n mod.processing.pushMatrix();\n });\n\n mod.applyMatrix = new Sk.builtin.func(function() {\n var args = Array.prototype.slice.call(arguments, 0, 16),\n i;\n\n for (i = 0; i < args.length; i++) {\n args[i] = typeof(args[i]) === \"undefined\" ? 0.0 : args[i].v;\n }\n\n mod.processing.applyMatrix.apply(mod.processing, args);\n });\n\n mod.resetMatrix = new Sk.builtin.func(function() {\n mod.processing.resetMatrix();\n });\n\n mod.printMatrix = new Sk.builtin.func(function() {\n return Sk.ffi.remapToPy(mod.processing.printMatrix());\n });\n\n // //////////////////////////////////////////////////////////////////////\n // Run\n // \n // Create the processing context and setup of calls to setup, draw etc.\n //\n //\n // ////////////////////////////////////////////////////////////////////// \n mod.run = new Sk.builtin.func(function () {\n function sketchProc (processing) {\n mod.processing = processing;\n\n // processing.setup = function() {\n // if Sk.globals[\"setup\"]\n // Sk.misceval.callsim(Sk.globals[\"setup\"])\n // }\n\n\n // FIXME if no Sk.globals[\"draw\"], then no need for this\n processing.draw = function () {\n // if there are pending image loads then just use the natural looping calls to \n // retry until all the images are loaded. If noLoop was called in setup then make\n // sure to revert to that after all the images in hand.\n var wait = false;\n for (var i in imList) {\n if (imList[i].width === 0) {\n wait = true;\n }\n }\n if (wait === true) {\n if (looping === true) {\n return;\n }\n else {\n processing.loop();\n return;\n }\n\n } else {\n if (looping === false) {\n processing.noLoop();\n }\n }\n\n mod.frameCount = processing.frameCount;\n if (Sk.globals[\"draw\"]) {\n \ttry {\n \t Sk.misceval.callsim(Sk.globals[\"draw\"]);\n }\n catch(e) {\n Sk.uncaughtException(e);\n }\n\t\t\t\t}\n };\n\n var callBacks = [\"setup\", \"mouseMoved\", \"mouseClicked\", \"mouseDragged\", \"mouseMoved\", \"mouseOut\",\n \"mouseOver\", \"mousePressed\", \"mouseReleased\", \"keyPressed\", \"keyReleased\", \"keyTyped\"\n ];\n for (var cb in callBacks) {\n if (Sk.globals[callBacks[cb]]) {\n processing[callBacks[cb]] = new Function(\"try {Sk.misceval.callsim(Sk.globals['\" + callBacks[cb] + \"']);} catch(e) {Sk.uncaughtException(e);}\");\n }\n }\n }\n\n var canvas = document.getElementById(Sk.canvas);\n if (canvas.tagName !== \"CANVAS\") {\n var mydiv = canvas;\n canvas = document.createElement('canvas');\n while (mydiv.firstChild) {\n mydiv.removeChild(mydiv.firstChild);\n }\n mydiv.appendChild(canvas);\n }\n window.$(canvas).show();\n window.Processing.logger = { log : function(message) {\n Sk.misceval.print_(message);\n }};\n // if a Processing instance already exists it's likely still running, stop it by exiting\n instance = window.Processing.getInstanceById(Sk.canvas);\n if (instance) {\n instance.exit();\n }\n mod.p = new window.Processing(canvas, sketchProc);\n\n\n });\n\n mouseClass = function ($gbl, $loc) {\n\n $loc.__getattr__ = new Sk.builtin.func(function (self, key) {\n\t key = Sk.ffi.remapToJs(key);\n if (key === \"x\") {\n return Sk.builtin.assk$(mod.processing.mouseX);\n }\n else if (key === \"y\") {\n return Sk.builtin.assk$(mod.processing.mouseY);\n }\n else if (key === \"px\") {\n return Sk.builtin.assk$(mod.processing.pmouseX);\n }\n else if (key === \"py\") {\n return Sk.builtin.assk$(mod.processing.pmouseY);\n }\n else if (key === \"pressed\") {\n return new Sk.builtin.bool(mod.processing.__mousePressed);\n }\n else if (key === \"button\") {\n return Sk.builtin.assk$(mod.processing.mouseButton);\n }\n });\n\n };\n\n\n mod.Mouse = Sk.misceval.buildClass(mod, mouseClass, \"Mouse\", []);\n\n mod.mouse = Sk.misceval.callsim(mod.Mouse);\n\n keyboardClass = function ($gbl, $loc) {\n\n $loc.__getattr__ = new Sk.builtin.func(function (self, key) {\n\t key = Sk.ffi.remapToJs(key);\n if (key === \"key\") {\n return new Sk.builtin.str(mod.processing.key.toString());\n }\n else if (key === \"keyCode\") {\n return Sk.builtin.assk$(mod.processing.keyCode);\n }\n else if (key === \"keyPressed\") {\n return new Sk.builtin.str(mod.processing.keyPressed);\n } // todo bool\n });\n\n };\n\n mod.Keyboard = Sk.misceval.buildClass(mod, keyboardClass, \"Keyboard\", []);\n\n mod.keyboard = Sk.misceval.callsim(mod.Keyboard);\n\n\n environmentClass = function ($gbl, $loc) {\n\n $loc.__getattr__ = new Sk.builtin.func(function (self, key) {\n\t key = Sk.ffi.remapToJs(key);\n if (key === \"frameCount\") {\n return Sk.builtin.assk$(mod.processing.frameCount);\n }\n else if (key === \"frameRate\") {\n return Sk.builtin.assk$(mod.processing.frameRate);\n }\n else if (key === \"height\") {\n return Sk.builtin.assk$(mod.processing.height);\n }\n else if (key === \"width\") {\n return Sk.builtin.assk$(mod.processing.width);\n }\n else if (key === \"online\") {\n return new Sk.builtin.bool(mod.processing.online);\n }\n else if (key === \"focused\") {\n return new Sk.builtin.bool(mod.processing.focused);\n }\n });\n\n };\n\n mod.Environment = Sk.misceval.buildClass(mod, environmentClass, \"Environment\", []);\n\n mod.environment = Sk.misceval.callsim(mod.Environment);\n\n screenClass = function ($gbl, $loc) {\n\n $loc.__init__ = new Sk.builtin.func(function (self) {\n self.pixels = null;\n });\n\n $loc.__getattr__ = new Sk.builtin.func(function (self, key) {\n\t key = Sk.ffi.remapToJs(key);\n if (key === \"height\") {\n return Sk.builtin.assk$(mod.processing.height);\n }\n else if (key === \"width\") {\n return Sk.builtin.assk$(mod.processing.width);\n }\n else if (key === \"pixels\") {\n if (self.pixels == null) {\n self.pixels = new Sk.builtin.list(mod.processing.pixels.toArray());\n }\n }\n return self.pixels;\n });\n\n };\n\n mod.Screen = Sk.misceval.buildClass(mod, screenClass, \"Screen\", []);\n\n mod.screen = Sk.misceval.callsim(mod.Screen);\n\n mod.loadPixels = new Sk.builtin.func(function () {\n mod.processing.loadPixels();\n });\n\n\n colorClass = function ($gbl, $loc) {\n /* images are loaded async.. so its best to preload them */\n $loc.__init__ = new Sk.builtin.func(function (self, val1, val2, val3, alpha) {\n if (typeof(val2) !== \"undefined\") {\n val2 = val2.v;\n }\n if (typeof(val3) !== \"undefined\") {\n val3 = val3.v;\n }\n if (typeof(alpha) !== \"undefined\") {\n alpha = alpha.v;\n }\n self.v = mod.processing.color(val1.v, val2, val3, alpha);\n });\n\n };\n\n mod.color = Sk.misceval.buildClass(mod, colorClass, \"color\", []);\n\n mod.red = new Sk.builtin.func(function (clr) {\n return new Sk.builtin.int_(mod.processing.red(clr.v));\n });\n\n mod.green = new Sk.builtin.func(function (clr) {\n return new Sk.builtin.int_(mod.processing.green(clr.v));\n });\n\n mod.blue = new Sk.builtin.func(function (clr) {\n return new Sk.builtin.int_(mod.processing.blue(clr.v));\n });\n\n // Image class and functions\n //\n imageClass = function ($gbl, $loc) {\n /* images are loaded async.. so its best to preload them */\n $loc.__init__ = new Sk.builtin.func(function (self, arg1, arg2, arg3) {\n\t // PImage()\n\t // PImage(img)\n\t // PImage(width,height)\n\t // PImage(width,height,format)\n\t if (typeof(arg1) === \"undefined\") {\n\t\tself.v = new mod.processing.PImage();\n\t } else if (typeof(arg2) === \"undefined\") {\n\t\tself.v = new mod.processing.PImage(arg1.v);\n\t } else if (typeof(arg3) === \"undefined\") {\n\t\tself.v = new mod.processing.PImage(arg1.v, arg2.v);\n\t } else {\n\t\tself.v = new mod.processing.PImage(arg1.v, arg2.v, arg3.v);\n\t }\n });\n\n $loc.__getattr__ = new Sk.builtin.func(function (self, key) {\n\t key = Sk.ffi.remapToJs(key);\n if (key === \"width\") {\n return Sk.builtin.assk$(self.v.width);\n }\n if (key === \"height\") {\n return Sk.builtin.assk$(self.v.height);\n }\n });\n\n };\n\n mod.loadImage = new Sk.builtin.func(function (imfile) {\n var i = mod.processing.loadImage(imfile.v);\n imList.push(i);\n\tvar image = Sk.misceval.callsim(mod.PImage);\n\timage.v = i;\n return image;\n });\n\n mod.image = new Sk.builtin.func(function (im, x, y, w, h) {\n\t// image(img, x, y)\n\t// image(img, x, y, width, height)\n\tif (typeof(w) === \"undefined\") {\n mod.processing.image(im.v, x.v, y.v);\n\t} else {\n mod.processing.image(im.v, x.v, y.v, w.v, h.v);\n }\n });\n\n mod.get = new Sk.builtin.func(function (x, y) {\n var clr = mod.processing.get(x.v, y.v);\n return Sk.misceval.callsim(mod.color,\n new Sk.builtin.int_(mod.processing.red(clr)),\n new Sk.builtin.int_(mod.processing.green(clr)),\n new Sk.builtin.int_(mod.processing.blue(clr)));\n });\n\n mod.set = new Sk.builtin.func(function (x, y, color) {\n mod.processing.set(x.v, y.v, color.v);\n });\n\n // --- classes\n\n vectorClass = function ($gbl, $loc) {\n $loc.__init__ = new Sk.builtin.func(function (self, x, y, z) {\n\t // PVector()\n\t // PVector(x,y)\n\t // PVector(x,y,z)\n if (typeof(x) === \"undefined\") {\n\t\tself.v = new mod.processing.PVector();\n } else if (typeof(z) === \"undefined\") {\n\t\tself.v = new mod.processing.PVector(x.v, y.v);\n } else {\n\t\tself.v = new mod.processing.PVector(x.v, y.v, z.v);\n\t }\n });\n\n $loc.__getattr__ = new Sk.builtin.func(function (self, key) {\n\t key = Sk.ffi.remapToJs(key);\n if (key === \"x\") {\n return Sk.builtin.assk$(self.v.x);\n } else if (key === \"y\") {\n return Sk.builtin.assk$(self.v.y);\n } else if (key === \"z\") {\n return Sk.builtin.assk$(self.v.z);\n\t }\n\t});\n\t \n $loc.get = new Sk.builtin.func(function (self) {\n\t // get() Gets a copy of the vector\n var new_vec = Sk.misceval.callsim(mod.PVector);\n\t new_vec.v = self.v.get();\n\t return new_vec;\n\t});\n\t\n\t$loc.set = new Sk.builtin.func(function (self, x, y, x) {\n\t // set() Sets the x, y, z component of the vector\n\t if (typeof(z) === \"undefined\") {\n\t\tself.v.set(x.v, y.v);\n\t } else {\n\t\tself.v.set(x.v, y.v, z.v);\n\t }\n\t});\n\n\t$loc.mag = new Sk.builtin.func(function (self) {\n\t // mag() Calculates the magnitude (length) of the vector\n\t // and returns the result as a float\n\t return Sk.builtin.assk$(self.v.mag());\n\t});\n\n\t$loc.add = new Sk.builtin.func(function (self, vec) {\n\t // add()\tAdds one vector to another\n var new_vec = Sk.misceval.callsim(mod.PVector);\n\t new_vec.v = self.v.add(vec.v);\n\t return new_vec;\n\t});\n\n\t$loc.sub = new Sk.builtin.func(function (self, vec) {\n\t // sub()\tSubtracts one vector from another\n var new_vec = Sk.misceval.callsim(mod.PVector);\n\t new_vec.v = self.v.sub(vec.v);\n\t return new_vec;\n\t});\n\n\t$loc.mult = new Sk.builtin.func(function (self, vec) {\n\t // mult()\tMultiplies the vector by a scalar\n var new_vec = Sk.misceval.callsim(mod.PVector);\n\t new_vec.v = self.v.mult(vec.v);\n\t return new_vec;\n\t});\n\n\t$loc.div = new Sk.builtin.func(function (self, vec) {\n\t // div()\tDivides the vector by a scalar\n var new_vec = Sk.misceval.callsim(mod.PVector);\n\t new_vec.v = self.v.dic(vec.v);\n\t return new_vec;\n\t});\n\n\t$loc.dist = new Sk.builtin.func(function (self, vec) {\n\t // dist()\tCalculate the Euclidean distance between two points\n\t return Sk.builtin.assk$(self.v.dist(vec.v));\n\t});\n\n\t$loc.dot = new Sk.builtin.func(function (self, v1, v2, v3) {\n\t // dot()\tCalculates the dot product\n\t // returns float\n\t // vec.dot(x,y,z)\n\t // vec.dot(v)\t \n\t if (typeof(v2) === 'undefined') {\n\t\treturn Sk.builtin.assk$(self.v.dot(v1.v));\n\t } else {\n\t\treturn Sk.builtin.assk$(self.v.dot(v1.v, v2.v, v3.v));\n\t }\n\t});\n\n\t$loc.cross = new Sk.builtin.func(function (self, vec) {\n\t // cross()\tCalculates the cross product\n var new_vec = Sk.misceval.callsim(mod.PVector);\n\t new_vec.v = self.v.cross(vec.v);\n\t return new_vec;\n\t});\n\n\t$loc.normalize = new Sk.builtin.func(function (self) {\n\t // normalize()\tNormalizes the vector\n\t self.v.normalize();\n\t});\n\n\t$loc.limit = new Sk.builtin.func(function (self, value) {\n\t // limit()\tLimits the magnitude of the vector\n\t self.v.limit(value.v);\n\t});\n\n\t$loc.angleBetween = new Sk.builtin.func(function (self, vec) {\n\t // angleBetween()\tCalculates the angle between two vectors\n\t return Sk.builtin.assk$(self.v.angleBetween(vec.v));\n\t});\n\n\t$loc.array = new Sk.builtin.func(function (self) {\n\t // array()\t\n\t return new Sk.builtin.list(self.v.array());\n\t});\n };\n\n fontClass = function ($gbl, $loc) {\n $loc.__init__ = new Sk.builtin.func(function (self, input) {\n\t // PFont()\n\t // PFont(input)\n if (typeof(input) === \"undefined\") {\n\t\tself.v = new mod.processing.PFont();\n } else {\n\t\tself.v = new mod.processing.PVector(input.v);\n\t }\n });\n\n $loc.list = new Sk.builtin.func(function (self) {\n\t // font.list()\n\t return new Sk.builtin.list(self.v.list());\n\t});\n };\n\n graphicsClass = function ($gbl, $loc) {\n $loc.__init__ = new Sk.builtin.func(function (self, x, y, z) {\n\t // PGraphics()\n\t // PGraphics(width,height)\n\t // PGraphics(width,height,applet)\n if (typeof(x) === \"undefined\") {\n\t\tself.v = new mod.processing.PVector();\n } else if (typeof(z) === \"undefined\") {\n\t\tself.v = new mod.processing.PVector(x.v, y.v);\n } else {\n\t\tself.v = new mod.processing.PVector(x.v, y.v, z.v);\n\t }\n });\n\n $loc.beginDraw = new Sk.builtin.func(function (self) {\n\t self.v.beginDraw();\n\t});\n\n $loc.endDraw = new Sk.builtin.func(function (self) {\n\t self.v.endDraw();\n\t});\n };\n \n shapeClass = function ($gbl, $loc) {\n $loc.__init__ = new Sk.builtin.func(function (self, arg1, arg2, arg3) {\n\t if (typeof(arg1) === \"undefined\") {\n\t\t// special version for Skulpt\n\t\tself.v = null;\n\t\t// Will fill in manually in getChild()\n\t } else if (typeof(arg2) === \"undefined\") {\n\t\tself.v = new mod.processing.PShapeSVG(arg1.v);\n\t } else if (typeof(arg3) === \"undefined\") {\n\t\tself.v = new mod.processing.PShapeSVG(arg1.v, arg2.v);\n\t } else {\n\t\tself.v = new mod.processing.PShapeSVG(arg1.v, arg2.v, arg3.v);\n\t }\n });\n\n $loc.__getattr__ = new Sk.builtin.func(function (self, key) {\n\t key = Sk.ffi.remapToJs(key);\n if (key === \"width\") {\n return Sk.builtin.assk$(self.v.width);\n } else if (key === \"height\") {\n return Sk.builtin.assk$(self.v.height);\n\t }\n\t});\n\n $loc.isVisible = new Sk.builtin.func(function (self) {\n\t // isVisible() Returns a boolean value \"true\" if the image is set to be visible, \"false\" if not\n\t return new Sk.builtin.bool(self.v.isVisible());\n\t});\n\n $loc.setVisible = new Sk.builtin.func(function (self, value) {\n\t // setVisible() Sets the shape to be visible or invisible\n\t self.v.setVisible(value.v);\n\t});\n\n $loc.disableStyle = new Sk.builtin.func(function (self) {\n\t // disableStyle() Disables the shape's style data and uses Processing styles\n\t self.v.disableStyle();\n\t});\n\n $loc.enableStyle = new Sk.builtin.func(function (self) {\n\t // enableStyle() Enables the shape's style data and ignores the Processing styles\n\t self.v.enableStyle();\n\t});\n\n $loc.getChild = new Sk.builtin.func(function (self, shape) {\n\t // getChild() Returns a child element of a shape as a PShapeSVG object\n\t var child = self.v.getChild(shape.v);\n\t if (child != null) {\n\t\t// special method for Skulpt:\n\t\tvar new_shape = Sk.misceval.callsim(mod.PShapeSVG);\n\t\t// Now fill in value:\n\t\tnew_shape.v = child;\n\t\treturn new_shape;\n\t } else {\n\t\treturn null;\n\t }\n\t});\n\n $loc.translate = new Sk.builtin.func(function (self, x, y, z) {\n\t // translate() Displaces the shape\n\t // sh.translate(x,y)\n\t // sh.translate(x,y,z)\n if (typeof(z) === \"undefined\") {\n\t\tself.v.translate(x.v, y.v);\n\t } else {\n\t\tself.v.translate(x.v, y.v, z.v);\n\t }\n\t});\n\n $loc.rotate = new Sk.builtin.func(function (self, angle) {\n\t // rotate() Rotates the shape\n\t self.v.rotate(angle.v);\n\t});\n\n $loc.rotateX = new Sk.builtin.func(function (self, angle) {\n\t // rotateX() Rotates the shape around the x-axis\n\t self.v.rotateX(angle.v);\n\t});\n\n $loc.rotateY = new Sk.builtin.func(function (self) {\n\t // rotateY() Rotates the shape around the y-axis\n\t self.v.rotateY(angle.v);\n\t});\n\n $loc.rotateZ = new Sk.builtin.func(function (self) {\n\t // rotateZ() Rotates the shape around the z-axis\n\t self.v.rotateZ(angle.v);\n\t});\n\n $loc.scale = new Sk.builtin.func(function (self, x, y, z) {\n\t // scale() Increases and decreases the size of a shape\n\t // sh.scale(size)\n\t // sh.scale(x,y)\n\t // sh.scale(x,y,z)\n if (typeof(y) === \"undefined\") {\n\t\tself.v.scale(x.v);\n\t } else if (typeof(z) === \"undefined\") {\n\t\tself.v.scale(x.v, y.v);\n\t } else {\n\t\tself.v.scale(x.v, y.v, z.v);\n\t }\n\t});\n };\n\n mod.PFont = Sk.misceval.buildClass(mod, fontClass, \"PFont\", []);\n mod.PGraphics = Sk.misceval.buildClass(mod, graphicsClass, \"PGraphics\", []);\n mod.PShapeSVG = Sk.misceval.buildClass(mod, shapeClass, \"PShapeSVG\", []);\n mod.PVector = Sk.misceval.buildClass(mod, vectorClass, \"PVector\", []);\n mod.PImage = Sk.misceval.buildClass(mod, imageClass, \"PImage\", []);\n\n return mod;\n};\n", "src/lib/code.py": "raise NotImplementedError(\"code is not yet implemented in Skulpt\")\n", "src/lib/UserDict.py": "raise NotImplementedError(\"UserDict is not yet implemented in Skulpt\")\n", "src/lib/codecs.py": "raise NotImplementedError(\"codecs is not yet implemented in Skulpt\")\n", "src/lib/tty.py": "raise NotImplementedError(\"tty is not yet implemented in Skulpt\")\n", "src/lib/pythonds/graphs/adjGraph.py": "#\n# adjGraph\n#\n# Created by Brad Miller on 2005-02-24.\n# Copyright (c) 2005 Brad Miller, David Ranum, Luther College. All rights reserved.\n#\n\nimport sys\nimport os\nimport unittest\n\nclass Graph:\n def __init__(self):\n self.vertices = {}\n self.numVertices = 0\n \n def addVertex(self,key):\n self.numVertices = self.numVertices + 1\n newVertex = Vertex(key)\n self.vertices[key] = newVertex\n return newVertex\n \n def getVertex(self,n):\n if n in self.vertices:\n return self.vertices[n]\n else:\n return None\n\n def __contains__(self,n):\n return n in self.vertices\n \n def addEdge(self,f,t,cost=0):\n if f not in self.vertices:\n nv = self.addVertex(f)\n if t not in self.vertices:\n nv = self.addVertex(t)\n self.vertices[f].addNeighbor(self.vertices[t],cost)\n \n def getVertices(self):\n return list(self.vertices.keys())\n \n def __iter__(self):\n return iter(self.vertices.values())\n \nclass Vertex:\n def __init__(self,num):\n self.id = num\n self.connectedTo = {}\n self.color = 'white'\n self.dist = sys.maxsize\n self.pred = None\n self.disc = 0\n self.fin = 0\n\n # def __lt__(self,o):\n # return self.id < o.id\n \n def addNeighbor(self,nbr,weight=0):\n self.connectedTo[nbr] = weight\n \n def setColor(self,color):\n self.color = color\n \n def setDistance(self,d):\n self.dist = d\n\n def setPred(self,p):\n self.pred = p\n\n def setDiscovery(self,dtime):\n self.disc = dtime\n \n def setFinish(self,ftime):\n self.fin = ftime\n \n def getFinish(self):\n return self.fin\n \n def getDiscovery(self):\n return self.disc\n \n def getPred(self):\n return self.pred\n \n def getDistance(self):\n return self.dist\n \n def getColor(self):\n return self.color\n \n def getConnections(self):\n return self.connectedTo.keys()\n \n def getWeight(self,nbr):\n return self.connectedTo[nbr]\n \n def __str__(self):\n return str(self.id) + \":color \" + self.color + \":disc \" + str(self.disc) + \":fin \" + str(self.fin) + \":dist \" + str(self.dist) + \":pred \\n\\t[\" + str(self.pred)+ \"]\\n\"\n \n def getId(self):\n return self.id\n\nclass adjGraphTests(unittest.TestCase):\n def setUp(self):\n self.tGraph = Graph()\n \n def testMakeGraph(self):\n gFile = open(\"test.dat\")\n for line in gFile:\n fVertex, tVertex = line.split('|')\n fVertex = int(fVertex)\n tVertex = int(tVertex)\n self.tGraph.addEdge(fVertex,tVertex)\n for i in self.tGraph:\n adj = i.getAdj()\n for k in adj:\n print(i, k)\n\n \nif __name__ == '__main__':\n unittest.main()\n \n", "src/lib/macurl2path.py": "raise NotImplementedError(\"macurl2path is not yet implemented in Skulpt\")\n", "src/lib/new.py": "raise NotImplementedError(\"new is not yet implemented in Skulpt\")\n", "src/lib/whichdb.py": "raise NotImplementedError(\"whichdb is not yet implemented in Skulpt\")\n", "src/lib/_abcoll.py": "raise NotImplementedError(\"_abcoll is not yet implemented in Skulpt\")\n", "src/lib/hotshot/__init__.py": "raise NotImplementedError(\"hotshot is not yet implemented in Skulpt\")\n", "src/lib/MimeWriter.py": "raise NotImplementedError(\"MimeWriter is not yet implemented in Skulpt\")\n", "src/lib/sre_constants.py": "raise NotImplementedError(\"sre_constants is not yet implemented in Skulpt\")\n", "src/lib/atexit.py": "raise NotImplementedError(\"atexit is not yet implemented in Skulpt\")\n", "src/lib/compileall.py": "raise NotImplementedError(\"compileall is not yet implemented in Skulpt\")\n", "src/lib/symtable.py": "raise NotImplementedError(\"symtable is not yet implemented in Skulpt\")\n", "src/lib/warnings.py": "raise NotImplementedError(\"warnings is not yet implemented in Skulpt\")\n", "src/lib/keyword.py": "\n__all__ = [\"iskeyword\", \"kwlist\"]\n\nkwlist = [\n#--start keywords--\n 'and',\n 'as',\n 'assert',\n 'break',\n 'class',\n 'continue',\n 'def',\n 'del',\n 'elif',\n 'else',\n 'except',\n 'exec',\n 'finally',\n 'for',\n 'from',\n 'global',\n 'if',\n 'import',\n 'in',\n 'is',\n 'lambda',\n 'not',\n 'or',\n 'pass',\n 'print',\n 'raise',\n 'return',\n 'try',\n 'while',\n 'with',\n 'yield',\n#--end keywords--\n ]\n\ndef iskeyword(wd):\n return wd in kwlist\n\n", "src/lib/timeit.py": "raise NotImplementedError(\"timeit is not yet implemented in Skulpt\")\n", "src/lib/pythonds/basic/deque.py": "# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \n#deque.py\r\n\r\n\r\nclass Deque:\r\n def __init__(self):\r\n self.items = []\r\n\r\n def isEmpty(self):\r\n return self.items == []\r\n\r\n def addFront(self, item):\r\n self.items.append(item)\r\n\r\n def addRear(self, item):\r\n self.items.insert(0,item)\r\n\r\n def removeFront(self):\r\n return self.items.pop()\r\n\r\n def removeRear(self):\r\n return self.items.pop(0)\r\n\r\n def size(self):\r\n return len(self.items)\r\n", "src/lib/sgmllib.py": "raise NotImplementedError(\"sgmllib is not yet implemented in Skulpt\")\n", "src/lib/pprint.py": "raise NotImplementedError(\"pprint is not yet implemented in Skulpt\")\n", "src/lib/mutex.py": "raise NotImplementedError(\"mutex is not yet implemented in Skulpt\")\n", "src/lib/xml/sax/__init__.py": "raise NotImplementedError(\"sax is not yet implemented in Skulpt\")\n", "src/lib/mimetypes.py": "raise NotImplementedError(\"mimetypes is not yet implemented in Skulpt\")\n", "src/lib/aifc.py": "raise NotImplementedError(\"aifc is not yet implemented in Skulpt\")\n", "src/lib/webgl/matrix4.js": "// more from 'tdl'\nvar $builtinmodule = function(name)\n{\n var mod = {};\n\n var temp0v3_ = new Float32Array(3);\n var temp1v3_ = new Float32Array(3);\n var temp2v3_ = new Float32Array(3);\n\n var temp0v4_ = new Float32Array(4);\n var temp1v4_ = new Float32Array(4);\n var temp2v4_ = new Float32Array(4);\n\n var temp0m4_ = new Float32Array(16);\n var temp1m4_ = new Float32Array(16);\n var temp2m4_ = new Float32Array(16);\n\n var normalize = function(dst, a) {\n var n = 0.0;\n var aLength = a.length;\n for (var i = 0; i < aLength; ++i)\n n += a[i] * a[i];\n n = Math.sqrt(n);\n if (n > 0.00001) {\n for (var i = 0; i < aLength; ++i)\n dst[i] = a[i] / n;\n } else {\n for (var i = 0; i < aLength; ++i)\n dst[i] = 0;\n }\n return dst;\n };\n\n var cross = function(dst, a, b) {\n dst[0] = a[1] * b[2] - a[2] * b[1];\n dst[1] = a[2] * b[0] - a[0] * b[2];\n dst[2] = a[0] * b[1] - a[1] * b[0];\n return dst;\n };\n\n var subVector = function(dst, a, b) {\n var aLength = a.length;\n for (var i = 0; i < aLength; ++i)\n dst[i] = a[i] - b[i];\n return dst;\n };\n\n var dot = function(a, b) {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);\n };\n\n mod.lookAt = new Sk.builtin.func(function(view, eye, target, up)\n {\n var t0 = temp0v3_;\n var t1 = temp1v3_;\n var t2 = temp2v3_;\n\n var vz = normalize(t0, subVector(t0, eye.v, target.v));\n var vx = normalize(t1, cross(t1, up.v, vz));\n var vy = cross(t2, vz, vx);\n\n var dst = view.v;\n dst[ 0] = vx[0];\n dst[ 1] = vy[0];\n dst[ 2] = vz[0];\n dst[ 3] = 0;\n dst[ 4] = vx[1];\n dst[ 5] = vy[1];\n dst[ 6] = vz[1];\n dst[ 7] = 0;\n dst[ 8] = vx[2];\n dst[ 9] = vy[2];\n dst[10] = vz[2];\n dst[11] = 0;\n dst[12] = -dot(vx, eye.v);\n dst[13] = -dot(vy, eye.v);\n dst[14] = -dot(vz, eye.v);\n dst[15] = 1;\n\n return view;\n });\n\n mod.perspective = new Sk.builtin.func(function(proj, angle, aspect, near, far)\n {\n var f = Math.tan(Math.PI * 0.5 - 0.5 * (angle * Math.PI / 180));\n var rangeInv = 1.0 / (near - far);\n\n var dst = proj.v;\n\n dst[0] = f / aspect;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n\n dst[4] = 0;\n dst[5] = f;\n dst[6] = 0;\n dst[7] = 0;\n\n dst[8] = 0;\n dst[9] = 0;\n dst[10] = (near + far) * rangeInv;\n dst[11] = -1;\n\n dst[12] = 0;\n dst[13] = 0;\n dst[14] = near * far * rangeInv * 2;\n dst[15] = 0;\n\n return proj;\n });\n\n // builds, not appending\n mod.rotationY = new Sk.builtin.func(function(target, angle)\n {\n var dst = target.v;\n var c = Math.cos(angle * Math.PI / 180);\n var s = Math.sin(angle * Math.PI / 180);\n\n dst[ 0] = c;\n dst[ 1] = 0;\n dst[ 2] = -s;\n dst[ 3] = 0;\n dst[ 4] = 0;\n dst[ 5] = 1;\n dst[ 6] = 0;\n dst[ 7] = 0;\n dst[ 8] = s;\n dst[ 9] = 0;\n dst[10] = c;\n dst[11] = 0;\n dst[12] = 0;\n dst[13] = 0;\n dst[14] = 0;\n dst[15] = 1;\n\n return target;\n });\n\n mod.identity = new Sk.builtin.func(function(target)\n {\n var dst = target.v;\n dst[ 0] = 1;\n dst[ 1] = 0;\n dst[ 2] = 0;\n dst[ 3] = 0;\n dst[ 4] = 0;\n dst[ 5] = 1;\n dst[ 6] = 0;\n dst[ 7] = 0;\n dst[ 8] = 0;\n dst[ 9] = 0;\n dst[10] = 1;\n dst[11] = 0;\n dst[12] = 0;\n dst[13] = 0;\n dst[14] = 0;\n dst[15] = 1;\n return target;\n });\n\n // row major\n mod.mul = new Sk.builtin.func(function(target, x, y)\n {\n var dst = target.v;\n var a = x.v;\n var b = y.v;\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a10 = a[ 4 + 0];\n var a11 = a[ 4 + 1];\n var a12 = a[ 4 + 2];\n var a13 = a[ 4 + 3];\n var a20 = a[ 8 + 0];\n var a21 = a[ 8 + 1];\n var a22 = a[ 8 + 2];\n var a23 = a[ 8 + 3];\n var a30 = a[12 + 0];\n var a31 = a[12 + 1];\n var a32 = a[12 + 2];\n var a33 = a[12 + 3];\n var b00 = b[0];\n var b01 = b[1];\n var b02 = b[2];\n var b03 = b[3];\n var b10 = b[ 4 + 0];\n var b11 = b[ 4 + 1];\n var b12 = b[ 4 + 2];\n var b13 = b[ 4 + 3];\n var b20 = b[ 8 + 0];\n var b21 = b[ 8 + 1];\n var b22 = b[ 8 + 2];\n var b23 = b[ 8 + 3];\n var b30 = b[12 + 0];\n var b31 = b[12 + 1];\n var b32 = b[12 + 2];\n var b33 = b[12 + 3];\n dst[ 0] = a00 * b00 + a01 * b10 + a02 * b20 + a03 * b30;\n dst[ 1] = a00 * b01 + a01 * b11 + a02 * b21 + a03 * b31;\n dst[ 2] = a00 * b02 + a01 * b12 + a02 * b22 + a03 * b32;\n dst[ 3] = a00 * b03 + a01 * b13 + a02 * b23 + a03 * b33;\n dst[ 4] = a10 * b00 + a11 * b10 + a12 * b20 + a13 * b30;\n dst[ 5] = a10 * b01 + a11 * b11 + a12 * b21 + a13 * b31;\n dst[ 6] = a10 * b02 + a11 * b12 + a12 * b22 + a13 * b32;\n dst[ 7] = a10 * b03 + a11 * b13 + a12 * b23 + a13 * b33;\n dst[ 8] = a20 * b00 + a21 * b10 + a22 * b20 + a23 * b30;\n dst[ 9] = a20 * b01 + a21 * b11 + a22 * b21 + a23 * b31;\n dst[10] = a20 * b02 + a21 * b12 + a22 * b22 + a23 * b32;\n dst[11] = a20 * b03 + a21 * b13 + a22 * b23 + a23 * b33;\n dst[12] = a30 * b00 + a31 * b10 + a32 * b20 + a33 * b30;\n dst[13] = a30 * b01 + a31 * b11 + a32 * b21 + a33 * b31;\n dst[14] = a30 * b02 + a31 * b12 + a32 * b22 + a33 * b32;\n dst[15] = a30 * b03 + a31 * b13 + a32 * b23 + a33 * b33;\n return target;\n });\n\n mod.invert = new Sk.builtin.func(function(target, mat)\n {\n var dst = target.v;\n var m = mat.v;\n var m00 = m[0 * 4 + 0];\n var m01 = m[0 * 4 + 1];\n var m02 = m[0 * 4 + 2];\n var m03 = m[0 * 4 + 3];\n var m10 = m[1 * 4 + 0];\n var m11 = m[1 * 4 + 1];\n var m12 = m[1 * 4 + 2];\n var m13 = m[1 * 4 + 3];\n var m20 = m[2 * 4 + 0];\n var m21 = m[2 * 4 + 1];\n var m22 = m[2 * 4 + 2];\n var m23 = m[2 * 4 + 3];\n var m30 = m[3 * 4 + 0];\n var m31 = m[3 * 4 + 1];\n var m32 = m[3 * 4 + 2];\n var m33 = m[3 * 4 + 3];\n var tmp_0 = m22 * m33;\n var tmp_1 = m32 * m23;\n var tmp_2 = m12 * m33;\n var tmp_3 = m32 * m13;\n var tmp_4 = m12 * m23;\n var tmp_5 = m22 * m13;\n var tmp_6 = m02 * m33;\n var tmp_7 = m32 * m03;\n var tmp_8 = m02 * m23;\n var tmp_9 = m22 * m03;\n var tmp_10 = m02 * m13;\n var tmp_11 = m12 * m03;\n var tmp_12 = m20 * m31;\n var tmp_13 = m30 * m21;\n var tmp_14 = m10 * m31;\n var tmp_15 = m30 * m11;\n var tmp_16 = m10 * m21;\n var tmp_17 = m20 * m11;\n var tmp_18 = m00 * m31;\n var tmp_19 = m30 * m01;\n var tmp_20 = m00 * m21;\n var tmp_21 = m20 * m01;\n var tmp_22 = m00 * m11;\n var tmp_23 = m10 * m01;\n\n var t0 = (tmp_0 * m11 + tmp_3 * m21 + tmp_4 * m31) -\n (tmp_1 * m11 + tmp_2 * m21 + tmp_5 * m31);\n var t1 = (tmp_1 * m01 + tmp_6 * m21 + tmp_9 * m31) -\n (tmp_0 * m01 + tmp_7 * m21 + tmp_8 * m31);\n var t2 = (tmp_2 * m01 + tmp_7 * m11 + tmp_10 * m31) -\n (tmp_3 * m01 + tmp_6 * m11 + tmp_11 * m31);\n var t3 = (tmp_5 * m01 + tmp_8 * m11 + tmp_11 * m21) -\n (tmp_4 * m01 + tmp_9 * m11 + tmp_10 * m21);\n\n var d = 1.0 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);\n\n dst[ 0] = d * t0;\n dst[ 1] = d * t1;\n dst[ 2] = d * t2;\n dst[ 3] = d * t3;\n dst[ 4] = d * ((tmp_1 * m10 + tmp_2 * m20 + tmp_5 * m30) -\n (tmp_0 * m10 + tmp_3 * m20 + tmp_4 * m30));\n dst[ 5] = d * ((tmp_0 * m00 + tmp_7 * m20 + tmp_8 * m30) -\n (tmp_1 * m00 + tmp_6 * m20 + tmp_9 * m30));\n dst[ 6] = d * ((tmp_3 * m00 + tmp_6 * m10 + tmp_11 * m30) -\n (tmp_2 * m00 + tmp_7 * m10 + tmp_10 * m30));\n dst[ 7] = d * ((tmp_4 * m00 + tmp_9 * m10 + tmp_10 * m20) -\n (tmp_5 * m00 + tmp_8 * m10 + tmp_11 * m20));\n dst[ 8] = d * ((tmp_12 * m13 + tmp_15 * m23 + tmp_16 * m33) -\n (tmp_13 * m13 + tmp_14 * m23 + tmp_17 * m33));\n dst[ 9] = d * ((tmp_13 * m03 + tmp_18 * m23 + tmp_21 * m33) -\n (tmp_12 * m03 + tmp_19 * m23 + tmp_20 * m33));\n dst[10] = d * ((tmp_14 * m03 + tmp_19 * m13 + tmp_22 * m33) -\n (tmp_15 * m03 + tmp_18 * m13 + tmp_23 * m33));\n dst[11] = d * ((tmp_17 * m03 + tmp_20 * m13 + tmp_23 * m23) -\n (tmp_16 * m03 + tmp_21 * m13 + tmp_22 * m23));\n dst[12] = d * ((tmp_14 * m22 + tmp_17 * m32 + tmp_13 * m12) -\n (tmp_16 * m32 + tmp_12 * m12 + tmp_15 * m22));\n dst[13] = d * ((tmp_20 * m32 + tmp_12 * m02 + tmp_19 * m22) -\n (tmp_18 * m22 + tmp_21 * m32 + tmp_13 * m02));\n dst[14] = d * ((tmp_18 * m12 + tmp_23 * m32 + tmp_15 * m02) -\n (tmp_22 * m32 + tmp_14 * m02 + tmp_19 * m12));\n dst[15] = d * ((tmp_22 * m22 + tmp_16 * m02 + tmp_21 * m12) -\n (tmp_20 * m12 + tmp_23 * m22 + tmp_17 * m02));\n return target;\n });\n\n mod.transpose = new Sk.builtin.func(function(target, mat)\n {\n var dst = target.v;\n var m = mat.v;\n for (var j = 0; j < 4; ++j) {\n for (var i = 0; i < 4; ++i)\n dst[j * 4 + i] = m[i * 4 + j];\n }\n return dst;\n });\n\n return mod;\n};\n", "src/lib/idlelib/__init__.py": "raise NotImplementedError(\"idlelib is not yet implemented in Skulpt\")\n", "src/lib/formatter.py": "raise NotImplementedError(\"formatter is not yet implemented in Skulpt\")\n", "src/lib/tabnanny.py": "raise NotImplementedError(\"tabnanny is not yet implemented in Skulpt\")\n", "src/lib/pythonds/graphs/priorityQueue.py": "# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \nimport unittest\n\n# this implementation of binary heap takes key value pairs,\n# we will assume that the keys are all comparable\n\nclass PriorityQueue:\n def __init__(self):\n self.heapArray = [(0,0)]\n self.currentSize = 0\n\n def buildHeap(self,alist):\n self.currentSize = len(alist)\n self.heapArray = [(0,0)]\n for i in alist:\n self.heapArray.append(i)\n i = len(alist) // 2 \n while (i > 0):\n self.percDown(i)\n i = i - 1\n \n def percDown(self,i):\n while (i * 2) <= self.currentSize:\n mc = self.minChild(i)\n if self.heapArray[i][0] > self.heapArray[mc][0]:\n tmp = self.heapArray[i]\n self.heapArray[i] = self.heapArray[mc]\n self.heapArray[mc] = tmp\n i = mc\n \n def minChild(self,i):\n if i*2 > self.currentSize:\n return -1\n else:\n if i*2 + 1 > self.currentSize:\n return i*2\n else:\n if self.heapArray[i*2][0] < self.heapArray[i*2+1][0]:\n return i*2\n else:\n return i*2+1\n\n def percUp(self,i):\n while i // 2 > 0:\n if self.heapArray[i][0] < self.heapArray[i//2][0]:\n tmp = self.heapArray[i//2]\n self.heapArray[i//2] = self.heapArray[i]\n self.heapArray[i] = tmp\n i = i//2\n \n def add(self,k):\n self.heapArray.append(k)\n self.currentSize = self.currentSize + 1\n self.percUp(self.currentSize)\n\n def delMin(self):\n retval = self.heapArray[1][1]\n self.heapArray[1] = self.heapArray[self.currentSize]\n self.currentSize = self.currentSize - 1\n self.heapArray.pop()\n self.percDown(1)\n return retval\n \n def isEmpty(self):\n if self.currentSize == 0:\n return True\n else:\n return False\n\n def decreaseKey(self,val,amt):\n # this is a little wierd, but we need to find the heap thing to decrease by\n # looking at its value\n done = False\n i = 1\n myKey = 0\n while not done and i <= self.currentSize:\n if self.heapArray[i][1] == val:\n done = True\n myKey = i\n else:\n i = i + 1\n if myKey > 0:\n self.heapArray[myKey] = (amt,self.heapArray[myKey][1])\n self.percUp(myKey)\n \n def __contains__(self,vtx):\n for pair in self.heapArray:\n if pair[1] == vtx:\n return True\n return False\n \nclass TestBinHeap(unittest.TestCase):\n def setUp(self):\n self.theHeap = PriorityQueue()\n self.theHeap.add((2,'x'))\n self.theHeap.add((3,'y'))\n self.theHeap.add((5,'z'))\n self.theHeap.add((6,'a'))\n self.theHeap.add((4,'d'))\n\n\n def testInsert(self):\n assert self.theHeap.currentSize == 5\n\n def testDelmin(self):\n assert self.theHeap.delMin() == 'x'\n assert self.theHeap.delMin() == 'y'\n \n def testDecKey(self):\n self.theHeap.decreaseKey('d',1)\n assert self.theHeap.delMin() == 'd'\n \nif __name__ == '__main__':\n unittest.main()\n", "src/lib/base64.py": "raise NotImplementedError(\"base64 is not yet implemented in Skulpt\")\n", "src/lib/site.py": "raise NotImplementedError(\"site is not yet implemented in Skulpt\")\n", "src/lib/abc.py": "raise NotImplementedError(\"abc is not yet implemented in Skulpt\")\n", "src/lib/string.py": "raise NotImplementedError(\"string is not yet implemented in Skulpt\")\n", "src/builtin/this.py": "s = \"\"\"Gur Mra bs Clguba, ol Gvz Crgref\n\nOrnhgvshy vf orggre guna htyl.\nRkcyvpvg vf orggre guna vzcyvpvg.\nFvzcyr vf orggre guna pbzcyrk.\nPbzcyrk vf orggre guna pbzcyvpngrq.\nSyng vf orggre guna arfgrq.\nFcnefr vf orggre guna qrafr.\nErnqnovyvgl pbhagf.\nFcrpvny pnfrf nera'g fcrpvny rabhtu gb oernx gur ehyrf.\nNygubhtu cenpgvpnyvgl orngf chevgl.\nReebef fubhyq arire cnff fvyragyl.\nHayrff rkcyvpvgyl fvyraprq.\nVa gur snpr bs nzovthvgl, ershfr gur grzcgngvba gb thrff.\nGurer fubhyq or bar-- naq cersrenoyl bayl bar --boivbhf jnl gb qb vg.\nNygubhtu gung jnl znl abg or boivbhf ng svefg hayrff lbh'er Qhgpu.\nAbj vf orggre guna arire.\nNygubhtu arire vf bsgra orggre guna *evtug* abj.\nVs gur vzcyrzragngvba vf uneq gb rkcynva, vg'f n onq vqrn.\nVs gur vzcyrzragngvba vf rnfl gb rkcynva, vg znl or n tbbq vqrn.\nAnzrfcnprf ner bar ubaxvat terng vqrn -- yrg'f qb zber bs gubfr!\"\"\"\n\nd = {}\nfor c in (65, 97):\n for i in range(26):\n d[chr(i+c)] = chr((i+13) % 26 + c)\n\nprint \"\".join([d.get(c, c) for c in s])\n", "src/lib/inspect.py": "raise NotImplementedError(\"inspect is not yet implemented in Skulpt\")\n", "src/lib/multiprocessing/dummy/__init__.py": "raise NotImplementedError(\"dummy is not yet implemented in Skulpt\")\n", "src/lib/xml/__init__.py": "raise NotImplementedError(\"xml is not yet implemented in Skulpt\")\n", "src/lib/pythonds/trees/binheap.py": "# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \n\n# this heap takes key value pairs, we will assume that the keys are integers\nclass BinHeap:\n def __init__(self):\n self.heapList = [0]\n self.currentSize = 0\n\n\n def buildHeap(self,alist):\n i = len(alist) // 2\n self.currentSize = len(alist)\n self.heapList = [0] + alist[:]\n print(len(self.heapList), i)\n while (i > 0):\n print(self.heapList, i)\n self.percDown(i)\n i = i - 1\n print(self.heapList,i)\n \n def percDown(self,i):\n while (i * 2) <= self.currentSize:\n mc = self.minChild(i)\n if self.heapList[i] > self.heapList[mc]:\n tmp = self.heapList[i]\n self.heapList[i] = self.heapList[mc]\n self.heapList[mc] = tmp\n i = mc\n \n def minChild(self,i):\n if i * 2 + 1 > self.currentSize:\n return i * 2\n else:\n if self.heapList[i * 2] < self.heapList[i * 2 + 1]:\n return i * 2\n else:\n return i * 2 + 1\n\n def percUp(self,i):\n while i // 2 > 0:\n if self.heapList[i] < self.heapList[i//2]:\n tmp = self.heapList[i // 2]\n self.heapList[i // 2] = self.heapList[i]\n self.heapList[i] = tmp\n i = i // 2\n \n def insert(self,k):\n self.heapList.append(k)\n self.currentSize = self.currentSize + 1\n self.percUp(self.currentSize)\n\n def delMin(self):\n retval = self.heapList[1]\n self.heapList[1] = self.heapList[self.currentSize]\n self.currentSize = self.currentSize - 1\n self.heapList.pop()\n self.percDown(1)\n return retval\n \n def isEmpty(self):\n if currentSize == 0:\n return True\n else:\n return False\n", "src/lib/distutils/__init__.py": "raise NotImplementedError(\"distutils is not yet implemented in Skulpt\")\n", "src/lib/urllib/__init__.js": "var $builtinmodule = function (name) {\n var urllib = {};\n\n return urllib;\n};\n", "src/lib/_strptime.py": "raise NotImplementedError(\"_strptime is not yet implemented in Skulpt\")\n", "src/lib/urllib2.py": "raise NotImplementedError(\"urllib2 is not yet implemented in Skulpt\")\n", "src/lib/Queue.py": "raise NotImplementedError(\"Queue is not yet implemented in Skulpt\")\n", "src/lib/time.js": "/*\n implementation of the Python time package.\n\n notes:\n - struct_time is a structseq but structseq does not implement methods: 'n_fields', 'n_sequence_fields', 'n_unnamed_fields' yet\n\n ['__doc__', '__file__', '__name__', '__package__', 'accept2dyear', 'altzone', 'asctime', 'clock', 'ctime', 'daylight', 'gmtime', 'localtime', 'mktime', 'sleep', 'strftime', 'strptime', 'struct_time', 'time', 'timezone', 'tzname', 'tzset']\n */\n\nvar $builtinmodule = function (name) {\n var mod = {};\n\n mod.__file__ = \"/src/lib/time/__init__.js\";\n\n mod.__package__ = Sk.builtin.none.none$;\n\n var struct_time_fields = {\n \"tm_year\": \"year, for example, 1993\",\n \"tm_mon\": \"month of year, range [1, 12]\",\n \"tm_mday\": \"day of month, range [1, 31]\",\n \"tm_hour\": \"hours, range [0, 23]\",\n \"tm_min\": \"minutes, range [0, 59]\",\n \"tm_sec\": \"seconds, range [0, 61]\",\n \"tm_wday\": \"day of week, range [0, 6], Monday is 0\",\n \"tm_yday\": \"day of year, range [1, 366]\",\n \"tm_isdst\": \"1 if summer time is in effect, 0 if not, and -1 if unknown\"\n };\n\n var struct_time_f = Sk.builtin.make_structseq('time', 'struct_time', struct_time_fields);\n\n mod.struct_time = struct_time_f;\n\n function check_struct_time(t) {\n if (!(t instanceof struct_time_f)) {\n throw new Sk.builtin.TypeError(\"Required argument 'struct_time' must be of type: 'struct_time'\");\n }\n var i;\n var len = t.v.length;\n var obj = t.v;\n for (i = 0; i < len; ++i) {\n if (!Sk.builtin.checkInt(obj[i])) {\n throw new Sk.builtin.TypeError(\"struct_time may only contain integers\");\n }\n }\n return true;\n }\n\n mod.time = new Sk.builtin.func(function () {\n Sk.builtin.pyCheckArgs(\"time\", arguments, 0, 0);\n var res = Date.now();\n if (this.performance && this.performance.now)\n {\n res = res + performance.now() % 1;\n }\n return Sk.builtin.assk$(res / 1000, undefined);\n });\n\n // This is an experimental implementation of time.sleep(), using suspensions\n mod.sleep = new Sk.builtin.func(function(delay) {\n Sk.builtin.pyCheckArgs(\"sleep\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"delay\", \"float\", Sk.builtin.checkNumber(delay));\n var susp = new Sk.misceval.Suspension();\n susp.resume = function() { return Sk.builtin.none.none$; }\n susp.data = {type: \"Sk.promise\", promise: new Promise(function(resolve) {\n Sk.setTimeout(resolve, Sk.ffi.remapToJs(delay)*1000);\n })};\n return susp;\n });\n\n function padLeft(str, l, c) {\n var _str = str.toString();\n return Array(l - _str.length + 1).join(c || \" \") + _str;\n }\n\n function isLeapYear(year) {\n if((year & 3) != 0) return false;\n return ((year % 100) != 0 || (year % 400) == 0);\n }\n\n function getDayOfYear(date,utc) {\n utc = utc || false;\n var dayCount = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];\n var mn = utc ? date.getUTCMonth() : date.getMonth();\n var dn = utc ? date.getUTCDate() : date.getDate();\n var dayOfYear = dayCount[mn] + dn;\n if(mn > 1 && isLeapYear(utc ? date.getUTCFullYear() : date.getFullYear())) dayOfYear++;\n return dayOfYear;\n }\n\n function stdTimezoneOffset() {\n var jan = new Date(2002, 0, 1);\n var jul = new Date(2002, 6, 1);\n return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());\n }\n\n function altTimezoneOffset() {\n var jan = new Date(2002, 0, 1);\n var jul = new Date(2002, 6, 1);\n return Math.min(jan.getTimezoneOffset(), jul.getTimezoneOffset());\n }\n\n function dst(date) {\n return date.getTimezoneOffset() < stdTimezoneOffset();\n }\n\n function timeZoneName(date) {\n return /\\((.*)\\)/.exec(date.toString())[1];\n }\n\n function timeZoneNames() {\n var jan = new Date(2002, 0, 1);\n var jul = new Date(2002, 6, 1);\n if (dst(jan)) {\n return [Sk.builtin.str(timeZoneName(jul)), Sk.builtin.str(timeZoneName(jan))];\n } else {\n return [Sk.builtin.str(timeZoneName(jan)), Sk.builtin.str(timeZoneName(jul))];\n }\n }\n\n function date_to_struct_time(date, utc) {\n utc = utc || false;\n // y, m, d, hh, mm, ss, weekday, jday, dst\n return new struct_time_f(\n [\n Sk.builtin.assk$(utc ? date.getUTCFullYear() : date.getFullYear()),\n Sk.builtin.assk$((utc ? date.getUTCMonth() : date.getMonth()) + 1), // want January == 1\n Sk.builtin.assk$(utc ? date.getUTCDate() : date.getDate()),\n Sk.builtin.assk$(utc ? date.getUTCHours() : date.getHours()),\n Sk.builtin.assk$(utc ? date.getUTCMinutes() : date.getMinutes()),\n Sk.builtin.assk$(utc ? date.getUTCSeconds() : date.getSeconds()),\n Sk.builtin.assk$(((utc ? date.getUTCDay() : date.getDay()) + 6) % 7), // Want Monday == 0\n Sk.builtin.assk$(getDayOfYear(date, utc)), // Want January, 1 == 1\n Sk.builtin.assk$(utc ? 0 : (dst(date) ? 1 : 0)) // 1 for DST /0 for non-DST /-1 for unknown\n ]\n );\n }\n\n function localtime_f(secs) {\n Sk.builtin.pyCheckArgs(\"localtime\", arguments, 0, 1);\n var d = new Date();\n if (secs) {\n Sk.builtin.pyCheckType(\"secs\", \"number\", Sk.builtin.checkNumber(secs));\n var seconds = Sk.builtin.asnum$(secs);\n d.setTime(seconds * 1000);\n }\n return date_to_struct_time(d);\n }\n\n mod.localtime = new Sk.builtin.func(localtime_f);\n\n mod.gmtime = new Sk.builtin.func(function(secs) {\n Sk.builtin.pyCheckArgs(\"localtime\", arguments, 0, 1);\n var d = new Date();\n if (secs) {\n Sk.builtin.pyCheckType(\"secs\", \"number\", Sk.builtin.checkNumber(secs));\n var seconds = Sk.builtin.asnum$(secs);\n d.setTime(seconds * 1000);\n }\n return date_to_struct_time(d, true);\n });\n\n var monthnames = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"];\n var daynames = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\n\n function asctime_f(time) {\n if (!time || Sk.builtin.checkNone(time))\n {\n time = localtime_f();\n } else if (!(time instanceof struct_time_f)) {\n time = new struct_time_f(time);\n }\n if (time instanceof Sk.builtin.tuple && time.v.length == 9)\n {\n // todo: test validity??\n var parts = [];\n parts.push(daynames[Sk.builtin.asnum$(time.v[6])]);\n parts.push(monthnames[Sk.builtin.asnum$(time.v[1])-1]);\n parts.push(padLeft(Sk.builtin.asnum$(time.v[2]).toString(), 2, '0'));\n parts.push(\n padLeft(Sk.builtin.asnum$(time.v[3]).toString(), 2, '0') + \":\" +\n padLeft(Sk.builtin.asnum$(time.v[4]).toString(), 2, '0') + \":\" +\n padLeft(Sk.builtin.asnum$(time.v[5]).toString(), 2, '0')\n );\n parts.push(padLeft(Sk.builtin.asnum$(time.v[0]).toString(), 4, '0'));\n\n return Sk.builtin.str(parts.join(\" \"));\n }\n }\n\n mod.asctime = new Sk.builtin.func(asctime_f);\n\n mod.ctime = new Sk.builtin.func(function(secs) {\n return asctime_f(localtime_f(secs));\n });\n\n function mktime_f(time) {\n if (time instanceof Sk.builtin.tuple && time.v.length == 9)\n {\n var d = new Date();\n d.setFullYear(Sk.builtin.asnum$(time.v[0]));\n d.setMonth(Sk.builtin.asnum$(time.v[1])-1);\n d.setDate(Sk.builtin.asnum$(time.v[2]));\n d.setHours(Sk.builtin.asnum$(time.v[3]));\n d.setMinutes(Sk.builtin.asnum$(time.v[4]));\n d.setSeconds(Sk.builtin.asnum$(time.v[5]));\n return Sk.builtin.assk$(d.getTime() / 1000, undefined);\n } else {\n throw new Sk.builtin.TypeError(\"mktime() requires a struct_time or 9-tuple\");\n }\n }\n\n mod.mktime = new Sk.builtin.func(mktime_f);\n\n /*\n The offset of the local (non-DST) timezone, in seconds west of UTC (negative in most of Western Europe,\n positive in the US, zero in the UK).\n */\n mod.timezone = new Sk.builtin.int_(stdTimezoneOffset() * 60);\n\n /*\n The offset of the local DST timezone, in seconds west of UTC, if one is defined. This is negative if the\n local DST timezone is east of UTC (as in Western Europe, including the UK). Only use this if daylight is nonzero.\n */\n mod.altzone = new Sk.builtin.int_(altTimezoneOffset() * 60);\n\n /*\n Nonzero if a DST timezone is defined.\n */\n mod.daylight = new Sk.builtin.int_(dst(new Date()) ? 1 : 0);\n\n /*\n A tuple of two strings: the first is the name of the local non-DST timezone, the second is the name of the local\n DST timezone. If no DST timezone is defined, the second string should not be used.\n */\n mod.tzname = Sk.builtin.tuple(timeZoneNames());\n\n mod.accept2dyear = Sk.builtin.assk$(1, Sk.builtin.nmber.int$);\n\n mod.clock = new Sk.builtin.func(function() {\n var res = 0.0;\n if (this.performance && this.performance.now)\n {\n res = performance.now() / 1000;\n } else {\n res = new Date().getTime() / 1000;\n }\n return new Sk.builtin.float_(res);\n });\n\n function strftime_f(format, t) {\n var jsFormat;\n\n Sk.builtin.pyCheckArgs(\"strftime\", arguments, 1, 2);\n if (!Sk.builtin.checkString(format)) {\n throw new Sk.builtin.TypeError(\"format must be a string\");\n }\n if (!t)\n {\n t = localtime_f();\n } else if (!(t instanceof struct_time_f)) {\n t = new struct_time_f(t);\n }\n\n check_struct_time(t);\n\n jsFormat = Sk.ffi.remapToJs(format);\n\n return Sk.ffi.remapToPy(strftime(jsFormat, new Date(mktime_f(t).v*1000)));\n }\n\n mod.strftime = new Sk.builtin.func(strftime_f);\n\n function tzset_f()\n {\n throw new Sk.builtin.NotImplementedError(\"time.tzset() is not yet implemented\");\n Sk.builtin.pyCheckArgs(\"tzset\", arguments, 0, 0);\n }\n\n mod.tzset = new Sk.builtin.func(tzset_f);\n\n function strptime_f(s, format)\n {\n Sk.builtin.pyCheckArgs(\"strptime\", arguments, 1, 2);\n Sk.builtin.pyCheckType(\"string\", \"string\", Sk.builtin.checkString(s));\n if (format !== undefined) {\n Sk.builtin.pyCheckType(\"format\", \"string\", Sk.builtin.checkString(format));\n } else {\n format = new Sk.builtin.str(\"%a %b %d %H:%M:%S %Y\");\n }\n\n return date_to_struct_time(strptime(Sk.ffi.remapToJs(s), Sk.ffi.remapToJs(format), true));\n }\n\n mod.strptime = new Sk.builtin.func(strptime_f);\n\n return mod;\n};\n", "src/lib/pythonds/basic/stack.py": "# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \n#stack.py\r\n\r\nclass Stack:\r\n def __init__(self):\r\n self.items = []\r\n\r\n def isEmpty(self):\r\n return self.items == []\r\n\r\n def push(self, item):\r\n self.items.append(item)\r\n\r\n def pop(self):\r\n return self.items.pop()\r\n\r\n def peek(self):\r\n return self.items[len(self.items)-1]\r\n\r\n def size(self):\r\n return len(self.items)\r\n\r\n", "src/lib/sndhdr.py": "raise NotImplementedError(\"sndhdr is not yet implemented in Skulpt\")\n", "src/lib/codeop.py": "raise NotImplementedError(\"codeop is not yet implemented in Skulpt\")\n", "src/lib/getpass.py": "raise NotImplementedError(\"getpass is not yet implemented in Skulpt\")\n", "src/lib/anydbm.py": "raise NotImplementedError(\"anydbm is not yet implemented in Skulpt\")\n", "src/lib/urlparse.py": "raise NotImplementedError(\"urlparse is not yet implemented in Skulpt\")\n", "src/lib/CGIHTTPServer.py": "raise NotImplementedError(\"CGIHTTPServer is not yet implemented in Skulpt\")\n", "src/lib/fnmatch.py": "raise NotImplementedError(\"fnmatch is not yet implemented in Skulpt\")\n", "src/lib/HTMLParser.py": "raise NotImplementedError(\"HTMLParser is not yet implemented in Skulpt\")\n", "src/lib/calendar.py": "raise NotImplementedError(\"calendar is not yet implemented in Skulpt\")\n", "src/lib/compiler/__init__.py": "raise NotImplementedError(\"compiler is not yet implemented in Skulpt\")\n", "src/lib/pydoc.py": "raise NotImplementedError(\"pydoc is not yet implemented in Skulpt\")\n", "src/lib/multifile.py": "raise NotImplementedError(\"multifile is not yet implemented in Skulpt\")\n", "src/lib/lib2to3/pgen2/__init__.py": "raise NotImplementedError(\"pgen2 is not yet implemented in Skulpt\")\n", "src/lib/dbhash.py": "raise NotImplementedError(\"dbhash is not yet implemented in Skulpt\")\n", "src/lib/ihooks.py": "raise NotImplementedError(\"ihooks is not yet implemented in Skulpt\")\n", "src/lib/lib2to3/tests/__init__.py": "raise NotImplementedError(\"tests is not yet implemented in Skulpt\")\n", "src/lib/genericpath.py": "raise NotImplementedError(\"genericpath is not yet implemented in Skulpt\")\n", "src/lib/unittest/__init__.py": "__author__ = 'bmiller'\n'''\nThis is the start of something that behaves like\nthe unittest module from cpython.\n\n'''\n\nclass TestCase:\n def __init__(self):\n self.numPassed = 0\n self.numFailed = 0\n self.assertPassed = 0\n self.assertFailed = 0\n self.verbosity = 1\n self.tlist = []\n testNames = {}\n for name in dir(self):\n if name[:4] == 'test' and name not in testNames:\n self.tlist.append(getattr(self,name))\n testNames[name]=True\n\n def setUp(self):\n pass\n\n def tearDown(self):\n pass\n \n def cleanName(self,funcName):\n # work around skulpts lack of an __name__\n funcName = str(funcName)\n funcName = funcName[13:]\n funcName = funcName[:funcName.find('<')-3]\n return funcName\n\n def main(self):\n\n for func in self.tlist:\n if self.verbosity > 1:\n print('Running %s' % self.cleanName(func))\n try:\n self.setUp()\n self.assertPassed = 0\n self.assertFailed = 0\n func()\n self.tearDown()\n if self.assertFailed == 0:\n self.numPassed += 1\n else:\n self.numFailed += 1\n print('Tests failed in %s ' % self.cleanName(func))\n except Exception as e:\n self.assertFailed += 1\n self.numFailed += 1\n print('Test threw exception in %s (%s)' % (self.cleanName(func), e))\n self.showSummary()\n\n def assertEqual(self, actual, expected, feedback=\"\"):\n res = actual==expected\n if not res and feedback == \"\":\n feedback = \"Expected %s to equal %s\" % (str(actual),str(expected))\n self.appendResult(res, actual ,expected, feedback)\n\n def assertNotEqual(self, actual, expected, feedback=\"\"):\n res = actual != expected\n if not res and feedback == \"\":\n feedback = \"Expected %s to not equal %s\" % (str(actual),str(expected))\n self.appendResult(res, actual, expected, feedback)\n\n def assertTrue(self,x, feedback=\"\"):\n res = bool(x) is True\n if not res and feedback == \"\":\n feedback = \"Expected %s to be True\" % (str(x))\n self.appendResult(res, x, True, feedback)\n\n def assertFalse(self,x, feedback=\"\"):\n res = not bool(x)\n if not res and feedback == \"\":\n feedback = \"Expected %s to be False\" % (str(x))\n self.appendResult(res, x, False, feedback)\n\n def assertIs(self,a,b, feedback=\"\"):\n res = a is b\n if not res and feedback == \"\":\n feedback = \"Expected %s to be the same object as %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertIsNot(self,a,b, feedback=\"\"):\n res = a is not b\n if not res and feedback == \"\":\n feedback = \"Expected %s to not be the same object as %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertIsNone(self,x, feedback=\"\"):\n res = x is None\n if not res and feedback == \"\":\n feedback = \"Expected %s to be None\" % (str(x))\n self.appendResult(res, x, None, feedback)\n\n def assertIsNotNone(self,x, feedback=\"\"):\n res = x is not None\n if not res and feedback == \"\":\n feedback = \"Expected %s to not be None\" % (str(x))\n self.appendResult(res, x, None, feedback)\n\n def assertIn(self, a, b, feedback=\"\"):\n res = a in b\n if not res and feedback == \"\":\n feedback = \"Expected %s to be in %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertNotIn(self, a, b, feedback=\"\"):\n res = a not in b\n if not res and feedback == \"\":\n feedback = \"Expected %s to not be in %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertIsInstance(self,a,b, feedback=\"\"):\n res = isinstance(a,b)\n if not res and feedback == \"\":\n feedback = \"Expected %s to be an instance of %s\" % (str(a), str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertNotIsInstance(self,a,b, feedback=\"\"):\n res = not isinstance(a,b)\n if not res and feedback == \"\":\n feedback = \"Expected %s to not be an instance of %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertAlmostEqual(self, a, b, places=7, feedback=\"\", delta=None):\n\n if delta is not None:\n res = abs(a-b) <= delta\n else:\n if places is None:\n places = 7\n res = round(a-b, places) == 0\n \n if not res and feedback == \"\":\n feedback = \"Expected %s to equal %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertNotAlmostEqual(self, a, b, places=7, feedback=\"\", delta=None):\n\n if delta is not None:\n res = not (a == b) and abs(a - b) > delta\n else:\n if places is None:\n places = 7\n res = round(a-b, places) != 0\n\n if not res and feedback == \"\":\n feedback = \"Expected %s to not equal %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n\n def assertGreater(self,a,b, feedback=\"\"):\n res = a > b\n if not res and feedback == \"\":\n feedback = \"Expected %s to be greater than %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertGreaterEqual(self,a,b, feedback=\"\"):\n res = a >= b\n if not res and feedback == \"\":\n feedback = \"Expected %s to be >= %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertLess(self, a, b, feedback=\"\"):\n res = a < b\n if not res and feedback == \"\":\n feedback = \"Expected %s to be less than %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertLessEqual(self,a,b, feedback=\"\"):\n res = a <= b\n if not res and feedback == \"\":\n feedback = \"Expected %s to be <= %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def appendResult(self,res,actual,expected,feedback):\n if res:\n msg = 'Pass'\n self.assertPassed += 1\n else:\n msg = 'Fail: ' + feedback\n print(msg)\n self.assertFailed += 1\n\n def assertRaises(self, exception, callable=None, *args, **kwds):\n # with is currently not supported hence we just try and catch\n if callable is None:\n raise NotImplementedError(\"assertRaises does currently not support assert contexts\")\n if kwds:\n raise NotImplementedError(\"assertRaises does currently not support **kwds\")\n\n res = False\n actualerror = str(exception())\n try:\n callable(*args)\n except exception as ex:\n res = True\n except Exception as inst:\n actualerror = str(inst)\n print(\"ACT = \", actualerror, str(exception()))\n else:\n actualerror = \"No Error\"\n\n self.appendResult(res, str(exception()), actualerror, \"\")\n\n def fail(self, msg=None):\n if msg is None:\n msg = 'Fail'\n else:\n msg = 'Fail: ' + msg\n print(msg)\n self.assertFailed += 1\n\n def showSummary(self):\n pct = self.numPassed / (self.numPassed+self.numFailed) * 100\n print(\"Ran %d tests, passed: %d failed: %d\\n\" % (self.numPassed+self.numFailed,\n self.numPassed, self.numFailed))\n\n\n\ndef main(verbosity=1):\n glob = globals() # globals() still needs work\n for name in glob:\n if issubclass(glob[name],TestCase):\n try:\n tc = glob[name]()\n tc.verbosity = verbosity\n tc.main()\n except:\n print(\"Uncaught Error in: \", name)\n", "src/lib/webgl/__init__.js": "var $builtinmodule = function(name)\n{\n var mod = {};\n\n var makeFailHTML = function(msg) {\n return '' +\n '<table style=\"background-color: #8CE; width: 100%; height: 100%;\"><tr>' +\n '<td align=\"center\">' +\n '<div style=\"display: table-cell; vertical-align: middle;\">' +\n '<div style=\"\">' + msg + '</div>' +\n '</div>' +\n '</td></tr></table>';\n };\n\n var GET_A_WEBGL_BROWSER = '' +\n 'This page requires a browser that supports WebGL.<br/>' +\n '<a href=\"http://get.webgl.org\">Click here to upgrade your browser.</a>';\n\n var NEED_HARDWARE = '' +\n \"It doesn't appear your computer can support WebGL.<br/>\" +\n '<a href=\"http://get.webgl.org\">Click here for more information.</a>';\n \n var create3DContext = function(canvas) {\n var names = [\"webgl\", \"experimental-webgl\", \"webkit-3d\", \"moz-webgl\"];\n var gl = null;\n for (var ii = 0; ii < names.length; ++ii) {\n try {\n gl = canvas.getContext(names[ii]);\n }\n catch(e) {\n }\n if (gl) {\n break;\n }\n }\n if (gl) {\n // Disallow selection by default. This keeps the cursor from changing to an\n // I-beam when the user clicks and drags. It's easier on the eyes.\n function returnFalse() {\n return false;\n }\n\n canvas.onselectstart = returnFalse;\n canvas.onmousedown = returnFalse;\n }\n return gl;\n };\n\n var setupWebGL = function(canvasContainerId, opt_canvas) {\n var container = document.getElementById(canvasContainerId);\n var context;\n if (!opt_canvas) {\n opt_canvas = container.getElementsByTagName(\"canvas\")[0];\n }\n if (!opt_canvas) {\n // this browser doesn't support the canvas tag at all. Not even 2d.\n container.innerHTML = makeFailHTML(GET_A_WEBGL_BROWSER);\n return;\n }\n\n var gl = create3DContext(opt_canvas);\n if (!gl) {\n // TODO(gman): fix to official way to detect that it's the user's machine, not the browser.\n var browserStrings = navigator.userAgent.match(/(\\w+\\/.*? )/g);\n var browsers = {};\n try {\n for (var b = 0; b < browserStrings.length; ++b) {\n var parts = browserStrings[b].match(/(\\w+)/g);\n var bb = [];\n for (var ii = 1; ii < parts.length; ++ii) {\n bb.push(parseInt(parts[ii]));\n }\n browsers[parts[0]] = bb;\n }\n }\n catch (e) {\n }\n if (browsers.Chrome &&\n (browsers.Chrome[0] > 7 ||\n (browsers.Chrome[0] == 7 && browsers.Chrome[1] > 0) ||\n (browsers.Chrome[0] == 7 && browsers.Chrome[1] == 0 && browsers.Chrome[2] >= 521))) {\n container.innerHTML = makeFailHTML(NEED_HARDWARE);\n }\n else {\n container.innerHTML = makeFailHTML(GET_A_WEBGL_BROWSER);\n }\n }\n return gl;\n };\n\n /**\n * The Context encapsulates the underlying WebGL native JavaScript API.\n */\n mod.Context = Sk.misceval.buildClass(mod, function($gbl, $loc) {\n $loc.__init__ = new Sk.builtin.func(\n function(self, canvasid) {\n var canvas = document.getElementById(canvasid.v);\n var gl = setupWebGL(canvasid.v, canvas)\n if (!gl) {\n throw new Error(\"Your browser does not appear to support WebGL.\");\n }\n\n self.gl = gl;\n\n // Copy symbolic constants and functions from native WebGL, encapsulating where necessary. \n for (var k in gl.__proto__) {\n if (typeof gl.__proto__[k] === 'number') {\n Sk.abstr.objectSetItem(self['$d'], new Sk.builtin.str(k), gl.__proto__[k]);\n }\n else if (typeof gl.__proto__[k] === \"function\") {\n switch(k) {\n case 'bufferData': {\n }\n break;\n case 'clearColor': {\n }\n break;\n case 'drawArrays': {\n }\n break;\n case 'getAttribLocation': {\n }\n break;\n case 'getUniformLocation': {\n }\n break;\n case 'shaderSource': {\n }\n break;\n case 'uniformMatrix4fv': {\n }\n break;\n case 'vertexAttribPointer': {\n }\n break;\n case 'viewport': {\n }\n break;\n default: {\n (function(key) {\n Sk.abstr.objectSetItem(self['$d'], new Sk.builtin.str(k), new Sk.builtin.func(function() {\n var f = gl.__proto__[key];\n return f.apply(gl, arguments);\n }));\n }(k));\n }\n }\n }\n }\n\n gl.clearColor(100.0/255.0, 149.0/255.0, 237.0/255.0, 1.0);\n gl.clear(gl.COLOR_BUFFER_BIT);\n }\n );\n\n $loc.tp$getattr = Sk.builtin.object.prototype.GenericGetAttr;\n\n $loc.bufferData = new Sk.builtin.func(\n function(self, target, data, usage) {\n self.gl.bufferData(target, data.v, usage);\n }\n );\n\n $loc.clearColor = new Sk.builtin.func(\n function(self, red, green, blue, alpha) {\n self.gl.clearColor(Sk.builtin.asnum$(red), Sk.builtin.asnum$(green), Sk.builtin.asnum$(blue), Sk.builtin.asnum$(alpha));\n }\n );\n\n $loc.getAttribLocation = new Sk.builtin.func(\n function(self, program, name) {\n return self.gl.getAttribLocation(program, name.v);\n }\n );\n\n $loc.getUniformLocation = new Sk.builtin.func(\n function(self, program, name) {\n return self.gl.getUniformLocation(program, name.v);\n }\n );\n\n $loc.shaderSource = new Sk.builtin.func(\n function(self, shader, src) {\n self.gl.shaderSource(shader, src.v);\n }\n );\n\n $loc.drawArrays = new Sk.builtin.func(\n function(self, mode, first, count) {\n self.gl.drawArrays(Sk.builtin.asnum$(mode), Sk.builtin.asnum$(first), Sk.builtin.asnum$(count));\n }\n );\n\n $loc.vertexAttribPointer = new Sk.builtin.func(\n function(self, index, size, type, normalized, stride, dunno) {\n self.gl.vertexAttribPointer(index, Sk.builtin.asnum$(size), Sk.builtin.asnum$(type), normalized, Sk.builtin.asnum$(stride), Sk.builtin.asnum$(dunno));\n }\n );\n\n $loc.viewport = new Sk.builtin.func(\n function(self, x, y, width, height) {\n self.gl.viewport(Sk.builtin.asnum$(x), Sk.builtin.asnum$(y), Sk.builtin.asnum$(width), Sk.builtin.asnum$(height));\n }\n );\n\n $loc.uniformMatrix4fv = new Sk.builtin.func(\n function(self, location, transpose, values) {\n// console.log(\"location \" + (typeof location));\n// console.log(\"transpose \" + (typeof transpose));\n// console.log(\"values.v \" + (typeof values.v));\n self.gl.uniformMatrix4fv(Sk.builtin.asnum$(location), transpose, values.v);\n }\n );\n\n $loc.setDrawFunc = new Sk.builtin.func(function(self, func) {\n var startTime = (new Date()).getTime();\n var intervalId = setInterval(\n function() {\n Sk.misceval.callsim(func, self, (new Date()).getTime() - startTime);\n }, 1000.0 / 60.0); // 60 fps\n });\n\n }, 'Context', []);\n\n mod.Float32Array = Sk.misceval.buildClass(mod, function($gbl, $loc) {\n $loc.__init__ = new Sk.builtin.func(function(self, data) {\n if (typeof data === \"number\") {\n self.v = new Float32Array(data);\n }\n else {\n self.v = new Float32Array(Sk.ffi.remapToJs(data));\n }\n });\n\n $loc.__repr__ = new Sk.builtin.func(function(self) {\n var copy = [];\n for (var i = 0; i < self.v.length; ++i) {\n copy.push(self.v[i]);\n }\n return new Sk.builtin.str(\"[\" + copy.join(', ') + \"]\");\n });\n }, 'Float32Array', []);\n\n /**\n * A 4x4 (mutable) matrix suitable for OpenGL.\n *\n * Mutability is chosen for performance.\n * The inderlying implementation is Float32Array.\n * The indexing of the elements is\n * 0 4 8 12\n * 1 5 9 13\n * 2 6 10 14\n * 3 7 11 15\n */\n mod.Matrix4x4 = Sk.misceval.buildClass(mod, function($gbl, $loc) {\n $loc.__init__ = new Sk.builtin.func(function(self, data) {\n self.v = new Float32Array(Sk.ffi.remapToJs(data));\n });\n\n $loc.identity = new Sk.builtin.func(\n function(self) {\n\n var m = self.v;\n\n m[0] = 1;\n m[1] = 0;\n m[2] = 0;\n m[3] = 0;\n\n m[4] = 0;\n m[5] = 1;\n m[6] = 0;\n m[7] = 0;\n\n m[8] = 0;\n m[9] = 0;\n m[10] = 1;\n m[11] = 0;\n\n m[12] = 0;\n m[13] = 0;\n m[14] = 0;\n m[15] = 1;\n }\n );\n\n $loc.perspective = new Sk.builtin.func(\n function(self, fov, aspect, near, far) {\n \n var t = Math.tan(Math.PI * 0.5 - 0.5 * (Sk.builtin.asnum$(fov) * Math.PI / 180));\n var a = Sk.builtin.asnum$(aspect)\n var n = Sk.builtin.asnum$(near)\n var f = Sk.builtin.asnum$(far)\n var k = 1.0 / (n - f);\n\n var m = self.v;\n\n m[0] = t / a;\n m[1] = 0;\n m[2] = 0;\n m[3] = 0;\n\n m[4] = 0;\n m[5] = t;\n m[6] = 0;\n m[7] = 0;\n\n m[8] = 0;\n m[9] = 0;\n m[10] = (n + f) * k;\n m[11] = -1;\n\n m[12] = 0;\n m[13] = 0;\n m[14] = n * f * k * 2;\n m[15] = 0;\n }\n );\n\n $loc.translate = new Sk.builtin.func(\n function(self, translation) {\n\n var m = self.v;\n var t = Sk.ffi.remapToJs(translation);\n\n m[0] = 1;\n m[1] = 0;\n m[2] = 0;\n m[3] = 0;\n\n m[4] = 0;\n m[5] = 1;\n m[6] = 0;\n m[7] = 0;\n\n m[8] = 0;\n m[9] = 0;\n m[10] = 1;\n m[11] = 0;\n\n m[12] = t[0];\n m[13] = t[1];\n m[14] = t[2];\n m[15] = 1;\n }\n );\n\n $loc.__repr__ = new Sk.builtin.func(function(self) {\n var copy = [];\n for (var i = 0; i < self.v.length; ++i) {\n copy.push(self.v[i]);\n }\n return new Sk.builtin.str(\"[\" + copy.join(', ') + \"]\");\n });\n }, 'Matrix4x4', []);\n\n return mod;\n};", "src/lib/fpformat.py": "raise NotImplementedError(\"fpformat is not yet implemented in Skulpt\")\n", "src/lib/xml/parsers/__init__.py": "raise NotImplementedError(\"parsers is not yet implemented in Skulpt\")\n", "src/lib/modulefinder.py": "raise NotImplementedError(\"modulefinder is not yet implemented in Skulpt\")\n", "src/lib/config/__init__.py": "raise NotImplementedError(\"config is not yet implemented in Skulpt\")\n", "src/lib/trace.py": "raise NotImplementedError(\"trace is not yet implemented in Skulpt\")\n", "src/lib/pythonds/trees/balance.py": "#!/bin/env python3.1\n# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005, 2010\n# \n\nfrom .bst import BinarySearchTree, TreeNode\n\nclass AVLTree(BinarySearchTree):\n '''\n Author: Brad Miller\n Date: 1/15/2005\n Description: Imlement a binary search tree with the following interface\n functions: \n __contains__(y) <==> y in x\n __getitem__(y) <==> x[y]\n __init__()\n __len__() <==> len(x)\n __setitem__(k,v) <==> x[k] = v\n clear()\n get(k)\n has_key(k)\n items() \n keys() \n values()\n put(k,v)\n '''\n\n\n def _put(self,key,val,currentNode):\n if key < currentNode.key:\n if currentNode.hasLeftChild():\n self._put(key,val,currentNode.leftChild)\n else:\n currentNode.leftChild = TreeNode(key,val,parent=currentNode)\n self.updateBalance(currentNode.leftChild)\n else:\n if currentNode.hasRightChild():\n self._put(key,val,currentNode.rightChild)\n else:\n currentNode.rightChild = TreeNode(key,val,parent=currentNode)\n self.updateBalance(currentNode.rightChild) \n\n def updateBalance(self,node):\n if node.balanceFactor > 1 or node.balanceFactor < -1:\n self.rebalance(node)\n return\n if node.parent != None:\n if node.isLeftChild():\n node.parent.balanceFactor += 1\n elif node.isRightChild():\n node.parent.balanceFactor -= 1\n\n if node.parent.balanceFactor != 0:\n self.updateBalance(node.parent)\n\n def rebalance(self,node):\n if node.balanceFactor < 0:\n if node.rightChild.balanceFactor > 0:\n # Do an LR Rotation\n self.rotateRight(node.rightChild)\n self.rotateLeft(node)\n else:\n # single left\n self.rotateLeft(node)\n elif node.balanceFactor > 0:\n if node.leftChild.balanceFactor < 0:\n # Do an RL Rotation\n self.rotateLeft(node.leftChild)\n self.rotateRight(node)\n else:\n # single right\n self.rotateRight(node)\n\n def rotateLeft(self,rotRoot):\n newRoot = rotRoot.rightChild\n rotRoot.rightChild = newRoot.leftChild\n if newRoot.leftChild != None:\n newRoot.leftChild.parent = rotRoot\n newRoot.parent = rotRoot.parent\n if rotRoot.isRoot():\n self.root = newRoot\n else:\n if rotRoot.isLeftChild():\n rotRoot.parent.leftChild = newRoot\n else:\n rotRoot.parent.rightChild = newRoot\n newRoot.leftChild = rotRoot\n rotRoot.parent = newRoot\n rotRoot.balanceFactor = rotRoot.balanceFactor + 1 - min(newRoot.balanceFactor, 0)\n newRoot.balanceFactor = newRoot.balanceFactor + 1 + max(rotRoot.balanceFactor, 0)\n\n\n def rotateRight(self,rotRoot):\n newRoot = rotRoot.leftChild\n rotRoot.leftChild = newRoot.rightChild\n if newRoot.rightChild != None:\n newRoot.rightChild.parent = rotRoot\n newRoot.parent = rotRoot.parent\n if rotRoot.isRoot():\n self.root = newRoot\n else:\n if rotRoot.isRightChild():\n rotRoot.parent.rightChild = newRoot\n else:\n rotRoot.parent.leftChild = newRoot\n newRoot.rightChild = rotRoot\n rotRoot.parent = newRoot\n rotRoot.balanceFactor = rotRoot.balanceFactor - 1 - max(newRoot.balanceFactor, 0)\n newRoot.balanceFactor = newRoot.balanceFactor - 1 + min(rotRoot.balanceFactor, 0)\n \n", "src/lib/urllib/request/__init__.js": "var $builtinmodule = function (name) {\n var request = {};\n\n\n //~ Classes .................................................................\n\n // Response class\n //\n // Response objects are returned by the request, get, post, etc.\n // methods, allowing the user to access the response text, status\n // code, and other information.\n\n // ------------------------------------------------------------\n var response = function ($gbl, $loc) {\n\n // ------------------------------------------------------------\n $loc.__init__ = new Sk.builtin.func(function (self, xhr) {\n self.data$ = xhr.responseText;\n self.lineList = self.data$.split(\"\\n\");\n self.lineList = self.lineList.slice(0, -1);\n for (var i = 0; i < self.lineList.length; i++) {\n self.lineList[i] = self.lineList[i] + '\\n';\n }\n self.currentLine = 0;\n self.pos$ = 0;\n });\n\n\n // ------------------------------------------------------------\n $loc.__str__ = new Sk.builtin.func(function (self) {\n return Sk.ffi.remapToPy('<Response>');\n });\n\n\n // ------------------------------------------------------------\n $loc.__iter__ = new Sk.builtin.func(function (self) {\n var allLines = self.lineList;\n\n return Sk.builtin.makeGenerator(function () {\n if (this.$index >= this.$lines.length) {\n return undefined;\n }\n return new Sk.builtin.str(this.$lines[this.$index++]);\n }, {\n $obj : self,\n $index: 0,\n $lines: allLines\n });\n });\n\n\n // ------------------------------------------------------------\n $loc.read = new Sk.builtin.func(function (self, size) {\n if (self.closed) {\n throw new Sk.builtin.ValueError(\"I/O operation on closed file\");\n }\n var len = self.data$.length;\n if (size === undefined) {\n size = len;\n }\n var ret = new Sk.builtin.str(self.data$.substr(self.pos$, size));\n self.pos$ += size;\n if (self.pos$ >= len) {\n self.pos$ = len;\n }\n return ret;\n });\n\n\n // ------------------------------------------------------------\n $loc.readline = new Sk.builtin.func(function (self, size) {\n var line = \"\";\n if (self.currentLine < self.lineList.length) {\n line = self.lineList[self.currentLine];\n self.currentLine++;\n }\n return new Sk.builtin.str(line);\n });\n\n\n // ------------------------------------------------------------\n $loc.readlines = new Sk.builtin.func(function (self, sizehint) {\n var arr = [];\n for (var i = self.currentLine; i < self.lineList.length; i++) {\n arr.push(new Sk.builtin.str(self.lineList[i]));\n }\n return new Sk.builtin.list(arr);\n });\n\n };\n\n request.Response =\n Sk.misceval.buildClass(request, response, 'Response', []);\n\n\n //~ Module functions ........................................................\n\n // ------------------------------------------------------------\n /**\n * Constructs and sends a Request. Returns Response object.\n *\n * http://docs.python-requests.org/en/latest/api/#requests.request\n *\n * For now, this implementation doesn't actually construct a Request\n * object; it just makes the request through jQuery.ajax and then\n * constructs a Response.\n */\n request.urlopen = new Sk.builtin.func(function (url, data, timeout) {\n var prom = new Promise(function(resolve, reject) {\n var xmlhttp = new XMLHttpRequest();\n\n xmlhttp.addEventListener(\"loadend\", function (e) {\n resolve(Sk.misceval.callsim(request.Response, xmlhttp));\n });\n\n if (!data) {\n xmlhttp.open(\"GET\", url.v);\n xmlhttp.send(null);\n } else {\n xmlhttp.open(\"POST\", url.v);\n xmlhttp.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\n xmlhttp.setRequestHeader(\"Content-length\", data.v.length);\n xmlhttp.send(data.v);\n }\n });\n\n var susp = new Sk.misceval.Suspension();\n\n susp.resume = function() {\n return resolution;\n };\n\n susp.data = {\n type: \"Sk.promise\",\n promise: prom.then(function(value) {\n resolution = value;\n return value;\n }, function(err) {\n resolution = \"\";\n return err;\n })\n };\n\n return susp;\n });\n\n\n return request;\n};\n", "src/lib/wave.py": "raise NotImplementedError(\"wave is not yet implemented in Skulpt\")\n", "src/lib/mailcap.py": "raise NotImplementedError(\"mailcap is not yet implemented in Skulpt\")\n", "src/lib/datetime.py": "\"\"\"Concrete date/time and related types -- prototype implemented in Python.\n\nSee http://www.zope.org/Members/fdrake/DateTimeWiki/FrontPage\n\nSee also http://dir.yahoo.com/Reference/calendars/\n\nFor a primer on DST, including many current DST rules, see\nhttp://webexhibits.org/daylightsaving/\n\nFor more about DST than you ever wanted to know, see\nftp://elsie.nci.nih.gov/pub/\n\nSources for time zone and DST data: http://www.twinsun.com/tz/tz-link.htm\n\nThis was originally copied from the sandbox of the CPython CVS repository.\nThanks to Tim Peters for suggesting using it.\n\nThis was then copied from PyPy v5.1.0 into Skulpt by Meredydd Luff, removing\n'from __future__ import division' (and replacing division operators accordingly)\nand pickle support (which requires 'struct', which Skulpt does not currently\n[as of 31/8/2016] have)\n\"\"\"\n\nimport time as _time\nimport math as _math\n\n_SENTINEL = object()\n\ndef _cmp(x, y):\n return 0 if x == y else 1 if x > y else -1\n\ndef _round(x):\n return int(_math.floor(x + 0.5) if x >= 0.0 else _math.ceil(x - 0.5))\n\nMINYEAR = 1\nMAXYEAR = 9999\n_MINYEARFMT = 1900\n\n_MAX_DELTA_DAYS = 999999999\n\n# Utility functions, adapted from Python's Demo/classes/Dates.py, which\n# also assumes the current Gregorian calendar indefinitely extended in\n# both directions. Difference: Dates.py calls January 1 of year 0 day\n# number 1. The code here calls January 1 of year 1 day number 1. This is\n# to match the definition of the \"proleptic Gregorian\" calendar in Dershowitz\n# and Reingold's \"Calendrical Calculations\", where it's the base calendar\n# for all computations. See the book for algorithms for converting between\n# proleptic Gregorian ordinals and many other calendar systems.\n\n_DAYS_IN_MONTH = [-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n\n_DAYS_BEFORE_MONTH = [-1]\ndbm = 0\nfor dim in _DAYS_IN_MONTH[1:]:\n _DAYS_BEFORE_MONTH.append(dbm)\n dbm += dim\ndel dbm, dim\n\ndef _is_leap(year):\n \"year -> 1 if leap year, else 0.\"\n return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)\n\ndef _days_before_year(year):\n \"year -> number of days before January 1st of year.\"\n y = year - 1\n return y*365 + y//4 - y//100 + y//400\n\ndef _days_in_month(year, month):\n \"year, month -> number of days in that month in that year.\"\n assert 1 <= month <= 12, month\n if month == 2 and _is_leap(year):\n return 29\n return _DAYS_IN_MONTH[month]\n\ndef _days_before_month(year, month):\n \"year, month -> number of days in year preceding first day of month.\"\n assert 1 <= month <= 12, 'month must be in 1..12'\n return _DAYS_BEFORE_MONTH[month] + (month > 2 and _is_leap(year))\n\ndef _ymd2ord(year, month, day):\n \"year, month, day -> ordinal, considering 01-Jan-0001 as day 1.\"\n assert 1 <= month <= 12, 'month must be in 1..12'\n dim = _days_in_month(year, month)\n assert 1 <= day <= dim, ('day must be in 1..%d' % dim)\n return (_days_before_year(year) +\n _days_before_month(year, month) +\n day)\n\n_DI400Y = _days_before_year(401) # number of days in 400 years\n_DI100Y = _days_before_year(101) # \" \" \" \" 100 \"\n_DI4Y = _days_before_year(5) # \" \" \" \" 4 \"\n\n# A 4-year cycle has an extra leap day over what we'd get from pasting\n# together 4 single years.\nassert _DI4Y == 4 * 365 + 1\n\n# Similarly, a 400-year cycle has an extra leap day over what we'd get from\n# pasting together 4 100-year cycles.\nassert _DI400Y == 4 * _DI100Y + 1\n\n# OTOH, a 100-year cycle has one fewer leap day than we'd get from\n# pasting together 25 4-year cycles.\nassert _DI100Y == 25 * _DI4Y - 1\n\n_US_PER_US = 1\n_US_PER_MS = 1000\n_US_PER_SECOND = 1000000\n_US_PER_MINUTE = 60000000\n_SECONDS_PER_DAY = 24 * 3600\n_US_PER_HOUR = 3600000000\n_US_PER_DAY = 86400000000\n_US_PER_WEEK = 604800000000\n\ndef _ord2ymd(n):\n \"ordinal -> (year, month, day), considering 01-Jan-0001 as day 1.\"\n\n # n is a 1-based index, starting at 1-Jan-1. The pattern of leap years\n # repeats exactly every 400 years. The basic strategy is to find the\n # closest 400-year boundary at or before n, then work with the offset\n # from that boundary to n. Life is much clearer if we subtract 1 from\n # n first -- then the values of n at 400-year boundaries are exactly\n # those divisible by _DI400Y:\n #\n # D M Y n n-1\n # -- --- ---- ---------- ----------------\n # 31 Dec -400 -_DI400Y -_DI400Y -1\n # 1 Jan -399 -_DI400Y +1 -_DI400Y 400-year boundary\n # ...\n # 30 Dec 000 -1 -2\n # 31 Dec 000 0 -1\n # 1 Jan 001 1 0 400-year boundary\n # 2 Jan 001 2 1\n # 3 Jan 001 3 2\n # ...\n # 31 Dec 400 _DI400Y _DI400Y -1\n # 1 Jan 401 _DI400Y +1 _DI400Y 400-year boundary\n n -= 1\n n400, n = divmod(n, _DI400Y)\n year = n400 * 400 + 1 # ..., -399, 1, 401, ...\n\n # Now n is the (non-negative) offset, in days, from January 1 of year, to\n # the desired date. Now compute how many 100-year cycles precede n.\n # Note that it's possible for n100 to equal 4! In that case 4 full\n # 100-year cycles precede the desired day, which implies the desired\n # day is December 31 at the end of a 400-year cycle.\n n100, n = divmod(n, _DI100Y)\n\n # Now compute how many 4-year cycles precede it.\n n4, n = divmod(n, _DI4Y)\n\n # And now how many single years. Again n1 can be 4, and again meaning\n # that the desired day is December 31 at the end of the 4-year cycle.\n n1, n = divmod(n, 365)\n\n year += n100 * 100 + n4 * 4 + n1\n if n1 == 4 or n100 == 4:\n assert n == 0\n return year-1, 12, 31\n\n # Now the year is correct, and n is the offset from January 1. We find\n # the month via an estimate that's either exact or one too large.\n leapyear = n1 == 3 and (n4 != 24 or n100 == 3)\n assert leapyear == _is_leap(year)\n month = (n + 50) >> 5\n preceding = _DAYS_BEFORE_MONTH[month] + (month > 2 and leapyear)\n if preceding > n: # estimate is too large\n month -= 1\n preceding -= _DAYS_IN_MONTH[month] + (month == 2 and leapyear)\n n -= preceding\n assert 0 <= n < _days_in_month(year, month)\n\n # Now the year and month are correct, and n is the offset from the\n # start of that month: we're done!\n return year, month, n+1\n\n# Month and day names. For localized versions, see the calendar module.\n_MONTHNAMES = [None, \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\",\n \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n_DAYNAMES = [None, \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"]\n\n\ndef _build_struct_time(y, m, d, hh, mm, ss, dstflag):\n wday = (_ymd2ord(y, m, d) + 6) % 7\n dnum = _days_before_month(y, m) + d\n return _time.struct_time((y, m, d, hh, mm, ss, wday, dnum, dstflag))\n\ndef _format_time(hh, mm, ss, us):\n # Skip trailing microseconds when us==0.\n result = \"%02d:%02d:%02d\" % (hh, mm, ss)\n if us:\n result += \".%06d\" % us\n return result\n\n# Correctly substitute for %z and %Z escapes in strftime formats.\ndef _wrap_strftime(object, format, timetuple):\n year = timetuple[0]\n if year < _MINYEARFMT:\n raise ValueError(\"year=%d is before %d; the datetime strftime() \"\n \"methods require year >= %d\" %\n (year, _MINYEARFMT, _MINYEARFMT))\n # Don't call utcoffset() or tzname() unless actually needed.\n freplace = None # the string to use for %f\n zreplace = None # the string to use for %z\n Zreplace = None # the string to use for %Z\n\n # Scan format for %z and %Z escapes, replacing as needed.\n newformat = []\n push = newformat.append\n i, n = 0, len(format)\n while i < n:\n ch = format[i]\n i += 1\n if ch == '%':\n if i < n:\n ch = format[i]\n i += 1\n if ch == 'f':\n if freplace is None:\n freplace = '%06d' % getattr(object,\n 'microsecond', 0)\n newformat.append(freplace)\n elif ch == 'z':\n if zreplace is None:\n zreplace = \"\"\n if hasattr(object, \"_utcoffset\"):\n offset = object._utcoffset()\n if offset is not None:\n sign = '+'\n if offset < 0:\n offset = -offset\n sign = '-'\n h, m = divmod(offset, 60)\n zreplace = '%c%02d%02d' % (sign, h, m)\n assert '%' not in zreplace\n newformat.append(zreplace)\n elif ch == 'Z':\n if Zreplace is None:\n Zreplace = \"\"\n if hasattr(object, \"tzname\"):\n s = object.tzname()\n if s is not None:\n # strftime is going to have at this: escape %\n Zreplace = s.replace('%', '%%')\n newformat.append(Zreplace)\n else:\n push('%')\n push(ch)\n else:\n push('%')\n else:\n push(ch)\n newformat = \"\".join(newformat)\n return _time.strftime(newformat, timetuple)\n\n# Just raise TypeError if the arg isn't None or a string.\ndef _check_tzname(name):\n if name is not None and not isinstance(name, str):\n raise TypeError(\"tzinfo.tzname() must return None or string, \"\n \"not '%s'\" % type(name))\n\n# name is the offset-producing method, \"utcoffset\" or \"dst\".\n# offset is what it returned.\n# If offset isn't None or timedelta, raises TypeError.\n# If offset is None, returns None.\n# Else offset is checked for being in range, and a whole # of minutes.\n# If it is, its integer value is returned. Else ValueError is raised.\ndef _check_utc_offset(name, offset):\n assert name in (\"utcoffset\", \"dst\")\n if offset is None:\n return\n if not isinstance(offset, timedelta):\n raise TypeError(\"tzinfo.%s() must return None \"\n \"or timedelta, not '%s'\" % (name, type(offset)))\n days = offset.days\n if days < -1 or days > 0:\n offset = 1440 # trigger out-of-range\n else:\n seconds = days * 86400 + offset.seconds\n minutes, seconds = divmod(seconds, 60)\n if seconds or offset.microseconds:\n raise ValueError(\"tzinfo.%s() must return a whole number \"\n \"of minutes\" % name)\n offset = minutes\n if not -1440 < offset < 1440:\n raise ValueError(\"%s()=%d, must be in -1439..1439\" % (name, offset))\n return offset\n\ndef _check_int_field(value):\n if isinstance(value, int):\n return int(value)\n if not isinstance(value, float):\n try:\n value = value.__int__()\n except AttributeError:\n pass\n else:\n if isinstance(value, int):\n return int(value)\n elif isinstance(value, long):\n return int(long(value))\n raise TypeError('__int__ method should return an integer')\n raise TypeError('an integer is required')\n raise TypeError('integer argument expected, got float')\n\ndef _check_date_fields(year, month, day):\n year = _check_int_field(year)\n month = _check_int_field(month)\n day = _check_int_field(day)\n if not MINYEAR <= year <= MAXYEAR:\n raise ValueError('year must be in %d..%d' % (MINYEAR, MAXYEAR), year)\n if not 1 <= month <= 12:\n raise ValueError('month must be in 1..12', month)\n dim = _days_in_month(year, month)\n if not 1 <= day <= dim:\n raise ValueError('day must be in 1..%d' % dim, day)\n return year, month, day\n\ndef _check_time_fields(hour, minute, second, microsecond):\n hour = _check_int_field(hour)\n minute = _check_int_field(minute)\n second = _check_int_field(second)\n microsecond = _check_int_field(microsecond)\n if not 0 <= hour <= 23:\n raise ValueError('hour must be in 0..23', hour)\n if not 0 <= minute <= 59:\n raise ValueError('minute must be in 0..59', minute)\n if not 0 <= second <= 59:\n raise ValueError('second must be in 0..59', second)\n if not 0 <= microsecond <= 999999:\n raise ValueError('microsecond must be in 0..999999', microsecond)\n return hour, minute, second, microsecond\n\ndef _check_tzinfo_arg(tz):\n if tz is not None and not isinstance(tz, tzinfo):\n raise TypeError(\"tzinfo argument must be None or of a tzinfo subclass\")\n\n\n# Notes on comparison: In general, datetime module comparison operators raise\n# TypeError when they don't know how to do a comparison themself. If they\n# returned NotImplemented instead, comparison could (silently) fall back to\n# the default compare-objects-by-comparing-their-memory-addresses strategy,\n# and that's not helpful. There are two exceptions:\n#\n# 1. For date and datetime, if the other object has a \"timetuple\" attr,\n# NotImplemented is returned. This is a hook to allow other kinds of\n# datetime-like objects a chance to intercept the comparison.\n#\n# 2. Else __eq__ and __ne__ return False and True, respectively. This is\n# so opertaions like\n#\n# x == y\n# x != y\n# x in sequence\n# x not in sequence\n# dict[x] = y\n#\n# don't raise annoying TypeErrors just because a datetime object\n# is part of a heterogeneous collection. If there's no known way to\n# compare X to a datetime, saying they're not equal is reasonable.\n\ndef _cmperror(x, y):\n raise TypeError(\"can't compare '%s' to '%s'\" % (\n type(x).__name__, type(y).__name__))\n\ndef _normalize_pair(hi, lo, factor):\n if not 0 <= lo <= factor-1:\n inc, lo = divmod(lo, factor)\n hi += inc\n return hi, lo\n\ndef _normalize_datetime(y, m, d, hh, mm, ss, us, ignore_overflow=False):\n # Normalize all the inputs, and store the normalized values.\n ss, us = _normalize_pair(ss, us, 1000000)\n mm, ss = _normalize_pair(mm, ss, 60)\n hh, mm = _normalize_pair(hh, mm, 60)\n d, hh = _normalize_pair(d, hh, 24)\n y, m, d = _normalize_date(y, m, d, ignore_overflow)\n return y, m, d, hh, mm, ss, us\n\ndef _normalize_date(year, month, day, ignore_overflow=False):\n # That was easy. Now it gets muddy: the proper range for day\n # can't be determined without knowing the correct month and year,\n # but if day is, e.g., plus or minus a million, the current month\n # and year values make no sense (and may also be out of bounds\n # themselves).\n # Saying 12 months == 1 year should be non-controversial.\n if not 1 <= month <= 12:\n year, month = _normalize_pair(year, month-1, 12)\n month += 1\n assert 1 <= month <= 12\n\n # Now only day can be out of bounds (year may also be out of bounds\n # for a datetime object, but we don't care about that here).\n # If day is out of bounds, what to do is arguable, but at least the\n # method here is principled and explainable.\n dim = _days_in_month(year, month)\n if not 1 <= day <= dim:\n # Move day-1 days from the first of the month. First try to\n # get off cheap if we're only one day out of range (adjustments\n # for timezone alone can't be worse than that).\n if day == 0: # move back a day\n month -= 1\n if month > 0:\n day = _days_in_month(year, month)\n else:\n year, month, day = year-1, 12, 31\n elif day == dim + 1: # move forward a day\n month += 1\n day = 1\n if month > 12:\n month = 1\n year += 1\n else:\n ordinal = _ymd2ord(year, month, 1) + (day - 1)\n year, month, day = _ord2ymd(ordinal)\n\n if not ignore_overflow and not MINYEAR <= year <= MAXYEAR:\n raise OverflowError(\"date value out of range\")\n return year, month, day\n\ndef _accum(tag, sofar, num, factor, leftover):\n if isinstance(num, (int, long)):\n prod = num * factor\n rsum = sofar + prod\n return rsum, leftover\n if isinstance(num, float):\n fracpart, intpart = _math.modf(num)\n prod = int(intpart) * factor\n rsum = sofar + prod\n if fracpart == 0.0:\n return rsum, leftover\n assert isinstance(factor, (int, long))\n fracpart, intpart = _math.modf(factor * fracpart)\n rsum += int(intpart)\n return rsum, leftover + fracpart\n raise TypeError(\"unsupported type for timedelta %s component: %s\" %\n (tag, type(num)))\n\nclass timedelta(object):\n \"\"\"Represent the difference between two datetime objects.\n\n Supported operators:\n\n - add, subtract timedelta\n - unary plus, minus, abs\n - compare to timedelta\n - multiply, divide by int/long\n\n In addition, datetime supports subtraction of two datetime objects\n returning a timedelta, and addition or subtraction of a datetime\n and a timedelta giving a datetime.\n\n Representation: (days, seconds, microseconds). Why? Because I\n felt like it.\n \"\"\"\n __slots__ = '_days', '_seconds', '_microseconds', '_hashcode'\n\n def __new__(cls, days=_SENTINEL, seconds=_SENTINEL, microseconds=_SENTINEL,\n milliseconds=_SENTINEL, minutes=_SENTINEL, hours=_SENTINEL, weeks=_SENTINEL):\n x = 0\n leftover = 0.0\n if microseconds is not _SENTINEL:\n x, leftover = _accum(\"microseconds\", x, microseconds, _US_PER_US, leftover)\n if milliseconds is not _SENTINEL:\n x, leftover = _accum(\"milliseconds\", x, milliseconds, _US_PER_MS, leftover)\n if seconds is not _SENTINEL:\n x, leftover = _accum(\"seconds\", x, seconds, _US_PER_SECOND, leftover)\n if minutes is not _SENTINEL:\n x, leftover = _accum(\"minutes\", x, minutes, _US_PER_MINUTE, leftover)\n if hours is not _SENTINEL:\n x, leftover = _accum(\"hours\", x, hours, _US_PER_HOUR, leftover)\n if days is not _SENTINEL:\n x, leftover = _accum(\"days\", x, days, _US_PER_DAY, leftover)\n if weeks is not _SENTINEL:\n x, leftover = _accum(\"weeks\", x, weeks, _US_PER_WEEK, leftover)\n if leftover != 0.0:\n x += _round(leftover)\n return cls._from_microseconds(x)\n\n @classmethod\n def _from_microseconds(cls, us):\n s, us = divmod(us, _US_PER_SECOND)\n d, s = divmod(s, _SECONDS_PER_DAY)\n return cls._create(d, s, us, False)\n\n @classmethod\n def _create(cls, d, s, us, normalize):\n if normalize:\n s, us = _normalize_pair(s, us, 1000000)\n d, s = _normalize_pair(d, s, 24*3600)\n\n if not -_MAX_DELTA_DAYS <= d <= _MAX_DELTA_DAYS:\n raise OverflowError(\"days=%d; must have magnitude <= %d\" % (d, _MAX_DELTA_DAYS))\n\n self = object.__new__(cls)\n self._days = d\n self._seconds = s\n self._microseconds = us\n self._hashcode = -1\n return self\n\n def _to_microseconds(self):\n return ((self._days * _SECONDS_PER_DAY + self._seconds) * _US_PER_SECOND +\n self._microseconds)\n\n def __repr__(self):\n module = \"datetime.\" if self.__class__ is timedelta else \"\"\n if self._microseconds:\n return \"%s(%d, %d, %d)\" % (module + self.__class__.__name__,\n self._days,\n self._seconds,\n self._microseconds)\n if self._seconds:\n return \"%s(%d, %d)\" % (module + self.__class__.__name__,\n self._days,\n self._seconds)\n return \"%s(%d)\" % (module + self.__class__.__name__, self._days)\n\n def __str__(self):\n mm, ss = divmod(self._seconds, 60)\n hh, mm = divmod(mm, 60)\n s = \"%d:%02d:%02d\" % (hh, mm, ss)\n if self._days:\n def plural(n):\n return n, abs(n) != 1 and \"s\" or \"\"\n s = (\"%d day%s, \" % plural(self._days)) + s\n if self._microseconds:\n s = s + \".%06d\" % self._microseconds\n return s\n\n def total_seconds(self):\n \"\"\"Total seconds in the duration.\"\"\"\n return self._to_microseconds() / 10.0**6\n\n # Read-only field accessors\n @property\n def days(self):\n \"\"\"days\"\"\"\n return self._days\n\n @property\n def seconds(self):\n \"\"\"seconds\"\"\"\n return self._seconds\n\n @property\n def microseconds(self):\n \"\"\"microseconds\"\"\"\n return self._microseconds\n\n def __add__(self, other):\n if isinstance(other, timedelta):\n # for CPython compatibility, we cannot use\n # our __class__ here, but need a real timedelta\n return timedelta._create(self._days + other._days,\n self._seconds + other._seconds,\n self._microseconds + other._microseconds,\n True)\n return NotImplemented\n\n def __sub__(self, other):\n if isinstance(other, timedelta):\n # for CPython compatibility, we cannot use\n # our __class__ here, but need a real timedelta\n return timedelta._create(self._days - other._days,\n self._seconds - other._seconds,\n self._microseconds - other._microseconds,\n True)\n return NotImplemented\n\n def __neg__(self):\n # for CPython compatibility, we cannot use\n # our __class__ here, but need a real timedelta\n return timedelta._create(-self._days,\n -self._seconds,\n -self._microseconds,\n True)\n\n def __pos__(self):\n # for CPython compatibility, we cannot use\n # our __class__ here, but need a real timedelta\n return timedelta._create(self._days,\n self._seconds,\n self._microseconds,\n False)\n\n def __abs__(self):\n if self._days < 0:\n return -self\n else:\n return self\n\n def __mul__(self, other):\n if not isinstance(other, (int, long)):\n return NotImplemented\n usec = self._to_microseconds()\n return timedelta._from_microseconds(usec * other)\n\n __rmul__ = __mul__\n\n def __div__(self, other):\n if not isinstance(other, (int, long)):\n return NotImplemented\n usec = self._to_microseconds()\n return timedelta._from_microseconds(usec // other)\n\n __floordiv__ = __div__\n\n # Comparisons of timedelta objects with other.\n\n def __eq__(self, other):\n if isinstance(other, timedelta):\n return self._cmp(other) == 0\n else:\n return False\n\n def __ne__(self, other):\n if isinstance(other, timedelta):\n return self._cmp(other) != 0\n else:\n return True\n\n def __le__(self, other):\n if isinstance(other, timedelta):\n return self._cmp(other) <= 0\n else:\n _cmperror(self, other)\n\n def __lt__(self, other):\n if isinstance(other, timedelta):\n return self._cmp(other) < 0\n else:\n _cmperror(self, other)\n\n def __ge__(self, other):\n if isinstance(other, timedelta):\n return self._cmp(other) >= 0\n else:\n _cmperror(self, other)\n\n def __gt__(self, other):\n if isinstance(other, timedelta):\n return self._cmp(other) > 0\n else:\n _cmperror(self, other)\n\n def _cmp(self, other):\n assert isinstance(other, timedelta)\n return _cmp(self._getstate(), other._getstate())\n\n def __hash__(self):\n if self._hashcode == -1:\n self._hashcode = hash(self._getstate())\n return self._hashcode\n\n def __nonzero__(self):\n return (self._days != 0 or\n self._seconds != 0 or\n self._microseconds != 0)\n\ntimedelta.min = timedelta(-_MAX_DELTA_DAYS)\ntimedelta.max = timedelta(_MAX_DELTA_DAYS, 24*3600-1, 1000000-1)\ntimedelta.resolution = timedelta(microseconds=1)\n\nclass date(object):\n \"\"\"Concrete date type.\n\n Constructors:\n\n __new__()\n fromtimestamp()\n today()\n fromordinal()\n\n Operators:\n\n __repr__, __str__\n __cmp__, __hash__\n __add__, __radd__, __sub__ (add/radd only with timedelta arg)\n\n Methods:\n\n timetuple()\n toordinal()\n weekday()\n isoweekday(), isocalendar(), isoformat()\n ctime()\n strftime()\n\n Properties (readonly):\n year, month, day\n \"\"\"\n __slots__ = '_year', '_month', '_day', '_hashcode'\n\n def __new__(cls, year, month=None, day=None):\n \"\"\"Constructor.\n\n Arguments:\n\n year, month, day (required, base 1)\n \"\"\"\n year, month, day = _check_date_fields(year, month, day)\n self = object.__new__(cls)\n self._year = year\n self._month = month\n self._day = day\n self._hashcode = -1\n return self\n\n # Additional constructors\n\n @classmethod\n def fromtimestamp(cls, t):\n \"Construct a date from a POSIX timestamp (like time.time()).\"\n y, m, d, hh, mm, ss, weekday, jday, dst = _time.localtime(t)\n return cls(y, m, d)\n\n @classmethod\n def today(cls):\n \"Construct a date from time.time().\"\n t = _time.time()\n return cls.fromtimestamp(t)\n\n @classmethod\n def fromordinal(cls, n):\n \"\"\"Contruct a date from a proleptic Gregorian ordinal.\n\n January 1 of year 1 is day 1. Only the year, month and day are\n non-zero in the result.\n \"\"\"\n y, m, d = _ord2ymd(n)\n return cls(y, m, d)\n\n # Conversions to string\n\n def __repr__(self):\n \"\"\"Convert to formal string, for repr().\n\n >>> dt = datetime(2010, 1, 1)\n >>> repr(dt)\n 'datetime.datetime(2010, 1, 1, 0, 0)'\n\n >>> dt = datetime(2010, 1, 1, tzinfo=timezone.utc)\n >>> repr(dt)\n 'datetime.datetime(2010, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)'\n \"\"\"\n module = \"datetime.\" if self.__class__ is date else \"\"\n return \"%s(%d, %d, %d)\" % (module + self.__class__.__name__,\n self._year,\n self._month,\n self._day)\n\n # XXX These shouldn't depend on time.localtime(), because that\n # clips the usable dates to [1970 .. 2038). At least ctime() is\n # easily done without using strftime() -- that's better too because\n # strftime(\"%c\", ...) is locale specific.\n\n def ctime(self):\n \"Return ctime() style string.\"\n weekday = self.toordinal() % 7 or 7\n return \"%s %s %2d 00:00:00 %04d\" % (\n _DAYNAMES[weekday],\n _MONTHNAMES[self._month],\n self._day, self._year)\n\n def strftime(self, format):\n \"Format using strftime().\"\n return _wrap_strftime(self, format, self.timetuple())\n\n def __format__(self, fmt):\n if not isinstance(fmt, (str, unicode)):\n raise ValueError(\"__format__ expects str or unicode, not %s\" %\n fmt.__class__.__name__)\n if len(fmt) != 0:\n return self.strftime(fmt)\n return str(self)\n\n def isoformat(self):\n \"\"\"Return the date formatted according to ISO.\n\n This is 'YYYY-MM-DD'.\n\n References:\n - http://www.w3.org/TR/NOTE-datetime\n - http://www.cl.cam.ac.uk/~mgk25/iso-time.html\n \"\"\"\n return \"%04d-%02d-%02d\" % (self._year, self._month, self._day)\n\n __str__ = isoformat\n\n # Read-only field accessors\n @property\n def year(self):\n \"\"\"year (1-9999)\"\"\"\n return self._year\n\n @property\n def month(self):\n \"\"\"month (1-12)\"\"\"\n return self._month\n\n @property\n def day(self):\n \"\"\"day (1-31)\"\"\"\n return self._day\n\n # Standard conversions, __cmp__, __hash__ (and helpers)\n\n def timetuple(self):\n \"Return local time tuple compatible with time.localtime().\"\n return _build_struct_time(self._year, self._month, self._day,\n 0, 0, 0, -1)\n\n def toordinal(self):\n \"\"\"Return proleptic Gregorian ordinal for the year, month and day.\n\n January 1 of year 1 is day 1. Only the year, month and day values\n contribute to the result.\n \"\"\"\n return _ymd2ord(self._year, self._month, self._day)\n\n def replace(self, year=None, month=None, day=None):\n \"\"\"Return a new date with new values for the specified fields.\"\"\"\n if year is None:\n year = self._year\n if month is None:\n month = self._month\n if day is None:\n day = self._day\n return date(year, month, day)\n\n # Comparisons of date objects with other.\n\n def __eq__(self, other):\n if isinstance(other, date):\n return self._cmp(other) == 0\n elif hasattr(other, \"timetuple\"):\n return NotImplemented\n else:\n return False\n\n def __ne__(self, other):\n if isinstance(other, date):\n return self._cmp(other) != 0\n elif hasattr(other, \"timetuple\"):\n return NotImplemented\n else:\n return True\n\n def __le__(self, other):\n if isinstance(other, date):\n return self._cmp(other) <= 0\n elif hasattr(other, \"timetuple\"):\n return NotImplemented\n else:\n _cmperror(self, other)\n\n def __lt__(self, other):\n if isinstance(other, date):\n return self._cmp(other) < 0\n elif hasattr(other, \"timetuple\"):\n return NotImplemented\n else:\n _cmperror(self, other)\n\n def __ge__(self, other):\n if isinstance(other, date):\n return self._cmp(other) >= 0\n elif hasattr(other, \"timetuple\"):\n return NotImplemented\n else:\n _cmperror(self, other)\n\n def __gt__(self, other):\n if isinstance(other, date):\n return self._cmp(other) > 0\n elif hasattr(other, \"timetuple\"):\n return NotImplemented\n else:\n _cmperror(self, other)\n\n def _cmp(self, other):\n assert isinstance(other, date)\n y, m, d = self._year, self._month, self._day\n y2, m2, d2 = other._year, other._month, other._day\n return _cmp((y, m, d), (y2, m2, d2))\n\n def __hash__(self):\n \"Hash.\"\n if self._hashcode == -1:\n self._hashcode = hash(self._getstate())\n return self._hashcode\n\n # Computations\n\n def _add_timedelta(self, other, factor):\n y, m, d = _normalize_date(\n self._year,\n self._month,\n self._day + other.days * factor)\n return date(y, m, d)\n\n def __add__(self, other):\n \"Add a date to a timedelta.\"\n if isinstance(other, timedelta):\n return self._add_timedelta(other, 1)\n return NotImplemented\n\n __radd__ = __add__\n\n def __sub__(self, other):\n \"\"\"Subtract two dates, or a date and a timedelta.\"\"\"\n if isinstance(other, date):\n days1 = self.toordinal()\n days2 = other.toordinal()\n return timedelta._create(days1 - days2, 0, 0, False)\n if isinstance(other, timedelta):\n return self._add_timedelta(other, -1)\n return NotImplemented\n\n def weekday(self):\n \"Return day of the week, where Monday == 0 ... Sunday == 6.\"\n return (self.toordinal() + 6) % 7\n\n # Day-of-the-week and week-of-the-year, according to ISO\n\n def isoweekday(self):\n \"Return day of the week, where Monday == 1 ... Sunday == 7.\"\n # 1-Jan-0001 is a Monday\n return self.toordinal() % 7 or 7\n\n def isocalendar(self):\n \"\"\"Return a 3-tuple containing ISO year, week number, and weekday.\n\n The first ISO week of the year is the (Mon-Sun) week\n containing the year's first Thursday; everything else derives\n from that.\n\n The first week is 1; Monday is 1 ... Sunday is 7.\n\n ISO calendar algorithm taken from\n http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm\n \"\"\"\n year = self._year\n week1monday = _isoweek1monday(year)\n today = _ymd2ord(self._year, self._month, self._day)\n # Internally, week and day have origin 0\n week, day = divmod(today - week1monday, 7)\n if week < 0:\n year -= 1\n week1monday = _isoweek1monday(year)\n week, day = divmod(today - week1monday, 7)\n elif week >= 52:\n if today >= _isoweek1monday(year+1):\n year += 1\n week = 0\n return year, week+1, day+1\n\n_date_class = date # so functions w/ args named \"date\" can get at the class\n\ndate.min = date(1, 1, 1)\ndate.max = date(9999, 12, 31)\ndate.resolution = timedelta(days=1)\n\nclass tzinfo(object):\n \"\"\"Abstract base class for time zone info classes.\n\n Subclasses must override the name(), utcoffset() and dst() methods.\n \"\"\"\n __slots__ = ()\n\n def tzname(self, dt):\n \"datetime -> string name of time zone.\"\n raise NotImplementedError(\"tzinfo subclass must override tzname()\")\n\n def utcoffset(self, dt):\n \"datetime -> minutes east of UTC (negative for west of UTC)\"\n raise NotImplementedError(\"tzinfo subclass must override utcoffset()\")\n\n def dst(self, dt):\n \"\"\"datetime -> DST offset in minutes east of UTC.\n\n Return 0 if DST not in effect. utcoffset() must include the DST\n offset.\n \"\"\"\n raise NotImplementedError(\"tzinfo subclass must override dst()\")\n\n def fromutc(self, dt):\n \"datetime in UTC -> datetime in local time.\"\n\n if not isinstance(dt, datetime):\n raise TypeError(\"fromutc() requires a datetime argument\")\n if dt.tzinfo is not self:\n raise ValueError(\"dt.tzinfo is not self\")\n\n dtoff = dt.utcoffset()\n if dtoff is None:\n raise ValueError(\"fromutc() requires a non-None utcoffset() \"\n \"result\")\n\n # See the long comment block at the end of this file for an\n # explanation of this algorithm.\n dtdst = dt.dst()\n if dtdst is None:\n raise ValueError(\"fromutc() requires a non-None dst() result\")\n delta = dtoff - dtdst\n if delta:\n dt = dt + delta\n dtdst = dt.dst()\n if dtdst is None:\n raise ValueError(\"fromutc(): dt.dst gave inconsistent \"\n \"results; cannot convert\")\n if dtdst:\n return dt + dtdst\n else:\n return dt\n\n_tzinfo_class = tzinfo\n\nclass time(object):\n \"\"\"Time with time zone.\n\n Constructors:\n\n __new__()\n\n Operators:\n\n __repr__, __str__\n __cmp__, __hash__\n\n Methods:\n\n strftime()\n isoformat()\n utcoffset()\n tzname()\n dst()\n\n Properties (readonly):\n hour, minute, second, microsecond, tzinfo\n \"\"\"\n __slots__ = '_hour', '_minute', '_second', '_microsecond', '_tzinfo', '_hashcode'\n\n def __new__(cls, hour=0, minute=0, second=0, microsecond=0, tzinfo=None):\n \"\"\"Constructor.\n\n Arguments:\n\n hour, minute (required)\n second, microsecond (default to zero)\n tzinfo (default to None)\n \"\"\"\n hour, minute, second, microsecond = _check_time_fields(\n hour, minute, second, microsecond)\n _check_tzinfo_arg(tzinfo)\n self = object.__new__(cls)\n self._hour = hour\n self._minute = minute\n self._second = second\n self._microsecond = microsecond\n self._tzinfo = tzinfo\n self._hashcode = -1\n return self\n\n # Read-only field accessors\n @property\n def hour(self):\n \"\"\"hour (0-23)\"\"\"\n return self._hour\n\n @property\n def minute(self):\n \"\"\"minute (0-59)\"\"\"\n return self._minute\n\n @property\n def second(self):\n \"\"\"second (0-59)\"\"\"\n return self._second\n\n @property\n def microsecond(self):\n \"\"\"microsecond (0-999999)\"\"\"\n return self._microsecond\n\n @property\n def tzinfo(self):\n \"\"\"timezone info object\"\"\"\n return self._tzinfo\n\n # Standard conversions, __hash__ (and helpers)\n\n # Comparisons of time objects with other.\n\n def __eq__(self, other):\n if isinstance(other, time):\n return self._cmp(other) == 0\n else:\n return False\n\n def __ne__(self, other):\n if isinstance(other, time):\n return self._cmp(other) != 0\n else:\n return True\n\n def __le__(self, other):\n if isinstance(other, time):\n return self._cmp(other) <= 0\n else:\n _cmperror(self, other)\n\n def __lt__(self, other):\n if isinstance(other, time):\n return self._cmp(other) < 0\n else:\n _cmperror(self, other)\n\n def __ge__(self, other):\n if isinstance(other, time):\n return self._cmp(other) >= 0\n else:\n _cmperror(self, other)\n\n def __gt__(self, other):\n if isinstance(other, time):\n return self._cmp(other) > 0\n else:\n _cmperror(self, other)\n\n def _cmp(self, other):\n assert isinstance(other, time)\n mytz = self._tzinfo\n ottz = other._tzinfo\n myoff = otoff = None\n\n if mytz is ottz:\n base_compare = True\n else:\n myoff = self._utcoffset()\n otoff = other._utcoffset()\n base_compare = myoff == otoff\n\n if base_compare:\n return _cmp((self._hour, self._minute, self._second,\n self._microsecond),\n (other._hour, other._minute, other._second,\n other._microsecond))\n if myoff is None or otoff is None:\n raise TypeError(\"can't compare offset-naive and offset-aware times\")\n myhhmm = self._hour * 60 + self._minute - myoff\n othhmm = other._hour * 60 + other._minute - otoff\n return _cmp((myhhmm, self._second, self._microsecond),\n (othhmm, other._second, other._microsecond))\n\n def __hash__(self):\n \"\"\"Hash.\"\"\"\n if self._hashcode == -1:\n tzoff = self._utcoffset()\n if not tzoff: # zero or None\n self._hashcode = hash(self._getstate()[0])\n else:\n h, m = divmod(self.hour * 60 + self.minute - tzoff, 60)\n if 0 <= h < 24:\n self._hashcode = hash(time(h, m, self.second, self.microsecond))\n else:\n self._hashcode = hash((h, m, self.second, self.microsecond))\n return self._hashcode\n\n # Conversion to string\n\n def _tzstr(self, sep=\":\"):\n \"\"\"Return formatted timezone offset (+xx:xx) or None.\"\"\"\n off = self._utcoffset()\n if off is not None:\n if off < 0:\n sign = \"-\"\n off = -off\n else:\n sign = \"+\"\n hh, mm = divmod(off, 60)\n assert 0 <= hh < 24\n off = \"%s%02d%s%02d\" % (sign, hh, sep, mm)\n return off\n\n def __repr__(self):\n \"\"\"Convert to formal string, for repr().\"\"\"\n if self._microsecond != 0:\n s = \", %d, %d\" % (self._second, self._microsecond)\n elif self._second != 0:\n s = \", %d\" % self._second\n else:\n s = \"\"\n module = \"datetime.\" if self.__class__ is time else \"\"\n s= \"%s(%d, %d%s)\" % (module + self.__class__.__name__,\n self._hour, self._minute, s)\n if self._tzinfo is not None:\n assert s[-1:] == \")\"\n s = s[:-1] + \", tzinfo=%r\" % self._tzinfo + \")\"\n return s\n\n def isoformat(self):\n \"\"\"Return the time formatted according to ISO.\n\n This is 'HH:MM:SS.mmmmmm+zz:zz', or 'HH:MM:SS+zz:zz' if\n self.microsecond == 0.\n \"\"\"\n s = _format_time(self._hour, self._minute, self._second,\n self._microsecond)\n tz = self._tzstr()\n if tz:\n s += tz\n return s\n\n __str__ = isoformat\n\n def strftime(self, format):\n \"\"\"Format using strftime(). The date part of the timestamp passed\n to underlying strftime should not be used.\n \"\"\"\n # The year must be >= _MINYEARFMT else Python's strftime implementation\n # can raise a bogus exception.\n timetuple = (1900, 1, 1,\n self._hour, self._minute, self._second,\n 0, 1, -1)\n return _wrap_strftime(self, format, timetuple)\n\n def __format__(self, fmt):\n if not isinstance(fmt, (str, unicode)):\n raise ValueError(\"__format__ expects str or unicode, not %s\" %\n fmt.__class__.__name__)\n if len(fmt) != 0:\n return self.strftime(fmt)\n return str(self)\n\n # Timezone functions\n\n def utcoffset(self):\n \"\"\"Return the timezone offset in minutes east of UTC (negative west of\n UTC).\"\"\"\n if self._tzinfo is None:\n return None\n offset = self._tzinfo.utcoffset(None)\n offset = _check_utc_offset(\"utcoffset\", offset)\n if offset is not None:\n offset = timedelta._create(0, offset * 60, 0, True)\n return offset\n\n # Return an integer (or None) instead of a timedelta (or None).\n def _utcoffset(self):\n if self._tzinfo is None:\n return None\n offset = self._tzinfo.utcoffset(None)\n offset = _check_utc_offset(\"utcoffset\", offset)\n return offset\n\n def tzname(self):\n \"\"\"Return the timezone name.\n\n Note that the name is 100% informational -- there's no requirement that\n it mean anything in particular. For example, \"GMT\", \"UTC\", \"-500\",\n \"-5:00\", \"EDT\", \"US/Eastern\", \"America/New York\" are all valid replies.\n \"\"\"\n if self._tzinfo is None:\n return None\n name = self._tzinfo.tzname(None)\n _check_tzname(name)\n return name\n\n def dst(self):\n \"\"\"Return 0 if DST is not in effect, or the DST offset (in minutes\n eastward) if DST is in effect.\n\n This is purely informational; the DST offset has already been added to\n the UTC offset returned by utcoffset() if applicable, so there's no\n need to consult dst() unless you're interested in displaying the DST\n info.\n \"\"\"\n if self._tzinfo is None:\n return None\n offset = self._tzinfo.dst(None)\n offset = _check_utc_offset(\"dst\", offset)\n if offset is not None:\n offset = timedelta._create(0, offset * 60, 0, True)\n return offset\n\n # Return an integer (or None) instead of a timedelta (or None).\n def _dst(self):\n if self._tzinfo is None:\n return None\n offset = self._tzinfo.dst(None)\n offset = _check_utc_offset(\"dst\", offset)\n return offset\n\n def replace(self, hour=None, minute=None, second=None, microsecond=None,\n tzinfo=True):\n \"\"\"Return a new time with new values for the specified fields.\"\"\"\n if hour is None:\n hour = self.hour\n if minute is None:\n minute = self.minute\n if second is None:\n second = self.second\n if microsecond is None:\n microsecond = self.microsecond\n if tzinfo is True:\n tzinfo = self.tzinfo\n return time(hour, minute, second, microsecond, tzinfo)\n\n def __nonzero__(self):\n if self.second or self.microsecond:\n return True\n offset = self._utcoffset() or 0\n return self.hour * 60 + self.minute != offset\n\n_time_class = time # so functions w/ args named \"time\" can get at the class\n\ntime.min = time(0, 0, 0)\ntime.max = time(23, 59, 59, 999999)\ntime.resolution = timedelta(microseconds=1)\n\nclass datetime(date):\n \"\"\"datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])\n\n The year, month and day arguments are required. tzinfo may be None, or an\n instance of a tzinfo subclass. The remaining arguments may be ints or longs.\n \"\"\"\n __slots__ = date.__slots__ + time.__slots__\n\n def __new__(cls, year, month=None, day=None, hour=0, minute=0, second=0,\n microsecond=0, tzinfo=None):\n year, month, day = _check_date_fields(year, month, day)\n hour, minute, second, microsecond = _check_time_fields(\n hour, minute, second, microsecond)\n _check_tzinfo_arg(tzinfo)\n self = object.__new__(cls)\n self._year = year\n self._month = month\n self._day = day\n self._hour = hour\n self._minute = minute\n self._second = second\n self._microsecond = microsecond\n self._tzinfo = tzinfo\n self._hashcode = -1\n return self\n\n # Read-only field accessors\n @property\n def hour(self):\n \"\"\"hour (0-23)\"\"\"\n return self._hour\n\n @property\n def minute(self):\n \"\"\"minute (0-59)\"\"\"\n return self._minute\n\n @property\n def second(self):\n \"\"\"second (0-59)\"\"\"\n return self._second\n\n @property\n def microsecond(self):\n \"\"\"microsecond (0-999999)\"\"\"\n return self._microsecond\n\n @property\n def tzinfo(self):\n \"\"\"timezone info object\"\"\"\n return self._tzinfo\n\n @classmethod\n def fromtimestamp(cls, timestamp, tz=None):\n \"\"\"Construct a datetime from a POSIX timestamp (like time.time()).\n\n A timezone info object may be passed in as well.\n \"\"\"\n _check_tzinfo_arg(tz)\n converter = _time.localtime if tz is None else _time.gmtime\n self = cls._from_timestamp(converter, timestamp, tz)\n if tz is not None:\n self = tz.fromutc(self)\n return self\n\n @classmethod\n def utcfromtimestamp(cls, t):\n \"Construct a UTC datetime from a POSIX timestamp (like time.time()).\"\n return cls._from_timestamp(_time.gmtime, t, None)\n\n @classmethod\n def _from_timestamp(cls, converter, timestamp, tzinfo):\n t_full = timestamp\n timestamp = int(_math.floor(timestamp))\n frac = t_full - timestamp\n us = _round(frac * 1e6)\n\n # If timestamp is less than one microsecond smaller than a\n # full second, us can be rounded up to 1000000. In this case,\n # roll over to seconds, otherwise, ValueError is raised\n # by the constructor.\n if us == 1000000:\n timestamp += 1\n us = 0\n y, m, d, hh, mm, ss, weekday, jday, dst = converter(timestamp)\n ss = min(ss, 59) # clamp out leap seconds if the platform has them\n return cls(y, m, d, hh, mm, ss, us, tzinfo)\n\n @classmethod\n def now(cls, tz=None):\n \"Construct a datetime from time.time() and optional time zone info.\"\n t = _time.time()\n return cls.fromtimestamp(t, tz)\n\n @classmethod\n def utcnow(cls):\n \"Construct a UTC datetime from time.time().\"\n t = _time.time()\n return cls.utcfromtimestamp(t)\n\n @classmethod\n def combine(cls, date, time):\n \"Construct a datetime from a given date and a given time.\"\n if not isinstance(date, _date_class):\n raise TypeError(\"date argument must be a date instance\")\n if not isinstance(time, _time_class):\n raise TypeError(\"time argument must be a time instance\")\n return cls(date.year, date.month, date.day,\n time.hour, time.minute, time.second, time.microsecond,\n time.tzinfo)\n\n def timetuple(self):\n \"Return local time tuple compatible with time.localtime().\"\n dst = self._dst()\n if dst is None:\n dst = -1\n elif dst:\n dst = 1\n return _build_struct_time(self.year, self.month, self.day,\n self.hour, self.minute, self.second,\n dst)\n\n def utctimetuple(self):\n \"Return UTC time tuple compatible with time.gmtime().\"\n y, m, d = self.year, self.month, self.day\n hh, mm, ss = self.hour, self.minute, self.second\n offset = self._utcoffset()\n if offset: # neither None nor 0\n mm -= offset\n y, m, d, hh, mm, ss, _ = _normalize_datetime(\n y, m, d, hh, mm, ss, 0, ignore_overflow=True)\n return _build_struct_time(y, m, d, hh, mm, ss, 0)\n\n def date(self):\n \"Return the date part.\"\n return date(self._year, self._month, self._day)\n\n def time(self):\n \"Return the time part, with tzinfo None.\"\n return time(self.hour, self.minute, self.second, self.microsecond)\n\n def timetz(self):\n \"Return the time part, with same tzinfo.\"\n return time(self.hour, self.minute, self.second, self.microsecond,\n self._tzinfo)\n\n def replace(self, year=None, month=None, day=None, hour=None,\n minute=None, second=None, microsecond=None, tzinfo=True):\n \"\"\"Return a new datetime with new values for the specified fields.\"\"\"\n if year is None:\n year = self.year\n if month is None:\n month = self.month\n if day is None:\n day = self.day\n if hour is None:\n hour = self.hour\n if minute is None:\n minute = self.minute\n if second is None:\n second = self.second\n if microsecond is None:\n microsecond = self.microsecond\n if tzinfo is True:\n tzinfo = self.tzinfo\n return datetime(year, month, day, hour, minute, second, microsecond,\n tzinfo)\n\n def astimezone(self, tz):\n if not isinstance(tz, tzinfo):\n raise TypeError(\"tz argument must be an instance of tzinfo\")\n\n mytz = self.tzinfo\n if mytz is None:\n raise ValueError(\"astimezone() requires an aware datetime\")\n\n if tz is mytz:\n return self\n\n # Convert self to UTC, and attach the new time zone object.\n myoffset = self.utcoffset()\n if myoffset is None:\n raise ValueError(\"astimezone() requires an aware datetime\")\n utc = (self - myoffset).replace(tzinfo=tz)\n\n # Convert from UTC to tz's local time.\n return tz.fromutc(utc)\n\n # Ways to produce a string.\n\n def ctime(self):\n \"Return ctime() style string.\"\n weekday = self.toordinal() % 7 or 7\n return \"%s %s %2d %02d:%02d:%02d %04d\" % (\n _DAYNAMES[weekday],\n _MONTHNAMES[self._month],\n self._day,\n self._hour, self._minute, self._second,\n self._year)\n\n def isoformat(self, sep='T'):\n \"\"\"Return the time formatted according to ISO.\n\n This is 'YYYY-MM-DD HH:MM:SS.mmmmmm', or 'YYYY-MM-DD HH:MM:SS' if\n self.microsecond == 0.\n\n If self.tzinfo is not None, the UTC offset is also attached, giving\n 'YYYY-MM-DD HH:MM:SS.mmmmmm+HH:MM' or 'YYYY-MM-DD HH:MM:SS+HH:MM'.\n\n Optional argument sep specifies the separator between date and\n time, default 'T'.\n \"\"\"\n s = (\"%04d-%02d-%02d%c\" % (self._year, self._month, self._day, sep) +\n _format_time(self._hour, self._minute, self._second,\n self._microsecond))\n off = self._utcoffset()\n if off is not None:\n if off < 0:\n sign = \"-\"\n off = -off\n else:\n sign = \"+\"\n hh, mm = divmod(off, 60)\n s += \"%s%02d:%02d\" % (sign, hh, mm)\n return s\n\n def __repr__(self):\n \"\"\"Convert to formal string, for repr().\"\"\"\n L = [self._year, self._month, self._day, # These are never zero\n self._hour, self._minute, self._second, self._microsecond]\n if L[-1] == 0:\n del L[-1]\n if L[-1] == 0:\n del L[-1]\n s = \", \".join(map(str, L))\n module = \"datetime.\" if self.__class__ is datetime else \"\"\n s = \"%s(%s)\" % (module + self.__class__.__name__, s)\n if self._tzinfo is not None:\n assert s[-1:] == \")\"\n s = s[:-1] + \", tzinfo=%r\" % self._tzinfo + \")\"\n return s\n\n def __str__(self):\n \"Convert to string, for str().\"\n return self.isoformat(sep=' ')\n\n @classmethod\n def strptime(cls, date_string, format):\n 'string, format -> new datetime parsed from a string (like time.strptime()).'\n from _strptime import _strptime\n # _strptime._strptime returns a two-element tuple. The first\n # element is a time.struct_time object. The second is the\n # microseconds (which are not defined for time.struct_time).\n struct, micros = _strptime(date_string, format)\n return cls(*(struct[0:6] + (micros,)))\n\n def utcoffset(self):\n \"\"\"Return the timezone offset in minutes east of UTC (negative west of\n UTC).\"\"\"\n if self._tzinfo is None:\n return None\n offset = self._tzinfo.utcoffset(self)\n offset = _check_utc_offset(\"utcoffset\", offset)\n if offset is not None:\n offset = timedelta._create(0, offset * 60, 0, True)\n return offset\n\n # Return an integer (or None) instead of a timedelta (or None).\n def _utcoffset(self):\n if self._tzinfo is None:\n return None\n offset = self._tzinfo.utcoffset(self)\n offset = _check_utc_offset(\"utcoffset\", offset)\n return offset\n\n def tzname(self):\n \"\"\"Return the timezone name.\n\n Note that the name is 100% informational -- there's no requirement that\n it mean anything in particular. For example, \"GMT\", \"UTC\", \"-500\",\n \"-5:00\", \"EDT\", \"US/Eastern\", \"America/New York\" are all valid replies.\n \"\"\"\n if self._tzinfo is None:\n return None\n name = self._tzinfo.tzname(self)\n _check_tzname(name)\n return name\n\n def dst(self):\n \"\"\"Return 0 if DST is not in effect, or the DST offset (in minutes\n eastward) if DST is in effect.\n\n This is purely informational; the DST offset has already been added to\n the UTC offset returned by utcoffset() if applicable, so there's no\n need to consult dst() unless you're interested in displaying the DST\n info.\n \"\"\"\n if self._tzinfo is None:\n return None\n offset = self._tzinfo.dst(self)\n offset = _check_utc_offset(\"dst\", offset)\n if offset is not None:\n offset = timedelta._create(0, offset * 60, 0, True)\n return offset\n\n # Return an integer (or None) instead of a timedelta (or None).\n def _dst(self):\n if self._tzinfo is None:\n return None\n offset = self._tzinfo.dst(self)\n offset = _check_utc_offset(\"dst\", offset)\n return offset\n\n # Comparisons of datetime objects with other.\n\n def __eq__(self, other):\n if isinstance(other, datetime):\n return self._cmp(other) == 0\n elif hasattr(other, \"timetuple\") and not isinstance(other, date):\n return NotImplemented\n else:\n return False\n\n def __ne__(self, other):\n if isinstance(other, datetime):\n return self._cmp(other) != 0\n elif hasattr(other, \"timetuple\") and not isinstance(other, date):\n return NotImplemented\n else:\n return True\n\n def __le__(self, other):\n if isinstance(other, datetime):\n return self._cmp(other) <= 0\n elif hasattr(other, \"timetuple\") and not isinstance(other, date):\n return NotImplemented\n else:\n _cmperror(self, other)\n\n def __lt__(self, other):\n if isinstance(other, datetime):\n return self._cmp(other) < 0\n elif hasattr(other, \"timetuple\") and not isinstance(other, date):\n return NotImplemented\n else:\n _cmperror(self, other)\n\n def __ge__(self, other):\n if isinstance(other, datetime):\n return self._cmp(other) >= 0\n elif hasattr(other, \"timetuple\") and not isinstance(other, date):\n return NotImplemented\n else:\n _cmperror(self, other)\n\n def __gt__(self, other):\n if isinstance(other, datetime):\n return self._cmp(other) > 0\n elif hasattr(other, \"timetuple\") and not isinstance(other, date):\n return NotImplemented\n else:\n _cmperror(self, other)\n\n def _cmp(self, other):\n assert isinstance(other, datetime)\n mytz = self._tzinfo\n ottz = other._tzinfo\n myoff = otoff = None\n\n if mytz is ottz:\n base_compare = True\n else:\n if mytz is not None:\n myoff = self._utcoffset()\n if ottz is not None:\n otoff = other._utcoffset()\n base_compare = myoff == otoff\n\n if base_compare:\n return _cmp((self._year, self._month, self._day,\n self._hour, self._minute, self._second,\n self._microsecond),\n (other._year, other._month, other._day,\n other._hour, other._minute, other._second,\n other._microsecond))\n if myoff is None or otoff is None:\n raise TypeError(\"can't compare offset-naive and offset-aware datetimes\")\n # XXX What follows could be done more efficiently...\n diff = self - other # this will take offsets into account\n if diff.days < 0:\n return -1\n return diff and 1 or 0\n\n def _add_timedelta(self, other, factor):\n y, m, d, hh, mm, ss, us = _normalize_datetime(\n self._year,\n self._month,\n self._day + other.days * factor,\n self._hour,\n self._minute,\n self._second + other.seconds * factor,\n self._microsecond + other.microseconds * factor)\n return datetime(y, m, d, hh, mm, ss, us, tzinfo=self._tzinfo)\n\n def __add__(self, other):\n \"Add a datetime and a timedelta.\"\n if not isinstance(other, timedelta):\n return NotImplemented\n return self._add_timedelta(other, 1)\n\n __radd__ = __add__\n\n def __sub__(self, other):\n \"Subtract two datetimes, or a datetime and a timedelta.\"\n if not isinstance(other, datetime):\n if isinstance(other, timedelta):\n return self._add_timedelta(other, -1)\n return NotImplemented\n\n delta_d = self.toordinal() - other.toordinal()\n delta_s = (self._hour - other._hour) * 3600 + \\\n (self._minute - other._minute) * 60 + \\\n (self._second - other._second)\n delta_us = self._microsecond - other._microsecond\n base = timedelta._create(delta_d, delta_s, delta_us, True)\n if self._tzinfo is other._tzinfo:\n return base\n myoff = self._utcoffset()\n otoff = other._utcoffset()\n if myoff == otoff:\n return base\n if myoff is None or otoff is None:\n raise TypeError(\"can't subtract offset-naive and offset-aware datetimes\")\n return base + timedelta(minutes = otoff-myoff)\n\n def __hash__(self):\n if self._hashcode == -1:\n tzoff = self._utcoffset()\n if tzoff is None:\n self._hashcode = hash(self._getstate()[0])\n else:\n days = _ymd2ord(self.year, self.month, self.day)\n seconds = self.hour * 3600 + (self.minute - tzoff) * 60 + self.second\n self._hashcode = hash(timedelta(days, seconds, self.microsecond))\n return self._hashcode\n\n\n\ndatetime.min = datetime(1, 1, 1)\ndatetime.max = datetime(9999, 12, 31, 23, 59, 59, 999999)\ndatetime.resolution = timedelta(microseconds=1)\n\n\ndef _isoweek1monday(year):\n # Helper to calculate the day number of the Monday starting week 1\n # XXX This could be done more efficiently\n THURSDAY = 3\n firstday = _ymd2ord(year, 1, 1)\n firstweekday = (firstday + 6) % 7 # See weekday() above\n week1monday = firstday - firstweekday\n if firstweekday > THURSDAY:\n week1monday += 7\n return week1monday\n\n\"\"\"\nSome time zone algebra. For a datetime x, let\n x.n = x stripped of its timezone -- its naive time.\n x.o = x.utcoffset(), and assuming that doesn't raise an exception or\n return None\n x.d = x.dst(), and assuming that doesn't raise an exception or\n return None\n x.s = x's standard offset, x.o - x.d\n\nNow some derived rules, where k is a duration (timedelta).\n\n1. x.o = x.s + x.d\n This follows from the definition of x.s.\n\n2. If x and y have the same tzinfo member, x.s = y.s.\n This is actually a requirement, an assumption we need to make about\n sane tzinfo classes.\n\n3. The naive UTC time corresponding to x is x.n - x.o.\n This is again a requirement for a sane tzinfo class.\n\n4. (x+k).s = x.s\n This follows from #2, and that datimetimetz+timedelta preserves tzinfo.\n\n5. (x+k).n = x.n + k\n Again follows from how arithmetic is defined.\n\nNow we can explain tz.fromutc(x). Let's assume it's an interesting case\n(meaning that the various tzinfo methods exist, and don't blow up or return\nNone when called).\n\nThe function wants to return a datetime y with timezone tz, equivalent to x.\nx is already in UTC.\n\nBy #3, we want\n\n y.n - y.o = x.n [1]\n\nThe algorithm starts by attaching tz to x.n, and calling that y. So\nx.n = y.n at the start. Then it wants to add a duration k to y, so that [1]\nbecomes true; in effect, we want to solve [2] for k:\n\n (y+k).n - (y+k).o = x.n [2]\n\nBy #1, this is the same as\n\n (y+k).n - ((y+k).s + (y+k).d) = x.n [3]\n\nBy #5, (y+k).n = y.n + k, which equals x.n + k because x.n=y.n at the start.\nSubstituting that into [3],\n\n x.n + k - (y+k).s - (y+k).d = x.n; the x.n terms cancel, leaving\n k - (y+k).s - (y+k).d = 0; rearranging,\n k = (y+k).s - (y+k).d; by #4, (y+k).s == y.s, so\n k = y.s - (y+k).d\n\nOn the RHS, (y+k).d can't be computed directly, but y.s can be, and we\napproximate k by ignoring the (y+k).d term at first. Note that k can't be\nvery large, since all offset-returning methods return a duration of magnitude\nless than 24 hours. For that reason, if y is firmly in std time, (y+k).d must\nbe 0, so ignoring it has no consequence then.\n\nIn any case, the new value is\n\n z = y + y.s [4]\n\nIt's helpful to step back at look at [4] from a higher level: it's simply\nmapping from UTC to tz's standard time.\n\nAt this point, if\n\n z.n - z.o = x.n [5]\n\nwe have an equivalent time, and are almost done. The insecurity here is\nat the start of daylight time. Picture US Eastern for concreteness. The wall\ntime jumps from 1:59 to 3:00, and wall hours of the form 2:MM don't make good\nsense then. The docs ask that an Eastern tzinfo class consider such a time to\nbe EDT (because it's \"after 2\"), which is a redundant spelling of 1:MM EST\non the day DST starts. We want to return the 1:MM EST spelling because that's\nthe only spelling that makes sense on the local wall clock.\n\nIn fact, if [5] holds at this point, we do have the standard-time spelling,\nbut that takes a bit of proof. We first prove a stronger result. What's the\ndifference between the LHS and RHS of [5]? Let\n\n diff = x.n - (z.n - z.o) [6]\n\nNow\n z.n = by [4]\n (y + y.s).n = by #5\n y.n + y.s = since y.n = x.n\n x.n + y.s = since z and y are have the same tzinfo member,\n y.s = z.s by #2\n x.n + z.s\n\nPlugging that back into [6] gives\n\n diff =\n x.n - ((x.n + z.s) - z.o) = expanding\n x.n - x.n - z.s + z.o = cancelling\n - z.s + z.o = by #2\n z.d\n\nSo diff = z.d.\n\nIf [5] is true now, diff = 0, so z.d = 0 too, and we have the standard-time\nspelling we wanted in the endcase described above. We're done. Contrarily,\nif z.d = 0, then we have a UTC equivalent, and are also done.\n\nIf [5] is not true now, diff = z.d != 0, and z.d is the offset we need to\nadd to z (in effect, z is in tz's standard time, and we need to shift the\nlocal clock into tz's daylight time).\n\nLet\n\n z' = z + z.d = z + diff [7]\n\nand we can again ask whether\n\n z'.n - z'.o = x.n [8]\n\nIf so, we're done. If not, the tzinfo class is insane, according to the\nassumptions we've made. This also requires a bit of proof. As before, let's\ncompute the difference between the LHS and RHS of [8] (and skipping some of\nthe justifications for the kinds of substitutions we've done several times\nalready):\n\n diff' = x.n - (z'.n - z'.o) = replacing z'.n via [7]\n x.n - (z.n + diff - z'.o) = replacing diff via [6]\n x.n - (z.n + x.n - (z.n - z.o) - z'.o) =\n x.n - z.n - x.n + z.n - z.o + z'.o = cancel x.n\n - z.n + z.n - z.o + z'.o = cancel z.n\n - z.o + z'.o = #1 twice\n -z.s - z.d + z'.s + z'.d = z and z' have same tzinfo\n z'.d - z.d\n\nSo z' is UTC-equivalent to x iff z'.d = z.d at this point. If they are equal,\nwe've found the UTC-equivalent so are done. In fact, we stop with [7] and\nreturn z', not bothering to compute z'.d.\n\nHow could z.d and z'd differ? z' = z + z.d [7], so merely moving z' by\na dst() offset, and starting *from* a time already in DST (we know z.d != 0),\nwould have to change the result dst() returns: we start in DST, and moving\na little further into it takes us out of DST.\n\nThere isn't a sane case where this can happen. The closest it gets is at\nthe end of DST, where there's an hour in UTC with no spelling in a hybrid\ntzinfo class. In US Eastern, that's 5:MM UTC = 0:MM EST = 1:MM EDT. During\nthat hour, on an Eastern clock 1:MM is taken as being in standard time (6:MM\nUTC) because the docs insist on that, but 0:MM is taken as being in daylight\ntime (4:MM UTC). There is no local time mapping to 5:MM UTC. The local\nclock jumps from 1:59 back to 1:00 again, and repeats the 1:MM hour in\nstandard time. Since that's what the local clock *does*, we want to map both\nUTC hours 5:MM and 6:MM to 1:MM Eastern. The result is ambiguous\nin local time, but so it goes -- it's the way the local clock works.\n\nWhen x = 5:MM UTC is the input to this algorithm, x.o=0, y.o=-5 and y.d=0,\nso z=0:MM. z.d=60 (minutes) then, so [5] doesn't hold and we keep going.\nz' = z + z.d = 1:MM then, and z'.d=0, and z'.d - z.d = -60 != 0 so [8]\n(correctly) concludes that z' is not UTC-equivalent to x.\n\nBecause we know z.d said z was in daylight time (else [5] would have held and\nwe would have stopped then), and we know z.d != z'.d (else [8] would have held\nand we have stopped then), and there are only 2 possible values dst() can\nreturn in Eastern, it follows that z'.d must be 0 (which it is in the example,\nbut the reasoning doesn't depend on the example -- it depends on there being\ntwo possible dst() outcomes, one zero and the other non-zero). Therefore\nz' must be in standard time, and is the spelling we want in this case.\n\nNote again that z' is not UTC-equivalent as far as the hybrid tzinfo class is\nconcerned (because it takes z' as being in standard time rather than the\ndaylight time we intend here), but returning it gives the real-life \"local\nclock repeats an hour\" behavior when mapping the \"unspellable\" UTC hour into\ntz.\n\nWhen the input is 6:MM, z=1:MM and z.d=0, and we stop at once, again with\nthe 1:MM standard time spelling we want.\n\nSo how can this break? One of the assumptions must be violated. Two\npossibilities:\n\n1) [2] effectively says that y.s is invariant across all y belong to a given\n time zone. This isn't true if, for political reasons or continental drift,\n a region decides to change its base offset from UTC.\n\n2) There may be versions of \"double daylight\" time where the tail end of\n the analysis gives up a step too early. I haven't thought about that\n enough to say.\n\nIn any case, it's clear that the default fromutc() is strong enough to handle\n\"almost all\" time zones: so long as the standard offset is invariant, it\ndoesn't matter if daylight time transition points change from year to year, or\nif daylight time is skipped in some years; it doesn't matter how large or\nsmall dst() may get within its bounds; and it doesn't even matter if some\nperverse time zone returns a negative dst()). So a breaking case must be\npretty bizarre, and a tzinfo subclass can override fromutc() if it is.\n\"\"\"\n", "src/lib/nntplib.py": "raise NotImplementedError(\"nntplib is not yet implemented in Skulpt\")\n", "src/lib/ssl.py": "raise NotImplementedError(\"ssl is not yet implemented in Skulpt\")\n", "src/lib/opcode.py": "raise NotImplementedError(\"opcode is not yet implemented in Skulpt\")\n", "src/lib/mailbox.py": "raise NotImplementedError(\"mailbox is not yet implemented in Skulpt\")\n", "src/lib/xmlrpclib.py": "raise NotImplementedError(\"xmlrpclib is not yet implemented in Skulpt\")\n", "src/lib/UserList.py": "raise NotImplementedError(\"UserList is not yet implemented in Skulpt\")\n", "src/lib/webgl/math.js": "var $builtinmodule = function(name)\n{\n var mod = {};\n\n // todo; should probably put this in a math package\n mod.Mat44 = Sk.misceval.buildClass(mod, function($gbl, $loc)\n {\n $loc.__init__ = new Sk.builtin.func(function(self)\n {\n Sk.misceval.callsim($loc.loadIdentity, self);\n self.stack = [];\n });\n\n $loc.push = new Sk.builtin.func(function(self)\n {\n self.stack.push(self.elements.slice(0));\n });\n\n $loc.pop = new Sk.builtin.func(function(self)\n {\n self.elements = self.stack.pop();\n });\n\n $loc.loadIdentity = new Sk.builtin.func(function(self)\n {\n self.elements = [1.0, 0.0, 0.0, 0.0,\n 0.0, 1.0, 0.0, 0.0,\n 0.0, 0.0, 1.0, 0.0,\n 0.0, 0.0, 0.0, 1.0];\n });\n\n $loc.transform3 = new Sk.builtin.func(function(self, v)\n {\n var e = self.elements;\n return Sk.misceval.callsim(mod.Vec3,\n e[0] * v.x + e[4] * v.y + e[8] * v.z,\n e[1] * v.x + e[5] * v.y + e[9] * v.z,\n e[2] * v.x + e[6] * v.y + e[10] * v.z);\n });\n\n $loc.scale = new Sk.builtin.func(function(self, sx, sy, sz)\n {\n self.elements[0*4+0] *= sx;\n self.elements[0*4+1] *= sx;\n self.elements[0*4+2] *= sx;\n self.elements[0*4+3] *= sx;\n\n self.elements[1*4+0] *= sy;\n self.elements[1*4+1] *= sy;\n self.elements[1*4+2] *= sy;\n self.elements[1*4+3] *= sy;\n\n self.elements[2*4+0] *= sz;\n self.elements[2*4+1] *= sz;\n self.elements[2*4+2] *= sz;\n self.elements[2*4+3] *= sz;\n\n return self;\n });\n\n $loc.translate = new Sk.builtin.func(function(self, tx, ty, tz)\n {\n self.elements[3*4+0] += self.elements[0*4+0] * tx + self.elements[1*4+0] * ty + self.elements[2*4+0] * tz;\n self.elements[3*4+1] += self.elements[0*4+1] * tx + self.elements[1*4+1] * ty + self.elements[2*4+1] * tz;\n self.elements[3*4+2] += self.elements[0*4+2] * tx + self.elements[1*4+2] * ty + self.elements[2*4+2] * tz;\n self.elements[3*4+3] += self.elements[0*4+3] * tx + self.elements[1*4+3] * ty + self.elements[2*4+3] * tz;\n return self;\n });\n\n $loc.rotate = new Sk.builtin.func(function(self, angle, x, y, z)\n {\n var mag = Math.sqrt(x*x + y*y + z*z);\n var sinAngle = Math.sin(angle * Math.PI / 180.0);\n var cosAngle = Math.cos(angle * Math.PI / 180.0);\n\n if (mag > 0)\n {\n var xx, yy, zz, xy, yz, zx, xs, ys, zs;\n var oneMinusCos;\n var rotMat;\n\n x /= mag;\n y /= mag;\n z /= mag;\n\n xx = x * x;\n yy = y * y;\n zz = z * z;\n xy = x * y;\n yz = y * z;\n zx = z * x;\n xs = x * sinAngle;\n ys = y * sinAngle;\n zs = z * sinAngle;\n oneMinusCos = 1.0 - cosAngle;\n\n rotMat = Sk.misceval.callsim(mod.Mat44);\n\n rotMat.elements[0*4+0] = (oneMinusCos * xx) + cosAngle;\n rotMat.elements[0*4+1] = (oneMinusCos * xy) - zs;\n rotMat.elements[0*4+2] = (oneMinusCos * zx) + ys;\n rotMat.elements[0*4+3] = 0.0;\n\n rotMat.elements[1*4+0] = (oneMinusCos * xy) + zs;\n rotMat.elements[1*4+1] = (oneMinusCos * yy) + cosAngle;\n rotMat.elements[1*4+2] = (oneMinusCos * yz) - xs;\n rotMat.elements[1*4+3] = 0.0;\n\n rotMat.elements[2*4+0] = (oneMinusCos * zx) - ys;\n rotMat.elements[2*4+1] = (oneMinusCos * yz) + xs;\n rotMat.elements[2*4+2] = (oneMinusCos * zz) + cosAngle;\n rotMat.elements[2*4+3] = 0.0;\n\n rotMat.elements[3*4+0] = 0.0;\n rotMat.elements[3*4+1] = 0.0;\n rotMat.elements[3*4+2] = 0.0;\n rotMat.elements[3*4+3] = 1.0;\n\n rotMat = rotMat.multiply(self);\n self.elements = rotMat.elements;\n }\n return self;\n });\n\n $loc.multiply = new Sk.builtin.func(function(self, right)\n {\n var tmp = Sk.misceval.callsim(mod.Mat44);\n\n for (var i = 0; i < 4; i++)\n {\n tmp.elements[i*4+0] =\n (self.elements[i*4+0] * right.elements[0*4+0]) +\n (self.elements[i*4+1] * right.elements[1*4+0]) +\n (self.elements[i*4+2] * right.elements[2*4+0]) +\n (self.elements[i*4+3] * right.elements[3*4+0]) ;\n\n tmp.elements[i*4+1] =\n (self.elements[i*4+0] * right.elements[0*4+1]) +\n (self.elements[i*4+1] * right.elements[1*4+1]) +\n (self.elements[i*4+2] * right.elements[2*4+1]) +\n (self.elements[i*4+3] * right.elements[3*4+1]) ;\n\n tmp.elements[i*4+2] =\n (self.elements[i*4+0] * right.elements[0*4+2]) +\n (self.elements[i*4+1] * right.elements[1*4+2]) +\n (self.elements[i*4+2] * right.elements[2*4+2]) +\n (self.elements[i*4+3] * right.elements[3*4+2]) ;\n\n tmp.elements[i*4+3] =\n (self.elements[i*4+0] * right.elements[0*4+3]) +\n (self.elements[i*4+1] * right.elements[1*4+3]) +\n (self.elements[i*4+2] * right.elements[2*4+3]) +\n (self.elements[i*4+3] * right.elements[3*4+3]) ;\n }\n\n self.elements = tmp.elements;\n return self;\n });\n\n /* Following gluLookAt implementation is adapted from\n * the Mesa 3D Graphics library. http://www.mesa3d.org\n */\n // todo; rewrite this with proper vec/mat ops\n $loc.lookAt = new Sk.builtin.func(function(self, eyeX, eyeY, eyeZ,\n centerX, centerY, centerZ,\n upX, upY, upZ)\n {\n /* Z vector */\n var z = [\n eyeX - centerX,\n eyeY - centerY,\n eyeZ - centerZ\n ];\n var mag = Math.sqrt(z[0] * z[0] + z[1] * z[1] + z[2] * z[2]);\n if (mag)\n {\n z[0] /= mag;\n z[1] /= mag;\n z[2] /= mag;\n }\n\n /* Y vector */\n var y = [ upX, upY, upZ ];\n\n /* X vector = Y cross Z */\n var x = [];\n x[0] = y[1] * z[2] - y[2] * z[1];\n x[1] = -y[0] * z[2] + y[2] * z[0];\n x[2] = y[0] * z[1] - y[1] * z[0];\n\n /* Recompute Y = Z cross X */\n y[0] = z[1] * x[2] - z[2] * x[1];\n y[1] = -z[0] * x[2] + z[2] * x[0];\n y[2] = z[0] * x[1] - z[1] * x[0];\n\n /* mpichler, 19950515 */\n /* cross product gives area of parallelogram, which is < 1.0 for\n * non-perpendicular unit-length vectors; so normalize x, y here\n */\n\n mag = Math.sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);\n if (mag) {\n x[0] /= mag;\n x[1] /= mag;\n x[2] /= mag;\n }\n\n mag = Math.sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]);\n if (mag) {\n y[0] /= mag;\n y[1] /= mag;\n y[2] /= mag;\n }\n\n var lookAt = Sk.misceval.callsim(mod.Mat44);\n lookAt.elements[0 * 4 + 0] = x[0];\n lookAt.elements[1 * 4 + 0] = x[1];\n lookAt.elements[2 * 4 + 0] = x[2];\n lookAt.elements[3 * 4 + 0] = 0.;\n lookAt.elements[0 * 4 + 1] = y[0];\n lookAt.elements[1 * 4 + 1] = y[1];\n lookAt.elements[2 * 4 + 1] = y[2];\n lookAt.elements[3 * 4 + 1] = 0.;\n lookAt.elements[0 * 4 + 2] = z[0];\n lookAt.elements[1 * 4 + 2] = z[1];\n lookAt.elements[2 * 4 + 2] = z[2];\n lookAt.elements[3 * 4 + 2] = 0.;\n lookAt.elements[0 * 4 + 3] = 0.;\n lookAt.elements[1 * 4 + 3] = 0.;\n lookAt.elements[2 * 4 + 3] = 0.;\n lookAt.elements[3 * 4 + 3] = 1.;\n\n // log(lookAt.elements);\n\n lookAt = lookAt.multiply(self);\n self.elements = lookAt.elements;\n self.translate(-eyeX, -eyeY, -eyeZ);\n\n // log(this.elements);\n\n return self;\n });\n },\n 'Mat44', []);\n\n // todo; should probably put this in a math package\n mod.Mat33 = Sk.misceval.buildClass(mod, function($gbl, $loc)\n {\n $loc.__init__ = new Sk.builtin.func(function(self)\n {\n Sk.misceval.callsim($loc.loadIdentity, self);\n });\n\n $loc.loadIdentity = new Sk.builtin.func(function(self)\n {\n self.elements = [1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0];\n });\n },\n 'Mat33', []);\n\n mod.Vec3 = Sk.misceval.buildClass(mod, function($gbl, $loc)\n {\n $loc.__init__ = new Sk.builtin.func(function(self, x, y, z)\n {\n self.x = x;\n self.y = y;\n self.z = z;\n });\n $loc.__sub__ = new Sk.builtin.func(function(self, other)\n {\n return Sk.misceval.callsim(mod.Vec3, self.x - other.x, self.y - other.y, self.z - other.z);\n });\n },\n 'Vec3', []);\n \n mod.cross = new Sk.builtin.func(function(v1, v2)\n {\n goog.asserts.assert(v1 instanceof mod.Vec3 && v2 instanceof mod.Vec3);\n return Sk.misceval.callsim(mod.Vec3,\n v1.y * v2.z - v1.z * v2.y,\n v1.z * v2.x - v1.x * v2.z,\n v1.x * v2.y - v1.y * v2.x);\n });\n\n return mod;\n};\n", "src/lib/toaiff.py": "raise NotImplementedError(\"toaiff is not yet implemented in Skulpt\")\n", "src/lib/__future__.py": "raise NotImplementedError(\"__future__ is not yet implemented in Skulpt\")\n", "src/lib/zipfile.py": "raise NotImplementedError(\"zipfile is not yet implemented in Skulpt\")\n", "src/lib/email/__init__.py": "raise NotImplementedError(\"email is not yet implemented in Skulpt\")\n", "src/lib/pythonds/__init__.py": "", "src/lib/dummy_thread.py": "raise NotImplementedError(\"dummy_thread is not yet implemented in Skulpt\")\n", "src/lib/Cookie.py": "raise NotImplementedError(\"Cookie is not yet implemented in Skulpt\")\n", "src/lib/ntpath.py": "raise NotImplementedError(\"ntpath is not yet implemented in Skulpt\")\n", "src/lib/pstats.py": "raise NotImplementedError(\"pstats is not yet implemented in Skulpt\")\n", "src/lib/test/test_support.py": "\"\"\"Supporting definitions for the Python regression tests.\"\"\"\n\nif __name__ != 'test.test_support':\n raise ImportError('test_support must be imported from the test package')\n\nimport unittest\n\n\n# def run_unittest(*classes):\n# \"\"\"Run tests from unittest.TestCase-derived classes.\"\"\"\n# valid_types = (unittest.TestSuite, unittest.TestCase)\n# suite = unittest.TestSuite()\n# for cls in classes:\n# if isinstance(cls, str):\n# if cls in sys.modules:\n# suite.addTest(unittest.findTestCases(sys.modules[cls]))\n# else:\n# raise ValueError(\"str arguments must be keys in sys.modules\")\n# elif isinstance(cls, valid_types):\n# suite.addTest(cls)\n# else:\n# suite.addTest(unittest.makeSuite(cls))\n# _run_suite(suite)\n\ndef run_unittest(*classes):\n \"\"\"Run tests from unittest.TestCase-derived classes.\"\"\"\n for cls in classes:\n print cls\n if issubclass(cls, unittest.TestCase):\n cls().main()\n else:\n print \"Don't know what to do with \", cls\n", "src/lib/io.py": "raise NotImplementedError(\"io is not yet implemented in Skulpt\")\n", "src/lib/webgl/models.js": "// most of this file is from/based on 'tdl'\n\nvar $builtinmodule = function(name)\n{\n var mod = {};\n\n var Buffer = function(array, opt_target) {\n var target = opt_target || gl.ARRAY_BUFFER;\n var buf = gl.createBuffer();\n this.target = target;\n this.buf = buf;\n this.set(array);\n this.numComponents_ = array.numComponents;\n this.numElements_ = array.numElements;\n this.totalComponents_ = this.numComponents_ * this.numElements_;\n if (array.buffer instanceof Float32Array) {\n this.type_ = gl.FLOAT;\n } else if (array.buffer instanceof Uint8Array) {\n this.type_ = gl.UNSIGNED_BYTE;\n } else if (array.buffer instanceof Int8Array) {\n this.type_ = gl._BYTE;\n } else if (array.buffer instanceof Uint16Array) {\n this.type_ = gl.UNSIGNED_SHORT;\n } else if (array.buffer instanceof Int16Array) {\n this.type_ = gl.SHORT;\n } else {\n throw(\"unhandled type:\" + (typeof array.buffer));\n }\n };\n\n Buffer.prototype.set = function(array) {\n gl.bindBuffer(this.target, this.buf);\n gl.bufferData(this.target, array.buffer, gl.STATIC_DRAW);\n }\n\n Buffer.prototype.type = function() {\n return this.type_;\n };\n\n Buffer.prototype.numComponents = function() {\n return this.numComponents_;\n };\n\n Buffer.prototype.numElements = function() {\n return this.numElements_;\n };\n\n Buffer.prototype.totalComponents = function() {\n return this.totalComponents_;\n };\n\n Buffer.prototype.buffer = function() {\n return this.buf;\n };\n\n Buffer.prototype.stride = function() {\n return 0;\n };\n\n Buffer.prototype.offset = function() {\n return 0;\n };\n\n\n\n mod.Model = Sk.misceval.buildClass(mod, function($gbl, $loc)\n {\n $loc.__init__ = new Sk.builtin.func(function(self, shader, arrays, textures)\n {\n self.buffers = {};\n var setBuffer = function(name, array)\n {\n var target = (name == 'indices') ? gl.ELEMENT_ARRAY_BUFFER : gl.ARRAY_BUFFER;\n b = self.buffers[name];\n if (!b)\n b = new Buffer(array, target);\n else\n b.set(array);\n self.buffers[name] = b;\n };\n for (name in arrays)\n setBuffer(name, arrays[name]);\n\n var textureUnits = {};\n var unit = 0;\n for (var texture in textures)\n {\n textureUnits[texture] = unit++;\n }\n\n self.mode = gl.TRIANGLES;\n self.textures = textures.v;\n self.textureUnits = textureUnits;\n self.shader = shader;\n });\n\n /**\n * Sets up the shared parts of drawing this model. Uses the\n * program, binds the buffers, sets the textures.\n *\n * @param {!Object.<string, *>} uniforms An object of names to\n * values to set on this models uniforms.\n */\n $loc.drawPrep = new Sk.builtin.func(function(self, uniforms)\n {\n var shader = self.shader;\n var buffers = self.buffers;\n var textures = self.textures;\n\n uniforms = Sk.ffi.remapToJs(uniforms);\n\n Sk.misceval.callsim(shader.use, shader);\n\n for (var buffer in buffers) {\n var b = buffers[buffer];\n if (buffer == 'indices') {\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, b.buffer());\n } else {\n var attrib = shader.attrib[buffer];\n if (attrib) {\n attrib(b);\n }\n }\n }\n\n for (var texture in textures) {\n var unit = self.textureUnits[texture];\n shader.setUniform$impl(shader, textuer, unit);\n textures[texture].bindToUnit(unit);\n }\n\n for (var uniform in uniforms) {\n shader.setUniform$impl(shader, uniform, uniforms[uniform]);\n }\n });\n\n /**\n * Draws this model.\n *\n * After calling tdl.models.Model.drawPrep you can call this\n * function multiple times to draw this model.\n *\n * @param {!Object.<string, *>} uniforms An object of names to\n * values to set on this models uniforms.\n */\n $loc.draw = new Sk.builtin.func(function(self, uniforms, opt_textures)\n {\n var shader = self.shader;\n uniforms = Sk.ffi.remapToJs(uniforms);\n for (uniform in uniforms) {\n shader.setUniform$impl(shader, uniform, uniforms[uniform]);\n }\n\n if (opt_textures) {\n for (var texture in opt_textures) {\n var unit = self.textureUnits[texture];\n shader.setUniform$impl(shader, texture, unit);\n opt_textures[texture].bindToUnit(unit);\n }\n }\n\n var buffers = self.buffers;\n gl.drawElements(self.mode, buffers.indices.totalComponents(), gl.UNSIGNED_SHORT, 0);\n });\n },\n 'Model', []);\n\n return mod;\n};\n", "src/lib/csv.py": "raise NotImplementedError(\"csv is not yet implemented in Skulpt\")\n", "src/lib/email/test/data/__init__.py": "raise NotImplementedError(\"data is not yet implemented in Skulpt\")\n", "src/lib/sets.py": "raise NotImplementedError(\"sets is not yet implemented in Skulpt\")\n", "src/lib/SimpleHTTPServer.py": "raise NotImplementedError(\"SimpleHTTPServer is not yet implemented in Skulpt\")\n", "src/lib/image.js": "var ImageMod; // the single identifier needed in the global scope\nvar $builtinmodule;\n\nif (!ImageMod) {\n ImageMod = {};\n ImageMod.canvasLib = [];\n}\n\n$builtinmodule = function (name) {\n var screen;\n var pixel;\n var eImage;\n var mod = {};\n var updateCanvasAndSuspend;\n var initializeImage;\n var checkPixelRange;\n var remapImageIdToURL;\n\n var image = function ($gbl, $loc) {\n initializeImage = function (self) {\n self.width = self.image.width;\n self.height = self.image.height;\n self.delay = 0;\n self.updateCount = 0;\n self.updateInterval = 1;\n self.lastx = 0;\n self.lasty = 0;\n self.canvas = document.createElement(\"canvas\");\n self.canvas.height = self.height;\n self.canvas.width = self.width;\n self.ctx = self.canvas.getContext(\"2d\");\n self.ctx.drawImage(self.image, 0, 0);\n self.imagedata = self.ctx.getImageData(0, 0, self.width, self.height);\n };\n\n\n $loc.__init__ = new Sk.builtin.func(function (self, imageId) {\n var susp;\n Sk.builtin.pyCheckArgs(\"__init__\", arguments, 2, 2);\n try {\n self.image = document.getElementById(Sk.ffi.remapToJs(imageId));\n initializeImage(self);\n } catch (e) {\n self.image = null;\n }\n if (self.image == null) {\n susp = new Sk.misceval.Suspension();\n susp.resume = function () {\n // Should the post image get stuff go here??\n if (susp.data[\"error\"]) {\n throw new Sk.builtin.IOError(susp.data[\"error\"].message);\n }\n };\n susp.data = {\n type: \"Sk.promise\",\n promise: new Promise(function (resolve, reject) {\n var newImg = new Image();\n newImg.crossOrigin = \"\";\n newImg.onerror = function () {\n reject(Error(\"Failed to load URL: \" + newImg.src));\n };\n newImg.onload = function () {\n self.image = this;\n initializeImage(self);\n resolve();\n };\n // look for mapping from imagename to url and possible an image proxy server\n newImg.src = remapImageIdToURL(imageId);\n }\n )\n };\n return susp;\n }\n\n });\n\n remapImageIdToURL = function (imageId) {\n // if imageId starts with http -- OK\n // if imageId is in Sk.imageMap -- look it up\n // if imageId is the name of an image file prepend http://host/app/book/_static/\n // if image proxy server is configured construct url for proxy\n // return the final URL\n var url;\n var ret;\n ret = Sk.ffi.remapToJs(imageId);\n url = document.createElement(\"a\");\n url.href = ret;\n if (window.location.host !== url.host) {\n ret = Sk.imageProxy + \"/\" + ret;\n }\n return ret;\n };\n\n checkPixelRange = function (self, x, y) {\n if (x < 0 || y < 0 || x >= self.width || y >= self.height) {\n throw new Sk.builtin.ValueError(\"Pixel index out of range.\");\n }\n };\n\n $loc.setDelay = new Sk.builtin.func(function (self, delay, interval) {\n var i;\n Sk.builtin.pyCheckArgs(\"setDelay\", arguments, 2, 3);\n self.delay = Sk.ffi.remapToJs(delay);\n i = Sk.builtin.asnum$(interval);\n if (!i) {\n self.updateInterval = 1;\n } else {\n self.updateInterval = i;\n }\n });\n\n\n //get a one-dimensional array of pixel objects - Zhu\n $loc.getPixels = new Sk.builtin.func(function (self) {\n var arr = [];//initial array\n var i;\n Sk.builtin.pyCheckArgs(\"getPixels\", arguments, 1, 1);\n\n for (i = 0; i < self.image.height * self.image.width; i++) {\n\n arr[i] = Sk.misceval.callsim(self.getPixel, self,\n i % self.image.width, Math.floor(i / self.image.width));\n }\n return new Sk.builtin.tuple(arr);\n });\n\n $loc.getPixel = new Sk.builtin.func(function (self, x, y) {\n var red;\n var blue;\n var green;\n var index;\n Sk.builtin.pyCheckArgs(\"getPixel\", arguments, 3, 3);\n x = Sk.builtin.asnum$(x);\n y = Sk.builtin.asnum$(y);\n checkPixelRange(self, x, y);\n index = (y * 4) * self.width + (x * 4);\n red = self.imagedata.data[index];\n green = self.imagedata.data[index + 1];\n blue = self.imagedata.data[index + 2];\n return Sk.misceval.callsim(mod.Pixel, red, green, blue, x, y);\n });\n\n updateCanvasAndSuspend = function (self, x, y) {\n var susp = new Sk.misceval.Suspension();\n susp.resume = function () {\n return Sk.builtin.none.none$;\n };\n susp.data = {\n type: \"Sk.promise\",\n promise: new Promise(function (resolve, reject) {\n self.updateCount++;\n if ((self.updateCount % self.updateInterval) === 0) {\n if (self.lastx + self.updateInterval >= self.width) {\n self.lastCtx.putImageData(self.imagedata, self.lastUlx, self.lastUly,\n 0, self.lasty, self.width, 2);\n } else if (self.lasty + self.updateInterval >= self.height) {\n self.lastCtx.putImageData(self.imagedata, self.lastUlx, self.lastUly,\n self.lastx, 0, 2, self.height);\n } else {\n self.lastCtx.putImageData(self.imagedata, self.lastUlx, self.lastUly,\n Math.min(x, self.lastx),\n Math.min(y, self.lasty),\n Math.max(Math.abs(x - self.lastx), 1),\n Math.max(Math.abs(y - self.lasty), 1));\n }\n self.lastx = x;\n self.lasty = y;\n if (self.delay > 0) {\n window.setTimeout(resolve, self.delay);\n } else {\n resolve();\n }\n } else {\n resolve();\n }\n })\n };\n return susp;\n };\n\n $loc.setPixel = new Sk.builtin.func(function (self, x, y, pix) {\n var index;\n Sk.builtin.pyCheckArgs(\"setPixel\", arguments, 4, 4);\n x = Sk.builtin.asnum$(x);\n y = Sk.builtin.asnum$(y);\n checkPixelRange(self, x, y);\n index = (y * 4) * self.width + (x * 4);\n self.imagedata.data[index] = Sk.builtin.asnum$(Sk.misceval.callsim(pix.getRed, pix));\n self.imagedata.data[index + 1] = Sk.builtin.asnum$(Sk.misceval.callsim(pix.getGreen, pix));\n self.imagedata.data[index + 2] = Sk.builtin.asnum$(Sk.misceval.callsim(pix.getBlue, pix));\n self.imagedata.data[index + 3] = 255;\n return updateCanvasAndSuspend(self, x, y);\n });\n\n // update the image with the pixel at the given count - Zhu\n $loc.setPixelAt = new Sk.builtin.func(function (self, count, pixel) {\n var x;\n var y;\n var index;\n Sk.builtin.pyCheckArgs(\"setPixelAt\", arguments, 3, 3);\n count = Sk.builtin.asnum$(count);\n x = count % self.image.width;\n y = Math.floor(count / self.image.width);\n checkPixelRange(self, x, y);\n index = (y * 4) * self.width + (x * 4);\n self.imagedata.data[index] = Sk.builtin.asnum$(Sk.misceval.callsim(pixel.getRed, pixel));\n self.imagedata.data[index + 1] = Sk.builtin.asnum$(Sk.misceval.callsim(pixel.getGreen, pixel));\n self.imagedata.data[index + 2] = Sk.builtin.asnum$(Sk.misceval.callsim(pixel.getBlue, pixel));\n self.imagedata.data[index + 3] = 255;\n return updateCanvasAndSuspend(self, x, y);\n });\n\n // new updatePixel that uses the saved x and y location in the pixel - Barb Ericson\n $loc.updatePixel = new Sk.builtin.func(function (self, pixel) {\n var x;\n var y;\n var index;\n Sk.builtin.pyCheckArgs(\"updatePixel\", arguments, 2, 2);\n x = Sk.builtin.asnum$(Sk.misceval.callsim(pixel.getX, pixel));\n y = Sk.builtin.asnum$(Sk.misceval.callsim(pixel.getY, pixel));\n checkPixelRange(self, x, y);\n index = (y * 4) * self.width + (x * 4);\n self.imagedata.data[index] = Sk.builtin.asnum$(Sk.misceval.callsim(pixel.getRed, pixel));\n self.imagedata.data[index + 1] = Sk.builtin.asnum$(Sk.misceval.callsim(pixel.getGreen, pixel));\n self.imagedata.data[index + 2] = Sk.builtin.asnum$(Sk.misceval.callsim(pixel.getBlue, pixel));\n self.imagedata.data[index + 3] = 255;\n return updateCanvasAndSuspend(self, x, y);\n });\n\n $loc.getHeight = new Sk.builtin.func(function (self) {\n Sk.builtin.pyCheckArgs(\"getHeight\", arguments, 1, 1);\n return new Sk.builtin.int_(self.image.height);\n });\n\n $loc.getWidth = new Sk.builtin.func(function (self, titlestring) {\n Sk.builtin.pyCheckArgs(\"getWidth\", arguments, 1, 1);\n return new Sk.builtin.int_(self.image.width);\n });\n\n $loc.draw = new Sk.builtin.func(function (self, win, ulx, uly) {\n var susp;\n Sk.builtin.pyCheckArgs(\"draw\", arguments, 2, 4);\n susp = new Sk.misceval.Suspension();\n susp.resume = function () {\n return Sk.builtin.none.none$;\n };\n susp.data = {\n type: \"Sk.promise\",\n promise: new Promise(function (resolve, reject) {\n var can;\n var ctx;\n win = Sk.builtin.asnum$(win);\n ulx = Sk.builtin.asnum$(ulx);\n uly = Sk.builtin.asnum$(uly);\n can = Sk.misceval.callsim(win.getWin, win);\n ctx = can.getContext(\"2d\");\n if (!ulx) {\n ulx = 0;\n uly = 0;\n }\n self.lastUlx = ulx;\n self.lastUly = uly;\n self.lastCtx = ctx; // save a reference to the context of the window the image was last drawn in\n //ctx.putImageData(self.imagedata,0,0,0,0,self.imagedata.width,self.imagedata.height);\n ctx.putImageData(self.imagedata, ulx, uly);\n\n if (self.delay > 0) {\n window.setTimeout(resolve, self.delay);\n } else {\n window.setTimeout(resolve, 200);\n }\n })\n };\n return susp;\n\n });\n\n // toList\n\n };\n\n mod.Image = Sk.misceval.buildClass(mod, image, \"Image\", []);\n\n eImage = function ($gbl, $loc) {\n $loc.__init__ = new Sk.builtin.func(function (self, width, height) {\n Sk.builtin.pyCheckArgs(\"__init__\", arguments, 3, 3);\n self.width = Sk.builtin.asnum$(width);\n self.height = Sk.builtin.asnum$(height);\n self.canvas = document.createElement(\"canvas\");\n self.ctx = self.canvas.getContext(\"2d\");\n self.canvas.height = self.height;\n self.canvas.width = self.width;\n self.imagedata = self.ctx.getImageData(0, 0, self.width, self.height);\n });\n\n };\n\n mod.EmptyImage = Sk.misceval.buildClass(mod, eImage, \"EmptyImage\", [mod.Image]);\n\n // create a ListImage object\n\n\n pixel = function ($gbl, $loc) {\n $loc.__init__ = new Sk.builtin.func(function (self, r, g, b, x, y) {\n Sk.builtin.pyCheckArgs(\"__init__\", arguments, 4, 6);\n self.red = Sk.builtin.asnum$(r);\n self.green = Sk.builtin.asnum$(g);\n self.blue = Sk.builtin.asnum$(b);\n self.x = Sk.builtin.asnum$(x);\n self.y = Sk.builtin.asnum$(y);\n });\n\n $loc.getRed = new Sk.builtin.func(function (self) {\n Sk.builtin.pyCheckArgs(\"getRed\", arguments, 1, 1);\n return Sk.builtin.assk$(self.red);\n });\n\n $loc.getGreen = new Sk.builtin.func(function (self) {\n Sk.builtin.pyCheckArgs(\"getGreen\", arguments, 1, 1);\n return Sk.builtin.assk$(self.green);\n });\n\n $loc.getBlue = new Sk.builtin.func(function (self) {\n Sk.builtin.pyCheckArgs(\"getBlue\", arguments, 1, 1);\n return Sk.builtin.assk$(self.blue);\n });\n\n $loc.getX = new Sk.builtin.func(function (self) {\n Sk.builtin.pyCheckArgs(\"getX\", arguments, 1, 1);\n return Sk.builtin.assk$(self.x);\n });\n\n $loc.getY = new Sk.builtin.func(function (self) {\n Sk.builtin.pyCheckArgs(\"getY\", arguments, 1, 1);\n return Sk.builtin.assk$(self.y);\n });\n\n $loc.setRed = new Sk.builtin.func(function (self, r) {\n Sk.builtin.pyCheckArgs(\"setRed\", arguments, 2, 2);\n self.red = Sk.builtin.asnum$(r);\n });\n\n $loc.setGreen = new Sk.builtin.func(function (self, g) {\n Sk.builtin.pyCheckArgs(\"setGreen\", arguments, 2, 2);\n self.green = Sk.builtin.asnum$(g);\n });\n\n $loc.setBlue = new Sk.builtin.func(function (self, b) {\n Sk.builtin.pyCheckArgs(\"setBlue\", arguments, 2, 2);\n self.blue = Sk.builtin.asnum$(b);\n });\n\n $loc.setX = new Sk.builtin.func(function (self, x) {\n Sk.builtin.pyCheckArgs(\"setX\", arguments, 2, 2);\n self.x = Sk.builtin.asnum$(x);\n });\n\n $loc.setY = new Sk.builtin.func(function (self, y) {\n Sk.builtin.pyCheckArgs(\"setY\", arguments, 2, 2);\n self.y = Sk.builtin.asnum$(y);\n });\n\n $loc.__getitem__ = new Sk.builtin.func(function (self, k) {\n k = Sk.builtin.asnum$(k);\n if (k === 0) {\n return self.red;\n } else if (k == 1) {\n return self.green;\n } else if (k == 2) {\n return self.blue;\n }\n });\n\n $loc.__str__ = new Sk.builtin.func(function (self) {\n return \"[\" + self.red + \",\" + self.green + \",\" + self.blue + \"]\";\n });\n\n //getColorTuple\n $loc.getColorTuple = new Sk.builtin.func(function (self, x, y) {\n\n });\n\n //setRange -- change from 0..255 to 0.0 .. 1.0\n $loc.setRange = new Sk.builtin.func(function (self, mx) {\n self.max = Sk.builtin.asnum$(mx);\n });\n\n };\n mod.Pixel = Sk.misceval.buildClass(mod, pixel, \"Pixel\", []);\n\n\n screen = function ($gbl, $loc) {\n $loc.__init__ = new Sk.builtin.func(function (self, width, height) {\n var currentCanvas;\n var tmpCan, tmpDiv;\n Sk.builtin.pyCheckArgs(\"__init__\", arguments, 1, 3);\n currentCanvas = ImageMod.canvasLib[Sk.canvas];\n if (currentCanvas === undefined) {\n tmpCan = document.createElement(\"canvas\");\n tmpDiv = document.getElementById(Sk.canvas);\n self.theScreen = tmpCan;\n tmpDiv.appendChild(tmpCan);\n ImageMod.canvasLib[Sk.canvas] = tmpCan;\n ImageMod.canvasLib[Sk.canvas] = self.theScreen;\n } else {\n self.theScreen = currentCanvas;\n self.theScreen.height = self.theScreen.height;\n }\n if (width !== undefined) {\n self.theScreen.height = height.v;\n self.theScreen.width = width.v;\n } else {\n if (Sk.availableHeight) {\n self.theScreen.height = Sk.availableHeight;\n }\n if (Sk.availableWidth) {\n self.theScreen.width = Sk.availableWidth;\n }\n }\n\n self.theScreen.style.display = \"block\";\n });\n\n $loc.getWin = new Sk.builtin.func(function (self) {\n return self.theScreen;\n });\n\n // exitonclick\n $loc.exitonclick = new Sk.builtin.func(function (self) {\n var canvas_id = self.theScreen.id;\n self.theScreen.onclick = function () {\n document.getElementById(canvas_id).style.display = \"none\";\n document.getElementById(canvas_id).onclick = null;\n delete ImageMod.canvasLib[canvas_id];\n };\n\n });\n //getMouse\n };\n\n mod.ImageWin = Sk.misceval.buildClass(mod, screen, \"ImageWin\", []);\n\n return mod;\n};\n", "src/lib/wsgiref/__init__.py": "raise NotImplementedError(\"wsgiref is not yet implemented in Skulpt\")\n", "src/lib/httplib.py": "raise NotImplementedError(\"httplib is not yet implemented in Skulpt\")\n", "src/lib/lib2to3/__init__.py": "raise NotImplementedError(\"lib2to3 is not yet implemented in Skulpt\")\n", "src/lib/json/tests/__init__.py": "raise NotImplementedError(\"tests is not yet implemented in Skulpt\")\n", "src/lib/quopri.py": "raise NotImplementedError(\"quopri is not yet implemented in Skulpt\")\n", "src/lib/ftplib.py": "raise NotImplementedError(\"ftplib is not yet implemented in Skulpt\")\n", "src/lib/ctypes/__init__.py": "raise NotImplementedError(\"ctypes is not yet implemented in Skulpt\")\n", "src/lib/subprocess.py": "raise NotImplementedError(\"subprocess is not yet implemented in Skulpt\")\n", "src/lib/bsddb/__init__.py": "raise NotImplementedError(\"bsddb is not yet implemented in Skulpt\")\n", "src/lib/tempfile.py": "raise NotImplementedError(\"tempfile is not yet implemented in Skulpt\")\n", "src/lib/cProfile.py": "raise NotImplementedError(\"cProfile is not yet implemented in Skulpt\")\n", "src/lib/stringold.py": "raise NotImplementedError(\"stringold is not yet implemented in Skulpt\")\n", "src/lib/random.js": "/*\n I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace\n so it's better encapsulated. Now you can have multiple random number generators\n and they won't stomp all over eachother's state.\n\n If you want to use this as a substitute for Math.random(), use the random()\n method like so:\n\n var m = new MersenneTwister();\n var randomNumber = m.random();\n\n You can also call the other genrand_{foo}() methods on the instance.\n\n If you want to use a specific seed in order to get a repeatable random\n sequence, pass an integer into the constructor:\n\n var m = new MersenneTwister(123);\n\n and that will always produce the same random sequence.\n\n Sean McCullough (banksean@gmail.com)\n */\n\n/* \n A C-program for MT19937, with initialization improved 2002/1/26.\n Coded by Takuji Nishimura and Makoto Matsumoto.\n\n Before using, initialize the state by using init_genrand(seed)\n or init_by_array(init_key, key_length).\n\n Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions\n are met:\n\n 1. Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\n 3. The names of its contributors may not be used to endorse or promote\n products derived from this software without specific prior written\n permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n Any feedback is very welcome.\n http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html\n email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)\n */\n\nvar MersenneTwister = function (seed) {\n if (seed == undefined) {\n seed = new Date().getTime();\n }\n /* Period parameters */\n this.N = 624;\n this.M = 397;\n this.MATRIX_A = 0x9908b0df;\n /* constant vector a */\n this.UPPER_MASK = 0x80000000;\n /* most significant w-r bits */\n this.LOWER_MASK = 0x7fffffff;\n /* least significant r bits */\n\n this.mt = new Array(this.N);\n /* the array for the state vector */\n this.mti = this.N + 1;\n /* mti==N+1 means mt[N] is not initialized */\n\n this.init_genrand(seed);\n}\n\n/* initializes mt[N] with a seed */\nMersenneTwister.prototype.init_genrand = function (s) {\n this.mt[0] = s >>> 0;\n for (this.mti = 1; this.mti < this.N; this.mti++) {\n var s = this.mt[this.mti - 1] ^ (this.mt[this.mti - 1] >>> 30);\n this.mt[this.mti] = (((((s & 0xffff0000) >>> 16) * 1812433253) << 16) + (s & 0x0000ffff) * 1812433253)\n + this.mti;\n /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */\n /* In the previous versions, MSBs of the seed affect */\n /* only MSBs of the array mt[]. */\n /* 2002/01/09 modified by Makoto Matsumoto */\n this.mt[this.mti] >>>= 0;\n /* for >32 bit machines */\n }\n}\n\n/* initialize by an array with array-length */\n/* init_key is the array for initializing keys */\n/* key_length is its length */\n/* slight change for C++, 2004/2/26 */\nMersenneTwister.prototype.init_by_array = function (init_key, key_length) {\n var i, j, k;\n this.init_genrand(19650218);\n i = 1;\n j = 0;\n k = (this.N > key_length ? this.N : key_length);\n for (; k; k--) {\n var s = this.mt[i - 1] ^ (this.mt[i - 1] >>> 30)\n this.mt[i] = (this.mt[i] ^ (((((s & 0xffff0000) >>> 16) * 1664525) << 16) + ((s & 0x0000ffff) * 1664525)))\n + init_key[j] + j;\n /* non linear */\n this.mt[i] >>>= 0;\n /* for WORDSIZE > 32 machines */\n i++;\n j++;\n if (i >= this.N) {\n this.mt[0] = this.mt[this.N - 1];\n i = 1;\n }\n if (j >= key_length) {\n j = 0;\n }\n }\n for (k = this.N - 1; k; k--) {\n var s = this.mt[i - 1] ^ (this.mt[i - 1] >>> 30);\n this.mt[i] = (this.mt[i] ^ (((((s & 0xffff0000) >>> 16) * 1566083941) << 16) + (s & 0x0000ffff) * 1566083941))\n - i;\n /* non linear */\n this.mt[i] >>>= 0;\n /* for WORDSIZE > 32 machines */\n i++;\n if (i >= this.N) {\n this.mt[0] = this.mt[this.N - 1];\n i = 1;\n }\n }\n\n this.mt[0] = 0x80000000;\n /* MSB is 1; assuring non-zero initial array */\n}\n\n/* generates a random number on [0,0xffffffff]-interval */\nMersenneTwister.prototype.genrand_int32 = function () {\n var y;\n var mag01 = new Array(0x0, this.MATRIX_A);\n /* mag01[x] = x * MATRIX_A for x=0,1 */\n\n if (this.mti >= this.N) { /* generate N words at one time */\n var kk;\n\n if (this.mti == this.N + 1) /* if init_genrand() has not been called, */\n {\n this.init_genrand(5489);\n }\n /* a default initial seed is used */\n\n for (kk = 0; kk < this.N - this.M; kk++) {\n y = (this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK);\n this.mt[kk] = this.mt[kk + this.M] ^ (y >>> 1) ^ mag01[y & 0x1];\n }\n for (; kk < this.N - 1; kk++) {\n y = (this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK);\n this.mt[kk] = this.mt[kk + (this.M - this.N)] ^ (y >>> 1) ^ mag01[y & 0x1];\n }\n y = (this.mt[this.N - 1] & this.UPPER_MASK) | (this.mt[0] & this.LOWER_MASK);\n this.mt[this.N - 1] = this.mt[this.M - 1] ^ (y >>> 1) ^ mag01[y & 0x1];\n\n this.mti = 0;\n }\n\n y = this.mt[this.mti++];\n\n /* Tempering */\n y ^= (y >>> 11);\n y ^= (y << 7) & 0x9d2c5680;\n y ^= (y << 15) & 0xefc60000;\n y ^= (y >>> 18);\n\n return y >>> 0;\n}\n\n/* generates a random number on [0,0x7fffffff]-interval */\nMersenneTwister.prototype.genrand_int31 = function () {\n return (this.genrand_int32() >>> 1);\n}\n\n/* generates a random number on [0,1]-real-interval */\nMersenneTwister.prototype.genrand_real1 = function () {\n return this.genrand_int32() * (1.0 / 4294967295.0);\n /* divided by 2^32-1 */\n}\n\n/* generates a random number on [0,1)-real-interval */\nMersenneTwister.prototype.random = function () {\n return this.genrand_int32() * (1.0 / 4294967296.0);\n /* divided by 2^32 */\n}\n\n/* generates a random number on (0,1)-real-interval */\nMersenneTwister.prototype.genrand_real3 = function () {\n return (this.genrand_int32() + 0.5) * (1.0 / 4294967296.0);\n /* divided by 2^32 */\n}\n\n/* generates a random number on [0,1) with 53-bit resolution*/\nMersenneTwister.prototype.genrand_res53 = function () {\n var a = this.genrand_int32() >>> 5, b = this.genrand_int32() >>> 6;\n return(a * 67108864.0 + b) * (1.0 / 9007199254740992.0);\n}\n\n/* These real versions are due to Isaku Wada, 2002/01/09 added */\n\n\nvar $builtinmodule = function (name) {\n\n var mod = {};\n\n var myGenerator = new MersenneTwister();\n var nextNormalSample = undefined;\n\n mod.seed = new Sk.builtin.func(function (x) {\n Sk.builtin.pyCheckArgs(\"seed\", arguments, 0, 1);\n x = Sk.builtin.asnum$(x);\n\n if (arguments.length > 0) {\n myGenerator = new MersenneTwister(x);\n }\n else {\n myGenerator = new MersenneTwister();\n }\n\n return Sk.builtin.none.none$;\n });\n\n mod.random = new Sk.builtin.func(function () {\n Sk.builtin.pyCheckArgs(\"random\", arguments, 0, 0);\n\n return new Sk.builtin.float_(myGenerator.genrand_res53());\n });\n\n var toInt = function (num) {\n return num | 0;\n };\n\n var randrange = function (start, stop, step) {\n // Ported from CPython 2.7\n var width, n, ret;\n\n if (!Sk.builtin.checkInt(start)) {\n throw new Sk.builtin.ValueError(\"non-integer first argument for randrange()\");\n }\n ;\n\n if (stop === undefined) {\n // Random in [0, start)\n ret = toInt(myGenerator.genrand_res53() * start);\n return new Sk.builtin.int_(ret);\n }\n ;\n\n if (!Sk.builtin.checkInt(stop)) {\n throw new Sk.builtin.ValueError(\"non-integer stop for randrange()\");\n }\n ;\n\n if (step === undefined) {\n step = 1;\n }\n ;\n\n width = stop - start;\n\n if ((step == 1) && (width > 0)) {\n // Random in [start, stop), must use toInt on product for correct results with negative ranges\n ret = start + toInt(myGenerator.genrand_res53() * width);\n return new Sk.builtin.int_(ret);\n }\n ;\n\n if (step == 1) {\n throw new Sk.builtin.ValueError(\"empty range for randrange() (\" + start + \", \" + stop + \", \" + width + \")\");\n }\n ;\n\n if (!Sk.builtin.checkInt(step)) {\n throw new Sk.builtin.ValueError(\"non-integer step for randrange()\");\n }\n ;\n\n if (step > 0) {\n n = toInt((width + step - 1) / step);\n } else if (step < 0) {\n n = toInt((width + step + 1) / step);\n } else {\n throw new Sk.builtin.ValueError(\"zero step for randrange()\");\n }\n ;\n\n if (n <= 0) {\n throw new Sk.builtin.ValueError(\"empty range for randrange()\");\n }\n ;\n\n // Random in range(start, stop, step)\n ret = start + (step * toInt(myGenerator.genrand_res53() * n));\n return new Sk.builtin.int_(ret);\n };\n\n mod.randint = new Sk.builtin.func(function (a, b) {\n Sk.builtin.pyCheckArgs(\"randint\", arguments, 2, 2);\n\n a = Sk.builtin.asnum$(a);\n b = Sk.builtin.asnum$(b);\n return randrange(a, b + 1);\n });\n\n mod.randrange = new Sk.builtin.func(function (start, stop, step) {\n Sk.builtin.pyCheckArgs(\"randrange\", arguments, 1, 3);\n\n start = Sk.builtin.asnum$(start);\n stop = Sk.builtin.asnum$(stop);\n step = Sk.builtin.asnum$(step);\n return randrange(start, stop, step);\n });\n \n mod.uniform = new Sk.builtin.func(function (a, b) {\n Sk.builtin.pyCheckArgs(\"uniform\", arguments, 2, 2);\n\n a = Sk.builtin.asnum$(a);\n b = Sk.builtin.asnum$(b);\n var rnd = myGenerator.genrand_res53();\n c = a + rnd * (b - a)\n return new Sk.builtin.float_(c);\n });\n\n mod.triangular = new Sk.builtin.func(function (low, high, mode) {\n Sk.builtin.pyCheckArgs(\"triangular\", arguments, 2, 3);\n Sk.builtin.pyCheckType(\"low\", \"number\", Sk.builtin.checkNumber(low));\n Sk.builtin.pyCheckType(\"high\", \"number\", Sk.builtin.checkNumber(high));\n\n var rnd, sample, swap;\n\n low = Sk.builtin.asnum$(low);\n high = Sk.builtin.asnum$(high);\n if (low > high) {\n swap = low;\n low = high;\n high = swap;\n }\n if ((mode === undefined) || (mode instanceof Sk.builtin.none)) {\n mode = (high - low)/2.0;\n } else {\n Sk.builtin.pyCheckType(\"mode\", \"number\", Sk.builtin.checkNumber(mode));\n mode = Sk.builtin.asnum$(mode);\n }\n\n // https://en.wikipedia.org/wiki/Triangular_distribution\n rnd = myGenerator.genrand_res53();\n if (rnd < (mode - low)/(high - low)) {\n sample = low + Math.sqrt(rnd * (high - low) * (mode - low));\n } else {\n sample = high - Math.sqrt((1 - rnd) * (high - low) * (high - mode));\n }\n\n return new Sk.builtin.float_(sample);\n });\n\n var normalSample = function(mu, sigma) {\n var r1, r2, u, v, s;\n\n // Box-Muller transform\n // (https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform)\n // generates two independent samples from a Gaussian\n // distribution. Return one of them and store the another one\n // and return it next time.\n\n if (nextNormalSample !== undefined) {\n s = nextNormalSample;\n nextNormalSample = undefined;\n } else {\n r1 = myGenerator.genrand_res53();\n r2 = myGenerator.genrand_res53();\n u = Math.sqrt(-2*Math.log(r1));\n v = 2*Math.PI*r2;\n s = u * Math.cos(v);\n nextNormalSample = u * Math.sin(v);\n }\n\n return mu + sigma*s;\n };\n \n mod.gauss = new Sk.builtin.func(function (mu, sigma) {\n Sk.builtin.pyCheckArgs(\"gauss\", arguments, 2, 2);\n Sk.builtin.pyCheckType(\"mu\", \"number\", Sk.builtin.checkNumber(mu));\n Sk.builtin.pyCheckType(\"sigma\", \"number\", Sk.builtin.checkNumber(sigma));\n\n mu = Sk.builtin.asnum$(mu);\n sigma = Sk.builtin.asnum$(sigma);\n\n return new Sk.builtin.float_(normalSample(mu, sigma));\n });\n\n // CPython uses a different (slower but thread-safe) algorithm for\n // normalvariate. We use the same algorithm for normalvariate and\n // gauss.\n mod.normalvariate = mod.gauss;\n\n mod.lognormvariate = new Sk.builtin.func(function (mu, sigma) {\n Sk.builtin.pyCheckArgs(\"lognormvariate\", arguments, 2, 2);\n Sk.builtin.pyCheckType(\"mu\", \"number\", Sk.builtin.checkNumber(mu));\n Sk.builtin.pyCheckType(\"sigma\", \"number\", Sk.builtin.checkNumber(sigma));\n\n mu = Sk.builtin.asnum$(mu);\n sigma = Sk.builtin.asnum$(sigma);\n\n return new Sk.builtin.float_(Math.exp(normalSample(mu, sigma)));\n });\n\n mod.expovariate = new Sk.builtin.func(function (lambd) {\n Sk.builtin.pyCheckArgs(\"expovariate\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"lambd\", \"number\", Sk.builtin.checkNumber(lambd));\n\n lambd = Sk.builtin.asnum$(lambd);\n\n var rnd = myGenerator.genrand_res53();\n return new Sk.builtin.float_(-Math.log(rnd)/lambd);\n });\n\n mod.choice = new Sk.builtin.func(function (seq) {\n Sk.builtin.pyCheckArgs(\"choice\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"seq\", \"sequence\", Sk.builtin.checkSequence(seq));\n\n if (seq.sq$length !== undefined) {\n var r = toInt(myGenerator.genrand_res53() * seq.sq$length());\n return seq.mp$subscript(r);\n } else {\n throw new Sk.builtin.TypeError(\"object has no length\");\n }\n });\n\n mod.shuffle = new Sk.builtin.func(function (x) {\n Sk.builtin.pyCheckArgs(\"shuffle\", arguments, 1, 1);\n Sk.builtin.pyCheckType(\"x\", \"sequence\", Sk.builtin.checkSequence(x));\n\n if (x.sq$length !== undefined) {\n if (x.mp$ass_subscript !== undefined) {\n for (var i = x.sq$length() - 1; i > 0; i -= 1) {\n var r = toInt(myGenerator.genrand_res53() * (i + 1));\n var tmp = x.mp$subscript(r);\n x.mp$ass_subscript(r, x.mp$subscript(i));\n x.mp$ass_subscript(i, tmp);\n }\n ;\n } else {\n throw new Sk.builtin.TypeError(\"object is immutable\");\n }\n ;\n } else {\n throw new Sk.builtin.TypeError(\"object has no length\");\n }\n ;\n\n return Sk.builtin.none.none$;\n });\n\n mod.sample = new Sk.builtin.func(function (population, k) {\n var i, j, iter, elem, reservoir;\n\n Sk.builtin.pyCheckArgs(\"sample\", arguments, 2, 2);\n Sk.builtin.pyCheckType(\"population\", \"iterable\", Sk.builtin.checkIterable(population));\n Sk.builtin.pyCheckType(\"k\", \"integer\", Sk.builtin.checkInt(k));\n k = Sk.builtin.asnum$(k);\n \n // \"Algorithm R\" in\n // https://en.wikipedia.org/wiki/Reservoir_sampling\n //\n // This algorithm guarantees that each element has\n // equal probability of being included in the\n // resulting list. See the Wikipedia page for a proof.\n //\n // This requires no extra space but the runtime is\n // proportional to len(population). CPython implements a fast\n // path for the case when k is much smaller than\n // len(population). A similar optimization could be\n // implemented here.\n reservoir = [];\n iter = Sk.abstr.iter(population);\n for (i = 0, elem = iter.tp$iternext();\n elem !== undefined;\n i++, elem = iter.tp$iternext()) {\n j = Math.floor(myGenerator.genrand_res53() * (i + 1));\n if (i < k) {\n // Fill the reservoir\n if (j < i) {\n // Shuffle the existing elements to ensure that\n // subslices are valid random samples\n reservoir[i] = reservoir[j];\n }\n reservoir[j] = elem;\n } else {\n // Replace elements with a probability that decreases\n // the further we get\n if (j < k) {\n reservoir[j] = elem;\n }\n }\n }\n \n if (i < k) {\n throw new Sk.builtin.ValueError(\"sample larger than population\");\n }\n\n return Sk.builtin.list(reservoir);\n });\n\n return mod;\n}\n", "src/lib/plistlib.py": "raise NotImplementedError(\"plistlib is not yet implemented in Skulpt\")\n", "src/lib/tarfile.py": "raise NotImplementedError(\"tarfile is not yet implemented in Skulpt\")\n", "src/lib/pydoc_topics.py": "raise NotImplementedError(\"pydoc_topics is not yet implemented in Skulpt\")\n", "src/lib/colorsys.py": "raise NotImplementedError(\"colorsys is not yet implemented in Skulpt\")\n", "src/lib/webbrowser.py": "raise NotImplementedError(\"webbrowser is not yet implemented in Skulpt\")\n", "src/lib/mimetools.py": "raise NotImplementedError(\"mimetools is not yet implemented in Skulpt\")\n", "src/lib/pythonds/trees/bst.py": "#!/bin/env python3.1\n# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005, 2010\n# \n\nclass BinarySearchTree:\n '''\n Author: Brad Miller\n Date: 1/15/2005\n Description: Imlement a binary search tree with the following interface\n functions: \n __contains__(y) <==> y in x\n __getitem__(y) <==> x[y]\n __init__()\n __len__() <==> len(x)\n __setitem__(k,v) <==> x[k] = v\n clear()\n get(k)\n items() \n keys() \n values()\n put(k,v)\n in\n del <==> \n '''\n\n def __init__(self):\n self.root = None\n self.size = 0\n \n def put(self,key,val):\n if self.root:\n self._put(key,val,self.root)\n else:\n self.root = TreeNode(key,val)\n self.size = self.size + 1\n\n def _put(self,key,val,currentNode):\n if key < currentNode.key:\n if currentNode.hasLeftChild():\n self._put(key,val,currentNode.leftChild)\n else:\n currentNode.leftChild = TreeNode(key,val,parent=currentNode)\n else:\n if currentNode.hasRightChild():\n self._put(key,val,currentNode.rightChild)\n else:\n currentNode.rightChild = TreeNode(key,val,parent=currentNode)\n \n def __setitem__(self,k,v):\n self.put(k,v)\n\n def get(self,key):\n if self.root:\n res = self._get(key,self.root)\n if res:\n return res.payload\n else:\n return None\n else:\n return None\n \n def _get(self,key,currentNode):\n if not currentNode:\n return None\n elif currentNode.key == key:\n return currentNode\n elif key < currentNode.key:\n return self._get(key,currentNode.leftChild)\n else:\n return self._get(key,currentNode.rightChild)\n \n \n def __getitem__(self,key):\n res = self.get(key)\n if res:\n return res\n else:\n raise KeyError('Error, key not in tree')\n \n\n def __contains__(self,key):\n if self._get(key,self.root):\n return True\n else:\n return False\n \n def length(self):\n return self.size\n\n def __len__(self):\n return self.size\n\n def __iter__(self):\n return self.root.__iter__()\n \n def delete(self,key):\n if self.size > 1:\n nodeToRemove = self._get(key,self.root)\n if nodeToRemove:\n self.remove(nodeToRemove)\n self.size = self.size-1\n else:\n raise KeyError('Error, key not in tree')\n elif self.size == 1 and self.root.key == key:\n self.root = None\n self.size = self.size - 1\n else:\n raise KeyError('Error, key not in tree')\n\n def __delitem__(self,key):\n self.delete(key)\n \n def remove(self,currentNode):\n if currentNode.isLeaf(): #leaf\n if currentNode == currentNode.parent.leftChild:\n currentNode.parent.leftChild = None\n else:\n currentNode.parent.rightChild = None\n elif currentNode.hasBothChildren(): #interior\n succ = currentNode.findSuccessor()\n succ.spliceOut()\n currentNode.key = succ.key\n currentNode.payload = succ.payload\n else: # this node has one child\n if currentNode.hasLeftChild():\n if currentNode.isLeftChild():\n currentNode.leftChild.parent = currentNode.parent\n currentNode.parent.leftChild = currentNode.leftChild\n elif currentNode.isRightChild():\n currentNode.leftChild.parent = currentNode.parent\n currentNode.parent.rightChild = currentNode.leftChild\n else:\n currentNode.replaceNodeData(currentNode.leftChild.key,\n currentNode.leftChild.payload,\n currentNode.leftChild.leftChild,\n currentNode.leftChild.rightChild)\n else:\n if currentNode.isLeftChild():\n currentNode.rightChild.parent = currentNode.parent\n currentNode.parent.leftChild = currentNode.rightChild\n elif currentNode.isRightChild():\n currentNode.rightChild.parent = currentNode.parent\n currentNode.parent.rightChild = currentNode.rightChild\n else:\n currentNode.replaceNodeData(currentNode.rightChild.key,\n currentNode.rightChild.payload,\n currentNode.rightChild.leftChild,\n currentNode.rightChild.rightChild)\n\n def inorder(self):\n self._inorder(self.root)\n\n def _inorder(self,tree):\n if tree != None:\n self._inorder(tree.leftChild)\n print(tree.key)\n self._inorder(tree.rightChild)\n\n def postorder(self):\n self._postorder(self.root)\n\n def _postorder(self, tree):\n if tree:\n self._postorder(tree.rightChild)\n self._postorder(tree.leftChild)\n print(tree.key) \n\n def preorder(self):\n self._preorder(self,self.root)\n\n def _preorder(self,tree):\n if tree:\n print(tree.key) \n self._preorder(tree.leftChild)\n self._preorder(tree.rightChild)\n\n \nclass TreeNode:\n def __init__(self,key,val,left=None,right=None,parent=None):\n self.key = key\n self.payload = val\n self.leftChild = left\n self.rightChild = right\n self.parent = parent\n self.balanceFactor = 0\n \n def hasLeftChild(self):\n return self.leftChild\n\n def hasRightChild(self):\n return self.rightChild\n \n def isLeftChild(self):\n return self.parent and self.parent.leftChild == self\n\n def isRightChild(self):\n return self.parent and self.parent.rightChild == self\n\n def isRoot(self):\n return not self.parent\n\n def isLeaf(self):\n return not (self.rightChild or self.leftChild)\n\n def hasAnyChildren(self):\n return self.rightChild or self.leftChild\n\n def hasBothChildren(self):\n return self.rightChild and self.leftChild\n \n def replaceNodeData(self,key,value,lc,rc):\n self.key = key\n self.payload = value\n self.leftChild = lc\n self.rightChild = rc\n if self.hasLeftChild():\n self.leftChild.parent = self\n if self.hasRightChild():\n self.rightChild.parent = self\n \n def findSuccessor(self):\n succ = None\n if self.hasRightChild():\n succ = self.rightChild.findMin()\n else:\n if self.parent:\n if self.isLeftChild():\n succ = self.parent\n else:\n self.parent.rightChild = None\n succ = self.parent.findSuccessor()\n self.parent.rightChild = self\n return succ\n\n\n def spliceOut(self):\n if self.isLeaf():\n if self.isLeftChild():\n self.parent.leftChild = None\n else:\n self.parent.rightChild = None\n elif self.hasAnyChildren():\n if self.hasLeftChild():\n if self.isLeftChild():\n self.parent.leftChild = self.leftChild\n else:\n self.parent.rightChild = self.leftChild\n self.leftChild.parent = self.parent\n else:\n if self.isLeftChild():\n self.parent.leftChild = self.rightChild\n else:\n self.parent.rightChild = self.rightChild\n self.rightChild.parent = self.parent\n\n def findMin(self):\n current = self\n while current.hasLeftChild():\n current = current.leftChild\n return current\n\n def __iter__(self):\n \"\"\"The standard inorder traversal of a binary tree.\"\"\"\n if self:\n if self.hasLeftChild():\n for elem in self.leftChild:\n yield elem\n yield self.key\n if self.hasRightChild():\n for elem in self.rightChild:\n yield elem\n\n \n", "src/lib/document.js": "var $builtinmodule = function (name) {\n var elementClass;\n var mod = {};\n\n mod.getElementById = new Sk.builtin.func(function (id) {\n var result = document.getElementById(id.v);\n if (result) {\n return Sk.misceval.callsim(mod.Element, result);\n }\n return Sk.builtin.none.none$;\n });\n\n mod.createElement = new Sk.builtin.func(function (eName) {\n var r = document.createElement(eName.v);\n if (r) {\n return Sk.misceval.callsim(mod.Element, r);\n }\n });\n\n\n mod.getElementsByTagName = new Sk.builtin.func(function (tag) {\n var r = document.getElementsByTagName(tag.v)\n var reslist = [];\n for (var i = r.length - 1; i >= 0; i--) {\n reslist.push(Sk.misceval.callsim(mod.Element, r[i]))\n }\n return new Sk.builtin.list(reslist)\n });\n\n mod.getElementsByClassName = new Sk.builtin.func(function (cname) {\n var r = document.getElementsByClassName(cname.v);\n var reslist = [];\n for (var i = 0; i < r.length; i++) {\n reslist.push(Sk.misceval.callsim(mod.Element, r[i]));\n }\n ;\n return new Sk.builtin.list(reslist);\n });\n\n mod.getElementsByName = new Sk.builtin.func(function (cname) {\n var r = document.getElementsByName(cname.v);\n var reslist = [];\n for (var i = 0; i < r.length; i++) {\n reslist.push(Sk.misceval.callsim(mod.Element, r[i]));\n }\n ;\n return new Sk.builtin.list(reslist);\n });\n\n mod.currentDiv = new Sk.builtin.func(function () {\n if (Sk.divid !== undefined) {\n return new Sk.builtin.str(Sk.divid)\n }\n else {\n throw new Sk.builtin.AttributeError(\"There is no value set for divid\");\n }\n })\n\n elementClass = function ($gbl, $loc) {\n /*\n Notes: self['$d'] is the dictionary used by the GenericGetAttr mechanism for an object.\n for various reasons if you create a class in Javascript and have self.xxxx instance\n variables, you cannot say instance.xxx and get the value of the instance variable unless\n it is stored in the self['$d'] object. This seems like a duplication of storage to me\n but that is how it works right now (5/2013)\n\n Writing your own __getattr__ is also an option but this gets very tricky when an attr is\n a method...\n */\n $loc.__init__ = new Sk.builtin.func(function (self, elem) {\n self.v = elem\n self.innerHTML = elem.innerHTML\n self.innerText = elem.innerText\n if (elem.value !== undefined) {\n self.value = elem.value\n Sk.abstr.objectSetItem(self['$d'], new Sk.builtin.str('value'), new Sk.builtin.str(self.value))\n }\n\n if (elem.checked !== undefined) {\n self.checked = elem.checked\n Sk.abstr.objectSetItem(self['$d'], new Sk.builtin.str('checked'), new Sk.builtin.str(self.checked))\n }\n\n Sk.abstr.objectSetItem(self['$d'], new Sk.builtin.str('innerHTML'), new Sk.builtin.str(self.innerHTML))\n Sk.abstr.objectSetItem(self['$d'], new Sk.builtin.str('innerText'), new Sk.builtin.str(self.innerText))\n\n })\n\n $loc.tp$getattr = Sk.builtin.object.prototype.GenericGetAttr;\n\n $loc.__setattr__ = new Sk.builtin.func(function (self, key, value) {\n key = Sk.ffi.remapToJs(key);\n if (key === 'innerHTML') {\n self.innerHTML = value\n self.v.innerHTML = value.v\n Sk.abstr.objectSetItem(self['$d'], new Sk.builtin.str('innerHTML'), value)\n }\n if (key === 'innerText') {\n self.innerText = value\n self.v.innerText = value.v\n Sk.abstr.objectSetItem(self['$d'], new Sk.builtin.str('innerText'), value)\n }\n });\n\n\n $loc.appendChild = new Sk.builtin.func(function (self, ch) {\n self.v.appendChild(ch.v);\n });\n\n $loc.removeChild = new Sk.builtin.func(function (self, node) {\n self.v.removeChild(node.v)\n })\n\n // getCSS\n\n $loc.getCSS = new Sk.builtin.func(function (self, key) {\n return new Sk.builtin.str(self.v.style[key.v]);\n });\n\n\n $loc.setCSS = new Sk.builtin.func(function (self, attr, value) {\n self.v.style[attr.v] = value.v\n\n })\n\n $loc.getAttribute = new Sk.builtin.func(function (self, key) {\n var res = self.v.getAttribute(key.v)\n if (res) {\n return new Sk.builtin.str(res)\n } else {\n return Sk.builtin.none.none$;\n }\n });\n\n $loc.setAttribute = new Sk.builtin.func(function (self, attr, value) {\n self.v.setAttribute(attr.v, value.v)\n });\n\n $loc.getProperty = new Sk.builtin.func(function (self, key) {\n var res = self.v[key.v]\n if (res) {\n return new Sk.builtin.str(res)\n } else {\n return Sk.builtin.none.none$;\n }\n });\n\n $loc.__str__ = new Sk.builtin.func(function (self) {\n console.log(self.v.tagName);\n return new Sk.builtin.str(self.v.tagName)\n })\n\n $loc.__repr__ = new Sk.builtin.func(function (self) {\n return new Sk.builtin.str('[DOM Element]')\n })\n\n\n };\n\n mod.Element = Sk.misceval.buildClass(mod, elementClass, 'Element', []);\n\n return mod;\n\n}\n", "src/lib/hashlib.py": "raise NotImplementedError(\"hashlib is not yet implemented in Skulpt\")\n", "src/lib/_threading_local.py": "raise NotImplementedError(\"_threading_local is not yet implemented in Skulpt\")\n", "src/lib/profile.py": "raise NotImplementedError(\"profile is not yet implemented in Skulpt\")\n", "src/lib/copy.py": "\"\"\"\nThis file was modified from CPython.\nCopyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,\n2011, 2012, 2013, 2014, 2015 Python Software Foundation; All Rights Reserved\n\"\"\"\nimport types\nclass Error(Exception):\n pass\nerror = Error \nclass _EmptyClass:\n pass\n\ndef copy(x):\n cls = type(x)\n if callable(x):\n return x\n copier = getattr(cls, \"__copy__\", None)\n if copier:\n return copier(x)\n if cls in (type(None), int, float, bool, long, str, tuple, type):\n return x\n if (cls == list) or (cls == dict) or (cls == set) or (cls == slice):\n return cls(x)\n try:\n getstate = getattr(x, \"__getstate__\", None)\n setstate = getattr(x, \"__setstate__\", None)\n initargs = getattr(x, \"__getinitargs__\", None)\n except:\n reductor = False\n if getstate or setstate or initargs:\n raise NotImplementedError(\"Skulpt does not yet support copying with user-defined __getstate__, __setstate__ or __getinitargs__()\")\n reductor = getattr(x, \"__reduce_ex__\", None)\n if reductor:\n rv = reductor(4)\n else:\n reductor = getattr(x, \"__reduce__\", None)\n if reductor:\n rv = reductor()\n elif str(cls)[1:6] == \"class\":\n copier = _copy_inst\n return copier(x)\n else:\n raise Error(\"un(shallow)copyable object of type %s\" % cls)\n if isinstance(rv, str):\n return x\n return _reconstruct(x, rv, 0)\n\ndef _copy_inst(x):\n if hasattr(x, '__copy__'):\n return x.__copy__()\n if hasattr(x, '__getinitargs__'):\n args = x.__getinitargs__()\n y = x.__class__(*args)\n else:\n y = _EmptyClass()\n y.__class__ = x.__class__\n if hasattr(x, '__getstate__'):\n state = x.__getstate__()\n else:\n state = x.__dict__\n if hasattr(y, '__setstate__'):\n y.__setstate__(state)\n else:\n y.__dict__.update(state)\n return y\n\nd = _deepcopy_dispatch = {}\n\ndef deepcopy(x, memo=None, _nil=[]):\n \"\"\"Deep copy operation on arbitrary Python objects.\n See the module's __doc__ string for more info.\n \"\"\"\n if memo is None:\n memo = {}\n idx = id(x)\n y = memo.get(idx, _nil)\n if y is not _nil:\n return y\n cls = type(x)\n try:\n getstate = getattr(x, \"__getstate__\", None)\n setstate = getattr(x, \"__setstate__\", None)\n initargs = getattr(x, \"__getinitargs__\", None)\n except:\n reductor = False\n if getstate or setstate or initargs:\n raise NotImplementedError(\"Skulpt does not yet support copying with user-defined __getstate__, __setstate__ or __getinitargs__()\")\n copier = _deepcopy_dispatch.get(cls)\n if copier:\n y = copier(x, memo)\n elif str(cls)[1:6] == \"class\":\n copier = _deepcopy_dispatch[\"InstanceType\"]\n y = copier(x, memo)\n else:\n try:\n issc = issubclass(cls, type)\n except TypeError: # cls is not a class (old Boost; see SF #502085)\n issc = 0\n if issc:\n y = _deepcopy_atomic(x, memo)\n else:\n copier = getattr(x, \"__deepcopy__\", None)\n if copier:\n y = copier(memo)\n else:\n reductor = getattr(x, \"__reduce_ex__\", None)\n if reductor:\n rv = reductor(2)\n else:\n reductor = getattr(x, \"__reduce__\", None)\n if reductor:\n rv = reductor()\n else:\n raise Error(\n \"un(deep)copyable object of type %s\" % cls)\n y = _reconstruct(x, rv, 1, memo)\n memo[idx] = y\n _keep_alive(x, memo) # Make sure x lives at least as long as d\n return y\n\ndef _deepcopy_atomic(x, memo):\n return x\nd[type(None)] = _deepcopy_atomic\n# d[type(Ellipsis)] = _deepcopy_atomic\nd[type(NotImplemented)] = _deepcopy_atomic\nd[int] = _deepcopy_atomic\nd[float] = _deepcopy_atomic\nd[bool] = _deepcopy_atomic\nd[complex] = _deepcopy_atomic\n# d[bytes] = _deepcopy_atomic\nd[str] = _deepcopy_atomic\n# try:\n# d[types.CodeType] = _deepcopy_atomic\n# except AttributeError:\n# pass\nd[type] = _deepcopy_atomic\n# d[types.BuiltinFunctionType] = _deepcopy_atomic\nd[types.FunctionType] = _deepcopy_atomic\n# d[weakref.ref] = _deepcopy_atomic\n\ndef _deepcopy_list(x, memo):\n y = []\n memo[id(x)] = y\n for a in x:\n y.append(deepcopy(a, memo))\n return y\nd[list] = _deepcopy_list\n\ndef _deepcopy_set(x, memo):\n result = set([]) # make empty set\n memo[id(x)] = result # register this set in the memo for loop checking\n for a in x: # go through elements of set\n result.add(deepcopy(a, memo)) # add the copied elements into the new set\n return result # return the new set\nd[set] = _deepcopy_set\n\ndef _deepcopy_tuple(x, memo):\n y = [deepcopy(a, memo) for a in x]\n # We're not going to put the tuple in the memo, but it's still important we\n # check for it, in case the tuple contains recursive mutable structures.\n try:\n return memo[id(x)]\n except KeyError:\n pass\n for k, j in zip(x, y):\n if k is not j:\n y = tuple(y)\n break\n else:\n y = x\n return y\nd[tuple] = _deepcopy_tuple\n\ndef _deepcopy_dict(x, memo):\n y = {}\n memo[id(x)] = y\n for key, value in x.items():\n y[deepcopy(key, memo)] = deepcopy(value, memo)\n return y\nd[dict] = _deepcopy_dict\n\ndef _deepcopy_method(x, memo): # Copy instance methods\n y = type(x)(x.im_func, deepcopy(x.im_self, memo), x.im_class);\n return y\nd[types.MethodType] = _deepcopy_method\n\ndef _deepcopy_inst(x, memo):\n if hasattr(x, '__deepcopy__'):\n return x.__deepcopy__(memo)\n if hasattr(x, '__getinitargs__'):\n args = x.__getinitargs__()\n args = deepcopy(args, memo)\n y = x.__class__(*args)\n else:\n y = _EmptyClass()\n y.__class__ = x.__class__\n memo[id(x)] = y\n if hasattr(x, '__getstate__'):\n state = x.__getstate__()\n else:\n state = x.__dict__\n state = deepcopy(state, memo)\n if hasattr(y, '__setstate__'):\n y.__setstate__(state)\n else:\n y.__dict__.update(state)\n return y\nd[\"InstanceType\"] = _deepcopy_inst\n\ndef _keep_alive(x, memo):\n \"\"\"Keeps a reference to the object x in the memo.\n Because we remember objects by their id, we have\n to assure that possibly temporary objects are kept\n alive by referencing them.\n We store a reference at the id of the memo, which should\n normally not be used unless someone tries to deepcopy\n the memo itself...\n \"\"\"\n try:\n memo[id(memo)].append(x)\n except KeyError:\n # aha, this is the first one :-)\n memo[id(memo)]=[x]\n\ndef _reconstruct(x, info, deep, memo=None):\n if isinstance(info, str):\n return x\n assert isinstance(info, tuple)\n if memo is None:\n memo = {}\n n = len(info)\n assert n in (2, 3, 4, 5)\n callable, args = info[:2]\n if n > 2:\n state = info[2]\n else:\n state = None\n if n > 3:\n listiter = info[3]\n else:\n listiter = None\n if n > 4:\n dictiter = info[4]\n else:\n dictiter = None\n if deep:\n args = deepcopy(args, memo)\n y = callable(*args)\n memo[id(x)] = y\n\n if state is not None:\n if deep:\n state = deepcopy(state, memo)\n if hasattr(y, '__setstate__'):\n y.__setstate__(state)\n else:\n if isinstance(state, tuple) and len(state) == 2:\n state, slotstate = state\n else:\n slotstate = None\n if state is not None:\n y.__dict__.update(state)\n if slotstate is not None:\n for key, value in slotstate.items():\n setattr(y, key, value)\n\n if listiter is not None:\n for item in listiter:\n if deep:\n item = deepcopy(item, memo)\n y.append(item)\n if dictiter is not None:\n for key, value in dictiter:\n if deep:\n key = deepcopy(key, memo)\n value = deepcopy(value, memo)\n y[key] = value\n return y\n\ndel d\n\ndel types\n\n# Helper for instance creation without calling __init__\nclass _EmptyClass:\n pass", "src/lib/binhex.py": "raise NotImplementedError(\"binhex is not yet implemented in Skulpt\")\n", "src/lib/dircache.py": "raise NotImplementedError(\"dircache is not yet implemented in Skulpt\")\n", "src/lib/cgi.py": "raise NotImplementedError(\"cgi is not yet implemented in Skulpt\")\n", "src/lib/posixfile.py": "raise NotImplementedError(\"posixfile is not yet implemented in Skulpt\")\n", "src/lib/netrc.py": "raise NotImplementedError(\"netrc is not yet implemented in Skulpt\")\n", "src/lib/commands.py": "raise NotImplementedError(\"commands is not yet implemented in Skulpt\")\n", "src/lib/sunaudio.py": "raise NotImplementedError(\"sunaudio is not yet implemented in Skulpt\")\n", "src/lib/md5.py": "raise NotImplementedError(\"md5 is not yet implemented in Skulpt\")\n", "src/lib/struct.py": "raise NotImplementedError(\"struct is not yet implemented in Skulpt\")\n", "src/lib/sunau.py": "raise NotImplementedError(\"sunau is not yet implemented in Skulpt\")\n", "src/lib/turtle.js": "var $builtinmodule = function (name) {\n\"use strict\";\n\nfunction getConfiguredTarget() {\n var selector, target;\n\n selector = (Sk.TurtleGraphics && Sk.TurtleGraphics.target) || \"turtle\",\n target = typeof selector === \"string\" ?\n document.getElementById(selector) :\n selector;\n // ensure that the canvas container is empty\n while (target.firstChild) {\n target.removeChild(target.firstChild);\n }\n return target;\n}\n\nfunction generateTurtleModule(_target) {\n var _module = {},\n _durationSinceRedraw = 0,\n _focus = true,\n OPTIMAL_FRAME_RATE = 1000/30,\n SHAPES = {},\n TURTLE_COUNT = 0,\n Types = {},\n _frameRequest,\n _frameRequestTimeout,\n _screenInstance,\n _config,\n _anonymousTurtle,\n _mouseHandler;\n\n // Ensure that the turtle DOM target has a tabindex\n // so that it can accept keyboard focus and events\n if (!_target.hasAttribute(\"tabindex\")) {\n _target.setAttribute(\"tabindex\", 0);\n }\n\n Types.FLOAT = function(value) {\n return Sk.builtin.float_(value);\n };\n Types.COLOR = function(value) {\n if (typeof value === \"string\") {\n return new Sk.builtin.str(value);\n }\n else {\n for(var i = 0; i < 3; i++) {\n value[i] = Sk.builtin.assk$(value[i]);\n }\n if (value.length === 4) {\n value[3] = Sk.builtin.float_(value[3]);\n }\n return new Sk.builtin.tuple(value);\n }\n };\n Types.TURTLE_LIST = function(value) {\n var skValues = [];\n for (var i = 0; i < value.length; i++) {\n skValues.push(value[i].skInstance);\n }\n return new Sk.builtin.tuple(skValues);\n };\n\n SHAPES.arrow = [[-10,0],[10,0],[0,10]];\n SHAPES.square = [[ 10,-10],[10,10],[-10,10],[-10, -10]];\n SHAPES.triangle = [[10,-5.77],[0,11.55],[-10,-5.77]];\n SHAPES.classic = [[0,0],[-5,-9],[0,-7],[5,-9]];\n SHAPES.turtle = [\n [0,16],[-2,14],[-1,10],[-4,7],[-7,9],[-9,8],[-6,5],[-7,1],[-5,-3],[-8,-6],\n [-6,-8],[-4,-5],[0,-7],[4,-5],[6,-8],[8,-6],[5,-3],[7,1],[6,5],[9,8],[7,9],\n [4,7],[1,10],[2,14]\n ];\n\n SHAPES.circle = [\n [10,0],[9.51,3.09],[8.09,5.88],[5.88,8.09],[3.09,9.51],[0,10],[-3.09,9.51],\n [-5.88,8.09],[-8.09,5.88],[-9.51,3.09],[-10,0],[-9.51,-3.09],[-8.09,-5.88],\n [-5.88,-8.09],[-3.09,-9.51],[-0,-10],[3.09,-9.51],[5.88,-8.09],[8.09,-5.88],\n [9.51,-3.09]\n ];\n\n _config = (function() {\n var defaultSetup = {\n target : \"turtle\", // DOM element or id of parent container\n width : 400, // if set to 0 it will use the target width\n height : 400, // if set to 0 it will use the target height\n animate : true, // enabled/disable all animated rendering\n bufferSize : 0, // default turtle buffer size\n allowUndo : true, // enable ability to use the undo buffer\n },\n key;\n\n if (!Sk.TurtleGraphics) {\n Sk.TurtleGraphics = {};\n }\n\n for(key in defaultSetup) {\n if (!Sk.TurtleGraphics.hasOwnProperty(key)) {\n Sk.TurtleGraphics[key] = defaultSetup[key];\n }\n }\n\n return Sk.TurtleGraphics;\n })();\n\n // InstantPromise is a workaround to allow usage of the clean promise-style\n // then/catch syntax but to instantly call resolve the then/catch chain so we\n // can avoid creating Suspensions in unnecessary cases. This is desirable\n // because Suspensions have a fairly large negative impact on overall\n // performance. These 'instant promises' come into play when a tracer()\n // call is made with a value other than 1. When tracer is 0 or greater than 1\n // , we can bypass the creation of a Suspension and proceed to the next line of\n // code immediately if the current line is not going to incur involve a screen\n // update. We determine if a real promise or InstantPromise is necessary by\n // checking FrameManager.willRenderNext()\n function InstantPromise() {\n this.lastResult = undefined;\n this.lastError = undefined;\n }\n\n InstantPromise.prototype.then = function(cb) {\n if (this.lastError) {\n return this;\n }\n\n try {\n this.lastResult = cb(this.lastResult);\n } catch(e) {\n this.lastResult = undefined;\n this.lastError = e;\n }\n\n return this.lastResult instanceof Promise ? this.lastResult : this;\n };\n\n InstantPromise.prototype.catch = function(cb) {\n if (this.lastError) {\n try {\n this.lastResult = cb(this.lastError);\n this.lastError = undefined;\n } catch(e) {\n this.lastResult = undefined;\n this.lastError = e;\n }\n }\n\n return this.lastResult instanceof Promise ? this.lastResult : this;\n };\n\n function FrameManager() {\n this.reset();\n }\n\n var _frameManager;\n function getFrameManager() {\n if (!_frameManager) {\n _frameManager = new FrameManager();\n }\n return _frameManager;\n }\n\n (function(proto) {\n var browserFrame;\n (function(frame) {\n if (frame) {\n browserFrame = function(method) {\n return (_frameRequest = frame(method));\n };\n }\n })(window.requestAnimationFrame || window.mozRequestAnimationFrame);\n\n function animationFrame(delay) {\n if (!_config.animate) {\n return function(method) {\n method();\n };\n }\n\n if (!delay && browserFrame) {\n return browserFrame;\n }\n\n return function(method) {\n _frameRequestTimeout = window.setTimeout(\n method,\n delay || OPTIMAL_FRAME_RATE\n );\n return _frameRequestTimeout;\n };\n }\n\n proto.willRenderNext = function() {\n return !!(this._buffer && this._frameCount+1 === this.frameBuffer());\n };\n\n proto.turtles = function() {\n return this._turtles;\n };\n\n proto.addTurtle = function(turtle) {\n this._turtles.push(turtle);\n };\n\n proto.reset = function() {\n if (this._turtles) {\n for(var i = this._turtles.length; --i >= 0;) {\n this._turtles[i].reset();\n }\n }\n this._turtles = [];\n this._frames = [];\n this._frameCount = 0;\n this._buffer = 1;\n this._rate = 0;\n this._animationFrame = animationFrame();\n };\n\n proto.addFrame = function(method, countAsFrame) {\n var instant = false;\n\n if (countAsFrame) {\n this._frameCount += 1;\n }\n\n this.frames().push(method);\n\n instant = (\n !_config.animate ||\n (this._buffer && this._frameCount === this.frameBuffer())\n );\n\n return instant ? this.update() : new InstantPromise();\n };\n\n proto.frames = function() {\n return this._frames;\n };\n\n proto.frameBuffer = function(buffer) {\n if (typeof buffer === \"number\") {\n this._buffer = buffer | 0;\n if (buffer && buffer <= this._frameCount) {\n return this.update();\n }\n }\n return this._buffer;\n };\n\n proto.refreshInterval = function(rate) {\n if (typeof rate === \"number\") {\n this._rate = rate | 0;\n this._animationFrame = animationFrame(rate);\n }\n return this._rate;\n };\n\n proto.update = function() {\n return (this._frames && this._frames.length) ?\n this.requestAnimationFrame() :\n new InstantPromise();\n };\n\n proto.requestAnimationFrame = function() {\n var frames = this._frames,\n animationFrame = this._animationFrame,\n turtles = this._turtles,\n sprites = getScreen().spriteLayer(),\n turtle, i;\n\n this._frames = [];\n this._frameCount = 0;\n\n return new Promise(function(resolve) {\n animationFrame(function paint() {\n for (i = 0; i < frames.length; i++) {\n if (frames[i]) {\n frames[i]();\n }\n }\n clearLayer(sprites);\n for (i = 0; i < turtles.length; i++) {\n turtle = turtles[i];\n if (turtle.getState().shown) {\n drawTurtle(turtle.getState(), sprites);\n }\n }\n resolve();\n });\n });\n };\n })(FrameManager.prototype);\n\n function MouseHandler() {\n var self = this;\n\n this._target = getTarget();\n this._managers = {};\n this._handlers = {\n mousedown : function(e) {\n self.onEvent(\"mousedown\", e);\n },\n mouseup : function(e) {\n self.onEvent(\"mouseup\", e);\n },\n mousemove : function(e) {\n self.onEvent(\"mousemove\", e);\n }\n };\n for (var key in this._handlers) {\n this._target.addEventListener(key, this._handlers[key]);\n }\n }\n\n (function(proto) {\n proto.onEvent = function(type, e) {\n var managers = this._managers[type],\n moveManagers = this._managers[\"mousemove\"],\n computed = false,\n x, y, localX, localY, i;\n\n function computeCoordinates() {\n if (computed) return;\n var world = getScreen();\n var rect = world.spriteLayer().canvas.getBoundingClientRect();\n x = e.clientX - rect.left | 0;\n y = e.clientY - rect.top | 0;\n localX = x * world.xScale + world.llx;\n localY = y * world.yScale + world.ury;\n computed = true;\n }\n\n if ((type === \"mousedown\" || type === \"mouseup\") && moveManagers && moveManagers.length) {\n computeCoordinates();\n for (i = moveManagers.length; --i >= 0;) {\n if (moveManagers[i].test(x, y, localX, localY)) {\n moveManagers[i].canMove(type === \"mousedown\");\n }\n }\n }\n\n if (managers && managers.length) {\n computeCoordinates();\n for (i = managers.length; --i >= 0;) {\n if (type === \"mousemove\") {\n if (managers[i].canMove()) {\n managers[i].trigger([localX, localY]);\n }\n continue;\n }\n\n if (managers[i].test(x, y, localX, localY)) {\n managers[i].trigger([localX, localY]);\n }\n }\n }\n };\n\n proto.reset = function() {\n this._managers = {};\n };\n\n proto.addManager = function(type, manager) {\n if (!this._managers[type]) {\n this._managers[type] = [];\n }\n\n this._managers[type].push(manager);\n };\n\n })(MouseHandler.prototype);\n\n function EventManager(type, target) {\n this._type = type;\n this._target = target;\n this._handlers = undefined;\n getMouseHandler().addManager(type, this);\n }\n\n (function(proto) {\n proto.reset = function() {\n this._handlers = undefined;\n };\n\n proto.canMove = function(value) {\n if (!this._target || !this._target.hitTest) return false;\n\n if (value !== undefined) {\n this._target.hitTest.hit = value;\n }\n\n return this._target.hitTest.hit;\n };\n\n proto.test = function(x, y, localX, localY) {\n return this._target && this._target.hitTest ?\n this._target.hitTest(x, y, localX, localY) :\n !!this._target;\n };\n\n proto.trigger = function(args) {\n var handlers = this._handlers,\n i;\n\n if (handlers && handlers.length) {\n for (i = 0; i < handlers.length; i++) {\n handlers[i].apply({}, args);\n }\n }\n };\n\n proto.addHandler = function(handler, add) {\n var handlers = this._handlers;\n\n if (!add && handlers && handlers.length) {\n // remove all existing handlers\n while (handlers.shift()) {/* noop */}\n }\n\n if (typeof handler !== \"function\") {\n if (handlers && !handlers.length) {\n this.reset();\n }\n return;\n }\n\n if (!handlers) {\n handlers = this._handlers = [];\n }\n\n handlers.push(handler);\n };\n })(EventManager.prototype);\n\n function Turtle() {\n getFrameManager().addTurtle(this);\n this._screen = getScreen();\n this._managers = {};\n this.reset();\n }\n\n Turtle.RADIANS = 2 * Math.PI;\n\n (function(proto) {\n proto.hitTest = function(mouseX, mouseY, localX, localY) {\n var context = getScreen().hitTestLayer();\n clearLayer(context);\n drawTurtle(this.getState(), context);\n var pixel = context.getImageData(mouseX,mouseY,1,1).data;\n // check alpha first since it is most likely to have a value\n return pixel[3] ||pixel[0] || pixel[1] || pixel[2];\n };\n\n proto.addUpdate = function(method, countAsFrame, stateChanges) {\n var self = this,\n state = this.getState(),\n args = Array.prototype.slice.call(arguments, stateChanges ? 2 : 3);\n\n return getFrameManager().addFrame(function() {\n if (method) {\n method.apply(state, args);\n }\n if (stateChanges) {\n for(var key in stateChanges) {\n state[key] = stateChanges[key];\n }\n }\n }, countAsFrame);\n };\n\n proto.getState = function() {\n var self = this;\n\n if (!this._state) {\n this._state = {\n x : this._x,\n y : this._y,\n angle : this._angle,\n radians : this._radians,\n shape : this._shape,\n color : this._color,\n fill : this._fill,\n filling : this._filling,\n size : this._size,\n speed : this._computed_speed,\n down : this._down,\n shown : this._shown,\n context : function() {\n return self.getPaper();\n }\n };\n }\n return this._state;\n };\n\n proto.translate = function(startX, startY, dx, dy, beginPath, isCircle) {\n var self = this;\n return translate(this, startX, startY, dx, dy, beginPath, isCircle)\n .then(function(coords) {\n self._x = coords[0];\n self._y = coords[1];\n });\n };\n\n proto.rotate = function(startAngle, delta, isCircle) {\n var self = this;\n return rotate(this, startAngle, delta, isCircle)\n .then(function(heading) {\n self._angle = heading.angle;\n self._radians = heading.radians;\n });\n };\n\n proto.queueMoveBy = function(startX, startY, theta, distance) {\n var dx = Math.cos(theta) * distance,\n dy = Math.sin(theta) * distance;\n\n return this.translate(startX, startY, dx, dy, true);\n };\n\n proto.queueTurnTo = function(startAngle, endAngle) {\n endAngle = endAngle % this._fullCircle;\n if (endAngle < 0) {\n endAngle += this._fullCircle;\n }\n return this.rotate(startAngle, endAngle - startAngle);\n };\n\n proto.getManager = function(type) {\n if (!this._managers[type]) {\n this._managers[type] = new EventManager(type, this);\n }\n return this._managers[type];\n };\n\n proto.getPaper = function() {\n return this._paper || (this._paper = createLayer(2));\n };\n\n proto.reset = function() {\n this._x = 0;\n this._y = 0;\n this._radians = 0;\n this._angle = 0;\n this._shown = true;\n this._down = true;\n this._color = \"black\";\n this._fill = \"black\";\n this._shape = \"classic\";\n this._size = 1;\n this._filling = false;\n this._undoBuffer = [];\n this._speed = 3;\n this._computed_speed = 5;\n this._state = undefined;\n\n for(var key in this._managers) {\n this._managers[key].reset();\n }\n\n this._isRadians = false;\n this._fullCircle = 360;\n this._bufferSize = typeof _config.bufferSize === \"number\" ?\n _config.bufferSize :\n 0;\n\n removeLayer(this._paper);\n this._paper = undefined;\n };\n\n proto.$degrees = function(fullCircle) {\n fullCircle = (typeof fullCircle === \"number\") ?\n Math.abs(fullCircle) :\n 360;\n\n this._isRadians = false;\n if (!fullCircle || !this._fullCircle) {\n this._angle = this._radians = 0;\n }\n else {\n this._angle = this._angle / this._fullCircle * fullCircle;\n }\n this._fullCircle = fullCircle;\n return this.addUpdate(\n undefined,\n false,\n {angle:this._angle, radians: this._radians}\n );\n };\n proto.$degrees.minArgs = 0;\n proto.$degrees.keywordArgs = [\"fullcircle\"];\n proto.$degrees.returnType = Types.FLOAT;\n\n proto.$radians = function() {\n if (!this._isRadians) {\n this._isRadians = true;\n this._angle = this._radians;\n this._fullCircle = Turtle.RADIANS;\n }\n\n return this._angle;\n };\n proto.$radians.returnType = Types.FLOAT;\n\n proto.$position = proto.$pos = function() {\n return [this.$xcor(), this.$ycor()];\n };\n proto.$position.returnType = function(value) {\n return new Sk.builtin.tuple([\n Sk.builtin.float_(value[0]),\n Sk.builtin.float_(value[1])\n ]);\n };\n\n proto.$towards = function(x,y) {\n var coords = getCoordinates(x,y),\n radians = Math.PI + Math.atan2(this._y - coords.y, this._x - coords.x),\n angle = radians * (this._fullCircle / Turtle.RADIANS);\n\n return angle;\n };\n proto.$towards.minArgs = 1;\n proto.$towards.returnType = Types.FLOAT;\n\n proto.$distance = function(x,y) {\n var coords = getCoordinates(x,y),\n dx = coords.x - this._x,\n dy = coords.y - this._y;\n\n return Math.sqrt(dx * dx + dy * dy);\n };\n proto.$distance.minArgs = 1;\n proto.$distance.returnType = Types.FLOAT;\n\n proto.$heading = function() {\n return Math.abs(this._angle) < 1e-13 ? 0 : this._angle;\n };\n proto.$heading.returnType = Types.FLOAT;\n\n proto.$xcor = function() {\n return Math.abs(this._x) < 1e-13 ? 0 : this._x;\n };\n proto.$xcor.returnType = Types.FLOAT;\n\n proto.$ycor = function() {\n return Math.abs(this._y) < 1e-13 ? 0 : this._y;\n };\n proto.$ycor.returnType = Types.FLOAT;\n\n proto.$forward = proto.$fd = function(distance) {\n pushUndo(this);\n return this.queueMoveBy(this._x, this._y, this._radians, distance);\n };\n\n proto.$undo = function() {\n popUndo(this);\n };\n\n proto.$undobufferentries = function() {\n return this._undoBuffer.length;\n };\n\n proto.$setundobuffer = function(size) {\n this._bufferSize = typeof size === \"number\" ?\n Math.min(Math.abs(size), 1000) :\n 0;\n };\n\n proto.$backward = proto.$back = proto.$bk = function(distance) {\n pushUndo(this);\n return this.queueMoveBy(this._x, this._y, this._radians, -distance);\n };\n\n proto.$goto_$rw$ = proto.$setpos = proto.$setposition = function(x,y) {\n var coords = getCoordinates(x,y);\n\n pushUndo(this);\n\n return this.translate(\n this._x, this._y,\n coords.x - this._x, coords.y - this._y,\n true\n );\n };\n proto.$goto_$rw$.minArgs = 1;\n\n proto.$setx = function(x) {\n return this.translate(this._x, this._y, x - this._x, 0, true);\n };\n\n proto.$sety = function(y) {\n return this.translate(this._x, this._y, 0, y - this._y, true);\n };\n\n proto.$home = function() {\n var self = this,\n angle = this._angle;\n\n pushUndo(this);\n return self.translate(this._x, this._y, -this._x, -this._y, true)\n .then(function(position) {\n return self.queueTurnTo(angle, 0);\n })\n .then(function(heading) {\n return undefined;\n });\n };\n\n proto.$right = proto.$rt = function(angle) {\n pushUndo(this);\n return this.rotate(this._angle, -angle);\n };\n\n proto.$left = proto.$lt = function(angle) {\n pushUndo(this);\n return this.rotate(this._angle, angle);\n };\n\n proto.$setheading = proto.$seth = function(angle) {\n pushUndo(this);\n return this.queueTurnTo(this._angle, angle);\n };\n\n function circleRotate(turtle, angle, radians) {\n return function() {\n return turtle.addUpdate(\n undefined,\n false,{angle:angle, radians:radians}\n );\n };\n }\n\n function circleSegment(turtle, x, y, dx, dy, beginPath) {\n return function() {\n return turtle.translate(x, y, dx, dy, beginPath, true);\n };\n }\n\n proto.$circle = function(radius, extent, steps) {\n var self = this,\n x = this._x,\n y = this._y,\n angle = this._angle,\n heading = {},\n states = [],\n scale = 1/getScreen().lineScale,\n beginPath = true,\n endAngle, frac, w, w2, l, i, dx, dy, promise;\n\n pushUndo(this);\n\n if (extent === undefined) {\n extent = self._fullCircle;\n }\n\n if (steps === undefined) {\n frac = Math.abs(extent)/self._fullCircle;\n steps = 1 + ((Math.min(11+Math.abs(radius*scale)/6, 59)*frac) | 0);\n }\n w = extent / steps;\n w2 = 0.5 * w;\n l = 2 * radius * Math.sin(w*Math.PI/self._fullCircle);\n\n if (radius < 0) {\n l = -l;\n w = -w;\n w2 = -w2;\n endAngle = angle - extent;\n }\n else {\n endAngle = angle + extent;\n }\n\n promise = getFrameManager().willRenderNext() ? Promise.resolve() : new InstantPromise();\n\n angle += w2;\n\n for(i = 0; i < steps; i++) {\n calculateHeading(self, angle + w * i, heading);\n dx = Math.cos(heading.radians) * l;\n dy = Math.sin(heading.radians) * l;\n promise = promise\n .then(circleRotate(self, heading.angle, heading.radians))\n .then(circleSegment(self, x, y, dx, dy, beginPath));\n x += dx;\n y += dy;\n beginPath = false;\n }\n\n promise = promise.then(function() {\n calculateHeading(self, endAngle, heading);\n self._angle = heading.angle;\n self._radians = heading.radians;\n return self.addUpdate(undefined, true, heading);\n });\n\n return promise;\n };\n proto.$circle.keywordArgs = [\"extent\", \"steps\"];\n proto.$circle.minArgs = 1;\n\n proto.$penup = proto.$up = proto.$pu = function() {\n this._down = false;\n return this.addUpdate(undefined, false, {down:false});\n };\n\n proto.$pendown = proto.$down = proto.$pd = function() {\n this._down = true;\n return this.addUpdate(undefined, false, {down:true});\n };\n\n proto.$isdown = function() {\n return this._down;\n };\n\n proto.$speed = function(speed) {\n if (arguments.length) {\n this._speed = Math.max(0, Math.min(1000, speed));\n this._computed_speed = Math.max(0, speed * 2 - 1);\n return this.addUpdate(undefined, false, {speed:this._computed_speed});\n }\n\n return this._speed;\n };\n proto.$speed.minArgs = 0;\n proto.$speed.keywordArgs = [\"speed\"];\n\n proto.$pencolor = function(r,g,b,a) {\n var color;\n\n if (arguments.length) {\n this._color = createColor(r,g,b,a);\n return this.addUpdate(undefined, this._shown, {color : this._color});\n }\n\n return hexToRGB(this._color);\n };\n proto.$pencolor.minArgs = 0;\n proto.$pencolor.returnType = Types.COLOR;\n\n proto.$fillcolor = function(r,g,b,a) {\n var color;\n\n if (arguments.length) {\n this._fill = createColor(r,g,b,a);\n return this.addUpdate(undefined, this._shown, {fill : this._fill});\n }\n\n return hexToRGB(this._fill);\n };\n proto.$fillcolor.minArgs = 0;\n proto.$fillcolor.returnType = Types.COLOR;\n\n proto.$color = function(color, fill, b, a) {\n if (arguments.length) {\n if (arguments.length === 1 || arguments.length >= 3) {\n this._color = createColor(color, fill, b, a);\n this._fill = this._color;\n }\n else {\n this._color = createColor(color);\n this._fill = createColor(fill);\n }\n return this.addUpdate(undefined, this._shown, {\n color : this._color,\n fill : this._fill\n });\n }\n return [this.$pencolor(), this.$fillcolor()];\n };\n proto.$color.minArgs = 0;\n proto.$color.returnType = function(value) {\n return new Sk.builtin.tuple([\n Types.COLOR(value[0]),\n Types.COLOR(value[1])\n ]);\n };\n\n proto.$fill = function(flag) {\n var self = this;\n\n if (flag !== undefined) {\n flag = !!flag;\n if (flag === this._filling) return;\n this._filling = flag;\n if (flag) {\n pushUndo(this);\n return this.addUpdate(undefined, false, {\n filling : true,\n fillBuffer : [{x : this._x, y : this._y}]\n });\n }\n else {\n pushUndo(this);\n return this.addUpdate(\n function() {\n this.fillBuffer.push(this);\n drawFill.call(this);\n },\n true,\n {\n filling : false,\n fillBuffer : undefined\n }\n );\n }\n }\n\n return this._filling;\n };\n proto.$fill.minArgs = 0;\n\n proto.$begin_fill = function() {\n return this.$fill(true);\n };\n\n proto.$end_fill = function() {\n return this.$fill(false);\n };\n\n proto.$stamp = function() {\n pushUndo(this);\n return this.addUpdate(function() {\n drawTurtle(this, this.context());\n }, true);\n };\n\n proto.$dot = function(size, color, g, b, a) {\n pushUndo(this);\n size = Sk.builtin.asnum$(size);\n size = (typeof size === \"number\") ?\n Math.max(1, Math.abs(size) | 0) :\n Math.max(this._size + 4, this._size * 2);\n\n color = (color !== undefined) ?\n createColor(color, g, b, a) :\n this._color;\n\n return this.addUpdate(drawDot, true, undefined, size, color);\n };\n\n proto.$write = function(message,move,align,font) {\n var self = this,\n promise, face, size, type, width;\n\n pushUndo(this);\n\n message = String(message);\n\n if (font && font.constructor === Array) {\n face = typeof font[0] === \"string\" ? font[0] : \"Arial\";\n size = String(font[1] || \"12pt\");\n type = typeof font[2] === \"string\" ? font[2] : \"normal\";\n if (/^\\d+$/.test(size)) {\n size += \"pt\";\n }\n\n font = [type, size, face].join(\" \");\n }\n\n if (!align) {\n align = \"left\";\n }\n\n promise = this.addUpdate(\n drawText, true, undefined, message, align, font\n );\n\n if (move && (align === \"left\" || align === \"center\")) {\n width = measureText(message, font);\n if (align === \"center\") {\n width = width/2;\n }\n promise = promise.then(function() {\n var state = self.getState();\n return self.translate(state.x, state.y, width, 0, true);\n });\n }\n\n return promise;\n };\n proto.$write.keywordArgs = [\"move\",\"align\",\"font\"];\n proto.$write.minArgs = 1;\n\n proto.$pensize = proto.$width = function(size) {\n if (arguments.length) {\n this._size = size;\n return this.addUpdate(undefined, this._shown, {size : size});\n }\n\n return this._size;\n };\n proto.$pensize.minArgs = proto.$width.minArgs = 0;\n proto.$pensize.keywordArgs = proto.$width.keywordArgs = [\"width\"];\n\n proto.$showturtle = proto.$st = function() {\n this._shown = true;\n return this.addUpdate(undefined, true, {shown : true});\n };\n\n proto.$hideturtle = proto.$ht = function() {\n this._shown = false;\n return this.addUpdate(undefined, true, {shown : false});\n };\n\n proto.$isvisible = function() {\n return this._shown;\n };\n\n proto.$shape = function(shape) {\n if (shape && SHAPES[shape]) {\n this._shape = shape;\n return this.addUpdate(undefined, this._shown, {shape : shape});\n }\n\n return this._shape;\n };\n proto.$shape.minArgs = 0;\n proto.$shape.keywordArgs = [\"name\"];\n\n proto.$window_width = function() {\n return this._screen.$window_width();\n };\n \n proto.$window_height = function() {\n return this._screen.$window_height();\n };\n \n proto.$tracer = function(n, delay) {\n return this._screen.$tracer(n, delay);\n };\n proto.$tracer.minArgs = 0;\n proto.$tracer.keywordArgs = [\"n\", \"delay\"];\n \n proto.$update = function() {\n return this._screen.$update();\n };\n \n proto.$delay = function(delay) {\n return this._screen.$delay(delay);\n };\n proto.$delay.minArgs = 0;\n proto.$delay.keywordArgs = [\"delay\"];\n\n proto.$reset = function() {\n this.reset();\n return this.$clear();\n };\n\n proto.$mainloop = proto.$done = function() {\n return this._screen.$mainloop();\n };\n\n proto.$clear = function() {\n return this.addUpdate(function() {\n clearLayer(this.context());\n }, true);\n };\n proto.$dot.minArgs = 0;\n\n proto.$onclick = function(method,btn,add) {\n this.getManager(\"mousedown\").addHandler(method, add);\n };\n proto.$onclick.minArgs = 1;\n proto.$onclick.keywordArgs = [\"btn\",\"add\"];\n\n proto.$onrelease = function(method,btn,add) {\n this.getManager(\"mouseup\").addHandler(method, add);\n };\n proto.$onrelease.minArgs = 1;\n proto.$onrelease.keywordArgs = [\"btn\",\"add\"];\n\n proto.$ondrag = function(method,btn,add) {\n this.getManager(\"mousemove\").addHandler(method, add);\n };\n proto.$ondrag.minArgs = 1;\n proto.$ondrag.keywordArgs = [\"btn\",\"add\"];\n\n proto.$getscreen = function() {\n return _module.Screen();\n };\n proto.$getscreen.isSk = true;\n\n proto.$clone = function() {\n\n var newTurtleInstance = Sk.misceval.callsimOrSuspend(_module.Turtle);\n\n // All the properties that are in getState()\n newTurtleInstance.instance._x = this._x;\n newTurtleInstance.instance._y = this._y;\n newTurtleInstance.instance._angle = this._angle;\n newTurtleInstance.instance._radians = this._radians;\n newTurtleInstance.instance._shape = this._shape;\n newTurtleInstance.instance._color = this._color;\n newTurtleInstance.instance._fill = this._fill;\n newTurtleInstance.instance._filling = this._filling;\n newTurtleInstance.instance._size = this._size;\n newTurtleInstance.instance._computed_speed = this._computed_speed;\n newTurtleInstance.instance._down = this._down;\n newTurtleInstance.instance._shown = this._shown;\n\n // Other properties to copy\n newTurtleInstance.instance._isRadians = this._isRadians;\n newTurtleInstance.instance._fullCircle = this._fullCircle;\n newTurtleInstance.instance._bufferSize = this._bufferSize;\n newTurtleInstance.instance._undoBuffer = this._undoBuffer;\n\n\n newTurtleInstance._clonedFrom = this;\n\n return newTurtleInstance;\n };\n proto.$clone.returnType = function(value) {\n // When I return the instance here, I'm not sure if it ends up with the right \"Turtle\" python type.\n return value\n };\n\n proto.$getturtle = proto.$getpen = function() {\n return this.skInstance;\n };\n proto.$getturtle.isSk = true;\n })(Turtle.prototype);\n\n function Screen() {\n var w,h;\n this._frames = 1;\n this._delay = undefined;\n this._bgcolor = \"none\";\n this._mode = \"standard\";\n this._managers = {};\n this._keyLogger = {};\n if (_config.height && _config.width) {\n w = _config.width/2;\n h = _config.height/2;\n } else {\n w = _config.defaultSetup.width/2;\n h = _config.defaultSetup.height/2;\n }\n this.setUpWorld(-w,-h,w,h);\n }\n\n (function(proto) {\n proto.spriteLayer = function() {\n return this._sprites || (this._sprites = createLayer(3));\n };\n\n proto.bgLayer = function() {\n return this._background || (this._background = createLayer(1));\n };\n\n proto.hitTestLayer = function() {\n return this._hitTest || (this._hitTest = createLayer(0,true));\n };\n\n proto.getManager = function(type) {\n if (!this._managers[type]) {\n this._managers[type] = new EventManager(type, this);\n }\n return this._managers[type];\n };\n\n proto.reset = function() {\n var key;\n\n this._keyListeners = undefined;\n\n for (key in this._keyLogger) {\n window.clearInterval(this._keyLogger[key]);\n window.clearTimeout(this._keyLogger[key]);\n delete this._keyLogger[key];\n }\n\n if (this._keyDownListener) {\n getTarget().removeEventListener(\"keydown\", this._keyDownListener);\n this._keyDownListener = undefined;\n }\n\n if (this._keyUpListener) {\n getTarget().removeEventListener(\"keyup\", this._keyUpListener);\n this._keyUpListener = undefined;\n }\n\n if (this._timer) {\n window.clearTimeout(this._timer);\n this._timer = undefined;\n }\n\n for(key in this._managers) {\n this._managers[key].reset();\n }\n\n this._mode = \"standard\";\n removeLayer(this._sprites);\n this._sprites = undefined;\n removeLayer(this._background);\n this._background = undefined;\n };\n\n proto.setUpWorld = function(llx, lly, urx, ury) {\n var world = this;\n\n world.llx = llx;\n world.lly = lly;\n world.urx = urx;\n world.ury = ury;\n world.xScale = (urx - llx) / getWidth();\n world.yScale = -1 * (ury - lly) / getHeight();\n world.lineScale = Math.min(Math.abs(world.xScale), Math.abs(world.yScale));\n };\n\n proto.$setup = function(width, height, startX, startY) {\n if (isNaN(parseFloat(width))) {\n width = getWidth();\n }\n if (isNaN(parseFloat(height))) {\n height = getHeight();\n }\n\n if (width <= 1) {\n width = getWidth() * width;\n }\n if (height <= 1) {\n height = getHeight() * height;\n }\n\n this._width = width;\n this._height = height;\n\n this._xOffset = (startX !== undefined && !isNaN(parseInt(startX))) ?\n parseInt(startX) :\n 0;\n\n this._yOffset = (startY !== undefined && !isNaN(parseInt(startY))) ?\n parseInt(startY) :\n 0;\n\n if (this._mode === \"world\") {\n return this._setworldcoordinates(this.llx, this.lly, this.urx, this.ury);\n }\n\n return this._setworldcoordinates(-width/2, -height/2, width/2, height/2);\n };\n proto.$setup.minArgs = 0;\n proto.$setup.keywordArgs = [\"width\", \"height\", \"startx\", \"starty\"];\n\n proto.$register_shape = proto.$addshape = function(name, points) {\n SHAPES[name] = points;\n };\n\n proto.$getshapes = function() {\n return Object.keys(SHAPES);\n };\n\n proto.$tracer = function(frames, delay) {\n if (frames !== undefined || delay !== undefined) {\n if (typeof delay === \"number\") {\n this._delay = delay;\n getFrameManager().refreshInterval(delay);\n }\n if (typeof frames === \"number\") {\n this._frames = frames;\n return getFrameManager().frameBuffer(frames);\n }\n\n return;\n }\n\n return this._frames;\n };\n proto.$tracer.minArgs = 0;\n\n proto.$delay = function(delay) {\n if (delay !== undefined) {\n return this.$tracer(undefined, delay);\n }\n\n return this._delay === undefined ? OPTIMAL_FRAME_RATE : this._delay;\n };\n\n proto._setworldcoordinates = function(llx, lly, urx, ury) {\n var world = this,\n turtles = getFrameManager().turtles();\n\n this.setUpWorld(llx, lly, urx, ury);\n\n if (this._sprites) {\n applyWorld(this, this._sprites);\n }\n\n if (this._background) {\n applyWorld(this, this._background);\n }\n\n return this.$clear();\n };\n\n proto.$setworldcoordinates = function(llx, lly, urx, ury) {\n this._mode = \"world\";\n return this._setworldcoordinates(llx, lly, urx, ury);\n };\n\n proto.$clear = proto.$clearscreen = function() {\n this.reset();\n return this.$reset();\n };\n\n proto.$update = function() {\n return getFrameManager().update();\n };\n\n proto.$reset = proto.$resetscreen = function() {\n var self = this,\n turtles = getFrameManager().turtles();\n\n return getFrameManager().addFrame(function() {\n applyWorld(self, self._sprites);\n applyWorld(self, self._background);\n for(var i = 0; i < turtles.length; i++) {\n turtles[i].reset();\n applyWorld(self, turtles[i]._paper);\n }\n }, true);\n };\n\n proto.$window_width = function() {\n return getWidth();\n };\n\n proto.$window_height = function() {\n return getHeight();\n };\n proto.$delay.minArgs = 0;\n\n proto.$turtles = function() {\n return getFrameManager().turtles();\n };\n proto.$turtles.returnType = Types.TURTLE_LIST;\n\n proto.$bgcolor = function(color, g, b, a) {\n if (arguments.length) {\n this._bgcolor = createColor(color, g, b, a);\n clearLayer(this.bgLayer(), this._bgcolor);\n return;\n }\n\n return hexToRGB(this._bgcolor);\n };\n proto.$bgcolor.minArgs = 0;\n proto.$bgcolor.returnType = Types.COLOR;\n\n // no-op - just defined for consistency with python version\n proto.$mainloop = proto.$done = function() {\n return undefined;\n };\n\n proto.$bye = function() {\n return Sk.TurtleGraphics.reset();\n };\n\n proto.$exitonclick = function() {\n this._exitOnClick = true;\n return this.getManager(\"mousedown\").addHandler(function() {\n resetTurtle();\n }, false);\n };\n\n proto.$onclick = function(method,btn,add) {\n if (this._exitOnClick) return;\n this.getManager(\"mousedown\").addHandler(method, add);\n };\n proto.$onclick.minArgs = 1;\n proto.$onclick.keywordArgs = [\"btn\",\"add\"];\n\n var KEY_MAP = {\n \"8\" : /^back(space)?$/i,\n \"9\" : /^tab$/i,\n \"13\" : /^(enter|return)$/i,\n \"16\" : /^shift$/i,\n \"17\" : /^(ctrl|control)$/i,\n \"18\" : /^alt$/i,\n \"27\" : /^esc(ape)?$/i,\n \"32\" : /^space$/i,\n \"33\" : /^page[\\s\\-]?up$/i,\n \"34\" : /^page[\\s\\-]?down$/i,\n \"35\" : /^end$/i,\n \"36\" : /^home$/i,\n \"37\" : /^left([\\s\\-]?arrow)?$/i,\n \"38\" : /^up([\\s\\-]?arrow)?$/i,\n \"39\" : /^right([\\s\\-]?arrow)?$/i,\n \"40\" : /^down([\\s\\-]?arrow)?$/i,\n \"45\" : /^insert$/i,\n \"46\" : /^del(ete)?$/i\n };\n\n proto._createKeyRepeater = function(key, code) {\n var self = this;\n // set a timeout for 333ms and if key has not yet been\n // released, fire another event and continue firing\n // at a rate of ~20 times per second until key is released\n self._keyLogger[code] = window.setTimeout(function() {\n // trigger the first repeat after the longer delay\n self._keyListeners[key]();\n // set up the repeat interval with the quick delay\n self._keyLogger[code] = window.setInterval(function() {\n self._keyListeners[key]();\n }, 50);\n }, 333);\n };\n\n proto._createKeyDownListener = function() {\n var self = this;\n\n if (this._keyDownListener) return;\n\n this._keyDownListener = function(e) {\n if (!focusTurtle()) return;\n\n var code = e.charCode || e.keyCode,\n pressed = String.fromCharCode(code).toLowerCase(),\n key, inKeyMap;\n\n if (self._keyLogger[code]) return;\n\n for (key in self._keyListeners) {\n inKeyMap = (key.length > 1 && KEY_MAP[code] && KEY_MAP[code].test(key));\n if (key === pressed || inKeyMap) {\n // trigger the intial keydown handler\n self._keyListeners[key]();\n self._createKeyRepeater(key, code);\n e.preventDefault();\n break;\n }\n }\n };\n\n getTarget().addEventListener(\"keydown\", this._keyDownListener);\n };\n\n proto._createKeyUpListener = function() {\n var self = this;\n\n if (this._keyUpListener) return;\n\n this._keyUpListener = function(e) {\n var interval = self._keyLogger[e.charCode || e.keyCode];\n if (interval !== undefined) {\n e.preventDefault();\n window.clearInterval(interval);\n window.clearTimeout(interval);\n delete(self._keyLogger[e.charCode || e.keyCode]);\n }\n };\n \n getTarget().addEventListener(\"keyup\", this._keyUpListener);\n };\n\n proto.$listen = function() {\n this._createKeyUpListener();\n this._createKeyDownListener();\n };\n\n proto.$onkey = function(method, keyValue) {\n if (typeof keyValue === \"function\") {\n var temp = method;\n method = keyValue;\n keyValue = temp;\n }\n\n keyValue = String(keyValue).toLowerCase();\n\n if (method && typeof method === \"function\") {\n if (!this._keyListeners) this._keyListeners = {};\n this._keyListeners[keyValue] = method;\n }\n else {\n delete this._keyListeners[keyValue];\n }\n };\n\n proto.$onscreenclick = function(method,btn,add) {\n this.getManager(\"mousedown\").addHandler(method, add);\n };\n proto.$onscreenclick.minArgs = 1;\n proto.$onscreenclick.keywordArgs = [\"btn\",\"add\"];\n\n proto.$ontimer = function(method, interval) {\n if (this._timer) {\n window.clearTimeout(this._timer);\n this._timer = undefined;\n }\n\n if (method && typeof interval === \"number\") {\n this._timer = window.setTimeout(method, Math.max(0, interval|0));\n }\n };\n proto.$ontimer.minArgs = 0;\n\n })(Screen.prototype);\n\n function ensureAnonymous() {\n if (!_anonymousTurtle) {\n _anonymousTurtle = _module.Turtle();\n }\n\n return _anonymousTurtle.instance;\n }\n\n function getTarget() {\n return _target;\n }\n\n function getScreen() {\n if (!_screenInstance) {\n _screenInstance = new Screen();\n }\n return _screenInstance;\n }\n\n function getMouseHandler() {\n if (!_mouseHandler) {\n _mouseHandler = new MouseHandler();\n }\n return _mouseHandler;\n }\n\n function getWidth() {\n return (\n (_screenInstance && _screenInstance._width) ||\n _config.width ||\n getTarget().clientWidth\n ) | 0;\n }\n\n function getHeight() {\n return (\n (_screenInstance && _screenInstance._height) ||\n _config.height ||\n getTarget().clientHeight\n ) | 0;\n }\n\n function createLayer(zIndex, isHidden) {\n var canvas = document.createElement(\"canvas\"),\n width = getWidth(),\n height = getHeight(),\n offset = getTarget().firstChild ? (-height) + \"px\" : \"0\",\n context;\n\n canvas.width = width;\n canvas.height = height;\n canvas.style.position = \"relative\";\n canvas.style.display = \"block\";\n canvas.style.setProperty(\"margin-top\",offset);\n canvas.style.setProperty(\"z-index\", zIndex);\n if (isHidden) {\n canvas.style.display = \"none\";\n }\n\n getTarget().appendChild(canvas);\n\n context = canvas.getContext(\"2d\");\n context.lineCap = \"round\";\n context.lineJoin = \"round\";\n\n applyWorld(getScreen(), context);\n\n return context;\n }\n\n function cancelAnimationFrame() {\n if (_frameRequest) {\n (window.cancelAnimationFrame || window.mozCancelAnimationFrame)(_frameRequest);\n _frameRequest = undefined;\n }\n if (_frameRequestTimeout) {\n window.clearTimeout(_frameRequestTimeout);\n _frameRequestTimeout = undefined;\n }\n }\n\n function applyWorld(world, context) {\n var llx = world.llx,\n lly = world.lly,\n urx = world.urx,\n ury = world.ury,\n xScale = world.xScale,\n yScale = world.yScale;\n\n if (!context) return;\n\n clearLayer(context);\n\n context.restore();\n context.save();\n context.scale(1 / xScale, 1 / yScale);\n if (lly === 0) {\n context.translate(-llx, lly - (ury - lly));\n } else if (lly > 0) {\n context.translate(-llx, -lly * 2);\n } else {\n context.translate(-llx, -ury);\n }\n }\n\n function pushUndo(turtle) {\n var properties, undoState, i;\n\n if (!_config.allowUndo || !turtle._bufferSize) {\n return;\n }\n\n if (!turtle._undoBuffer) {\n turtle._undoBuffer = [];\n }\n\n while(turtle._undoBuffer.length > turtle._bufferSize) {\n turtle._undoBuffer.shift();\n }\n\n undoState = {};\n properties = \"x y angle radians color fill down filling shown shape size\".split(\" \");\n for(i = 0; i < properties.length; i++) {\n undoState[properties[i]] = turtle[\"_\" + properties[i]];\n }\n\n turtle._undoBuffer.push(undoState);\n\n return turtle.addUpdate(function() {\n undoState.fillBuffer = this.fillBuffer ? this.fillBuffer.slice() : undefined;\n if (turtle._paper && turtle._paper.canvas) {\n undoState.image = turtle._paper.canvas.toDataURL();\n }\n }, false);\n }\n\n var undoImage = new Image();\n function popUndo(turtle) {\n var undoState;\n\n if (!turtle._bufferSize || !turtle._undoBuffer) {\n return;\n }\n\n undoState = turtle._undoBuffer.pop();\n\n if (!undoState) {\n return;\n }\n\n for(var key in undoState) {\n if (key === \"image\" || key === \"fillBuffer\") continue;\n turtle[\"_\" + key] = undoState[key];\n }\n\n return turtle.addUpdate(function() {\n var img;\n if (undoState.image) {\n undoImage.src = undoState.image;\n img = undoImage;\n }\n\n clearLayer(this.context(), false, undoImage);\n delete undoState.image;\n }, true, undoState);\n }\n\n function removeLayer(layer) {\n if (layer && layer.canvas && layer.canvas.parentNode) {\n layer.canvas.parentNode.removeChild(layer.canvas);\n }\n }\n\n function clearLayer(context, color, image) {\n if (!context) return;\n\n context.save();\n context.setTransform(1,0,0,1,0,0);\n if (color) {\n context.fillStyle = color;\n context.fillRect(0, 0, context.canvas.width, context.canvas.height);\n }\n else {\n context.clearRect(0, 0, context.canvas.width, context.canvas.height);\n }\n\n if (image) {\n context.drawImage(image, 0, 0);\n }\n\n context.restore();\n }\n\n function drawTurtle(state, context) {\n var shape = SHAPES[state.shape],\n world = getScreen(),\n width = getWidth(),\n height = getHeight(),\n xScale = world.xScale,\n yScale = world.yScale,\n x, y, bearing;\n\n if (!context) return;\n\n x = Math.cos(state.radians) / xScale;\n y = Math.sin(state.radians) / yScale;\n bearing = Math.atan2(y, x) - Math.PI/2;\n\n context.save();\n context.translate(state.x, state.y);\n context.scale(xScale,yScale);\n context.rotate(bearing);\n context.beginPath();\n context.lineWidth = 1;\n context.strokeStyle = state.color;\n context.fillStyle = state.fill;\n context.moveTo(shape[0][0], shape[0][1]);\n for(var i = 1; i < shape.length; i++) {\n context.lineTo(shape[i][0], shape[i][1]);\n }\n context.closePath();\n context.fill();\n context.stroke();\n context.restore();\n }\n\n function drawDot(size, color) {\n var context = this.context(),\n screen = getScreen(),\n xScale = screen.xScale,\n yScale = screen.yScale;\n\n if (!context) return;\n context.beginPath();\n context.moveTo(this.x, this.y);\n size = size * Math.min(Math.abs(xScale),Math.abs(yScale));\n context.arc(this.x, this.y, size, 0, Turtle.RADIANS);\n context.closePath();\n context.fillStyle = color || this.color;\n context.fill();\n }\n\n var textMeasuringContext = document.createElement(\"canvas\").getContext(\"2d\");\n function measureText(message, font) {\n if (font) {\n textMeasuringContext.font = font;\n }\n return textMeasuringContext.measureText(message).width;\n }\n\n function drawText(message, align, font) {\n var context = this.context();\n\n if (!context) return;\n\n context.save();\n if (font) {\n context.font = font;\n }\n if (align && align.match(/^(left|right|center)$/)) {\n context.textAlign = align;\n }\n\n context.scale(1,-1);\n context.fillStyle = this.fill;\n context.fillText(message, this.x, -this.y);\n context.restore();\n }\n\n function drawLine(loc, beginPath, endPath) {\n // TODO: make steps in path use square ends of lines\n // and open and close path at the right times.\n // See if we can minimize calls to stroke\n var context = this.context();\n\n if (!context) return;\n\n if (beginPath) {\n context.beginPath();\n context.moveTo(this.x, this.y);\n }\n\n context.lineWidth = this.size * getScreen().lineScale;\n context.strokeStyle = this.color;\n context.lineTo(loc.x, loc.y);\n context.stroke();\n }\n\n function drawFill() {\n var context = this.context(),\n path = this.fillBuffer,\n i;\n\n if (!context || !path || !path.length) return;\n\n context.save();\n context.beginPath();\n context.moveTo(path[0].x,path[0].y);\n for(i = 1; i < path.length; i++) {\n context.lineTo(path[i].x, path[i].y);\n }\n context.closePath();\n context.fillStyle = this.fill;\n context.fill();\n for(i = 1; i < path.length; i++) {\n if (!path[i].stroke) {\n continue;\n }\n\n context.beginPath();\n context.moveTo(path[i-1].x, path[i-1].y);\n context.lineWidth = path[i].size * getScreen().lineScale;\n context.strokeStyle = path[i].color;\n context.lineTo(path[i].x, path[i].y);\n context.stroke();\n }\n context.restore();\n }\n\n function partialTranslate(turtle, x, y, beginPath, countAsFrame) {\n return function() {\n return turtle.addUpdate(\n function(loc) {\n if (this.down) {\n drawLine.call(this, loc, beginPath);\n }\n },\n countAsFrame,\n {x : x, y : y},\n beginPath\n );\n };\n }\n\n function translate(turtle, startX, startY, dx, dy, beginPath, isCircle) {\n // speed is in pixels per ms\n var speed = turtle._computed_speed,\n screen = getScreen(),\n xScale = Math.abs(screen.xScale),\n yScale = Math.abs(screen.yScale),\n x = startX,\n y = startY,\n pixels = Math.sqrt(dx * dx * xScale + dy * dy * yScale),\n // TODO: allow fractional frame updates?\n frames = speed ? Math.round(Math.max(1, pixels / speed)) : 1,\n xStep = dx / frames,\n yStep = dy / frames,\n promise = getFrameManager().willRenderNext() ?\n Promise.resolve() :\n new InstantPromise(),\n countAsFrame = (!speed && isCircle) ? false : true,\n i;\n\n turtle.addUpdate(function() {\n if (this.filling) {\n this.fillBuffer.push({\n x : this.x,\n y : this.y,\n stroke : this.down,\n color : this.color,\n size : this.size\n });\n }\n }, false);\n\n for(i = 0; i < frames; i++) {\n x = startX + xStep * (i+1);\n y = startY + yStep * (i+1);\n promise = promise.then(\n partialTranslate(turtle, x, y, beginPath, countAsFrame)\n );\n beginPath = false;\n }\n\n return promise.then(function() {\n return [startX + dx, startY + dy];\n });\n }\n\n function partialRotate(turtle, angle, radians, countAsFrame) {\n return function() {\n return turtle.addUpdate(undefined, countAsFrame, {angle:angle, radians:radians});\n };\n }\n\n function rotate(turtle, startAngle, delta, isCircle) {\n var speed = turtle._computed_speed,\n degrees = delta / turtle._fullCircle * 360,\n frames = speed ? Math.round(Math.max(1, Math.abs(degrees) / speed)) : 1,\n dAngle = delta / frames,\n heading = {},\n countAsFrame = (!speed && isCircle) ? false : true,\n promise = getFrameManager().willRenderNext() ?\n Promise.resolve() :\n new InstantPromise(),\n i;\n\n // TODO: request how many frames are remaining and only queue up\n // a single rotation per screen update\n\n for(i = 0; i < frames; i++) {\n calculateHeading(turtle, startAngle + dAngle * (i+1), heading);\n promise = promise.then(\n partialRotate(turtle, heading.angle, heading.radians, countAsFrame)\n );\n }\n\n return promise.then(function() {\n return calculateHeading(turtle, startAngle + delta);\n });\n }\n\n function getCoordinates(x, y) {\n if (y === undefined) {\n y = (x && (x.y || x._y || x[1])) || 0;\n x = (x && (x.x || x._x || x[0])) || 0;\n }\n return {x:x, y:y};\n }\n\n // Modified solution of Tim Down's version from stackoverflow\n // http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb\n function hexToRGB(hex) {\n var rgbForm, hexForm, result;\n\n if (rgbForm = /^rgba?\\((\\d+),(\\d+),(\\d+)(?:,([.\\d]+))?\\)$/.exec(hex)) {\n result = [\n parseInt(rgbForm[1]),\n parseInt(rgbForm[2]),\n parseInt(rgbForm[3])\n ];\n if (rgbForm[4]) {\n result.push(parseFloat(rgbForm[4]));\n }\n }\n else if (/^#?[a-f\\d]{3}|[a-f\\d]{6}$/i.exec(hex)) {\n if (hex.length === 4) {\n // Expand shorthand form (e.g. \"03F\") to full form (e.g. \"0033FF\")\n hex = hex.replace(/^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i, function(m, r, g, b) {\n return r + r + g + g + b + b;\n });\n }\n\n hexForm = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n result = [\n parseInt(hexForm[1], 16),\n parseInt(hexForm[2], 16),\n parseInt(hexForm[3], 16)\n ];\n }\n else {\n result = hex;\n }\n\n return result;\n }\n\n function createColor(color, g, b, a) {\n var i;\n\n if (g !== undefined) {\n color = [color, g, b, a];\n }\n\n if (color.constructor === Array && color.length) {\n for(i = 0; i < 3; i++) {\n color[i] = (typeof color[i] === \"number\") ?\n Math.max(0, Math.min(255, parseInt(color[i]))) :\n 0;\n }\n if (typeof color[i] === \"number\") {\n color[3] = Math.max(0, Math.min(1, color[i]));\n color = \"rgba(\" + color.join(\",\") + \")\";\n }\n else {\n color = \"rgb(\" + color.slice(0,3).join(\",\") + \")\";\n }\n }\n else if (typeof color === \"string\" && !color.match(/\\s*url\\s*\\(/i)) {\n color = color.replace(/\\s+/g, \"\");\n }\n else {\n return \"black\";\n }\n\n return color;\n }\n\n function calculateHeading(turtle, value, heading) {\n var angle = turtle._angle || 0,\n radians = turtle._radians || 0;\n\n heading || (heading = {});\n\n if (typeof value === \"number\") {\n if (turtle._isRadians) {\n angle = radians = value % Turtle.RADIANS;\n }\n else if (turtle._fullCircle) {\n angle = (value % turtle._fullCircle);\n radians = angle / turtle._fullCircle * Turtle.RADIANS;\n }\n else {\n angle = radians = 0;\n }\n\n if (angle < 0) {\n angle += turtle._fullCircle;\n radians += Turtle.RADIANS;\n }\n }\n\n heading.angle = angle;\n heading.radians = radians;\n\n return heading;\n }\n\n function pythonToJavascriptFunction(pyValue, scope) {\n return function() {\n var argsJs = Array.prototype.slice.call(arguments),\n argsPy = argsJs.map(\n function(argJs) {return Sk.ffi.remapToPy(argJs);}\n );\n\n if (typeof(scope) !== \"undefined\") {\n argsPy.unshift(scope);\n }\n return Sk.misceval.applyAsync(\n undefined, pyValue, undefined, undefined, undefined, argsPy\n ).catch(Sk.uncaughtException);\n };\n }\n\n function addModuleMethod(klass, module, method, scopeGenerator) {\n var publicMethodName = method.replace(/^\\$/, \"\"),\n displayName = publicMethodName.replace(/_\\$[a-z]+\\$$/i, \"\"),\n maxArgs = klass.prototype[method].length,\n minArgs = klass.prototype[method].minArgs,\n keywordArgs = klass.prototype[method].keywordArgs,\n returnType = klass.prototype[method].returnType,\n isSk = klass.prototype[method].isSk,\n wrapperFn;\n\n if (minArgs === undefined) {\n minArgs = maxArgs;\n }\n\n wrapperFn = function() {\n var args = Array.prototype.slice.call(arguments, 0),\n instance = scopeGenerator ? scopeGenerator() : args.shift().instance,\n i, result, susp, resolution, lengthError;\n\n if (args < minArgs || args.length > maxArgs) {\n lengthError = minArgs === maxArgs ?\n \"exactly \" + maxArgs :\n \"between \" + minArgs + \" and \" + maxArgs;\n\n throw new Sk.builtin.TypeError(displayName + \"() takes \" + lengthError + \" positional argument(s) (\" + args.length + \" given)\");\n }\n\n for (i = args.length; --i >= 0;) {\n if (args[i] !== undefined) {\n if (args[i] instanceof Sk.builtin.func) {\n args[i] = pythonToJavascriptFunction(args[i]);\n }\n else if (args[i] instanceof Sk.builtin.method) {\n args[i] = pythonToJavascriptFunction(args[i].im_func, args[i].im_self);\n }\n else if (args[i] && args[i].$d instanceof Sk.builtin.dict && args[i].instance) {\n args[i] = args[i].instance;\n }\n else {\n args[i] = Sk.ffi.remapToJs(args[i]);\n }\n }\n }\n\n try {\n result = instance[method].apply(instance, args);\n } catch(e) {\n if (window && window.console) {\n window.console.log(\"wrapped method failed\");\n window.console.log(e.stack);\n }\n throw e;\n }\n\n if (result instanceof InstantPromise) {\n result = result.lastResult;\n }\n\n if (result instanceof Promise) {\n result = result.catch(function(e) {\n if (window && window.console) {\n window.console.log(\"promise failed\");\n window.console.log(e.stack);\n }\n throw e;\n });\n\n susp = new Sk.misceval.Suspension();\n\n susp.resume = function() {\n return (resolution === undefined) ?\n Sk.builtin.none.none$ :\n Sk.ffi.remapToPy(resolution);\n };\n\n susp.data = {\n type: \"Sk.promise\",\n promise: result.then(function(value) {\n resolution = value;\n return value;\n })\n };\n\n return susp;\n }\n else {\n if (result === undefined) return Sk.builtin.none.none$;\n if (isSk) return result;\n if (typeof returnType === \"function\") {\n return returnType(result);\n }\n\n return Sk.ffi.remapToPy(result);\n }\n };\n\n if (keywordArgs) {\n wrapperFn.co_varnames = keywordArgs.slice();\n // make room for required arguments\n for(var i = 0; i < minArgs; i++) {\n wrapperFn.co_varnames.unshift(\"\");\n }\n if (!scopeGenerator) {\n // make room for the \"self\" argument\n wrapperFn.co_varnames.unshift(\"\");\n }\n }\n\n module[publicMethodName] = new Sk.builtin.func(wrapperFn);\n }\n\n function TurtleWrapper($gbl, $loc) {\n $loc.__init__ = new Sk.builtin.func(function (self) {\n self.instance = new Turtle();\n self.instance.skInstance = self;\n });\n\n for(var key in Turtle.prototype) {\n if (/^\\$[a-z_]+/.test(key)) {\n addModuleMethod(Turtle, $loc, key);\n }\n }\n }\n\n function ScreenWrapper($gbl, $loc) {\n $loc.__init__ = new Sk.builtin.func(function (self) {\n self.instance = getScreen();\n });\n\n for(var key in Screen.prototype) {\n if (/^\\$[a-z_]+/.test(key)) {\n addModuleMethod(Screen, $loc, key);\n }\n }\n }\n\n for(var key in Turtle.prototype) {\n if (/^\\$[a-z_]+/.test(key)) {\n addModuleMethod(Turtle, _module, key, ensureAnonymous);\n }\n }\n\n // add Screen method aliases to the main turtle module\n // to allow things like:\n // import turtle\n // turtle.mainloop()\n addModuleMethod(Screen, _module, \"$mainloop\", getScreen);\n addModuleMethod(Screen, _module, \"$done\", getScreen);\n addModuleMethod(Screen, _module, \"$bye\", getScreen);\n addModuleMethod(Screen, _module, \"$tracer\", getScreen);\n addModuleMethod(Screen, _module, \"$update\", getScreen);\n addModuleMethod(Screen, _module, \"$delay\", getScreen);\n addModuleMethod(Screen, _module, \"$window_width\", getScreen);\n addModuleMethod(Screen, _module, \"$window_height\", getScreen);\n\n _module.Turtle = Sk.misceval.buildClass(_module, TurtleWrapper, \"Turtle\", []);\n _module.Screen = Sk.misceval.buildClass(_module, ScreenWrapper, \"Screen\", []);\n\n // Calling focus(false) will block turtle key/mouse events\n // until focus(true) is called again or until the turtle DOM target\n // is clicked/tabbed into.\n function focusTurtle(value) {\n if (value !== undefined) {\n _focus = !!value;\n if (_focus) {\n getTarget().focus();\n }\n else {\n getTarget().blur();\n }\n }\n\n return _focus;\n }\n\n function resetTurtle() {\n cancelAnimationFrame();\n getScreen().reset();\n getFrameManager().reset();\n\n while (_target.firstChild) {\n _target.removeChild(_target.firstChild);\n }\n\n if (_mouseHandler) {\n _mouseHandler.reset();\n }\n\n _durationSinceRedraw = 0;\n _screenInstance = undefined;\n _anonymousTurtle = undefined;\n _mouseHandler = undefined;\n TURTLE_COUNT = 0;\n }\n\n function stopTurtle() {\n cancelAnimationFrame();\n\n if (_mouseHandler) {\n _mouseHandler.reset();\n }\n\n _durationSinceRedraw = 0;\n _screenInstance = undefined;\n _anonymousTurtle = undefined;\n _mouseHandler = undefined;\n TURTLE_COUNT = 0;\n }\n\n return {\n skModule : _module,\n reset : resetTurtle,\n stop : stopTurtle,\n focus : focusTurtle,\n Turtle : Turtle,\n Screen : Screen\n };\n}\n\n// See if the TurtleGraphics module has already been loaded\n// for the currently configured DOM target element.\nvar currentTarget = getConfiguredTarget();\n\nif (!currentTarget.turtleInstance) {\n currentTarget.turtleInstance = generateTurtleModule(currentTarget);\n}\nelse {\n currentTarget.turtleInstance.reset();\n}\n\nSk.TurtleGraphics.module = currentTarget.turtleInstance.skModule;\nSk.TurtleGraphics.reset = currentTarget.turtleInstance.reset;\nSk.TurtleGraphics.stop = currentTarget.turtleInstance.stop;\nSk.TurtleGraphics.focus = currentTarget.turtleInstance.focus;\nSk.TurtleGraphics.raw = {\n Turtle : currentTarget.turtleInstance.Turtle,\n Screen : currentTarget.turtleInstance.Screen\n};\n\nreturn currentTarget.turtleInstance.skModule;\n\n};\n", "src/lib/rexec.py": "raise NotImplementedError(\"rexec is not yet implemented in Skulpt\")\n", "src/lib/glob.py": "raise NotImplementedError(\"glob is not yet implemented in Skulpt\")\n", "src/lib/pipes.py": "raise NotImplementedError(\"pipes is not yet implemented in Skulpt\")\n", "src/lib/smtpd.py": "raise NotImplementedError(\"smtpd is not yet implemented in Skulpt\")\n", "src/lib/_MozillaCookieJar.py": "raise NotImplementedError(\"_MozillaCookieJar is not yet implemented in Skulpt\")\n", "src/lib/collections.js": "var $builtinmodule = function (name) {\n\n var mod = {};\n\n // defaultdict object\n\n mod.defaultdict = function defaultdict(default_, args) {\n if (!(this instanceof mod.defaultdict)) {\n return new mod.defaultdict(default_, args);\n }\n\n Sk.abstr.superConstructor(mod.defaultdict, this, args);\n\n if (default_ === undefined) {\n this.default_factory = Sk.builtin.none.none$;\n }\n else {\n if (!Sk.builtin.checkCallable(default_) && !(default_ instanceof Sk.builtin.none)) {\n throw new Sk.builtin.TypeError(\"first argument must be callable\");\n }\n this.default_factory = default_;\n }\n\n if (this['$d']) {\n this['$d']['default_factory'] = this.default_factory;\n }\n else {\n this['$d'] = {'default_factory': this.default_factory};\n }\n\n return this;\n };\n\n Sk.abstr.setUpInheritance(\"defaultdict\", mod.defaultdict, Sk.builtin.dict);\n\n mod.defaultdict.prototype['$r'] = function () {\n var def_str = Sk.misceval.objectRepr(this.default_factory).v;\n var dict_str = Sk.builtin.dict.prototype['$r'].call(this).v;\n return new Sk.builtin.str(\"defaultdict(\" + def_str + \", \" + dict_str + \")\");\n };\n\n mod.defaultdict.prototype['__missing__'] = function (key) {\n Sk.builtin.pyCheckArgs('__missing__', arguments, 0, 1);\n if (key) {\n throw new Sk.builtin.KeyError(Sk.misceval.objectRepr(key));\n }\n else {\n return Sk.misceval.callsim(this.default_factory);\n }\n };\n\n mod.defaultdict.prototype.mp$subscript = function (key) {\n try {\n return Sk.builtin.dict.prototype.mp$subscript.call(this, key);\n }\n catch (e) {\n if (this.default_factory instanceof Sk.builtin.none) {\n return this.__missing__(key);\n }\n else {\n ret = this.__missing__();\n this.mp$ass_subscript(key, ret);\n return ret;\n }\n }\n };\n\n // Counter object\n\n mod.Counter = function Counter(iter_or_map) {\n if (!(this instanceof mod.Counter)) {\n return new mod.Counter(iter_or_map);\n }\n\n\n if (iter_or_map instanceof Sk.builtin.dict || iter_or_map === undefined) {\n Sk.abstr.superConstructor(mod.Counter, this, iter_or_map);\n\n }\n else {\n if (!(Sk.builtin.checkIterable(iter_or_map))) {\n throw new Sk.builtin.TypeError(\"'\" + Sk.abstr.typeName(iter_or_map) + \"' object is not iterable\");\n }\n\n Sk.abstr.superConstructor(mod.Counter, this);\n var one = new Sk.builtin.int_(1);\n\n for (var iter = iter_or_map.tp$iter(), k = iter.tp$iternext();\n k !== undefined;\n k = iter.tp$iternext()) {\n var count = this.mp$subscript(k);\n count = count.nb$add(one);\n this.mp$ass_subscript(k, count);\n }\n }\n\n return this;\n };\n\n Sk.abstr.setUpInheritance(\"Counter\", mod.Counter, Sk.builtin.dict);\n\n mod.Counter.prototype['$r'] = function () {\n var dict_str = this.size > 0 ? Sk.builtin.dict.prototype['$r'].call(this).v : '';\n return new Sk.builtin.str('Counter(' + dict_str + ')');\n };\n\n mod.Counter.prototype.mp$subscript = function (key) {\n try {\n return Sk.builtin.dict.prototype.mp$subscript.call(this, key);\n }\n catch (e) {\n return new Sk.builtin.int_(0);\n }\n };\n\n mod.Counter.prototype['elements'] = new Sk.builtin.func(function (self) {\n Sk.builtin.pyCheckArgs('elements', arguments, 1, 1);\n var all_elements = [];\n for (var iter = self.tp$iter(), k = iter.tp$iternext();\n k !== undefined;\n k = iter.tp$iternext()) {\n for (var i = 0; i < self.mp$subscript(k).v; i++) {\n all_elements.push(k);\n }\n }\n\n var ret =\n {\n tp$iter: function () {\n return ret;\n },\n $obj: this,\n $index: 0,\n $elem: all_elements,\n tp$iternext: function () {\n if (ret.$index >= ret.$elem.length) {\n return undefined;\n }\n return ret.$elem[ret.$index++];\n }\n };\n\n return ret;\n\n });\n\n mod.Counter.prototype['most_common'] = new Sk.builtin.func(function (self, n) {\n Sk.builtin.pyCheckArgs('most_common', arguments, 1, 2);\n var length = self.mp$length();\n\n if (n === undefined) {\n n = length;\n }\n else {\n if (!Sk.builtin.checkInt(n)) {\n if (n instanceof Sk.builtin.float_) {\n throw new Sk.builtin.TypeError(\"integer argument expected, got float\");\n }\n else {\n throw new Sk.builtin.TypeError(\"an integer is required\");\n }\n }\n\n n = Sk.builtin.asnum$(n);\n n = n <= length ? n : length;\n n = n >= 0 ? n : 0;\n }\n\n var most_common_elem = [];\n for (var iter = self.tp$iter(), k = iter.tp$iternext();\n k !== undefined;\n k = iter.tp$iternext()) {\n most_common_elem.push([k, self.mp$subscript(k)]);\n }\n\n var sort_func = function (a, b) {\n if (a[1].v < b[1].v) {\n return 1;\n } else if (a[1].v > b[1].v) {\n return -1;\n } else {\n return 0;\n }\n };\n most_common_elem = most_common_elem.sort(sort_func);\n\n var ret = [];\n for (var i = 0; i < n; i++) {\n ret.push(new Sk.builtin.tuple(most_common_elem.shift()));\n }\n\n return new Sk.builtin.list(ret);\n });\n\n mod.Counter.prototype['update'] = new Sk.builtin.func(function (self, other) {\n Sk.builtin.pyCheckArgs('update', arguments, 1, 2);\n\n if (other instanceof Sk.builtin.dict) {\n for (var iter = other.tp$iter(), k = iter.tp$iternext();\n k !== undefined;\n k = iter.tp$iternext()) {\n var count = self.mp$subscript(k);\n self.mp$ass_subscript(k, count.nb$add(other.mp$subscript(k)));\n }\n }\n else if (other !== undefined) {\n if (!Sk.builtin.checkIterable(other)) {\n throw new Sk.builtin.TypeError(\"'\" + Sk.abstr.typeName(other) + \"' object is not iterable\");\n }\n\n var one = new Sk.builtin.int_(1);\n for (var iter = other.tp$iter(), k = iter.tp$iternext();\n k !== undefined;\n k = iter.tp$iternext()) {\n var count = self.mp$subscript(k);\n self.mp$ass_subscript(k, count.nb$add(one));\n }\n }\n });\n\n mod.Counter.prototype['subtract'] = new Sk.builtin.func(function (self, other) {\n Sk.builtin.pyCheckArgs('subtract', arguments, 1, 2);\n\n if (other instanceof Sk.builtin.dict) {\n for (var iter = other.tp$iter(), k = iter.tp$iternext();\n k !== undefined;\n k = iter.tp$iternext()) {\n var count = self.mp$subscript(k);\n self.mp$ass_subscript(k, count.nb$subtract(other.mp$subscript(k)));\n }\n }\n else if (other !== undefined) {\n if (!Sk.builtin.checkIterable(other)) {\n throw new Sk.builtin.TypeError(\"'\" + Sk.abstr.typeName(other) + \"' object is not iterable\");\n }\n\n var one = new Sk.builtin.int_(1);\n for (var iter = other.tp$iter(), k = iter.tp$iternext();\n k !== undefined;\n k = iter.tp$iternext()) {\n var count = self.mp$subscript(k);\n self.mp$ass_subscript(k, count.nb$subtract(one));\n }\n }\n });\n\n\n // OrderedDict\n mod.OrderedDict = function OrderedDict(items)\n {\n if (!(this instanceof mod.OrderedDict))\n {\n return new mod.OrderedDict(items);\n }\n\n this.orderedkeys = [];\n\n Sk.abstr.superConstructor(mod.OrderedDict, this, items);\n\n return this;\n }\n\n Sk.abstr.setUpInheritance(\"OrderedDict\", mod.OrderedDict, Sk.builtin.dict);\n\n mod.OrderedDict.prototype['$r'] = function()\n {\n var v;\n var iter, k;\n var ret = [];\n var pairstr;\n for (iter = this.tp$iter(), k = iter.tp$iternext();\n k !== undefined;\n k = iter.tp$iternext()) {\n v = this.mp$subscript(k);\n if (v === undefined) {\n //print(k, \"had undefined v\");\n v = null;\n }\n ret.push(\"(\" + Sk.misceval.objectRepr(k).v + \", \" + Sk.misceval.objectRepr(v).v + \")\");\n }\n pairstr = ret.join(\", \");\n if (ret.length > 0)\n {\n pairstr = \"[\" + pairstr + \"]\";\n }\n return new Sk.builtin.str(\"OrderedDict(\" + pairstr + \")\");\n }\n\n mod.OrderedDict.prototype.mp$ass_subscript = function(key, w)\n {\n var idx = this.orderedkeys.indexOf(key);\n if (idx == -1)\n {\n this.orderedkeys.push(key);\n }\n\n return Sk.builtin.dict.prototype.mp$ass_subscript.call(this, key, w);\n }\n\n mod.OrderedDict.prototype.mp$del_subscript = function(key)\n {\n var idx = this.orderedkeys.indexOf(key);\n if (idx != -1)\n {\n this.orderedkeys.splice(idx, 1);\n }\n\n return Sk.builtin.dict.prototype.mp$del_subscript.call(this, key);\n }\n\n mod.OrderedDict.prototype.__iter__ = new Sk.builtin.func(function (self) {\n Sk.builtin.pyCheckArgs(\"__iter__\", arguments, 0, 0, false, true);\n\n return mod.OrderedDict.prototype.tp$iter.call(self);\n });\n\n mod.OrderedDict.prototype.tp$iter = function()\n {\n var ret;\n ret =\n {\n tp$iter : function () {\n return ret;\n },\n $obj : this,\n $index : 0,\n $keys : this.orderedkeys.slice(0),\n tp$iternext: function () {\n // todo; StopIteration\n if (ret.$index >= ret.$keys.length) {\n return undefined;\n }\n return ret.$keys[ret.$index++];\n }\n };\n return ret;\n }\n\n mod.OrderedDict.prototype.ob$eq = function (other) {\n var l;\n var otherl;\n var iter;\n var k;\n var v;\n\n if (!(other instanceof mod.OrderedDict))\n {\n return Sk.builtin.dict.prototype.ob$eq.call(this, other);\n }\n\n l = this.mp$length();\n otherl = other.mp$length();\n\n if (l !== otherl) {\n return Sk.builtin.bool.false$;\n }\n\n for (iter = this.tp$iter(), otheriter = other.tp$iter(),\n k = iter.tp$iternext(), otherk = otheriter.tp$iternext();\n k !== undefined;\n k = iter.tp$iternext(), otherk = otheriter.tp$iternext()) \n {\n if (!Sk.misceval.isTrue(Sk.misceval.richCompareBool(k, otherk, \"Eq\")))\n {\n return Sk.builtin.bool.false$;\n }\n v = this.mp$subscript(k);\n otherv = other.mp$subscript(otherk);\n\n if (!Sk.misceval.isTrue(Sk.misceval.richCompareBool(v, otherv, \"Eq\"))) {\n return Sk.builtin.bool.false$;\n }\n }\n\n return Sk.builtin.bool.true$;\n };\n\n mod.OrderedDict.prototype.ob$ne = function (other) {\n var l;\n var otherl;\n var iter;\n var k;\n var v;\n\n if (!(other instanceof mod.OrderedDict))\n {\n return Sk.builtin.dict.prototype.ob$ne.call(this, other);\n }\n\n l = this.size;\n otherl = other.size;\n\n if (l !== otherl) {\n return Sk.builtin.bool.true$;\n }\n\n for (iter = this.tp$iter(), otheriter = other.tp$iter(),\n k = iter.tp$iternext(), otherk = otheriter.tp$iternext();\n k !== undefined;\n k = iter.tp$iternext(), otherk = otheriter.tp$iternext()) \n {\n if (!Sk.misceval.isTrue(Sk.misceval.richCompareBool(k, otherk, \"Eq\")))\n {\n return Sk.builtin.bool.true$;\n }\n v = this.mp$subscript(k);\n otherv = other.mp$subscript(otherk);\n\n if (!Sk.misceval.isTrue(Sk.misceval.richCompareBool(v, otherv, \"Eq\"))) {\n return Sk.builtin.bool.true$;\n }\n }\n\n return Sk.builtin.bool.false$;\n };\n\n mod.OrderedDict.prototype[\"pop\"] = new Sk.builtin.func(function (self, key, d) {\n var s;\n var idx;\n\n Sk.builtin.pyCheckArgs('pop', arguments, 2, 3);\n\n idx = self.orderedkeys.indexOf(key);\n if (idx != -1)\n {\n self.orderedkeys.splice(idx, 1);\n }\n\n return Sk.misceval.callsim(Sk.builtin.dict.prototype[\"pop\"], self, key, d);\n });\n\n mod.OrderedDict.prototype[\"popitem\"] = new Sk.builtin.func(function (self, last) {\n var key, val;\n var s;\n\n Sk.builtin.pyCheckArgs('popitem', arguments, 1, 2);\n\n // Empty dictionary\n if (self.orderedkeys.length == 0)\n {\n s = new Sk.builtin.str('dictionary is empty');\n throw new Sk.builtin.KeyError(s.v);\n }\n\n key = self.orderedkeys[0];\n if (last === undefined || Sk.misceval.isTrue(last))\n {\n key = self.orderedkeys[self.orderedkeys.length - 1];\n }\n\n val = Sk.misceval.callsim(self[\"pop\"], self, key);\n return Sk.builtin.tuple([key, val]);\n });\n\n // deque\n mod.deque = function deque(iterable, maxlen) {\n throw new Sk.builtin.NotImplementedError(\"deque is not implemented\")\n };\n\n // namedtuple\n mod.namedtuples = {};\n var keywds = Sk.importModule(\"keyword\", false, false);\n // should cover most things. Does not:\n // * keyword args\n // _make\n // _replace\n // _asdict\n // _fields\n\n\n var hasDupes = function(a) {\n var counts = [];\n for(var i = 0; i <= a.length; i++) {\n if(counts[a[i]] === undefined) {\n counts[a[i]] = 1;\n } else {\n return true;\n }\n }\n return false;\n }\n\n var Skinherits = function(childCtor, parentCtor) {\n /** @constructor */\n function tempCtor() {};\n tempCtor.prototype = parentCtor.prototype;\n childCtor.superClass_ = parentCtor.prototype;\n childCtor.prototype = new tempCtor();\n /** @override */\n childCtor.prototype.constructor = childCtor;\n };\n\n mod.namedtuple = function (name, fields) {\n if (Sk.ffi.remapToJs(Sk.misceval.callsim(keywds.$d['iskeyword'],name ))) {\n throw new Sk.builtin.ValueError(\"Type names and field names cannot be a keyword: \" + name.v);\n }\n var nm = Sk.ffi.remapToJs(name);\n startsw = new RegExp(/^[0-9].*/);\n startsw2 = new RegExp(/^[0-9_].*/);\n alnum = new RegExp(/^\\w*$/);\n if (startsw.test(nm) || (! alnum.test(nm))) {\n throw new Sk.builtin.ValueError(\" Bad type name \" + nm);\n }\n // fields could be a string or a tuple or list of strings\n var flds = Sk.ffi.remapToJs(fields);\n\n if (typeof(flds) === 'string') {\n flds = flds.split(/\\s+/);\n }\n // import the keyword module here and use iskeyword\n for (i = 0; i < flds.length; i++) {\n if (Sk.ffi.remapToJs(Sk.misceval.callsim(keywds.$d['iskeyword'],Sk.ffi.remapToPy(flds[i]))) ||\n startsw2.test(flds[i]) || (! alnum.test(flds[i]))\n ) {\n throw new Sk.builtin.ValueError(\"Type names and field names cannot be a keyword: \" + flds[i]);\n }\n }\n if (hasDupes(flds)) {\n throw new Sk.builtin.ValueError(\"Field names must be unique.\");\n }\n\n var cons = function nametuple_constructor() {\n var o;\n if (arguments.length !== flds.length ) {\n throw new Sk.builtin.TypeError(\"Number of arguments must match\");\n }\n if (!(this instanceof mod.namedtuples[nm])) {\n o = Object.create(mod.namedtuples[nm].prototype);\n o.constructor.apply(o, arguments);\n return o;\n }\n this.__class__ = mod.namedtuples[nm];\n this.v = Array.prototype.slice.call(arguments);\n };\n mod.namedtuples[nm] = cons;\n\n Skinherits(cons, Sk.builtin.tuple);\n cons.prototype.tp$name = nm;\n cons.prototype.ob$type = Sk.builtin.type.makeIntoTypeObj(nm, mod.namedtuples[nm]);\n cons.prototype[\"$r\"] = function () {\n var ret;\n var i;\n var bits;\n if (this.v.length === 0) {\n return new Sk.builtin.str(nm + \"()\");\n }\n bits = [];\n for (i = 0; i < this.v.length; ++i) {\n bits[i] = flds[i] + \"=\" + Sk.misceval.objectRepr(this.v[i]).v;\n }\n ret = bits.join(\", \");\n if (this.v.length === 1) {\n ret += \",\";\n }\n return new Sk.builtin.str(nm + \"(\" + ret + \")\");\n };\n\n cons.prototype.tp$getattr = function (name) {\n var i = flds.indexOf(name);\n if (i >= 0) {\n return this.v[i];\n }\n return undefined;\n };\n\n cons.prototype.tp$setattr = function (name, value) {\n throw new Sk.builtin.AttributeError(\"can't set attribute\");\n };\n\n return cons;\n };\n\n return mod;\n};\n", "src/lib/lib-tk/__init__.py": "raise NotImplementedError(\"lib-tk is not yet implemented in Skulpt\")\n", "src/lib/json/__init__.py": "raise NotImplementedError(\"json is not yet implemented in Skulpt\")\n", "src/lib/difflib.py": "raise NotImplementedError(\"difflib is not yet implemented in Skulpt\")\n", "src/lib/dis.py": "raise NotImplementedError(\"dis is not yet implemented in Skulpt\")\n", "src/lib/sched.py": "raise NotImplementedError(\"sched is not yet implemented in Skulpt\")\n", "src/lib/rfc822.py": "raise NotImplementedError(\"rfc822 is not yet implemented in Skulpt\")\n", "src/lib/distutils/command/__init__.py": "raise NotImplementedError(\"command is not yet implemented in Skulpt\")\n", "src/lib/stat.py": "raise NotImplementedError(\"stat is not yet implemented in Skulpt\")\n", "src/lib/StringIO.py": "r\"\"\"File-like objects that read from or write to a string buffer.\n\nThis implements (nearly) all stdio methods.\n\nf = StringIO() # ready for writing\nf = StringIO(buf) # ready for reading\nf.close() # explicitly release resources held\nflag = f.isatty() # always false\npos = f.tell() # get current position\nf.seek(pos) # set current position\nf.seek(pos, mode) # mode 0: absolute; 1: relative; 2: relative to EOF\nbuf = f.read() # read until EOF\nbuf = f.read(n) # read up to n bytes\nbuf = f.readline() # read until end of line ('\\n') or EOF\nlist = f.readlines()# list of f.readline() results until EOF\nf.truncate([size]) # truncate file at to at most size (default: current pos)\nf.write(buf) # write at current position\nf.writelines(list) # for line in list: f.write(line)\nf.getvalue() # return whole file's contents as a string\n\nNotes:\n- Using a real file is often faster (but less convenient).\n- There's also a much faster implementation in C, called cStringIO, but\n it's not subclassable.\n- fileno() is left unimplemented so that code which uses it triggers\n an exception early.\n- Seeking far beyond EOF and then writing will insert real null\n bytes that occupy space in the buffer.\n- There's a simple test set (see end of this file).\n\"\"\"\n\n__all__ = [\"StringIO\"]\n\ndef _complain_ifclosed(closed):\n if closed:\n raise ValueError, \"I/O operation on closed file\"\n\nclass StringIO:\n \"\"\"class StringIO([buffer])\n\n When a StringIO object is created, it can be initialized to an existing\n string by passing the string to the constructor. If no string is given,\n the StringIO will start empty.\n\n The StringIO object can accept either Unicode or 8-bit strings, but\n mixing the two may take some care. If both are used, 8-bit strings that\n cannot be interpreted as 7-bit ASCII (that use the 8th bit) will cause\n a UnicodeError to be raised when getvalue() is called.\n \"\"\"\n def __init__(self, buf = ''):\n # Force self.buf to be a string or unicode\n if not isinstance(buf, str):\n buf = str(buf)\n self.buf = buf\n self.len = len(buf)\n self.buflist = []\n self.pos = 0\n self.closed = False\n self.softspace = 0\n\n def __iter__(self):\n return self\n\n def next(self):\n \"\"\"A file object is its own iterator, for example iter(f) returns f\n (unless f is closed). When a file is used as an iterator, typically\n in a for loop (for example, for line in f: print line), the next()\n method is called repeatedly. This method returns the next input line,\n or raises StopIteration when EOF is hit.\n \"\"\"\n _complain_ifclosed(self.closed)\n r = self.readline()\n if not r:\n raise StopIteration\n return r\n\n def close(self):\n \"\"\"Free the memory buffer.\n \"\"\"\n if not self.closed:\n self.closed = True\n self.buf = None\n self.pos = None\n\n def isatty(self):\n \"\"\"Returns False because StringIO objects are not connected to a\n tty-like device.\n \"\"\"\n _complain_ifclosed(self.closed)\n return False\n\n def seek(self, pos, mode = 0):\n \"\"\"Set the file's current position.\n\n The mode argument is optional and defaults to 0 (absolute file\n positioning); other values are 1 (seek relative to the current\n position) and 2 (seek relative to the file's end).\n\n There is no return value.\n \"\"\"\n _complain_ifclosed(self.closed)\n if self.buflist:\n self.buf += ''.join(self.buflist)\n self.buflist = []\n if mode == 1:\n pos += self.pos\n elif mode == 2:\n pos += self.len\n self.pos = max(0, pos)\n\n def tell(self):\n \"\"\"Return the file's current position.\"\"\"\n _complain_ifclosed(self.closed)\n return self.pos\n\n def read(self, n = -1):\n \"\"\"Read at most size bytes from the file\n (less if the read hits EOF before obtaining size bytes).\n\n If the size argument is negative or omitted, read all data until EOF\n is reached. The bytes are returned as a string object. An empty\n string is returned when EOF is encountered immediately.\n \"\"\"\n _complain_ifclosed(self.closed)\n if self.buflist:\n self.buf += ''.join(self.buflist)\n self.buflist = []\n if n is None or n < 0:\n newpos = self.len\n else:\n newpos = min(self.pos+n, self.len)\n r = self.buf[self.pos:newpos]\n self.pos = newpos\n return r\n\n def readline(self, length=None):\n r\"\"\"Read one entire line from the file.\n\n A trailing newline character is kept in the string (but may be absent\n when a file ends with an incomplete line). If the size argument is\n present and non-negative, it is a maximum byte count (including the\n trailing newline) and an incomplete line may be returned.\n\n An empty string is returned only when EOF is encountered immediately.\n\n Note: Unlike stdio's fgets(), the returned string contains null\n characters ('\\0') if they occurred in the input.\n \"\"\"\n _complain_ifclosed(self.closed)\n if self.buflist:\n self.buf += ''.join(self.buflist)\n self.buflist = []\n i = self.buf.find('\\n', self.pos)\n if i < 0:\n newpos = self.len\n else:\n newpos = i+1\n if length is not None and length >= 0:\n if self.pos + length < newpos:\n newpos = self.pos + length\n r = self.buf[self.pos:newpos]\n self.pos = newpos\n return r\n\n def readlines(self, sizehint = 0):\n \"\"\"Read until EOF using readline() and return a list containing the\n lines thus read.\n\n If the optional sizehint argument is present, instead of reading up\n to EOF, whole lines totalling approximately sizehint bytes (or more\n to accommodate a final whole line).\n \"\"\"\n total = 0\n lines = []\n line = self.readline()\n while line:\n lines.append(line)\n total += len(line)\n if 0 < sizehint <= total:\n break\n line = self.readline()\n return lines\n\n def truncate(self, size=None):\n \"\"\"Truncate the file's size.\n\n If the optional size argument is present, the file is truncated to\n (at most) that size. The size defaults to the current position.\n The current file position is not changed unless the position\n is beyond the new file size.\n\n If the specified size exceeds the file's current size, the\n file remains unchanged.\n \"\"\"\n _complain_ifclosed(self.closed)\n if size is None:\n size = self.pos\n elif size < 0:\n raise IOError(22, \"Negative size not allowed\")\n elif size < self.pos:\n self.pos = size\n self.buf = self.getvalue()[:size]\n self.len = size\n\n def write(self, s):\n \"\"\"Write a string to the file.\n\n There is no return value.\n \"\"\"\n _complain_ifclosed(self.closed)\n if not s: return\n # Force s to be a string or unicode\n if not isinstance(s, str):\n s = str(s)\n spos = self.pos\n slen = self.len\n if spos == slen:\n self.buflist.append(s)\n self.len = self.pos = spos + len(s)\n return\n if spos > slen:\n self.buflist.append('\\0'*(spos - slen))\n slen = spos\n newpos = spos + len(s)\n if spos < slen:\n if self.buflist:\n self.buf += ''.join(self.buflist)\n self.buflist = [self.buf[:spos], s, self.buf[newpos:]]\n self.buf = ''\n if newpos > slen:\n slen = newpos\n else:\n self.buflist.append(s)\n slen = newpos\n self.len = slen\n self.pos = newpos\n\n def writelines(self, iterable):\n \"\"\"Write a sequence of strings to the file. The sequence can be any\n iterable object producing strings, typically a list of strings. There\n is no return value.\n\n (The name is intended to match readlines(); writelines() does not add\n line separators.)\n \"\"\"\n write = self.write\n for line in iterable:\n write(line)\n\n def flush(self):\n \"\"\"Flush the internal buffer\n \"\"\"\n _complain_ifclosed(self.closed)\n\n def getvalue(self):\n \"\"\"\n Retrieve the entire contents of the \"file\" at any time before\n the StringIO object's close() method is called.\n\n The StringIO object can accept either Unicode or 8-bit strings,\n but mixing the two may take some care. If both are used, 8-bit\n strings that cannot be interpreted as 7-bit ASCII (that use the\n 8th bit) will cause a UnicodeError to be raised when getvalue()\n is called.\n \"\"\"\n _complain_ifclosed(self.closed)\n if self.buflist:\n self.buf += ''.join(self.buflist)\n self.buflist = []\n return self.buf\n", "src/lib/sqlite3/__init__.py": "raise NotImplementedError(\"sqlite3 is not yet implemented in Skulpt\")\n", "src/lib/xdrlib.py": "raise NotImplementedError(\"xdrlib is not yet implemented in Skulpt\")\n", "src/lib/__phello__.foo.py": "raise NotImplementedError(\"__phello__.foo is not yet implemented in Skulpt\")\n", "src/lib/imaplib.py": "raise NotImplementedError(\"imaplib is not yet implemented in Skulpt\")\n", "src/lib/smtplib.py": "raise NotImplementedError(\"smtplib is not yet implemented in Skulpt\")\n", "src/lib/repr.py": "raise NotImplementedError(\"repr is not yet implemented in Skulpt\")\n", "src/lib/distutils/tests/__init__.py": "raise NotImplementedError(\"tests is not yet implemented in Skulpt\")\n", "src/lib/telnetlib.py": "raise NotImplementedError(\"telnetlib is not yet implemented in Skulpt\")\n", "src/lib/curses/__init__.py": "raise NotImplementedError(\"curses is not yet implemented in Skulpt\")\n", "src/lib/bisect.py": "raise NotImplementedError(\"bisect is not yet implemented in Skulpt\")\n", "src/lib/pythonds/trees/__init__.py": "\n# from .binaryTree import BinaryTree\n# from .balance import AVLTree\n# from .bst import BinarySearchTree\n# from .binheap import BinHeap\n\n\n", "src/lib/pythonds/trees/binaryTree.py": "# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \n\nclass BinaryTree:\n \"\"\"\n A recursive implementation of Binary Tree\n Using links and Nodes approach.\n \"\"\" \n def __init__(self,rootObj):\n self.key = rootObj\n self.leftChild = None\n self.rightChild = None\n\n def insertLeft(self,newNode):\n if self.leftChild == None:\n self.leftChild = BinaryTree(newNode)\n else:\n t = BinaryTree(newNode)\n t.left = self.leftChild\n self.leftChild = t\n \n def insertRight(self,newNode):\n if self.rightChild == None:\n self.rightChild = BinaryTree(newNode)\n else:\n t = BinaryTree(newNode)\n t.right = self.rightChild\n self.rightChild = t\n\n def isLeaf(self):\n return ((not self.leftChild) and (not self.rightChild))\n\n def getRightChild(self):\n return self.rightChild\n\n def getLeftChild(self):\n return self.leftChild\n\n def setRootVal(self,obj):\n self.key = obj\n\n def getRootVal(self,):\n return self.key\n\n def inorder(self):\n if self.leftChild:\n self.leftChild.inorder()\n print(self.key)\n if self.rightChild:\n self.rightChild.inorder()\n\n def postorder(self):\n if self.leftChild:\n self.leftChild.postorder()\n if self.rightChild:\n self.rightChild.postorder()\n print(self.key)\n\n\n def preorder(self):\n print(self.key)\n if self.leftChild:\n self.leftChild.preorder()\n if self.rightChild:\n self.rightChild.preorder()\n\n def printexp(self):\n if self.leftChild:\n print('(')\n self.leftChild.printexp()\n print(self.key)\n if self.rightChild:\n self.rightChild.printexp()\n print(')')\n\n def postordereval(self):\n opers = {'+':operator.add, '-':operator.sub, '*':operator.mul, '/':operator.truediv}\n res1 = None\n res2 = None\n if self.leftChild:\n res1 = self.leftChild.postordereval() #// \\label{peleft}\n if self.rightChild:\n res2 = self.rightChild.postordereval() #// \\label{peright}\n if res1 and res2:\n return opers[self.key](res1,res2) #// \\label{peeval}\n else:\n return self.key\n\ndef inorder(tree):\n if tree != None:\n inorder(tree.getLeftChild())\n print(tree.getRootVal())\n inorder(tree.getRightChild())\n\ndef printexp(tree):\n if tree.leftChild:\n print('(')\n printexp(tree.getLeftChild())\n print(tree.getRootVal())\n if tree.rightChild:\n printexp(tree.getRightChild())\n print(')') \n\ndef printexp(tree):\n sVal = \"\"\n if tree:\n sVal = '(' + printexp(tree.getLeftChild())\n sVal = sVal + str(tree.getRootVal())\n sVal = sVal + printexp(tree.getRightChild()) + ')'\n return sVal\n\ndef postordereval(tree):\n opers = {'+':operator.add, '-':operator.sub, '*':operator.mul, '/':operator.truediv}\n res1 = None\n res2 = None\n if tree:\n res1 = postordereval(tree.getLeftChild()) #// \\label{peleft}\n res2 = postordereval(tree.getRightChild()) #// \\label{peright}\n if res1 and res2:\n return opers[tree.getRootVal()](res1,res2) #// \\label{peeval}\n else:\n return tree.getRootVal()\n\ndef height(tree):\n if tree == None:\n return -1\n else:\n return 1 + max(height(tree.leftChild),height(tree.rightChild))\n\n# t = BinaryTree(7)\n# t.insertLeft(3)\n# t.insertRight(9)\n# inorder(t)\n# import operator\n# x = BinaryTree('*')\n# x.insertLeft('+')\n# l = x.getLeftChild()\n# l.insertLeft(4)\n# l.insertRight(5)\n# x.insertRight(7)\n# print(printexp(x))\n# print(postordereval(x))\n# print(height(x))\n", "src/lib/webgl/primitives.js": "// most of this file is from 'tdl'\n\nvar $builtinmodule = function(name)\n{\n var mod = {};\n\n\n\n /**\n * AttribBuffer manages a TypedArray as an array of vectors.\n *\n * @param {number} numComponents Number of components per\n * vector.\n * @param {number|!Array.<number>} numElements Number of vectors or the data.\n * @param {string} opt_type The type of the TypedArray to\n * create. Default = 'Float32Array'.\n * @param {!Array.<number>} opt_data The data for the array.\n */\n var AttribBuffer = function(\n numComponents, numElements, opt_type) {\n opt_type = opt_type || 'Float32Array';\n var type = window[opt_type];\n if (numElements.length) {\n this.buffer = new type(numElements);\n numElements = this.buffer.length / numComponents;\n this.cursor = numElements;\n } else {\n this.buffer = new type(numComponents * numElements);\n this.cursor = 0;\n }\n this.numComponents = numComponents;\n this.numElements = numElements;\n this.type = opt_type;\n };\n\n AttribBuffer.prototype.stride = function() {\n return 0;\n };\n\n AttribBuffer.prototype.offset = function() {\n return 0;\n };\n\n AttribBuffer.prototype.getElement = function(index) {\n var offset = index * this.numComponents;\n var value = [];\n for (var ii = 0; ii < this.numComponents; ++ii) {\n value.push(this.buffer[offset + ii]);\n }\n return value;\n };\n\n AttribBuffer.prototype.setElement = function(index, value) {\n var offset = index * this.numComponents;\n for (var ii = 0; ii < this.numComponents; ++ii) {\n this.buffer[offset + ii] = value[ii];\n }\n };\n\n AttribBuffer.prototype.clone = function() {\n var copy = new AttribBuffer(\n this.numComponents, this.numElements, this.type);\n copy.pushArray(this);\n return copy;\n }\n\n AttribBuffer.prototype.push = function(value) {\n this.setElement(this.cursor++, value);\n };\n\n AttribBuffer.prototype.pushArray = function(array) {\n // this.buffer.set(array, this.cursor * this.numComponents);\n // this.cursor += array.numElements;\n for (var ii = 0; ii < array.numElements; ++ii) {\n this.push(array.getElement(ii));\n }\n };\n\n AttribBuffer.prototype.pushArrayWithOffset =\n function(array, offset) {\n for (var ii = 0; ii < array.numElements; ++ii) {\n var elem = array.getElement(ii);\n for (var jj = 0; jj < offset.length; ++jj) {\n elem[jj] += offset[jj];\n }\n this.push(elem);\n }\n };\n\n /**\n * Computes the extents\n * @param {!AttribBuffer} positions The positions\n * @return {!{min: !tdl.math.Vector3, max:!tdl.math.Vector3}}\n * The min and max extents.\n */\n AttribBuffer.prototype.computeExtents = function() {\n var numElements = this.numElements;\n var numComponents = this.numComponents;\n var minExtent = this.getElement(0);\n var maxExtent = this.getElement(0);\n for (var ii = 1; ii < numElements; ++ii) {\n var element = this.getElement(ii);\n for (var jj = 0; jj < numComponents; ++jj) {\n minExtent[jj] = Math.min(minExtent[jj], element[jj]);\n maxExtent[jj] = Math.max(maxExtent[jj], element[jj]);\n }\n }\n return {min: minExtent, max: maxExtent};\n };\n\n\n /**\n * Creates the vertices and indices for a cube. The\n * cube will be created around the origin. (-size / 2, size / 2)\n *\n * @param {number} size Width, height and depth of the cube.\n * @return {!Object.<string, !tdl.primitives.AttribBuffer>} The\n * created plane vertices.\n */\n mod.createCube = new Sk.builtin.func(function(size)\n {\n var CUBE_FACE_INDICES_ = [\n [3, 7, 5, 1],\n [0, 4, 6, 2],\n [6, 7, 3, 2],\n [0, 1, 5, 4],\n [5, 7, 6, 4],\n [2, 3, 1, 0]\n ];\n\n var k = size / 2;\n\n var cornerVertices = [\n [-k, -k, -k],\n [+k, -k, -k],\n [-k, +k, -k],\n [+k, +k, -k],\n [-k, -k, +k],\n [+k, -k, +k],\n [-k, +k, +k],\n [+k, +k, +k]\n ];\n\n var faceNormals = [\n [+1, +0, +0],\n [-1, +0, +0],\n [+0, +1, +0],\n [+0, -1, +0],\n [+0, +0, +1],\n [+0, +0, -1]\n ];\n\n var uvCoords = [\n [0, 0],\n [1, 0],\n [1, 1],\n [0, 1]\n ];\n\n var numVertices = 6 * 4;\n var positions = new AttribBuffer(3, numVertices);\n var normals = new AttribBuffer(3, numVertices);\n var texCoords = new AttribBuffer(2, numVertices);\n var indices = new AttribBuffer(3, 6 * 2, 'Uint16Array');\n\n for (var f = 0; f < 6; ++f) {\n var faceIndices = CUBE_FACE_INDICES_[f];\n for (var v = 0; v < 4; ++v) {\n var position = cornerVertices[faceIndices[v]];\n var normal = faceNormals[f];\n var uv = uvCoords[v];\n\n // Each face needs all four vertices because the normals and texture\n // coordinates are not all the same.\n positions.push(position);\n normals.push(normal);\n texCoords.push(uv);\n\n }\n // Two triangles make a square face.\n var offset = 4 * f;\n indices.push([offset + 0, offset + 1, offset + 2]);\n indices.push([offset + 0, offset + 2, offset + 3]);\n }\n\n return {\n position: positions,\n normal: normals,\n texCoord: texCoords,\n indices: indices\n };\n });\n\n return mod;\n};\n", "src/lib/weakref.py": "raise NotImplementedError(\"weakref is not yet implemented in Skulpt\")\n", "src/lib/user.py": "raise NotImplementedError(\"user is not yet implemented in Skulpt\")\n", "src/lib/pickletools.py": "raise NotImplementedError(\"pickletools is not yet implemented in Skulpt\")\n", "src/lib/mhlib.py": "raise NotImplementedError(\"mhlib is not yet implemented in Skulpt\")\n", "src/lib/re.js": "var $builtinmodule = function (name) {\n var mod = {};\n\n // Constants (mostly unsupported)\n mod.I = 2;\n mod.IGNORECASE = 2;\n // mod.L = 4;\n // mod.LOCALE = 4;\n mod.M = 8;\n mod.MULTILINE = 8;\n // mod.S = 16;\n // mod.DOTALL = 16;\n // mod.U = 32;\n // mod.UNICODE = 32;\n // mod.X = 64;\n // mod.VERBOSE = 64;\n\n var validGroups = [\"(?:\", \"(?=\", \"(?!\"];\n\n var convert = function (pattern) {\n var newpattern;\n var match;\n var i;\n\n // Look for disallowed constructs\n match = pattern.match(/\\(\\?./g);\n if (match) {\n for (i = 0; i < match.length; i++) {\n if (validGroups.indexOf(match[i]) == -1) {\n throw new Sk.builtin.ValueError(\"Disallowed group in pattern: '\"\n + match[i] + \"'\");\n }\n ;\n }\n ;\n }\n ;\n\n newpattern = pattern.replace('/\\\\/g', '\\\\\\\\');\n newpattern = pattern.replace(/([^\\\\]){,(?![^\\[]*\\])/g, '$1{0,');\n\n return newpattern;\n };\n\n var getFlags = function (flags) {\n var jsflags = \"g\";\n if ((flags & mod.IGNORECASE) == mod.IGNORECASE) {\n jsflags += \"i\";\n }\n ;\n if ((flags & mod.MULTILINE) == mod.MULTILINE) {\n jsflags += \"m\";\n }\n ;\n return jsflags;\n };\n\n mod.split = Sk.nativejs.func(function split (pattern, string, maxsplit, flags) {\n Sk.builtin.pyCheckArgs(\"split\", arguments, 2, 4);\n if (!Sk.builtin.checkString(pattern)) {\n throw new Sk.builtin.TypeError(\"pattern must be a string\");\n }\n ;\n if (!Sk.builtin.checkString(string)) {\n throw new Sk.builtin.TypeError(\"string must be a string\");\n }\n ;\n if (maxsplit === undefined) {\n maxsplit = 0;\n }\n ;\n if (!Sk.builtin.checkNumber(maxsplit)) {\n throw new Sk.builtin.TypeError(\"maxsplit must be a number\");\n }\n ;\n if (flags === undefined) {\n flags = 0;\n }\n ;\n if (!Sk.builtin.checkNumber(flags)) {\n throw new Sk.builtin.TypeError(\"flags must be a number\");\n }\n ;\n\n maxsplit = Sk.builtin.asnum$(maxsplit);\n var pat = Sk.ffi.unwrapo(pattern);\n var str = Sk.ffi.unwrapo(string);\n\n // Convert pat from Python to Javascript regex syntax\n pat = convert(pat);\n //print(\"Pat: \" + pat);\n //print(\"Str: \" + str);\n\n var captured = !(pat.match(/^\\(.*\\)$/) === null);\n //print(\"Captured: \", captured);\n\n var jsflags = getFlags(flags);\n //print(\"Flags: \", jsflags);\n\n var regex = new RegExp(pat, jsflags);\n\n var result = [];\n var match;\n var index = 0;\n var splits = 0;\n while ((match = regex.exec(str)) != null) {\n //print(\"Matched '\" + match[0] + \"' at position \" + match.index + \n // \"; next search at \" + regex.lastIndex);\n if (match.index === regex.lastIndex) {\n // empty match\n break;\n }\n ;\n result.push(new Sk.builtin.str(str.substring(index, match.index)));\n if (captured) {\n // Add matching pattern, too\n result.push(new Sk.builtin.str(match[0]));\n }\n ;\n index = regex.lastIndex;\n splits += 1;\n if (maxsplit && (splits >= maxsplit)) {\n break;\n }\n ;\n }\n ;\n result.push(new Sk.builtin.str(str.substring(index)));\n\n return new Sk.builtin.list(result);\n });\n\n mod.findall = Sk.nativejs.func(function findall (pattern, string, flags) {\n Sk.builtin.pyCheckArgs(\"findall\", arguments, 2, 3);\n if (!Sk.builtin.checkString(pattern)) {\n throw new Sk.builtin.TypeError(\"pattern must be a string\");\n }\n ;\n if (!Sk.builtin.checkString(string)) {\n throw new Sk.builtin.TypeError(\"string must be a string\");\n }\n ;\n if (flags === undefined) {\n flags = 0;\n }\n ;\n if (!Sk.builtin.checkNumber(flags)) {\n throw new Sk.builtin.TypeError(\"flags must be a number\");\n }\n ;\n\n var pat = Sk.ffi.unwrapo(pattern);\n var str = Sk.ffi.unwrapo(string);\n\n // Convert pat from Python to Javascript regex syntax\n pat = convert(pat);\n //print(\"Pat: \" + pat);\n //print(\"Str: \" + str);\n\n var jsflags = getFlags(flags);\n //print(\"Flags: \", jsflags);\n\n var regex = new RegExp(pat, jsflags);\n\n if (pat.match(/\\$/)) {\n var newline_at_end = new RegExp(/\\n$/);\n if (str.match(newline_at_end)) {\n str = str.slice(0, -1);\n }\n }\n\n var result = [];\n var match;\n while ((match = regex.exec(str)) != null) {\n //print(\"Matched '\" + match[0] + \"' at position \" + match.index + \n // \"; next search at \" + regex.lastIndex);\n // print(\"match: \" + JSON.stringify(match));\n if (match.length < 2) {\n result.push(new Sk.builtin.str(match[0]));\n } else if (match.length == 2) {\n result.push(new Sk.builtin.str(match[1]));\n } else {\n var groups = [];\n for (var i = 1; i < match.length; i++) {\n groups.push(new Sk.builtin.str(match[i]));\n }\n ;\n result.push(new Sk.builtin.tuple(groups));\n }\n ;\n if (match.index === regex.lastIndex) {\n regex.lastIndex += 1;\n }\n ;\n }\n ;\n\n return new Sk.builtin.list(result);\n });\n\n\n var matchobj = function ($gbl, $loc) {\n $loc.__init__ = new Sk.builtin.func(function (self, thematch, pattern, string) {\n self.thematch = thematch;\n self.re = pattern;\n self.string = string;\n });\n\n $loc.groups = new Sk.builtin.func(function (self) {\n return new Sk.builtin.tuple(self.thematch.v.slice(1))\n });\n\n $loc.group = new Sk.builtin.func(function (self, grpnum) {\n if (grpnum === undefined) {\n grpnum = 0;\n }\n else {\n grpnum = Sk.builtin.asnum$(grpnum);\n }\n if (grpnum >= self.thematch.v.length) {\n throw new Sk.builtin.IndexError(\"Index out of range: \" + grpnum);\n }\n return self.thematch.v[grpnum]\n });\n\n }\n\n mod.MatchObject = Sk.misceval.buildClass(mod, matchobj, 'MatchObject', []);\n\n // Internal function to return a Python list of strings \n // From a JS regular expression string\n mod._findre = function (res, string) {\n res = res.replace(/([^\\\\]){,(?![^\\[]*\\])/g, '$1{0,');\n var re = eval(res);\n var patt = new RegExp('\\n$');\n if (string.v.match(patt)) {\n var matches = string.v.slice(0, -1).match(re);\n }\n else {\n var matches = string.v.match(re);\n }\n retval = new Sk.builtin.list();\n if (matches == null) {\n return retval;\n }\n for (var i = 0; i < matches.length; ++i) {\n var sitem = new Sk.builtin.str(matches[i]);\n retval.v.push(sitem);\n }\n return retval;\n }\n\n mod.search = new Sk.builtin.func(function (pattern, string, flags) {\n Sk.builtin.pyCheckArgs('search', arguments, 2, 3);\n if (!Sk.builtin.checkString(pattern)) {\n throw new Sk.builtin.TypeError(\"pattern must be a string\");\n }\n ;\n if (!Sk.builtin.checkString(string)) {\n throw new Sk.builtin.TypeError(\"string must be a string\");\n }\n ;\n if (flags === undefined) {\n flags = 0;\n }\n ;\n if (!Sk.builtin.checkNumber(flags)) {\n throw new Sk.builtin.TypeError(\"flags must be a number\");\n }\n ;\n var res = \"/\" + pattern.v.replace(/\\//g, \"\\\\/\") + \"/\";\n lst = mod._findre(res, string);\n if (lst.v.length < 1) {\n return Sk.builtin.none.none$;\n }\n var mob = Sk.misceval.callsim(mod.MatchObject, lst, pattern, string);\n return mob;\n });\n\n mod.match = new Sk.builtin.func(function (pattern, string, flags) {\n Sk.builtin.pyCheckArgs('match', arguments, 2, 3);\n if (!Sk.builtin.checkString(pattern)) {\n throw new Sk.builtin.TypeError(\"pattern must be a string\");\n }\n ;\n if (!Sk.builtin.checkString(string)) {\n throw new Sk.builtin.TypeError(\"string must be a string\");\n }\n ;\n if (flags === undefined) {\n flags = 0;\n }\n ;\n if (!Sk.builtin.checkNumber(flags)) {\n throw new Sk.builtin.TypeError(\"flags must be a number\");\n }\n ;\n var res = \"/^\" + pattern.v.replace(/\\//g, \"\\\\/\") + \"/\";\n lst = mod._findre(res, string);\n if (lst.v.length < 1) {\n return Sk.builtin.none.none$;\n }\n var mob = Sk.misceval.callsim(mod.MatchObject, lst, pattern, string);\n return mob;\n });\n\n return mod;\n}\n", "src/lib/SocketServer.py": "raise NotImplementedError(\"SocketServer is not yet implemented in Skulpt\")\n", "src/lib/types.py": "\"\"\"\nThis file was modified from CPython.\nCopyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,\n2011, 2012, 2013, 2014, 2015 Python Software Foundation; All Rights Reserved\n\"\"\"\n\"\"\"Define names for all type symbols known in the standard interpreter.\nTypes that are part of optional modules (e.g. array) are not listed.\n\"\"\"\nimport sys\n\n# Iterators in Python aren't a matter of type but of protocol. A large\n# and changing number of builtin types implement *some* flavor of\n# iterator. Don't check the type! Use hasattr to check for both\n# \"__iter__\" and \"next\" attributes instead.\n\nNoneType = type(None)\nTypeType = type\nObjectType = object\nIntType = int\nLongType = long\nFloatType = float\nBooleanType = bool\ntry:\n ComplexType = complex\nexcept NameError:\n pass\nStringType = str\n\n# StringTypes is already outdated. Instead of writing \"type(x) in\n# types.StringTypes\", you should use \"isinstance(x, basestring)\". But\n# we keep around for compatibility with Python 2.2.\ntry:\n UnicodeType = unicode\n StringTypes = (StringType, UnicodeType)\nexcept NameError:\n StringTypes = (StringType,)\n\nBufferType = buffer\n\nTupleType = tuple\nListType = list\nDictType = DictionaryType = dict\n\ndef _f(): pass\nFunctionType = type(_f)\nLambdaType = type(lambda: None) # Same as FunctionType\nCodeType = type(_f.func_code)\n\ndef _g():\n yield 1\nGeneratorType = type(_g())\n\nclass _C:\n def _m(self): pass\nClassType = type(_C)\nUnboundMethodType = type(_C._m) # Same as MethodType\n_x = _C()\nInstanceType = type(_x)\nMethodType = type(_x._m)\nBuiltinFunctionType = type(len)\nBuiltinMethodType = type([].append) # Same as BuiltinFunctionType\n\nModuleType = type(sys)\nFileType = file\nXRangeType = xrange\n\n# try:\n# raise TypeError\n# except TypeError:\n# tb = sys.exc_info()[2]\n# TracebackType = type(tb)\n# FrameType = type(tb.tb_frame)\n# del tb\n\nSliceType = slice\n# EllipsisType = type(Ellipsis)\n\n# DictProxyType = type(TypeType.__dict__)\nNotImplementedType = type(NotImplemented)\n\n# For Jython, the following two types are identical\n# GetSetDescriptorType = type(FunctionType.func_code)\n# MemberDescriptorType = type(FunctionType.func_globals)\n\ndel sys, _f, _g, _C, _x # Not for export\n__all__ = list(n for n in globals() if n[:1] != '_')\n", "src/lib/DocXMLRPCServer.py": "raise NotImplementedError(\"DocXMLRPCServer is not yet implemented in Skulpt\")\n", "src/lib/heapq.py": "raise NotImplementedError(\"heapq is not yet implemented in Skulpt\")\n", "src/lib/encodings/__init__.py": "raise NotImplementedError(\"encodings is not yet implemented in Skulpt\")\n", "src/lib/mimify.py": "raise NotImplementedError(\"mimify is not yet implemented in Skulpt\")\n", "src/lib/tokenize.py": "raise NotImplementedError(\"tokenize is not yet implemented in Skulpt\")\n", "src/lib/pythonds/graphs/__init__.py": "\n\nfrom .adjGraph import Graph\nfrom .adjGraph import Vertex\nfrom .priorityQueue import PriorityQueue\n"}} \ No newline at end of file
diff --git a/static/skulpt.min.js b/static/skulpt.min.js
new file mode 100644
index 0000000..55f67d8
--- /dev/null
+++ b/static/skulpt.min.js
@@ -0,0 +1,1022 @@
+(function(){function k(b,a){s[b]||(typeof console!=="undefined"&&typeof console.warn=="function"&&console.warn("[WARNING] "+b+" is deprecated and will be removed in version 1.0. Instead, use `"+a+"`."),s[b]=!0)}function t(b){b.localize=i.localize.bind(i);b.timezone=i.timezone.bind(i);b.utc=i.utc.bind(i)}function r(b,a,e){a&&a.days&&(e=a,a=void 0);e&&k("`"+g+"(format, [date], [locale])`","var s = "+g+".localize(locale); s(format, [date])");return(e?i.localize(e):i)(b,a)}function u(b,a,e){e?k("`"+g+
+".strftime(format, [date], [locale])`","var s = "+g+".localize(locale); s(format, [date])"):k("`"+g+".strftime(format, [date])`",g+"(format, [date])");return(e?i.localize(e):i)(b,a)}function p(b,a,e){function g(b,c,h,a){for(var d="",f=null,e=!1,i=b.length,j=!1,o=0;o<i;o++){var n=b.charCodeAt(o);if(e===!0)if(n===45)f="";else if(n===95)f=" ";else if(n===48)f="0";else if(n===58)j&&typeof console!=="undefined"&&typeof console.warn=="function"&&console.warn("[WARNING] detected use of unsupported %:: or %::: modifiers to strftime"),
+j=!0;else{switch(n){case 65:d+=h.days[c.getDay()];break;case 66:d+=h.months[c.getMonth()];break;case 67:d+=l(Math.floor(c.getFullYear()/100),f);break;case 68:d+=g(h.formats.D,c,h,a);break;case 70:d+=g(h.formats.F,c,h,a);break;case 72:d+=l(c.getHours(),f);break;case 73:d+=l(v(c.getHours()),f);break;case 76:d+=Math.floor(a%1E3)>99?Math.floor(a%1E3):Math.floor(a%1E3)>9?"0"+Math.floor(a%1E3):"00"+Math.floor(a%1E3);break;case 77:d+=l(c.getMinutes(),f);break;case 80:d+=c.getHours()<12?h.am:h.pm;break;case 82:d+=
+g(h.formats.R,c,h,a);break;case 83:d+=l(c.getSeconds(),f);break;case 84:d+=g(h.formats.T,c,h,a);break;case 85:d+=l(w(c,"sunday"),f);break;case 87:d+=l(w(c,"monday"),f);break;case 88:d+=g(h.formats.X,c,h,a);break;case 89:d+=c.getFullYear();break;case 90:k&&m===0?d+="GMT":(f=c.toString().match(/\(([\w\s]+)\)/),d+=f&&f[1]||"");break;case 97:d+=h.shortDays[c.getDay()];break;case 98:d+=h.shortMonths[c.getMonth()];break;case 99:d+=g(h.formats.c,c,h,a);break;case 100:d+=l(c.getDate(),f);break;case 101:d+=
+l(c.getDate(),f==null?" ":f);break;case 104:d+=h.shortMonths[c.getMonth()];break;case 106:f=new Date(c.getFullYear(),0,1);f=Math.ceil((c.getTime()-f.getTime())/864E5);d+=f>99?f:f>9?"0"+f:"00"+f;break;case 107:d+=l(c.getHours(),f==null?" ":f);break;case 108:d+=l(v(c.getHours()),f==null?" ":f);break;case 109:d+=l(c.getMonth()+1,f);break;case 110:d+="\n";break;case 111:d+=String(c.getDate())+A(c.getDate());break;case 112:d+=c.getHours()<12?h.AM:h.PM;break;case 114:d+=g(h.formats.r,c,h,a);break;case 115:d+=
+Math.floor(a/1E3);break;case 116:d+="\t";break;case 117:f=c.getDay();d+=f===0?7:f;break;case 118:d+=g(h.formats.v,c,h,a);break;case 119:d+=c.getDay();break;case 120:d+=g(h.formats.x,c,h,a);break;case 121:d+=(""+c.getFullYear()).slice(2);break;case 122:k&&m===0?d+=j?"+00:00":"+0000":(f=m!==0?m/6E4:-c.getTimezoneOffset(),e=j?":":"",n=Math.abs(f%60),d+=(f<0?"-":"+")+l(Math.floor(Math.abs(f/60)))+e+l(n));break;default:d+=b[o]}f=null;e=!1}else n===37?e=!0:d+=b[o]}return d}var i=b||x,m=a||0,k=e||!1,j=0,
+q,b=function(b,c){var a;c?(a=c.getTime(),k&&(c=new Date(c.getTime()+(c.getTimezoneOffset()||0)*6E4+m))):(a=Date.now(),a>j?(j=a,q=new Date(j),a=j,k&&(q=new Date(j+(q.getTimezoneOffset()||0)*6E4+m))):a=j,c=q);return g(b,c,i,a)};b.localize=function(a){return new p(a||i,m,k)};b.timezone=function(a){var c=m,b=k,e=typeof a;if(e==="number"||e==="string")b=!0,e==="string"?(c=a[0]==="-"?-1:1,e=parseInt(a.slice(1,3),10),a=parseInt(a.slice(3,5),10),c=c*(60*e+a)*6E4):e==="number"&&(c=a*6E4);return new p(i,c,
+b)};b.utc=function(){return new p(i,m,!0)};return b}function l(b,a){if(a===""||b>9)return b;a==null&&(a="0");return a+b}function v(b){if(b===0)return 12;else if(b>12)return b-12;return b}function w(b,a){var a=a||"sunday",e=b.getDay();a==="monday"&&(e===0?e=6:e--);var g=Date.UTC(b.getFullYear(),0,1),i=Date.UTC(b.getFullYear(),b.getMonth(),b.getDate());return Math.floor((Math.floor((i-g)/864E5)+7-e)/7)}function A(b){var a=b%10;b%=100;if(b>=11&&b<=13||a===0||a>=4)return"th";switch(a){case 1:return"st";
+case 2:return"nd";case 3:return"rd"}}var x={days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{D:"%m/%d/%y",F:"%Y-%m-%d",R:"%H:%M",T:"%H:%M:%S",X:"%T",c:"%a %b %d %X %Y",r:"%I:%M:%S %p",
+v:"%e-%b-%Y",x:"%D"}},i=new p(x,0,!1),y=typeof module!=="undefined",j;y?(j=module.exports=r,j.strftime=u):(j=function(){return this||(0,eval)("this")}(),j.strftime=r);var g=y?"require('strftime')":"strftime",s={};j.strftimeTZ=function(b,a,e,j){if((typeof e=="number"||typeof e=="string")&&j==null)j=e,e=void 0;e?k("`"+g+".strftimeTZ(format, date, locale, tz)`","var s = "+g+".localize(locale).timezone(tz); s(format, [date])` or `var s = "+g+".localize(locale); s.timezone(tz)(format, [date])"):k("`"+
+g+".strftimeTZ(format, date, tz)`","var s = "+g+".timezone(tz); s(format, [date])` or `"+g+".timezone(tz)(format, [date])");return(e?i.localize(e):i).timezone(j)(b,a)};j.strftimeUTC=function(b,a,e){e?k("`"+g+".strftimeUTC(format, date, locale)`","var s = "+g+".localize(locale).utc(); s(format, [date])"):k("`"+g+".strftimeUTC(format, [date])`","var s = "+g+".utc(); s(format, [date])");return(e?z.localize(e):z)(b,a)};j.localizedStrftime=function(b){k("`"+g+".localizedStrftime(locale)`",g+".localize(locale)");
+return i.localize(b)};t(r);t(u);var z=i.utc();if(typeof Date.now!=="function")Date.now=function(){return+new Date}})();
+!function(){"use strict";var strptime=function(str,format,local){return strptime.parse(str,format,local)};strptime.version="0.0.1";var namespace;if(typeof module!=="undefined"){namespace=module.exports=strptime}else{namespace=function(){return this||(1,eval)("this")}()}namespace.strptime=strptime;!function(strptime){strptime.locale={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],f:["Jan.","Feb.","Mar.","Apr.","May","Jun.","Jul.","Aug.","Sep.","Oct.","Nov.","Dec."],c:"%Y-%m-%d %H:%M:%S",P:["am","pm"],r:"%I:%M:%S %p",x:"%m/%d/%y",X:"%H:%M:%S",day:["Yesterday","Today","Tomorrow"],bg:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Bg:["January","February","March","April","May","June","July","August","September","October","November","December"],fg:["Jan.","Feb.","Mar.","Apr.","May","Jun.","Jul.","Aug.","Sep.","Oct.","Nov.","Dec."],Date_dBY_year_in_HM:"%#B %-d, %Y at %-H:%M",Date_dBY_year:"%#B %-d, %Y",Date_dBY:"%#B %-d, %Y",Date_AdBY:"%A, %#B %-d, %Y",Date_dBA:"%#B %-d, %A",Date_df_in_HM:"%#f, %-d at %-H:%M",Date_dfY:"%-d %#f %Y",Date_dB_in_HM:"%#B %-d at %-H:%M",Date_df:"%-d %#f"}}(strptime);!function(strptime){var inArray=Array.prototype.indexOf||function(el){var l=this.length;var i=0;while(i<l){if(el==this[i]){return i}i++}return-1};var locale=strptime.locale;var strRegNum2="[\\d\\s]?\\d";var strRegStr="\\S+";var specifiers={"%":"\\%",a:strRegStr,A:strRegStr,b:{reg:strRegStr,make:function(date,data,mod,gen){data=inArray.call(gen?locale.bg:locale.b,toLetterCaseReverse(data,mod));if(data===-1){return false}date.setUTCMonth(data);return true}},h:{reg:strRegStr,make:function(date,data,mod,gen){data=inArray.call(gen?locale.bg:locale.b,toLetterCaseReverse(data,mod));if(data===-1){return false}date.setUTCMonth(data);return true}},B:{reg:strRegStr,make:function(date,data,mod,gen){data=inArray.call(gen?locale.Bg:locale.B,toLetterCaseReverse(data,mod));if(data===-1){return false}date.setUTCMonth(data);return true}},f:{reg:strRegStr,make:function(date,data,mod,gen){data=inArray.call(gen?locale.fg:locale.f,toLetterCaseReverse(data,mod));if(data===-1){return false}date.setUTCMonth(data);return true}},g:{reg:strRegNum2,make:function(date,data){data=parseInt(data,10);if(data<0||data>99){return false}data=data+100*parseInt((new Date).getUTCFullYear()/100,10);date.setUTCFullYear(data);return true}},G:{reg:"\\d{4}",make:function(date,data){data=parseInt(data,10);date.setUTCFullYear(data);return true}},d:{reg:strRegNum2,make:function(date,data){data=parseInt(data,10);if(data<1||data>31){return false}date.setUTCDate(data);return true}},e:{reg:strRegNum2,make:function(date,data){data=parseInt(data,10);if(data<1||data>31){return false}date.setUTCDate(data);return true}},H:{reg:strRegNum2,make:function(date,data){data=parseInt(data,10);if(data<0||data>23){return false}date.setUTCHours(data);return true}},I:{reg:strRegNum2,make:function(date,data){data=parseInt(data,10);if(data<1||data>12){return false}date.setUTCHours(date.getUTCHours()+data);return true}},m:{reg:strRegNum2,make:function(date,data){data=parseInt(data,10);if(data<1||data>12){return false}date.setUTCMonth(data-1);return true}},M:{reg:strRegNum2,make:function(date,data){data=parseInt(data,10);if(data<0||data>59){return false}date.setUTCMinutes(data);return true}},n:"\\n",p:{reg:strRegStr,make:function(date,data){data=inArray.call(locale.P,data.toLowerCase());if(data===-1){return false}if(data===1){date.setUTCHours(date.getUTCHours()+12)}return true}},P:{reg:strRegStr,make:function(date,data){data=inArray.call(locale.P,data.toLowerCase());if(data===-1){return false}if(data===1){date.setUTCHours(date.getUTCHours()+12)}return true}},S:{reg:strRegNum2,make:function(date,data){data=parseInt(data,10);if(data<0||data>60){return false}date.setUTCSeconds(data);return true}},t:"\\t",u:"\\d",U:strRegNum2,w:"\\d",W:strRegNum2,y:{reg:strRegNum2,make:function(date,data){data=parseInt(data,10);if(data<0||data>99){return false}data=data+100*parseInt((new Date).getUTCFullYear()/100,10);date.setUTCFullYear(data);return true}},Y:{reg:"\\d{4}",make:function(date,data){data=parseInt(data,10);date.setUTCFullYear(data);return true}},z:{reg:"[+\\-]\\d{4}",make:function(date,data){var m=data.match(/^([+\-])(\d{2})(\d{2})$/);if(!m){return false}var offset=(parseInt(m[2],10)*60+parseInt(m[3],10))*6e4;if(m[1]==="+"){offset=-offset}date.setTime(date.getTime()+offset);return true}},l:{reg:strRegNum2,make:function(date,data){data=parseInt(data,10);if(data<1||data>12){return false}date.setUTCHours(date.getUTCHours()+data);return true}},s:{reg:"\\d+",make:function(date,data){data=parseInt(data,10);date.setTime(data*1e3);return true}},c:locale.c,r:locale.r,R:"%H:%M",T:"%H:%M:%S",x:locale.x,X:locale.X,D:"%m/%d/%y",F:"%Y-%m-%d",Date_iso:"%Y-%m-%dT%H:%M:%S",Date_dBY_year_in_HM:locale.Date_dBY_year_in_HM,Date_dBY_year:locale.Date_dBY_year,Date_dBY:locale.Date_dBY,Date_dBA:locale.Date_dBA,Date_AdBY:locale.Date_AdBY,Date_df_in_HM:locale.Date_df_in_HM,Date_dfY:locale.Date_dfY,Date_dB_in_HM:locale.Date_dB_in_HM,Date_dmY__dot:"%d.%m.%Y",Date_df:locale.Date_df,Date_FT:"%F %T",Date_dmY__minus:"%d-%m-%Y"};strptime.parse=function(str,format,local){str=String(str);format=String(format);var loop=5;while(/%(Date_[a-zA-Z0-9_]+|[cDFrRTxX])/g.test(format)&&loop){format=format.replace(/%(Date_[a-zA-Z0-9_]+|[cDFrRTxX])/,formatTransform);loop--}formatTransform.make=[];var reg=format.replace(/%(([#\^!~]{0,2})[aAbBfh]|([0\-_]?)[degHImMSVWyl]|[GnpPtuUwYzZs%])/g,formatTransform);var match=str.match(new RegExp(reg));if(!match||!formatTransform.make.length){return null}var date=new Date(Date.UTC(0,0));for(var i=0,l=formatTransform.make.length;i<l;i++){var build=formatTransform.make[i];if(!build[0](date,match[i+1],build[1],build[2])){return null}}if(local){date.setTime(date.getTime()+date.getTimezoneOffset()*6e4)}return date};function formatTransform(_,spec,mod,numPad,pos,str){spec=String(spec);mod=String(mod);spec=spec.replace(/^[#_0\^\-!~]+/,"");var s=specifiers[spec];if(!s){return _}var genitive=false;if(mod.indexOf("!")===-1&&spec.length===1&&(mod.indexOf("~")>-1||"bBf".indexOf(spec)>-1&&/%[0\-_]?d[\s]+$/.test(str.substr(0,pos)))){genitive=true}if((spec==="I"||spec==="l")&&!/%[pP]/.test(str)){throw new Error("Undefined AM/PM")}switch(typeof s){case"function":return s();case"string":return s;case"object":formatTransform.make.push([s.make,mod,genitive]);return"("+s.reg+")";default:return _}}function toLetterCaseReverse(str,mode){str=String(str);mode=String(mode);if(mode.indexOf("#")!==-1){return str.substr(0,1).toUpperCase()+str.substr(1)}if(mode.indexOf("^")!==-1){return str.substr(0,1)+str.substr(1).toLowerCase()}return str}}(strptime)}();(function(){var COMPILED=!0,goog=goog||{};goog.global=this;goog.exportPath_=function(a,b,c){a=a.split(".");c=c||goog.global;a[0]in c||!c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)a.length||void 0===b?c=c[d]?c[d]:c[d]={}:c[d]=b};goog.define=function(a,b){var c=b;COMPILED||goog.global.CLOSURE_DEFINES&&Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES,a)&&(c=goog.global.CLOSURE_DEFINES[a]);goog.exportPath_(a,c)};goog.DEBUG=!1;goog.LOCALE="en";goog.TRUSTED_SITE=!0;
+goog.provide=function(a){if(!COMPILED){if(goog.isProvided_(a))throw Error('Namespace "'+a+'" already declared.');delete goog.implicitNamespaces_[a];for(var b=a;(b=b.substring(0,b.lastIndexOf(".")))&&!goog.getObjectByName(b);)goog.implicitNamespaces_[b]=!0}goog.exportPath_(a)};goog.setTestOnly=function(a){if(COMPILED&&!goog.DEBUG)throw a=a||"",Error("Importing test-only code into non-debug environment"+a?": "+a:".");};
+COMPILED||(goog.isProvided_=function(a){return!goog.implicitNamespaces_[a]&&!!goog.getObjectByName(a)},goog.implicitNamespaces_={});goog.getObjectByName=function(a,b){for(var c=a.split("."),d=b||goog.global,e;e=c.shift();)if(goog.isDefAndNotNull(d[e]))d=d[e];else return null;return d};goog.globalize=function(a,b){var c=b||goog.global,d;for(d in a)c[d]=a[d]};
+goog.addDependency=function(a,b,c){if(goog.DEPENDENCIES_ENABLED){var d;a=a.replace(/\\/g,"/");for(var e=goog.dependencies_,f=0;d=b[f];f++)e.nameToPath[d]=a,a in e.pathToNames||(e.pathToNames[a]={}),e.pathToNames[a][d]=!0;for(d=0;b=c[d];d++)a in e.requires||(e.requires[a]={}),e.requires[a][b]=!0}};goog.ENABLE_DEBUG_LOADER=!0;
+goog.require=function(a){if(!COMPILED&&!goog.isProvided_(a)){if(goog.ENABLE_DEBUG_LOADER){var b=goog.getPathFromDeps_(a);if(b){goog.included_[b]=!0;goog.writeScripts_();return}}a="goog.require could not find: "+a;goog.global.console&&goog.global.console.error(a);throw Error(a);}};goog.basePath="";goog.nullFunction=function(){};goog.identityFunction=function(a,b){return a};goog.abstractMethod=function(){throw Error("unimplemented abstract method");};
+goog.addSingletonGetter=function(a){a.getInstance=function(){if(a.instance_)return a.instance_;goog.DEBUG&&(goog.instantiatedSingletons_[goog.instantiatedSingletons_.length]=a);return a.instance_=new a}};goog.instantiatedSingletons_=[];goog.DEPENDENCIES_ENABLED=!COMPILED&&goog.ENABLE_DEBUG_LOADER;
+goog.DEPENDENCIES_ENABLED&&(goog.included_={},goog.dependencies_={pathToNames:{},nameToPath:{},requires:{},visited:{},written:{}},goog.inHtmlDocument_=function(){var a=goog.global.document;return"undefined"!=typeof a&&"write"in a},goog.findBasePath_=function(){if(goog.global.CLOSURE_BASE_PATH)goog.basePath=goog.global.CLOSURE_BASE_PATH;else if(goog.inHtmlDocument_())for(var a=goog.global.document.getElementsByTagName("script"),b=a.length-1;0<=b;--b){var c=a[b].src,d=c.lastIndexOf("?"),d=-1==d?c.length:
+d;if("base.js"==c.substr(d-7,7)){goog.basePath=c.substr(0,d-7);break}}},goog.importScript_=function(a){var b=goog.global.CLOSURE_IMPORT_SCRIPT||goog.writeScriptTag_;!goog.dependencies_.written[a]&&b(a)&&(goog.dependencies_.written[a]=!0)},goog.writeScriptTag_=function(a){if(goog.inHtmlDocument_()){var b=goog.global.document;if("complete"==b.readyState){if(/\bdeps.js$/.test(a))return!1;throw Error('Cannot write "'+a+'" after document load');}b.write('<script type="text/javascript" src="'+a+'">\x3c/script>');
+return!0}return!1},goog.writeScripts_=function(){function a(e){if(!(e in d.written)){if(!(e in d.visited)&&(d.visited[e]=!0,e in d.requires))for(var g in d.requires[e])if(!goog.isProvided_(g))if(g in d.nameToPath)a(d.nameToPath[g]);else throw Error("Undefined nameToPath for "+g);e in c||(c[e]=!0,b.push(e))}}var b=[],c={},d=goog.dependencies_,e;for(e in goog.included_)d.written[e]||a(e);for(e=0;e<b.length;e++)if(b[e])goog.importScript_(goog.basePath+b[e]);else throw Error("Undefined script input");
+},goog.getPathFromDeps_=function(a){return a in goog.dependencies_.nameToPath?goog.dependencies_.nameToPath[a]:null},goog.findBasePath_(),goog.global.CLOSURE_NO_DEPS||goog.importScript_(goog.basePath+"deps.js"));
+goog.typeOf=function(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};goog.isDef=function(a){return void 0!==a};goog.isNull=function(a){return null===a};goog.isDefAndNotNull=function(a){return null!=a};goog.isArray=function(a){return"array"==goog.typeOf(a)};goog.isArrayLike=function(a){var b=goog.typeOf(a);return"array"==b||"object"==b&&"number"==typeof a.length};goog.isDateLike=function(a){return goog.isObject(a)&&"function"==typeof a.getFullYear};goog.isString=function(a){return"string"==typeof a};
+goog.isBoolean=function(a){return"boolean"==typeof a};goog.isNumber=function(a){return"number"==typeof a};goog.isFunction=function(a){return"function"==goog.typeOf(a)};goog.isObject=function(a){var b=typeof a;return"object"==b&&null!=a||"function"==b};goog.getUid=function(a){return a[goog.UID_PROPERTY_]||(a[goog.UID_PROPERTY_]=++goog.uidCounter_)};goog.removeUid=function(a){"removeAttribute"in a&&a.removeAttribute(goog.UID_PROPERTY_);try{delete a[goog.UID_PROPERTY_]}catch(b){}};
+goog.UID_PROPERTY_="closure_uid_"+(1E9*Math.random()>>>0);goog.uidCounter_=0;goog.getHashCode=goog.getUid;goog.removeHashCode=goog.removeUid;goog.cloneObject=function(a){var b=goog.typeOf(a);if("object"==b||"array"==b){if(a.clone)return a.clone();var b="array"==b?[]:{},c;for(c in a)b[c]=goog.cloneObject(a[c]);return b}return a};goog.bindNative_=function(a,b,c){return a.call.apply(a.bind,arguments)};
+goog.bindJs_=function(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)}};goog.bind=function(a,b,c){Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?goog.bind=goog.bindNative_:goog.bind=goog.bindJs_;return goog.bind.apply(null,arguments)};
+goog.partial=function(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=Array.prototype.slice.call(arguments);b.unshift.apply(b,c);return a.apply(this,b)}};goog.mixin=function(a,b){for(var c in b)a[c]=b[c]};goog.now=goog.TRUSTED_SITE&&Date.now||function(){return+new Date};
+goog.globalEval=function(a){if(goog.global.execScript)goog.global.execScript(a,"JavaScript");else if(goog.global.eval)if(null==goog.evalWorksForGlobals_&&(goog.global.eval("var _et_ = 1;"),"undefined"!=typeof goog.global._et_?(delete goog.global._et_,goog.evalWorksForGlobals_=!0):goog.evalWorksForGlobals_=!1),goog.evalWorksForGlobals_)goog.global.eval(a);else{var b=goog.global.document,c=b.createElement("script");c.type="text/javascript";c.defer=!1;c.appendChild(b.createTextNode(a));b.body.appendChild(c);
+b.body.removeChild(c)}else throw Error("goog.globalEval not available");};goog.evalWorksForGlobals_=null;goog.getCssName=function(a,b){var c=function(a){return goog.cssNameMapping_[a]||a},d=function(a){a=a.split("-");for(var b=[],d=0;d<a.length;d++)b.push(c(a[d]));return b.join("-")},d=goog.cssNameMapping_?"BY_WHOLE"==goog.cssNameMappingStyle_?c:d:function(a){return a};return b?a+"-"+d(b):d(a)};goog.setCssNameMapping=function(a,b){goog.cssNameMapping_=a;goog.cssNameMappingStyle_=b};
+!COMPILED&&goog.global.CLOSURE_CSS_NAME_MAPPING&&(goog.cssNameMapping_=goog.global.CLOSURE_CSS_NAME_MAPPING);goog.getMsg=function(a,b){var c=b||{},d;for(d in c){var e=(""+c[d]).replace(/\$/g,"$$$$");a=a.replace(RegExp("\\{\\$"+d+"\\}","gi"),e)}return a};goog.getMsgWithFallback=function(a,b){return a};goog.exportSymbol=function(a,b,c){goog.exportPath_(a,b,c)};goog.exportProperty=function(a,b,c){a[b]=c};
+goog.inherits=function(a,b){function c(){}c.prototype=b.prototype;a.superClass_=b.prototype;a.prototype=new c;a.prototype.constructor=a};
+goog.base=function(a,b,c){var d=arguments.callee.caller;if(goog.DEBUG&&!d)throw Error("arguments.caller not defined. goog.base() expects not to be running in strict mode. See http://www.ecma-international.org/ecma-262/5.1/#sec-C");if(d.superClass_)return d.superClass_.constructor.apply(a,Array.prototype.slice.call(arguments,1));for(var e=Array.prototype.slice.call(arguments,2),f=!1,g=a.constructor;g;g=g.superClass_&&g.superClass_.constructor)if(g.prototype[b]===d)f=!0;else if(f)return g.prototype[b].apply(a,
+e);if(a[b]===d)return a.constructor.prototype[b].apply(a,e);throw Error("goog.base called from a method of one name to a method of a different name");};goog.scope=function(a){a.call(goog.global)};goog.string={};goog.string.Unicode={NBSP:"\u00a0"};goog.string.startsWith=function(a,b){return 0==a.lastIndexOf(b,0)};goog.string.endsWith=function(a,b){var c=a.length-b.length;return 0<=c&&a.indexOf(b,c)==c};goog.string.caseInsensitiveStartsWith=function(a,b){return 0==goog.string.caseInsensitiveCompare(b,a.substr(0,b.length))};goog.string.caseInsensitiveEndsWith=function(a,b){return 0==goog.string.caseInsensitiveCompare(b,a.substr(a.length-b.length,b.length))};
+goog.string.caseInsensitiveEquals=function(a,b){return a.toLowerCase()==b.toLowerCase()};goog.string.subs=function(a,b){for(var c=a.split("%s"),d="",e=Array.prototype.slice.call(arguments,1);e.length&&1<c.length;)d+=c.shift()+e.shift();return d+c.join("%s")};goog.string.collapseWhitespace=function(a){return a.replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,"")};goog.string.isEmpty=function(a){return/^[\s\xa0]*$/.test(a)};goog.string.isEmptySafe=function(a){return goog.string.isEmpty(goog.string.makeSafe(a))};
+goog.string.isBreakingWhitespace=function(a){return!/[^\t\n\r ]/.test(a)};goog.string.isAlpha=function(a){return!/[^a-zA-Z]/.test(a)};goog.string.isNumeric=function(a){return!/[^0-9]/.test(a)};goog.string.isAlphaNumeric=function(a){return!/[^a-zA-Z0-9]/.test(a)};goog.string.isSpace=function(a){return" "==a};goog.string.isUnicodeChar=function(a){return 1==a.length&&" "<=a&&"~">=a||"\u0080"<=a&&"\ufffd">=a};goog.string.stripNewlines=function(a){return a.replace(/(\r\n|\r|\n)+/g," ")};
+goog.string.canonicalizeNewlines=function(a){return a.replace(/(\r\n|\r|\n)/g,"\n")};goog.string.normalizeWhitespace=function(a){return a.replace(/\xa0|\s/g," ")};goog.string.normalizeSpaces=function(a){return a.replace(/\xa0|[ \t]+/g," ")};goog.string.collapseBreakingSpaces=function(a){return a.replace(/[\t\r\n ]+/g," ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g,"")};goog.string.trim=function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")};
+goog.string.trimLeft=function(a){return a.replace(/^[\s\xa0]+/,"")};goog.string.trimRight=function(a){return a.replace(/[\s\xa0]+$/,"")};goog.string.caseInsensitiveCompare=function(a,b){var c=String(a).toLowerCase(),d=String(b).toLowerCase();return c<d?-1:c==d?0:1};goog.string.numerateCompareRegExp_=/(\.\d+)|(\d+)|(\D+)/g;
+goog.string.numerateCompare=function(a,b){if(a==b)return 0;if(!a)return-1;if(!b)return 1;for(var c=a.toLowerCase().match(goog.string.numerateCompareRegExp_),d=b.toLowerCase().match(goog.string.numerateCompareRegExp_),e=Math.min(c.length,d.length),f=0;f<e;f++){var g=c[f],h=d[f];if(g!=h)return c=parseInt(g,10),!isNaN(c)&&(d=parseInt(h,10),!isNaN(d)&&c-d)?c-d:g<h?-1:1}return c.length!=d.length?c.length-d.length:a<b?-1:1};goog.string.urlEncode=function(a){return encodeURIComponent(String(a))};
+goog.string.urlDecode=function(a){return decodeURIComponent(a.replace(/\+/g," "))};goog.string.newLineToBr=function(a,b){return a.replace(/(\r\n|\r|\n)/g,b?"<br />":"<br>")};
+goog.string.htmlEscape=function(a,b){if(b)return a.replace(goog.string.amperRe_,"&amp;").replace(goog.string.ltRe_,"&lt;").replace(goog.string.gtRe_,"&gt;").replace(goog.string.quotRe_,"&quot;");if(!goog.string.allRe_.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(goog.string.amperRe_,"&amp;"));-1!=a.indexOf("<")&&(a=a.replace(goog.string.ltRe_,"&lt;"));-1!=a.indexOf(">")&&(a=a.replace(goog.string.gtRe_,"&gt;"));-1!=a.indexOf('"')&&(a=a.replace(goog.string.quotRe_,"&quot;"));return a};
+goog.string.amperRe_=/&/g;goog.string.ltRe_=/</g;goog.string.gtRe_=/>/g;goog.string.quotRe_=/\"/g;goog.string.allRe_=/[&<>\"]/;goog.string.unescapeEntities=function(a){return goog.string.contains(a,"&")?"document"in goog.global?goog.string.unescapeEntitiesUsingDom_(a):goog.string.unescapePureXmlEntities_(a):a};
+goog.string.unescapeEntitiesUsingDom_=function(a){var b={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"'},c=document.createElement("div");return a.replace(goog.string.HTML_ENTITY_PATTERN_,function(a,e){var f=b[a];if(f)return f;if("#"==e.charAt(0)){var g=Number("0"+e.substr(1));isNaN(g)||(f=String.fromCharCode(g))}f||(c.innerHTML=a+" ",f=c.firstChild.nodeValue.slice(0,-1));return b[a]=f})};
+goog.string.unescapePureXmlEntities_=function(a){return a.replace(/&([^;]+);/g,function(a,c){switch(c){case "amp":return"&";case "lt":return"<";case "gt":return">";case "quot":return'"';default:if("#"==c.charAt(0)){var d=Number("0"+c.substr(1));if(!isNaN(d))return String.fromCharCode(d)}return a}})};goog.string.HTML_ENTITY_PATTERN_=/&([^;\s<&]+);?/g;goog.string.whitespaceEscape=function(a,b){return goog.string.newLineToBr(a.replace(/ /g," &#160;"),b)};
+goog.string.stripQuotes=function(a,b){for(var c=b.length,d=0;d<c;d++){var e=1==c?b:b.charAt(d);if(a.charAt(0)==e&&a.charAt(a.length-1)==e)return a.substring(1,a.length-1)}return a};goog.string.truncate=function(a,b,c){c&&(a=goog.string.unescapeEntities(a));a.length>b&&(a=a.substring(0,b-3)+"...");c&&(a=goog.string.htmlEscape(a));return a};
+goog.string.truncateMiddle=function(a,b,c,d){c&&(a=goog.string.unescapeEntities(a));if(d&&a.length>b){d>b&&(d=b);var e=a.length-d;a=a.substring(0,b-d)+"..."+a.substring(e)}else a.length>b&&(d=Math.floor(b/2),e=a.length-d,a=a.substring(0,d+b%2)+"..."+a.substring(e));c&&(a=goog.string.htmlEscape(a));return a};goog.string.specialEscapeChars_={"\x00":"\\0","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\x0B",'"':'\\"',"\\":"\\\\"};goog.string.jsEscapeCache_={"'":"\\'"};
+goog.string.quote=function(a){a=String(a);if(a.quote)return a.quote();for(var b=['"'],c=0;c<a.length;c++){var d=a.charAt(c),e=d.charCodeAt(0);b[c+1]=goog.string.specialEscapeChars_[d]||(31<e&&127>e?d:goog.string.escapeChar(d))}b.push('"');return b.join("")};goog.string.escapeString=function(a){for(var b=[],c=0;c<a.length;c++)b[c]=goog.string.escapeChar(a.charAt(c));return b.join("")};
+goog.string.escapeChar=function(a){if(a in goog.string.jsEscapeCache_)return goog.string.jsEscapeCache_[a];if(a in goog.string.specialEscapeChars_)return goog.string.jsEscapeCache_[a]=goog.string.specialEscapeChars_[a];var b=a,c=a.charCodeAt(0);if(31<c&&127>c)b=a;else{if(256>c){if(b="\\x",16>c||256<c)b+="0"}else b="\\u",4096>c&&(b+="0");b+=c.toString(16).toUpperCase()}return goog.string.jsEscapeCache_[a]=b};goog.string.toMap=function(a){for(var b={},c=0;c<a.length;c++)b[a.charAt(c)]=!0;return b};
+goog.string.contains=function(a,b){return-1!=a.indexOf(b)};goog.string.countOf=function(a,b){return a&&b?a.split(b).length-1:0};goog.string.removeAt=function(a,b,c){var d=a;0<=b&&(b<a.length&&0<c)&&(d=a.substr(0,b)+a.substr(b+c,a.length-b-c));return d};goog.string.remove=function(a,b){var c=RegExp(goog.string.regExpEscape(b),"");return a.replace(c,"")};goog.string.removeAll=function(a,b){var c=RegExp(goog.string.regExpEscape(b),"g");return a.replace(c,"")};
+goog.string.regExpEscape=function(a){return String(a).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08")};goog.string.repeat=function(a,b){return Array(b+1).join(a)};goog.string.padNumber=function(a,b,c){a=goog.isDef(c)?a.toFixed(c):String(a);c=a.indexOf(".");-1==c&&(c=a.length);return goog.string.repeat("0",Math.max(0,b-c))+a};goog.string.makeSafe=function(a){return null==a?"":String(a)};goog.string.buildString=function(a){return Array.prototype.join.call(arguments,"")};
+goog.string.getRandomString=function(){return Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^goog.now()).toString(36)};
+goog.string.compareVersions=function(a,b){for(var c=0,d=goog.string.trim(String(a)).split("."),e=goog.string.trim(String(b)).split("."),f=Math.max(d.length,e.length),g=0;0==c&&g<f;g++){var h=d[g]||"",k=e[g]||"",l=RegExp("(\\d*)(\\D*)","g"),m=RegExp("(\\d*)(\\D*)","g");do{var p=l.exec(h)||["","",""],n=m.exec(k)||["","",""];if(0==p[0].length&&0==n[0].length)break;var c=0==p[1].length?0:parseInt(p[1],10),r=0==n[1].length?0:parseInt(n[1],10),c=goog.string.compareElements_(c,r)||goog.string.compareElements_(0==
+p[2].length,0==n[2].length)||goog.string.compareElements_(p[2],n[2])}while(0==c)}return c};goog.string.compareElements_=function(a,b){return a<b?-1:a>b?1:0};goog.string.HASHCODE_MAX_=4294967296;goog.string.hashCode=function(a){for(var b=0,c=0;c<a.length;++c)b=31*b+a.charCodeAt(c),b%=goog.string.HASHCODE_MAX_;return b};goog.string.uniqueStringCounter_=2147483648*Math.random()|0;goog.string.createUniqueString=function(){return"goog_"+goog.string.uniqueStringCounter_++};
+goog.string.toNumber=function(a){var b=Number(a);return 0==b&&goog.string.isEmpty(a)?NaN:b};goog.string.isLowerCamelCase=function(a){return/^[a-z]+([A-Z][a-z]*)*$/.test(a)};goog.string.isUpperCamelCase=function(a){return/^([A-Z][a-z]*)+$/.test(a)};goog.string.toCamelCase=function(a){return String(a).replace(/\-([a-z])/g,function(a,c){return c.toUpperCase()})};goog.string.toSelectorCase=function(a){return String(a).replace(/([A-Z])/g,"-$1").toLowerCase()};
+goog.string.toTitleCase=function(a,b){var c=goog.isString(b)?goog.string.regExpEscape(b):"\\s";return a.replace(RegExp("(^"+(c?"|["+c+"]+":"")+")([a-z])","g"),function(a,b,c){return b+c.toUpperCase()})};goog.string.parseInt=function(a){isFinite(a)&&(a=String(a));return goog.isString(a)?/^\s*-?0x/i.test(a)?parseInt(a,16):parseInt(a,10):NaN};goog.string.splitLimit=function(a,b,c){a=a.split(b);for(var d=[];0<c&&a.length;)d.push(a.shift()),c--;a.length&&d.push(a.join(b));return d};goog.debug={};goog.debug.Error=function(a){Error.captureStackTrace?Error.captureStackTrace(this,goog.debug.Error):this.stack=Error().stack||"";a&&(this.message=String(a))};goog.inherits(goog.debug.Error,Error);goog.debug.Error.prototype.name="CustomError";goog.asserts={};goog.asserts.ENABLE_ASSERTS=goog.DEBUG;goog.asserts.AssertionError=function(a,b){b.unshift(a);goog.debug.Error.call(this,goog.string.subs.apply(null,b));b.shift();this.messagePattern=a};goog.inherits(goog.asserts.AssertionError,goog.debug.Error);goog.asserts.AssertionError.prototype.name="AssertionError";goog.asserts.doAssertFailure_=function(a,b,c,d){var e="Assertion failed";if(c)var e=e+(": "+c),f=d;else a&&(e+=": "+a,f=b);throw new goog.asserts.AssertionError(""+e,f||[]);};
+goog.asserts.assert=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!a&&goog.asserts.doAssertFailure_("",null,b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.fail=function(a,b){if(goog.asserts.ENABLE_ASSERTS)throw new goog.asserts.AssertionError("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));};
+goog.asserts.assertNumber=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isNumber(a)&&goog.asserts.doAssertFailure_("Expected number but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.assertString=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isString(a)&&goog.asserts.doAssertFailure_("Expected string but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};
+goog.asserts.assertFunction=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isFunction(a)&&goog.asserts.doAssertFailure_("Expected function but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.assertObject=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isObject(a)&&goog.asserts.doAssertFailure_("Expected object but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};
+goog.asserts.assertArray=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isArray(a)&&goog.asserts.doAssertFailure_("Expected array but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.assertBoolean=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isBoolean(a)&&goog.asserts.doAssertFailure_("Expected boolean but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};
+goog.asserts.assertInstanceof=function(a,b,c,d){!goog.asserts.ENABLE_ASSERTS||a instanceof b||goog.asserts.doAssertFailure_("instanceof check failed.",null,c,Array.prototype.slice.call(arguments,3));return a};goog.asserts.assertObjectPrototypeIsIntact=function(){for(var a in Object.prototype)goog.asserts.fail(a+" should not be enumerable in Object.prototype.")};(function(a){var b,c,d;(function(){var a={},f={};b=function(b,c,d){a[b]={deps:c,callback:d}};d=c=function(b){function h(a){if("."!==a.charAt(0))return a;a=a.split("/");for(var c=b.split("/").slice(0,-1),d=0,e=a.length;d<e;d++){var f=a[d];".."===f?c.pop():"."!==f&&c.push(f)}return c.join("/")}d._eak_seen=a;if(f[b])return f[b];f[b]={};if(!a[b])throw Error("Could not find module "+b);for(var k=a[b],l=k.deps,k=k.callback,m=[],p,n=0,r=l.length;n<r;n++)"exports"===l[n]?m.push(p={}):m.push(c(h(l[n])));l=
+k.apply(this,m);return f[b]=p||l}})();b("promise/all",["./utils","exports"],function(a,b){var c=a.isArray,d=a.isFunction;b.all=function(a){if(!c(a))throw new TypeError("You must pass an array to all.");return new this(function(b,c){function e(a){return function(c){f[a]=c;0===--g&&b(f)}}var f=[],g=a.length,q;0===g&&b([]);for(var t=0;t<a.length;t++)(q=a[t])&&d(q.then)?q.then(e(t),c):(f[t]=q,0===--g&&b(f))})}});b("promise/asap",["exports"],function(a){function b(){return function(){process.nextTick(d)}}
+function c(){return function(){k.setTimeout(d,1)}}function d(){for(var a=0;a<l.length;a++){var b=l[a];(0,b[0])(b[1])}l=[]}var k="undefined"!==typeof global?global:void 0===this?window:this,l=[],m;m="undefined"!==typeof process&&"[object process]"==={}.toString.call(process)?b():c();a.asap=function(a,b){1===l.push([a,b])&&m()}});b("promise/config",["exports"],function(a){var b={instrument:!1};a.config=b;a.configure=function(a,c){if(2===arguments.length)b[a]=c;else return b[a]}});b("promise/polyfill",
+["./promise","./utils","exports"],function(b,c,d){var h=b.Promise,k=c.isFunction;d.polyfill=function(){var b;b="undefined"!==typeof global?global:"undefined"!==typeof window&&window.document?window:a;"Promise"in b&&"resolve"in b.Promise&&"reject"in b.Promise&&"all"in b.Promise&&"race"in b.Promise&&function(){var a;new b.Promise(function(b){a=b});return k(a)}()||(b.Promise=h)}});b("promise/promise","./config ./utils ./all ./race ./resolve ./reject ./asap exports".split(" "),function(a,b,c,d,k,l,m,
+p){function n(a){if(!C(a))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof n))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[];r(a,this)}function r(a,b){function c(a){z(b,a)}function d(a){w(b,a)}try{a(c,d)}catch(e){d(e)}}function q(a,b,c,d){var e=C(c),f,g,h,k;if(e)try{f=c(d),h=!0}catch(l){k=!0,g=l}else f=d,h=
+!0;v(b,f)||(e&&h?z(b,f):k?w(b,g):a===A?z(b,f):a===B&&w(b,f))}function t(a,b,c,d){a=a._subscribers;var e=a.length;a[e]=b;a[e+A]=c;a[e+B]=d}function y(a,b){for(var c,d,e=a._subscribers,f=a._detail,g=0;g<e.length;g+=3)c=e[g],d=e[g+b],q(b,c,d,f);a._subscribers=null}function v(a,b){var c=null,d;try{if(a===b)throw new TypeError("A promises callback cannot return that same promise.");if(K(b)&&(c=b.then,C(c)))return c.call(b,function(c){if(d)return!0;d=!0;b!==c?z(a,c):F(a,c)},function(b){if(d)return!0;d=
+!0;w(a,b)}),!0}catch(e){if(d)return!0;w(a,e);return!0}return!1}function z(a,b){a===b?F(a,b):v(a,b)||F(a,b)}function F(a,b){a._state===D&&(a._state=u,a._detail=b,s.async(E,a))}function w(a,b){a._state===D&&(a._state=u,a._detail=b,s.async(x,a))}function E(a){y(a,a._state=A)}function x(a){y(a,a._state=B)}var s=a.config,K=b.objectOrFunction,C=b.isFunction;a=c.all;d=d.race;k=k.resolve;l=l.reject;s.async=m.asap;var D=void 0,u=0,A=1,B=2;n.prototype={constructor:n,_state:void 0,_detail:void 0,_subscribers:void 0,
+then:function(a,b){var c=this,d=new this.constructor(function(){});if(this._state){var e=arguments;s.async(function(){q(c._state,d,e[c._state-1],c._detail)})}else t(this,d,a,b);return d},"catch":function(a){return this.then(null,a)}};n.all=a;n.race=d;n.resolve=k;n.reject=l;p.Promise=n});b("promise/race",["./utils","exports"],function(a,b){var c=a.isArray;b.race=function(a){if(!c(a))throw new TypeError("You must pass an array to race.");return new this(function(b,c){for(var d,e=0;e<a.length;e++)(d=
+a[e])&&"function"===typeof d.then?d.then(b,c):b(d)})}});b("promise/reject",["exports"],function(a){a.reject=function(a){return new this(function(b,c){c(a)})}});b("promise/resolve",["exports"],function(a){a.resolve=function(a){return a&&"object"===typeof a&&a.constructor===this?a:new this(function(b){b(a)})}});b("promise/utils",["exports"],function(a){function b(a){return"function"===typeof a}var c=Date.now||function(){return(new Date).getTime()};a.objectOrFunction=function(a){return b(a)||"object"===
+typeof a&&null!==a};a.isFunction=b;a.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)};a.now=c});c("promise/polyfill").polyfill()})(this);var Sk=Sk||{};
+Sk.configure=function(a){Sk.output=a.output||Sk.output;goog.asserts.assert("function"===typeof Sk.output);Sk.debugout=a.debugout||Sk.debugout;goog.asserts.assert("function"===typeof Sk.debugout);Sk.uncaughtException=a.uncaughtException||Sk.uncaughtException;goog.asserts.assert("function"===typeof Sk.uncaughtException);Sk.read=a.read||Sk.read;goog.asserts.assert("function"===typeof Sk.read);Sk.timeoutMsg=a.timeoutMsg||Sk.timeoutMsg;goog.asserts.assert("function"===typeof Sk.timeoutMsg);goog.exportSymbol("Sk.timeoutMsg",
+Sk.timeoutMsg);Sk.sysargv=a.sysargv||Sk.sysargv;goog.asserts.assert(goog.isArrayLike(Sk.sysargv));Sk.python3=a.python3||Sk.python3;goog.asserts.assert("boolean"===typeof Sk.python3);Sk.imageProxy=a.imageProxy||"http://localhost:8080/320x";goog.asserts.assert("string"===typeof Sk.imageProxy);Sk.inputfun=a.inputfun||Sk.inputfun;goog.asserts.assert("function"===typeof Sk.inputfun);Sk.retainGlobals=a.retainglobals||!1;goog.asserts.assert("boolean"===typeof Sk.retainGlobals);Sk.debugging=a.debugging||
+!1;goog.asserts.assert("boolean"===typeof Sk.debugging);Sk.breakpoints=a.breakpoints||function(){return!0};goog.asserts.assert("function"===typeof Sk.breakpoints);Sk.setTimeout=a.setTimeout;void 0===Sk.setTimeout&&(Sk.setTimeout="function"===typeof setTimeout?setTimeout:function(a,c){a()});goog.asserts.assert("function"===typeof Sk.setTimeout);"execLimit"in a&&(Sk.execLimit=a.execLimit);"yieldLimit"in a&&(Sk.yieldLimit=a.yieldLimit);a.syspath&&(Sk.syspath=a.syspath,goog.asserts.assert(goog.isArrayLike(Sk.syspath)),
+Sk.realsyspath=void 0,Sk.sysmodules=new Sk.builtin.dict([]));Sk.misceval.softspace_=!1};goog.exportSymbol("Sk.configure",Sk.configure);Sk.uncaughtException=function(a){throw a;};goog.exportSymbol("Sk.uncaughtException",Sk.uncaughtException);Sk.timeoutMsg=function(){return"Program exceeded run time limit."};goog.exportSymbol("Sk.timeoutMsg",Sk.timeoutMsg);Sk.execLimit=Number.POSITIVE_INFINITY;Sk.yieldLimit=Number.POSITIVE_INFINITY;Sk.output=function(a){};
+Sk.read=function(a){throw"Sk.read has not been implemented";};Sk.sysargv=[];Sk.getSysArgv=function(){return Sk.sysargv};goog.exportSymbol("Sk.getSysArgv",Sk.getSysArgv);Sk.syspath=[];Sk.inBrowser=void 0!==goog.global.document;Sk.debugout=function(a){};
+(function(){void 0!==goog.global.write?Sk.output=goog.global.write:void 0!==goog.global.console&&void 0!==goog.global.console.log?Sk.output=function(a){goog.global.console.log(a)}:void 0!==goog.global.print&&(Sk.output=goog.global.print);void 0!==goog.global.print&&(Sk.debugout=goog.global.print)})();Sk.inBrowser||(goog.global.CLOSURE_IMPORT_SCRIPT=function(a){goog.global.eval(goog.global.read("support/closure-library/closure/goog/"+a));return!0});Sk.python3=!1;Sk.inputfun=function(a){return window.prompt(a)};
+goog.exportSymbol("Sk.python3",Sk.python3);goog.exportSymbol("Sk.inputfun",Sk.inputfun);void 0===Sk.builtin&&(Sk.builtin={});
+Sk.dunderToSkulpt={__eq__:"ob$eq",__ne__:"ob$ne",__lt__:"ob$lt",__le__:"ob$le",__gt__:"ob$gt",__ge__:"ob$ge",__hash__:"tp$hash",__abs__:"nb$abs",__neg__:"nb$negative",__pos__:"nb$positive",__int__:"nb$int_",__long__:"nb$lng",__float__:"nb$float_",__add__:"nb$add",__radd__:"nb$reflected_add",__sub__:"nb$subtract",__rsub__:"nb$reflected_subtract",__mul__:"nb$multiply",__rmul__:"nb$reflected_multiply",__div__:"nb$divide",__rdiv__:"nb$reflected_divide",__floordiv__:"nb$floor_divide",__rfloordiv__:"nb$reflected_floor_divide",
+__mod__:"nb$remainder",__rmod__:"nb$reflected_remainder",__divmod__:"nb$divmod",__rdivmod__:"nb$reflected_divmod",__pow__:"nb$power",__rpow__:"nb$reflected_power",__contains__:"sq$contains",__len__:"sq$length"};
+Sk.builtin.type=function(a,b,c){var d,e;if(void 0===b&&void 0===c)return a.ob$type;if("dict"!==c.tp$name)throw new Sk.builtin.TypeError("type() argument 3 must be dict, not "+Sk.abstr.typeName(c));if(!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError("type() argument 1 must be str, not "+Sk.abstr.typeName(a));if("tuple"!==b.tp$name)throw new Sk.builtin.TypeError("type() argument 2 must be tuple, not "+Sk.abstr.typeName(b));d=function(a,b,c,e,f){var g,h=this;if(!(this instanceof d))return new d(a,
+b,c,e,f);e=e||[];h.$d=new Sk.builtin.dict([]);void 0!==d.prototype.tp$base&&(d.prototype.tp$base.sk$klass?d.prototype.tp$base.call(this,a,b,c,e.slice(),f):(g=e.slice(),g.unshift(d,this),Sk.abstr.superConstructor.apply(void 0,g)));g=Sk.builtin.type.typeLookup(h.ob$type,"__init__");return void 0!==g?(e.unshift(h),a=Sk.misceval.applyOrSuspend(g,a,b,c,e),function w(a){return a instanceof Sk.misceval.Suspension?f?new Sk.misceval.Suspension(w,a):Sk.misceval.retryOptionalSuspensionOrThrow(a):h}(a)):h};var f=
+Sk.ffi.remapToJs(a);e=!1;0===b.v.length&&Sk.python3&&(e=!0,Sk.abstr.setUpInheritance(f,d,Sk.builtin.object));var g,h,k,l=[];h=b.tp$iter();for(g=h.tp$iternext();void 0!==g;g=h.tp$iternext())if(void 0===k&&(k=g),g.prototype instanceof Sk.builtin.object||g===Sk.builtin.object){for(;g.sk$klass&&g.prototype.tp$base;)g=g.prototype.tp$base;!g.sk$klass&&0>l.indexOf(g)&&l.push(g);e=!0}if(1<l.length)throw new Sk.builtin.TypeError("Multiple inheritance with more than one builtin type is unsupported");void 0!==
+k&&(goog.inherits(d,k),k.prototype instanceof Sk.builtin.object||k===Sk.builtin.object)&&(d.prototype.tp$base=k);d.prototype.tp$name=f;d.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj(f,d);e||(d.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr,d.prototype.tp$setattr=Sk.builtin.object.prototype.GenericSetAttr);var m=new Sk.builtin.str("__module__");void 0===c.mp$lookup(m)&&c.mp$ass_subscript(m,Sk.globals.__name__);h=c.tp$iter();for(g=h.tp$iternext();void 0!==g;g=h.tp$iternext())e=
+c.mp$subscript(g),void 0===e&&(e=null),d.prototype[g.v]=e,d[g.v]=e;d.__class__=d;d.__name__=a;d.sk$klass=!0;d.prototype.tp$descr_get=function(){goog.asserts.fail("in type tp$descr_get")};d.prototype.$r=function(){var a,b;a=this.tp$getattr("__repr__");if(void 0!==a&&a.im_func!==Sk.builtin.object.prototype.__repr__)return Sk.misceval.apply(a,void 0,void 0,void 0,[]);if(void 0!==d.prototype.tp$base&&d.prototype.tp$base!==Sk.builtin.object&&void 0!==d.prototype.tp$base.prototype.$r)return d.prototype.tp$base.prototype.$r.call(this);
+b=c.mp$subscript(m);a="";b&&(a=b.v+".");return new Sk.builtin.str("<"+a+f+" object>")};d.prototype.tp$str=function(){var a=this.tp$getattr("__str__");return void 0!==a&&a.im_func!==Sk.builtin.object.prototype.__str__?Sk.misceval.apply(a,void 0,void 0,void 0,[]):void 0!==d.prototype.tp$base&&d.prototype.tp$base!==Sk.builtin.object&&void 0!==d.prototype.tp$base.prototype.tp$str?d.prototype.tp$base.prototype.tp$str.call(this):this.$r()};d.prototype.tp$length=function(){var a;a=this.tp$getattr("__len__");
+if(void 0!==a)return Sk.misceval.apply(a,void 0,void 0,void 0,[]);a=Sk.abstr.typeName(this);throw new Sk.builtin.AttributeError(a+" instance has no attribute '__len__'");};d.prototype.tp$call=function(a,b){var c=this.tp$getattr("__call__");if(c)return Sk.misceval.apply(c,void 0,void 0,b,a);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(this)+"' object is not callable");};d.prototype.tp$iter=function(){var a;a=this.tp$getattr("__iter__");var b=Sk.abstr.typeName(this);if(a)return a=Sk.misceval.callsim(a);
+throw new Sk.builtin.TypeError("'"+b+"' object is not iterable");};d.prototype.tp$iternext=function(a){var b,c=this.tp$getattr("next");if(c)return b=Sk.misceval.tryCatch(function(){return Sk.misceval.callsimOrSuspend(c)},function(a){if(!(a instanceof Sk.builtin.StopIteration))throw a;}),a?b:Sk.misceval.retryOptionalSuspensionOrThrow(b)};d.prototype.tp$getitem=function(a,b){var c=this.tp$getattr("__getitem__");if(void 0!==c)return c=Sk.misceval.applyOrSuspend(c,void 0,void 0,void 0,[a]),b?c:Sk.misceval.retryOptionalSuspensionOrThrow(c);
+throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(this)+"' object does not support indexing");};d.prototype.tp$setitem=function(a,b,c){var d=this.tp$getattr("__setitem__");if(void 0!==d)return a=Sk.misceval.applyOrSuspend(d,void 0,void 0,void 0,[a,b]),c?a:Sk.misceval.retryOptionalSuspensionOrThrow(a);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(this)+"' object does not support item assignment");};b&&(d.$d=new Sk.builtin.dict([]),d.$d.mp$ass_subscript(Sk.builtin.type.basesStr_,b),a=Sk.builtin.type.buildMRO(d),
+d.$d.mp$ass_subscript(Sk.builtin.type.mroStr_,a),d.tp$mro=a);d.tp$setattr=Sk.builtin.type.prototype.tp$setattr;a=function(a,b,c){d.prototype[a]=function(){var a=Array.prototype.slice.call(arguments);a.unshift(c,this);return Sk.misceval.callsim.apply(void 0,a)}};for(var p in Sk.dunderToSkulpt)b=Sk.dunderToSkulpt[p],d[p]&&a(b,p,d[p]);return d};Sk.builtin.type.makeTypeObj=function(a,b){Sk.builtin.type.makeIntoTypeObj(a,b);return b};
+Sk.builtin.type.makeIntoTypeObj=function(a,b){goog.asserts.assert(void 0!==a);goog.asserts.assert(void 0!==b);b.ob$type=Sk.builtin.type;b.tp$name=a;b.$r=function(){var a,d=b.__module__,e="";d&&(e=d.v+".");a="class";d||(b.sk$klass||Sk.python3)||(a="type");return new Sk.builtin.str("<"+a+" '"+e+b.tp$name+"'>")};b.tp$str=void 0;b.tp$getattr=Sk.builtin.type.prototype.tp$getattr;b.tp$setattr=Sk.builtin.object.prototype.GenericSetAttr;b.tp$richcompare=Sk.builtin.type.prototype.tp$richcompare;b.sk$type=
+!0;return b};Sk.builtin.type.ob$type=Sk.builtin.type;Sk.builtin.type.tp$name="type";Sk.builtin.type.$r=function(){return Sk.python3?new Sk.builtin.str("<class 'type'>"):new Sk.builtin.str("<type 'type'>")};Sk.builtin.type.prototype.tp$getattr=function(a){var b,c;if(this.$d&&(b=this.$d.mp$lookup(new Sk.builtin.str(a)),void 0!==b))return b;a=Sk.builtin.type.typeLookup(this,a);void 0!==a&&(null!==a&&void 0!==a.ob$type)&&(c=a.ob$type.tp$descr_get);if(c)return c.call(a,null,this);if(void 0!==a)return a};
+Sk.builtin.type.prototype.tp$setattr=function(a,b){this[a]=b};Sk.builtin.type.typeLookup=function(a,b){var c=a.tp$mro,d=new Sk.builtin.str(b),e,f,g;if(c)for(g=0;g<c.v.length;++g){e=c.v[g];if(e.hasOwnProperty(b))return e[b];f=e.$d.mp$lookup(d);if(void 0!==f)return f;if(e.prototype&&void 0!==e.prototype[b])return e.prototype[b]}else if(a.prototype)return a.prototype[b]};
+Sk.builtin.type.mroMerge_=function(a){for(var b,c,d,e,f,g,h=[];;){for(c=0;c<a.length&&(b=a[c],0===b.length);++c);if(c===a.length)return h;d=[];for(c=0;c<a.length;++c)if(b=a[c],0!==b.length){g=b[0];f=0;a:for(;f<a.length;++f)for(e=a[f],b=1;b<e.length;++b)if(e[b]===g)break a;f===a.length&&d.push(g)}if(0===d.length)throw new Sk.builtin.TypeError("Inconsistent precedences in type hierarchy");d=d[0];h.push(d);for(c=0;c<a.length;++c)b=a[c],0<b.length&&b[0]===d&&b.splice(0,1)}};
+Sk.builtin.type.buildMRO_=function(a){var b,c=[[a]],d=a.$d.mp$subscript(Sk.builtin.type.basesStr_);for(a=0;a<d.v.length;++a)c.push(Sk.builtin.type.buildMRO_(d.v[a]));b=[];for(a=0;a<d.v.length;++a)b.push(d.v[a]);c.push(b);return Sk.builtin.type.mroMerge_(c)};Sk.builtin.type.buildMRO=function(a){return new Sk.builtin.tuple(Sk.builtin.type.buildMRO_(a))};
+Sk.builtin.type.prototype.tp$richcompare=function(a,b){var c,d;if(a.ob$type==Sk.builtin.type&&this.$r&&a.$r)return d=this.$r(),c=a.$r(),d.tp$richcompare(c,b)};Sk.abstr={};Sk.abstr.typeName=function(a){return void 0!==a.tp$name?a.tp$name:"<invalid type>"};Sk.abstr.binop_type_error=function(a,b,c){a=Sk.abstr.typeName(a);b=Sk.abstr.typeName(b);throw new Sk.builtin.TypeError("unsupported operand type(s) for "+c+": '"+a+"' and '"+b+"'");};Sk.abstr.unop_type_error=function(a,b){var c=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("bad operand type for unary "+{UAdd:"+",USub:"-",Invert:"~"}[b]+": '"+c+"'");};
+Sk.abstr.boNameToSlotFuncLhs_=function(a,b){if(null!==a)switch(b){case "Add":return a.nb$add?a.nb$add:a.__add__;case "Sub":return a.nb$subtract?a.nb$subtract:a.__sub__;case "Mult":return a.nb$multiply?a.nb$multiply:a.__mul__;case "Div":return a.nb$divide?a.nb$divide:a.__div__;case "FloorDiv":return a.nb$floor_divide?a.nb$floor_divide:a.__floordiv__;case "Mod":return a.nb$remainder?a.nb$remainder:a.__mod__;case "DivMod":return a.nb$divmod?a.nb$divmod:a.__divmod__;case "Pow":return a.nb$power?a.nb$power:
+a.__pow__;case "LShift":return a.nb$lshift?a.nb$lshift:a.__lshift__;case "RShift":return a.nb$rshift?a.nb$rshift:a.__rshift__;case "BitAnd":return a.nb$and?a.nb$and:a.__and__;case "BitXor":return a.nb$xor?a.nb$xor:a.__xor__;case "BitOr":return a.nb$or?a.nb$or:a.__or__}};
+Sk.abstr.boNameToSlotFuncRhs_=function(a,b){if(null!==a)switch(b){case "Add":return a.nb$reflected_add?a.nb$reflected_add:a.__radd__;case "Sub":return a.nb$reflected_subtract?a.nb$reflected_subtract:a.__rsub__;case "Mult":return a.nb$reflected_multiply?a.nb$reflected_multiply:a.__rmul__;case "Div":return a.nb$reflected_divide?a.nb$reflected_divide:a.__rdiv__;case "FloorDiv":return a.nb$reflected_floor_divide?a.nb$reflected_floor_divide:a.__rfloordiv__;case "Mod":return a.nb$reflected_remainder?a.nb$reflected_remainder:
+a.__rmod__;case "DivMod":return a.nb$reflected_divmod?a.nb$reflected_divmod:a.__rdivmod__;case "Pow":return a.nb$reflected_power?a.nb$reflected_power:a.__rpow__;case "LShift":return a.nb$reflected_lshift?a.nb$reflected_lshift:a.__rlshift__;case "RShift":return a.nb$reflected_rshift?a.nb$reflected_rshift:a.__rrshift__;case "BitAnd":return a.nb$reflected_and?a.nb$reflected_and:a.__rand__;case "BitXor":return a.nb$reflected_xor?a.nb$reflected_xor:a.__rxor__;case "BitOr":return a.nb$reflected_or?a.nb$reflected_or:
+a.__ror__}};
+Sk.abstr.iboNameToSlotFunc_=function(a,b){switch(b){case "Add":return a.nb$inplace_add?a.nb$inplace_add:a.__iadd__;case "Sub":return a.nb$inplace_subtract?a.nb$inplace_subtract:a.__isub__;case "Mult":return a.nb$inplace_multiply?a.nb$inplace_multiply:a.__imul__;case "Div":return a.nb$inplace_divide?a.nb$inplace_divide:a.__idiv__;case "FloorDiv":return a.nb$inplace_floor_divide?a.nb$inplace_floor_divide:a.__ifloordiv__;case "Mod":return a.nb$inplace_remainder;case "Pow":return a.nb$inplace_power;case "LShift":return a.nb$inplace_lshift?
+a.nb$inplace_lshift:a.__ilshift__;case "RShift":return a.nb$inplace_rshift?a.nb$inplace_rshift:a.__irshift__;case "BitAnd":return a.nb$inplace_and;case "BitOr":return a.nb$inplace_or;case "BitXor":return a.nb$inplace_xor?a.nb$inplace_xor:a.__ixor__}};Sk.abstr.uoNameToSlotFunc_=function(a,b){if(null!==a)switch(b){case "USub":return a.nb$negative?a.nb$negative:a.__neg__;case "UAdd":return a.nb$positive?a.nb$positive:a.__pos__;case "Invert":return a.nb$invert?a.nb$invert:a.__invert__}};
+Sk.abstr.binary_op_=function(a,b,c){var d,e=b.constructor.prototype instanceof a.constructor;if(e&&(d=Sk.abstr.boNameToSlotFuncRhs_(b,c),void 0!==d&&(d=d.call?d.call(b,a):Sk.misceval.callsim(d,b,a),void 0!==d&&d!==Sk.builtin.NotImplemented.NotImplemented$)))return d;d=Sk.abstr.boNameToSlotFuncLhs_(a,c);if(void 0!==d&&(d=d.call?d.call(a,b):Sk.misceval.callsim(d,a,b),void 0!==d&&d!==Sk.builtin.NotImplemented.NotImplemented$)||!e&&(d=Sk.abstr.boNameToSlotFuncRhs_(b,c),void 0!==d&&(d=d.call?d.call(b,
+a):Sk.misceval.callsim(d,b,a),void 0!==d&&d!==Sk.builtin.NotImplemented.NotImplemented$)))return d;Sk.abstr.binop_type_error(a,b,c)};
+Sk.abstr.binary_iop_=function(a,b,c){var d;d=Sk.abstr.iboNameToSlotFunc_(a,c);if(void 0!==d&&(d=d.call?d.call(a,b):Sk.misceval.callsim(d,a,b),void 0!==d&&d!==Sk.builtin.NotImplemented.NotImplemented$))return d;d=Sk.abstr.iboNameToSlotFunc_(b,c);if(void 0!==d&&(d=d.call?d.call(b,a):Sk.misceval.callsim(d,b,a),void 0!==d&&d!==Sk.builtin.NotImplemented.NotImplemented$))return d;Sk.abstr.binop_type_error(a,b,c)};
+Sk.abstr.unary_op_=function(a,b){var c;c=Sk.abstr.uoNameToSlotFunc_(a,b);if(void 0!==c&&(c=c.call?c.call(a):Sk.misceval.callsim(c,a),void 0!==c))return c;Sk.abstr.unop_type_error(a,b)};
+Sk.abstr.numOpAndPromote=function(a,b,c){if(null!==a&&null!==b){if("number"===typeof a&&"number"===typeof b)return c=c(a,b),(c>Sk.builtin.int_.threshold$||c<-Sk.builtin.int_.threshold$)&&Math.floor(c)===c?[Sk.builtin.lng.fromInt$(a),Sk.builtin.lng.fromInt$(b)]:c;if(void 0===a||void 0===b)throw new Sk.builtin.NameError("Undefined variable in expression");if(a.constructor===Sk.builtin.lng)return[a,b];if(a.constructor!==Sk.builtin.int_&&a.constructor!==Sk.builtin.float_||b.constructor!==Sk.builtin.complex){if(a.constructor===
+Sk.builtin.int_||a.constructor===Sk.builtin.float_)return[a,b];if("number"===typeof a)return a=Sk.builtin.assk$(a),[a,b]}else return a=new Sk.builtin.complex(a),[a,b]}};
+Sk.abstr.boNumPromote_={Add:function(a,b){return a+b},Sub:function(a,b){return a-b},Mult:function(a,b){return a*b},Mod:function(a,b){var c;if(0===b)throw new Sk.builtin.ZeroDivisionError("division or modulo by zero");c=a%b;return 0>c*b?c+b:c},Div:function(a,b){if(0===b)throw new Sk.builtin.ZeroDivisionError("division or modulo by zero");return a/b},FloorDiv:function(a,b){if(0===b)throw new Sk.builtin.ZeroDivisionError("division or modulo by zero");return Math.floor(a/b)},Pow:Math.pow,BitAnd:function(a,
+b){var c=a&b;0>c&&(c+=4294967296);return c},BitOr:function(a,b){var c=a|b;0>c&&(c+=4294967296);return c},BitXor:function(a,b){var c=a^b;0>c&&(c+=4294967296);return c},LShift:function(a,b){var c;if(0>b)throw new Sk.builtin.ValueError("negative shift count");c=a<<b;return c>a?c:a*Math.pow(2,b)},RShift:function(a,b){var c;if(0>b)throw new Sk.builtin.ValueError("negative shift count");c=a>>b;0<a&&0>c&&(c&=Math.pow(2,32-b)-1);return c}};
+Sk.abstr.numberBinOp=function(a,b,c){var d;d=Sk.abstr.boNumPromote_[c];if(void 0!==d){d=Sk.abstr.numOpAndPromote(a,b,d);if("number"===typeof d)return d;if(void 0!==d&&d.constructor===Sk.builtin.int_||void 0!==d&&d.constructor===Sk.builtin.float_||void 0!==d&&d.constructor===Sk.builtin.lng)return d;void 0!==d&&(a=d[0],b=d[1])}return Sk.abstr.binary_op_(a,b,c)};goog.exportSymbol("Sk.abstr.numberBinOp",Sk.abstr.numberBinOp);
+Sk.abstr.numberInplaceBinOp=function(a,b,c){var d;d=Sk.abstr.boNumPromote_[c];if(void 0!==d){d=Sk.abstr.numOpAndPromote(a,b,d);if("number"===typeof d)return d;if(void 0!==d&&d.constructor===Sk.builtin.int_||void 0!==d&&d.constructor===Sk.builtin.float_||void 0!==d&&d.constructor===Sk.builtin.lng)return d;void 0!==d&&(a=d[0],b=d[1])}return Sk.abstr.binary_iop_(a,b,c)};goog.exportSymbol("Sk.abstr.numberInplaceBinOp",Sk.abstr.numberInplaceBinOp);
+Sk.abstr.numberUnaryOp=function(a,b){var c;if("Not"===b)return Sk.misceval.isTrue(a)?Sk.builtin.bool.false$:Sk.builtin.bool.true$;if(a instanceof Sk.builtin.bool){c=Sk.builtin.asnum$(a);if("USub"===b)return new Sk.builtin.int_(-c);if("UAdd"===b)return new Sk.builtin.int_(c);if("Invert"===b)return new Sk.builtin.int_(~c)}else{if("USub"===b&&a.nb$negative)return a.nb$negative();if("UAdd"===b&&a.nb$positive)return a.nb$positive();if("Invert"===b&&a.nb$invert)return a.nb$invert()}return Sk.abstr.unary_op_(a,
+b)};goog.exportSymbol("Sk.abstr.numberUnaryOp",Sk.abstr.numberUnaryOp);Sk.abstr.fixSeqIndex_=function(a,b){b=Sk.builtin.asnum$(b);0>b&&a.sq$length&&(b+=a.sq$length());return b};
+Sk.abstr.sequenceContains=function(a,b,c){var d;if(a.sq$contains)return a.sq$contains(b);d=Sk.abstr.lookupSpecial(a,"__contains__");if(null!=d)return Sk.misceval.isTrue(Sk.misceval.callsim(d,a,b));if(!Sk.builtin.checkIterable(a))throw c=Sk.abstr.typeName(a),new Sk.builtin.TypeError("argument of type '"+c+"' is not iterable");a=Sk.misceval.iterFor(Sk.abstr.iter(a),function(a){return Sk.misceval.richCompareBool(a,b,"Eq")?new Sk.misceval.Break(!0):!1},!1);return c?a:Sk.misceval.retryOptionalSuspensionOrThrow(a)};
+Sk.abstr.sequenceConcat=function(a,b){var c;if(a.sq$concat)return a.sq$concat(b);c=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("'"+c+"' object can't be concatenated");};
+Sk.abstr.sequenceGetIndexOf=function(a,b){var c,d,e;if(a.index)return Sk.misceval.callsim(a.index,a,b);if(Sk.builtin.checkIterable(a)){e=0;d=Sk.abstr.iter(a);for(c=d.tp$iternext();void 0!==c;c=d.tp$iternext()){if(Sk.misceval.richCompareBool(b,c,"Eq"))return new Sk.builtin.int_(e);e+=1}throw new Sk.builtin.ValueError("sequence.index(x): x not in sequence");}c=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("argument of type '"+c+"' is not iterable");};
+Sk.abstr.sequenceGetCountOf=function(a,b){var c,d,e;if(a.count)return Sk.misceval.callsim(a.count,a,b);if(Sk.builtin.checkIterable(a)){e=0;d=Sk.abstr.iter(a);for(c=d.tp$iternext();void 0!==c;c=d.tp$iternext())Sk.misceval.richCompareBool(b,c,"Eq")&&(e+=1);return new Sk.builtin.int_(e)}c=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("argument of type '"+c+"' is not iterable");};
+Sk.abstr.sequenceGetItem=function(a,b,c){if(a.mp$subscript)return a.mp$subscript(b);a=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("'"+a+"' object is unsubscriptable");};Sk.abstr.sequenceSetItem=function(a,b,c,d){if(a.mp$ass_subscript)return a.mp$ass_subscript(b,c);a=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("'"+a+"' object does not support item assignment");};
+Sk.abstr.sequenceDelItem=function(a,b){var c;if(a.sq$del_item)b=Sk.abstr.fixSeqIndex_(a,b),a.sq$del_item(b);else throw c=Sk.abstr.typeName(a),new Sk.builtin.TypeError("'"+c+"' object does not support item deletion");};Sk.abstr.sequenceRepeat=function(a,b,c){c=Sk.builtin.asnum$(c);if(void 0===Sk.misceval.asIndex(c))throw a=Sk.abstr.typeName(c),new Sk.builtin.TypeError("can't multiply sequence by non-int of type '"+a+"'");return a.call(b,c)};
+Sk.abstr.sequenceGetSlice=function(a,b,c){if(a.sq$slice)return b=Sk.abstr.fixSeqIndex_(a,b),c=Sk.abstr.fixSeqIndex_(a,c),a.sq$slice(b,c);if(a.mp$subscript)return a.mp$subscript(new Sk.builtin.slice(b,c));a=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("'"+a+"' object is unsliceable");};
+Sk.abstr.sequenceDelSlice=function(a,b,c){if(a.sq$del_slice)b=Sk.abstr.fixSeqIndex_(a,b),c=Sk.abstr.fixSeqIndex_(a,c),a.sq$del_slice(b,c);else throw a=Sk.abstr.typeName(a),new Sk.builtin.TypeError("'"+a+"' doesn't support slice deletion");};
+Sk.abstr.sequenceSetSlice=function(a,b,c,d){if(a.sq$ass_slice)b=Sk.abstr.fixSeqIndex_(a,b),c=Sk.abstr.fixSeqIndex_(a,c),a.sq$ass_slice(b,c,d);else if(a.mp$ass_subscript)a.mp$ass_subscript(new Sk.builtin.slice(b,c),d);else throw a=Sk.abstr.typeName(a),new Sk.builtin.TypeError("'"+a+"' object doesn't support slice assignment");};
+Sk.abstr.sequenceUnpack=function(a,b){var c=[],d,e;if(!Sk.builtin.checkIterable(a))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not iterable");d=Sk.abstr.iter(a);for(e=d.tp$iternext();void 0!==e&&c.length<b;e=d.tp$iternext())c.push(e);if(c.length<b)throw new Sk.builtin.ValueError("need more than "+c.length+" values to unpack");if(void 0!==e)throw new Sk.builtin.ValueError("too many values to unpack");return c};
+Sk.abstr.objectFormat=function(a,b){var c;null==b&&(b="");c=Sk.abstr.lookupSpecial(a,"__format__");if(null==c)throw new Sk.builtin.TypeError("Type "+Sk.abstr.typeName(a)+"doesn't define __format__");c=Sk.misceval.callsim(c,a,b);if(!Sk.builtin.checkString(c))throw new Sk.builtin.TypeError("__format__ must return a str, not "+Sk.abstr.typeName(c));return c};
+Sk.abstr.objectAdd=function(a,b){var c,d;if(a.nb$add)return a.nb$add(b);d=Sk.abstr.typeName(a);c=Sk.abstr.typeName(b);throw new Sk.builtin.TypeError("unsupported operand type(s) for +: '"+d+"' and '"+c+"'");};Sk.abstr.objectNegative=function(a){var b=Sk.builtin.asnum$(a);a instanceof Sk.builtin.bool&&(a=new Sk.builtin.int_(b));if(a.nb$negative)return a.nb$negative();a=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("bad operand type for unary -: '"+a+"'");};
+Sk.abstr.objectPositive=function(a){var b=Sk.abstr.typeName(a),c=Sk.builtin.asnum$(a);a instanceof Sk.builtin.bool&&(a=new Sk.builtin.int_(c));if(a.nb$negative)return a.nb$positive();throw new Sk.builtin.TypeError("bad operand type for unary +: '"+b+"'");};
+Sk.abstr.objectDelItem=function(a,b){var c;if(null!==a){if(a.mp$del_subscript){a.mp$del_subscript(b);return}if(a.sq$ass_item){c=Sk.misceval.asIndex(b);if(void 0===c)throw c=Sk.abstr.typeName(b),new Sk.builtin.TypeError("sequence index must be integer, not '"+c+"'");Sk.abstr.sequenceDelItem(a,c);return}}c=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("'"+c+"' object does not support item deletion");};goog.exportSymbol("Sk.abstr.objectDelItem",Sk.abstr.objectDelItem);
+Sk.abstr.objectGetItem=function(a,b,c){if(null!==a){if(a.tp$getitem)return a.tp$getitem(b,c);if(a.mp$subscript)return a.mp$subscript(b,c);if(Sk.misceval.isIndex(b)&&a.sq$item)return Sk.abstr.sequenceGetItem(a,Sk.misceval.asIndex(b),c)}a=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("'"+a+"' does not support indexing");};goog.exportSymbol("Sk.abstr.objectGetItem",Sk.abstr.objectGetItem);
+Sk.abstr.objectSetItem=function(a,b,c,d){if(null!==a){if(a.tp$setitem)return a.tp$setitem(b,c,d);if(a.mp$ass_subscript)return a.mp$ass_subscript(b,c,d);if(Sk.misceval.isIndex(b)&&a.sq$ass_item)return Sk.abstr.sequenceSetItem(a,Sk.misceval.asIndex(b),c,d)}a=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("'"+a+"' does not support item assignment");};goog.exportSymbol("Sk.abstr.objectSetItem",Sk.abstr.objectSetItem);
+Sk.abstr.gattr=function(a,b,c){var d,e,f=Sk.abstr.typeName(a);if(null===a)throw new Sk.builtin.AttributeError("'"+f+"' object has no attribute '"+b+"'");void 0!==a.tp$getattr&&(e=a.tp$getattr("__getattribute__"));void 0!==e&&(d=Sk.misceval.callsimOrSuspend(e,new Sk.builtin.str(b)));d=Sk.misceval.chain(d,function(c){var d;void 0===c&&void 0!==a.tp$getattr&&(c=a.tp$getattr(b),void 0===c&&(d=a.tp$getattr("__getattr__"),void 0!==d&&(c=Sk.misceval.callsimOrSuspend(d,new Sk.builtin.str(b)))));return c},
+function(a){if(void 0===a)throw new Sk.builtin.AttributeError("'"+f+"' object has no attribute '"+b+"'");return a});return c?d:Sk.misceval.retryOptionalSuspensionOrThrow(d)};goog.exportSymbol("Sk.abstr.gattr",Sk.abstr.gattr);
+Sk.abstr.sattr=function(a,b,c,d){var e=Sk.abstr.typeName(a),f;if(null===a)throw new Sk.builtin.AttributeError("'"+e+"' object has no attribute '"+b+"'");if(void 0!==a.tp$getattr&&(f=a.tp$getattr("__setattr__"),void 0!==f))return a=Sk.misceval.callsimOrSuspend(f,new Sk.builtin.str(b),c),d?a:Sk.misceval.retryOptionalSuspensionOrThrow(a);if(void 0!==a.tp$setattr)a.tp$setattr(b,c);else throw new Sk.builtin.AttributeError("'"+e+"' object has no attribute '"+b+"'");};
+goog.exportSymbol("Sk.abstr.sattr",Sk.abstr.sattr);Sk.abstr.iternext=function(a,b){return a.tp$iternext(b)};goog.exportSymbol("Sk.abstr.iternext",Sk.abstr.iternext);
+Sk.abstr.iter=function(a){var b,c,d=function(a){this.idx=0;this.myobj=a;this.getitem=Sk.abstr.lookupSpecial(a,"__getitem__");this.tp$iternext=function(){var a;try{a=Sk.misceval.callsim(this.getitem,this.myobj,Sk.ffi.remapToPy(this.idx))}catch(b){if(b instanceof Sk.builtin.IndexError||b instanceof Sk.builtin.StopIteration)return;throw b;}this.idx++;return a}};if(a.tp$getattr&&(b=Sk.abstr.lookupSpecial(a,"__iter__"))&&(c=Sk.misceval.callsim(b,a),c.tp$iternext))return c;if(a.tp$iter)try{if(c=a.tp$iter(),
+c.tp$iternext)return c}catch(e){}if(Sk.abstr.lookupSpecial(a,"__getitem__"))return new d(a);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not iterable");};goog.exportSymbol("Sk.abstr.iter",Sk.abstr.iter);Sk.abstr.lookupSpecial=function(a,b){var c;if(a.ob$type)c=a.ob$type;else return null;return Sk.builtin.type.typeLookup(c,b)};goog.exportSymbol("Sk.abstr.lookupSpecial",Sk.abstr.lookupSpecial);
+Sk.abstr.markUnhashable=function(a){a=a.prototype;a.__hash__=Sk.builtin.none.none$;a.tp$hash=Sk.builtin.none.none$};Sk.abstr.setUpInheritance=function(a,b,c){goog.inherits(b,c);b.prototype.tp$base=c;b.prototype.tp$name=a;b.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj(a,b)};Sk.abstr.superConstructor=function(a,b,c){var d=Array.prototype.slice.call(arguments,2);a.prototype.tp$base.apply(b,d)};Sk.builtin.object=function(){return this instanceof Sk.builtin.object?this:new Sk.builtin.object};
+Sk.builtin.object.prototype.GenericGetAttr=function(a){var b,c,d,e,f=new Sk.builtin.str(a);goog.asserts.assert("string"===typeof a);d=this.ob$type;goog.asserts.assert(void 0!==d,"object has no ob$type!");if(e=this.$d||this.constructor.$d){if(e.mp$lookup)b=e.mp$lookup(f);else if(e.mp$subscript)try{b=e.mp$subscript(f)}catch(g){b=void 0}else"object"===typeof e&&(b=e[a]);if(void 0!==b)return b}a=Sk.builtin.type.typeLookup(d,a);void 0!==a&&(null!==a&&void 0!==a.ob$type)&&(c=a.ob$type.tp$descr_get);if(c)return c.call(a,
+this,this.ob$type);if(void 0!==a)return a};goog.exportSymbol("Sk.builtin.object.prototype.GenericGetAttr",Sk.builtin.object.prototype.GenericGetAttr);Sk.builtin.object.prototype.GenericPythonGetAttr=function(a,b){return Sk.builtin.object.prototype.GenericGetAttr.call(a,b.v)};goog.exportSymbol("Sk.builtin.object.prototype.GenericPythonGetAttr",Sk.builtin.object.prototype.GenericPythonGetAttr);
+Sk.builtin.object.prototype.GenericSetAttr=function(a,b){var c=Sk.abstr.typeName(this),d,e;goog.asserts.assert("string"===typeof a);e=this.$d||this.constructor.$d;if(e.mp$ass_subscript){d=new Sk.builtin.str(a);if(this instanceof Sk.builtin.object&&!this.ob$type.sk$klass&&void 0===e.mp$lookup(d))throw new Sk.builtin.AttributeError("'"+c+"' object has no attribute '"+a+"'");e.mp$ass_subscript(new Sk.builtin.str(a),b)}else"object"===typeof e&&(e[a]=b)};
+goog.exportSymbol("Sk.builtin.object.prototype.GenericSetAttr",Sk.builtin.object.prototype.GenericSetAttr);Sk.builtin.object.prototype.GenericPythonSetAttr=function(a,b,c){return Sk.builtin.object.prototype.GenericSetAttr.call(a,b.v,c)};goog.exportSymbol("Sk.builtin.object.prototype.GenericPythonSetAttr",Sk.builtin.object.prototype.GenericPythonSetAttr);Sk.builtin.object.prototype.HashNotImplemented=function(){throw new Sk.builtin.TypeError("unhashable type: '"+Sk.abstr.typeName(this)+"'");};
+Sk.builtin.object.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;Sk.builtin.object.prototype.tp$setattr=Sk.builtin.object.prototype.GenericSetAttr;Sk.builtin.object.prototype.__getattr__=Sk.builtin.object.prototype.GenericPythonGetAttr;Sk.builtin.object.prototype.__setattr__=Sk.builtin.object.prototype.GenericPythonSetAttr;Sk.builtin.object.prototype.tp$name="object";Sk.builtin.object.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("object",Sk.builtin.object);
+Sk.builtin.object.prototype.ob$type.sk$klass=void 0;Sk.builtin.object.prototype.__repr__=function(a){Sk.builtin.pyCheckArgs("__repr__",arguments,0,0,!1,!0);return a.$r()};Sk.builtin.object.prototype.__str__=function(a){Sk.builtin.pyCheckArgs("__str__",arguments,0,0,!1,!0);return a.$r()};Sk.builtin.object.prototype.__hash__=function(a){Sk.builtin.pyCheckArgs("__hash__",arguments,0,0,!1,!0);return a.tp$hash()};
+Sk.builtin.object.prototype.__eq__=function(a,b){Sk.builtin.pyCheckArgs("__eq__",arguments,1,1,!1,!0);return a.ob$eq(b)};Sk.builtin.object.prototype.__ne__=function(a,b){Sk.builtin.pyCheckArgs("__ne__",arguments,1,1,!1,!0);return a.ob$ne(b)};Sk.builtin.object.prototype.__lt__=function(a,b){Sk.builtin.pyCheckArgs("__lt__",arguments,1,1,!1,!0);return a.ob$lt(b)};Sk.builtin.object.prototype.__le__=function(a,b){Sk.builtin.pyCheckArgs("__le__",arguments,1,1,!1,!0);return a.ob$le(b)};
+Sk.builtin.object.prototype.__gt__=function(a,b){Sk.builtin.pyCheckArgs("__gt__",arguments,1,1,!1,!0);return a.ob$gt(b)};Sk.builtin.object.prototype.__ge__=function(a,b){Sk.builtin.pyCheckArgs("__ge__",arguments,1,1,!1,!0);return a.ob$ge(b)};Sk.builtin.object.prototype.$r=function(){return new Sk.builtin.str("<object>")};Sk.builtin.hashCount=1;Sk.builtin.object.prototype.tp$hash=function(){this.$savedHash_||(this.$savedHash_=new Sk.builtin.int_(Sk.builtin.hashCount++));return this.$savedHash_};
+Sk.builtin.object.prototype.ob$eq=function(a){return this===a?Sk.builtin.bool.true$:Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.object.prototype.ob$ne=function(a){return this===a?Sk.builtin.bool.false$:Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.object.prototype.ob$lt=function(a){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.object.prototype.ob$le=function(a){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.object.prototype.ob$gt=function(a){return Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.object.prototype.ob$ge=function(a){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.object.pythonFunctions="__repr__ __str__ __hash__ __eq__ __ne__ __lt__ __le__ __gt__ __ge__ __getattr__ __setattr__".split(" ");Sk.builtin.none=function(){this.v=null};Sk.abstr.setUpInheritance("NoneType",Sk.builtin.none,Sk.builtin.object);Sk.builtin.none.prototype.$r=function(){return new Sk.builtin.str("None")};Sk.builtin.none.prototype.tp$hash=function(){return new Sk.builtin.int_(0)};
+Sk.builtin.none.none$=new Sk.builtin.none;Sk.builtin.NotImplemented=function(){};Sk.abstr.setUpInheritance("NotImplementedType",Sk.builtin.NotImplemented,Sk.builtin.object);Sk.builtin.NotImplemented.prototype.$r=function(){return new Sk.builtin.str("NotImplemented")};Sk.builtin.NotImplemented.NotImplemented$=new Sk.builtin.NotImplemented;goog.exportSymbol("Sk.builtin.none",Sk.builtin.none);goog.exportSymbol("Sk.builtin.NotImplemented",Sk.builtin.NotImplemented);Sk.builtin.pyCheckArgs=function(a,b,c,d,e,f){b=b.length;var g="";void 0===d&&(d=Infinity);e&&(b-=1);f&&(b-=1);if(b<c||b>d)throw g=(c===d?a+"() takes exactly "+c+" arguments":b<c?a+"() takes at least "+c+" arguments":a+"() takes at most "+d+" arguments")+(" ("+b+" given)"),new Sk.builtin.TypeError(g);};goog.exportSymbol("Sk.builtin.pyCheckArgs",Sk.builtin.pyCheckArgs);Sk.builtin.pyCheckType=function(a,b,c){if(!c)throw new Sk.builtin.TypeError(a+" must be a "+b);};
+goog.exportSymbol("Sk.builtin.pyCheckType",Sk.builtin.pyCheckType);Sk.builtin.checkSequence=function(a){return null!==a&&void 0!==a.mp$subscript};goog.exportSymbol("Sk.builtin.checkSequence",Sk.builtin.checkSequence);Sk.builtin.checkIterable=function(a){var b=!1;if(null!==a)try{return(b=Sk.abstr.iter(a))?!0:!1}catch(c){if(c instanceof Sk.builtin.TypeError)return!1;throw c;}return b};goog.exportSymbol("Sk.builtin.checkIterable",Sk.builtin.checkIterable);
+Sk.builtin.checkCallable=function(a){return"function"===typeof a?!(a instanceof Sk.builtin.none)&&void 0!==a.ob$type:void 0!==a.tp$call||void 0!==a.__call__};Sk.builtin.checkNumber=function(a){return null!==a&&("number"===typeof a||a instanceof Sk.builtin.int_||a instanceof Sk.builtin.float_||a instanceof Sk.builtin.lng)};goog.exportSymbol("Sk.builtin.checkNumber",Sk.builtin.checkNumber);Sk.builtin.checkComplex=function(a){return Sk.builtin.complex._complex_check(a)};
+goog.exportSymbol("Sk.builtin.checkComplex",Sk.builtin.checkComplex);Sk.builtin.checkInt=function(a){return null!==a&&("number"===typeof a&&a===(a|0)||a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng)};goog.exportSymbol("Sk.builtin.checkInt",Sk.builtin.checkInt);Sk.builtin.checkFloat=function(a){return null!==a&&a instanceof Sk.builtin.float_};goog.exportSymbol("Sk.builtin.checkFloat",Sk.builtin.checkFloat);Sk.builtin.checkString=function(a){return null!==a&&a.__class__==Sk.builtin.str};
+goog.exportSymbol("Sk.builtin.checkString",Sk.builtin.checkString);Sk.builtin.checkClass=function(a){return null!==a&&a.sk$type};goog.exportSymbol("Sk.builtin.checkClass",Sk.builtin.checkClass);Sk.builtin.checkBool=function(a){return a instanceof Sk.builtin.bool};goog.exportSymbol("Sk.builtin.checkBool",Sk.builtin.checkBool);Sk.builtin.checkNone=function(a){return a instanceof Sk.builtin.none};goog.exportSymbol("Sk.builtin.checkNone",Sk.builtin.checkNone);
+Sk.builtin.checkFunction=function(a){return null!==a&&void 0!==a.tp$call};goog.exportSymbol("Sk.builtin.checkFunction",Sk.builtin.checkFunction);Sk.builtin.func=function(a,b,c,d){var e;this.func_code=a;this.func_globals=b||null;if(void 0!==d)for(e in d)c[e]=d[e];this.func_closure=c;return this};goog.exportSymbol("Sk.builtin.func",Sk.builtin.func);Sk.builtin.func.prototype.tp$name="function";
+Sk.builtin.func.prototype.tp$descr_get=function(a,b){goog.asserts.assert(void 0!==a&&void 0!==b);return null==a?this:new Sk.builtin.method(this,a)};
+Sk.builtin.func.prototype.tp$call=function(a,b){var c,d,e,f,g,h,k;this.func_closure&&a.push(this.func_closure);k=this.func_code.co_kwargs;h=[];if(this.func_code.no_kw&&b)throw c=this.func_code&&this.func_code.co_name&&this.func_code.co_name.v||"<native JS>",new Sk.builtin.TypeError(c+"() takes no keyword arguments");if(b)for(g=b.length,e=(f=this.func_code.co_varnames)&&f.length,d=0;d<g;d+=2){for(c=0;c<e&&b[d]!==f[c];++c);if(f&&c!==e){if(c in a)throw c=this.func_code&&this.func_code.co_name&&this.func_code.co_name.v||
+"<native JS>",new Sk.builtin.TypeError(c+"() got multiple values for keyword argument '"+b[d]+"'");a[c]=b[d+1]}else if(k)h.push(new Sk.builtin.str(b[d])),h.push(b[d+1]);else throw c=this.func_code&&this.func_code.co_name&&this.func_code.co_name.v||"<native JS>",new Sk.builtin.TypeError(c+"() got an unexpected keyword argument '"+b[d]+"'");}k&&a.unshift(h);return this.func_code.apply(this.func_globals,a)};Sk.builtin.func.prototype.tp$getattr=function(a){return this[a]};
+Sk.builtin.func.prototype.tp$setattr=function(a,b){this[a]=b};Sk.builtin.func.prototype.ob$type=Sk.builtin.type.makeTypeObj("function",new Sk.builtin.func(null,null));Sk.builtin.func.prototype.$r=function(){return new Sk.builtin.str("<function "+(this.func_code&&this.func_code.co_name&&this.func_code.co_name.v||"<native JS>")+">")};Sk.builtin.range=function(a,b,c){var d=[],e;Sk.builtin.pyCheckArgs("range",arguments,1,3);Sk.builtin.pyCheckType("start","integer",Sk.builtin.checkInt(a));void 0!==b&&Sk.builtin.pyCheckType("stop","integer",Sk.builtin.checkInt(b));void 0!==c&&Sk.builtin.pyCheckType("step","integer",Sk.builtin.checkInt(c));a=Sk.builtin.asnum$(a);b=Sk.builtin.asnum$(b);c=Sk.builtin.asnum$(c);void 0===b&&void 0===c?(b=a,a=0,c=1):void 0===c&&(c=1);if(0===c)throw new Sk.builtin.ValueError("range() step argument must not be zero");
+if(0<c)for(e=a;e<b;e+=c)d.push(new Sk.builtin.int_(e));else for(e=a;e>b;e+=c)d.push(new Sk.builtin.int_(e));return new Sk.builtin.list(d)};
+Sk.builtin.asnum$=function(a){return void 0===a||null===a?a:a instanceof Sk.builtin.none?null:a instanceof Sk.builtin.bool?a.v?1:0:"number"===typeof a?a:"string"===typeof a?a:a instanceof Sk.builtin.int_?a.v:a instanceof Sk.builtin.float_?a.v:a instanceof Sk.builtin.lng?a.cantBeInt()?a.str$(10,!0):a.toInt$():a.constructor===Sk.builtin.biginteger?0<a.trueCompare(new Sk.builtin.biginteger(Sk.builtin.int_.threshold$))||0>a.trueCompare(new Sk.builtin.biginteger(-Sk.builtin.int_.threshold$))?a.toString():
+a.intValue():a};goog.exportSymbol("Sk.builtin.asnum$",Sk.builtin.asnum$);Sk.builtin.assk$=function(a){return 0===a%1?new Sk.builtin.int_(a):new Sk.builtin.float_(a)};goog.exportSymbol("Sk.builtin.assk$",Sk.builtin.assk$);
+Sk.builtin.asnum$nofloat=function(a){var b,c;if(void 0===a||null===a)return a;if(a.constructor===Sk.builtin.none)return null;if(a.constructor===Sk.builtin.bool)return a.v?1:0;"number"===typeof a&&(a=a.toString());a.constructor===Sk.builtin.int_&&(a=a.v.toString());a.constructor===Sk.builtin.float_&&(a=a.v.toString());a.constructor===Sk.builtin.lng&&(a=a.str$(10,!0));a.constructor===Sk.builtin.biginteger&&(a=a.toString());if(0>a.indexOf(".")&&0>a.indexOf("e")&&0>a.indexOf("E"))return a;c=0;0<=a.indexOf("e")?
+(b=a.substr(0,a.indexOf("e")),c=a.substr(a.indexOf("e")+1)):0<=a.indexOf("E")?(b=a.substr(0,a.indexOf("e")),c=a.substr(a.indexOf("E")+1)):b=a;c=parseInt(c,10);a=b.indexOf(".");if(0>a){if(0<=c){for(;0<c--;)b+="0";return b}return b.length>-c?b.substr(0,b.length+c):0}b=0===a?b.substr(1):a<b.length?b.substr(0,a)+b.substr(a+1):b.substr(0,a);for(a+=c;a>b.length;)b+="0";return b=0>=a?0:b.substr(0,a)};goog.exportSymbol("Sk.builtin.asnum$nofloat",Sk.builtin.asnum$nofloat);
+Sk.builtin.round=function(a,b){var c;Sk.builtin.pyCheckArgs("round",arguments,1,2);if(!Sk.builtin.checkNumber(a))throw new Sk.builtin.TypeError("a float is required");if(void 0!==b&&!Sk.misceval.isIndex(b))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object cannot be interpreted as an index");void 0===b&&(b=0);if(a.__round__)return a.__round__(a,b);c=Sk.abstr.lookupSpecial(a,"__round__");if(null!=c)return Sk.misceval.callsim(c,a,b)};
+Sk.builtin.len=function(a){Sk.builtin.pyCheckArgs("len",arguments,1,1);if(a.sq$length)return new Sk.builtin.int_(a.sq$length());if(a.mp$length)return new Sk.builtin.int_(a.mp$length());if(a.tp$length)return new Sk.builtin.int_(a.tp$length());throw new Sk.builtin.TypeError("object of type '"+Sk.abstr.typeName(a)+"' has no len()");};
+Sk.builtin.min=function(){var a,b,c;Sk.builtin.pyCheckArgs("min",arguments,1);c=Sk.misceval.arrayFromArguments(arguments);b=c[0];if(void 0===b)throw new Sk.builtin.ValueError("min() arg is an empty sequence");for(a=1;a<c.length;++a)Sk.misceval.richCompareBool(c[a],b,"Lt")&&(b=c[a]);return b};
+Sk.builtin.max=function(){var a,b,c;Sk.builtin.pyCheckArgs("max",arguments,1);c=Sk.misceval.arrayFromArguments(arguments);b=c[0];if(void 0===b)throw new Sk.builtin.ValueError("max() arg is an empty sequence");for(a=1;a<c.length;++a)Sk.misceval.richCompareBool(c[a],b,"Gt")&&(b=c[a]);return b};
+Sk.builtin.any=function(a){var b,c;Sk.builtin.pyCheckArgs("any",arguments,1,1);if(!Sk.builtin.checkIterable(a))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not iterable");b=Sk.abstr.iter(a);for(c=b.tp$iternext();void 0!==c;c=b.tp$iternext())if(Sk.misceval.isTrue(c))return Sk.builtin.bool.true$;return Sk.builtin.bool.false$};
+Sk.builtin.all=function(a){var b,c;Sk.builtin.pyCheckArgs("all",arguments,1,1);if(!Sk.builtin.checkIterable(a))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not iterable");b=Sk.abstr.iter(a);for(c=b.tp$iternext();void 0!==c;c=b.tp$iternext())if(!Sk.misceval.isTrue(c))return Sk.builtin.bool.false$;return Sk.builtin.bool.true$};
+Sk.builtin.sum=function(a,b){var c,d,e,f,g;Sk.builtin.pyCheckArgs("sum",arguments,1,2);Sk.builtin.pyCheckType("iter","iterable",Sk.builtin.checkIterable(a));if(void 0!==b&&Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("sum() can't sum strings [use ''.join(seq) instead]");c=void 0===b?new Sk.builtin.int_(0):b;e=Sk.abstr.iter(a);for(f=e.tp$iternext();void 0!==f;f=e.tp$iternext()){f instanceof Sk.builtin.float_?(g=!0,c instanceof Sk.builtin.float_||(c=new Sk.builtin.float_(Sk.builtin.asnum$(c)))):
+f instanceof Sk.builtin.lng&&(g||c instanceof Sk.builtin.lng||(c=new Sk.builtin.lng(c)));if(void 0!==c.nb$add&&(d=c.nb$add(f),void 0!==d&&d!==Sk.builtin.NotImplemented.NotImplemented$)){c=c.nb$add(f);continue}throw new Sk.builtin.TypeError("unsupported operand type(s) for +: '"+Sk.abstr.typeName(c)+"' and '"+Sk.abstr.typeName(f)+"'");}return c};
+Sk.builtin.zip=function(){var a,b,c,d,e,f;if(0===arguments.length)return new Sk.builtin.list([]);f=[];for(e=0;e<arguments.length;e++)if(Sk.builtin.checkIterable(arguments[e]))f.push(Sk.abstr.iter(arguments[e]));else throw new Sk.builtin.TypeError("argument "+e+" must support iteration");d=[];for(c=!1;!c;){b=[];for(e=0;e<arguments.length;e++){a=f[e].tp$iternext();if(void 0===a){c=!0;break}b.push(a)}c||d.push(new Sk.builtin.tuple(b))}return new Sk.builtin.list(d)};
+Sk.builtin.abs=function(a){Sk.builtin.pyCheckArgs("abs",arguments,1,1);if(a instanceof Sk.builtin.int_)return new Sk.builtin.int_(Math.abs(a.v));if(a instanceof Sk.builtin.float_)return new Sk.builtin.float_(Math.abs(a.v));if(Sk.builtin.checkNumber(a))return Sk.builtin.assk$(Math.abs(Sk.builtin.asnum$(a)));if(Sk.builtin.checkComplex(a))return Sk.misceval.callsim(a.__abs__,a);if(a.tp$getattr){var b=a.tp$getattr("__abs__");return Sk.misceval.callsim(b)}throw new TypeError("bad operand type for abs(): '"+
+Sk.abstr.typeName(a)+"'");};Sk.builtin.ord=function(a){Sk.builtin.pyCheckArgs("ord",arguments,1,1);if(!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError("ord() expected a string of length 1, but "+Sk.abstr.typeName(a)+" found");if(1!==a.v.length)throw new Sk.builtin.TypeError("ord() expected a character, but string of length "+a.v.length+" found");return new Sk.builtin.int_(a.v.charCodeAt(0))};
+Sk.builtin.chr=function(a){Sk.builtin.pyCheckArgs("chr",arguments,1,1);if(!Sk.builtin.checkInt(a))throw new Sk.builtin.TypeError("an integer is required");a=Sk.builtin.asnum$(a);if(0>a||255<a)throw new Sk.builtin.ValueError("chr() arg not in range(256)");return new Sk.builtin.str(String.fromCharCode(a))};
+Sk.builtin.unichr=function(a){Sk.builtin.pyCheckArgs("chr",arguments,1,1);if(!Sk.builtin.checkInt(a))throw new Sk.builtin.TypeError("an integer is required");a=Sk.builtin.asnum$(a);try{return new Sk.builtin.str(String.fromCodePoint(a))}catch(b){if(b instanceof RangeError)throw new Sk.builtin.ValueError(b.message);throw b;}};
+Sk.builtin.int2str_=function(a,b,c){var d,e="";if(a instanceof Sk.builtin.lng)return d="",2!==b&&(d="L"),e=a.str$(b,!1),a.nb$isnegative()?new Sk.builtin.str("-"+c+e+d):new Sk.builtin.str(c+e+d);a=Sk.misceval.asIndex(a);e=a.toString(b);return 0>a?new Sk.builtin.str("-"+c+e.slice(1)):new Sk.builtin.str(c+e)};
+Sk.builtin.hex=function(a){Sk.builtin.pyCheckArgs("hex",arguments,1,1);if(!Sk.misceval.isIndex(a))throw new Sk.builtin.TypeError("hex() argument can't be converted to hex");return Sk.builtin.int2str_(a,16,"0x")};Sk.builtin.oct=function(a){Sk.builtin.pyCheckArgs("oct",arguments,1,1);if(!Sk.misceval.isIndex(a))throw new Sk.builtin.TypeError("oct() argument can't be converted to hex");return Sk.builtin.int2str_(a,8,"0")};
+Sk.builtin.bin=function(a){Sk.builtin.pyCheckArgs("bin",arguments,1,1);if(!Sk.misceval.isIndex(a))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object can't be interpreted as an index");return Sk.builtin.int2str_(a,2,"0b")};
+Sk.builtin.dir=function(a){var b,c,d,e,f,g,h;Sk.builtin.pyCheckArgs("dir",arguments,1,1);h=function(a){var b=null;if(-1!=="__bases__ __mro__ __class__ __name__ GenericGetAttr GenericSetAttr GenericPythonGetAttr GenericPythonSetAttr pythonFunctions HashNotImplemented constructor".split(" ").indexOf(a))return null;-1!==a.indexOf("$")?b=Sk.builtin.dir.slotNameToRichName(a):"_"!==a.charAt(a.length-1)?b=a:"_"===a.charAt(0)&&(b=a);return b};g=[];b=Sk.abstr.lookupSpecial(a,"__dir__");if(null!=b){c=Sk.misceval.callsim(b,
+a);if(!Sk.builtin.checkSequence(c))throw new Sk.builtin.TypeError("__dir__ must return sequence.");c=Sk.ffi.remapToJs(c);for(e=0;e<c.length;++e)g.push(new Sk.builtin.str(c[e]))}else{for(e in a.constructor.prototype)(f=h(e))&&g.push(new Sk.builtin.str(f));if(a.$d)if(a.$d.tp$iter)for(b=a.$d.tp$iter(),e=b.tp$iternext();void 0!==e;e=b.tp$iternext())f=new Sk.builtin.str(e),(f=h(f.v))&&g.push(new Sk.builtin.str(f));else for(f in a.$d)g.push(new Sk.builtin.str(f));d=a.tp$mro;!d&&a.ob$type&&(d=a.ob$type.tp$mro);
+if(d)for(e=0;e<d.v.length;++e)for(c in b=d.v[e],b)b.hasOwnProperty(c)&&(f=h(c))&&g.push(new Sk.builtin.str(f))}g.sort(function(a,b){return(a.v>b.v)-(a.v<b.v)});return new Sk.builtin.list(g.filter(function(a,b,c){return a!==c[b+1]}))};Sk.builtin.dir.slotNameToRichName=function(a){};Sk.builtin.repr=function(a){Sk.builtin.pyCheckArgs("repr",arguments,1,1);return Sk.misceval.objectRepr(a)};
+Sk.builtin.open=function(a,b,c){Sk.builtin.pyCheckArgs("open",arguments,1,3);void 0===b&&(b=new Sk.builtin.str("r"));return new Sk.builtin.file(a,b,c)};
+Sk.builtin.isinstance=function(a,b){var c,d;Sk.builtin.pyCheckArgs("isinstance",arguments,2,2);if(!(Sk.builtin.checkClass(b)||b instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError("isinstance() arg 2 must be a class, type, or tuple of classes and types");if(b===Sk.builtin.none.prototype.ob$type)return a instanceof Sk.builtin.none?Sk.builtin.bool.true$:Sk.builtin.bool.false$;if(a.ob$type===b)return Sk.builtin.bool.true$;if(b instanceof Sk.builtin.tuple){for(d=0;d<b.v.length;++d)if(Sk.misceval.isTrue(Sk.builtin.isinstance(a,
+b.v[d])))return Sk.builtin.bool.true$;return Sk.builtin.bool.false$}if(a instanceof b)return Sk.builtin.bool.true$;c=function(a,b){var d,h;if(a===b)return Sk.builtin.bool.true$;if(void 0===a.$d)return Sk.builtin.bool.false$;h=a.$d.mp$subscript(Sk.builtin.type.basesStr_);for(d=0;d<h.v.length;++d)if(Sk.misceval.isTrue(c(h.v[d],b)))return Sk.builtin.bool.true$;return Sk.builtin.bool.false$};return c(a.ob$type,b)};
+Sk.builtin.hash=function(a){Sk.builtin.pyCheckArgs("hash",arguments,1,1);if(a instanceof Object){if(Sk.builtin.checkNone(a.tp$hash))throw new Sk.builtin.TypeError(new Sk.builtin.str("unhashable type: '"+Sk.abstr.typeName(a)+"'"));if(void 0!==a.tp$hash){if(a.$savedHash_)return a.$savedHash_;a.$savedHash_=a.tp$hash();return a.$savedHash_}void 0===a.__id&&(Sk.builtin.hashCount+=1,a.__id=Sk.builtin.hashCount);return new Sk.builtin.int_(a.__id)}if("number"===typeof a||null===a||!0===a||!1===a)throw new Sk.builtin.TypeError("unsupported Javascript type");
+return new Sk.builtin.str(typeof a+" "+String(a))};Sk.builtin.getattr=function(a,b,c){var d;Sk.builtin.pyCheckArgs("getattr",arguments,2,3);if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("attribute name must be string");d=a.tp$getattr(b.v);if(void 0===d){if(void 0!==c)return c;throw new Sk.builtin.AttributeError("'"+Sk.abstr.typeName(a)+"' object has no attribute '"+b.v+"'");}return d};
+Sk.builtin.setattr=function(a,b,c){Sk.builtin.pyCheckArgs("setattr",arguments,3,3);if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("attribute name must be string");if(a.tp$setattr)a.tp$setattr(Sk.ffi.remapToJs(b),c);else throw new Sk.builtin.AttributeError("object has no attribute "+Sk.ffi.remapToJs(b));return Sk.builtin.none.none$};
+Sk.builtin.raw_input=function(a){var b=Sk.importModule("sys");a&&Sk.misceval.callsimOrSuspend(b.$d.stdout.write,b.$d.stdout,new Sk.builtin.str(a));return Sk.misceval.callsimOrSuspend(b.$d.stdin.readline,b.$d.stdin)};Sk.builtin.input=Sk.builtin.raw_input;Sk.builtin.jseval=function(a){goog.global.eval(a)};Sk.builtin.jsmillis=function(){return(new Date).valueOf()};
+Sk.builtin.superbi=function(){throw new Sk.builtin.NotImplementedError("super is not yet implemented, please report your use case as a github issue.");};Sk.builtin.eval_=function(){throw new Sk.builtin.NotImplementedError("eval is not yet implemented");};
+Sk.builtin.map=function(a,b){var c,d,e,f,g,h;Sk.builtin.pyCheckArgs("map",arguments,2);if(2<arguments.length){h=[];g=Array.prototype.slice.apply(arguments).slice(1);for(f in g){if(!Sk.builtin.checkIterable(g[f]))throw c=parseInt(f,10)+2,new Sk.builtin.TypeError("argument "+c+" to map() must support iteration");g[f]=Sk.abstr.iter(g[f])}for(;;){e=[];d=0;for(f in g)c=g[f].tp$iternext(),void 0===c?(e.push(Sk.builtin.none.none$),d++):e.push(c);if(d!==g.length)h.push(e);else break}b=new Sk.builtin.list(h)}if(!Sk.builtin.checkIterable(b))throw new Sk.builtin.TypeError("'"+
+Sk.abstr.typeName(b)+"' object is not iterable");e=[];c=Sk.abstr.iter(b);for(d=c.tp$iternext();void 0!==d;d=c.tp$iternext())a===Sk.builtin.none.none$?(d instanceof Array&&(d=new Sk.builtin.tuple(d)),e.push(d)):(d instanceof Array||(d=[d]),e.push(Sk.misceval.apply(a,void 0,void 0,void 0,d)));return new Sk.builtin.list(e)};
+Sk.builtin.reduce=function(a,b,c){var d,e,f;Sk.builtin.pyCheckArgs("reduce",arguments,2,3);if(!Sk.builtin.checkIterable(b))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object is not iterable");f=Sk.abstr.iter(b);if(void 0===c&&(c=f.tp$iternext(),void 0===c))throw new Sk.builtin.TypeError("reduce() of empty sequence with no initial value");e=c;for(d=f.tp$iternext();void 0!==d;d=f.tp$iternext())e=Sk.misceval.callsim(a,e,d);return e};
+Sk.builtin.filter=function(a,b){var c,d,e,f,g,h;Sk.builtin.pyCheckArgs("filter",arguments,2,2);if(!Sk.builtin.checkIterable(b))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object is not iterable");c=function(){return[]};h=function(a,b){a.push(b);return a};g=function(a){return new Sk.builtin.list(a)};b.__class__===Sk.builtin.str?(c=function(){return new Sk.builtin.str("")},h=function(a,b){return a.sq$concat(b)},g=function(a){return a}):b.__class__===Sk.builtin.tuple&&(g=function(a){return new Sk.builtin.tuple(a)});
+f=c();d=Sk.abstr.iter(b);for(e=d.tp$iternext();void 0!==e;e=d.tp$iternext())c=a===Sk.builtin.none.none$?new Sk.builtin.bool(e):Sk.misceval.callsim(a,e),Sk.misceval.isTrue(c)&&(f=h(f,e));return g(f)};
+Sk.builtin.hasattr=function(a,b){Sk.builtin.pyCheckArgs("hasattr",arguments,2,2);if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("hasattr(): attribute name must be string");if(a.tp$getattr)return a.tp$getattr(b.v)?Sk.builtin.bool.true$:Sk.builtin.bool.false$;throw new Sk.builtin.AttributeError("Object has no tp$getattr method");};
+Sk.builtin.pow=function(a,b,c){var d,e;Sk.builtin.pyCheckArgs("pow",arguments,2,3);c instanceof Sk.builtin.none&&(c=void 0);if(Sk.builtin.checkComplex(a))return a.nb$power(b,c);d=Sk.builtin.asnum$(a);e=Sk.builtin.asnum$(b);Sk.builtin.asnum$(c);if(!Sk.builtin.checkNumber(a)||!Sk.builtin.checkNumber(b)){if(void 0===c)throw new Sk.builtin.TypeError("unsupported operand type(s) for pow(): '"+Sk.abstr.typeName(a)+"' and '"+Sk.abstr.typeName(b)+"'");throw new Sk.builtin.TypeError("unsupported operand type(s) for pow(): '"+
+Sk.abstr.typeName(a)+"', '"+Sk.abstr.typeName(b)+"', '"+Sk.abstr.typeName(c)+"'");}if(0>d&&b instanceof Sk.builtin.float_)throw new Sk.builtin.ValueError("negative number cannot be raised to a fractional power");if(void 0===c){if(a instanceof Sk.builtin.float_||b instanceof Sk.builtin.float_||0>e)return new Sk.builtin.float_(Math.pow(d,e));d=new Sk.builtin.int_(d);e=new Sk.builtin.int_(e);d=d.nb$power(e);return a instanceof Sk.builtin.lng||b instanceof Sk.builtin.lng?new Sk.builtin.lng(d):d}if(!Sk.builtin.checkInt(a)||
+!Sk.builtin.checkInt(b)||!Sk.builtin.checkInt(c))throw new Sk.builtin.TypeError("pow() 3rd argument not allowed unless all arguments are integers");if(0>e)throw new Sk.builtin.TypeError("pow() 2nd argument cannot be negative when 3rd argument specified");return a instanceof Sk.builtin.lng||(b instanceof Sk.builtin.lng||c instanceof Sk.builtin.lng)||Infinity===Math.pow(d,e)?(a=new Sk.builtin.lng(a),a.nb$power(b,c)):(new Sk.builtin.int_(Math.pow(d,e))).nb$remainder(c)};
+Sk.builtin.quit=function(a){a=(new Sk.builtin.str(a)).v;throw new Sk.builtin.SystemExit(a);};
+Sk.builtin.issubclass=function(a,b){var c,d;Sk.builtin.pyCheckArgs("issubclass",arguments,2,2);if(!(Sk.builtin.checkClass(b)||b instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError("issubclass() arg 2 must be a classinfo, type, or tuple of classes and types");d=function(a,b){var c,h;if(a===b)return!0;if(void 0!==a.$d&&a.$d.mp$subscript)h=a.$d.mp$subscript(Sk.builtin.type.basesStr_);else return!1;for(c=0;c<h.v.length;++c)if(d(h.v[c],b))return!0;return!1};if(Sk.builtin.checkClass(b))return a===
+b?!0:d(a,b);if(b instanceof Sk.builtin.tuple){for(c=0;c<b.v.length;++c)if(Sk.builtin.issubclass(a,b.v[c]))return!0;return!1}};Sk.builtin.globals=function(){var a,b=new Sk.builtin.dict([]);for(a in Sk.globals)b.mp$ass_subscript(new Sk.builtin.str(a),Sk.globals[a]);return b};Sk.builtin.divmod=function(a,b){return Sk.abstr.numberBinOp(a,b,"DivMod")};Sk.builtin.format=function(a,b){Sk.builtin.pyCheckArgs("format",arguments,1,2);return Sk.abstr.objectFormat(a,b)};
+Sk.builtin.reversed=function(a){Sk.builtin.pyCheckArgs("reversed",arguments,1,1);var b=Sk.abstr.lookupSpecial(a,"__reversed__");if(null!=b)return Sk.misceval.callsim(b,a);if(!Sk.builtin.checkSequence(a))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not a sequence");return new function(a){this.idx=a.sq$length()-1;this.myobj=a;this.getitem=Sk.abstr.lookupSpecial(a,"__getitem__");this.tp$iter=function(){return this};this.tp$iternext=function(){var a;if(!(0>this.idx)){try{a=Sk.misceval.callsim(this.getitem,
+this.myobj,Sk.ffi.remapToPy(this.idx))}catch(b){if(b instanceof Sk.builtin.IndexError)return;throw b;}this.idx--;return a}}}(a)};Sk.builtin.bytearray=function(){throw new Sk.builtin.NotImplementedError("bytearray is not yet implemented");};Sk.builtin.callable=function(){throw new Sk.builtin.NotImplementedError("callable is not yet implemented");};Sk.builtin.delattr=function(){throw new Sk.builtin.NotImplementedError("delattr is not yet implemented");};
+Sk.builtin.execfile=function(){throw new Sk.builtin.NotImplementedError("execfile is not yet implemented");};Sk.builtin.frozenset=function(){throw new Sk.builtin.NotImplementedError("frozenset is not yet implemented");};Sk.builtin.help=function(){throw new Sk.builtin.NotImplementedError("help is not yet implemented");};Sk.builtin.iter=function(){throw new Sk.builtin.NotImplementedError("iter is not yet implemented");};
+Sk.builtin.locals=function(){throw new Sk.builtin.NotImplementedError("locals is not yet implemented");};Sk.builtin.memoryview=function(){throw new Sk.builtin.NotImplementedError("memoryview is not yet implemented");};Sk.builtin.next_=function(){throw new Sk.builtin.NotImplementedError("next is not yet implemented");};Sk.builtin.property=function(){throw new Sk.builtin.NotImplementedError("property is not yet implemented");};
+Sk.builtin.reload=function(){throw new Sk.builtin.NotImplementedError("reload is not yet implemented");};Sk.builtin.vars=function(){throw new Sk.builtin.NotImplementedError("vars is not yet implemented");};Sk.builtin.xrange=Sk.builtin.range;Sk.builtin.apply_=function(){throw new Sk.builtin.NotImplementedError("apply is not yet implemented");};Sk.builtin.buffer=function(){throw new Sk.builtin.NotImplementedError("buffer is not yet implemented");};
+Sk.builtin.coerce=function(){throw new Sk.builtin.NotImplementedError("coerce is not yet implemented");};Sk.builtin.intern=function(){throw new Sk.builtin.NotImplementedError("intern is not yet implemented");};String.fromCodePoint||function(){var a=function(){var a;try{var b={},c=Object.defineProperty;a=c(b,"foo",b)&&c}catch(d){}return a}(),b=String.fromCharCode,c=Math.floor,d=function(a){var d=[],g,h,k=-1,l=arguments.length;if(!l)return"";for(var m="";++k<l;){h=Number(arguments[k]);if(!isFinite(h)||0>h||1114111<h||c(h)!=h)throw RangeError("Invalid code point: "+h);65535>=h?d.push(h):(h-=65536,g=(h>>10)+55296,h=h%1024+56320,d.push(g,h));if(k+1==l||16384<d.length)m+=b.apply(null,d),d.length=0}return m};
+a?a(String,"fromCodePoint",{value:d,configurable:!0,writable:!0}):String.fromCodePoint=d}();Sk.builtin.BaseException=function(a){var b;if(!(this instanceof Sk.builtin.BaseException))return b=Object.create(Sk.builtin.BaseException.prototype),b.constructor.apply(b,arguments),b;a=Array.prototype.slice.call(arguments);for(b=0;b<a.length;++b)"string"===typeof a[b]&&(a[b]=new Sk.builtin.str(a[b]));this.args=new Sk.builtin.tuple(a);this.traceback=[];3<=this.args.sq$length()&&this.traceback.push({lineno:this.args.v[2],filename:this.args.v[1].v||"<unknown>"})};
+Sk.abstr.setUpInheritance("BaseException",Sk.builtin.BaseException,Sk.builtin.object);Sk.builtin.BaseException.prototype.tp$str=function(){var a,b;b=""+this.tp$name;this.args&&(b+=": "+(0<this.args.v.length?this.args.v[0].v:""));b=0!==this.traceback.length?b+(" on line "+this.traceback[0].lineno):b+" at <unknown>";if(4<this.args.v.length){b+="\n"+this.args.v[4].v+"\n";for(a=0;a<this.args.v[3];++a)b+=" ";b+="^\n"}return new Sk.builtin.str(b)};Sk.builtin.BaseException.prototype.toString=function(){return this.tp$str().v};
+goog.exportSymbol("Sk.builtin.BaseException",Sk.builtin.BaseException);Sk.builtin.Exception=function(a){var b;if(!(this instanceof Sk.builtin.Exception))return b=Object.create(Sk.builtin.Exception.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.BaseException.apply(this,arguments)};Sk.abstr.setUpInheritance("Exception",Sk.builtin.Exception,Sk.builtin.BaseException);goog.exportSymbol("Sk.builtin.Exception",Sk.builtin.Exception);
+Sk.builtin.StandardError=function(a){var b;if(!(this instanceof Sk.builtin.StandardError))return b=Object.create(Sk.builtin.StandardError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("StandardError",Sk.builtin.StandardError,Sk.builtin.Exception);goog.exportSymbol("Sk.builtin.StandardError",Sk.builtin.StandardError);
+Sk.builtin.AssertionError=function(a){var b;if(!(this instanceof Sk.builtin.AssertionError))return b=Object.create(Sk.builtin.AssertionError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("AssertionError",Sk.builtin.AssertionError,Sk.builtin.StandardError);goog.exportSymbol("Sk.builtin.AssertionError",Sk.builtin.AssertionError);
+Sk.builtin.AttributeError=function(a){var b;if(!(this instanceof Sk.builtin.AttributeError))return b=Object.create(Sk.builtin.AttributeError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("AttributeError",Sk.builtin.AttributeError,Sk.builtin.StandardError);
+Sk.builtin.ImportError=function(a){var b;if(!(this instanceof Sk.builtin.ImportError))return b=Object.create(Sk.builtin.ImportError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("ImportError",Sk.builtin.ImportError,Sk.builtin.StandardError);
+Sk.builtin.IndentationError=function(a){var b;if(!(this instanceof Sk.builtin.IndentationError))return b=Object.create(Sk.builtin.IndentationError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("IndentationError",Sk.builtin.IndentationError,Sk.builtin.StandardError);
+Sk.builtin.IndexError=function(a){var b;if(!(this instanceof Sk.builtin.IndexError))return b=Object.create(Sk.builtin.IndexError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("IndexError",Sk.builtin.IndexError,Sk.builtin.StandardError);
+Sk.builtin.KeyError=function(a){var b;if(!(this instanceof Sk.builtin.KeyError))return b=Object.create(Sk.builtin.KeyError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("KeyError",Sk.builtin.KeyError,Sk.builtin.StandardError);
+Sk.builtin.NameError=function(a){var b;if(!(this instanceof Sk.builtin.NameError))return b=Object.create(Sk.builtin.NameError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("NameError",Sk.builtin.NameError,Sk.builtin.StandardError);
+Sk.builtin.UnboundLocalError=function(a){var b;if(!(this instanceof Sk.builtin.UnboundLocalError))return b=Object.create(Sk.builtin.UnboundLocalError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("UnboundLocalError",Sk.builtin.UnboundLocalError,Sk.builtin.StandardError);
+Sk.builtin.OverflowError=function(a){var b;if(!(this instanceof Sk.builtin.OverflowError))return b=Object.create(Sk.builtin.OverflowError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("OverflowError",Sk.builtin.OverflowError,Sk.builtin.StandardError);
+Sk.builtin.ParseError=function(a){var b;if(!(this instanceof Sk.builtin.ParseError))return b=Object.create(Sk.builtin.ParseError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("ParseError",Sk.builtin.ParseError,Sk.builtin.StandardError);
+Sk.builtin.RuntimeError=function(a){var b;if(!(this instanceof Sk.builtin.RuntimeError))return b=Object.create(Sk.builtin.RuntimeError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("RuntimeError",Sk.builtin.RuntimeError,Sk.builtin.StandardError);goog.exportSymbol("Sk.builtin.RuntimeError",Sk.builtin.RuntimeError);
+Sk.builtin.SuspensionError=function(a){var b;if(!(this instanceof Sk.builtin.SuspensionError))return b=Object.create(Sk.builtin.SuspensionError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("SuspensionError",Sk.builtin.SuspensionError,Sk.builtin.StandardError);goog.exportSymbol("Sk.builtin.SuspensionError",Sk.builtin.SuspensionError);
+Sk.builtin.SystemExit=function(a){var b;if(!(this instanceof Sk.builtin.SystemExit))return b=Object.create(Sk.builtin.SystemExit.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.BaseException.apply(this,arguments)};Sk.abstr.setUpInheritance("SystemExit",Sk.builtin.SystemExit,Sk.builtin.BaseException);goog.exportSymbol("Sk.builtin.SystemExit",Sk.builtin.SystemExit);
+Sk.builtin.SyntaxError=function(a){var b;if(!(this instanceof Sk.builtin.SyntaxError))return b=Object.create(Sk.builtin.SyntaxError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("SyntaxError",Sk.builtin.SyntaxError,Sk.builtin.StandardError);
+Sk.builtin.TokenError=function(a){var b;if(!(this instanceof Sk.builtin.TokenError))return b=Object.create(Sk.builtin.TokenError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("TokenError",Sk.builtin.TokenError,Sk.builtin.StandardError);
+Sk.builtin.TypeError=function(a){var b;if(!(this instanceof Sk.builtin.TypeError))return b=Object.create(Sk.builtin.TypeError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("TypeError",Sk.builtin.TypeError,Sk.builtin.StandardError);goog.exportSymbol("Sk.builtin.TypeError",Sk.builtin.TypeError);
+Sk.builtin.ValueError=function(a){var b;if(!(this instanceof Sk.builtin.ValueError))return b=Object.create(Sk.builtin.ValueError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("ValueError",Sk.builtin.ValueError,Sk.builtin.StandardError);goog.exportSymbol("Sk.builtin.ValueError",Sk.builtin.ValueError);
+Sk.builtin.ZeroDivisionError=function(a){var b;if(!(this instanceof Sk.builtin.ZeroDivisionError))return b=Object.create(Sk.builtin.ZeroDivisionError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("ZeroDivisionError",Sk.builtin.ZeroDivisionError,Sk.builtin.StandardError);
+Sk.builtin.TimeLimitError=function(a){var b;if(!(this instanceof Sk.builtin.TimeLimitError))return b=Object.create(Sk.builtin.TimeLimitError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("TimeLimitError",Sk.builtin.TimeLimitError,Sk.builtin.StandardError);goog.exportSymbol("Sk.builtin.TimeLimitError",Sk.builtin.TimeLimitError);
+Sk.builtin.IOError=function(a){var b;if(!(this instanceof Sk.builtin.IOError))return b=Object.create(Sk.builtin.IOError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("IOError",Sk.builtin.IOError,Sk.builtin.StandardError);goog.exportSymbol("Sk.builtin.IOError",Sk.builtin.IOError);
+Sk.builtin.NotImplementedError=function(a){var b;if(!(this instanceof Sk.builtin.NotImplementedError))return b=Object.create(Sk.builtin.NotImplementedError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("NotImplementedError",Sk.builtin.NotImplementedError,Sk.builtin.StandardError);goog.exportSymbol("Sk.builtin.NotImplementedError",Sk.builtin.NotImplementedError);
+Sk.builtin.NegativePowerError=function(a){var b;if(!(this instanceof Sk.builtin.NegativePowerError))return b=Object.create(Sk.builtin.NegativePowerError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("NegativePowerError",Sk.builtin.NegativePowerError,Sk.builtin.StandardError);goog.exportSymbol("Sk.builtin.NegativePowerError",Sk.builtin.NegativePowerError);
+Sk.builtin.ExternalError=function(a,b){var c;if(!(this instanceof Sk.builtin.ExternalError))return c=Object.create(Sk.builtin.ExternalError.prototype),c.constructor.apply(c,arguments),c;b=Array.prototype.slice.call(arguments);this.nativeError=b[0];b[0]instanceof Sk.builtin.str||(b[0]=""+b[0]);Sk.builtin.StandardError.apply(this,b)};Sk.abstr.setUpInheritance("ExternalError",Sk.builtin.ExternalError,Sk.builtin.StandardError);goog.exportSymbol("Sk.builtin.ExternalError",Sk.builtin.ExternalError);
+Sk.builtin.OperationError=function(a){var b;if(!(this instanceof Sk.builtin.OperationError))return b=Object.create(Sk.builtin.OperationError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("OperationError",Sk.builtin.OperationError,Sk.builtin.StandardError);goog.exportSymbol("Sk.builtin.OperationError",Sk.builtin.OperationError);
+Sk.builtin.SystemError=function(a){var b;if(!(this instanceof Sk.builtin.SystemError))return b=Object.create(Sk.builtin.SystemError.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.StandardError.apply(this,arguments)};Sk.abstr.setUpInheritance("SystemError",Sk.builtin.SystemError,Sk.builtin.StandardError);goog.exportSymbol("Sk.builtin.SystemError",Sk.builtin.SystemError);
+Sk.builtin.StopIteration=function(a){var b;if(!(this instanceof Sk.builtin.StopIteration))return b=Object.create(Sk.builtin.StopIteration.prototype),b.constructor.apply(b,arguments),b;Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("StopIteration",Sk.builtin.StopIteration,Sk.builtin.Exception);goog.exportSymbol("Sk.builtin.StopIteration",Sk.builtin.StopIteration);goog.exportSymbol("Sk",Sk);Sk.nativejs={FN_ARGS:/^function\s*[^\(]*\(\s*([^\)]*)\)/m,FN_ARG_SPLIT:/,/,FN_ARG:/^\s*(_?)(\S+?)\1\s*$/,STRIP_COMMENTS:/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,formalParameterList:function(a){var b,c,d=[];a=a.toString().replace(this.STRIP_COMMENTS,"").match(this.FN_ARGS)[1].split(this.FN_ARG_SPLIT);for(b in a)c=a[b],c.replace(this.FN_ARG,function(a,b,c){d.push(c)});return d},func:function(a){a.co_name=new Sk.builtin.str(a.name);a.co_varnames=Sk.nativejs.formalParameterList(a);return new Sk.builtin.func(a)},
+func_nokw:function(a){a.co_name=new Sk.builtin.str(a.name);a.co_varnames=Sk.nativejs.formalParameterList(a);a.no_kw=!0;return new Sk.builtin.func(a)}};goog.exportSymbol("Sk.nativejs.func",Sk.nativejs.func);goog.exportSymbol("Sk.nativejs.func_nokw",Sk.nativejs.func_nokw);Sk.builtin.method=function(a,b){this.im_func=a;this.im_self=b};goog.exportSymbol("Sk.builtin.method",Sk.builtin.method);Sk.builtin.method.prototype.tp$call=function(a,b){goog.asserts.assert(this.im_self,"should just be a function, not a method since there's no self?");goog.asserts.assert(this.im_func instanceof Sk.builtin.func);a.unshift(this.im_self);return this.im_func.tp$call(a,b)};
+Sk.builtin.method.prototype.$r=function(){return new Sk.builtin.str("<bound method "+this.im_self.ob$type.tp$name+"."+(this.im_func.func_code&&this.im_func.func_code.co_name&&this.im_func.func_code.co_name.v||"<native JS>")+" of "+this.im_self.$r().v+">")};Sk.misceval={};Sk.misceval.Suspension=function(a,b,c){this.isSuspension=!0;void 0!==a&&void 0!==b&&(this.resume=function(){return a(b.resume())});this.child=b;this.optional=void 0!==b&&b.optional;this.data=void 0===c&&void 0!==b?b.data:c};goog.exportSymbol("Sk.misceval.Suspension",Sk.misceval.Suspension);
+Sk.misceval.retryOptionalSuspensionOrThrow=function(a,b){for(;a instanceof Sk.misceval.Suspension;){if(!a.optional)throw new Sk.builtin.SuspensionError(b||"Cannot call a function that blocks or suspends here");a=a.resume()}return a};goog.exportSymbol("Sk.misceval.retryOptionalSuspensionOrThrow",Sk.misceval.retryOptionalSuspensionOrThrow);Sk.misceval.isIndex=function(a){return Sk.builtin.checkInt(a)||Sk.abstr.lookupSpecial(a,"__index__")?!0:!1};goog.exportSymbol("Sk.misceval.isIndex",Sk.misceval.isIndex);
+Sk.misceval.asIndex=function(a){var b;if(Sk.misceval.isIndex(a)&&null!==a){if(!0===a)return 1;if(!1===a)return 0;if("number"===typeof a)return a;if(a.constructor===Sk.builtin.int_)return a.v;if(a.constructor===Sk.builtin.lng)return a.tp$index();if(a.constructor===Sk.builtin.bool)return Sk.builtin.asnum$(a);if(b=Sk.abstr.lookupSpecial(a,"__index__")){a=Sk.misceval.callsim(b,a);if(!Sk.builtin.checkInt(a))throw new Sk.builtin.TypeError("__index__ returned non-(int,long) (type "+Sk.abstr.typeName(a)+
+")");return Sk.builtin.asnum$(a)}goog.asserts.fail("todo asIndex;")}};Sk.misceval.applySlice=function(a,b,c,d){return a.sq$slice&&Sk.misceval.isIndex(b)&&Sk.misceval.isIndex(c)?(b=Sk.misceval.asIndex(b),void 0===b&&(b=0),c=Sk.misceval.asIndex(c),void 0===c&&(c=1E100),Sk.abstr.sequenceGetSlice(a,b,c)):Sk.abstr.objectGetItem(a,new Sk.builtin.slice(b,c,null),d)};goog.exportSymbol("Sk.misceval.applySlice",Sk.misceval.applySlice);
+Sk.misceval.assignSlice=function(a,b,c,d,e){if(a.sq$ass_slice&&Sk.misceval.isIndex(b)&&Sk.misceval.isIndex(c))e=Sk.misceval.asIndex(b)||0,c=Sk.misceval.asIndex(c)||1E100,null===d?Sk.abstr.sequenceDelSlice(a,e,c):Sk.abstr.sequenceSetSlice(a,e,c,d);else return c=new Sk.builtin.slice(b,c),null===d?Sk.abstr.objectDelItem(a,c):Sk.abstr.objectSetItem(a,c,d,e)};goog.exportSymbol("Sk.misceval.assignSlice",Sk.misceval.assignSlice);
+Sk.misceval.arrayFromArguments=function(a){var b,c;if(1!=a.length)return a;b=a[0];b instanceof Sk.builtin.set?b=b.tp$iter().$obj:b instanceof Sk.builtin.dict&&(b=Sk.builtin.dict.prototype.keys.func_code(b));if(b instanceof Sk.builtin.list||b instanceof Sk.builtin.tuple)return b.v;if(Sk.builtin.checkIterable(b)){a=[];b=Sk.abstr.iter(b);for(c=b.tp$iternext();void 0!==c;c=b.tp$iternext())a.push(c);return a}throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object is not iterable");};
+goog.exportSymbol("Sk.misceval.arrayFromArguments",Sk.misceval.arrayFromArguments);Sk.misceval.swappedOp_={Eq:"Eq",NotEq:"NotEq",Lt:"GtE",LtE:"Gt",Gt:"LtE",GtE:"Lt",Is:"IsNot",IsNot:"Is",In_:"NotIn",NotIn:"In_"};
+Sk.misceval.richCompareBool=function(a,b,c,d){var e,f,g,h,k,l,m;goog.asserts.assert(null!==a&&void 0!==a,"passed null or undefined parameter to Sk.misceval.richCompareBool");goog.asserts.assert(null!==b&&void 0!==b,"passed null or undefined parameter to Sk.misceval.richCompareBool");m=new Sk.builtin.type(a);h=new Sk.builtin.type(b);if(m!==h&&("GtE"===c||"Gt"===c||"LtE"===c||"Lt"===c)){l=[Sk.builtin.float_.prototype.ob$type,Sk.builtin.int_.prototype.ob$type,Sk.builtin.lng.prototype.ob$type,Sk.builtin.bool.prototype.ob$type];
+k=[Sk.builtin.dict.prototype.ob$type,Sk.builtin.enumerate.prototype.ob$type,Sk.builtin.list.prototype.ob$type,Sk.builtin.str.prototype.ob$type,Sk.builtin.tuple.prototype.ob$type];f=l.indexOf(m);g=k.indexOf(m);l=l.indexOf(h);k=k.indexOf(h);if(m===Sk.builtin.none.prototype.ob$type)switch(c){case "Lt":return!0;case "LtE":return!0;case "Gt":return!1;case "GtE":return!1}if(h===Sk.builtin.none.prototype.ob$type)switch(c){case "Lt":return!1;case "LtE":return!1;case "Gt":return!0;case "GtE":return!0}if(-1!==
+f&&-1!==k)switch(c){case "Lt":return!0;case "LtE":return!0;case "Gt":return!1;case "GtE":return!1}if(-1!==g&&-1!==l)switch(c){case "Lt":return!1;case "LtE":return!1;case "Gt":return!0;case "GtE":return!0}if(-1!==g&&-1!==k)switch(c){case "Lt":return g<k;case "LtE":return g<=k;case "Gt":return g>k;case "GtE":return g>=k}}if("Is"===c)return a instanceof Sk.builtin.int_&&b instanceof Sk.builtin.int_?0===a.numberCompare(b):a instanceof Sk.builtin.float_&&b instanceof Sk.builtin.float_?0===a.numberCompare(b):
+a instanceof Sk.builtin.lng&&b instanceof Sk.builtin.lng?0===a.longCompare(b):a===b;if("IsNot"===c)return a instanceof Sk.builtin.int_&&b instanceof Sk.builtin.int_?0!==a.numberCompare(b):a instanceof Sk.builtin.float_&&b instanceof Sk.builtin.float_?0!==a.numberCompare(b):a instanceof Sk.builtin.lng&&b instanceof Sk.builtin.lng?0!==a.longCompare(b):a!==b;if("In"===c)return Sk.misceval.chain(Sk.abstr.sequenceContains(b,a,d),Sk.misceval.isTrue);if("NotIn"===c)return Sk.misceval.chain(Sk.abstr.sequenceContains(b,
+a,d),function(a){return!Sk.misceval.isTrue(a)});f={Eq:"ob$eq",NotEq:"ob$ne",Gt:"ob$gt",GtE:"ob$ge",Lt:"ob$lt",LtE:"ob$le"};g=f[c];if((d=a.constructor.prototype.hasOwnProperty(g))&&(e=a[g](b))!==Sk.builtin.NotImplemented.NotImplemented$)return Sk.misceval.isTrue(e);f=f[Sk.misceval.swappedOp_[c]];if((g=b.constructor.prototype.hasOwnProperty(f))&&(e=b[f](a))!==Sk.builtin.NotImplemented.NotImplemented$)return Sk.misceval.isTrue(e);if(a.tp$richcompare&&void 0!==(e=a.tp$richcompare(b,c))&&e!=Sk.builtin.NotImplemented.NotImplemented$||
+b.tp$richcompare&&void 0!==(e=b.tp$richcompare(a,Sk.misceval.swappedOp_[c]))&&e!=Sk.builtin.NotImplemented.NotImplemented$)return Sk.misceval.isTrue(e);h={Eq:"__eq__",NotEq:"__ne__",Gt:"__gt__",GtE:"__ge__",Lt:"__lt__",LtE:"__le__"};if((f=Sk.abstr.lookupSpecial(a,h[c]))&&!d&&(e=Sk.misceval.callsim(f,a,b),e!=Sk.builtin.NotImplemented.NotImplemented$)||(d=Sk.abstr.lookupSpecial(b,h[Sk.misceval.swappedOp_[c]]))&&!g&&(e=Sk.misceval.callsim(d,b,a),e!=Sk.builtin.NotImplemented.NotImplemented$))return Sk.misceval.isTrue(e);
+if(d=Sk.abstr.lookupSpecial(a,"__cmp__"))try{e=Sk.misceval.callsim(d,a,b);if(Sk.builtin.checkNumber(e)){e=Sk.builtin.asnum$(e);if("Eq"===c)return 0===e;if("NotEq"===c)return 0!==e;if("Lt"===c)return 0>e;if("Gt"===c)return 0<e;if("LtE"===c)return 0>=e;if("GtE"===c)return 0<=e}if(e!==Sk.builtin.NotImplemented.NotImplemented$)throw new Sk.builtin.TypeError("comparison did not return an int");}catch(p){throw new Sk.builtin.TypeError("comparison did not return an int");}if(d=Sk.abstr.lookupSpecial(b,"__cmp__"))try{e=
+Sk.misceval.callsim(d,b,a);if(Sk.builtin.checkNumber(e)){e=Sk.builtin.asnum$(e);if("Eq"===c)return 0===e;if("NotEq"===c)return 0!==e;if("Lt"===c)return 0<e;if("Gt"===c)return 0>e;if("LtE"===c)return 0<=e;if("GtE"===c)return 0>=e}if(e!==Sk.builtin.NotImplemented.NotImplemented$)throw new Sk.builtin.TypeError("comparison did not return an int");}catch(n){throw new Sk.builtin.TypeError("comparison did not return an int");}if(a instanceof Sk.builtin.none&&b instanceof Sk.builtin.none||a instanceof Sk.builtin.bool&&
+b instanceof Sk.builtin.bool){if("Eq"===c)return a.v===b.v;if("NotEq"===c)return a.v!==b.v;if("Gt"===c)return a.v>b.v;if("GtE"===c)return a.v>=b.v;if("Lt"===c)return a.v<b.v;if("LtE"===c)return a.v<=b.v}if("Eq"===c)return a instanceof Sk.builtin.str&&b instanceof Sk.builtin.str?a.v===b.v:a===b;if("NotEq"===c)return a instanceof Sk.builtin.str&&b instanceof Sk.builtin.str?a.v!==b.v:a!==b;a=Sk.abstr.typeName(a);b=Sk.abstr.typeName(b);throw new Sk.builtin.ValueError("don't know how to compare '"+a+"' and '"+
+b+"'");};goog.exportSymbol("Sk.misceval.richCompareBool",Sk.misceval.richCompareBool);
+Sk.misceval.objectRepr=function(a){goog.asserts.assert(void 0!==a,"trying to repr undefined");return null===a||a instanceof Sk.builtin.none?new Sk.builtin.str("None"):!0===a?new Sk.builtin.str("True"):!1===a?new Sk.builtin.str("False"):"number"===typeof a?new Sk.builtin.str(""+a):a.$r?a.constructor===Sk.builtin.float_?Infinity===a.v?new Sk.builtin.str("inf"):-Infinity===a.v?new Sk.builtin.str("-inf"):a.$r():a.$r():a.tp$name?new Sk.builtin.str("<"+a.tp$name+" object>"):new Sk.builtin.str("<unknown>")};
+goog.exportSymbol("Sk.misceval.objectRepr",Sk.misceval.objectRepr);Sk.misceval.opAllowsEquality=function(a){switch(a){case "LtE":case "Eq":case "GtE":return!0}return!1};goog.exportSymbol("Sk.misceval.opAllowsEquality",Sk.misceval.opAllowsEquality);
+Sk.misceval.isTrue=function(a){if(!0===a)return!0;if(!1===a||null===a||a.constructor===Sk.builtin.none||a.constructor===Sk.builtin.NotImplemented)return!1;if(a.constructor===Sk.builtin.bool)return a.v;if("number"===typeof a)return 0!==a;if(a instanceof Sk.builtin.lng)return a.nb$nonzero();if(a.constructor===Sk.builtin.int_||a.constructor===Sk.builtin.float_)return 0!==a.v;if(a.__nonzero__){a=Sk.misceval.callsim(a.__nonzero__,a);if(!Sk.builtin.checkInt(a))throw new Sk.builtin.TypeError("__nonzero__ should return an int");
+return 0!==Sk.builtin.asnum$(a)}if(a.__len__){a=Sk.misceval.callsim(a.__len__,a);if(!Sk.builtin.checkInt(a))throw new Sk.builtin.TypeError("__len__ should return an int");return 0!==Sk.builtin.asnum$(a)}return a.mp$length?0!==Sk.builtin.asnum$(a.mp$length()):a.sq$length?0!==Sk.builtin.asnum$(a.sq$length()):!0};goog.exportSymbol("Sk.misceval.isTrue",Sk.misceval.isTrue);Sk.misceval.softspace_=!1;
+Sk.misceval.print_=function(a){var b;Sk.misceval.softspace_&&("\n"!==a&&Sk.output(" "),Sk.misceval.softspace_=!1);a=new Sk.builtin.str(a);b=Sk.importModule("sys");Sk.misceval.apply(b.$d.stdout.write,void 0,void 0,void 0,[b.$d.stdout,a]);b=function(a){return"\n"===a||"\t"===a||"\r"===a};0!==a.v.length&&b(a.v[a.v.length-1])&&" "!==a.v[a.v.length-1]||(Sk.misceval.softspace_=!0)};goog.exportSymbol("Sk.misceval.print_",Sk.misceval.print_);
+Sk.misceval.loadname=function(a,b){var c;c=b[a];if(void 0!==c)return c;c=Sk.builtins[a];if(void 0!==c)return c;a=a.replace("_$rw$","");a=a.replace("_$rn$","");throw new Sk.builtin.NameError("name '"+a+"' is not defined");};goog.exportSymbol("Sk.misceval.loadname",Sk.misceval.loadname);Sk.misceval.call=function(a,b,c,d,e){e=Array.prototype.slice.call(arguments,4);return Sk.misceval.apply(a,b,c,d,e)};goog.exportSymbol("Sk.misceval.call",Sk.misceval.call);
+Sk.misceval.callAsync=function(a,b,c,d,e,f){f=Array.prototype.slice.call(arguments,5);return Sk.misceval.applyAsync(a,b,c,d,e,f)};goog.exportSymbol("Sk.misceval.callAsync",Sk.misceval.callAsync);Sk.misceval.callOrSuspend=function(a,b,c,d,e){e=Array.prototype.slice.call(arguments,4);return Sk.misceval.applyOrSuspend(a,b,c,d,e)};goog.exportSymbol("Sk.misceval.callOrSuspend",Sk.misceval.callOrSuspend);
+Sk.misceval.callsim=function(a,b){b=Array.prototype.slice.call(arguments,1);return Sk.misceval.apply(a,void 0,void 0,void 0,b)};goog.exportSymbol("Sk.misceval.callsim",Sk.misceval.callsim);Sk.misceval.callsimAsync=function(a,b,c){c=Array.prototype.slice.call(arguments,2);return Sk.misceval.applyAsync(a,b,void 0,void 0,void 0,c)};goog.exportSymbol("Sk.misceval.callsimAsync",Sk.misceval.callsimAsync);
+Sk.misceval.callsimOrSuspend=function(a,b){b=Array.prototype.slice.call(arguments,1);return Sk.misceval.applyOrSuspend(a,void 0,void 0,void 0,b)};goog.exportSymbol("Sk.misceval.callsimOrSuspend",Sk.misceval.callsimOrSuspend);Sk.misceval.apply=function(a,b,c,d,e){a=Sk.misceval.applyOrSuspend(a,b,c,d,e);return a instanceof Sk.misceval.Suspension?Sk.misceval.retryOptionalSuspensionOrThrow(a):a};goog.exportSymbol("Sk.misceval.apply",Sk.misceval.apply);
+Sk.misceval.asyncToPromise=function(a,b){return new Promise(function(c,d){try{(function g(a){try{for(var e=function(){g(a.resume())},l=function(b){try{a.data.result=b,e()}catch(c){d(c)}},m=function(b){try{a.data.error=b,e()}catch(c){d(c)}};a instanceof Sk.misceval.Suspension;){var p=b&&(b[a.data.type]||b["*"]);if(p){var n=p(a);if(n){n.then(g,d);return}}if("Sk.promise"==a.data.type){a.data.promise.then(l,m);return}if("Sk.yield"==a.data.type){Sk.setTimeout(e,0);return}if(a.optional)a=a.resume();else throw new Sk.builtin.SuspensionError("Unhandled non-optional suspension of type '"+
+a.data.type+"'");}c(a)}catch(r){d(r)}})(a())}catch(e){d(e)}})};goog.exportSymbol("Sk.misceval.asyncToPromise",Sk.misceval.asyncToPromise);Sk.misceval.applyAsync=function(a,b,c,d,e,f){return Sk.misceval.asyncToPromise(function(){return Sk.misceval.applyOrSuspend(b,c,d,e,f)},a)};goog.exportSymbol("Sk.misceval.applyAsync",Sk.misceval.applyAsync);
+Sk.misceval.chain=function(a,b){for(var c=Array(arguments.length),d=1,d=1;d<arguments.length;d++)c[d]=arguments[d];d=1;return function f(a){for(;d<c.length;){if(a instanceof Sk.misceval.Suspension)return new Sk.misceval.Suspension(f,a);a=c[d](a);d++}return a}(a)};goog.exportSymbol("Sk.misceval.chain",Sk.misceval.chain);
+Sk.misceval.tryCatch=function(a,b){var c;try{c=a()}catch(d){return b(d)}if(c instanceof Sk.misceval.Suspension){var e=new Sk.misceval.Suspension(void 0,c);e.resume=function(){return Sk.misceval.tryCatch(c.resume,b)};return e}return c};goog.exportSymbol("Sk.misceval.tryCatch",Sk.misceval.tryCatch);
+Sk.misceval.iterFor=function(a,b,c){var d=c,e=function(b){d=b;return b instanceof Sk.misceval.Break?b:a.tp$iternext(!0)};return function g(a){for(;void 0!==a;){if(a instanceof Sk.misceval.Suspension)return new Sk.misceval.Suspension(g,a);if(a===Sk.misceval.Break||a instanceof Sk.misceval.Break)return a.brValue;a=Sk.misceval.chain(b(a,d),e)}return d}(a.tp$iternext(!0))};goog.exportSymbol("Sk.misceval.iterFor",Sk.misceval.iterFor);
+Sk.misceval.Break=function(a){if(!(this instanceof Sk.misceval.Break))return new Sk.misceval.Break(a);this.brValue=a};goog.exportSymbol("Sk.misceval.Break",Sk.misceval.Break);
+Sk.misceval.applyOrSuspend=function(a,b,c,d,e){var f,g;if(null===a||a instanceof Sk.builtin.none)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not callable");if("function"===typeof a){if(a.sk$klass)return a.apply(null,[b,c,d,e,!0]);if(c)for(g=c.tp$iter(),c=g.tp$iternext();void 0!==c;c=g.tp$iternext())e.push(c);if(b)for(g=Sk.abstr.iter(b),c=g.tp$iternext();void 0!==c;c=g.tp$iternext()){if(!Sk.builtin.checkString(c))throw new Sk.builtin.TypeError("Function keywords must be strings");
+d.push(c.v);d.push(Sk.abstr.objectGetItem(b,c,!1))}if(void 0!==d&&0<d.length){if(!a.co_varnames)throw new Sk.builtin.ValueError("Keyword arguments are not supported by this function");g=a.co_numargs-a.co_varnames.length;f=e.length-g;e=e.concat(a.$defaults.slice(f));for(c=0;c<d.length;c+=2){b=a.co_varnames.indexOf(d[c]);if(-1===b)throw new Sk.builtin.TypeError("'"+d[c]+"' is an invalid keyword argument for this function");if(b<f)throw new Sk.builtin.TypeError("Argument given by name ('"+d[c]+"') and position ("+
+(b+g+1)+")");e[b+g]=d[c+1]}}return a.apply(null,e)}f=a.tp$call;if(void 0!==f){if(c)for(g=c.tp$iter(),c=g.tp$iternext();void 0!==c;c=g.tp$iternext())e.push(c);if(b)for(g=Sk.abstr.iter(b),c=g.tp$iternext();void 0!==c;c=g.tp$iternext()){if(!Sk.builtin.checkString(c))throw new Sk.builtin.TypeError("Function keywords must be strings");d.push(c.v);d.push(Sk.abstr.objectGetItem(b,c,!1))}return f.call(a,e,d,b)}f=a.__call__;if(void 0!==f)return e.unshift(a),Sk.misceval.apply(f,b,c,d,e);throw new Sk.builtin.TypeError("'"+
+Sk.abstr.typeName(a)+"' object is not callable");};goog.exportSymbol("Sk.misceval.applyOrSuspend",Sk.misceval.applyOrSuspend);Sk.misceval.buildClass=function(a,b,c,d){var e=Sk.builtin.type,f={};b(a,f,[]);f.__module__=a.__name__;a=new Sk.builtin.str(c);d=new Sk.builtin.tuple(d);b=[];for(var g in f)f.hasOwnProperty(g)&&(b.push(new Sk.builtin.str(g)),b.push(f[g]));b=new Sk.builtin.dict(b);return Sk.misceval.callsim(e,a,d,b)};goog.exportSymbol("Sk.misceval.buildClass",Sk.misceval.buildClass);Sk.builtin.seqtype=function(){throw new Sk.builtin.ExternalError("Cannot instantiate abstract Sk.builtin.seqtype class");};Sk.abstr.setUpInheritance("SequenceType",Sk.builtin.seqtype,Sk.builtin.object);Sk.builtin.seqtype.sk$abstract=!0;Sk.builtin.seqtype.prototype.__len__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("__len__",arguments,0,0,!1,!0);return new Sk.builtin.int_(a.sq$length())});
+Sk.builtin.seqtype.prototype.__iter__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("__iter__",arguments,0,0,!1,!0);return a.tp$iter()});Sk.builtin.seqtype.prototype.__contains__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("__contains__",arguments,1,1,!1,!0);return a.sq$contains(b)?Sk.builtin.bool.true$:Sk.builtin.bool.false$});Sk.builtin.seqtype.prototype.__getitem__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("__getitem__",arguments,1,1,!1,!0);return a.mp$subscript(b)});
+Sk.builtin.seqtype.prototype.__add__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("__add__",arguments,1,1,!1,!0);return a.sq$concat(b)});Sk.builtin.seqtype.prototype.__mul__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("__mul__",arguments,1,1,!1,!0);if(!Sk.misceval.isIndex(b))throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '"+Sk.abstr.typeName(b)+"'");return a.sq$repeat(b)});
+Sk.builtin.seqtype.prototype.__rmul__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("__rmul__",arguments,1,1,!1,!0);return a.sq$repeat(b)});Sk.builtin.list=function(a,b){var c,d,e;if(this instanceof Sk.builtin.list)b=b||!1;else return new Sk.builtin.list(a,b||!0);this.__class__=Sk.builtin.list;if(void 0===a)c=[];else if("[object Array]"===Object.prototype.toString.apply(a))c=a;else{if(Sk.builtin.checkIterable(a))return c=[],d=Sk.abstr.iter(a),e=this,function g(a){for(;;){if(a instanceof Sk.misceval.Suspension)return new Sk.misceval.Suspension(g,a);if(void 0===a)return e.v=c,e;c.push(a);a=d.tp$iternext(b)}}(d.tp$iternext(b));throw new Sk.builtin.TypeError("expecting Array or iterable");
+}this.v=this.v=c;return this};Sk.abstr.setUpInheritance("list",Sk.builtin.list,Sk.builtin.seqtype);Sk.abstr.markUnhashable(Sk.builtin.list);Sk.builtin.list.prototype.list_iter_=function(){var a={tp$iter:function(){return a},$obj:this,$index:0,tp$iternext:function(){return a.$index>=a.$obj.v.length?void 0:a.$obj.v[a.$index++]},tp$name:"list_iterator"};return a};
+Sk.builtin.list.prototype.list_concat_=function(a){var b,c;if(!a.__class__||a.__class__!=Sk.builtin.list)throw new Sk.builtin.TypeError("can only concatenate list to list");c=this.v.slice();for(b=0;b<a.v.length;++b)c.push(a.v[b]);return new Sk.builtin.list(c,!1)};
+Sk.builtin.list.prototype.list_extend_=function(a){var b,c;if(!Sk.builtin.checkIterable(a))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not iterable");if(this==a){c=[];a=Sk.abstr.iter(a);for(b=a.tp$iternext();void 0!==b;b=a.tp$iternext())c.push(b);this.v.push.apply(this.v,c)}else for(a=Sk.abstr.iter(a),b=a.tp$iternext();void 0!==b;b=a.tp$iternext())this.v.push(b);return this};
+Sk.builtin.list.prototype.list_del_item_=function(a){a=Sk.builtin.asnum$(a);if(0>a||a>=this.v.length)throw new Sk.builtin.IndexError("list assignment index out of range");this.list_del_slice_(a,a+1)};Sk.builtin.list.prototype.list_del_slice_=function(a,b){var c;a=Sk.builtin.asnum$(a);b=Sk.builtin.asnum$(b);c=[];c.unshift(b-a);c.unshift(a);this.v.splice.apply(this.v,c)};
+Sk.builtin.list.prototype.list_ass_item_=function(a,b){a=Sk.builtin.asnum$(a);if(0>a||a>=this.v.length)throw new Sk.builtin.IndexError("list assignment index out of range");this.v[a]=b};Sk.builtin.list.prototype.list_ass_slice_=function(a,b,c){a=Sk.builtin.asnum$(a);b=Sk.builtin.asnum$(b);if(Sk.builtin.checkIterable(c))c=(new Sk.builtin.list(c,!1)).v.slice(0);else throw new Sk.builtin.TypeError("can only assign an iterable");c.unshift(b-a);c.unshift(a);this.v.splice.apply(this.v,c)};
+Sk.builtin.list.prototype.$r=function(){var a,b,c=[];a=Sk.abstr.iter(this);for(b=a.tp$iternext();void 0!==b;b=a.tp$iternext())b===this?c.push("[...]"):c.push(Sk.misceval.objectRepr(b).v);return new Sk.builtin.str("["+c.join(", ")+"]")};
+Sk.builtin.list.prototype.tp$richcompare=function(a,b){var c,d,e,f,g;if(this===a&&Sk.misceval.opAllowsEquality(b))return!0;if(!a.__class__||a.__class__!=Sk.builtin.list)return"Eq"===b?!1:"NotEq"===b?!0:!1;g=this.v;a=a.v;f=g.length;e=a.length;for(d=0;d<f&&d<e&&(c=Sk.misceval.richCompareBool(g[d],a[d],"Eq"),c);++d);if(d>=f||d>=e)switch(b){case "Lt":return f<e;case "LtE":return f<=e;case "Eq":return f===e;case "NotEq":return f!==e;case "Gt":return f>e;case "GtE":return f>=e;default:goog.asserts.fail()}return"Eq"===
+b?!1:"NotEq"===b?!0:Sk.misceval.richCompareBool(g[d],a[d],b)};Sk.builtin.list.prototype.tp$iter=Sk.builtin.list.prototype.list_iter_;Sk.builtin.list.prototype.sq$length=function(){return this.v.length};Sk.builtin.list.prototype.sq$concat=Sk.builtin.list.prototype.list_concat_;Sk.builtin.list.prototype.nb$add=Sk.builtin.list.prototype.list_concat_;Sk.builtin.list.prototype.nb$inplace_add=Sk.builtin.list.prototype.list_extend_;
+Sk.builtin.list.prototype.sq$repeat=function(a){var b,c,d;if(!Sk.misceval.isIndex(a))throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '"+Sk.abstr.typeName(a)+"'");a=Sk.misceval.asIndex(a);d=[];for(c=0;c<a;++c)for(b=0;b<this.v.length;++b)d.push(this.v[b]);return new Sk.builtin.list(d,!1)};Sk.builtin.list.prototype.nb$multiply=Sk.builtin.list.prototype.sq$repeat;
+Sk.builtin.list.prototype.nb$inplace_multiply=function(a){var b,c,d;if(!Sk.misceval.isIndex(a))throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '"+Sk.abstr.typeName(a)+"'");a=Sk.misceval.asIndex(a);d=this.v.length;for(c=1;c<a;++c)for(b=0;b<d;++b)this.v.push(this.v[b]);return this};Sk.builtin.list.prototype.sq$ass_item=Sk.builtin.list.prototype.list_ass_item_;Sk.builtin.list.prototype.sq$del_item=Sk.builtin.list.prototype.list_del_item_;
+Sk.builtin.list.prototype.sq$ass_slice=Sk.builtin.list.prototype.list_ass_slice_;Sk.builtin.list.prototype.sq$del_slice=Sk.builtin.list.prototype.list_del_slice_;Sk.builtin.list.prototype.sq$contains=function(a){var b,c;b=this.tp$iter();for(c=b.tp$iternext();void 0!==c;c=b.tp$iternext())if(Sk.misceval.richCompareBool(c,a,"Eq"))return!0;return!1};
+Sk.builtin.list.prototype.list_subscript_=function(a){var b,c;if(Sk.misceval.isIndex(a)){if(c=Sk.misceval.asIndex(a),void 0!==c){0>c&&(c=this.v.length+c);if(0>c||c>=this.v.length)throw new Sk.builtin.IndexError("list index out of range");return this.v[c]}}else if(a instanceof Sk.builtin.slice)return b=[],a.sssiter$(this,function(a,c){b.push(c.v[a])}),new Sk.builtin.list(b,!1);throw new Sk.builtin.TypeError("list indices must be integers, not "+Sk.abstr.typeName(a));};
+Sk.builtin.list.prototype.list_ass_subscript_=function(a,b){var c,d,e;if(Sk.misceval.isIndex(a)){if(c=Sk.misceval.asIndex(a),void 0!==c){0>c&&(c=this.v.length+c);this.list_ass_item_(c,b);return}}else if(a instanceof Sk.builtin.slice){c=a.slice_indices_(this.v.length);if(1===c[2])this.list_ass_slice_(c[0],c[1],b);else{e=[];a.sssiter$(this,function(a,b){e.push(a)});d=0;if(e.length!==b.v.length)throw new Sk.builtin.ValueError("attempt to assign sequence of size "+b.v.length+" to extended slice of size "+
+e.length);for(c=0;c<e.length;++c)this.v.splice(e[c],1,b.v[d]),d+=1}return}throw new Sk.builtin.TypeError("list indices must be integers, not "+Sk.abstr.typeName(a));};
+Sk.builtin.list.prototype.list_del_subscript_=function(a){var b,c,d,e;if(Sk.misceval.isIndex(a)){if(e=Sk.misceval.asIndex(a),void 0!==e){0>e&&(e=this.v.length+e);this.list_del_item_(e);return}}else if(a instanceof Sk.builtin.slice){e=a.slice_indices_(this.v.length);1===e[2]?this.list_del_slice_(e[0],e[1]):(d=this,c=0,b=0<e[2]?1:0,a.sssiter$(this,function(a,e){d.v.splice(a-c,1);c+=b}));return}throw new Sk.builtin.TypeError("list indices must be integers, not "+typeof a);};
+Sk.builtin.list.prototype.mp$subscript=Sk.builtin.list.prototype.list_subscript_;Sk.builtin.list.prototype.mp$ass_subscript=Sk.builtin.list.prototype.list_ass_subscript_;Sk.builtin.list.prototype.mp$del_subscript=Sk.builtin.list.prototype.list_del_subscript_;Sk.builtin.list.prototype.__getitem__=new Sk.builtin.func(function(a,b){return Sk.builtin.list.prototype.list_subscript_.call(a,b)});
+Sk.builtin.list.prototype.list_sort_=function(a,b,c,d){var e,f,g,h,k=void 0!==c&&null!==c;f=void 0!==b&&null!==b;var l;if(void 0===d)l=!1;else{if(d===Sk.builtin.none.none$)throw new Sk.builtin.TypeError("an integer is required");l=Sk.misceval.isTrue(d)}d=new Sk.builtin.timSort(a);a.v=[];h=new Sk.builtin.int_(0);if(k)for(d.lt=f?function(a,c){var d=Sk.misceval.callsim(b,a[0],c[0]);return Sk.misceval.richCompareBool(d,h,"Lt")}:function(a,b){return Sk.misceval.richCompareBool(a[0],b[0],"Lt")},g=0;g<d.listlength;g++)f=
+d.list.v[g],e=Sk.misceval.callsim(c,f),d.list.v[g]=[e,f];else f&&(d.lt=function(a,c){var d=Sk.misceval.callsim(b,a,c);return Sk.misceval.richCompareBool(d,h,"Lt")});l&&d.list.list_reverse_(d.list);d.sort();l&&d.list.list_reverse_(d.list);if(k)for(c=0;c<d.listlength;c++)f=d.list.v[c][1],d.list.v[c]=f;c=0<a.sq$length();a.v=d.list.v;if(c)throw new Sk.builtin.OperationError("list modified during sort");return Sk.builtin.none.none$};
+Sk.builtin.list.prototype.list_reverse_=function(a){var b,c,d;Sk.builtin.pyCheckArgs("reverse",arguments,1,1);b=a.v.length;d=a.v;c=[];for(b-=1;-1<b;--b)c.push(d[b]);a.v=c;return Sk.builtin.none.none$};Sk.builtin.list.prototype.__iter__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("__iter__",arguments,1,1);return a.list_iter_()});Sk.builtin.list.prototype.append=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("append",arguments,2,2);a.v.push(b);return Sk.builtin.none.none$});
+Sk.builtin.list.prototype.insert=new Sk.builtin.func(function(a,b,c){Sk.builtin.pyCheckArgs("insert",arguments,3,3);if(!Sk.builtin.checkNumber(b))throw new Sk.builtin.TypeError("an integer is required");b=Sk.builtin.asnum$(b);0>b&&(b+=a.v.length);0>b?b=0:b>a.v.length&&(b=a.v.length);a.v.splice(b,0,c);return Sk.builtin.none.none$});Sk.builtin.list.prototype.extend=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("extend",arguments,2,2);a.list_extend_(b);return Sk.builtin.none.none$});
+Sk.builtin.list.prototype.pop=new Sk.builtin.func(function(a,b){var c;Sk.builtin.pyCheckArgs("pop",arguments,1,2);void 0===b&&(b=a.v.length-1);if(!Sk.builtin.checkNumber(b))throw new Sk.builtin.TypeError("an integer is required");b=Sk.builtin.asnum$(b);0>b&&(b+=a.v.length);if(0>b||b>=a.v.length)throw new Sk.builtin.IndexError("pop index out of range");c=a.v[b];a.v.splice(b,1);return c});
+Sk.builtin.list.prototype.remove=new Sk.builtin.func(function(a,b){var c;Sk.builtin.pyCheckArgs("remove",arguments,2,2);c=Sk.builtin.list.prototype.index.func_code(a,b);a.v.splice(Sk.builtin.asnum$(c),1);return Sk.builtin.none.none$});
+Sk.builtin.list.prototype.index=new Sk.builtin.func(function(a,b,c,d){var e,f;Sk.builtin.pyCheckArgs("index",arguments,2,4);if(void 0!==c&&!Sk.builtin.checkInt(c))throw new Sk.builtin.TypeError("slice indices must be integers");if(void 0!==d&&!Sk.builtin.checkInt(d))throw new Sk.builtin.TypeError("slice indices must be integers");e=a.v.length;f=a.v;c=void 0===c?0:c.v;0>c&&(c=0<=c+e?c+e:0);d=void 0===d?e:d.v;0>d&&(d=0<=d+e?d+e:0);for(e=c;e<d;++e)if(Sk.misceval.richCompareBool(f[e],b,"Eq"))return new Sk.builtin.int_(e);
+throw new Sk.builtin.ValueError("list.index(x): x not in list");});Sk.builtin.list.prototype.count=new Sk.builtin.func(function(a,b){var c,d,e,f;Sk.builtin.pyCheckArgs("count",arguments,2,2);f=a.v.length;e=a.v;for(c=d=0;c<f;++c)Sk.misceval.richCompareBool(e[c],b,"Eq")&&(d+=1);return new Sk.builtin.int_(d)});Sk.builtin.list.prototype.reverse=new Sk.builtin.func(Sk.builtin.list.prototype.list_reverse_);Sk.builtin.list.prototype.sort=new Sk.builtin.func(Sk.builtin.list.prototype.list_sort_);
+Sk.builtin.list.prototype.sort.func_code.co_varnames=["__self__","cmp","key","reverse"];goog.exportSymbol("Sk.builtin.list",Sk.builtin.list);Sk.builtin.interned={};
+Sk.builtin.str=function(a){void 0===a&&(a="");if(a instanceof Sk.builtin.str)return a;if(!(this instanceof Sk.builtin.str))return new Sk.builtin.str(a);if(!0===a)a="True";else if(!1===a)a="False";else if(null===a||a instanceof Sk.builtin.none)a="None";else if(a instanceof Sk.builtin.bool)a=a.v?"True":"False";else if("number"===typeof a)a=a.toString(),"Infinity"===a?a="inf":"-Infinity"===a&&(a="-inf");else if("string"!==typeof a){if(void 0!==a.tp$str){a=a.tp$str();if(!(a instanceof Sk.builtin.str))throw new Sk.builtin.ValueError("__str__ didn't return a str");
+return a}return Sk.misceval.objectRepr(a)}if(Sk.builtin.interned["1"+a])return Sk.builtin.interned["1"+a];this.__class__=Sk.builtin.str;this.v=this.v=a;Sk.builtin.interned["1"+a]=this;return this};goog.exportSymbol("Sk.builtin.str",Sk.builtin.str);Sk.abstr.setUpInheritance("str",Sk.builtin.str,Sk.builtin.seqtype);
+Sk.builtin.str.prototype.mp$subscript=function(a){var b;if(Sk.misceval.isIndex(a)){a=Sk.misceval.asIndex(a);0>a&&(a=this.v.length+a);if(0>a||a>=this.v.length)throw new Sk.builtin.IndexError("string index out of range");return new Sk.builtin.str(this.v.charAt(a))}if(a instanceof Sk.builtin.slice)return b="",a.sssiter$(this,function(a,d){0<=a&&a<d.v.length&&(b+=d.v.charAt(a))}),new Sk.builtin.str(b);throw new Sk.builtin.TypeError("string indices must be integers, not "+Sk.abstr.typeName(a));};
+Sk.builtin.str.prototype.sq$length=function(){return this.v.length};Sk.builtin.str.prototype.sq$concat=function(a){if(!a||!Sk.builtin.checkString(a))throw a=Sk.abstr.typeName(a),new Sk.builtin.TypeError("cannot concatenate 'str' and '"+a+"' objects");return new Sk.builtin.str(this.v+a.v)};Sk.builtin.str.prototype.nb$add=Sk.builtin.str.prototype.sq$concat;Sk.builtin.str.prototype.nb$inplace_add=Sk.builtin.str.prototype.sq$concat;
+Sk.builtin.str.prototype.sq$repeat=function(a){var b,c;if(!Sk.misceval.isIndex(a))throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '"+Sk.abstr.typeName(a)+"'");a=Sk.misceval.asIndex(a);c="";for(b=0;b<a;++b)c+=this.v;return new Sk.builtin.str(c)};Sk.builtin.str.prototype.nb$multiply=Sk.builtin.str.prototype.sq$repeat;Sk.builtin.str.prototype.nb$inplace_multiply=Sk.builtin.str.prototype.sq$repeat;Sk.builtin.str.prototype.sq$item=function(){goog.asserts.fail()};
+Sk.builtin.str.prototype.sq$slice=function(a,b){a=Sk.builtin.asnum$(a);b=Sk.builtin.asnum$(b);0>a&&(a=0);return new Sk.builtin.str(this.v.substr(a,b-a))};Sk.builtin.str.prototype.sq$contains=function(a){if(!(a instanceof Sk.builtin.str))throw new Sk.builtin.TypeError("TypeError: 'In <string> requires string as left operand");return-1!=this.v.indexOf(a.v)};
+Sk.builtin.str.prototype.tp$iter=function(){var a={tp$iter:function(){return a},$obj:this,$index:0,tp$iternext:function(){return a.$index>=a.$obj.v.length?void 0:new Sk.builtin.str(a.$obj.v.substr(a.$index++,1))},tp$name:"str_iterator"};return a};
+Sk.builtin.str.prototype.tp$richcompare=function(a,b){if(a instanceof Sk.builtin.str)switch(b){case "Lt":return this.v<a.v;case "LtE":return this.v<=a.v;case "Eq":return this.v===a.v;case "NotEq":return this.v!==a.v;case "Gt":return this.v>a.v;case "GtE":return this.v>=a.v;default:goog.asserts.fail()}};
+Sk.builtin.str.prototype.$r=function(){var a,b,c,d,e="'";-1!==this.v.indexOf("'")&&-1===this.v.indexOf('"')&&(e='"');d=this.v.length;c=e;for(b=0;b<d;++b)a=this.v.charAt(b),a===e||"\\"===a?c+="\\"+a:"\t"===a?c+="\\t":"\n"===a?c+="\\n":"\r"===a?c+="\\r":" ">a||127<=a?(a=a.charCodeAt(0).toString(16),2>a.length&&(a="0"+a),c+="\\x"+a):c+=a;return new Sk.builtin.str(c+e)};
+Sk.builtin.str.re_escape_=function(a){var b,c,d=[],e=/^[A-Za-z0-9]+$/;for(c=0;c<a.length;++c)b=a.charAt(c),e.test(b)?d.push(b):"\\000"===b?d.push("\\000"):d.push("\\"+b);return d.join("")};Sk.builtin.str.prototype.lower=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("lower",arguments,1,1);return new Sk.builtin.str(a.v.toLowerCase())});Sk.builtin.str.prototype.upper=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("upper",arguments,1,1);return new Sk.builtin.str(a.v.toUpperCase())});
+Sk.builtin.str.prototype.capitalize=new Sk.builtin.func(function(a){var b,c,d;Sk.builtin.pyCheckArgs("capitalize",arguments,1,1);d=a.v;if(0===d.length)return new Sk.builtin.str("");c=d.charAt(0).toUpperCase();for(b=1;b<d.length;b++)c+=d.charAt(b).toLowerCase();return new Sk.builtin.str(c)});
+Sk.builtin.str.prototype.join=new Sk.builtin.func(function(a,b){var c,d,e;Sk.builtin.pyCheckArgs("join",arguments,2,2);Sk.builtin.pyCheckType("seq","iterable",Sk.builtin.checkIterable(b));e=[];c=b.tp$iter();for(d=c.tp$iternext();void 0!==d;d=c.tp$iternext()){if(d.constructor!==Sk.builtin.str)throw new Sk.builtin.TypeError("TypeError: sequence item "+e.length+": expected string, "+typeof d+" found");e.push(d.v)}return new Sk.builtin.str(e.join(a.v))});
+Sk.builtin.str.prototype.split=new Sk.builtin.func(function(a,b,c){var d,e,f,g,h,k;Sk.builtin.pyCheckArgs("split",arguments,1,3);if(void 0===b||b instanceof Sk.builtin.none)b=null;if(null!==b&&!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("expected a string");if(null!==b&&""===b.v)throw new Sk.builtin.ValueError("empty separator");if(void 0!==c&&!Sk.builtin.checkInt(c))throw new Sk.builtin.TypeError("an integer is required");c=Sk.builtin.asnum$(c);k=/[\s]+/g;h=a.v;null===b?h=goog.string.trimLeft(h):
+(d=b.v.replace(/([.*+?=|\\\/()\[\]\{\}^$])/g,"\\$1"),k=RegExp(d,"g"));g=[];for(d=e=0;null!=(f=k.exec(h))&&f.index!==k.lastIndex&&!(g.push(new Sk.builtin.str(h.substring(e,f.index))),e=k.lastIndex,d+=1,c&&d>=c););h=h.substring(e);(null!==b||0<h.length)&&g.push(new Sk.builtin.str(h));return new Sk.builtin.list(g)});
+Sk.builtin.str.prototype.strip=new Sk.builtin.func(function(a,b){var c;Sk.builtin.pyCheckArgs("strip",arguments,1,2);if(void 0!==b&&!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("strip arg must be None or str");void 0===b?c=/^\s+|\s+$/g:(c=Sk.builtin.str.re_escape_(b.v),c=RegExp("^["+c+"]+|["+c+"]+$","g"));return new Sk.builtin.str(a.v.replace(c,""))});
+Sk.builtin.str.prototype.lstrip=new Sk.builtin.func(function(a,b){var c;Sk.builtin.pyCheckArgs("lstrip",arguments,1,2);if(void 0!==b&&!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("lstrip arg must be None or str");void 0===b?c=/^\s+/g:(c=Sk.builtin.str.re_escape_(b.v),c=RegExp("^["+c+"]+","g"));return new Sk.builtin.str(a.v.replace(c,""))});
+Sk.builtin.str.prototype.rstrip=new Sk.builtin.func(function(a,b){var c;Sk.builtin.pyCheckArgs("rstrip",arguments,1,2);if(void 0!==b&&!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("rstrip arg must be None or str");void 0===b?c=/\s+$/g:(c=Sk.builtin.str.re_escape_(b.v),c=RegExp("["+c+"]+$","g"));return new Sk.builtin.str(a.v.replace(c,""))});
+Sk.builtin.str.prototype.partition=new Sk.builtin.func(function(a,b){var c,d;Sk.builtin.pyCheckArgs("partition",arguments,2,2);Sk.builtin.pyCheckType("sep","string",Sk.builtin.checkString(b));d=new Sk.builtin.str(b);c=a.v.indexOf(d.v);return 0>c?new Sk.builtin.tuple([a,Sk.builtin.str.$emptystr,Sk.builtin.str.$emptystr]):new Sk.builtin.tuple([new Sk.builtin.str(a.v.substring(0,c)),d,new Sk.builtin.str(a.v.substring(c+d.v.length))])});
+Sk.builtin.str.prototype.rpartition=new Sk.builtin.func(function(a,b){var c,d;Sk.builtin.pyCheckArgs("rpartition",arguments,2,2);Sk.builtin.pyCheckType("sep","string",Sk.builtin.checkString(b));d=new Sk.builtin.str(b);c=a.v.lastIndexOf(d.v);return 0>c?new Sk.builtin.tuple([Sk.builtin.str.$emptystr,Sk.builtin.str.$emptystr,a]):new Sk.builtin.tuple([new Sk.builtin.str(a.v.substring(0,c)),d,new Sk.builtin.str(a.v.substring(c+d.v.length))])});
+Sk.builtin.str.prototype.count=new Sk.builtin.func(function(a,b,c,d){var e;Sk.builtin.pyCheckArgs("count",arguments,2,4);if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("expected a character buffer object");if(void 0!==c&&!Sk.builtin.checkInt(c))throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method");if(void 0!==d&&!Sk.builtin.checkInt(d))throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method");void 0===
+c?c=0:(c=Sk.builtin.asnum$(c),c=0<=c?c:a.v.length+c);void 0===d?d=a.v.length:(d=Sk.builtin.asnum$(d),d=0<=d?d:a.v.length+d);e=b.v.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");e=RegExp(e,"g");return(e=a.v.slice(c,d).match(e))?new Sk.builtin.int_(e.length):new Sk.builtin.int_(0)});
+Sk.builtin.str.prototype.ljust=new Sk.builtin.func(function(a,b,c){var d;Sk.builtin.pyCheckArgs("ljust",arguments,2,3);if(!Sk.builtin.checkInt(b))throw new Sk.builtin.TypeError("integer argument exepcted, got "+Sk.abstr.typeName(b));if(void 0!==c&&(!Sk.builtin.checkString(c)||1!==c.v.length))throw new Sk.builtin.TypeError("must be char, not "+Sk.abstr.typeName(c));c=void 0===c?" ":c.v;b=Sk.builtin.asnum$(b);if(a.v.length>=b)return a;d=Array.prototype.join.call({length:Math.floor(b-a.v.length)+1},
+c);return new Sk.builtin.str(a.v+d)});
+Sk.builtin.str.prototype.rjust=new Sk.builtin.func(function(a,b,c){var d;Sk.builtin.pyCheckArgs("rjust",arguments,2,3);if(!Sk.builtin.checkInt(b))throw new Sk.builtin.TypeError("integer argument exepcted, got "+Sk.abstr.typeName(b));if(void 0!==c&&(!Sk.builtin.checkString(c)||1!==c.v.length))throw new Sk.builtin.TypeError("must be char, not "+Sk.abstr.typeName(c));c=void 0===c?" ":c.v;b=Sk.builtin.asnum$(b);if(a.v.length>=b)return a;d=Array.prototype.join.call({length:Math.floor(b-a.v.length)+1},
+c);return new Sk.builtin.str(d+a.v)});
+Sk.builtin.str.prototype.center=new Sk.builtin.func(function(a,b,c){var d;Sk.builtin.pyCheckArgs("center",arguments,2,3);if(!Sk.builtin.checkInt(b))throw new Sk.builtin.TypeError("integer argument exepcted, got "+Sk.abstr.typeName(b));if(void 0!==c&&(!Sk.builtin.checkString(c)||1!==c.v.length))throw new Sk.builtin.TypeError("must be char, not "+Sk.abstr.typeName(c));c=void 0===c?" ":c.v;b=Sk.builtin.asnum$(b);if(a.v.length>=b)return a;d=Array.prototype.join.call({length:Math.floor((b-a.v.length)/
+2)+1},c);d=d+a.v+d;d.length<b&&(d+=c);return new Sk.builtin.str(d)});
+Sk.builtin.str.prototype.find=new Sk.builtin.func(function(a,b,c,d){var e;Sk.builtin.pyCheckArgs("find",arguments,2,4);if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("expected a character buffer object");if(void 0!==c&&!Sk.builtin.checkInt(c))throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method");if(void 0!==d&&!Sk.builtin.checkInt(d))throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method");void 0===
+c?c=0:(c=Sk.builtin.asnum$(c),c=0<=c?c:a.v.length+c);void 0===d?d=a.v.length:(d=Sk.builtin.asnum$(d),d=0<=d?d:a.v.length+d);e=a.v.indexOf(b.v,c);return new Sk.builtin.int_(e>=c&&e<d?e:-1)});Sk.builtin.str.prototype.index=new Sk.builtin.func(function(a,b,c,d){var e;Sk.builtin.pyCheckArgs("index",arguments,2,4);e=Sk.misceval.callsim(a.find,a,b,c,d);if(-1===Sk.builtin.asnum$(e))throw new Sk.builtin.ValueError("substring not found");return e});
+Sk.builtin.str.prototype.rfind=new Sk.builtin.func(function(a,b,c,d){var e;Sk.builtin.pyCheckArgs("rfind",arguments,2,4);if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("expected a character buffer object");if(void 0!==c&&!Sk.builtin.checkInt(c))throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method");if(void 0!==d&&!Sk.builtin.checkInt(d))throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method");void 0===
+c?c=0:(c=Sk.builtin.asnum$(c),c=0<=c?c:a.v.length+c);void 0===d?d=a.v.length:(d=Sk.builtin.asnum$(d),d=0<=d?d:a.v.length+d);e=a.v.lastIndexOf(b.v,d);e=e!==d?e:a.v.lastIndexOf(b.v,d-1);return new Sk.builtin.int_(e>=c&&e<d?e:-1)});Sk.builtin.str.prototype.rindex=new Sk.builtin.func(function(a,b,c,d){var e;Sk.builtin.pyCheckArgs("rindex",arguments,2,4);e=Sk.misceval.callsim(a.rfind,a,b,c,d);if(-1===Sk.builtin.asnum$(e))throw new Sk.builtin.ValueError("substring not found");return e});
+Sk.builtin.str.prototype.startswith=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("startswith",arguments,2,2);Sk.builtin.pyCheckType("tgt","string",Sk.builtin.checkString(b));return new Sk.builtin.bool(0===a.v.indexOf(b.v))});Sk.builtin.str.prototype.endswith=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("endswith",arguments,2,2);Sk.builtin.pyCheckType("tgt","string",Sk.builtin.checkString(b));return new Sk.builtin.bool(-1!==a.v.indexOf(b.v,a.v.length-b.v.length))});
+Sk.builtin.str.prototype.replace=new Sk.builtin.func(function(a,b,c,d){var e,f;Sk.builtin.pyCheckArgs("replace",arguments,3,4);Sk.builtin.pyCheckType("oldS","string",Sk.builtin.checkString(b));Sk.builtin.pyCheckType("newS","string",Sk.builtin.checkString(c));if(void 0!==d&&!Sk.builtin.checkInt(d))throw new Sk.builtin.TypeError("integer argument expected, got "+Sk.abstr.typeName(d));d=Sk.builtin.asnum$(d);f=RegExp(Sk.builtin.str.re_escape_(b.v),"g");if(void 0===d||0>d)return new Sk.builtin.str(a.v.replace(f,
+c.v));e=0;return new Sk.builtin.str(a.v.replace(f,function(a){e++;return e<=d?c.v:a}))});Sk.builtin.str.prototype.zfill=new Sk.builtin.func(function(a,b){var c=a.v,d,e,f="";Sk.builtin.pyCheckArgs("zfill",arguments,2,2);if(!Sk.builtin.checkInt(b))throw new Sk.builtin.TypeError("integer argument exepected, got "+Sk.abstr.typeName(b));d=b.v-c.length;e="+"===c[0]||"-"===c[0]?1:0;for(var g=0;g<d;g++)f+="0";c=c.substr(0,e)+f+c.substr(e);return new Sk.builtin.str(c)});
+Sk.builtin.str.prototype.isdigit=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("isdigit",arguments,1,1);return new Sk.builtin.bool(/^\d+$/.test(a.v))});Sk.builtin.str.prototype.isspace=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("isspace",arguments,1,1);return new Sk.builtin.bool(/^\s+$/.test(a.v))});
+Sk.builtin.str.prototype.expandtabs=new Sk.builtin.func(function(a,b){var c,d;Sk.builtin.pyCheckArgs("expandtabs",arguments,1,2);if(void 0!==b&&!Sk.builtin.checkInt(b))throw new Sk.builtin.TypeError("integer argument exepected, got "+Sk.abstr.typeName(b));b=void 0===b?8:Sk.builtin.asnum$(b);c=Array(b+1).join(" ");d=a.v.replace(/([^\r\n\t]*)\t/g,function(a,d){return d+c.slice(d.length%b)});return new Sk.builtin.str(d)});
+Sk.builtin.str.prototype.swapcase=new Sk.builtin.func(function(a){var b;Sk.builtin.pyCheckArgs("swapcase",arguments,1,1);b=a.v.replace(/[a-z]/gi,function(a){var b=a.toLowerCase();return b===a?a.toUpperCase():b});return new Sk.builtin.str(b)});
+Sk.builtin.str.prototype.splitlines=new Sk.builtin.func(function(a,b){var c=a.v,d=0,e=a.v.length,f=[],g,h=0;Sk.builtin.pyCheckArgs("splitlines",arguments,1,2);if(void 0!==b&&!Sk.builtin.checkBool(b))throw new Sk.builtin.TypeError("boolean argument expected, got "+Sk.abstr.typeName(b));b=void 0===b?!1:b.v;for(d=0;d<e;d++)if(g=c.charAt(d),"\n"===c.charAt(d+1)&&"\r"===g)g=d+2,h=c.slice(h,g),b||(h=h.replace(/(\r|\n)/g,"")),f.push(new Sk.builtin.str(h)),h=g;else if("\n"===g&&"\r"!==c.charAt(d-1)||"\r"===
+g)g=d+1,h=c.slice(h,g),b||(h=h.replace(/(\r|\n)/g,"")),f.push(new Sk.builtin.str(h)),h=g;h<e&&(h=c.slice(h,e),b||(h=h.replace(/(\r|\n)/g,"")),f.push(new Sk.builtin.str(h)));return new Sk.builtin.list(f)});Sk.builtin.str.prototype.title=new Sk.builtin.func(function(a){var b;Sk.builtin.pyCheckArgs("title",arguments,1,1);b=a.v.replace(/[a-z][a-z]*/gi,function(a){return a[0].toUpperCase()+a.substr(1).toLowerCase()});return new Sk.builtin.str(b)});
+Sk.builtin.str.prototype.isalpha=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("isalpha",arguments,1,1);return new Sk.builtin.bool(a.v.length&&goog.string.isAlpha(a.v))});Sk.builtin.str.prototype.isalnum=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("isalnum",arguments,1,1);return new Sk.builtin.bool(a.v.length&&goog.string.isAlphaNumeric(a.v))});
+Sk.builtin.str.prototype.isnumeric=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("isnumeric",arguments,1,1);return new Sk.builtin.bool(a.v.length&&goog.string.isNumeric(a.v))});Sk.builtin.str.prototype.islower=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("islower",arguments,1,1);return new Sk.builtin.bool(a.v.length&&/[a-z]/.test(a.v)&&!/[A-Z]/.test(a.v))});
+Sk.builtin.str.prototype.isupper=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("isupper",arguments,1,1);return new Sk.builtin.bool(a.v.length&&!/[a-z]/.test(a.v)&&/[A-Z]/.test(a.v))});
+Sk.builtin.str.prototype.istitle=new Sk.builtin.func(function(a){var b=a.v,c=!1,d=!1,e,f;Sk.builtin.pyCheckArgs("istitle",arguments,1,1);for(e=0;e<b.length;e++)if(f=b.charAt(e),!/[a-z]/.test(f)&&/[A-Z]/.test(f)){if(d)return new Sk.builtin.bool(!1);c=d=!0}else if(/[a-z]/.test(f)&&!/[A-Z]/.test(f)){if(!d)return new Sk.builtin.bool(!1);c=!0}else d=!1;return new Sk.builtin.bool(c)});
+Sk.builtin.str.prototype.nb$remainder=function(a){var b,c;a.constructor===Sk.builtin.tuple||void 0!==a.mp$subscript&&a.constructor!==Sk.builtin.str||(a=new Sk.builtin.tuple([a]));c=0;b=this.v.replace(/%(\([a-zA-Z0-9]+\))?([#0 +\-]+)?(\*|[0-9]+)?(\.(\*|[0-9]+))?[hlL]?([diouxXeEfFgGcrs%])/g,function(b,e,f,g,h,k,l){var m,p,n,r,q,t;g=Sk.builtin.asnum$(g);h=Sk.builtin.asnum$(h);if(void 0===e||""===e)m=c++;""===h&&(h=void 0);p=n=r=q=t=!1;f&&(-1!==f.indexOf("-")?q=!0:-1!==f.indexOf("0")&&(t=!0),-1!==f.indexOf("+")?
+n=!0:-1!==f.indexOf(" ")&&(r=!0),p=-1!==f.indexOf("#"));h&&(h=parseInt(h.substr(1),10));f=function(a,b){var c,d,e,f;b=Sk.builtin.asnum$(b);e=!1;"number"===typeof a?(0>a&&(a=-a,e=!0),f=a.toString(b)):a instanceof Sk.builtin.float_?(f=a.str$(b,!1),2<f.length&&".0"===f.substr(-2)&&(f=f.substr(0,f.length-2)),e=a.nb$isnegative()):a instanceof Sk.builtin.int_?(f=a.str$(b,!1),e=a.nb$isnegative()):a instanceof Sk.builtin.lng&&(f=a.str$(b,!1),e=a.nb$isnegative());goog.asserts.assert(void 0!==f,"unhandled number format");
+c=!1;if(h)for(d=f.length;d<h;++d)f="0"+f,c=!0;d="";e?d="-":n?d="+"+d:r&&(d=" "+d);p&&(16===b?d+="0x":8!==b||(c||"0"===f)||(d+="0"));return[d,f]};b=function(a){var b,c=a[0];a=a[1];if(g)if(g=parseInt(g,10),b=a.length+c.length,t)for(;b<g;++b)a="0"+a;else if(q)for(;b<g;++b)a+=" ";else for(;b<g;++b)c=" "+c;return c+a};if(a.constructor===Sk.builtin.tuple)e=a.v[m];else if(void 0!==a.mp$subscript&&void 0!==e)e=e.substring(1,e.length-1),e=a.mp$subscript(new Sk.builtin.str(e));else if(a.constructor===Sk.builtin.dict||
+a.constructor===Sk.builtin.list)e=a;else throw new Sk.builtin.AttributeError(a.tp$name+" instance has no attribute 'mp$subscript'");if("d"===l||"i"===l)return b(f(e,10));if("o"===l)return b(f(e,8));if("x"===l)return b(f(e,16));if("X"===l)return b(f(e,16)).toUpperCase();if("f"===l||"F"===l||"e"===l||"E"===l||"g"===l||"G"===l){m=Sk.builtin.asnum$(e);"string"===typeof m&&(m=Number(m));if(Infinity===m)return"inf";if(-Infinity===m)return"-inf";if(isNaN(m))return"nan";f=["toExponential","toFixed","toPrecision"]["efg".indexOf(l.toLowerCase())];
+if(void 0===h||""===h)if("e"===l||"E"===l)h=6;else if("f"===l||"F"===l)h=7;f=m[f](h);Sk.builtin.checkFloat(e)&&0===m&&-Infinity===1/m&&(f="-"+f);-1!=="EFG".indexOf(l)&&(f=f.toUpperCase());return b(["",f])}if("c"===l){if("number"===typeof e)return String.fromCharCode(e);if(e instanceof Sk.builtin.int_)return String.fromCharCode(e.v);if(e instanceof Sk.builtin.float_)return String.fromCharCode(e.v);if(e instanceof Sk.builtin.lng)return String.fromCharCode(e.str$(10,!1)[0]);if(e.constructor===Sk.builtin.str)return e.v.substr(0,
+1);throw new Sk.builtin.TypeError("an integer is required");}if("r"===l)return l=Sk.builtin.repr(e),h?l.v.substr(0,h):l.v;if("s"===l){l=new Sk.builtin.str(e);if(h)return l.v.substr(0,h);g&&(l.v=b([" ",l.v]));return l.v}if("%"===l)return"%"});return new Sk.builtin.str(b)};var format=function(a){var b,c,d,e={};Sk.builtin.pyCheckArgs("format",arguments,0,Infinity,!0,!0);b=new Sk.builtins.tuple(Array.prototype.slice.call(arguments,1));c=new Sk.builtins.dict(a);if(void 0===arguments[1])return b.v;d=0;if(0!==c.size){c=Sk.misceval.callsim(Sk.builtin.dict.prototype.items,c);for(var f in c.v)e[c.v[f].v[0].v]=c.v[f].v[1].v}for(var g in b.v)"0"!==g&&(e[g-1]=b.v[g].v);b=b.v[0].v.replace(/{(((?:\d+)|(?:\w+))?((?:\.(\w+))|(?:\[((?:\d+)|(?:\w+))\])?))?(?:\!([rs]))?(?:\:((?:(.)?([<\>\=\^]))?([\+\-\s])?(#)?(0)?(\d+)?(,)?(?:\.(\d+))?([bcdeEfFgGnosxX%])?))?}/g,
+function(a,b,c,f,g,n,r,q,t,y,v,z,F,w,E,x,s,K,C){var D,u,A,B,G,H,I,J;w=Sk.builtin.asnum$(w);x=Sk.builtin.asnum$(x);if(void 0!==n&&""!==n)u=e[c][n].v,d++;else if(void 0!==g&&""!==g)u=e[c][g].v,d++;else if(void 0!==c&&""!==c)u=e[c],d++;else if(void 0===b||""===b)a=e[d],d++,u=a;else if(b instanceof Sk.builtin.int_||b instanceof Sk.builtin.float_||b instanceof Sk.builtin.lng||!isNaN(parseInt(b,10)))a=e[b],d++,u=a;""===x&&(x=void 0);if(void 0===t||""===t)t=" ";B=G=H=I=!1;q&&(void 0!==v&&""!==v&&(-1!=="-".indexOf(v)?
+I=!0:-1!=="+".indexOf(v)?G=!0:-1!==" ".indexOf(v)&&(H=!0)),z&&(B=-1!=="#".indexOf(z)),void 0===w||""===w||void 0!==t&&""!==t||(t=" "),-1!=="%".indexOf(s)&&(J=!0));x&&(x=parseInt(x,10));D=function(a){if(void 0===r||""===r)return a;if("r"==r)return a=new Sk.builtin.str(a),a=Sk.builtin.repr(a),a.v;if("s"==r)return a=new Sk.builtin.str(a),a.v};A=function(a,b){var c;J&&(b+="%");if(void 0!==w&&""!==w)if(w=parseInt(w,10),c=b.length+a.length,I)for(;c<w;++c)b+=t;else if(-1!==">".indexOf(y))for(;c<w;++c)a=
+t+a;else if(-1!=="^".indexOf(y))for(;c<w;++c)0===c%2?a=t+a:1===c%2&&(b+=t);else if(-1!=="=".indexOf(y))for(;c<w;++c)b=t+b;else for(;c<w;++c)b+=t;return D(a+b)};v=function(a,b){var c,d,e;b=Sk.builtin.asnum$(b);d=!1;if(void 0===q)return D(u);"number"!==typeof a||x?x?(0>a&&(a=-a,d=!0),a=Number(a.toString(b)),e=a.toFixed(x)):a instanceof Sk.builtin.float_?(e=a.str$(b,!1),2<e.length&&".0"===e.substr(-2)&&(e=e.substr(0,e.length-2)),d=a.nb$isnegative()):a instanceof Sk.builtin.int_?(e=a.str$(b,!1),d=a.nb$isnegative()):
+a instanceof Sk.builtin.lng?(e=a.str$(b,!1),d=a.nb$isnegative()):e=a:(0>a&&(a=-a,d=!0),e=a.toString(b));c="";d?c="-":G?c="+":H&&(c=" ");B&&(16===b?c+="0x":8===b&&"0"!==e?c+="0o":2===b&&"0"!==e&&(c+="0b"));"n"===s?e=e.toLocaleString():-1!==",".indexOf(E)&&(d=e.toString().split("."),d[0]=d[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),e=d.join("."));return A(c,e)};if("d"===s||"n"===s||""===s||void 0===s)return v(u,10);if("b"===s)return v(u,2);if("o"===s)return v(u,8);if("x"===s)return v(u,16);if("X"===s)return v(u,
+16).toUpperCase();if("f"===s||"F"===s||"e"===s||"E"===s||"g"===s||"G"===s){if(B)throw new Sk.builtin.ValueError("Alternate form (#) not allowed in float format specifier");a=Sk.builtin.asnum$(u);"string"===typeof a&&(a=Number(a));if(Infinity===a)return A("","inf");if(-Infinity===a)return A("-","inf");if(isNaN(a))return A("","nan");z=["toExponential","toFixed","toPrecision"]["efg".indexOf(s.toLowerCase())];if(void 0===x||""===x)if("e"===s||"E"===s||"%"===s)x=6;else if("f"===s||"F"===s)x=6;z=a[z](x);
+-1!=="EFG".indexOf(s)&&(z=z.toUpperCase());return v(z,10)}if("c"===s){if("number"===typeof u)return A("",String.fromCharCode(u));if(u instanceof Sk.builtin.int_)return A("",String.fromCharCode(u.v));if(u instanceof Sk.builtin.float_)return A("",String.fromCharCode(u.v));if(u instanceof Sk.builtin.lng)return A("",String.fromCharCode(u.str$(10,!1)[0]));if(u.constructor===Sk.builtin.str)return A("",u.v.substr(0,1));throw new Sk.builtin.TypeError("an integer is required");}if(J)return void 0===x&&(x=
+7),v(100*u,10)});return new Sk.builtin.str(b)};format.co_kwargs=!0;Sk.builtin.str.prototype.format=new Sk.builtin.func(format);Sk.builtin.tuple=function(a){var b;if(!(this instanceof Sk.builtin.tuple))return new Sk.builtin.tuple(a);void 0===a&&(a=[]);if("[object Array]"===Object.prototype.toString.apply(a))this.v=a;else if(Sk.builtin.checkIterable(a))for(this.v=[],a=Sk.abstr.iter(a),b=a.tp$iternext();void 0!==b;b=a.tp$iternext())this.v.push(b);else throw new Sk.builtin.TypeError("expecting Array or iterable");this.__class__=Sk.builtin.tuple;this.v=this.v;return this};Sk.abstr.setUpInheritance("tuple",Sk.builtin.tuple,Sk.builtin.seqtype);
+Sk.builtin.tuple.prototype.$r=function(){var a,b;if(0===this.v.length)return new Sk.builtin.str("()");b=[];for(a=0;a<this.v.length;++a)b[a]=Sk.misceval.objectRepr(this.v[a]).v;a=b.join(", ");1===this.v.length&&(a+=",");return new Sk.builtin.str("("+a+")")};
+Sk.builtin.tuple.prototype.mp$subscript=function(a){var b,c;if(Sk.misceval.isIndex(a)){if(c=Sk.misceval.asIndex(a),void 0!==c){0>c&&(c=this.v.length+c);if(0>c||c>=this.v.length)throw new Sk.builtin.IndexError("tuple index out of range");return this.v[c]}}else if(a instanceof Sk.builtin.slice)return b=[],a.sssiter$(this,function(a,c){b.push(c.v[a])}),new Sk.builtin.tuple(b);throw new Sk.builtin.TypeError("tuple indices must be integers, not "+Sk.abstr.typeName(a));};
+Sk.builtin.tuple.prototype.tp$hash=function(){var a,b,c=1000003,d=3430008,e=this.v.length;for(b=0;b<e;++b){a=Sk.builtin.hash(this.v[b]).v;if(-1===a)return new Sk.builtin.int_(-1);d=(d^a)*c;c+=82520+e+e}d+=97531;-1===d&&(d=-2);return new Sk.builtin.int_(d|0)};Sk.builtin.tuple.prototype.sq$repeat=function(a){var b,c,d;a=Sk.misceval.asIndex(a);d=[];for(c=0;c<a;++c)for(b=0;b<this.v.length;++b)d.push(this.v[b]);return new Sk.builtin.tuple(d)};Sk.builtin.tuple.prototype.nb$multiply=Sk.builtin.tuple.prototype.sq$repeat;
+Sk.builtin.tuple.prototype.nb$inplace_multiply=Sk.builtin.tuple.prototype.sq$repeat;Sk.builtin.tuple.prototype.tp$iter=function(){var a={tp$iter:function(){return a},$obj:this,$index:0,tp$iternext:function(){return a.$index>=a.$obj.v.length?void 0:a.$obj.v[a.$index++]},tp$name:"tuple_iterator"};return a};Sk.builtin.tuple.prototype.__iter__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("__iter__",arguments,1,1);return a.tp$iter()});
+Sk.builtin.tuple.prototype.tp$richcompare=function(a,b){var c,d,e,f,g;if(!a.__class__||!Sk.misceval.isTrue(Sk.builtin.isinstance(a,Sk.builtin.tuple)))return"Eq"===b?!1:"NotEq"===b?!0:!1;g=this.v;a=a.v;f=g.length;e=a.length;for(d=0;d<f&&d<e&&(c=Sk.misceval.richCompareBool(g[d],a[d],"Eq"),c);++d);if(d>=f||d>=e)switch(b){case "Lt":return f<e;case "LtE":return f<=e;case "Eq":return f===e;case "NotEq":return f!==e;case "Gt":return f>e;case "GtE":return f>=e;default:goog.asserts.fail()}return"Eq"===b?!1:
+"NotEq"===b?!0:Sk.misceval.richCompareBool(g[d],a[d],b)};Sk.builtin.tuple.prototype.sq$concat=function(a){if(a.__class__!=Sk.builtin.tuple)throw a='can only concatenate tuple (not "'+(Sk.abstr.typeName(a)+'") to tuple'),new Sk.builtin.TypeError(a);return new Sk.builtin.tuple(this.v.concat(a.v))};Sk.builtin.tuple.prototype.sq$contains=function(a){var b,c;b=this.tp$iter();for(c=b.tp$iternext();void 0!==c;c=b.tp$iternext())if(Sk.misceval.richCompareBool(c,a,"Eq"))return!0;return!1};
+Sk.builtin.tuple.prototype.nb$add=Sk.builtin.tuple.prototype.sq$concat;Sk.builtin.tuple.prototype.nb$inplace_add=Sk.builtin.tuple.prototype.sq$concat;Sk.builtin.tuple.prototype.sq$length=function(){return this.v.length};Sk.builtin.tuple.prototype.index=new Sk.builtin.func(function(a,b){var c,d=a.v.length,e=a.v;for(c=0;c<d;++c)if(Sk.misceval.richCompareBool(e[c],b,"Eq"))return new Sk.builtin.int_(c);throw new Sk.builtin.ValueError("tuple.index(x): x not in tuple");});
+Sk.builtin.tuple.prototype.count=new Sk.builtin.func(function(a,b){var c,d=a.v.length,e=a.v,f=0;for(c=0;c<d;++c)Sk.misceval.richCompareBool(e[c],b,"Eq")&&(f+=1);return new Sk.builtin.int_(f)});goog.exportSymbol("Sk.builtin.tuple",Sk.builtin.tuple);Sk.builtin.dict=function(a){var b,c,d;if(!(this instanceof Sk.builtin.dict))return new Sk.builtin.dict(a);void 0===a&&(a=[]);this.size=0;if("[object Array]"===Object.prototype.toString.apply(a))for(b=0;b<a.length;b+=2)this.mp$ass_subscript(a[b],a[b+1]);else if(a instanceof Sk.builtin.dict)for(c=Sk.abstr.iter(a),d=c.tp$iternext();void 0!==d;d=c.tp$iternext())b=a.mp$subscript(d),void 0===b&&(b=null),this.mp$ass_subscript(d,b);else if(Sk.builtin.checkIterable(a))for(c=Sk.abstr.iter(a),b=c.tp$iternext();void 0!==
+b;b=c.tp$iternext())if(b.mp$subscript)this.mp$ass_subscript(b.mp$subscript(0),b.mp$subscript(1));else throw new Sk.builtin.TypeError("element "+this.size+" is not a sequence");else throw new Sk.builtin.TypeError("object is not iterable");this.__class__=Sk.builtin.dict;return this};Sk.abstr.setUpInheritance("dict",Sk.builtin.dict,Sk.builtin.object);Sk.abstr.markUnhashable(Sk.builtin.dict);var kf=Sk.builtin.hash;
+Sk.builtin.dict.prototype.key$lookup=function(a,b){var c,d,e;for(e=0;e<a.items.length;e++)if(c=a.items[e],d=Sk.misceval.richCompareBool(c.lhs,b,"Eq"))return c;return null};Sk.builtin.dict.prototype.key$pop=function(a,b){var c,d,e;for(e=0;e<a.items.length;e++)if(c=a.items[e],d=Sk.misceval.richCompareBool(c.lhs,b,"Eq"))return a.items.splice(e,1),this.size-=1,c};Sk.builtin.dict.prototype.mp$lookup=function(a){var b=this[kf(a).v];if(void 0!==b&&(a=this.key$lookup(b,a)))return a.rhs};
+Sk.builtin.dict.prototype.mp$subscript=function(a){Sk.builtin.pyCheckArgs("[]",arguments,1,2,!1,!1);var b;b=this.mp$lookup(a);if(void 0!==b)return b;b=new Sk.builtin.str(a);throw new Sk.builtin.KeyError(b.v);};Sk.builtin.dict.prototype.sq$contains=function(a){Sk.builtin.pyCheckArgs("__contains__()",arguments,1,1,!1,!1);return void 0!==this.mp$lookup(a)};
+Sk.builtin.dict.prototype.mp$ass_subscript=function(a,b){var c=kf(a),d=this[c.v];void 0===d?(d={$hash:c,items:[{lhs:a,rhs:b}]},this[c.v]=d,this.size+=1):(c=this.key$lookup(d,a))?c.rhs=b:(d.items.push({lhs:a,rhs:b}),this.size+=1)};Sk.builtin.dict.prototype.mp$del_subscript=function(a){Sk.builtin.pyCheckArgs("del",arguments,1,1,!1,!1);var b=this[kf(a).v];if(void 0!==b&&(b=this.key$pop(b,a),void 0!==b))return;b=new Sk.builtin.str(a);throw new Sk.builtin.KeyError(b.v);};
+Sk.builtin.dict.prototype.tp$iter=function(){var a,b,c,d,e=[];for(d in this)if(this.hasOwnProperty(d)&&(c=this[d])&&void 0!==c.$hash&&void 0!==c.items)for(b=0;b<c.items.length;b++)e.push(c.items[b].lhs);return a={tp$iter:function(){return a},$obj:this,$index:0,$keys:e,tp$iternext:function(){return a.$index>=a.$keys.length?void 0:a.$keys[a.$index++]},tp$name:"dict_keyiterator"}};
+Sk.builtin.dict.prototype.$r=function(){var a,b,c,d=[];b=Sk.abstr.iter(this);for(c=b.tp$iternext();void 0!==c;c=b.tp$iternext())a=this.mp$subscript(c),void 0===a&&(a=null),a===this?d.push(Sk.misceval.objectRepr(c).v+": {...}"):d.push(Sk.misceval.objectRepr(c).v+": "+Sk.misceval.objectRepr(a).v);return new Sk.builtin.str("{"+d.join(", ")+"}")};Sk.builtin.dict.prototype.mp$length=function(){return this.size};
+Sk.builtin.dict.prototype.get=new Sk.builtin.func(function(a,b,c){Sk.builtin.pyCheckArgs("get()",arguments,1,2,!1,!0);var d;void 0===c&&(c=Sk.builtin.none.none$);d=a.mp$lookup(b);void 0===d&&(d=c);return d});Sk.builtin.dict.prototype.pop=new Sk.builtin.func(function(a,b,c){Sk.builtin.pyCheckArgs("pop()",arguments,1,2,!1,!0);var d=kf(b),d=a[d.v];if(void 0!==d&&(d=a.key$pop(d,b),void 0!==d))return d.rhs;if(void 0!==c)return c;d=new Sk.builtin.str(b);throw new Sk.builtin.KeyError(d.v);});
+Sk.builtin.dict.prototype.has_key=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("has_key()",arguments,1,1,!1,!0);return new Sk.builtin.bool(a.sq$contains(b))});Sk.builtin.dict.prototype.items=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("items()",arguments,0,0,!1,!0);var b,c,d,e=[];c=Sk.abstr.iter(a);for(d=c.tp$iternext();void 0!==d;d=c.tp$iternext())b=a.mp$subscript(d),void 0===b&&(b=null),e.push(new Sk.builtin.tuple([d,b]));return new Sk.builtin.list(e)});
+Sk.builtin.dict.prototype.keys=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("keys()",arguments,0,0,!1,!0);var b,c,d=[];b=Sk.abstr.iter(a);for(c=b.tp$iternext();void 0!==c;c=b.tp$iternext())d.push(c);return new Sk.builtin.list(d)});Sk.builtin.dict.prototype.values=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("values()",arguments,0,0,!1,!0);var b,c,d=[];c=Sk.abstr.iter(a);for(b=c.tp$iternext();void 0!==b;b=c.tp$iternext())b=a.mp$subscript(b),void 0===b&&(b=null),d.push(b);return new Sk.builtin.list(d)});
+Sk.builtin.dict.prototype.clear=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("clear()",arguments,0,0,!1,!0);var b,c;c=Sk.abstr.iter(a);for(b=c.tp$iternext();void 0!==b;b=c.tp$iternext())a.mp$del_subscript(b)});Sk.builtin.dict.prototype.setdefault=new Sk.builtin.func(function(a,b,c){try{return a.mp$subscript(b)}catch(d){return void 0===c&&(c=Sk.builtin.none.none$),a.mp$ass_subscript(b,c),c}});
+Sk.builtin.dict.prototype.dict_merge=function(a){var b,c,d;if(a instanceof Sk.builtin.dict)for(b=a.tp$iter(),c=b.tp$iternext();void 0!==c;c=b.tp$iternext()){d=a.mp$subscript(c);if(void 0===d)throw new Sk.builtin.AttributeError("cannot get item for key: "+c.v);this.mp$ass_subscript(c,d)}else for(b=Sk.misceval.callsim(a.keys,a),b=Sk.abstr.iter(b),c=b.tp$iternext();void 0!==c;c=b.tp$iternext()){d=a.tp$getitem(c);if(void 0===d)throw new Sk.builtin.AttributeError("cannot get item for key: "+c.v);this.mp$ass_subscript(c,
+d)}};
+var update_f=function(a,b,c){if(void 0!==c&&("dict"===c.tp$name||c.keys))b.dict_merge(c);else if(void 0!==c&&Sk.builtin.checkIterable(c)){var d,e=0;c=Sk.abstr.iter(c);for(d=c.tp$iternext();void 0!==d;d=c.tp$iternext(),e++){if(!Sk.builtin.checkIterable(d))throw new Sk.builtin.TypeError("cannot convert dictionary update sequence element #"+e+" to a sequence");if(2===d.sq$length()){var f=Sk.abstr.iter(d);d=f.tp$iternext();f=f.tp$iternext();b.mp$ass_subscript(d,f)}else throw new Sk.builtin.ValueError("dictionary update sequence element #"+e+
+" has length "+d.sq$length()+"; 2 is required");}}else if(void 0!==c)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(c)+"' object is not iterable");a=new Sk.builtins.dict(a);b.dict_merge(a);return Sk.builtin.none.none$};update_f.co_kwargs=!0;Sk.builtin.dict.prototype.update=new Sk.builtin.func(update_f);Sk.builtin.dict.prototype.__contains__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("__contains__",arguments,1,1,!1,!0);return Sk.builtin.dict.prototype.sq$contains.call(a,b)});
+Sk.builtin.dict.prototype.__cmp__=new Sk.builtin.func(function(a,b,c){return Sk.builtin.NotImplemented.NotImplemented$});Sk.builtin.dict.prototype.__delitem__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("__delitem__",arguments,1,1,!1,!0);return Sk.builtin.dict.prototype.mp$del_subscript.call(a,b)});Sk.builtin.dict.prototype.__getitem__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("__getitem__",arguments,1,1,!1,!0);return Sk.builtin.dict.prototype.mp$subscript.call(a,b)});
+Sk.builtin.dict.prototype.__setitem__=new Sk.builtin.func(function(a,b,c){Sk.builtin.pyCheckArgs("__setitem__",arguments,2,2,!1,!0);return Sk.builtin.dict.prototype.mp$ass_subscript.call(a,b,c)});Sk.builtin.dict.prototype.__hash__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("__hash__",arguments,0,0,!1,!0);return Sk.builtin.dict.prototype.tp$hash.call(a)});Sk.builtin.dict.prototype.__len__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("__len__",arguments,0,0,!1,!0);return Sk.builtin.dict.prototype.mp$length.call(a)});
+Sk.builtin.dict.prototype.__getattr__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("__getattr__",arguments,1,1,!1,!0);if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("__getattr__ requires a string");return Sk.builtin.dict.prototype.tp$getattr.call(a,Sk.ffi.remapToJs(b))});Sk.builtin.dict.prototype.__iter__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("__iter__",arguments,0,0,!1,!0);return Sk.builtin.dict.prototype.tp$iter.call(a)});
+Sk.builtin.dict.prototype.__repr__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("__repr__",arguments,0,0,!1,!0);return Sk.builtin.dict.prototype.$r.call(a)});
+Sk.builtin.dict.prototype.ob$eq=function(a){var b,c,d;if(this===a)return Sk.builtin.bool.true$;if(!(a instanceof Sk.builtin.dict))return Sk.builtin.NotImplemented.NotImplemented$;if(this.size!==a.size)return Sk.builtin.bool.false$;b=this.tp$iter();for(c=b.tp$iternext();void 0!==c;c=b.tp$iternext())if(d=this.mp$subscript(c),c=a.mp$subscript(c),!Sk.misceval.richCompareBool(d,c,"Eq"))return Sk.builtin.bool.false$;return Sk.builtin.bool.true$};
+Sk.builtin.dict.prototype.ob$ne=function(a){a=this.ob$eq(a);return a instanceof Sk.builtin.NotImplemented?a:a.v?Sk.builtin.bool.false$:Sk.builtin.bool.true$};Sk.builtin.dict.prototype.copy=new Sk.builtin.func(function(a){throw new Sk.builtin.NotImplementedError("dict.copy is not yet implemented in Skulpt");});Sk.builtin.dict.prototype.fromkeys=new Sk.builtin.func(function(a,b){throw new Sk.builtin.NotImplementedError("dict.fromkeys is not yet implemented in Skulpt");});
+Sk.builtin.dict.prototype.iteritems=new Sk.builtin.func(function(a){throw new Sk.builtin.NotImplementedError("dict.iteritems is not yet implemented in Skulpt");});Sk.builtin.dict.prototype.iterkeys=new Sk.builtin.func(function(a){throw new Sk.builtin.NotImplementedError("dict.iterkeys is not yet implemented in Skulpt");});Sk.builtin.dict.prototype.itervalues=new Sk.builtin.func(function(a){throw new Sk.builtin.NotImplementedError("dict.itervalues is not yet implemented in Skulpt");});
+Sk.builtin.dict.prototype.popitem=new Sk.builtin.func(function(a){throw new Sk.builtin.NotImplementedError("dict.popitem is not yet implemented in Skulpt");});Sk.builtin.dict.prototype.viewitems=new Sk.builtin.func(function(a){throw new Sk.builtin.NotImplementedError("dict.viewitems is not yet implemented in Skulpt");});Sk.builtin.dict.prototype.viewkeys=new Sk.builtin.func(function(a){throw new Sk.builtin.NotImplementedError("dict.viewkeys is not yet implemented in Skulpt");});
+Sk.builtin.dict.prototype.viewvalues=new Sk.builtin.func(function(a){throw new Sk.builtin.NotImplementedError("dict.viewvalues is not yet implemented in Skulpt");});goog.exportSymbol("Sk.builtin.dict",Sk.builtin.dict);Sk.builtin.numtype=function(){throw new Sk.builtin.ExternalError("Cannot instantiate abstract Sk.builtin.numtype class");};Sk.abstr.setUpInheritance("NumericType",Sk.builtin.numtype,Sk.builtin.object);Sk.builtin.numtype.sk$abstract=!0;Sk.builtin.numtype.prototype.__abs__=new Sk.builtin.func(function(a){if(void 0===a.nb$abs)throw new Sk.builtin.NotImplementedError("__abs__ is not yet implemented");Sk.builtin.pyCheckArgs("__abs__",arguments,0,0,!1,!0);return a.nb$abs()});
+Sk.builtin.numtype.prototype.__neg__=new Sk.builtin.func(function(a){if(void 0===a.nb$negative)throw new Sk.builtin.NotImplementedError("__neg__ is not yet implemented");Sk.builtin.pyCheckArgs("__neg__",arguments,0,0,!1,!0);return a.nb$negative()});Sk.builtin.numtype.prototype.__pos__=new Sk.builtin.func(function(a){if(void 0===a.nb$positive)throw new Sk.builtin.NotImplementedError("__pos__ is not yet implemented");Sk.builtin.pyCheckArgs("__pos__",arguments,0,0,!1,!0);return a.nb$positive()});
+Sk.builtin.numtype.prototype.__int__=new Sk.builtin.func(function(a){if(void 0===a.nb$int_)throw new Sk.builtin.NotImplementedError("__int__ is not yet implemented");Sk.builtin.pyCheckArgs("__int__",arguments,0,0,!1,!0);return a.nb$int_()});Sk.builtin.numtype.prototype.__long__=new Sk.builtin.func(function(a){if(void 0===a.nb$lng)throw new Sk.builtin.NotImplementedError("__long__ is not yet implemented");Sk.builtin.pyCheckArgs("__long__",arguments,0,0,!1,!0);return a.nb$lng()});
+Sk.builtin.numtype.prototype.__float__=new Sk.builtin.func(function(a){if(void 0===a.nb$float_)throw new Sk.builtin.NotImplementedError("__float__ is not yet implemented");Sk.builtin.pyCheckArgs("__float__",arguments,0,0,!1,!0);return a.nb$float_()});Sk.builtin.numtype.prototype.__add__=new Sk.builtin.func(function(a,b){if(void 0===a.nb$add)throw new Sk.builtin.NotImplementedError("__add__ is not yet implemented");Sk.builtin.pyCheckArgs("__add__",arguments,1,1,!1,!0);return a.nb$add(b)});
+Sk.builtin.numtype.prototype.__radd__=new Sk.builtin.func(function(a,b){if(void 0===a.nb$reflected_add)throw new Sk.builtin.NotImplementedError("__radd__ is not yet implemented");Sk.builtin.pyCheckArgs("__radd__",arguments,1,1,!1,!0);return a.nb$reflected_add(b)});Sk.builtin.numtype.prototype.__sub__=new Sk.builtin.func(function(a,b){if(void 0===a.nb$subtract)throw new Sk.builtin.NotImplementedError("__sub__ is not yet implemented");Sk.builtin.pyCheckArgs("__sub__",arguments,1,1,!1,!0);return a.nb$subtract(b)});
+Sk.builtin.numtype.prototype.__rsub__=new Sk.builtin.func(function(a,b){if(void 0===a.nb$reflected_subtract)throw new Sk.builtin.NotImplementedError("__rsub__ is not yet implemented");Sk.builtin.pyCheckArgs("__rsub__",arguments,1,1,!1,!0);return a.nb$reflected_subtract(b)});
+Sk.builtin.numtype.prototype.__mul__=new Sk.builtin.func(function(a,b){if(void 0===a.nb$multiply)throw new Sk.builtin.NotImplementedError("__mul__ is not yet implemented");Sk.builtin.pyCheckArgs("__mul__",arguments,1,1,!1,!0);return a.nb$multiply(b)});Sk.builtin.numtype.prototype.__rmul__=new Sk.builtin.func(function(a,b){if(void 0===a.nb$reflected_multiply)throw new Sk.builtin.NotImplementedError("__rmul__ is not yet implemented");Sk.builtin.pyCheckArgs("__rmul__",arguments,1,1,!1,!0);return a.nb$reflected_multiply(b)});
+Sk.builtin.numtype.prototype.__div__=new Sk.builtin.func(function(a,b){if(void 0===a.nb$divide)throw new Sk.builtin.NotImplementedError("__div__ is not yet implemented");Sk.builtin.pyCheckArgs("__div__",arguments,1,1,!1,!0);return a.nb$divide(b)});Sk.builtin.numtype.prototype.__rdiv__=new Sk.builtin.func(function(a,b){if(void 0===a.nb$reflected_divide)throw new Sk.builtin.NotImplementedError("__rdiv__ is not yet implemented");Sk.builtin.pyCheckArgs("__rdiv__",arguments,1,1,!1,!0);return a.nb$reflected_divide(b)});
+Sk.builtin.numtype.prototype.__floordiv__=new Sk.builtin.func(function(a,b){if(void 0===a.nb$floor_divide)throw new Sk.builtin.NotImplementedError("__floordiv__ is not yet implemented");Sk.builtin.pyCheckArgs("__floordiv__",arguments,1,1,!1,!0);return a.nb$floor_divide(b)});
+Sk.builtin.numtype.prototype.__rfloordiv__=new Sk.builtin.func(function(a,b){if(void 0===a.nb$reflected_floor_divide)throw new Sk.builtin.NotImplementedError("__rfloordiv__ is not yet implemented");Sk.builtin.pyCheckArgs("__rfloordiv__",arguments,1,1,!1,!0);return a.nb$reflected_floor_divide(b)});
+Sk.builtin.numtype.prototype.__mod__=new Sk.builtin.func(function(a,b){if(void 0===a.nb$remainder)throw new Sk.builtin.NotImplementedError("__mod__ is not yet implemented");Sk.builtin.pyCheckArgs("__mod__",arguments,1,1,!1,!0);return a.nb$remainder(b)});Sk.builtin.numtype.prototype.__rmod__=new Sk.builtin.func(function(a,b){if(void 0===a.nb$reflected_remainder)throw new Sk.builtin.NotImplementedError("__rmod__ is not yet implemented");Sk.builtin.pyCheckArgs("__rmod__",arguments,1,1,!1,!0);return a.nb$reflected_remainder(b)});
+Sk.builtin.numtype.prototype.__divmod__=new Sk.builtin.func(function(a,b){if(void 0===a.nb$divmod)throw new Sk.builtin.NotImplementedError("__divmod__ is not yet implemented");Sk.builtin.pyCheckArgs("__divmod__",arguments,1,1,!1,!0);return a.nb$divmod(b)});
+Sk.builtin.numtype.prototype.__rdivmod__=new Sk.builtin.func(function(a,b){if(void 0===a.nb$reflected_divmod)throw new Sk.builtin.NotImplementedError("__rdivmod__ is not yet implemented");Sk.builtin.pyCheckArgs("__rdivmod__",arguments,1,1,!1,!0);return a.nb$reflected_divmod(b)});
+Sk.builtin.numtype.prototype.__pow__=new Sk.builtin.func(function(a,b){if(void 0===a.nb$power)throw new Sk.builtin.NotImplementedError("__pow__ is not yet implemented");Sk.builtin.pyCheckArgs("__pow__",arguments,1,1,!1,!0);return a.nb$power(b)});Sk.builtin.numtype.prototype.__rpow__=new Sk.builtin.func(function(a,b){if(void 0===a.nb$reflected_power)throw new Sk.builtin.NotImplementedError("__rpow__ is not yet implemented");Sk.builtin.pyCheckArgs("__rpow__",arguments,1,1,!1,!0);return a.nb$reflected_power(b)});
+Sk.builtin.numtype.prototype.__coerce__=new Sk.builtin.func(function(a,b){throw new Sk.builtin.NotImplementedError("__coerce__ is not yet implemented");});Sk.builtin.numtype.prototype.nb$add=function(a){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$reflected_add=function(a){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$inplace_add=function(a){return Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.numtype.prototype.nb$subtract=function(a){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$reflected_subtract=function(a){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$inplace_subtract=function(a){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$multiply=function(a){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$reflected_multiply=function(a){return Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.numtype.prototype.nb$inplace_multiply=function(a){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$divide=function(a){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$reflected_divide=function(a){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$inplace_divide=function(a){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$floor_divide=function(a){return Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.numtype.prototype.nb$reflected_floor_divide=function(a){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$inplace_floor_divide=function(a){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$remainder=function(a){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$reflected_remainder=function(a){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$inplace_remainder=function(a){return Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.numtype.prototype.nb$divmod=function(a){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$reflected_divmod=function(a){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$power=function(a,b){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$reflected_power=function(a,b){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$inplace_power=function(a){return Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.numtype.prototype.nb$abs=function(){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$negative=function(){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$positive=function(){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$nonzero=function(){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.numtype.prototype.nb$isnegative=function(){return Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.numtype.prototype.nb$ispositive=function(){return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.biginteger=function(a,b,c){null!=a&&("number"==typeof a?this.fromNumber(a,b,c):null==b&&"string"!=typeof a?this.fromString(a,256):this.fromString(a,b))};Sk.builtin.biginteger.canary=0xdeadbeefcafe;Sk.builtin.biginteger.j_lm=15715070==(Sk.builtin.biginteger.canary&16777215);Sk.builtin.biginteger.nbi=function(){return new Sk.builtin.biginteger(null)};
+Sk.builtin.biginteger.prototype.am1=function(a,b,c,d,e,f){for(var g;0<=--f;)g=b*this[a++]+c[d]+e,e=Math.floor(g/67108864),c[d++]=g&67108863;return e};Sk.builtin.biginteger.prototype.am2=function(a,b,c,d,e,f){for(var g,h,k=b&32767,l=b>>15;0<=--f;)h=this[a]&32767,g=this[a++]>>15,b=l*h+g*k,h=k*h+((b&32767)<<15)+c[d]+(e&1073741823),e=(h>>>30)+(b>>>15)+l*g+(e>>>30),c[d++]=h&1073741823;return e};
+Sk.builtin.biginteger.prototype.am3=function(a,b,c,d,e,f){for(var g,h,k=b&16383,l=b>>14;0<=--f;)h=this[a]&16383,g=this[a++]>>14,b=l*h+g*k,h=k*h+((b&16383)<<14)+c[d]+e,e=(h>>28)+(b>>14)+l*g,c[d++]=h&268435455;return e};Sk.builtin.biginteger.prototype.am=Sk.builtin.biginteger.prototype.am3;Sk.builtin.biginteger.dbits=28;Sk.builtin.biginteger.prototype.DB=Sk.builtin.biginteger.dbits;Sk.builtin.biginteger.prototype.DM=(1<<Sk.builtin.biginteger.dbits)-1;Sk.builtin.biginteger.prototype.DV=1<<Sk.builtin.biginteger.dbits;
+Sk.builtin.biginteger.BI_FP=52;Sk.builtin.biginteger.prototype.FV=Math.pow(2,Sk.builtin.biginteger.BI_FP);Sk.builtin.biginteger.prototype.F1=Sk.builtin.biginteger.BI_FP-Sk.builtin.biginteger.dbits;Sk.builtin.biginteger.prototype.F2=2*Sk.builtin.biginteger.dbits-Sk.builtin.biginteger.BI_FP;Sk.builtin.biginteger.BI_RM="0123456789abcdefghijklmnopqrstuvwxyz";Sk.builtin.biginteger.BI_RC=[];var rr,vv;rr=48;for(vv=0;9>=vv;++vv)Sk.builtin.biginteger.BI_RC[rr++]=vv;rr=97;
+for(vv=10;36>vv;++vv)Sk.builtin.biginteger.BI_RC[rr++]=vv;rr=65;for(vv=10;36>vv;++vv)Sk.builtin.biginteger.BI_RC[rr++]=vv;Sk.builtin.biginteger.int2char=function(a){return Sk.builtin.biginteger.BI_RM.charAt(a)};Sk.builtin.biginteger.intAt=function(a,b){var c=Sk.builtin.biginteger.BI_RC[a.charCodeAt(b)];return null==c?-1:c};Sk.builtin.biginteger.prototype.bnpCopyTo=function(a){var b;for(b=this.t-1;0<=b;--b)a[b]=this[b];a.t=this.t;a.s=this.s};
+Sk.builtin.biginteger.prototype.bnpFromInt=function(a){this.t=1;this.s=0>a?-1:0;0<a?this[0]=a:-1>a?this[0]=a+this.DV:this.t=0};Sk.builtin.biginteger.nbv=function(a){var b=new Sk.builtin.biginteger(null);b.bnpFromInt(a);return b};
+Sk.builtin.biginteger.prototype.bnpFromString=function(a,b){var c,d,e,f,g;if(16==b)g=4;else if(8==b)g=3;else if(256==b)g=8;else if(2==b)g=1;else if(32==b)g=5;else if(4==b)g=2;else{this.fromRadix(a,b);return}this.s=this.t=0;d=a.length;e=!1;for(f=0;0<=--d;)c=8==g?a[d]&255:Sk.builtin.biginteger.intAt(a,d),0>c?"-"==a.charAt(d)&&(e=!0):(e=!1,0===f?this[this.t++]=c:f+g>this.DB?(this[this.t-1]|=(c&(1<<this.DB-f)-1)<<f,this[this.t++]=c>>this.DB-f):this[this.t-1]|=c<<f,f+=g,f>=this.DB&&(f-=this.DB));8==g&&
+0!==(a[0]&128)&&(this.s=-1,0<f&&(this[this.t-1]|=(1<<this.DB-f)-1<<f));this.clamp();e&&Sk.builtin.biginteger.ZERO.subTo(this,this)};Sk.builtin.biginteger.prototype.bnpClamp=function(){for(var a=this.s&this.DM;0<this.t&&this[this.t-1]==a;)--this.t};
+Sk.builtin.biginteger.prototype.bnToString=function(a){var b,c,d,e,f,g;if(0>this.s)return"-"+this.negate().toString(a);if(16==a)g=4;else if(8==a)g=3;else if(2==a)g=1;else if(32==a)g=5;else if(4==a)g=2;else return this.toRadix(a);b=(1<<g)-1;d=!1;e="";f=this.t;a=this.DB-f*this.DB%g;if(0<f--)for(a<this.DB&&0<(c=this[f]>>a)&&(d=!0,e=Sk.builtin.biginteger.int2char(c));0<=f;)a<g?(c=(this[f]&(1<<a)-1)<<g-a,c|=this[--f]>>(a+=this.DB-g)):(c=this[f]>>(a-=g)&b,0>=a&&(a+=this.DB,--f)),0<c&&(d=!0),d&&(e+=Sk.builtin.biginteger.int2char(c));
+return d?e:"0"};Sk.builtin.biginteger.prototype.bnNegate=function(){var a=Sk.builtin.biginteger.nbi();Sk.builtin.biginteger.ZERO.subTo(this,a);return a};Sk.builtin.biginteger.prototype.bnAbs=function(){return 0>this.s?this.negate():this};Sk.builtin.biginteger.prototype.bnCompareTo=function(a){var b,c=this.s-a.s;if(0!==c)return c;b=this.t;c=b-a.t;if(0!==c)return 0>this.s?-c:c;for(;0<=--b;)if(0!==(c=this[b]-a[b]))return c;return 0};
+Sk.builtin.biginteger.nbits=function(a){var b=1,c;0!==(c=a>>>16)&&(a=c,b+=16);0!==(c=a>>8)&&(a=c,b+=8);0!==(c=a>>4)&&(a=c,b+=4);0!==(c=a>>2)&&(a=c,b+=2);0!==a>>1&&(b+=1);return b};Sk.builtin.biginteger.prototype.bnBitLength=function(){return 0>=this.t?0:this.DB*(this.t-1)+Sk.builtin.biginteger.nbits(this[this.t-1]^this.s&this.DM)};Sk.builtin.biginteger.prototype.bnpDLShiftTo=function(a,b){var c;for(c=this.t-1;0<=c;--c)b[c+a]=this[c];for(c=a-1;0<=c;--c)b[c]=0;b.t=this.t+a;b.s=this.s};
+Sk.builtin.biginteger.prototype.bnpDRShiftTo=function(a,b){var c;for(c=a;c<this.t;++c)b[c-a]=this[c];b.t=Math.max(this.t-a,0);b.s=this.s};Sk.builtin.biginteger.prototype.bnpLShiftTo=function(a,b){var c=a%this.DB,d=this.DB-c,e=(1<<d)-1,f=Math.floor(a/this.DB),g=this.s<<c&this.DM,h;for(h=this.t-1;0<=h;--h)b[h+f+1]=this[h]>>d|g,g=(this[h]&e)<<c;for(h=f-1;0<=h;--h)b[h]=0;b[f]=g;b.t=this.t+f+1;b.s=this.s;b.clamp()};
+Sk.builtin.biginteger.prototype.bnpRShiftTo=function(a,b){var c,d,e,f,g;b.s=this.s;g=Math.floor(a/this.DB);if(g>=this.t)b.t=0;else{f=a%this.DB;e=this.DB-f;d=(1<<f)-1;b[0]=this[g]>>f;for(c=g+1;c<this.t;++c)b[c-g-1]|=(this[c]&d)<<e,b[c-g]=this[c]>>f;0<f&&(b[this.t-g-1]|=(this.s&d)<<e);b.t=this.t-g;b.clamp()}};
+Sk.builtin.biginteger.prototype.bnpSubTo=function(a,b){for(var c=0,d=0,e=Math.min(a.t,this.t);c<e;)d+=this[c]-a[c],b[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d-=a.s;c<this.t;)d+=this[c],b[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d-=a[c],b[c++]=d&this.DM,d>>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b[c++]=this.DV+d:0<d&&(b[c++]=d);b.t=c;b.clamp()};
+Sk.builtin.biginteger.prototype.bnpMultiplyTo=function(a,b){var c=this.abs(),d=a.abs(),e=c.t;for(b.t=e+d.t;0<=--e;)b[e]=0;for(e=0;e<d.t;++e)b[e+c.t]=c.am(0,d[e],b,e,0,c.t);b.s=0;b.clamp();this.s!=a.s&&Sk.builtin.biginteger.ZERO.subTo(b,b)};
+Sk.builtin.biginteger.prototype.bnpSquareTo=function(a){for(var b,c=this.abs(),d=a.t=2*c.t;0<=--d;)a[d]=0;for(d=0;d<c.t-1;++d)b=c.am(d,c[d],a,2*d,0,1),(a[d+c.t]+=c.am(d+1,2*c[d],a,2*d+1,b,c.t-d-1))>=c.DV&&(a[d+c.t]-=c.DV,a[d+c.t+1]=1);0<a.t&&(a[a.t-1]+=c.am(d,c[d],a,2*d,0,1));a.s=0;a.clamp()};
+Sk.builtin.biginteger.prototype.bnpDivRemTo=function(a,b,c){var d,e,f,g,h,k,l,m,p,n,r,q;m=a.abs();if(!(0>=m.t))if(h=this.abs(),h.t<m.t)null!=b&&b.fromInt(0),null!=c&&this.copyTo(c);else if(null==c&&(c=Sk.builtin.biginteger.nbi()),n=Sk.builtin.biginteger.nbi(),r=this.s,q=a.s,a=this.DB-Sk.builtin.biginteger.nbits(m[m.t-1]),0<a?(m.lShiftTo(a,n),h.lShiftTo(a,c)):(m.copyTo(n),h.copyTo(c)),p=n.t,m=n[p-1],0!==m){d=m*(1<<this.F1)+(1<p?n[p-2]>>this.F2:0);h=this.FV/d;k=(1<<this.F1)/d;l=1<<this.F2;e=c.t;f=e-
+p;g=null==b?Sk.builtin.biginteger.nbi():b;n.dlShiftTo(f,g);0<=c.compareTo(g)&&(c[c.t++]=1,c.subTo(g,c));Sk.builtin.biginteger.ONE.dlShiftTo(p,g);for(g.subTo(n,n);n.t<p;)n[n.t++]=0;for(;0<=--f;)if(d=c[--e]==m?this.DM:Math.floor(c[e]*h+(c[e-1]+l)*k),(c[e]+=n.am(0,d,c,f,0,p))<d)for(n.dlShiftTo(f,g),c.subTo(g,c);c[e]<--d;)c.subTo(g,c);null!=b&&(c.drShiftTo(p,b),r!=q&&Sk.builtin.biginteger.ZERO.subTo(b,b));c.t=p;c.clamp();0<a&&c.rShiftTo(a,c);0>r&&Sk.builtin.biginteger.ZERO.subTo(c,c)}};
+Sk.builtin.biginteger.prototype.bnMod=function(a){var b=Sk.builtin.biginteger.nbi();this.abs().divRemTo(a,null,b);0>this.s&&0<b.compareTo(Sk.builtin.biginteger.ZERO)&&a.subTo(b,b);return b};Sk.builtin.biginteger.Classic=function(a){this.m=a};Sk.builtin.biginteger.prototype.cConvert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};Sk.builtin.biginteger.prototype.cRevert=function(a){return a};Sk.builtin.biginteger.prototype.cReduce=function(a){a.divRemTo(this.m,null,a)};
+Sk.builtin.biginteger.prototype.cMulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};Sk.builtin.biginteger.prototype.cSqrTo=function(a,b){a.squareTo(b);this.reduce(b)};Sk.builtin.biginteger.Classic.prototype.convert=Sk.builtin.biginteger.prototype.cConvert;Sk.builtin.biginteger.Classic.prototype.revert=Sk.builtin.biginteger.prototype.cRevert;Sk.builtin.biginteger.Classic.prototype.reduce=Sk.builtin.biginteger.prototype.cReduce;Sk.builtin.biginteger.Classic.prototype.mulTo=Sk.builtin.biginteger.prototype.cMulTo;
+Sk.builtin.biginteger.Classic.prototype.sqrTo=Sk.builtin.biginteger.prototype.cSqrTo;Sk.builtin.biginteger.prototype.bnpInvDigit=function(){var a,b;if(1>this.t)return 0;b=this[0];if(0===(b&1))return 0;a=b&3;a=a*(2-(b&15)*a)&15;a=a*(2-(b&255)*a)&255;a=a*(2-((b&65535)*a&65535))&65535;a=a*(2-b*a%this.DV)%this.DV;return 0<a?this.DV-a:-a};Sk.builtin.biginteger.Montgomery=function(a){this.m=a;this.mp=a.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<a.DB-15)-1;this.mt2=2*a.t};
+Sk.builtin.biginteger.prototype.montConvert=function(a){var b=Sk.builtin.biginteger.nbi();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0<b.compareTo(Sk.builtin.biginteger.ZERO)&&this.m.subTo(b,b);return b};Sk.builtin.biginteger.prototype.montRevert=function(a){var b=Sk.builtin.biginteger.nbi();a.copyTo(b);this.reduce(b);return b};
+Sk.builtin.biginteger.prototype.montReduce=function(a){for(var b,c,d;a.t<=this.mt2;)a[a.t++]=0;for(d=0;d<this.m.t;++d)for(c=a[d]&32767,b=c*this.mpl+((c*this.mph+(a[d]>>15)*this.mpl&this.um)<<15)&a.DM,c=d+this.m.t,a[c]+=this.m.am(0,b,a,d,0,this.m.t);a[c]>=a.DV;)a[c]-=a.DV,a[++c]++;a.clamp();a.drShiftTo(this.m.t,a);0<=a.compareTo(this.m)&&a.subTo(this.m,a)};Sk.builtin.biginteger.prototype.montSqrTo=function(a,b){a.squareTo(b);this.reduce(b)};
+Sk.builtin.biginteger.prototype.montMulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};Sk.builtin.biginteger.Montgomery.prototype.convert=Sk.builtin.biginteger.prototype.montConvert;Sk.builtin.biginteger.Montgomery.prototype.revert=Sk.builtin.biginteger.prototype.montRevert;Sk.builtin.biginteger.Montgomery.prototype.reduce=Sk.builtin.biginteger.prototype.montReduce;Sk.builtin.biginteger.Montgomery.prototype.mulTo=Sk.builtin.biginteger.prototype.montMulTo;
+Sk.builtin.biginteger.Montgomery.prototype.sqrTo=Sk.builtin.biginteger.prototype.montSqrTo;Sk.builtin.biginteger.prototype.bnpIsEven=function(){return 0===(0<this.t?this[0]&1:this.s)};Sk.builtin.biginteger.prototype.bnpExp=function(a,b){var c,d,e,f,g;if(4294967295<a||1>a)return Sk.builtin.biginteger.ONE;d=Sk.builtin.biginteger.nbi();e=Sk.builtin.biginteger.nbi();f=b.convert(this);g=Sk.builtin.biginteger.nbits(a)-1;for(f.copyTo(d);0<=--g;)b.sqrTo(d,e),0<(a&1<<g)?b.mulTo(e,f,d):(c=d,d=e,e=c);return b.revert(d)};
+Sk.builtin.biginteger.prototype.bnModPowInt=function(a,b){var c;c=256>a||b.isEven()?new Sk.builtin.biginteger.Classic(b):new Sk.builtin.biginteger.Montgomery(b);return this.exp(a,c)};Sk.builtin.biginteger.prototype.copyTo=Sk.builtin.biginteger.prototype.bnpCopyTo;Sk.builtin.biginteger.prototype.fromInt=Sk.builtin.biginteger.prototype.bnpFromInt;Sk.builtin.biginteger.prototype.fromString=Sk.builtin.biginteger.prototype.bnpFromString;Sk.builtin.biginteger.prototype.clamp=Sk.builtin.biginteger.prototype.bnpClamp;
+Sk.builtin.biginteger.prototype.dlShiftTo=Sk.builtin.biginteger.prototype.bnpDLShiftTo;Sk.builtin.biginteger.prototype.drShiftTo=Sk.builtin.biginteger.prototype.bnpDRShiftTo;Sk.builtin.biginteger.prototype.lShiftTo=Sk.builtin.biginteger.prototype.bnpLShiftTo;Sk.builtin.biginteger.prototype.rShiftTo=Sk.builtin.biginteger.prototype.bnpRShiftTo;Sk.builtin.biginteger.prototype.subTo=Sk.builtin.biginteger.prototype.bnpSubTo;Sk.builtin.biginteger.prototype.multiplyTo=Sk.builtin.biginteger.prototype.bnpMultiplyTo;
+Sk.builtin.biginteger.prototype.squareTo=Sk.builtin.biginteger.prototype.bnpSquareTo;Sk.builtin.biginteger.prototype.divRemTo=Sk.builtin.biginteger.prototype.bnpDivRemTo;Sk.builtin.biginteger.prototype.invDigit=Sk.builtin.biginteger.prototype.bnpInvDigit;Sk.builtin.biginteger.prototype.isEven=Sk.builtin.biginteger.prototype.bnpIsEven;Sk.builtin.biginteger.prototype.exp=Sk.builtin.biginteger.prototype.bnpExp;Sk.builtin.biginteger.prototype.toString=Sk.builtin.biginteger.prototype.bnToString;
+Sk.builtin.biginteger.prototype.negate=Sk.builtin.biginteger.prototype.bnNegate;Sk.builtin.biginteger.prototype.abs=Sk.builtin.biginteger.prototype.bnAbs;Sk.builtin.biginteger.prototype.compareTo=Sk.builtin.biginteger.prototype.bnCompareTo;Sk.builtin.biginteger.prototype.bitLength=Sk.builtin.biginteger.prototype.bnBitLength;Sk.builtin.biginteger.prototype.mod=Sk.builtin.biginteger.prototype.bnMod;Sk.builtin.biginteger.prototype.modPowInt=Sk.builtin.biginteger.prototype.bnModPowInt;
+Sk.builtin.biginteger.ZERO=Sk.builtin.biginteger.nbv(0);Sk.builtin.biginteger.ONE=Sk.builtin.biginteger.nbv(1);Sk.builtin.biginteger.prototype.bnClone=function(){var a=Sk.builtin.biginteger.nbi();this.copyTo(a);return a};Sk.builtin.biginteger.prototype.bnIntValue=function(){if(0>this.s){if(1==this.t)return this[0]-this.DV;if(0===this.t)return-1}else{if(1==this.t)return this[0];if(0===this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]};
+Sk.builtin.biginteger.prototype.bnByteValue=function(){return 0===this.t?this.s:this[0]<<24>>24};Sk.builtin.biginteger.prototype.bnShortValue=function(){return 0===this.t?this.s:this[0]<<16>>16};Sk.builtin.biginteger.prototype.bnpChunkSize=function(a){return Math.floor(Math.LN2*this.DB/Math.log(a))};Sk.builtin.biginteger.prototype.bnSigNum=function(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this[0]?0:1};
+Sk.builtin.biginteger.prototype.bnpToRadix=function(a){var b,c,d,e,f;null==a&&(a=10);if(0===this.signum()||2>a||36<a)return"0";b=this.chunkSize(a);f=Math.pow(a,b);b=Sk.builtin.biginteger.nbv(f);c=Sk.builtin.biginteger.nbi();d=Sk.builtin.biginteger.nbi();e="";for(this.divRemTo(b,c,d);0<c.signum();)e=(f+d.intValue()).toString(a).substr(1)+e,c.divRemTo(b,c,d);return d.intValue().toString(a)+e};
+Sk.builtin.biginteger.prototype.bnpFromRadix=function(a,b){var c,d,e,f,g,h,k;this.fromInt(0);null==b&&(b=10);k=this.chunkSize(b);e=Math.pow(b,k);f=!1;for(d=h=g=0;d<a.length;++d)if(c=Sk.builtin.biginteger.intAt(a,d),0>c){if("-"==a.charAt(d)&&0===this.signum()&&(f=!0),"."==a.charAt(d))break}else h=b*h+c,++g>=k&&(this.dMultiply(e),this.dAddOffset(h,0),h=g=0);0<g&&(this.dMultiply(Math.pow(b,g)),this.dAddOffset(h,0));f&&Sk.builtin.biginteger.ZERO.subTo(this,this)};
+Sk.builtin.biginteger.prototype.bnpFromNumber=function(a,b,c){if("number"==typeof b)if(2>a)this.fromInt(1);else for(this.fromNumber(a,c),this.testBit(a-1)||this.bitwiseTo(Sk.builtin.biginteger.ONE.shiftLeft(a-1),Sk.builtin.biginteger.op_or,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(Sk.builtin.biginteger.ONE.shiftLeft(a-1),this);this.fromString(a+"")};
+Sk.builtin.biginteger.prototype.bnToByteArray=function(){var a,b,c,d=this.t,e=[];e[0]=this.s;a=this.DB-d*this.DB%8;c=0;if(0<d--)for(a<this.DB&&(b=this[d]>>a)!=(this.s&this.DM)>>a&&(e[c++]=b|this.s<<this.DB-a);0<=d;)if(8>a?(b=(this[d]&(1<<a)-1)<<8-a,b|=this[--d]>>(a+=this.DB-8)):(b=this[d]>>(a-=8)&255,0>=a&&(a+=this.DB,--d)),0!==(b&128)&&(b|=-256),0===c&&(this.s&128)!=(b&128)&&++c,0<c||b!=this.s)e[c++]=b;return e};Sk.builtin.biginteger.prototype.bnEquals=function(a){return 0===this.compareTo(a)};
+Sk.builtin.biginteger.prototype.bnMin=function(a){return 0>this.compareTo(a)?this:a};Sk.builtin.biginteger.prototype.bnMax=function(a){return 0<this.compareTo(a)?this:a};Sk.builtin.biginteger.prototype.bnpBitwiseTo=function(a,b,c){var d,e,f=Math.min(a.t,this.t);for(d=0;d<f;++d)c[d]=b(this[d],a[d]);if(a.t<this.t){e=a.s&this.DM;for(d=f;d<this.t;++d)c[d]=b(this[d],e);c.t=this.t}else{e=this.s&this.DM;for(d=f;d<a.t;++d)c[d]=b(e,a[d]);c.t=a.t}c.s=b(this.s,a.s);c.clamp()};
+Sk.builtin.biginteger.op_and=function(a,b){return a&b};Sk.builtin.biginteger.prototype.bnAnd=function(a){var b=Sk.builtin.biginteger.nbi();this.bitwiseTo(a,Sk.builtin.biginteger.op_and,b);return b};Sk.builtin.biginteger.op_or=function(a,b){return a|b};Sk.builtin.biginteger.prototype.bnOr=function(a){var b=Sk.builtin.biginteger.nbi();this.bitwiseTo(a,Sk.builtin.biginteger.op_or,b);return b};Sk.builtin.biginteger.op_xor=function(a,b){return a^b};
+Sk.builtin.biginteger.prototype.bnXor=function(a){var b=Sk.builtin.biginteger.nbi();this.bitwiseTo(a,Sk.builtin.biginteger.op_xor,b);return b};Sk.builtin.biginteger.op_andnot=function(a,b){return a&~b};Sk.builtin.biginteger.prototype.bnAndNot=function(a){var b=Sk.builtin.biginteger.nbi();this.bitwiseTo(a,Sk.builtin.biginteger.op_andnot,b);return b};
+Sk.builtin.biginteger.prototype.bnNot=function(){var a,b=Sk.builtin.biginteger.nbi();for(a=0;a<this.t;++a)b[a]=this.DM&~this[a];b.t=this.t;b.s=~this.s;return b};Sk.builtin.biginteger.prototype.bnShiftLeft=function(a){var b=Sk.builtin.biginteger.nbi();0>a?this.rShiftTo(-a,b):this.lShiftTo(a,b);return b};Sk.builtin.biginteger.prototype.bnShiftRight=function(a){var b=Sk.builtin.biginteger.nbi();0>a?this.lShiftTo(-a,b):this.rShiftTo(a,b);return b};
+Sk.builtin.biginteger.lbit=function(a){var b;if(0===a)return-1;b=0;0===(a&65535)&&(a>>=16,b+=16);0===(a&255)&&(a>>=8,b+=8);0===(a&15)&&(a>>=4,b+=4);0===(a&3)&&(a>>=2,b+=2);0===(a&1)&&++b;return b};Sk.builtin.biginteger.prototype.bnGetLowestSetBit=function(){var a;for(a=0;a<this.t;++a)if(0!==this[a])return a*this.DB+Sk.builtin.biginteger.lbit(this[a]);return 0>this.s?this.t*this.DB:-1};Sk.builtin.biginteger.cbit=function(a){for(var b=0;0!==a;)a&=a-1,++b;return b};
+Sk.builtin.biginteger.prototype.bnBitCount=function(){var a,b=0,c=this.s&this.DM;for(a=0;a<this.t;++a)b+=Sk.builtin.biginteger.cbit(this[a]^c);return b};Sk.builtin.biginteger.prototype.bnTestBit=function(a){var b=Math.floor(a/this.DB);return b>=this.t?0!==this.s:0!==(this[b]&1<<a%this.DB)};Sk.builtin.biginteger.prototype.bnpChangeBit=function(a,b){var c=Sk.builtin.biginteger.ONE.shiftLeft(a);this.bitwiseTo(c,b,c);return c};
+Sk.builtin.biginteger.prototype.bnSetBit=function(a){return this.changeBit(a,Sk.builtin.biginteger.op_or)};Sk.builtin.biginteger.prototype.bnClearBit=function(a){return this.changeBit(a,Sk.builtin.biginteger.op_andnot)};Sk.builtin.biginteger.prototype.bnFlipBit=function(a){return this.changeBit(a,Sk.builtin.biginteger.op_xor)};
+Sk.builtin.biginteger.prototype.bnpAddTo=function(a,b){for(var c=0,d=0,e=Math.min(a.t,this.t);c<e;)d+=this[c]+a[c],b[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d+=a.s;c<this.t;)d+=this[c],b[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d+=a[c],b[c++]=d&this.DM,d>>=this.DB;d+=a.s}b.s=0>d?-1:0;0<d?b[c++]=d:-1>d&&(b[c++]=this.DV+d);b.t=c;b.clamp()};Sk.builtin.biginteger.prototype.bnAdd=function(a){var b=Sk.builtin.biginteger.nbi();this.addTo(a,b);return b};
+Sk.builtin.biginteger.prototype.bnSubtract=function(a){var b=Sk.builtin.biginteger.nbi();this.subTo(a,b);return b};Sk.builtin.biginteger.prototype.bnMultiply=function(a){var b=Sk.builtin.biginteger.nbi();this.multiplyTo(a,b);return b};Sk.builtin.biginteger.prototype.bnDivide=function(a){var b=Sk.builtin.biginteger.nbi();this.divRemTo(a,b,null);return b};Sk.builtin.biginteger.prototype.bnRemainder=function(a){var b=Sk.builtin.biginteger.nbi();this.divRemTo(a,null,b);return b};
+Sk.builtin.biginteger.prototype.bnDivideAndRemainder=function(a){var b=Sk.builtin.biginteger.nbi(),c=Sk.builtin.biginteger.nbi();this.divRemTo(a,b,c);return[b,c]};Sk.builtin.biginteger.prototype.bnpDMultiply=function(a){this[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()};Sk.builtin.biginteger.prototype.bnpDAddOffset=function(a,b){if(0!==a){for(;this.t<=b;)this[this.t++]=0;for(this[b]+=a;this[b]>=this.DV;)this[b]-=this.DV,++b>=this.t&&(this[this.t++]=0),++this[b]}};
+Sk.builtin.biginteger.NullExp=function(){};Sk.builtin.biginteger.prototype.nNop=function(a){return a};Sk.builtin.biginteger.prototype.nMulTo=function(a,b,c){a.multiplyTo(b,c)};Sk.builtin.biginteger.prototype.nSqrTo=function(a,b){a.squareTo(b)};Sk.builtin.biginteger.NullExp.prototype.convert=Sk.builtin.biginteger.prototype.nNop;Sk.builtin.biginteger.NullExp.prototype.revert=Sk.builtin.biginteger.prototype.nNop;Sk.builtin.biginteger.NullExp.prototype.mulTo=Sk.builtin.biginteger.prototype.nMulTo;
+Sk.builtin.biginteger.NullExp.prototype.sqrTo=Sk.builtin.biginteger.prototype.nSqrTo;Sk.builtin.biginteger.prototype.bnPow=function(a){return this.exp(a,new Sk.builtin.biginteger.NullExp)};Sk.builtin.biginteger.prototype.bnpMultiplyLowerTo=function(a,b,c){var d,e=Math.min(this.t+a.t,b);c.s=0;for(c.t=e;0<e;)c[--e]=0;for(d=c.t-this.t;e<d;++e)c[e+this.t]=this.am(0,a[e],c,e,0,this.t);for(d=Math.min(a.t,b);e<d;++e)this.am(0,a[e],c,e,0,b-e);c.clamp()};
+Sk.builtin.biginteger.prototype.bnpMultiplyUpperTo=function(a,b,c){var d;--b;d=c.t=this.t+a.t-b;for(c.s=0;0<=--d;)c[d]=0;for(d=Math.max(b-this.t,0);d<a.t;++d)c[this.t+d-b]=this.am(b-d,a[d],c,0,0,this.t+d-b);c.clamp();c.drShiftTo(1,c)};Sk.builtin.biginteger.Barrett=function(a){this.r2=Sk.builtin.biginteger.nbi();this.q3=Sk.builtin.biginteger.nbi();Sk.builtin.biginteger.ONE.dlShiftTo(2*a.t,this.r2);this.mu=this.r2.divide(a);this.m=a};
+Sk.builtin.biginteger.prototype.barrettConvert=function(a){var b;if(0>a.s||a.t>2*this.m.t)return a.mod(this.m);if(0>a.compareTo(this.m))return a;b=Sk.builtin.biginteger.nbi();a.copyTo(b);this.reduce(b);return b};Sk.builtin.biginteger.prototype.barrettRevert=function(a){return a};
+Sk.builtin.biginteger.prototype.barrettReduce=function(a){a.drShiftTo(this.m.t-1,this.r2);a.t>this.m.t+1&&(a.t=this.m.t+1,a.clamp());this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>a.compareTo(this.r2);)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);0<=a.compareTo(this.m);)a.subTo(this.m,a)};Sk.builtin.biginteger.prototype.barrettSqrTo=function(a,b){a.squareTo(b);this.reduce(b)};
+Sk.builtin.biginteger.prototype.barrettMulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};Sk.builtin.biginteger.Barrett.prototype.convert=Sk.builtin.biginteger.prototype.barrettConvert;Sk.builtin.biginteger.Barrett.prototype.revert=Sk.builtin.biginteger.prototype.barrettRevert;Sk.builtin.biginteger.Barrett.prototype.reduce=Sk.builtin.biginteger.prototype.barrettReduce;Sk.builtin.biginteger.Barrett.prototype.mulTo=Sk.builtin.biginteger.prototype.barrettMulTo;
+Sk.builtin.biginteger.Barrett.prototype.sqrTo=Sk.builtin.biginteger.prototype.barrettSqrTo;
+Sk.builtin.biginteger.prototype.bnModPow=function(a,b){var c,d,e,f,g,h,k,l,m=a.bitLength(),p,n=Sk.builtin.biginteger.nbv(1),r;if(0>=m)return n;p=18>m?1:48>m?3:144>m?4:768>m?5:6;r=8>m?new Sk.builtin.biginteger.Classic(b):b.isEven()?new Sk.builtin.biginteger.Barrett(b):new Sk.builtin.biginteger.Montgomery(b);h=[];g=3;k=p-1;l=(1<<p)-1;h[1]=r.convert(this);if(1<p)for(c=Sk.builtin.biginteger.nbi(),r.sqrTo(h[1],c);g<=l;)h[g]=Sk.builtin.biginteger.nbi(),r.mulTo(c,h[g-2],h[g]),g+=2;c=a.t-1;e=!0;f=Sk.builtin.biginteger.nbi();
+for(m=Sk.builtin.biginteger.nbits(a[c])-1;0<=c;){m>=k?d=a[c]>>m-k&l:(d=(a[c]&(1<<m+1)-1)<<k-m,0<c&&(d|=a[c-1]>>this.DB+m-k));for(g=p;0===(d&1);)d>>=1,--g;0>(m-=g)&&(m+=this.DB,--c);if(e)h[d].copyTo(n),e=!1;else{for(;1<g;)r.sqrTo(n,f),r.sqrTo(f,n),g-=2;0<g?r.sqrTo(n,f):(g=n,n=f,f=g);r.mulTo(f,h[d],n)}for(;0<=c&&0===(a[c]&1<<m);)r.sqrTo(n,f),g=n,n=f,f=g,0>--m&&(m=this.DB-1,--c)}return r.revert(n)};
+Sk.builtin.biginteger.prototype.bnGCD=function(a){var b,c,d=0>this.s?this.negate():this.clone();a=0>a.s?a.negate():a.clone();0>d.compareTo(a)&&(b=d,d=a,a=b);b=d.getLowestSetBit();c=a.getLowestSetBit();if(0>c)return d;b<c&&(c=b);0<c&&(d.rShiftTo(c,d),a.rShiftTo(c,a));for(;0<d.signum();)0<(b=d.getLowestSetBit())&&d.rShiftTo(b,d),0<(b=a.getLowestSetBit())&&a.rShiftTo(b,a),0<=d.compareTo(a)?(d.subTo(a,d),d.rShiftTo(1,d)):(a.subTo(d,a),a.rShiftTo(1,a));0<c&&a.lShiftTo(c,a);return a};
+Sk.builtin.biginteger.prototype.bnpModInt=function(a){var b,c,d;if(0>=a)return 0;c=this.DV%a;d=0>this.s?a-1:0;if(0<this.t)if(0===c)d=this[0]%a;else for(b=this.t-1;0<=b;--b)d=(c*d+this[b])%a;return d};
+Sk.builtin.biginteger.prototype.bnModInverse=function(a){var b,c,d,e,f,g,h=a.isEven();if(this.isEven()&&h||0===a.signum())return Sk.builtin.biginteger.ZERO;f=a.clone();g=this.clone();b=Sk.builtin.biginteger.nbv(1);c=Sk.builtin.biginteger.nbv(0);d=Sk.builtin.biginteger.nbv(0);for(e=Sk.builtin.biginteger.nbv(1);0!==f.signum();){for(;f.isEven();)f.rShiftTo(1,f),h?(b.isEven()&&c.isEven()||(b.addTo(this,b),c.subTo(a,c)),b.rShiftTo(1,b)):c.isEven()||c.subTo(a,c),c.rShiftTo(1,c);for(;g.isEven();)g.rShiftTo(1,
+g),h?(d.isEven()&&e.isEven()||(d.addTo(this,d),e.subTo(a,e)),d.rShiftTo(1,d)):e.isEven()||e.subTo(a,e),e.rShiftTo(1,e);0<=f.compareTo(g)?(f.subTo(g,f),h&&b.subTo(d,b),c.subTo(e,c)):(g.subTo(f,g),h&&d.subTo(b,d),e.subTo(c,e))}if(0!==g.compareTo(Sk.builtin.biginteger.ONE))return Sk.builtin.biginteger.ZERO;if(0<=e.compareTo(a))return e.subtract(a);if(0>e.signum())e.addTo(a,e);else return e;return 0>e.signum()?e.add(a):e};
+Sk.builtin.biginteger.lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509];
+Sk.builtin.biginteger.lplim=67108864/Sk.builtin.biginteger.lowprimes[Sk.builtin.biginteger.lowprimes.length-1];
+Sk.builtin.biginteger.prototype.bnIsProbablePrime=function(a){var b,c,d,e=this.abs();if(1==e.t&&e[0]<=Sk.builtin.biginteger.lowprimes[Sk.builtin.biginteger.lowprimes.length-1]){for(d=0;d<Sk.builtin.biginteger.lowprimes.length;++d)if(e[0]==Sk.builtin.biginteger.lowprimes[d])return!0;return!1}if(e.isEven())return!1;for(d=1;d<Sk.builtin.biginteger.lowprimes.length;){b=Sk.builtin.biginteger.lowprimes[d];for(c=d+1;c<Sk.builtin.biginteger.lowprimes.length&&b<Sk.builtin.biginteger.lplim;)b*=Sk.builtin.biginteger.lowprimes[c++];
+for(b=e.modInt(b);d<c;)if(0===b%Sk.builtin.biginteger.lowprimes[d++])return!1}return e.millerRabin(a)};
+Sk.builtin.biginteger.prototype.bnpMillerRabin=function(a){var b,c,d,e,f,g=this.subtract(Sk.builtin.biginteger.ONE),h=g.getLowestSetBit();if(0>=h)return!1;f=g.shiftRight(h);a=a+1>>1;a>Sk.builtin.biginteger.lowprimes.length&&(a=Sk.builtin.biginteger.lowprimes.length);e=Sk.builtin.biginteger.nbi();for(d=0;d<a;++d)if(e.fromInt(Sk.builtin.biginteger.lowprimes[d]),c=e.modPow(f,this),0!==c.compareTo(Sk.builtin.biginteger.ONE)&&0!==c.compareTo(g)){for(b=1;b++<h&&0!==c.compareTo(g);)if(c=c.modPowInt(2,this),
+0===c.compareTo(Sk.builtin.biginteger.ONE))return!1;if(0!==c.compareTo(g))return!1}return!0};Sk.builtin.biginteger.prototype.isnegative=function(){return 0>this.s};Sk.builtin.biginteger.prototype.ispositive=function(){return 0<=this.s};Sk.builtin.biginteger.prototype.trueCompare=function(a){return 0<=this.s&&0>a.s?1:0>this.s&&0<=a.s?-1:this.compare(a)};Sk.builtin.biginteger.prototype.chunkSize=Sk.builtin.biginteger.prototype.bnpChunkSize;Sk.builtin.biginteger.prototype.toRadix=Sk.builtin.biginteger.prototype.bnpToRadix;
+Sk.builtin.biginteger.prototype.fromRadix=Sk.builtin.biginteger.prototype.bnpFromRadix;Sk.builtin.biginteger.prototype.fromNumber=Sk.builtin.biginteger.prototype.bnpFromNumber;Sk.builtin.biginteger.prototype.bitwiseTo=Sk.builtin.biginteger.prototype.bnpBitwiseTo;Sk.builtin.biginteger.prototype.changeBit=Sk.builtin.biginteger.prototype.bnpChangeBit;Sk.builtin.biginteger.prototype.addTo=Sk.builtin.biginteger.prototype.bnpAddTo;Sk.builtin.biginteger.prototype.dMultiply=Sk.builtin.biginteger.prototype.bnpDMultiply;
+Sk.builtin.biginteger.prototype.dAddOffset=Sk.builtin.biginteger.prototype.bnpDAddOffset;Sk.builtin.biginteger.prototype.multiplyLowerTo=Sk.builtin.biginteger.prototype.bnpMultiplyLowerTo;Sk.builtin.biginteger.prototype.multiplyUpperTo=Sk.builtin.biginteger.prototype.bnpMultiplyUpperTo;Sk.builtin.biginteger.prototype.modInt=Sk.builtin.biginteger.prototype.bnpModInt;Sk.builtin.biginteger.prototype.millerRabin=Sk.builtin.biginteger.prototype.bnpMillerRabin;Sk.builtin.biginteger.prototype.clone=Sk.builtin.biginteger.prototype.bnClone;
+Sk.builtin.biginteger.prototype.intValue=Sk.builtin.biginteger.prototype.bnIntValue;Sk.builtin.biginteger.prototype.byteValue=Sk.builtin.biginteger.prototype.bnByteValue;Sk.builtin.biginteger.prototype.shortValue=Sk.builtin.biginteger.prototype.bnShortValue;Sk.builtin.biginteger.prototype.signum=Sk.builtin.biginteger.prototype.bnSigNum;Sk.builtin.biginteger.prototype.toByteArray=Sk.builtin.biginteger.prototype.bnToByteArray;Sk.builtin.biginteger.prototype.equals=Sk.builtin.biginteger.prototype.bnEquals;
+Sk.builtin.biginteger.prototype.compare=Sk.builtin.biginteger.prototype.compareTo;Sk.builtin.biginteger.prototype.min=Sk.builtin.biginteger.prototype.bnMin;Sk.builtin.biginteger.prototype.max=Sk.builtin.biginteger.prototype.bnMax;Sk.builtin.biginteger.prototype.and=Sk.builtin.biginteger.prototype.bnAnd;Sk.builtin.biginteger.prototype.or=Sk.builtin.biginteger.prototype.bnOr;Sk.builtin.biginteger.prototype.xor=Sk.builtin.biginteger.prototype.bnXor;Sk.builtin.biginteger.prototype.andNot=Sk.builtin.biginteger.prototype.bnAndNot;
+Sk.builtin.biginteger.prototype.not=Sk.builtin.biginteger.prototype.bnNot;Sk.builtin.biginteger.prototype.shiftLeft=Sk.builtin.biginteger.prototype.bnShiftLeft;Sk.builtin.biginteger.prototype.shiftRight=Sk.builtin.biginteger.prototype.bnShiftRight;Sk.builtin.biginteger.prototype.getLowestSetBit=Sk.builtin.biginteger.prototype.bnGetLowestSetBit;Sk.builtin.biginteger.prototype.bitCount=Sk.builtin.biginteger.prototype.bnBitCount;Sk.builtin.biginteger.prototype.testBit=Sk.builtin.biginteger.prototype.bnTestBit;
+Sk.builtin.biginteger.prototype.setBit=Sk.builtin.biginteger.prototype.bnSetBit;Sk.builtin.biginteger.prototype.clearBit=Sk.builtin.biginteger.prototype.bnClearBit;Sk.builtin.biginteger.prototype.flipBit=Sk.builtin.biginteger.prototype.bnFlipBit;Sk.builtin.biginteger.prototype.add=Sk.builtin.biginteger.prototype.bnAdd;Sk.builtin.biginteger.prototype.subtract=Sk.builtin.biginteger.prototype.bnSubtract;Sk.builtin.biginteger.prototype.multiply=Sk.builtin.biginteger.prototype.bnMultiply;
+Sk.builtin.biginteger.prototype.divide=Sk.builtin.biginteger.prototype.bnDivide;Sk.builtin.biginteger.prototype.remainder=Sk.builtin.biginteger.prototype.bnRemainder;Sk.builtin.biginteger.prototype.divideAndRemainder=Sk.builtin.biginteger.prototype.bnDivideAndRemainder;Sk.builtin.biginteger.prototype.modPow=Sk.builtin.biginteger.prototype.bnModPow;Sk.builtin.biginteger.prototype.modInverse=Sk.builtin.biginteger.prototype.bnModInverse;Sk.builtin.biginteger.prototype.pow=Sk.builtin.biginteger.prototype.bnPow;
+Sk.builtin.biginteger.prototype.gcd=Sk.builtin.biginteger.prototype.bnGCD;Sk.builtin.biginteger.prototype.isProbablePrime=Sk.builtin.biginteger.prototype.bnIsProbablePrime;Sk.builtin.int_=function(a,b){var c,d;if(!(this instanceof Sk.builtin.int_))return new Sk.builtin.int_(a,b);if(this instanceof Sk.builtin.bool)return this;if(a instanceof Sk.builtin.int_&&void 0===b)return this.v=a.v,this;if(void 0!==b&&!Sk.builtin.checkInt(b)){if(Sk.builtin.checkFloat(b))throw new Sk.builtin.TypeError("integer argument expected, got "+Sk.abstr.typeName(b));if(b.__index__)b=Sk.misceval.callsim(b.__index__,b);else if(b.__int__)b=Sk.misceval.callsim(b.__int__,b);else throw new Sk.builtin.AttributeError(Sk.abstr.typeName(b)+
+" instance has no attribute '__index__' or '__int__'");}if(a instanceof Sk.builtin.str){b=Sk.builtin.asnum$(b);c=Sk.str2number(a.v,b,parseInt,function(a){return-a},"int");if(c>Sk.builtin.int_.threshold$||c<-Sk.builtin.int_.threshold$)return new Sk.builtin.lng(a,b);this.v=c;return this}if(void 0!==b)throw new Sk.builtin.TypeError("int() can't convert non-string with explicit base");if(void 0===a||a===Sk.builtin.none)a=0;void 0!==a&&a.tp$getattr&&a.tp$getattr("__int__")?(c=Sk.misceval.callsim(a.tp$getattr("__int__")),
+d="__int__"):void 0!==a&&a.__int__?(c=Sk.misceval.callsim(a.__int__,a),d="__int__"):void 0!==a&&a.tp$getattr&&a.tp$getattr("__trunc__")?(c=Sk.misceval.callsim(a.tp$getattr("__trunc__")),d="__trunc__"):void 0!==a&&a.__trunc__&&(c=Sk.misceval.callsim(a.__trunc__,a),d="__trunc__");if(void 0===c||Sk.builtin.checkInt(c))void 0!==c&&(a=c);else throw new Sk.builtin.TypeError(d+" returned non-Integral (type "+Sk.abstr.typeName(c)+")");if(!Sk.builtin.checkNumber(a))throw new Sk.builtin.TypeError("int() argument must be a string or a number, not '"+
+Sk.abstr.typeName(a)+"'");a=Sk.builtin.asnum$(a);if(a>Sk.builtin.int_.threshold$||a<-Sk.builtin.int_.threshold$)return new Sk.builtin.lng(a);-1<a&&1>a&&(a=0);this.v=parseInt(a,b);return this};Sk.abstr.setUpInheritance("int",Sk.builtin.int_,Sk.builtin.numtype);Sk.builtin.int_.prototype.nb$int_=function(){return this};Sk.builtin.int_.prototype.nb$float_=function(){return new Sk.builtin.float_(this.v)};Sk.builtin.int_.prototype.nb$lng=function(){return new Sk.builtin.lng(this.v)};
+Sk.builtin.int_.prototype.__trunc__=new Sk.builtin.func(function(a){return a});Sk.builtin.int_.prototype.__index__=new Sk.builtin.func(function(a){return a});Sk.builtin.int_.prototype.__complex__=new Sk.builtin.func(function(a){return Sk.builtin.NotImplemented.NotImplemented$});Sk.builtin.int_.prototype.tp$index=function(){return this.v};Sk.builtin.int_.prototype.tp$hash=function(){return new Sk.builtin.int_(this.v)};Sk.builtin.int_.threshold$=Math.pow(2,53)-1;Sk.builtin.int_.prototype.clone=function(){return new Sk.builtin.int_(this.v)};
+Sk.builtin.int_.prototype.nb$add=function(a){var b;return a instanceof Sk.builtin.int_?new Sk.builtin.int_(this.v+a.v):a instanceof Sk.builtin.lng?(b=new Sk.builtin.lng(this.v),b.nb$add(a)):a instanceof Sk.builtin.float_?(b=new Sk.builtin.float_(this.v),b.nb$add(a)):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.int_.prototype.nb$reflected_add=function(a){return Sk.builtin.int_.prototype.nb$add.call(this,a)};
+Sk.builtin.int_.prototype.nb$subtract=function(a){var b;return a instanceof Sk.builtin.int_?new Sk.builtin.int_(this.v-a.v):a instanceof Sk.builtin.lng?(b=new Sk.builtin.lng(this.v),b.nb$subtract(a)):a instanceof Sk.builtin.float_?(b=new Sk.builtin.float_(this.v),b.nb$subtract(a)):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.int_.prototype.nb$reflected_subtract=function(a){var b=this.nb$negative();return Sk.builtin.int_.prototype.nb$add.call(b,a)};
+Sk.builtin.int_.prototype.nb$multiply=function(a){var b;return a instanceof Sk.builtin.int_?(b=this.v*a.v,b>Sk.builtin.int_.threshold$||b<-Sk.builtin.int_.threshold$?(b=new Sk.builtin.lng(this.v),b.nb$multiply(a)):new Sk.builtin.int_(b)):a instanceof Sk.builtin.lng?(b=new Sk.builtin.lng(this.v),b.nb$multiply(a)):a instanceof Sk.builtin.float_?(b=new Sk.builtin.float_(this.v),b.nb$multiply(a)):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.int_.prototype.nb$reflected_multiply=function(a){return Sk.builtin.int_.prototype.nb$multiply.call(this,a)};Sk.builtin.int_.prototype.nb$divide=function(a){var b;return Sk.python3?(b=new Sk.builtin.float_(this.v),b.nb$divide(a)):a instanceof Sk.builtin.int_?this.nb$floor_divide(a):a instanceof Sk.builtin.lng?(b=new Sk.builtin.lng(this.v),b.nb$divide(a)):a instanceof Sk.builtin.float_?(b=new Sk.builtin.float_(this.v),b.nb$divide(a)):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.int_.prototype.nb$reflected_divide=function(a){return this.nb$reflected_floor_divide(a)};
+Sk.builtin.int_.prototype.nb$floor_divide=function(a){var b;if(a instanceof Sk.builtin.int_){if(0===a.v)throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");return new Sk.builtin.int_(Math.floor(this.v/a.v))}return a instanceof Sk.builtin.lng?(b=new Sk.builtin.lng(this.v),b.nb$floor_divide(a)):a instanceof Sk.builtin.float_?(b=new Sk.builtin.float_(this.v),b.nb$floor_divide(a)):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.int_.prototype.nb$reflected_floor_divide=function(a){return a instanceof Sk.builtin.int_?a.nb$divide(this):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.int_.prototype.nb$remainder=function(a){var b;return a instanceof Sk.builtin.int_?(b=Sk.abstr.numberBinOp(this,a,"FloorDiv"),b=Sk.abstr.numberBinOp(b,a,"Mult"),b=Sk.abstr.numberBinOp(this,b,"Sub"),b=b.v,0>a.v&&0===b?b=-0:0===b&&-Infinity===Infinity/b&&(b=0),new Sk.builtin.int_(b)):a instanceof Sk.builtin.lng?(b=new Sk.builtin.lng(this.v),b.nb$remainder(a)):a instanceof Sk.builtin.float_?(b=new Sk.builtin.float_(this.v),b.nb$remainder(a)):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.int_.prototype.nb$reflected_remainder=function(a){return a instanceof Sk.builtin.int_?a.nb$remainder(this):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.int_.prototype.nb$divmod=function(a){var b;return a instanceof Sk.builtin.int_?new Sk.builtin.tuple([this.nb$floor_divide(a),this.nb$remainder(a)]):a instanceof Sk.builtin.lng?(b=new Sk.builtin.lng(this.v),b.nb$divmod(a)):a instanceof Sk.builtin.float_?(b=new Sk.builtin.float_(this.v),b.nb$divmod(a)):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.int_.prototype.nb$reflected_divmod=function(a){return a instanceof Sk.builtin.int_?new Sk.builtin.tuple([a.nb$floor_divide(this),a.nb$remainder(this)]):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.int_.prototype.nb$power=function(a,b){var c;if(a instanceof Sk.builtin.int_&&(void 0===b||b instanceof Sk.builtin.int_)){c=Math.pow(this.v,a.v);c>Sk.builtin.int_.threshold$||c<-Sk.builtin.int_.threshold$?(c=new Sk.builtin.lng(this.v),c=c.nb$power(a,b)):c=0>a.v?new Sk.builtin.float_(c):new Sk.builtin.int_(c);if(void 0!==b){if(0>a.v)throw new Sk.builtin.TypeError("pow() 2nd argument cannot be negative when 3rd argument specified");return c.nb$remainder(b)}return c}return a instanceof Sk.builtin.lng?
+(c=new Sk.builtin.lng(this.v),c.nb$power(a)):a instanceof Sk.builtin.float_?(c=new Sk.builtin.float_(this.v),c.nb$power(a)):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.int_.prototype.nb$reflected_power=function(a,b){return a instanceof Sk.builtin.int_?a.nb$power(this,b):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.int_.prototype.nb$abs=function(){return new Sk.builtin.int_(Math.abs(this.v))};
+Sk.builtin.int_.prototype.nb$and=function(a){var b;return a instanceof Sk.builtin.int_&&(a=Sk.builtin.asnum$(a),b=this.v&a,void 0!==b&&0>b&&(b+=4294967296),void 0!==b)?new Sk.builtin.int_(b):a instanceof Sk.builtin.lng?(b=new Sk.builtin.lng(this.v),b.nb$and(a)):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.int_.prototype.nb$reflected_and=Sk.builtin.int_.prototype.nb$and;
+Sk.builtin.int_.prototype.nb$or=function(a){var b;return a instanceof Sk.builtin.int_&&(a=Sk.builtin.asnum$(a),b=this.v|a,void 0!==b&&0>b&&(b+=4294967296),void 0!==b)?new Sk.builtin.int_(b):a instanceof Sk.builtin.lng?(b=new Sk.builtin.lng(this.v),b.nb$and(a)):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.int_.prototype.nb$reflected_or=Sk.builtin.int_.prototype.nb$or;
+Sk.builtin.int_.prototype.nb$xor=function(a){var b;return a instanceof Sk.builtin.int_&&(a=Sk.builtin.asnum$(a),b=this.v^a,void 0!==b&&0>b&&(b+=4294967296),void 0!==b)?new Sk.builtin.int_(b):a instanceof Sk.builtin.lng?(b=new Sk.builtin.lng(this.v),b.nb$xor(a)):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.int_.prototype.nb$reflected_xor=Sk.builtin.int_.prototype.nb$xor;
+Sk.builtin.int_.prototype.nb$lshift=function(a){var b;if(a instanceof Sk.builtin.int_){var c=Sk.builtin.asnum$(a);if(void 0!==c){if(0>c)throw new Sk.builtin.ValueError("negative shift count");b=this.v<<c;if(b<=this.v)return(new Sk.builtin.lng(this.v)).nb$lshift(a)}if(void 0!==b)return new Sk.builtin.int_(b)}return a instanceof Sk.builtin.lng?(b=new Sk.builtin.lng(this.v),b.nb$lshift(a)):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.int_.prototype.nb$reflected_lshift=function(a){return a instanceof Sk.builtin.int_?a.nb$lshift(this):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.int_.prototype.nb$rshift=function(a){var b;if(a instanceof Sk.builtin.int_){var c=Sk.builtin.asnum$(a);if(void 0!==c){if(0>c)throw new Sk.builtin.ValueError("negative shift count");b=this.v>>c;0<this.v&&0>b&&(b&=Math.pow(2,32-c)-1)}if(void 0!==b)return new Sk.builtin.int_(b)}return a instanceof Sk.builtin.lng?(b=new Sk.builtin.lng(this.v),b.nb$rshift(a)):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.int_.prototype.nb$reflected_rshift=function(a){return a instanceof Sk.builtin.int_?a.nb$rshift(this):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.int_.prototype.nb$invert=function(){return new Sk.builtin.int_(~this.v)};Sk.builtin.int_.prototype.nb$inplace_add=Sk.builtin.int_.prototype.nb$add;Sk.builtin.int_.prototype.nb$inplace_subtract=Sk.builtin.int_.prototype.nb$subtract;Sk.builtin.int_.prototype.nb$inplace_multiply=Sk.builtin.int_.prototype.nb$multiply;
+Sk.builtin.int_.prototype.nb$inplace_divide=Sk.builtin.int_.prototype.nb$divide;Sk.builtin.int_.prototype.nb$inplace_remainder=Sk.builtin.int_.prototype.nb$remainder;Sk.builtin.int_.prototype.nb$inplace_floor_divide=Sk.builtin.int_.prototype.nb$floor_divide;Sk.builtin.int_.prototype.nb$inplace_power=Sk.builtin.int_.prototype.nb$power;Sk.builtin.int_.prototype.nb$inplace_and=Sk.builtin.int_.prototype.nb$and;Sk.builtin.int_.prototype.nb$inplace_or=Sk.builtin.int_.prototype.nb$or;
+Sk.builtin.int_.prototype.nb$inplace_xor=Sk.builtin.int_.prototype.nb$xor;Sk.builtin.int_.prototype.nb$inplace_lshift=Sk.builtin.int_.prototype.nb$lshift;Sk.builtin.int_.prototype.nb$inplace_rshift=Sk.builtin.int_.prototype.nb$rshift;Sk.builtin.int_.prototype.nb$negative=function(){return new Sk.builtin.int_(-this.v)};Sk.builtin.int_.prototype.nb$positive=function(){return this.clone()};Sk.builtin.int_.prototype.nb$nonzero=function(){return 0!==this.v};
+Sk.builtin.int_.prototype.nb$isnegative=function(){return 0>this.v};Sk.builtin.int_.prototype.nb$ispositive=function(){return 0<=this.v};Sk.builtin.int_.prototype.numberCompare=function(a){return a instanceof Sk.builtin.int_?this.v-a.v:a instanceof Sk.builtin.lng?-a.longCompare(this):a instanceof Sk.builtin.float_?-a.numberCompare(this):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.int_.prototype.ob$eq=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng||a instanceof Sk.builtin.float_?new Sk.builtin.bool(0==this.numberCompare(a)):a instanceof Sk.builtin.none?Sk.builtin.bool.false$:Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.int_.prototype.ob$ne=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng||a instanceof Sk.builtin.float_?new Sk.builtin.bool(0!=this.numberCompare(a)):a instanceof Sk.builtin.none?Sk.builtin.bool.true$:Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.int_.prototype.ob$lt=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng||a instanceof Sk.builtin.float_?new Sk.builtin.bool(0>this.numberCompare(a)):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.int_.prototype.ob$le=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng||a instanceof Sk.builtin.float_?new Sk.builtin.bool(0>=this.numberCompare(a)):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.int_.prototype.ob$gt=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng||a instanceof Sk.builtin.float_?new Sk.builtin.bool(0<this.numberCompare(a)):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.int_.prototype.ob$ge=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng||a instanceof Sk.builtin.float_?new Sk.builtin.bool(0<=this.numberCompare(a)):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.int_.prototype.__round__=function(a,b){Sk.builtin.pyCheckArgs("__round__",arguments,1,2);var c,d;if(void 0!==b&&!Sk.misceval.isIndex(b))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object cannot be interpreted as an index");void 0===b&&(b=0);d=Sk.builtin.asnum$(a);b=Sk.misceval.asIndex(b);c=Math.pow(10,b);c=Math.round(d*c)/c;return new Sk.builtin.int_(c)};Sk.builtin.int_.prototype.conjugate=new Sk.builtin.func(function(a){return new Sk.builtin.int_(a.v)});
+Sk.builtin.int_.prototype.$r=function(){return new Sk.builtin.str(this.str$(10,!0))};Sk.builtin.int_.prototype.tp$str=function(){return new Sk.builtin.str(this.str$(10,!0))};Sk.builtin.int_.prototype.str$=function(a,b){var c;void 0===b&&(b=!0);c=b?this.v:Math.abs(this.v);return void 0===a||10===a?c.toString():c.toString(a)};
+Sk.str2number=function(a,b,c,d,e){var f=a,g=!1,h,k,l;a=a.replace(/^\s+|\s+$/g,"");"-"===a.charAt(0)&&(g=!0,a=a.substring(1));"+"===a.charAt(0)&&(a=a.substring(1));void 0===b&&(b=10);if((2>b||36<b)&&0!==b)throw new Sk.builtin.ValueError(e+"() base must be >= 2 and <= 36");if("0x"===a.substring(0,2).toLowerCase())if(16===b||0===b)a=a.substring(2),b=16;else{if(34>b)throw new Sk.builtin.ValueError("invalid literal for "+e+"() with base "+b+": '"+f+"'");}else if("0b"===a.substring(0,2).toLowerCase())if(2===
+b||0===b)a=a.substring(2),b=2;else{if(12>b)throw new Sk.builtin.ValueError("invalid literal for "+e+"() with base "+b+": '"+f+"'");}else if("0o"===a.substring(0,2).toLowerCase())if(8===b||0===b)a=a.substring(2),b=8;else{if(25>b)throw new Sk.builtin.ValueError("invalid literal for "+e+"() with base "+b+": '"+f+"'");}else if("0"===a.charAt(0)){if("0"===a)return 0;if(8===b||0===b)b=8}0===b&&(b=10);if(0===a.length)throw new Sk.builtin.ValueError("invalid literal for "+e+"() with base "+b+": '"+f+"'");
+for(h=0;h<a.length;h+=1)if(k=a.charCodeAt(h),l=b,48<=k&&57>=k?l=k-48:65<=k&&90>=k?l=k-65+10:97<=k&&122>=k&&(l=k-97+10),l>=b)throw new Sk.builtin.ValueError("invalid literal for "+e+"() with base "+b+": '"+f+"'");l=c(a,b);g&&(l=d(l));return l};goog.exportSymbol("Sk.builtin.int_",Sk.builtin.int_);Sk.builtin.bool=function(a){Sk.builtin.pyCheckArgs("bool",arguments,1);return Sk.misceval.isTrue(a)?Sk.builtin.bool.true$:Sk.builtin.bool.false$};Sk.abstr.setUpInheritance("bool",Sk.builtin.bool,Sk.builtin.int_);Sk.builtin.bool.prototype.$r=function(){return this.v?new Sk.builtin.str("True"):new Sk.builtin.str("False")};Sk.builtin.bool.prototype.tp$hash=function(){return new Sk.builtin.int_(this.v)};Sk.builtin.bool.prototype.__int__=new Sk.builtin.func(function(a){a=Sk.builtin.asnum$(a);return new Sk.builtin.int_(a)});
+Sk.builtin.bool.prototype.__float__=new Sk.builtin.func(function(a){return new Sk.builtin.float_(Sk.ffi.remapToJs(a))});goog.exportSymbol("Sk.builtin.bool",Sk.builtin.bool);Sk.builtin.float_=function(a){if(void 0===a)return new Sk.builtin.float_(0);if(!(this instanceof Sk.builtin.float_))return new Sk.builtin.float_(a);if(a instanceof Sk.builtin.str){if(a.v.match(/^-inf$/i))a=-Infinity;else if(a.v.match(/^[+]?inf$/i))a=Infinity;else if(a.v.match(/^[-+]?nan$/i))a=NaN;else{if(isNaN(a.v))throw new Sk.builtin.ValueError("float: Argument: "+a.v+" is not number");a=parseFloat(a.v)}return new Sk.builtin.float_(a)}if("number"===typeof a||a instanceof Sk.builtin.int_||a instanceof
+Sk.builtin.lng||a instanceof Sk.builtin.float_)return this.v=Sk.builtin.asnum$(a),this;if(a instanceof Sk.builtin.bool)return this.v=Sk.builtin.asnum$(a),this;if("boolean"===typeof a)return this.v=a?1:0,this;if("string"===typeof a)return this.v=parseFloat(a),this;var b=Sk.abstr.lookupSpecial(a,"__float__");if(null!=b)return Sk.misceval.callsim(b,a);throw new Sk.builtin.TypeError("float() argument must be a string or a number");};Sk.abstr.setUpInheritance("float",Sk.builtin.float_,Sk.builtin.numtype);
+Sk.builtin.float_.prototype.nb$int_=function(){var a=this.v,a=0>a?Math.ceil(a):Math.floor(a);return new Sk.builtin.int_(a)};Sk.builtin.float_.prototype.nb$float_=function(){return this};Sk.builtin.float_.prototype.nb$lng=function(){return new Sk.builtin.lng(this.v)};Sk.builtin.float_.PyFloat_Check=function(a){return void 0===a?!1:Sk.builtin.checkNumber(a)||Sk.builtin.checkFloat(a)||Sk.builtin.issubclass(a.ob$type,Sk.builtin.float_)?!0:!1};Sk.builtin.float_.PyFloat_Check_Exact=function(a){return Sk.builtin.checkFloat(a)};
+Sk.builtin.float_.PyFloat_AsDouble=function(a){var b;if(a&&Sk.builtin.float_.PyFloat_Check(a))return Sk.ffi.remapToJs(a);if(null==a)throw Error("bad argument for internal PyFloat_AsDouble function");b=Sk.builtin.type.typeLookup(a.ob$type,"__float__");if(null==b)throw new Sk.builtin.TypeError("a float is required");a=Sk.misceval.callsim(b,a);if(!Sk.builtin.float_.PyFloat_Check(a))throw new Sk.builtin.TypeError("nb_float should return float object");return Sk.ffi.remapToJs(a)};
+Sk.builtin.float_.prototype.tp$index=function(){return this.v};Sk.builtin.float_.prototype.tp$hash=function(){return this.nb$int_()};Sk.builtin.float_.prototype.clone=function(){return new Sk.builtin.float_(this.v)};Sk.builtin.float_.prototype.toFixed=function(a){a=Sk.builtin.asnum$(a);return this.v.toFixed(a)};
+Sk.builtin.float_.prototype.nb$add=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.float_?new Sk.builtin.float_(this.v+a.v):a instanceof Sk.builtin.lng?new Sk.builtin.float_(this.v+parseFloat(a.str$(10,!0))):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.float_.prototype.nb$reflected_add=function(a){return Sk.builtin.float_.prototype.nb$add.call(this,a)};
+Sk.builtin.float_.prototype.nb$subtract=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.float_?new Sk.builtin.float_(this.v-a.v):a instanceof Sk.builtin.lng?new Sk.builtin.float_(this.v-parseFloat(a.str$(10,!0))):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.float_.prototype.nb$reflected_subtract=function(a){var b=this.nb$negative();return Sk.builtin.float_.prototype.nb$add.call(b,a)};
+Sk.builtin.float_.prototype.nb$multiply=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.float_?new Sk.builtin.float_(this.v*a.v):a instanceof Sk.builtin.lng?new Sk.builtin.float_(this.v*parseFloat(a.str$(10,!0))):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.float_.prototype.nb$reflected_multiply=function(a){return Sk.builtin.float_.prototype.nb$multiply.call(this,a)};
+Sk.builtin.float_.prototype.nb$divide=function(a){if(a instanceof Sk.builtin.int_||a instanceof Sk.builtin.float_){if(0===a.v)throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");return Infinity===this.v?Infinity===a.v||-Infinity===a.v?new Sk.builtin.float_(NaN):a.nb$isnegative()?new Sk.builtin.float_(-Infinity):new Sk.builtin.float_(Infinity):-Infinity===this.v?Infinity===a.v||-Infinity===a.v?new Sk.builtin.float_(NaN):a.nb$isnegative()?new Sk.builtin.float_(Infinity):new Sk.builtin.float_(-Infinity):
+new Sk.builtin.float_(this.v/a.v)}if(a instanceof Sk.builtin.lng){if(0===a.longCompare(Sk.builtin.biginteger.ZERO))throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");return Infinity===this.v?a.nb$isnegative()?new Sk.builtin.float_(-Infinity):new Sk.builtin.float_(Infinity):-Infinity===this.v?a.nb$isnegative()?new Sk.builtin.float_(Infinity):new Sk.builtin.float_(-Infinity):new Sk.builtin.float_(this.v/parseFloat(a.str$(10,!0)))}return Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.float_.prototype.nb$reflected_divide=function(a){if(a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng)a=new Sk.builtin.float_(a);return a instanceof Sk.builtin.float_?a.nb$divide(this):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.float_.prototype.nb$floor_divide=function(a){if(a instanceof Sk.builtin.int_||a instanceof Sk.builtin.float_){if(Infinity===this.v||-Infinity===this.v)return new Sk.builtin.float_(NaN);if(0===a.v)throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");return Infinity===a.v?this.nb$isnegative()?new Sk.builtin.float_(-1):new Sk.builtin.float_(0):-Infinity===a.v?this.nb$isnegative()||!this.nb$nonzero()?new Sk.builtin.float_(0):new Sk.builtin.float_(-1):new Sk.builtin.float_(Math.floor(this.v/
+a.v))}if(a instanceof Sk.builtin.lng){if(0===a.longCompare(Sk.builtin.biginteger.ZERO))throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");return Infinity===this.v||-Infinity===this.v?new Sk.builtin.float_(NaN):new Sk.builtin.float_(Math.floor(this.v/parseFloat(a.str$(10,!0))))}return Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.float_.prototype.nb$reflected_floor_divide=function(a){if(a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng)a=new Sk.builtin.float_(a);return a instanceof Sk.builtin.float_?a.nb$floor_divide(this):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.float_.prototype.nb$remainder=function(a){var b,c;if(a instanceof Sk.builtin.int_||a instanceof Sk.builtin.float_){if(0===a.v)throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");if(0===this.v)return new Sk.builtin.float_(0);if(Infinity===a.v)return Infinity===this.v||-Infinity===this.v?new Sk.builtin.float_(NaN):this.nb$ispositive()?new Sk.builtin.float_(this.v):new Sk.builtin.float_(Infinity);c=this.v%a.v;0>this.v?0<a.v&&0>c&&(c+=a.v):0>a.v&&0!==c&&(c+=a.v);0>
+a.v&&0===c?c=-0:0===c&&-Infinity===Infinity/c&&(c=0);return new Sk.builtin.float_(c)}if(a instanceof Sk.builtin.lng){if(0===a.longCompare(Sk.builtin.biginteger.ZERO))throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");if(0===this.v)return new Sk.builtin.float_(0);b=parseFloat(a.str$(10,!0));c=this.v%b;0>c?0<b&&0!==c&&(c+=b):0>b&&0!==c&&(c+=b);a.nb$isnegative()&&0===c?c=-0:0===c&&-Infinity===Infinity/c&&(c=0);return new Sk.builtin.float_(c)}return Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.float_.prototype.nb$reflected_remainder=function(a){if(a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng)a=new Sk.builtin.float_(a);return a instanceof Sk.builtin.float_?a.nb$remainder(this):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.float_.prototype.nb$divmod=function(a){if(a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng)a=new Sk.builtin.float_(a);return a instanceof Sk.builtin.float_?new Sk.builtin.tuple([this.nb$floor_divide(a),this.nb$remainder(a)]):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.float_.prototype.nb$reflected_divmod=function(a){if(a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng)a=new Sk.builtin.float_(a);return a instanceof Sk.builtin.float_?new Sk.builtin.tuple([a.nb$floor_divide(this),a.nb$remainder(this)]):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.float_.prototype.nb$power=function(a,b){var c;if(a instanceof Sk.builtin.int_||a instanceof Sk.builtin.float_){if(0>this.v&&0!==a.v%1)throw new Sk.builtin.NegativePowerError("cannot raise a negative number to a fractional power");if(0===this.v&&0>a.v)throw new Sk.builtin.NegativePowerError("cannot raise zero to a negative power");c=new Sk.builtin.float_(Math.pow(this.v,a.v));if(Infinity===Math.abs(c.v)&&Infinity!==Math.abs(this.v)&&Infinity!==Math.abs(a.v))throw new Sk.builtin.OverflowError("Numerical result out of range");
+return c}if(a instanceof Sk.builtin.lng){if(0===this.v&&0>a.longCompare(Sk.builtin.biginteger.ZERO))throw new Sk.builtin.NegativePowerError("cannot raise zero to a negative power");return new Sk.builtin.float_(Math.pow(this.v,parseFloat(a.str$(10,!0))))}return Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.float_.prototype.nb$reflected_power=function(a,b){if(a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng)a=new Sk.builtin.float_(a);return a instanceof Sk.builtin.float_?a.nb$power(this,b):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.float_.prototype.nb$abs=function(){return new Sk.builtin.float_(Math.abs(this.v))};Sk.builtin.float_.prototype.nb$inplace_add=Sk.builtin.float_.prototype.nb$add;Sk.builtin.float_.prototype.nb$inplace_subtract=Sk.builtin.float_.prototype.nb$subtract;
+Sk.builtin.float_.prototype.nb$inplace_multiply=Sk.builtin.float_.prototype.nb$multiply;Sk.builtin.float_.prototype.nb$inplace_divide=Sk.builtin.float_.prototype.nb$divide;Sk.builtin.float_.prototype.nb$inplace_remainder=Sk.builtin.float_.prototype.nb$remainder;Sk.builtin.float_.prototype.nb$inplace_floor_divide=Sk.builtin.float_.prototype.nb$floor_divide;Sk.builtin.float_.prototype.nb$inplace_power=Sk.builtin.float_.prototype.nb$power;Sk.builtin.float_.prototype.nb$negative=function(){return new Sk.builtin.float_(-this.v)};
+Sk.builtin.float_.prototype.nb$positive=function(){return this.clone()};Sk.builtin.float_.prototype.nb$nonzero=function(){return 0!==this.v};Sk.builtin.float_.prototype.nb$isnegative=function(){return 0>this.v};Sk.builtin.float_.prototype.nb$ispositive=function(){return 0<=this.v};
+Sk.builtin.float_.prototype.numberCompare=function(a){var b;if(a instanceof Sk.builtin.int_||a instanceof Sk.builtin.float_)return Infinity==this.v&&Infinity==a.v||-Infinity==this.v&&-Infinity==a.v?0:this.v-a.v;if(a instanceof Sk.builtin.lng){if(0===this.v%1)return b=new Sk.builtin.lng(this.v),a=b.longCompare(a);a=this.nb$subtract(a);if(a instanceof Sk.builtin.float_)return a.v;if(a instanceof Sk.builtin.lng)return a.longCompare(Sk.builtin.biginteger.ZERO)}return Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.float_.prototype.ob$eq=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng||a instanceof Sk.builtin.float_?new Sk.builtin.bool(0==this.numberCompare(a)):a instanceof Sk.builtin.none?Sk.builtin.bool.false$:Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.float_.prototype.ob$ne=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng||a instanceof Sk.builtin.float_?new Sk.builtin.bool(0!=this.numberCompare(a)):a instanceof Sk.builtin.none?Sk.builtin.bool.true$:Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.float_.prototype.ob$lt=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng||a instanceof Sk.builtin.float_?new Sk.builtin.bool(0>this.numberCompare(a)):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.float_.prototype.ob$le=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng||a instanceof Sk.builtin.float_?new Sk.builtin.bool(0>=this.numberCompare(a)):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.float_.prototype.ob$gt=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng||a instanceof Sk.builtin.float_?new Sk.builtin.bool(0<this.numberCompare(a)):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.float_.prototype.ob$ge=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng||a instanceof Sk.builtin.float_?new Sk.builtin.bool(0<=this.numberCompare(a)):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.float_.prototype.__round__=function(a,b){Sk.builtin.pyCheckArgs("__round__",arguments,1,2);var c,d;if(void 0!==b&&!Sk.misceval.isIndex(b))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object cannot be interpreted as an index");void 0===b&&(b=0);d=Sk.builtin.asnum$(a);b=Sk.misceval.asIndex(b);c=Math.pow(10,b);c=Math.round(d*c)/c;return new Sk.builtin.float_(c)};Sk.builtin.float_.prototype.conjugate=new Sk.builtin.func(function(a){return new Sk.builtin.float_(a.v)});
+Sk.builtin.float_.prototype.$r=function(){return new Sk.builtin.str(this.str$(10,!0))};Sk.builtin.float_.prototype.tp$str=function(){return new Sk.builtin.str(this.str$(10,!0))};
+Sk.builtin.float_.prototype.str$=function(a,b){var c,d,e,f;if(isNaN(this.v))return"nan";void 0===b&&(b=!0);if(Infinity==this.v)return"inf";if(-Infinity==this.v&&b)return"-inf";if(-Infinity==this.v&&!b)return"inf";f=b?this.v:Math.abs(this.v);if(void 0===a||10===a){e=f.toPrecision(12);c=e.indexOf(".");d=f.toString().slice(0,c);c=f.toString().slice(c);d.match(/^-?0$/)&&c.slice(1).match(/^0{4,}/)&&(e=12>e.length?f.toExponential():f.toExponential(11));if(0>e.indexOf("e")&&0<=e.indexOf(".")){for(;"0"==
+e.charAt(e.length-1);)e=e.substring(0,e.length-1);"."==e.charAt(e.length-1)&&(e+="0")}e=e.replace(/\.0+e/,"e","i");e=e.replace(/(e[-+])([1-9])$/,"$10$2");e=e.replace(/0+(e.*)/,"$1")}else e=f.toString(a);0===this.v&&-Infinity===1/this.v&&(e="-"+e);0>e.indexOf(".")&&(0>e.indexOf("E")&&0>e.indexOf("e"))&&(e+=".0");return e};var deprecatedError=new Sk.builtin.ExternalError("Sk.builtin.nmber is deprecated.");Sk.builtin.nmber=function(a,b){throw new Sk.builtin.ExternalError("Sk.builtin.nmber is deprecated. Please replace with Sk.builtin.int_, Sk.builtin.float_, or Sk.builtin.assk$.");};Sk.builtin.nmber.prototype.tp$index=function(){return this.v};Sk.builtin.nmber.prototype.tp$hash=function(){throw deprecatedError;};Sk.builtin.nmber.fromInt$=function(a){throw deprecatedError;};
+Sk.builtin.nmber.prototype.clone=function(){throw deprecatedError;};Sk.builtin.nmber.prototype.toFixed=function(a){throw deprecatedError;};Sk.builtin.nmber.prototype.nb$add=function(a){throw deprecatedError;};Sk.builtin.nmber.prototype.nb$subtract=function(a){throw deprecatedError;};Sk.builtin.nmber.prototype.nb$multiply=function(a){throw deprecatedError;};Sk.builtin.nmber.prototype.nb$divide=function(a){throw deprecatedError;};
+Sk.builtin.nmber.prototype.nb$floor_divide=function(a){throw deprecatedError;};Sk.builtin.nmber.prototype.nb$remainder=function(a){throw deprecatedError;};Sk.builtin.nmber.prototype.nb$divmod=function(a){throw deprecatedError;};Sk.builtin.nmber.prototype.nb$power=function(a){throw deprecatedError;};Sk.builtin.nmber.prototype.nb$and=function(a){throw deprecatedError;};Sk.builtin.nmber.prototype.nb$or=function(a){throw deprecatedError;};
+Sk.builtin.nmber.prototype.nb$xor=function(a){throw deprecatedError;};Sk.builtin.nmber.prototype.nb$lshift=function(a){throw deprecatedError;};Sk.builtin.nmber.prototype.nb$rshift=function(a){throw deprecatedError;};Sk.builtin.nmber.prototype.nb$inplace_add=Sk.builtin.nmber.prototype.nb$add;Sk.builtin.nmber.prototype.nb$inplace_subtract=Sk.builtin.nmber.prototype.nb$subtract;Sk.builtin.nmber.prototype.nb$inplace_multiply=Sk.builtin.nmber.prototype.nb$multiply;
+Sk.builtin.nmber.prototype.nb$inplace_divide=Sk.builtin.nmber.prototype.nb$divide;Sk.builtin.nmber.prototype.nb$inplace_remainder=Sk.builtin.nmber.prototype.nb$remainder;Sk.builtin.nmber.prototype.nb$inplace_floor_divide=Sk.builtin.nmber.prototype.nb$floor_divide;Sk.builtin.nmber.prototype.nb$inplace_power=Sk.builtin.nmber.prototype.nb$power;Sk.builtin.nmber.prototype.nb$inplace_and=Sk.builtin.nmber.prototype.nb$and;Sk.builtin.nmber.prototype.nb$inplace_or=Sk.builtin.nmber.prototype.nb$or;
+Sk.builtin.nmber.prototype.nb$inplace_xor=Sk.builtin.nmber.prototype.nb$xor;Sk.builtin.nmber.prototype.nb$inplace_lshift=Sk.builtin.nmber.prototype.nb$lshift;Sk.builtin.nmber.prototype.nb$inplace_rshift=Sk.builtin.nmber.prototype.nb$rshift;Sk.builtin.nmber.prototype.nb$negative=function(){throw deprecatedError;};Sk.builtin.nmber.prototype.nb$positive=function(){throw deprecatedError;};Sk.builtin.nmber.prototype.nb$nonzero=function(){throw deprecatedError;};
+Sk.builtin.nmber.prototype.nb$isnegative=function(){throw deprecatedError;};Sk.builtin.nmber.prototype.nb$ispositive=function(){throw deprecatedError;};Sk.builtin.nmber.prototype.numberCompare=function(a){throw deprecatedError;};Sk.builtin.nmber.prototype.__eq__=function(a,b){throw deprecatedError;};Sk.builtin.nmber.prototype.__ne__=function(a,b){throw deprecatedError;};Sk.builtin.nmber.prototype.__lt__=function(a,b){throw deprecatedError;};
+Sk.builtin.nmber.prototype.__le__=function(a,b){throw deprecatedError;};Sk.builtin.nmber.prototype.__gt__=function(a,b){throw deprecatedError;};Sk.builtin.nmber.prototype.__ge__=function(a,b){throw deprecatedError;};Sk.builtin.nmber.prototype.__round__=function(a,b){throw deprecatedError;};Sk.builtin.nmber.prototype.$r=function(){throw deprecatedError;};Sk.builtin.nmber.prototype.tp$str=function(){throw deprecatedError;};Sk.builtin.nmber.prototype.str$=function(a,b){throw deprecatedError;};
+goog.exportSymbol("Sk.builtin.nmber",Sk.builtin.nmber);Sk.builtin.lng=function(a,b){b=Sk.builtin.asnum$(b);if(!(this instanceof Sk.builtin.lng))return new Sk.builtin.lng(a,b);if(void 0===a)return this.biginteger=new Sk.builtin.biginteger(0),this;if(a instanceof Sk.builtin.lng)return this.biginteger=a.biginteger.clone(),this;if(a instanceof Sk.builtin.biginteger)return this.biginteger=a,this;if(a instanceof String||"string"===typeof a)return Sk.longFromStr(a,b);if(a instanceof Sk.builtin.str)return Sk.longFromStr(a.v,b);if(void 0!==a&&!Sk.builtin.checkString(a)&&
+!Sk.builtin.checkNumber(a))if(!0===a)a=1;else if(!1===a)a=0;else throw new Sk.builtin.TypeError("long() argument must be a string or a number, not '"+Sk.abstr.typeName(a)+"'");a=Sk.builtin.asnum$nofloat(a);this.biginteger=new Sk.builtin.biginteger(a);return this};Sk.abstr.setUpInheritance("long",Sk.builtin.lng,Sk.builtin.numtype);Sk.builtin.lng.prototype.tp$index=function(){return parseInt(this.str$(10,!0),10)};Sk.builtin.lng.prototype.tp$hash=function(){return new Sk.builtin.int_(this.tp$index())};
+Sk.builtin.lng.prototype.nb$int_=function(){return this.cantBeInt()?new Sk.builtin.lng(this):new Sk.builtin.int_(this.toInt$())};Sk.builtin.lng.prototype.__index__=new Sk.builtin.func(function(a){return a.nb$int_(a)});Sk.builtin.lng.prototype.nb$lng_=function(){return this};Sk.builtin.lng.prototype.nb$float_=function(){return new Sk.builtin.float_(Sk.ffi.remapToJs(this))};Sk.builtin.lng.MAX_INT$=new Sk.builtin.lng(Sk.builtin.int_.threshold$);Sk.builtin.lng.MIN_INT$=new Sk.builtin.lng(-Sk.builtin.int_.threshold$);
+Sk.builtin.lng.prototype.cantBeInt=function(){return 0<this.longCompare(Sk.builtin.lng.MAX_INT$)||0>this.longCompare(Sk.builtin.lng.MIN_INT$)};Sk.builtin.lng.fromInt$=function(a){return new Sk.builtin.lng(a)};Sk.longFromStr=function(a,b){var c=Sk.str2number(a,b,function(a,b){return 10===b?new Sk.builtin.biginteger(a):new Sk.builtin.biginteger(a,b)},function(a){return a.negate()},"long");return new Sk.builtin.lng(c)};goog.exportSymbol("Sk.longFromStr",Sk.longFromStr);
+Sk.builtin.lng.prototype.toInt$=function(){return this.biginteger.intValue()};Sk.builtin.lng.prototype.clone=function(){return new Sk.builtin.lng(this)};Sk.builtin.lng.prototype.conjugate=new Sk.builtin.func(function(a){return a.clone()});
+Sk.builtin.lng.prototype.nb$add=function(a){var b;if(a instanceof Sk.builtin.float_)return b=new Sk.builtin.float_(this.str$(10,!0)),b.nb$add(a);a instanceof Sk.builtin.int_&&(a=new Sk.builtin.lng(a.v));return a instanceof Sk.builtin.lng?new Sk.builtin.lng(this.biginteger.add(a.biginteger)):a instanceof Sk.builtin.biginteger?new Sk.builtin.lng(this.biginteger.add(a)):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.lng.prototype.nb$reflected_add=function(a){return Sk.builtin.lng.prototype.nb$add.call(this,a)};Sk.builtin.lng.prototype.nb$inplace_add=Sk.builtin.lng.prototype.nb$add;
+Sk.builtin.lng.prototype.nb$subtract=function(a){var b;if(a instanceof Sk.builtin.float_)return b=new Sk.builtin.float_(this.str$(10,!0)),b.nb$subtract(a);a instanceof Sk.builtin.int_&&(a=new Sk.builtin.lng(a.v));return a instanceof Sk.builtin.lng?new Sk.builtin.lng(this.biginteger.subtract(a.biginteger)):a instanceof Sk.builtin.biginteger?new Sk.builtin.lng(this.biginteger.subtract(a)):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.lng.prototype.nb$reflected_subtract=function(a){var b=this.nb$negative();return Sk.builtin.lng.prototype.nb$add.call(b,a)};Sk.builtin.lng.prototype.nb$inplace_subtract=Sk.builtin.lng.prototype.nb$subtract;
+Sk.builtin.lng.prototype.nb$multiply=function(a){var b;if(a instanceof Sk.builtin.float_)return b=new Sk.builtin.float_(this.str$(10,!0)),b.nb$multiply(a);a instanceof Sk.builtin.int_&&(a=new Sk.builtin.lng(a.v));return a instanceof Sk.builtin.lng?new Sk.builtin.lng(this.biginteger.multiply(a.biginteger)):a instanceof Sk.builtin.biginteger?new Sk.builtin.lng(this.biginteger.multiply(a)):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.lng.prototype.nb$reflected_multiply=function(a){return Sk.builtin.lng.prototype.nb$multiply.call(this,a)};Sk.builtin.lng.prototype.nb$inplace_multiply=Sk.builtin.lng.prototype.nb$multiply;
+Sk.builtin.lng.prototype.nb$divide=function(a){var b,c;if(a instanceof Sk.builtin.float_)return b=new Sk.builtin.float_(this.str$(10,!0)),b.nb$divide(a);a instanceof Sk.builtin.int_&&(a=new Sk.builtin.lng(a.v));if(a instanceof Sk.builtin.lng){b=this.nb$isnegative();c=a.nb$isnegative();if(b&&!c||c&&!b){a=this.biginteger.divideAndRemainder(a.biginteger);if(0===a[1].trueCompare(Sk.builtin.biginteger.ZERO))return new Sk.builtin.lng(a[0]);a=a[0].subtract(Sk.builtin.biginteger.ONE);return new Sk.builtin.lng(a)}return new Sk.builtin.lng(this.biginteger.divide(a.biginteger))}return Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.lng.prototype.nb$reflected_divide=function(a){a instanceof Sk.builtin.int_&&(a=new Sk.builtin.lng(a.v));return a instanceof Sk.builtin.lng?a.nb$divide(this):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.lng.prototype.nb$floor_divide=function(a){var b;if(a instanceof Sk.builtin.float_)return b=new Sk.builtin.float_(this.str$(10,!0)),b.nb$floor_divide(a);a instanceof Sk.builtin.int_&&(a=new Sk.builtin.lng(a.v));return a instanceof Sk.builtin.lng?a.nb$divide(this):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.lng.prototype.nb$divmod=function(a){a instanceof Sk.builtin.int_&&(a=new Sk.builtin.lng(a.v));return a instanceof Sk.builtin.lng?new Sk.builtin.tuple([this.nb$floor_divide(a),this.nb$remainder(a)]):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.lng.prototype.nb$reflected_divmod=function(a){a instanceof Sk.builtin.int_&&(a=new Sk.builtin.lng(a.v));return a instanceof Sk.builtin.lng?new Sk.builtin.tuple([a.nb$floor_divide(this),a.nb$remainder(this)]):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.lng.prototype.nb$inplace_divide=Sk.builtin.lng.prototype.nb$divide;Sk.builtin.lng.prototype.nb$floor_divide=Sk.builtin.lng.prototype.nb$divide;Sk.builtin.lng.prototype.nb$reflected_floor_divide=Sk.builtin.lng.prototype.nb$reflected_divide;Sk.builtin.lng.prototype.nb$inplace_floor_divide=Sk.builtin.lng.prototype.nb$floor_divide;
+Sk.builtin.lng.prototype.nb$remainder=function(a){var b;if(0===this.biginteger.trueCompare(Sk.builtin.biginteger.ZERO))return a instanceof Sk.builtin.float_?new Sk.builtin.float_(0):new Sk.builtin.lng(0);if(a instanceof Sk.builtin.float_)return b=new Sk.builtin.float_(this.str$(10,!0)),b.nb$remainder(a);a instanceof Sk.builtin.int_&&(a=new Sk.builtin.lng(a.v));return a instanceof Sk.builtin.lng?(b=new Sk.builtin.lng(this.biginteger.remainder(a.biginteger)),this.nb$isnegative()?a.nb$ispositive()&&
+b.nb$nonzero()&&(b=b.nb$add(a).nb$remainder(a)):a.nb$isnegative()&&b.nb$nonzero()&&(b=b.nb$add(a)),b):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.lng.prototype.nb$reflected_remainder=function(a){a instanceof Sk.builtin.int_&&(a=new Sk.builtin.lng(a.v));return a instanceof Sk.builtin.lng?a.nb$remainder(this):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.lng.prototype.nb$inplace_remainder=Sk.builtin.lng.prototype.nb$remainder;
+Sk.builtin.lng.prototype.nb$divmod=function(a){var b;a===Sk.builtin.bool.true$&&(a=new Sk.builtin.lng(1));a===Sk.builtin.bool.false$&&(a=new Sk.builtin.lng(0));a instanceof Sk.builtin.int_&&(a=new Sk.builtin.lng(a.v));return a instanceof Sk.builtin.lng?new Sk.builtin.tuple([this.nb$floor_divide(a),this.nb$remainder(a)]):a instanceof Sk.builtin.float_?(b=new Sk.builtin.float_(this.str$(10,!0)),b.nb$divmod(a)):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.lng.prototype.nb$power=function(a,b){var c;if(void 0!==b)return a=new Sk.builtin.biginteger(Sk.builtin.asnum$(a)),b=new Sk.builtin.biginteger(Sk.builtin.asnum$(b)),new Sk.builtin.lng(this.biginteger.modPowInt(a,b));if(a instanceof Sk.builtin.float_||a instanceof Sk.builtin.int_&&0>a.v)return c=new Sk.builtin.float_(this.str$(10,!0)),c.nb$power(a);a instanceof Sk.builtin.int_&&(a=new Sk.builtin.lng(a.v));return a instanceof Sk.builtin.lng?void 0!==b?(a=new Sk.builtin.biginteger(Sk.builtin.asnum$(a)),
+b=new Sk.builtin.biginteger(Sk.builtin.asnum$(b)),new Sk.builtin.lng(this.biginteger.modPowInt(a,b))):a.nb$isnegative()?(c=new Sk.builtin.float_(this.str$(10,!0)),c.nb$power(a)):new Sk.builtin.lng(this.biginteger.pow(a.biginteger)):a instanceof Sk.builtin.biginteger?void 0!==b?(b=new Sk.builtin.biginteger(Sk.builtin.asnum$(b)),new Sk.builtin.lng(this.biginteger.modPowInt(a,b))):a.isnegative()?(c=new Sk.builtin.float_(this.str$(10,!0)),c.nb$power(a)):new Sk.builtin.lng(this.biginteger.pow(a)):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.lng.prototype.nb$reflected_power=function(a,b){a instanceof Sk.builtin.int_&&(a=new Sk.builtin.lng(a.v));return a instanceof Sk.builtin.lng?a.nb$power(this,b):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.lng.prototype.nb$inplace_power=Sk.builtin.lng.prototype.nb$power;Sk.builtin.lng.prototype.nb$abs=function(){return new Sk.builtin.lng(this.biginteger.bnAbs())};
+Sk.builtin.lng.prototype.nb$lshift=function(a){a instanceof Sk.builtin.int_&&(a=new Sk.builtin.lng(a.v));if(a instanceof Sk.builtin.lng){if(0>a.biginteger.signum())throw new Sk.builtin.ValueError("negative shift count");return new Sk.builtin.lng(this.biginteger.shiftLeft(a.biginteger))}if(a instanceof Sk.builtin.biginteger){if(0>a.signum())throw new Sk.builtin.ValueError("negative shift count");return new Sk.builtin.lng(this.biginteger.shiftLeft(a))}return Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.lng.prototype.nb$reflected_lshift=function(a){a instanceof Sk.builtin.int_&&(a=new Sk.builtin.lng(a.v));return a instanceof Sk.builtin.lng?a.nb$lshift(this):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.lng.prototype.nb$inplace_lshift=Sk.builtin.lng.prototype.nb$lshift;
+Sk.builtin.lng.prototype.nb$rshift=function(a){a instanceof Sk.builtin.int_&&(a=new Sk.builtin.lng(a.v));if(a instanceof Sk.builtin.lng){if(0>a.biginteger.signum())throw new Sk.builtin.ValueError("negative shift count");return new Sk.builtin.lng(this.biginteger.shiftRight(a.biginteger))}if(a instanceof Sk.builtin.biginteger){if(0>a.signum())throw new Sk.builtin.ValueError("negative shift count");return new Sk.builtin.lng(this.biginteger.shiftRight(a))}return Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.lng.prototype.nb$reflected_rshift=function(a){a instanceof Sk.builtin.int_&&(a=new Sk.builtin.lng(a.v));return a instanceof Sk.builtin.lng?a.nb$rshift(this):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.lng.prototype.nb$inplace_rshift=Sk.builtin.lng.prototype.nb$rshift;
+Sk.builtin.lng.prototype.nb$and=function(a){a instanceof Sk.builtin.int_&&(a=new Sk.builtin.lng(a.v));return a instanceof Sk.builtin.lng?new Sk.builtin.lng(this.biginteger.and(a.biginteger)):a instanceof Sk.builtin.biginteger?new Sk.builtin.lng(this.biginteger.and(a)):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.lng.prototype.nb$reflected_and=Sk.builtin.lng.prototype.nb$and;Sk.builtin.lng.prototype.nb$inplace_and=Sk.builtin.lng.prototype.nb$and;
+Sk.builtin.lng.prototype.nb$or=function(a){a instanceof Sk.builtin.int_&&(a=new Sk.builtin.lng(a.v));return a instanceof Sk.builtin.lng?new Sk.builtin.lng(this.biginteger.or(a.biginteger)):a instanceof Sk.builtin.biginteger?new Sk.builtin.lng(this.biginteger.or(a)):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.lng.prototype.nb$reflected_or=Sk.builtin.lng.prototype.nb$or;Sk.builtin.lng.prototype.nb$inplace_or=Sk.builtin.lng.prototype.nb$or;
+Sk.builtin.lng.prototype.nb$xor=function(a){a instanceof Sk.builtin.int_&&(a=new Sk.builtin.lng(a.v));return a instanceof Sk.builtin.lng?new Sk.builtin.lng(this.biginteger.xor(a.biginteger)):a instanceof Sk.builtin.biginteger?new Sk.builtin.lng(this.biginteger.xor(a)):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.lng.prototype.nb$reflected_xor=Sk.builtin.lng.prototype.nb$xor;Sk.builtin.lng.prototype.nb$inplace_xor=Sk.builtin.lng.prototype.nb$xor;Sk.builtin.lng.prototype.nb$negative=function(){return new Sk.builtin.lng(this.biginteger.negate())};
+Sk.builtin.lng.prototype.nb$invert=function(){return new Sk.builtin.lng(this.biginteger.not())};Sk.builtin.lng.prototype.nb$positive=function(){return this.clone()};Sk.builtin.lng.prototype.nb$nonzero=function(){return 0!==this.biginteger.trueCompare(Sk.builtin.biginteger.ZERO)};Sk.builtin.lng.prototype.nb$isnegative=function(){return this.biginteger.isnegative()};Sk.builtin.lng.prototype.nb$ispositive=function(){return!this.biginteger.isnegative()};
+Sk.builtin.lng.prototype.longCompare=function(a){var b;"number"===typeof a&&(a=new Sk.builtin.lng(a));return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.float_&&0===a.v%1?(a=new Sk.builtin.lng(a.v),this.longCompare(a)):a instanceof Sk.builtin.float_?(b=new Sk.builtin.float_(this),b.numberCompare(a)):a instanceof Sk.builtin.lng?this.biginteger.subtract(a.biginteger):a instanceof Sk.builtin.biginteger?this.biginteger.subtract(a):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.lng.prototype.ob$eq=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng||a instanceof Sk.builtin.float_?new Sk.builtin.bool(0==this.longCompare(a)):a instanceof Sk.builtin.none?Sk.builtin.bool.false$:Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.lng.prototype.ob$ne=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng||a instanceof Sk.builtin.float_?new Sk.builtin.bool(0!=this.longCompare(a)):a instanceof Sk.builtin.none?Sk.builtin.bool.true$:Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.lng.prototype.ob$lt=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng||a instanceof Sk.builtin.float_?new Sk.builtin.bool(0>this.longCompare(a)):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.lng.prototype.ob$le=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng||a instanceof Sk.builtin.float_?new Sk.builtin.bool(0>=this.longCompare(a)):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.lng.prototype.ob$gt=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng||a instanceof Sk.builtin.float_?new Sk.builtin.bool(0<this.longCompare(a)):Sk.builtin.NotImplemented.NotImplemented$};
+Sk.builtin.lng.prototype.ob$ge=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng||a instanceof Sk.builtin.float_?new Sk.builtin.bool(0<=this.longCompare(a)):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.lng.prototype.$r=function(){return new Sk.builtin.str(this.str$(10,!0)+"L")};Sk.builtin.lng.prototype.tp$str=function(){return new Sk.builtin.str(this.str$(10,!0))};
+Sk.builtin.lng.prototype.str$=function(a,b){var c;void 0===b&&(b=!0);c=b?this.biginteger:this.biginteger.abs();return void 0===a||10===a?c.toString():c.toString(a)};Math.hypot=Math.hypot||function(){for(var a=0,b=arguments.length,c=0;c<b;c++){if(Infinity===arguments[c]||-Infinity===arguments[c])return Infinity;a+=arguments[c]*arguments[c]}return Math.sqrt(a)};
+Sk.builtin.complex=function(a,b){Sk.builtin.pyCheckArgs("complex",arguments,0,2);var c,d,e,f,g,h=!1,k=!1;if(!(this instanceof Sk.builtin.complex))return new Sk.builtin.complex(a,b);c=null==a?Sk.builtin.bool.false$:a;d=b;if(c instanceof Sk.builtin.complex&&null==d)return a;if(null!=c&&Sk.builtin.checkString(c)){if(null!=d)throw new Sk.builtin.TypeError("complex() can't take second arg if first is a string");return Sk.builtin.complex.complex_subtype_from_string(c)}if(null!=d&&Sk.builtin.checkString(d))throw new Sk.builtin.TypeError("complex() second arg can't be a string");
+e=Sk.builtin.complex.try_complex_special_method(c);if(null!=e&&e!==Sk.builtin.NotImplemented.NotImplemented$){if(!Sk.builtin.checkComplex(e))throw new Sk.builtin.TypeError("__complex__ should return a complex object");c=e}e=Sk.builtin.asnum$(c);null!=d&&(f=Sk.builtin.asnum$(d));var l=function(a){if(Sk.builtin.checkNumber(a)||void 0!==Sk.builtin.type.typeLookup(a.ob$type,"__float__"))return!0};if(null==e||!l(c)&&!Sk.builtin.checkComplex(c)||null!=d&&(null==f||!l(d)&&!Sk.builtin.checkComplex(d)))throw new Sk.builtin.TypeError("complex() argument must be a string or number");
+if(Sk.builtin.complex._complex_check(c))f=c.real.v,c=c.imag.v,h=!0;else{e=Sk.builtin.float_.PyFloat_AsDouble(c);if(null==e)return null;f=e;c=0}if(null==d)e=0;else if(Sk.builtin.complex._complex_check(d))e=d.real.v,g=d.imag.v,k=!0;else{e=Sk.builtin.float_.PyFloat_AsDouble(d);if(null==e)return null;g=0}!0===k&&(f-=g);!0===h&&(e+=c);0===f&&(0>e||Sk.builtin.complex._isNegativeZero(e))&&(f=-0);this.real=new Sk.builtin.float_(f);this.imag=new Sk.builtin.float_(e);this.__class__=Sk.builtin.complex;return this};
+Sk.abstr.setUpInheritance("complex",Sk.builtin.complex,Sk.builtin.numtype);Sk.builtin.complex.prototype.nb$int_=function(){throw new Sk.builtin.TypeError("can't convert complex to int");};Sk.builtin.complex.prototype.nb$float_=function(){throw new Sk.builtin.TypeError("can't convert complex to float");};Sk.builtin.complex.prototype.nb$lng=function(){throw new Sk.builtin.TypeError("can't convert complex to long");};Sk.builtin.complex.prototype.__doc__=new Sk.builtin.str("complex(real[, imag]) -> complex number\n\nCreate a complex number from a real part and an optional imaginary part.\nThis is equivalent to (real + imag*1j) where imag defaults to 0.");
+Sk.builtin.complex._isNegativeZero=function(a){return 0!==a?!1:-Infinity===1/a};Sk.builtin.complex.try_complex_special_method=function(a){new Sk.builtin.str("__complex__");var b;if(null==a)return null;b=Sk.abstr.lookupSpecial(a,"__complex__");return null!=b?a=Sk.misceval.callsim(b,a):null};
+Sk.builtin.complex.check_number_or_complex=function(a){if(!Sk.builtin.checkNumber(a)&&"complex"!==a.tp$name)throw new Sk.builtin.TypeError("unsupported operand type(s) for +: 'complex' and '"+Sk.abstr.typeName(a)+"'");Sk.builtin.checkNumber(a)&&(a=new Sk.builtin.complex(a));return a};
+Sk.builtin.complex.complex_subtype_from_string=function(a){var b,c,d=0,e=0,f=!1,g;if(Sk.builtin.checkString(a))a=Sk.ffi.remapToJs(a);else if("string"!==typeof a)throw new TypeError("provided unsupported string-alike argument");if(-1!==a.indexOf("\x00")||0===a.length||""===a)throw new Sk.builtin.ValueError("complex() arg is a malformed string");b=0;a=a.replace(/inf|infinity/gi,"Infinity");for(a=a.replace(/nan/gi,"NaN");" "===a[b];)b++;if("("===a[b])for(f=!0,b++;" "===a[b];)b++;var h=/^(?:[+-]?(?:(?:(?:\d*\.\d+)|(?:\d+\.?))(?:[eE][+-]?\d+)?|NaN|Infinity))/;
+c=a.substr(b);g=c.match(h);if(null!==g)if(b+=g[0].length,"j"===a[b]||"J"===a[b])e=parseFloat(g[0]),b++;else if("+"===a[b]||"-"===a[b]){d=parseFloat(g[0]);g=a.substr(b).match(h);null!==g?(e=parseFloat(g[0]),b+=g[0].length):(e="+"===a[b]?1:-1,b++);if("j"!==a[b]&&"J"!==a[b])throw new Sk.builtin.ValueError("complex() arg is malformed string");b++}else d=parseFloat(g[0]);else g=g=c.match(/^([+-]?[jJ])/),null!==g&&(e=1===g[0].length?1:"+"===g[0][0]?1:-1,b+=g[0].length);for(;" "===a[b];)b++;if(f){if(")"!==
+a[b])throw new Sk.builtin.ValueError("complex() arg is malformed string");for(b++;" "===a[b];)b++}if(a.length!==b)throw new Sk.builtin.ValueError("complex() arg is malformed string");return new Sk.builtin.complex(new Sk.builtin.float_(d),new Sk.builtin.float_(e))};Sk.builtin.complex.prototype.tp$hash=function(){return new Sk.builtin.int_(1000003*this.tp$getattr("imag").v+this.tp$getattr("real").v)};
+Sk.builtin.complex.prototype.nb$add=function(a){var b;a=Sk.builtin.complex.check_number_or_complex(a);b=this.tp$getattr("real").v+a.tp$getattr("real").v;a=this.tp$getattr("imag").v+a.tp$getattr("imag").v;return new Sk.builtin.complex(new Sk.builtin.float_(b),new Sk.builtin.float_(a))};Sk.builtin.complex._c_diff=function(a,b){var c,d;c=a.real.nb$subtract.call(a.real,b.real);d=a.imag.nb$subtract.call(a.imag,b.imag);return new Sk.builtin.complex(c,d)};
+Sk.builtin.complex.prototype.nb$subtract=function(a){var b;b=Sk.builtin.complex.check_number_or_complex(this);a=Sk.builtin.complex.check_number_or_complex(a);return Sk.builtin.complex._c_diff(b,a)};Sk.builtin.complex.prototype.nb$multiply=function(a){var b;b=Sk.builtin.complex.check_number_or_complex(a);a=this.real.v*b.real.v-this.imag.v*b.imag.v;b=this.real.v*b.imag.v+this.imag.v*b.real.v;return new Sk.builtin.complex(new Sk.builtin.float_(a),new Sk.builtin.float_(b))};
+Sk.builtin.complex.prototype.nb$divide=function(a){var b;a=Sk.builtin.complex.check_number_or_complex(a);var c,d;b=a.real.v;var e=a.imag.v;a=this.real.v;var f=this.imag.v;c=Math.abs(b);d=Math.abs(e);if(c>=d){if(0===c)throw new Sk.builtin.ZeroDivisionError("complex division by zero");c=e/b;d=b+e*c;b=(a+f*c)/d;a=(f-a*c)/d}else d>=c?(c=b/e,d=b*c+e,goog.asserts.assert(0!==e),b=(a*c+f)/d,a=(f*c-a)/d):a=b=NaN;return new Sk.builtin.complex(new Sk.builtin.float_(b),new Sk.builtin.float_(a))};
+Sk.builtin.complex.prototype.nb$floor_divide=function(a){throw new Sk.builtin.TypeError("can't take floor of complex number.");};Sk.builtin.complex.prototype.nb$remainder=function(a){throw new Sk.builtin.TypeError("can't mod complex numbers.");};
+Sk.builtin.complex.prototype.nb$power=function(a,b){var c,d;if(null!=b&&!Sk.builtin.checkNone(b))throw new Sk.builtin.ValueError("complex modulo");d=Sk.builtin.complex.check_number_or_complex(a);c=d.real.v|0;return 0===d.imag.v&&d.real.v===c?Sk.builtin.complex.c_powi(this,c):Sk.builtin.complex.c_pow(this,d)};
+Sk.builtin.complex.c_pow=function(a,b){var c,d,e,f;f=b.real.v;var g=b.imag.v;e=a.real.v;var h=a.imag.v;if(0===f&&0===g)c=1,d=0;else if(0===e&&0===h){if(0!==g||0>f)throw new Sk.builtin.ZeroDivisionError("complex division by zero");d=c=0}else c=Math.hypot(e,h),d=Math.pow(c,f),e=Math.atan2(h,e),f*=e,0!==g&&(d/=Math.exp(e*g),f+=g*Math.log(c)),c=d*Math.cos(f),d*=Math.sin(f);return new Sk.builtin.complex(new Sk.builtin.float_(c),new Sk.builtin.float_(d))};
+Sk.builtin.complex.c_powi=function(a,b){var c;return 100<b||-100>b?(c=new Sk.builtin.complex(new Sk.builtin.float_(b),new Sk.builtin.float_(0)),Sk.builtin.complex.c_pow(a,c)):0<b?Sk.builtin.complex.c_powu(a,b):(new Sk.builtin.complex(new Sk.builtin.float_(1),new Sk.builtin.float_(0))).nb$divide(Sk.builtin.complex.c_powu(a,-b))};
+Sk.builtin.complex.c_powu=function(a,b){var c,d,e=1;c=new Sk.builtin.complex(new Sk.builtin.float_(1),new Sk.builtin.float_(0));for(d=a;0<e&&b>=e;)b&e&&(c=c.nb$multiply(d)),e<<=1,d=d.nb$multiply(d);return c};Sk.builtin.complex.prototype.nb$inplace_add=Sk.builtin.complex.prototype.nb$add;Sk.builtin.complex.prototype.nb$inplace_subtract=Sk.builtin.complex.prototype.nb$subtract;Sk.builtin.complex.prototype.nb$inplace_multiply=Sk.builtin.complex.prototype.nb$multiply;
+Sk.builtin.complex.prototype.nb$inplace_divide=Sk.builtin.complex.prototype.nb$divide;Sk.builtin.complex.prototype.nb$inplace_remainder=Sk.builtin.complex.prototype.nb$remainder;Sk.builtin.complex.prototype.nb$inplace_floor_divide=Sk.builtin.complex.prototype.nb$floor_divide;Sk.builtin.complex.prototype.nb$inplace_power=Sk.builtin.complex.prototype.nb$power;
+Sk.builtin.complex.prototype.nb$negative=function(){var a,b;b=this.imag.v;a=-this.real.v;b=-b;return new Sk.builtin.complex(new Sk.builtin.float_(a),new Sk.builtin.float_(b))};Sk.builtin.complex.prototype.nb$positive=function(){return Sk.builtin.complex.check_number_or_complex(this)};Sk.builtin.complex._complex_check=function(a){return void 0===a?!1:a instanceof Sk.builtin.complex||a.tp$name&&"complex"===a.tp$name||Sk.builtin.issubclass(new Sk.builtin.type(a),Sk.builtin.complex)?!0:!1};
+Sk.builtin.complex.prototype.tp$richcompare=function(a,b){var c,d;if("Eq"!==b&&"NotEq"!==b){if(Sk.builtin.checkNumber(a)||Sk.builtin.complex._complex_check(a))throw new Sk.builtin.TypeError("no ordering relation is defined for complex numbers");return Sk.builtin.NotImplemented.NotImplemented$}d=Sk.builtin.complex.check_number_or_complex(this);c=d.tp$getattr("real").v;d=d.tp$getattr("imag").v;if(Sk.builtin.checkInt(a)){if(0===d)return c=Sk.misceval.richCompareBool(new Sk.builtin.float_(c),a,b),c=new Sk.builtin.bool(c);
+c=!1}else if(Sk.builtin.checkFloat(a))c=c===Sk.builtin.float_.PyFloat_AsDouble(a)&&0===d;else if(Sk.builtin.complex._complex_check(a)){var e=a.tp$getattr("real").v,f=a.tp$getattr("imag").v;c=c===e&&d===f}else return Sk.builtin.NotImplemented.NotImplemented$;"NotEq"===b&&(c=!c);return c=new Sk.builtin.bool(c)};Sk.builtin.complex.prototype.__eq__=function(a,b){return Sk.builtin.complex.prototype.tp$richcompare.call(a,b,"Eq")};
+Sk.builtin.complex.prototype.__ne__=function(a,b){return Sk.builtin.complex.prototype.tp$richcompare.call(a,b,"NotEq")};Sk.builtin.complex.prototype.__lt__=function(a,b){throw new Sk.builtin.TypeError("unorderable types: "+Sk.abstr.typeName(a)+" < "+Sk.abstr.typeName(b));};Sk.builtin.complex.prototype.__le__=function(a,b){throw new Sk.builtin.TypeError("unorderable types: "+Sk.abstr.typeName(a)+" <= "+Sk.abstr.typeName(b));};
+Sk.builtin.complex.prototype.__gt__=function(a,b){throw new Sk.builtin.TypeError("unorderable types: "+Sk.abstr.typeName(a)+" > "+Sk.abstr.typeName(b));};Sk.builtin.complex.prototype.__ge__=function(a,b){throw new Sk.builtin.TypeError("unorderable types: "+Sk.abstr.typeName(a)+" >= "+Sk.abstr.typeName(b));};Sk.builtin.complex.prototype.__float__=function(a){throw new Sk.builtin.TypeError("can't convert complex to float");};
+Sk.builtin.complex.prototype.__int__=function(a){throw new Sk.builtin.TypeError("can't convert complex to int");};Sk.builtin.complex.prototype._internalGenericGetAttr=Sk.builtin.object.prototype.GenericGetAttr;Sk.builtin.complex.prototype.tp$getattr=function(a){if(null!=a&&(Sk.builtin.checkString(a)||"string"===typeof a)){var b=a;Sk.builtin.checkString(a)&&(b=Sk.ffi.remapToJs(a));if("real"===b||"imag"===b)return this[b]}return this._internalGenericGetAttr(a)};
+Sk.builtin.complex.prototype.tp$setattr=function(a,b){if(null!=a&&(Sk.builtin.checkString(a)||"string"===typeof a)){var c=a;Sk.builtin.checkString(a)&&(c=Sk.ffi.remapToJs(a));if("real"===c||"imag"===c)throw new Sk.builtin.AttributeError("readonly attribute");}throw new Sk.builtin.AttributeError("'complex' object attribute '"+a+"' is readonly");};
+Sk.builtin.complex.complex_format=function(a,b,c){if(null==a||!Sk.builtin.complex._complex_check(a))throw Error("Invalid internal method call: Sk.complex.complex_format() called with invalid value type.");var d="",d="",e=null,f="",g="";0===a.real.v&&1==(0>a.real.v?-Math.abs(1):Math.abs(1))?(e="",d=Sk.builtin.complex.PyOS_double_to_string(a.imag.v,c,b,0,null)):(e=d=Sk.builtin.complex.PyOS_double_to_string(a.real.v,c,b,0,null),d=Sk.builtin.complex.PyOS_double_to_string(a.imag.v,c,b,Sk.builtin.complex.PyOS_double_to_string.Py_DTSF_SIGN,
+null),0===a.imag.v&&(-Infinity===1/a.imag.v&&d&&"-"!==d[0])&&(d="-"+d),f="(",g=")");return new Sk.builtin.str(""+f+e+d+"j"+g)};Sk.builtin.complex.prototype.$r=function(){return Sk.builtin.complex.complex_format(this,0,"r")};Sk.builtin.complex.prototype.tp$str=function(){return Sk.builtin.complex.complex_format(this,null,"g")};
+Sk.builtin.complex.prototype.__format__=new Sk.builtin.func(function(a,b){var c;if(null==b)return null;if(Sk.builtin.checkString(b))return c=Sk.builtin.complex._PyComplex_FormatAdvanced(a,b);throw new Sk.builtin.TypeError("__format__ requires str or unicode");});Sk.builtin.complex._PyComplex_FormatAdvanced=function(a,b){throw new Sk.builtin.NotImplementedError("__format__ is not implemented for complex type.");};
+Sk.builtin.complex._is_finite=function(a){return!isNaN(a)&&Infinity!==a&&-Infinity!==a};Sk.builtin.complex._is_infinity=function(a){return Infinity===a||-Infinity===a};
+Sk.builtin.complex.prototype.__abs__=new Sk.builtin.func(function(a){var b;b=a.real.v;a=a.imag.v;if(!Sk.builtin.complex._is_finite(b)||!Sk.builtin.complex._is_finite(a))return Sk.builtin.complex._is_infinity(b)?(b=Math.abs(b),new Sk.builtin.float_(b)):Sk.builtin.complex._is_infinity(a)?(b=Math.abs(a),new Sk.builtin.float_(b)):new Sk.builtin.float_(NaN);b=Math.hypot(b,a);if(!Sk.builtin.complex._is_finite(b))throw new Sk.builtin.OverflowError("absolute value too large");return new Sk.builtin.float_(b)});
+Sk.builtin.complex.prototype.__bool__=new Sk.builtin.func(function(a){return new Sk.builtin.bool(a.tp$getattr("real").v||a.tp$getattr("real").v)});Sk.builtin.complex.prototype.__truediv__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("__truediv__",arguments,1,1,!0);return a.nb$divide.call(a,b)});Sk.builtin.complex.prototype.__hash__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("__hash__",arguments,0,0,!0);return a.tp$hash.call(a)});
+Sk.builtin.complex.prototype.__add__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("__add__",arguments,1,1,!0);return a.nb$add.call(a,b)});Sk.builtin.complex.prototype.__repr__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("__repr__",arguments,0,0,!0);return a.r$.call(a)});Sk.builtin.complex.prototype.__str__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("__str__",arguments,0,0,!0);return a.tp$str.call(a)});
+Sk.builtin.complex.prototype.__sub__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("__sub__",arguments,1,1,!0);return a.nb$subtract.call(a,b)});Sk.builtin.complex.prototype.__mul__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("__mul__",arguments,1,1,!0);return a.nb$multiply.call(a,b)});Sk.builtin.complex.prototype.__div__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("__div__",arguments,1,1,!0);return a.nb$divide.call(a,b)});
+Sk.builtin.complex.prototype.__floordiv__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("__floordiv__",arguments,1,1,!0);return a.nb$floor_divide.call(a,b)});Sk.builtin.complex.prototype.__mod__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("__mod__",arguments,1,1,!0);return a.nb$remainder.call(a,b)});Sk.builtin.complex.prototype.__pow__=new Sk.builtin.func(function(a,b,c){Sk.builtin.pyCheckArgs("__pow__",arguments,1,2,!0);return a.nb$power.call(a,b,c)});
+Sk.builtin.complex.prototype.__neg__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("__neg__",arguments,0,0,!0);return a.nb$negative.call(a)});Sk.builtin.complex.prototype.__pos__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("__pos__",arguments,0,0,!0);return a.nb$positive.call(a)});Sk.builtin.complex.prototype.conjugate=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("conjugate",arguments,0,0,!0);var b=a.imag.v;return new Sk.builtin.complex(a.real,new Sk.builtin.float_(-b))});
+Sk.builtin.complex.prototype.__divmod__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("__divmod__",arguments,1,1,!0);var c,d,e;d=Sk.builtin.complex.check_number_or_complex(a);e=Sk.builtin.complex.check_number_or_complex(b);c=d.nb$divide.call(d,e);c.real=new Sk.builtin.float_(Math.floor(c.real.v));c.imag=new Sk.builtin.float_(0);d=d.nb$subtract.call(d,e.nb$multiply.call(e,c));return new Sk.builtin.tuple([c,d])});
+Sk.builtin.complex.prototype.__getnewargs__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("__getnewargs__",arguments,0,0,!0);return new Sk.builtin.tuple([a.real,a.imag])});Sk.builtin.complex.prototype.__nonzero__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("__nonzero__",arguments,0,0,!0);return 0!==a.real.v||0!==a.imag.v?Sk.builtin.bool.true$:Sk.builtin.bool.false$});goog.exportSymbol("Sk.builtin.complex",Sk.builtin.complex);
+Sk.builtin.complex.PyOS_double_to_string=function(a,b,c,d,e){e=!1;switch(b){case "e":case "f":case "g":break;case "E":e=!0;b="e";break;case "F":e=!0;b="f";break;case "r":if(0!==c)throw Error("Bad internall call");c=17;b="g";break;default:throw Error("Bad internall call");}if(isNaN(a))a="nan";else if(Infinity===a)a="inf";else if(-Infinity===a)a="-inf";else{d&Sk.builtin.complex.PyOS_double_to_string.Py_DTSF_ADD_DOT_0&&(b="g");var f;f="%"+(d&Sk.builtin.complex.PyOS_double_to_string.Py_DTSF_ALT?"#":"");
+null!=c&&(f=f+"."+c);f+=b;f=new Sk.builtin.str(f);a=f.nb$remainder(new Sk.builtin.float_(a));a=a.v}d&Sk.builtin.complex.PyOS_double_to_string.Py_DTSF_SIGN&&"-"!==a[0]&&(a="+"+a);e&&(a=a.toUpperCase());return a};Sk.builtin.complex.PyOS_double_to_string.Py_DTSF_SIGN=1;Sk.builtin.complex.PyOS_double_to_string.Py_DTSF_ADD_DOT_0=2;Sk.builtin.complex.PyOS_double_to_string.Py_DTSF_ALT=4;Sk.builtin.complex.PyOS_double_to_string.Py_DTST_FINITE=0;Sk.builtin.complex.PyOS_double_to_string.Py_DTST_INFINITE=1;
+Sk.builtin.complex.PyOS_double_to_string.Py_DTST_NAN=2;Sk.builtin.slice=function(a,b,c){Sk.builtin.pyCheckArgs("slice",arguments,1,3,!1,!1);if(void 0!==c&&Sk.misceval.isIndex(c)&&0===Sk.misceval.asIndex(c))throw new Sk.builtin.ValueError("slice step cannot be zero");if(!(this instanceof Sk.builtin.slice))return new Sk.builtin.slice(a,b,c);void 0===b&&void 0===c&&(b=a,a=Sk.builtin.none.none$);void 0===b&&(b=Sk.builtin.none.none$);void 0===c&&(c=Sk.builtin.none.none$);this.start=a;this.stop=b;this.step=c;this.__class__=Sk.builtin.slice;this.$d=new Sk.builtin.dict([Sk.builtin.slice$start,
+this.start,Sk.builtin.slice$stop,this.stop,Sk.builtin.slice$step,this.step]);return this};Sk.abstr.setUpInheritance("slice",Sk.builtin.slice,Sk.builtin.object);Sk.builtin.slice.prototype.$r=function(){var a=Sk.builtin.repr(this.start).v,b=Sk.builtin.repr(this.stop).v,c=Sk.builtin.repr(this.step).v;return new Sk.builtin.str("slice("+a+", "+b+", "+c+")")};
+Sk.builtin.slice.prototype.tp$richcompare=function(a,b){var c,d;if(!a.__class__||a.__class__!=Sk.builtin.slice)return"Eq"===b?!1:"NotEq"===b?!0:!1;c=new Sk.builtin.tuple([this.start,this.stop,this.step]);d=new Sk.builtin.tuple([a.start,a.stop,a.step]);return c.tp$richcompare(d,b)};
+Sk.builtin.slice.prototype.slice_indices_=function(a){var b,c,d;if(Sk.builtin.checkNone(this.start))b=null;else if(Sk.misceval.isIndex(this.start))b=Sk.misceval.asIndex(this.start);else throw new Sk.builtin.TypeError("slice indices must be integers or None");if(Sk.builtin.checkNone(this.stop))c=null;else if(Sk.misceval.isIndex(this.stop))c=Sk.misceval.asIndex(this.stop);else throw new Sk.builtin.TypeError("slice indices must be integers or None");if(Sk.builtin.checkNone(this.step))d=null;else if(Sk.misceval.isIndex(this.step))d=
+Sk.misceval.asIndex(this.step);else throw new Sk.builtin.TypeError("slice indices must be integers or None");null===d&&(d=1);0<d?(null===b&&(b=0),null===c&&(c=a),c>a&&(c=a),0>b&&(b=a+b,0>b&&(b=0)),0>c&&(c=a+c)):(null===b&&(b=a-1),b>=a&&(b=a-1),null===c?c=-1:0>c&&(c=a+c,0>c&&(c=-1)),0>b&&(b=a+b));return[b,c,d]};
+Sk.builtin.slice.prototype.indices=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("indices",arguments,2,2,!1,!1);b=Sk.builtin.asnum$(b);var c=a.slice_indices_(b);return new Sk.builtin.tuple([new Sk.builtin.int_(c[0]),new Sk.builtin.int_(c[1]),new Sk.builtin.int_(c[2])])});
+Sk.builtin.slice.prototype.sssiter$=function(a,b){var c,d=Sk.builtin.asnum$(a),e=this.slice_indices_("number"===typeof d?d:a.v.length);if(0<e[2])for(c=e[0];c<e[1]&&!1!==b(c,d);c+=e[2]);else for(c=e[0];c>e[1]&&!1!==b(c,d);c+=e[2]);};Sk.builtin.slice$start=new Sk.builtin.str("start");Sk.builtin.slice$stop=new Sk.builtin.str("stop");Sk.builtin.slice$step=new Sk.builtin.str("step");Sk.builtin.set=function(a){var b;if(!(this instanceof Sk.builtin.set))return new Sk.builtin.set(a);"undefined"===typeof a&&(a=[]);this.set_reset_();a=new Sk.builtin.list(a);a=Sk.abstr.iter(a);for(b=a.tp$iternext();void 0!==b;b=a.tp$iternext())Sk.builtin.set.prototype.add.func_code(this,b);this.__class__=Sk.builtin.set;this.v=this.v;return this};Sk.abstr.setUpInheritance("set",Sk.builtin.set,Sk.builtin.object);Sk.abstr.markUnhashable(Sk.builtin.set);
+Sk.builtin.set.prototype.set_iter_=function(){var a=this.v.tp$iter();a.tp$name="set_iterator";return a};Sk.builtin.set.prototype.set_reset_=function(){this.v=new Sk.builtin.dict([])};Sk.builtin.set.prototype.$r=function(){var a,b,c=[];a=Sk.abstr.iter(this);for(b=a.tp$iternext();void 0!==b;b=a.tp$iternext())c.push(Sk.misceval.objectRepr(b).v);return Sk.python3?new Sk.builtin.str("{"+c.join(", ")+"}"):new Sk.builtin.str("set(["+c.join(", ")+"])")};
+Sk.builtin.set.prototype.ob$eq=function(a){return this===a?Sk.builtin.bool.true$:a instanceof Sk.builtin.set&&Sk.builtin.set.prototype.sq$length.call(this)===Sk.builtin.set.prototype.sq$length.call(a)?this.issubset.func_code(this,a):Sk.builtin.bool.false$};
+Sk.builtin.set.prototype.ob$ne=function(a){return this===a?Sk.builtin.bool.false$:a instanceof Sk.builtin.set&&Sk.builtin.set.prototype.sq$length.call(this)===Sk.builtin.set.prototype.sq$length.call(a)?this.issubset.func_code(this,a).v?Sk.builtin.bool.false$:Sk.builtin.bool.true$:Sk.builtin.bool.true$};
+Sk.builtin.set.prototype.ob$lt=function(a){return this===a||Sk.builtin.set.prototype.sq$length.call(this)>=Sk.builtin.set.prototype.sq$length.call(a)?Sk.builtin.bool.false$:this.issubset.func_code(this,a)};Sk.builtin.set.prototype.ob$le=function(a){return this===a?Sk.builtin.bool.true$:Sk.builtin.set.prototype.sq$length.call(this)>Sk.builtin.set.prototype.sq$length.call(a)?Sk.builtin.bool.false$:this.issubset.func_code(this,a)};
+Sk.builtin.set.prototype.ob$gt=function(a){return this===a||Sk.builtin.set.prototype.sq$length.call(this)<=Sk.builtin.set.prototype.sq$length.call(a)?Sk.builtin.bool.false$:this.issuperset.func_code(this,a)};Sk.builtin.set.prototype.ob$ge=function(a){return this===a?Sk.builtin.bool.true$:Sk.builtin.set.prototype.sq$length.call(this)<Sk.builtin.set.prototype.sq$length.call(a)?Sk.builtin.bool.false$:this.issuperset.func_code(this,a)};
+Sk.builtin.set.prototype.__iter__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("__iter__",arguments,0,0,!1,!0);return Sk.builtin.set.prototype.tp$iter.call(a)});Sk.builtin.set.prototype.tp$iter=Sk.builtin.set.prototype.set_iter_;Sk.builtin.set.prototype.sq$length=function(){return this.v.mp$length()};Sk.builtin.set.prototype.sq$contains=function(a){return this.v.sq$contains(a)};
+Sk.builtin.set.prototype.isdisjoint=new Sk.builtin.func(function(a,b){var c,d;d=Sk.abstr.iter(a);for(c=d.tp$iternext();void 0!==c;c=d.tp$iternext())if(c=Sk.abstr.sequenceContains(b,c))return Sk.builtin.bool.false$;return Sk.builtin.bool.true$});
+Sk.builtin.set.prototype.issubset=new Sk.builtin.func(function(a,b){var c,d;d=a.sq$length();c=b.sq$length();if(d>c)return Sk.builtin.bool.false$;d=Sk.abstr.iter(a);for(c=d.tp$iternext();void 0!==c;c=d.tp$iternext())if(c=Sk.abstr.sequenceContains(b,c),!c)return Sk.builtin.bool.false$;return Sk.builtin.bool.true$});Sk.builtin.set.prototype.issuperset=new Sk.builtin.func(function(a,b){return Sk.builtin.set.prototype.issubset.func_code(b,a)});
+Sk.builtin.set.prototype.union=new Sk.builtin.func(function(a){var b,c=new Sk.builtin.set(a);for(b=1;b<arguments.length;b++)Sk.builtin.set.prototype.update.func_code(c,arguments[b]);return c});Sk.builtin.set.prototype.intersection=new Sk.builtin.func(function(a){var b=Sk.builtin.set.prototype.copy.func_code(a),c=Array.prototype.slice.call(arguments);c[0]=b;Sk.builtin.set.prototype.intersection_update.func_code.apply(null,c);return b});
+Sk.builtin.set.prototype.difference=new Sk.builtin.func(function(a,b){var c=Sk.builtin.set.prototype.copy.func_code(a),d=Array.prototype.slice.call(arguments);d[0]=c;Sk.builtin.set.prototype.difference_update.func_code.apply(null,d);return c});
+Sk.builtin.set.prototype.symmetric_difference=new Sk.builtin.func(function(a,b){var c,d,e=Sk.builtin.set.prototype.union.func_code(a,b);c=Sk.abstr.iter(e);for(d=c.tp$iternext();void 0!==d;d=c.tp$iternext())Sk.abstr.sequenceContains(a,d)&&Sk.abstr.sequenceContains(b,d)&&Sk.builtin.set.prototype.discard.func_code(e,d);return e});Sk.builtin.set.prototype.copy=new Sk.builtin.func(function(a){return new Sk.builtin.set(a)});
+Sk.builtin.set.prototype.update=new Sk.builtin.func(function(a,b){var c,d;c=Sk.abstr.iter(b);for(d=c.tp$iternext();void 0!==d;d=c.tp$iternext())Sk.builtin.set.prototype.add.func_code(a,d);return Sk.builtin.none.none$});
+Sk.builtin.set.prototype.intersection_update=new Sk.builtin.func(function(a,b){var c,d,e;d=Sk.abstr.iter(a);for(e=d.tp$iternext();void 0!==e;e=d.tp$iternext())for(c=1;c<arguments.length;c++)if(!Sk.abstr.sequenceContains(arguments[c],e)){Sk.builtin.set.prototype.discard.func_code(a,e);break}return Sk.builtin.none.none$});
+Sk.builtin.set.prototype.difference_update=new Sk.builtin.func(function(a,b){var c,d,e;d=Sk.abstr.iter(a);for(e=d.tp$iternext();void 0!==e;e=d.tp$iternext())for(c=1;c<arguments.length;c++)if(Sk.abstr.sequenceContains(arguments[c],e)){Sk.builtin.set.prototype.discard.func_code(a,e);break}return Sk.builtin.none.none$});
+Sk.builtin.set.prototype.symmetric_difference_update=new Sk.builtin.func(function(a,b){var c=Sk.builtin.set.prototype.symmetric_difference.func_code(a,b);a.set_reset_();Sk.builtin.set.prototype.update.func_code(a,c);return Sk.builtin.none.none$});Sk.builtin.set.prototype.add=new Sk.builtin.func(function(a,b){a.v.mp$ass_subscript(b,!0);return Sk.builtin.none.none$});
+Sk.builtin.set.prototype.discard=new Sk.builtin.func(function(a,b){Sk.builtin.dict.prototype.pop.func_code(a.v,b,Sk.builtin.none.none$);return Sk.builtin.none.none$});Sk.builtin.set.prototype.pop=new Sk.builtin.func(function(a){var b;if(0===a.sq$length())throw new Sk.builtin.KeyError("pop from an empty set");b=Sk.abstr.iter(a).tp$iternext();Sk.builtin.set.prototype.discard.func_code(a,b);return b});Sk.builtin.set.prototype.remove=new Sk.builtin.func(function(a,b){a.v.mp$del_subscript(b);return Sk.builtin.none.none$});
+goog.exportSymbol("Sk.builtin.set",Sk.builtin.set);var print_f=function(a){Sk.builtin.pyCheckArgs("print",arguments,0,Infinity,!0,!1);var b=Array.prototype.slice.call(arguments,1),c=new Sk.builtins.dict(a);Sk.ffi.remapToJs(c);var d={sep:" ",end:"\n",file:null},e,f;e=c.mp$lookup(new Sk.builtin.str("sep"));if(void 0!==e)if(f=Sk.builtin.checkNone(e),Sk.builtin.checkString(e)||f)d.sep=f?d.sep:Sk.ffi.remapToJs(e);else throw new Sk.builtin.TypeError("sep must be None or a string, not "+Sk.abstr.typeName(e));e=c.mp$lookup(new Sk.builtin.str("end"));if(void 0!==
+e)if(f=Sk.builtin.checkNone(e),Sk.builtin.checkString(e)||f)d.end=f?d.end:Sk.ffi.remapToJs(e);else throw new Sk.builtin.TypeError("end must be None or a string, not "+Sk.abstr.typeName(e));e=c.mp$lookup(new Sk.builtin.str("file"));if(void 0!==e)if((f=Sk.builtin.checkNone(e))||void 0!==e.tp$getattr("write"))d.file=f?d.file:e;else throw new Sk.builtin.AttributeError("'"+Sk.abstr.typeName(e)+"' object has no attribute 'write'");c="";for(e=0;e<b.length;e++)c+=(new Sk.builtin.str(b[e])).v,c+=d.sep;0<b.length&&
+0<d.sep.length&&(c=c.substring(0,c.length-d.sep.length));c+=d.end;null!==d.file?Sk.misceval.callsim(d.file.write,d.file,new Sk.builtin.str(c)):(b=Sk.importModule("sys"),Sk.misceval.apply(b.$d.stdout.write,void 0,void 0,void 0,[b.$d.stdout,new Sk.builtin.str(c)]))};print_f.co_kwargs=!0;Sk.builtin.print=new Sk.builtin.func(print_f);Sk.builtin.print.__doc__=new Sk.builtin.str("print(value, ..., sep=' ', end='\\n', file=sys.stdout, flush=False)\n\nPrints the values to a stream, or to sys.stdout by default.\nOptional keyword arguments:\nfile: a file-like object (stream); defaults to the current sys.stdout.\nsep: string inserted between values, default a space.\nend: string appended after the last value, default a newline.\nflush: whether to forcibly flush the stream.");Sk.builtin.module=function(){};goog.exportSymbol("Sk.builtin.module",Sk.builtin.module);Sk.builtin.module.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("module",Sk.builtin.module);Sk.builtin.module.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;Sk.builtin.module.prototype.tp$setattr=Sk.builtin.object.prototype.GenericSetAttr;Sk.builtin.structseq_types={};
+Sk.builtin.make_structseq=function(a,b,c,d){var e=a+"."+b,f=[];a=[];for(var g in c)f.push(g),a.push(c[g]);c=function(a){Sk.builtin.pyCheckArgs(e,arguments,1,1);var b,c,d;if(!(this instanceof Sk.builtin.structseq_types[e]))return b=Object.create(Sk.builtin.structseq_types[e].prototype),b.constructor.apply(b,arguments),b;if("[object Array]"===Object.prototype.toString.apply(a))d=a;else{d=[];b=Sk.abstr.iter(a);for(c=b.tp$iternext();void 0!==c;c=b.tp$iternext())d.push(c);if(d.length!=f.length)throw new Sk.builtin.TypeError(e+
+"() takes a "+f.length+"-sequence ("+d.length+"-sequence given)");}Sk.builtin.tuple.call(this,d);this.__class__=Sk.builtin.structseq_types[e]};Sk.builtin.structseq_types[e]=c;goog.inherits(c,Sk.builtin.tuple);d&&(c.prototype.__doc__=d);c.prototype.tp$name=e;c.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj(e,Sk.builtin.structseq_types[e]);c.prototype.ob$type.$d=new Sk.builtin.dict([]);c.prototype.ob$type.$d.mp$ass_subscript(Sk.builtin.type.basesStr_,new Sk.builtin.tuple([Sk.builtin.tuple]));c.prototype.__getitem__=
+new Sk.builtin.func(function(a,b){return Sk.builtin.tuple.prototype.mp$subscript.call(a,b)});c.prototype.__reduce__=new Sk.builtin.func(function(a){throw new Sk.builtin.Exception("__reduce__ is not implemented");});c.prototype.$r=function(){var a,b;if(0===this.v.length)return new Sk.builtin.str(e+"()");b=[];for(a=0;a<this.v.length;++a)b[a]=f[a]+"="+Sk.misceval.objectRepr(this.v[a]).v;a=b.join(", ");1===this.v.length&&(a+=",");return new Sk.builtin.str(e+"("+a+")")};c.prototype.tp$setattr=function(a,
+b){throw new Sk.builtin.AttributeError("readonly property");};c.prototype.tp$getattr=function(a){var b=f.indexOf(a);return 0<=b?this.v[b]:Sk.builtin.object.prototype.GenericGetAttr(a)};return c};goog.exportSymbol("Sk.builtin.make_structseq",Sk.builtin.make_structseq);Sk.builtin.generator=function(a,b,c,d,e){var f;if(a){if(!(this instanceof Sk.builtin.generator))return new Sk.builtin.generator(a,b,c,d,e);this.func_code=a;this.func_globals=b||null;this.gi$running=!1;this.gi$resumeat=0;this.gi$sentvalue=void 0;this.gi$locals={};this.gi$cells={};if(0<c.length)for(b=0;b<a.co_varnames.length;++b)this.gi$locals[a.co_varnames[b]]=c[b];if(void 0!==e)for(f in e)d[f]=e[f];this.func_closure=d;return this}};goog.exportSymbol("Sk.builtin.generator",Sk.builtin.generator);
+Sk.abstr.setUpInheritance("generator",Sk.builtin.generator,Sk.builtin.object);Sk.builtin.generator.prototype.tp$iter=function(){return this};
+Sk.builtin.generator.prototype.tp$iternext=function(a,b){var c,d=this;this.gi$running=!0;void 0===b&&(b=null);this.gi$sentvalue=b;c=[this];this.func_closure&&c.push(this.func_closure);return function f(b){if(b instanceof Sk.misceval.Suspension){if(a)return new Sk.misceval.Suspension(f,b);b=Sk.misceval.retryOptionalSuspensionOrThrow(b)}d.gi$running=!1;goog.asserts.assert(void 0!==b);if(b!==Sk.builtin.none.none$)return d.gi$resumeat=b[0],b=b[1]}(this.func_code.apply(this.func_globals,c))};
+Sk.builtin.generator.prototype.next=new Sk.builtin.func(function(a){return a.tp$iternext(!0)});Sk.builtin.generator.prototype.$r=function(){return new Sk.builtin.str("<generator object "+this.func_code.co_name.v+">")};Sk.builtin.generator.prototype.send=new Sk.builtin.func(function(a,b){return a.tp$iternext(!0,b)});Sk.builtin.makeGenerator=function(a,b){var c,d=new Sk.builtin.generator(null,null,null);d.tp$iternext=a;for(c in b)b.hasOwnProperty(c)&&(d[c]=b[c]);return d};
+goog.exportSymbol("Sk.builtin.makeGenerator",Sk.builtin.makeGenerator);Sk.builtin.file=function(a,b,c){var d;if(!(this instanceof Sk.builtin.file))return new Sk.builtin.file(a,b,c);this.mode=b;this.name=Sk.ffi.remapToJs(a);this.closed=!1;if("/dev/stdout"===this.name)this.data$=Sk.builtin.none.none$,this.fileno=1;else if("/dev/stdin"===this.name)this.fileno=0;else if("/dev/stderr"===this.name)this.fileno=2;else{if(Sk.inBrowser){this.fileno=10;b=document.getElementById(a.v);if(null==b)throw new Sk.builtin.IOError("[Errno 2] No such file or directory: '"+a.v+"'");"textarea"==
+b.nodeName.toLowerCase()?this.data$=b.value:this.data$=b.textContent}else this.fileno=11,this.data$=Sk.read(a.v);this.lineList=this.data$.split("\n");this.lineList=this.lineList.slice(0,-1);for(d in this.lineList)this.lineList[d]+="\n";this.currentLine=0}this.pos$=0;this.__class__=Sk.builtin.file;return this};Sk.abstr.setUpInheritance("file",Sk.builtin.file,Sk.builtin.object);
+Sk.builtin.file.prototype.$r=function(){return new Sk.builtin.str("<"+(this.closed?"closed":"open")+"file '"+this.name+"', mode '"+this.mode+"'>")};Sk.builtin.file.prototype.tp$iter=function(){var a={tp$iter:function(){return a},$obj:this,$index:0,$lines:this.lineList,tp$iternext:function(){return a.$index>=a.$lines.length?void 0:new Sk.builtin.str(a.$lines[a.$index++])}};return a};Sk.builtin.file.prototype.close=new Sk.builtin.func(function(a){a.closed=!0});Sk.builtin.file.prototype.flush=new Sk.builtin.func(function(a){});
+Sk.builtin.file.prototype.fileno=new Sk.builtin.func(function(a){return this.fileno});Sk.builtin.file.prototype.isatty=new Sk.builtin.func(function(a){return!1});Sk.builtin.file.prototype.read=new Sk.builtin.func(function(a,b){var c,d;if(a.closed)throw new Sk.builtin.ValueError("I/O operation on closed file");d=a.data$.length;void 0===b&&(b=d);c=new Sk.builtin.str(a.data$.substr(a.pos$,b));a.pos$+=b;a.pos$>=d&&(a.pos$=d);return c});
+Sk.builtin.file.prototype.readline=new Sk.builtin.func(function(a,b){if(0===a.fileno){var c,d,e;c=c?c.v:"";c=Sk.inputfun(c);return c instanceof Promise?(e=new Sk.misceval.Suspension,e.resume=function(){return new Sk.builtin.str(d)},e.data={type:"Sk.promise",promise:c.then(function(a){return d=a},function(a){d="";return a})},e):new Sk.builtin.str(c)}c="";a.currentLine<a.lineList.length&&(c=a.lineList[a.currentLine],a.currentLine++);return new Sk.builtin.str(c)});
+Sk.builtin.file.prototype.readlines=new Sk.builtin.func(function(a,b){if(0===a.fileno)return new Sk.builtin.NotImplementedError("readlines ins't implemented because the web doesn't support Ctrl+D");var c,d=[];for(c=a.currentLine;c<a.lineList.length;c++)d.push(new Sk.builtin.str(a.lineList[c]));return new Sk.builtin.list(d)});Sk.builtin.file.prototype.seek=new Sk.builtin.func(function(a,b,c){void 0===c&&(c=1);a.pos$=1==c?b:a.data$+b});Sk.builtin.file.prototype.tell=new Sk.builtin.func(function(a){return a.pos$});
+Sk.builtin.file.prototype.truncate=new Sk.builtin.func(function(a,b){goog.asserts.fail()});Sk.builtin.file.prototype.write=new Sk.builtin.func(function(a,b){1===a.fileno?Sk.output(Sk.ffi.remapToJs(b)):goog.asserts.fail()});goog.exportSymbol("Sk.builtin.file",Sk.builtin.file);Sk.ffi=Sk.ffi||{};
+Sk.ffi.remapToPy=function(a){var b,c;if("[object Array]"===Object.prototype.toString.call(a)){c=[];for(b=0;b<a.length;++b)c.push(Sk.ffi.remapToPy(a[b]));return new Sk.builtin.list(c)}if("object"===typeof a){c=[];for(b in a)c.push(Sk.ffi.remapToPy(b)),c.push(Sk.ffi.remapToPy(a[b]));return new Sk.builtin.dict(c)}if("string"===typeof a)return new Sk.builtin.str(a);if("number"===typeof a)return Sk.builtin.assk$(a);if("boolean"===typeof a)return new Sk.builtin.bool(a);goog.asserts.fail("unhandled remap type "+typeof a)};
+goog.exportSymbol("Sk.ffi.remapToPy",Sk.ffi.remapToPy);
+Sk.ffi.remapToJs=function(a){var b,c,d,e;if(a instanceof Sk.builtin.dict){e={};d=a.tp$iter();for(c=d.tp$iternext();void 0!==c;c=d.tp$iternext())b=a.mp$subscript(c),void 0===b&&(b=null),c=Sk.ffi.remapToJs(c),e[c]=Sk.ffi.remapToJs(b);return e}if(a instanceof Sk.builtin.list||a instanceof Sk.builtin.tuple){e=[];for(b=0;b<a.v.length;++b)e.push(Sk.ffi.remapToJs(a.v[b]));return e}return a instanceof Sk.builtin.bool?a.v?!0:!1:a instanceof Sk.builtin.int_?Sk.builtin.asnum$(a):a instanceof Sk.builtin.float_?
+Sk.builtin.asnum$(a):a instanceof Sk.builtin.lng?Sk.builtin.asnum$(a):"number"===typeof a||"boolean"===typeof a?a:a.v};goog.exportSymbol("Sk.ffi.remapToJs",Sk.ffi.remapToJs);Sk.ffi.callback=function(a){return void 0===a?a:function(){return Sk.misceval.apply(a,void 0,void 0,void 0,Array.prototype.slice.call(arguments,0))}};goog.exportSymbol("Sk.ffi.callback",Sk.ffi.callback);Sk.ffi.stdwrap=function(a,b){var c=new a;c.v=b;return c};goog.exportSymbol("Sk.ffi.stdwrap",Sk.ffi.stdwrap);
+Sk.ffi.basicwrap=function(a){if(a instanceof Sk.builtin.int_)return Sk.builtin.asnum$(a);if(a instanceof Sk.builtin.float_)return Sk.builtin.asnum$(a);if(a instanceof Sk.builtin.lng)return Sk.builtin.asnum$(a);if("number"===typeof a||"boolean"===typeof a)return a;if("string"===typeof a)return new Sk.builtin.str(a);goog.asserts.fail("unexpected type for basicwrap")};goog.exportSymbol("Sk.ffi.basicwrap",Sk.ffi.basicwrap);Sk.ffi.unwrapo=function(a){return void 0===a?void 0:a.v};
+goog.exportSymbol("Sk.ffi.unwrapo",Sk.ffi.unwrapo);Sk.ffi.unwrapn=function(a){return null===a?null:a.v};goog.exportSymbol("Sk.ffi.unwrapn",Sk.ffi.unwrapn);Sk.builtin.enumerate=function(a,b){var c;if(!(this instanceof Sk.builtin.enumerate))return new Sk.builtin.enumerate(a,b);Sk.builtin.pyCheckArgs("enumerate",arguments,1,2);if(!Sk.builtin.checkIterable(a))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not iterable");if(void 0!==b)if(Sk.misceval.isIndex(b))b=Sk.misceval.asIndex(b);else throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object cannot be interpreted as an index");else b=0;c=a.tp$iter();this.tp$iter=function(){return this};
+this.$index=b;this.tp$iternext=function(){var a,b=c.tp$iternext();if(void 0!==b)return a=new Sk.builtin.int_(this.$index++),new Sk.builtin.tuple([a,b])};this.__class__=Sk.builtin.enumerate;return this};Sk.abstr.setUpInheritance("enumerate",Sk.builtin.enumerate,Sk.builtin.object);Sk.builtin.enumerate.prototype.__iter__=new Sk.builtin.func(function(a){return a.tp$iter()});Sk.builtin.enumerate.prototype.next=new Sk.builtin.func(function(a){return a.tp$iternext()});Sk.builtin.enumerate.prototype.$r=function(){return new Sk.builtin.str("<enumerate object>")};Sk.Tokenizer=function(a,b,c){this.filename=a;this.callback=c;this.parenlev=this.lnum=0;this.continued=!1;this.namechars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";this.numchars="0123456789";this.contstr="";this.needcont=!1;this.contline=void 0;this.indents=[0];this.endprog=/.*/;this.strstart=[-1,-1];this.interactive=b;this.doneFunc=function(){var a;for(a=1;a<this.indents.length;++a)if(this.callback(Sk.Tokenizer.Tokens.T_DEDENT,"",[this.lnum,0],[this.lnum,0],""))return"done";return this.callback(Sk.Tokenizer.Tokens.T_ENDMARKER,
+"",[this.lnum,0],[this.lnum,0],"")?"done":"failed"}};
+Sk.Tokenizer.Tokens={T_ENDMARKER:0,T_NAME:1,T_NUMBER:2,T_STRING:3,T_NEWLINE:4,T_INDENT:5,T_DEDENT:6,T_LPAR:7,T_RPAR:8,T_LSQB:9,T_RSQB:10,T_COLON:11,T_COMMA:12,T_SEMI:13,T_PLUS:14,T_MINUS:15,T_STAR:16,T_SLASH:17,T_VBAR:18,T_AMPER:19,T_LESS:20,T_GREATER:21,T_EQUAL:22,T_DOT:23,T_PERCENT:24,T_BACKQUOTE:25,T_LBRACE:26,T_RBRACE:27,T_EQEQUAL:28,T_NOTEQUAL:29,T_LESSEQUAL:30,T_GREATEREQUAL:31,T_TILDE:32,T_CIRCUMFLEX:33,T_LEFTSHIFT:34,T_RIGHTSHIFT:35,T_DOUBLESTAR:36,T_PLUSEQUAL:37,T_MINEQUAL:38,T_STAREQUAL:39,
+T_SLASHEQUAL:40,T_PERCENTEQUAL:41,T_AMPEREQUAL:42,T_VBAREQUAL:43,T_CIRCUMFLEXEQUAL:44,T_LEFTSHIFTEQUAL:45,T_RIGHTSHIFTEQUAL:46,T_DOUBLESTAREQUAL:47,T_DOUBLESLASH:48,T_DOUBLESLASHEQUAL:49,T_AT:50,T_OP:51,T_COMMENT:52,T_NL:53,T_RARROW:54,T_ERRORTOKEN:55,T_N_TOKENS:56,T_NT_OFFSET:256};function group(a){return"("+Array.prototype.slice.call(arguments).join("|")+")"}function any(a){return group.apply(null,arguments)+"*"}function maybe(a){return group.apply(null,arguments)+"?"}
+var Whitespace="[ \\f\\t]*",Comment_="#[^\\r\\n]*",Ident="[a-zA-Z_]\\w*",Binnumber="0[bB][01]*",Hexnumber="0[xX][\\da-fA-F]*[lL]?",Octnumber="0[oO]?[0-7]*[lL]?",Decnumber="[1-9]\\d*[lL]?",Intnumber=group(Binnumber,Hexnumber,Octnumber,Decnumber),Exponent="[eE][-+]?\\d+",Pointfloat=group("\\d+\\.\\d*","\\.\\d+")+maybe(Exponent),Expfloat="\\d+"+Exponent,Floatnumber=group(Pointfloat,Expfloat),Imagnumber=group("\\d+[jJ]",Floatnumber+"[jJ]"),Number_=group(Imagnumber,Floatnumber,Intnumber),Single="^[^'\\\\]*(?:\\\\.[^'\\\\]*)*'",
+Double_='^[^"\\\\]*(?:\\\\.[^"\\\\]*)*"',Single3="[^'\\\\]*(?:(?:\\\\.|'(?!''))[^'\\\\]*)*'''",Double3='[^"\\\\]*(?:(?:\\\\.|"(?!""))[^"\\\\]*)*"""',Triple=group("[ubUB]?[rR]?'''",'[ubUB]?[rR]?"""'),String_=group("[uU]?[rR]?'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*'",'[uU]?[rR]?"[^\\n"\\\\]*(?:\\\\.[^\\n"\\\\]*)*"'),Operator=group("\\*\\*=?",">>=?","<<=?","<>","!=","//=?","->","[+\\-*/%&|^=<>]=?","~"),Bracket="[\\][(){}]",Special=group("\\r?\\n","[:;.,`@]"),Funny=group(Operator,Bracket,Special),ContStr=
+group("[uUbB]?[rR]?'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*"+group("'","\\\\\\r?\\n"),'[uUbB]?[rR]?"[^\\n"\\\\]*(?:\\\\.[^\\n"\\\\]*)*'+group('"',"\\\\\\r?\\n")),PseudoExtras=group("\\\\\\r?\\n",Comment_,Triple),PseudoToken="^"+group(PseudoExtras,Number_,Funny,ContStr,Ident),triple_quoted={"'''":!0,'"""':!0,"r'''":!0,'r"""':!0,"R'''":!0,'R"""':!0,"u'''":!0,'u"""':!0,"U'''":!0,'U"""':!0,"b'''":!0,'b"""':!0,"B'''":!0,'B"""':!0,"ur'''":!0,'ur"""':!0,"Ur'''":!0,'Ur"""':!0,"uR'''":!0,'uR"""':!0,"UR'''":!0,
+'UR"""':!0,"br'''":!0,'br"""':!0,"Br'''":!0,'Br"""':!0,"bR'''":!0,'bR"""':!0,"BR'''":!0,'BR"""':!0},single_quoted={"'":!0,'"':!0,"r'":!0,'r"':!0,"R'":!0,'R"':!0,"u'":!0,'u"':!0,"U'":!0,'U"':!0,"b'":!0,'b"':!0,"B'":!0,'B"':!0,"ur'":!0,'ur"':!0,"Ur'":!0,'Ur"':!0,"uR'":!0,'uR"':!0,"UR'":!0,'UR"':!0,"br'":!0,'br"':!0,"Br'":!0,'Br"':!0,"bR'":!0,'bR"':!0,"BR'":!0,'BR"':!0};(function(){for(var a in triple_quoted);for(a in single_quoted);})();var tabsize=8;
+function contains(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1}function rstrip(a,b){var c;for(c=a.length;0<c&&-1!==b.indexOf(a.charAt(c-1));--c);return a.substring(0,c)}
+Sk.Tokenizer.prototype.generateTokens=function(a){var b,c,d,e,f,g,h,k;b=RegExp(PseudoToken);k=RegExp(Single3,"g");h=RegExp(Double3,"g");var l={"'":RegExp(Single,"g"),'"':RegExp(Double_,"g"),"'''":k,'"""':h,"r'''":k,'r"""':h,"u'''":k,'u"""':h,"b'''":k,'b"""':h,"ur'''":k,'ur"""':h,"br'''":k,'br"""':h,"R'''":k,'R"""':h,"U'''":k,'U"""':h,"B'''":k,'B"""':h,"uR'''":k,'uR"""':h,"Ur'''":k,'Ur"""':h,"UR'''":k,'UR"""':h,"bR'''":k,'bR"""':h,"Br'''":k,'Br"""':h,"BR'''":k,'BR"""':h,r:null,R:null,u:null,U:null,
+b:null,B:null};a||(a="");this.lnum+=1;k=0;h=a.length;if(0<this.contstr.length){if(!a)throw new Sk.builtin.TokenError("EOF in multi-line string",this.filename,this.strstart[0],this.strstart[1],this.contline);this.endprog.lastIndex=0;if(f=this.endprog.test(a)){k=e=this.endprog.lastIndex;if(this.callback(Sk.Tokenizer.Tokens.T_STRING,this.contstr+a.substring(0,e),this.strstart,[this.lnum,e],this.contline+a))return"done";this.contstr="";this.needcont=!1;this.contline=void 0}else{if(this.needcont&&"\\\n"!==
+a.substring(a.length-2)&&"\\\r\n"!==a.substring(a.length-3)){if(this.callback(Sk.Tokenizer.Tokens.T_ERRORTOKEN,this.contstr+a,this.strstart,[this.lnum,a.length],this.contline))return"done";this.contstr="";this.contline=void 0}else this.contstr+=a,this.contline+=a;return!1}}else if(0!==this.parenlev||this.continued){if(!a)throw new Sk.builtin.TokenError("EOF in multi-line statement",this.filename,this.lnum,0,a);this.continued=!1}else{if(!a)return this.doneFunc();for(g=0;k<h;){if(" "===a.charAt(k))g+=
+1;else if("\t"===a.charAt(k))g=(g/tabsize+1)*tabsize;else if("\f"===a.charAt(k))g=0;else break;k+=1}if(k===h)return this.doneFunc();if(-1!=="#\r\n".indexOf(a.charAt(k))){if("#"===a.charAt(k))return h=rstrip(a.substring(k),"\r\n"),b=k+h.length,this.callback(Sk.Tokenizer.Tokens.T_COMMENT,h,[this.lnum,k],[this.lnum,k+h.length],a)||this.callback(Sk.Tokenizer.Tokens.T_NL,a.substring(b),[this.lnum,b],[this.lnum,a.length],a)?"done":!1;if(this.callback(Sk.Tokenizer.Tokens.T_NL,a.substring(k),[this.lnum,k],
+[this.lnum,a.length],a))return"done";if(!this.interactive)return!1}if(g>this.indents[this.indents.length-1]&&(this.indents.push(g),this.callback(Sk.Tokenizer.Tokens.T_INDENT,a.substring(0,k),[this.lnum,0],[this.lnum,k],a)))return"done";for(;g<this.indents[this.indents.length-1];){if(!contains(this.indents,g))throw new Sk.builtin.IndentationError("unindent does not match any outer indentation level",this.filename,this.lnum,k,a);this.indents.splice(this.indents.length-1,1);if(this.callback(Sk.Tokenizer.Tokens.T_DEDENT,
+"",[this.lnum,k],[this.lnum,k],a))return"done"}}for(;k<h;){for(g=a.charAt(k);" "===g||"\f"===g||"\t"===g;)k+=1,g=a.charAt(k);b.lastIndex=0;if(g=b.exec(a.substring(k)))if(c=k,e=c+g[1].length,g=[this.lnum,c],f=[this.lnum,e],k=e,e=a.substring(c,e),d=a.charAt(c),-1!==this.numchars.indexOf(d)||"."===d&&"."!==e){if(this.callback(Sk.Tokenizer.Tokens.T_NUMBER,e,g,f,a))return"done"}else if("\r"===d||"\n"===d){if(c=Sk.Tokenizer.Tokens.T_NEWLINE,0<this.parenlev&&(c=Sk.Tokenizer.Tokens.T_NL),this.callback(c,
+e,g,f,a))return"done"}else if("#"===d){if(this.callback(Sk.Tokenizer.Tokens.T_COMMENT,e,g,f,a))return"done"}else if(triple_quoted.hasOwnProperty(e))if(this.endprog=l[e],this.endprog.lastIndex=0,f=this.endprog.test(a.substring(k))){if(k=this.endprog.lastIndex+k,e=a.substring(c,k),this.callback(Sk.Tokenizer.Tokens.T_STRING,e,g,[this.lnum,k],a))return"done"}else{this.strstart=[this.lnum,c];this.contstr=a.substring(c);this.contline=a;break}else if(single_quoted.hasOwnProperty(d)||single_quoted.hasOwnProperty(e.substring(0,
+2))||single_quoted.hasOwnProperty(e.substring(0,3)))if("\n"===e[e.length-1]){this.strstart=[this.lnum,c];this.endprog=l[d]||l[e[1]]||l[e[2]];this.contstr=a.substring(c);this.needcont=!0;this.contline=a;break}else{if(this.callback(Sk.Tokenizer.Tokens.T_STRING,e,g,f,a))return"done"}else if(-1!==this.namechars.indexOf(d)){if(this.callback(Sk.Tokenizer.Tokens.T_NAME,e,g,f,a))return"done"}else if("\\"===d){if(this.callback(Sk.Tokenizer.Tokens.T_NL,e,g,[this.lnum,k],a))return"done";this.continued=!0}else{if(-1!==
+"([{".indexOf(d)?this.parenlev+=1:-1!==")]}".indexOf(d)&&(this.parenlev-=1),this.callback(Sk.Tokenizer.Tokens.T_OP,e,g,f,a))return"done"}else{if(this.callback(Sk.Tokenizer.Tokens.T_ERRORTOKEN,a.charAt(k),[this.lnum,k],[this.lnum,k+1],a))return"done";k+=1}}return!1};
+Sk.Tokenizer.tokenNames={0:"T_ENDMARKER",1:"T_NAME",2:"T_NUMBER",3:"T_STRING",4:"T_NEWLINE",5:"T_INDENT",6:"T_DEDENT",7:"T_LPAR",8:"T_RPAR",9:"T_LSQB",10:"T_RSQB",11:"T_COLON",12:"T_COMMA",13:"T_SEMI",14:"T_PLUS",15:"T_MINUS",16:"T_STAR",17:"T_SLASH",18:"T_VBAR",19:"T_AMPER",20:"T_LESS",21:"T_GREATER",22:"T_EQUAL",23:"T_DOT",24:"T_PERCENT",25:"T_BACKQUOTE",26:"T_LBRACE",27:"T_RBRACE",28:"T_EQEQUAL",29:"T_NOTEQUAL",30:"T_LESSEQUAL",31:"T_GREATEREQUAL",32:"T_TILDE",33:"T_CIRCUMFLEX",34:"T_LEFTSHIFT",
+35:"T_RIGHTSHIFT",36:"T_DOUBLESTAR",37:"T_PLUSEQUAL",38:"T_MINEQUAL",39:"T_STAREQUAL",40:"T_SLASHEQUAL",41:"T_PERCENTEQUAL",42:"T_AMPEREQUAL",43:"T_VBAREQUAL",44:"T_CIRCUMFLEXEQUAL",45:"T_LEFTSHIFTEQUAL",46:"T_RIGHTSHIFTEQUAL",47:"T_DOUBLESTAREQUAL",48:"T_DOUBLESLASH",49:"T_DOUBLESLASHEQUAL",50:"T_AT",51:"T_OP",52:"T_COMMENT",53:"T_NL",54:"T_RARROW",55:"T_ERRORTOKEN",56:"T_N_TOKENS",256:"T_NT_OFFSET"};goog.exportSymbol("Sk.Tokenizer",Sk.Tokenizer);
+goog.exportSymbol("Sk.Tokenizer.prototype.generateTokens",Sk.Tokenizer.prototype.generateTokens);goog.exportSymbol("Sk.Tokenizer.tokenNames",Sk.Tokenizer.tokenNames);Sk.OpMap={"(":Sk.Tokenizer.Tokens.T_LPAR,")":Sk.Tokenizer.Tokens.T_RPAR,"[":Sk.Tokenizer.Tokens.T_LSQB,"]":Sk.Tokenizer.Tokens.T_RSQB,":":Sk.Tokenizer.Tokens.T_COLON,",":Sk.Tokenizer.Tokens.T_COMMA,";":Sk.Tokenizer.Tokens.T_SEMI,"+":Sk.Tokenizer.Tokens.T_PLUS,"-":Sk.Tokenizer.Tokens.T_MINUS,"*":Sk.Tokenizer.Tokens.T_STAR,"/":Sk.Tokenizer.Tokens.T_SLASH,"|":Sk.Tokenizer.Tokens.T_VBAR,"&":Sk.Tokenizer.Tokens.T_AMPER,"<":Sk.Tokenizer.Tokens.T_LESS,">":Sk.Tokenizer.Tokens.T_GREATER,"=":Sk.Tokenizer.Tokens.T_EQUAL,
+".":Sk.Tokenizer.Tokens.T_DOT,"%":Sk.Tokenizer.Tokens.T_PERCENT,"`":Sk.Tokenizer.Tokens.T_BACKQUOTE,"{":Sk.Tokenizer.Tokens.T_LBRACE,"}":Sk.Tokenizer.Tokens.T_RBRACE,"@":Sk.Tokenizer.Tokens.T_AT,"==":Sk.Tokenizer.Tokens.T_EQEQUAL,"!=":Sk.Tokenizer.Tokens.T_NOTEQUAL,"<>":Sk.Tokenizer.Tokens.T_NOTEQUAL,"<=":Sk.Tokenizer.Tokens.T_LESSEQUAL,">=":Sk.Tokenizer.Tokens.T_GREATEREQUAL,"~":Sk.Tokenizer.Tokens.T_TILDE,"^":Sk.Tokenizer.Tokens.T_CIRCUMFLEX,"<<":Sk.Tokenizer.Tokens.T_LEFTSHIFT,">>":Sk.Tokenizer.Tokens.T_RIGHTSHIFT,
+"**":Sk.Tokenizer.Tokens.T_DOUBLESTAR,"+=":Sk.Tokenizer.Tokens.T_PLUSEQUAL,"-=":Sk.Tokenizer.Tokens.T_MINEQUAL,"*=":Sk.Tokenizer.Tokens.T_STAREQUAL,"/=":Sk.Tokenizer.Tokens.T_SLASHEQUAL,"%=":Sk.Tokenizer.Tokens.T_PERCENTEQUAL,"&=":Sk.Tokenizer.Tokens.T_AMPEREQUAL,"|=":Sk.Tokenizer.Tokens.T_VBAREQUAL,"^=":Sk.Tokenizer.Tokens.T_CIRCUMFLEXEQUAL,"<<=":Sk.Tokenizer.Tokens.T_LEFTSHIFTEQUAL,">>=":Sk.Tokenizer.Tokens.T_RIGHTSHIFTEQUAL,"**=":Sk.Tokenizer.Tokens.T_DOUBLESTAREQUAL,"//":Sk.Tokenizer.Tokens.T_DOUBLESLASH,
+"//=":Sk.Tokenizer.Tokens.T_DOUBLESLASHEQUAL,"->":Sk.Tokenizer.Tokens.T_RARROW};
+Sk.ParseTables={sym:{and_expr:257,and_test:258,arglist:259,argument:260,arith_expr:261,assert_stmt:262,atom:263,augassign:264,break_stmt:265,classdef:266,comp_for:267,comp_if:268,comp_iter:269,comp_op:270,comparison:271,compound_stmt:272,continue_stmt:273,debugger_stmt:274,decorated:275,decorator:276,decorators:277,del_stmt:278,dictorsetmaker:279,dotted_as_name:280,dotted_as_names:281,dotted_name:282,encoding_decl:283,eval_input:284,except_clause:285,exec_stmt:286,expr:287,expr_stmt:288,exprlist:289,
+factor:290,file_input:291,flow_stmt:292,for_stmt:293,fpdef:294,fplist:295,funcdef:296,global_stmt:297,if_stmt:298,import_as_name:299,import_as_names:300,import_from:301,import_name:302,import_stmt:303,lambdef:304,list_for:305,list_if:306,list_iter:307,listmaker:308,not_test:309,old_lambdef:310,old_test:311,or_test:312,parameters:313,pass_stmt:314,power:315,print_stmt:316,raise_stmt:317,return_stmt:318,shift_expr:319,simple_stmt:320,single_input:256,sliceop:321,small_stmt:322,stmt:323,subscript:324,
+subscriptlist:325,suite:326,term:327,test:328,testlist:329,testlist1:330,testlist_comp:331,testlist_safe:332,trailer:333,try_stmt:334,varargslist:335,while_stmt:336,with_item:337,with_stmt:338,xor_expr:339,yield_expr:340,yield_stmt:341},number2symbol:{256:"single_input",257:"and_expr",258:"and_test",259:"arglist",260:"argument",261:"arith_expr",262:"assert_stmt",263:"atom",264:"augassign",265:"break_stmt",266:"classdef",267:"comp_for",268:"comp_if",269:"comp_iter",270:"comp_op",271:"comparison",272:"compound_stmt",
+273:"continue_stmt",274:"debugger_stmt",275:"decorated",276:"decorator",277:"decorators",278:"del_stmt",279:"dictorsetmaker",280:"dotted_as_name",281:"dotted_as_names",282:"dotted_name",283:"encoding_decl",284:"eval_input",285:"except_clause",286:"exec_stmt",287:"expr",288:"expr_stmt",289:"exprlist",290:"factor",291:"file_input",292:"flow_stmt",293:"for_stmt",294:"fpdef",295:"fplist",296:"funcdef",297:"global_stmt",298:"if_stmt",299:"import_as_name",300:"import_as_names",301:"import_from",302:"import_name",
+303:"import_stmt",304:"lambdef",305:"list_for",306:"list_if",307:"list_iter",308:"listmaker",309:"not_test",310:"old_lambdef",311:"old_test",312:"or_test",313:"parameters",314:"pass_stmt",315:"power",316:"print_stmt",317:"raise_stmt",318:"return_stmt",319:"shift_expr",320:"simple_stmt",321:"sliceop",322:"small_stmt",323:"stmt",324:"subscript",325:"subscriptlist",326:"suite",327:"term",328:"test",329:"testlist",330:"testlist1",331:"testlist_comp",332:"testlist_safe",333:"trailer",334:"try_stmt",335:"varargslist",
+336:"while_stmt",337:"with_item",338:"with_stmt",339:"xor_expr",340:"yield_expr",341:"yield_stmt"},dfas:{256:[[[[1,1],[2,1],[3,2]],[[0,1]],[[2,1]]],{2:1,4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,34:1,35:1,36:1,37:1}],257:[[[[38,1]],[[39,0],[0,1]]],{6:1,8:1,9:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],258:[[[[40,1]],[[41,0],[0,1]]],{6:1,7:1,8:1,9:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],259:[[[[42,1],[43,
+2],[44,3]],[[45,4]],[[46,5],[0,2]],[[45,6]],[[46,7],[0,4]],[[42,1],[43,2],[44,3],[0,5]],[[0,6]],[[43,4],[44,3]]],{6:1,7:1,8:1,9:1,11:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1,42:1,44:1}],260:[[[[45,1]],[[47,2],[48,3],[0,1]],[[45,3]],[[0,3]]],{6:1,7:1,8:1,9:1,11:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],261:[[[[49,1]],[[26,0],[37,0],[0,1]]],{6:1,8:1,9:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],262:[[[[21,1]],[[45,2]],[[46,3],[0,2]],[[45,4]],[[0,4]]],{21:1}],263:[[[[19,1],[8,2],[9,5],[30,4],[14,3],[15,6],[22,2]],
+[[19,1],[0,1]],[[0,2]],[[50,7],[51,2]],[[52,2],[53,8],[54,8]],[[55,2],[56,9]],[[57,10]],[[51,2]],[[52,2]],[[55,2]],[[15,2]]],{8:1,9:1,14:1,15:1,19:1,22:1,30:1}],264:[[[[58,1],[59,1],[60,1],[61,1],[62,1],[63,1],[64,1],[65,1],[66,1],[67,1],[68,1],[69,1]],[[0,1]]],{58:1,59:1,60:1,61:1,62:1,63:1,64:1,65:1,66:1,67:1,68:1,69:1}],265:[[[[33,1]],[[0,1]]],{33:1}],266:[[[[10,1]],[[22,2]],[[70,3],[30,4]],[[71,5]],[[52,6],[72,7]],[[0,5]],[[70,3]],[[52,6]]],{10:1}],267:[[[[29,1]],[[73,2]],[[74,3]],[[75,4]],[[76,
+5],[0,4]],[[0,5]]],{29:1}],268:[[[[32,1]],[[77,2]],[[76,3],[0,2]],[[0,3]]],{32:1}],269:[[[[78,1],[48,1]],[[0,1]]],{29:1,32:1}],270:[[[[79,1],[80,1],[7,2],[81,1],[79,1],[74,1],[82,1],[83,3],[84,1],[85,1]],[[0,1]],[[74,1]],[[7,1],[0,3]]],{7:1,74:1,79:1,80:1,81:1,82:1,83:1,84:1,85:1}],271:[[[[86,1]],[[87,0],[0,1]]],{6:1,8:1,9:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],272:[[[[88,1],[89,1],[90,1],[91,1],[92,1],[93,1],[94,1],[95,1]],[[0,1]]],{4:1,10:1,16:1,18:1,29:1,32:1,35:1,36:1}],273:[[[[34,1]],[[0,1]]],
+{34:1}],274:[[[[13,1]],[[0,1]]],{13:1}],275:[[[[96,1]],[[94,2],[91,2]],[[0,2]]],{35:1}],276:[[[[35,1]],[[97,2]],[[2,4],[30,3]],[[52,5],[98,6]],[[0,4]],[[2,4]],[[52,5]]],{35:1}],277:[[[[99,1]],[[99,1],[0,1]]],{35:1}],278:[[[[23,1]],[[73,2]],[[0,2]]],{23:1}],279:[[[[45,1]],[[70,2],[48,3],[46,4],[0,1]],[[45,5]],[[0,3]],[[45,6],[0,4]],[[48,3],[46,7],[0,5]],[[46,4],[0,6]],[[45,8],[0,7]],[[70,9]],[[45,10]],[[46,7],[0,10]]],{6:1,7:1,8:1,9:1,11:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],280:[[[[97,1]],[[100,
+2],[0,1]],[[22,3]],[[0,3]]],{22:1}],281:[[[[101,1]],[[46,0],[0,1]]],{22:1}],282:[[[[22,1]],[[102,0],[0,1]]],{22:1}],283:[[[[22,1]],[[0,1]]],{22:1}],284:[[[[72,1]],[[2,1],[103,2]],[[0,2]]],{6:1,7:1,8:1,9:1,11:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],285:[[[[104,1]],[[45,2],[0,1]],[[100,3],[46,3],[0,2]],[[45,4]],[[0,4]]],{104:1}],286:[[[[17,1]],[[86,2]],[[74,3],[0,2]],[[45,4]],[[46,5],[0,4]],[[45,6]],[[0,6]]],{17:1}],287:[[[[105,1]],[[106,0],[0,1]]],{6:1,8:1,9:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],288:[[[[72,
+1]],[[107,2],[47,3],[0,1]],[[72,4],[53,4]],[[72,5],[53,5]],[[0,4]],[[47,3],[0,5]]],{6:1,7:1,8:1,9:1,11:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],289:[[[[86,1]],[[46,2],[0,1]],[[86,1],[0,2]]],{6:1,8:1,9:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],290:[[[[37,2],[26,2],[6,2],[108,1]],[[0,1]],[[109,1]]],{6:1,8:1,9:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],291:[[[[2,0],[103,1],[110,0]],[[0,1]]],{2:1,4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,
+28:1,29:1,30:1,31:1,32:1,33:1,34:1,35:1,36:1,37:1,103:1}],292:[[[[111,1],[112,1],[113,1],[114,1],[115,1]],[[0,1]]],{5:1,20:1,27:1,33:1,34:1}],293:[[[[29,1]],[[73,2]],[[74,3]],[[72,4]],[[70,5]],[[71,6]],[[116,7],[0,6]],[[70,8]],[[71,9]],[[0,9]]],{29:1}],294:[[[[30,1],[22,2]],[[117,3]],[[0,2]],[[52,2]]],{22:1,30:1}],295:[[[[118,1]],[[46,2],[0,1]],[[118,1],[0,2]]],{22:1,30:1}],296:[[[[4,1]],[[22,2]],[[119,3]],[[70,4]],[[71,5]],[[0,5]]],{4:1}],297:[[[[28,1]],[[22,2]],[[46,1],[0,2]]],{28:1}],298:[[[[32,
+1]],[[45,2]],[[70,3]],[[71,4]],[[116,5],[120,1],[0,4]],[[70,6]],[[71,7]],[[0,7]]],{32:1}],299:[[[[22,1]],[[100,2],[0,1]],[[22,3]],[[0,3]]],{22:1}],300:[[[[121,1]],[[46,2],[0,1]],[[121,1],[0,2]]],{22:1}],301:[[[[31,1]],[[97,2],[102,3]],[[25,4]],[[97,2],[25,4],[102,3]],[[122,5],[42,5],[30,6]],[[0,5]],[[122,7]],[[52,5]]],{31:1}],302:[[[[25,1]],[[123,2]],[[0,2]]],{25:1}],303:[[[[124,1],[125,1]],[[0,1]]],{25:1,31:1}],304:[[[[11,1]],[[70,2],[126,3]],[[45,4]],[[70,2]],[[0,4]]],{11:1}],305:[[[[29,1]],[[73,
+2]],[[74,3]],[[127,4]],[[128,5],[0,4]],[[0,5]]],{29:1}],306:[[[[32,1]],[[77,2]],[[128,3],[0,2]],[[0,3]]],{32:1}],307:[[[[129,1],[130,1]],[[0,1]]],{29:1,32:1}],308:[[[[45,1]],[[129,2],[46,3],[0,1]],[[0,2]],[[45,4],[0,3]],[[46,3],[0,4]]],{6:1,7:1,8:1,9:1,11:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],309:[[[[7,1],[131,2]],[[40,2]],[[0,2]]],{6:1,7:1,8:1,9:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],310:[[[[11,1]],[[70,2],[126,3]],[[77,4]],[[70,2]],[[0,4]]],{11:1}],311:[[[[132,1],[75,1]],[[0,1]]],{6:1,7:1,8:1,
+9:1,11:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],312:[[[[133,1]],[[134,0],[0,1]]],{6:1,7:1,8:1,9:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],313:[[[[30,1]],[[52,2],[126,3]],[[0,2]],[[52,2]]],{30:1}],314:[[[[24,1]],[[0,1]]],{24:1}],315:[[[[135,1]],[[44,2],[136,1],[0,1]],[[109,3]],[[0,3]]],{8:1,9:1,14:1,15:1,19:1,22:1,30:1}],316:[[[[12,1]],[[45,2],[137,3],[0,1]],[[46,4],[0,2]],[[45,5]],[[45,2],[0,4]],[[46,6],[0,5]],[[45,7]],[[46,8],[0,7]],[[45,7],[0,8]]],{12:1}],317:[[[[5,1]],[[45,2],[0,1]],[[46,3],[0,2]],
+[[45,4]],[[46,5],[0,4]],[[45,6]],[[0,6]]],{5:1}],318:[[[[20,1]],[[72,2],[0,1]],[[0,2]]],{20:1}],319:[[[[138,1]],[[139,0],[137,0],[0,1]]],{6:1,8:1,9:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],320:[[[[140,1]],[[2,2],[141,3]],[[0,2]],[[140,1],[2,2]]],{5:1,6:1,7:1,8:1,9:1,11:1,12:1,13:1,14:1,15:1,17:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,30:1,31:1,33:1,34:1,37:1}],321:[[[[70,1]],[[45,2],[0,1]],[[0,2]]],{70:1}],322:[[[[142,1],[143,1],[144,1],[145,1],[146,1],[147,1],[148,1],[149,1],[150,1],[151,
+1]],[[0,1]]],{5:1,6:1,7:1,8:1,9:1,11:1,12:1,13:1,14:1,15:1,17:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,30:1,31:1,33:1,34:1,37:1}],323:[[[[1,1],[3,1]],[[0,1]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,34:1,35:1,36:1,37:1}],324:[[[[45,1],[70,2],[102,3]],[[70,2],[0,1]],[[45,4],[152,5],[0,2]],[[102,6]],[[152,5],[0,4]],[[0,5]],[[102,5]]],{6:1,7:1,8:1,9:1,11:1,14:1,15:1,19:1,22:1,26:1,30:1,
+37:1,70:1,102:1}],325:[[[[153,1]],[[46,2],[0,1]],[[153,1],[0,2]]],{6:1,7:1,8:1,9:1,11:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1,70:1,102:1}],326:[[[[1,1],[2,2]],[[0,1]],[[154,3]],[[110,4]],[[155,1],[110,4]]],{2:1,5:1,6:1,7:1,8:1,9:1,11:1,12:1,13:1,14:1,15:1,17:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,30:1,31:1,33:1,34:1,37:1}],327:[[[[109,1]],[[156,0],[42,0],[157,0],[158,0],[0,1]]],{6:1,8:1,9:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],328:[[[[75,1],[159,2]],[[32,3],[0,1]],[[0,2]],[[75,4]],[[116,
+5]],[[45,2]]],{6:1,7:1,8:1,9:1,11:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],329:[[[[45,1]],[[46,2],[0,1]],[[45,1],[0,2]]],{6:1,7:1,8:1,9:1,11:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],330:[[[[45,1]],[[46,0],[0,1]]],{6:1,7:1,8:1,9:1,11:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],331:[[[[45,1]],[[48,2],[46,3],[0,1]],[[0,2]],[[45,4],[0,3]],[[46,3],[0,4]]],{6:1,7:1,8:1,9:1,11:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],332:[[[[77,1]],[[46,2],[0,1]],[[77,3]],[[46,4],[0,3]],[[77,3],[0,4]]],{6:1,7:1,8:1,9:1,11:1,14:1,15:1,
+19:1,22:1,26:1,30:1,37:1}],333:[[[[30,1],[102,2],[14,3]],[[52,4],[98,5]],[[22,4]],[[160,6]],[[0,4]],[[52,4]],[[51,4]]],{14:1,30:1,102:1}],334:[[[[16,1]],[[70,2]],[[71,3]],[[161,4],[162,5]],[[70,6]],[[70,7]],[[71,8]],[[71,9]],[[161,4],[116,10],[162,5],[0,8]],[[0,9]],[[70,11]],[[71,12]],[[162,5],[0,12]]],{16:1}],335:[[[[42,1],[118,2],[44,3]],[[22,4]],[[47,5],[46,6],[0,2]],[[22,7]],[[46,8],[0,4]],[[45,9]],[[42,1],[118,2],[44,3],[0,6]],[[0,7]],[[44,3]],[[46,6],[0,9]]],{22:1,30:1,42:1,44:1}],336:[[[[18,
+1]],[[45,2]],[[70,3]],[[71,4]],[[116,5],[0,4]],[[70,6]],[[71,7]],[[0,7]]],{18:1}],337:[[[[45,1]],[[100,2],[0,1]],[[86,3]],[[0,3]]],{6:1,7:1,8:1,9:1,11:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],338:[[[[36,1]],[[163,2]],[[70,3],[46,1]],[[71,4]],[[0,4]]],{36:1}],339:[[[[164,1]],[[165,0],[0,1]]],{6:1,8:1,9:1,14:1,15:1,19:1,22:1,26:1,30:1,37:1}],340:[[[[27,1]],[[72,2],[0,1]],[[0,2]]],{27:1}],341:[[[[53,1]],[[0,1]]],{27:1}]},states:[[[[1,1],[2,1],[3,2]],[[0,1]],[[2,1]]],[[[38,1]],[[39,0],[0,1]]],[[[40,1]],
+[[41,0],[0,1]]],[[[42,1],[43,2],[44,3]],[[45,4]],[[46,5],[0,2]],[[45,6]],[[46,7],[0,4]],[[42,1],[43,2],[44,3],[0,5]],[[0,6]],[[43,4],[44,3]]],[[[45,1]],[[47,2],[48,3],[0,1]],[[45,3]],[[0,3]]],[[[49,1]],[[26,0],[37,0],[0,1]]],[[[21,1]],[[45,2]],[[46,3],[0,2]],[[45,4]],[[0,4]]],[[[19,1],[8,2],[9,5],[30,4],[14,3],[15,6],[22,2]],[[19,1],[0,1]],[[0,2]],[[50,7],[51,2]],[[52,2],[53,8],[54,8]],[[55,2],[56,9]],[[57,10]],[[51,2]],[[52,2]],[[55,2]],[[15,2]]],[[[58,1],[59,1],[60,1],[61,1],[62,1],[63,1],[64,1],
+[65,1],[66,1],[67,1],[68,1],[69,1]],[[0,1]]],[[[33,1]],[[0,1]]],[[[10,1]],[[22,2]],[[70,3],[30,4]],[[71,5]],[[52,6],[72,7]],[[0,5]],[[70,3]],[[52,6]]],[[[29,1]],[[73,2]],[[74,3]],[[75,4]],[[76,5],[0,4]],[[0,5]]],[[[32,1]],[[77,2]],[[76,3],[0,2]],[[0,3]]],[[[78,1],[48,1]],[[0,1]]],[[[79,1],[80,1],[7,2],[81,1],[79,1],[74,1],[82,1],[83,3],[84,1],[85,1]],[[0,1]],[[74,1]],[[7,1],[0,3]]],[[[86,1]],[[87,0],[0,1]]],[[[88,1],[89,1],[90,1],[91,1],[92,1],[93,1],[94,1],[95,1]],[[0,1]]],[[[34,1]],[[0,1]]],[[[13,
+1]],[[0,1]]],[[[96,1]],[[94,2],[91,2]],[[0,2]]],[[[35,1]],[[97,2]],[[2,4],[30,3]],[[52,5],[98,6]],[[0,4]],[[2,4]],[[52,5]]],[[[99,1]],[[99,1],[0,1]]],[[[23,1]],[[73,2]],[[0,2]]],[[[45,1]],[[70,2],[48,3],[46,4],[0,1]],[[45,5]],[[0,3]],[[45,6],[0,4]],[[48,3],[46,7],[0,5]],[[46,4],[0,6]],[[45,8],[0,7]],[[70,9]],[[45,10]],[[46,7],[0,10]]],[[[97,1]],[[100,2],[0,1]],[[22,3]],[[0,3]]],[[[101,1]],[[46,0],[0,1]]],[[[22,1]],[[102,0],[0,1]]],[[[22,1]],[[0,1]]],[[[72,1]],[[2,1],[103,2]],[[0,2]]],[[[104,1]],[[45,
+2],[0,1]],[[100,3],[46,3],[0,2]],[[45,4]],[[0,4]]],[[[17,1]],[[86,2]],[[74,3],[0,2]],[[45,4]],[[46,5],[0,4]],[[45,6]],[[0,6]]],[[[105,1]],[[106,0],[0,1]]],[[[72,1]],[[107,2],[47,3],[0,1]],[[72,4],[53,4]],[[72,5],[53,5]],[[0,4]],[[47,3],[0,5]]],[[[86,1]],[[46,2],[0,1]],[[86,1],[0,2]]],[[[37,2],[26,2],[6,2],[108,1]],[[0,1]],[[109,1]]],[[[2,0],[103,1],[110,0]],[[0,1]]],[[[111,1],[112,1],[113,1],[114,1],[115,1]],[[0,1]]],[[[29,1]],[[73,2]],[[74,3]],[[72,4]],[[70,5]],[[71,6]],[[116,7],[0,6]],[[70,8]],
+[[71,9]],[[0,9]]],[[[30,1],[22,2]],[[117,3]],[[0,2]],[[52,2]]],[[[118,1]],[[46,2],[0,1]],[[118,1],[0,2]]],[[[4,1]],[[22,2]],[[119,3]],[[70,4]],[[71,5]],[[0,5]]],[[[28,1]],[[22,2]],[[46,1],[0,2]]],[[[32,1]],[[45,2]],[[70,3]],[[71,4]],[[116,5],[120,1],[0,4]],[[70,6]],[[71,7]],[[0,7]]],[[[22,1]],[[100,2],[0,1]],[[22,3]],[[0,3]]],[[[121,1]],[[46,2],[0,1]],[[121,1],[0,2]]],[[[31,1]],[[97,2],[102,3]],[[25,4]],[[97,2],[25,4],[102,3]],[[122,5],[42,5],[30,6]],[[0,5]],[[122,7]],[[52,5]]],[[[25,1]],[[123,2]],
+[[0,2]]],[[[124,1],[125,1]],[[0,1]]],[[[11,1]],[[70,2],[126,3]],[[45,4]],[[70,2]],[[0,4]]],[[[29,1]],[[73,2]],[[74,3]],[[127,4]],[[128,5],[0,4]],[[0,5]]],[[[32,1]],[[77,2]],[[128,3],[0,2]],[[0,3]]],[[[129,1],[130,1]],[[0,1]]],[[[45,1]],[[129,2],[46,3],[0,1]],[[0,2]],[[45,4],[0,3]],[[46,3],[0,4]]],[[[7,1],[131,2]],[[40,2]],[[0,2]]],[[[11,1]],[[70,2],[126,3]],[[77,4]],[[70,2]],[[0,4]]],[[[132,1],[75,1]],[[0,1]]],[[[133,1]],[[134,0],[0,1]]],[[[30,1]],[[52,2],[126,3]],[[0,2]],[[52,2]]],[[[24,1]],[[0,
+1]]],[[[135,1]],[[44,2],[136,1],[0,1]],[[109,3]],[[0,3]]],[[[12,1]],[[45,2],[137,3],[0,1]],[[46,4],[0,2]],[[45,5]],[[45,2],[0,4]],[[46,6],[0,5]],[[45,7]],[[46,8],[0,7]],[[45,7],[0,8]]],[[[5,1]],[[45,2],[0,1]],[[46,3],[0,2]],[[45,4]],[[46,5],[0,4]],[[45,6]],[[0,6]]],[[[20,1]],[[72,2],[0,1]],[[0,2]]],[[[138,1]],[[139,0],[137,0],[0,1]]],[[[140,1]],[[2,2],[141,3]],[[0,2]],[[140,1],[2,2]]],[[[70,1]],[[45,2],[0,1]],[[0,2]]],[[[142,1],[143,1],[144,1],[145,1],[146,1],[147,1],[148,1],[149,1],[150,1],[151,
+1]],[[0,1]]],[[[1,1],[3,1]],[[0,1]]],[[[45,1],[70,2],[102,3]],[[70,2],[0,1]],[[45,4],[152,5],[0,2]],[[102,6]],[[152,5],[0,4]],[[0,5]],[[102,5]]],[[[153,1]],[[46,2],[0,1]],[[153,1],[0,2]]],[[[1,1],[2,2]],[[0,1]],[[154,3]],[[110,4]],[[155,1],[110,4]]],[[[109,1]],[[156,0],[42,0],[157,0],[158,0],[0,1]]],[[[75,1],[159,2]],[[32,3],[0,1]],[[0,2]],[[75,4]],[[116,5]],[[45,2]]],[[[45,1]],[[46,2],[0,1]],[[45,1],[0,2]]],[[[45,1]],[[46,0],[0,1]]],[[[45,1]],[[48,2],[46,3],[0,1]],[[0,2]],[[45,4],[0,3]],[[46,3],
+[0,4]]],[[[77,1]],[[46,2],[0,1]],[[77,3]],[[46,4],[0,3]],[[77,3],[0,4]]],[[[30,1],[102,2],[14,3]],[[52,4],[98,5]],[[22,4]],[[160,6]],[[0,4]],[[52,4]],[[51,4]]],[[[16,1]],[[70,2]],[[71,3]],[[161,4],[162,5]],[[70,6]],[[70,7]],[[71,8]],[[71,9]],[[161,4],[116,10],[162,5],[0,8]],[[0,9]],[[70,11]],[[71,12]],[[162,5],[0,12]]],[[[42,1],[118,2],[44,3]],[[22,4]],[[47,5],[46,6],[0,2]],[[22,7]],[[46,8],[0,4]],[[45,9]],[[42,1],[118,2],[44,3],[0,6]],[[0,7]],[[44,3]],[[46,6],[0,9]]],[[[18,1]],[[45,2]],[[70,3]],
+[[71,4]],[[116,5],[0,4]],[[70,6]],[[71,7]],[[0,7]]],[[[45,1]],[[100,2],[0,1]],[[86,3]],[[0,3]]],[[[36,1]],[[163,2]],[[70,3],[46,1]],[[71,4]],[[0,4]]],[[[164,1]],[[165,0],[0,1]]],[[[27,1]],[[72,2],[0,1]],[[0,2]]],[[[53,1]],[[0,1]]]],labels:[[0,"EMPTY"],[320,null],[4,null],[272,null],[1,"def"],[1,"raise"],[32,null],[1,"not"],[2,null],[26,null],[1,"class"],[1,"lambda"],[1,"print"],[1,"debugger"],[9,null],[25,null],[1,"try"],[1,"exec"],[1,"while"],[3,null],[1,"return"],[1,"assert"],[1,null],[1,"del"],
+[1,"pass"],[1,"import"],[15,null],[1,"yield"],[1,"global"],[1,"for"],[7,null],[1,"from"],[1,"if"],[1,"break"],[1,"continue"],[50,null],[1,"with"],[14,null],[319,null],[19,null],[309,null],[1,"and"],[16,null],[260,null],[36,null],[328,null],[12,null],[22,null],[267,null],[327,null],[308,null],[10,null],[8,null],[340,null],[331,null],[27,null],[279,null],[330,null],[46,null],[39,null],[41,null],[47,null],[42,null],[43,null],[37,null],[44,null],[49,null],[45,null],[38,null],[40,null],[11,null],[326,
+null],[329,null],[289,null],[1,"in"],[312,null],[269,null],[311,null],[268,null],[29,null],[21,null],[28,null],[30,null],[1,"is"],[31,null],[20,null],[287,null],[270,null],[334,null],[298,null],[293,null],[266,null],[338,null],[336,null],[296,null],[275,null],[277,null],[282,null],[259,null],[276,null],[1,"as"],[280,null],[23,null],[0,null],[1,"except"],[339,null],[18,null],[264,null],[315,null],[290,null],[323,null],[265,null],[273,null],[317,null],[318,null],[341,null],[1,"else"],[295,null],[294,
+null],[313,null],[1,"elif"],[299,null],[300,null],[281,null],[302,null],[301,null],[335,null],[332,null],[307,null],[305,null],[306,null],[271,null],[310,null],[258,null],[1,"or"],[263,null],[333,null],[35,null],[261,null],[34,null],[322,null],[13,null],[292,null],[278,null],[288,null],[314,null],[316,null],[262,null],[286,null],[297,null],[303,null],[274,null],[321,null],[324,null],[5,null],[6,null],[48,null],[17,null],[24,null],[304,null],[325,null],[285,null],[1,"finally"],[337,null],[257,null],
+[33,null]],keywords:{and:41,as:100,assert:21,"break":33,"class":10,"continue":34,"debugger":13,def:4,del:23,elif:120,"else":116,except:104,exec:17,"finally":162,"for":29,from:31,global:28,"if":32,"import":25,"in":74,is:83,lambda:11,not:7,or:134,pass:24,print:12,raise:5,"return":20,"try":16,"while":18,"with":36,yield:27},tokens:{0:103,1:22,2:8,3:19,4:2,5:154,6:155,7:30,8:52,9:14,10:51,11:70,12:46,13:141,14:37,15:26,16:42,17:157,18:106,19:39,20:85,21:80,22:47,23:102,24:158,25:15,26:9,27:55,28:81,29:79,
+30:82,31:84,32:6,33:165,34:139,35:137,36:44,37:64,38:68,39:59,40:69,41:60,42:62,43:63,44:65,45:67,46:58,47:61,48:156,49:66,50:35},start:256};function Parser(a,b){this.filename=a;this.grammar=b;this.p_flags=0;return this}Parser.FUTURE_PRINT_FUNCTION="print_function";Parser.FUTURE_UNICODE_LITERALS="unicode_literals";Parser.FUTURE_DIVISION="division";Parser.FUTURE_ABSOLUTE_IMPORT="absolute_import";Parser.FUTURE_WITH_STATEMENT="with_statement";Parser.FUTURE_NESTED_SCOPES="nested_scopes";Parser.FUTURE_GENERATORS="generators";Parser.CO_FUTURE_PRINT_FUNCTION=65536;Parser.CO_FUTURE_UNICODE_LITERALS=131072;Parser.CO_FUTURE_DIVISON=8192;
+Parser.CO_FUTURE_ABSOLUTE_IMPORT=16384;Parser.CO_FUTURE_WITH_STATEMENT=32768;Parser.prototype.setup=function(a){a=a||this.grammar.start;this.stack=[{dfa:this.grammar.dfas[a],state:0,node:{type:a,value:null,context:null,children:[]}}];this.used_names={}};function findInDfa(a,b){for(var c=a.length;c--;)if(a[c][0]===b[0]&&a[c][1]===b[1])return!0;return!1}
+Parser.prototype.addtoken=function(a,b,c){var d,e,f,g,h,k,l,m=this.classify(a,b,c);a:for(;;){l=this.stack[this.stack.length-1];d=l.dfa[0];k=d[l.state];for(h=0;h<k.length;++h){e=k[h][0];g=k[h][1];f=this.grammar.labels[e][0];if(m===e){goog.asserts.assert(256>f);this.shift(a,b,g,c);for(c=g;1===d[c].length&&0===d[c][0][0]&&d[c][0][1]===c;){this.pop();if(0===this.stack.length)return!0;l=this.stack[this.stack.length-1];c=l.state;d=l.dfa[0]}return!1}if(256<=f&&(e=this.grammar.dfas[f],e=e[1],e.hasOwnProperty(m))){this.push(f,
+this.grammar.dfas[f],g,c);continue a}}if(findInDfa(k,[0,l.state])){if(this.pop(),0===this.stack.length)throw new Sk.builtin.ParseError("too much input",this.filename);}else throw d=c[0][0],new Sk.builtin.ParseError("bad input",this.filename,d,c);}};
+Parser.prototype.classify=function(a,b,c){var d;if(a===Sk.Tokenizer.Tokens.T_NAME&&(this.used_names[b]=!0,d=this.grammar.keywords.hasOwnProperty(b)&&this.grammar.keywords[b],"print"===b&&(this.p_flags&Parser.CO_FUTURE_PRINT_FUNCTION||!0===Sk.python3)&&(d=!1),d))return d;d=this.grammar.tokens.hasOwnProperty(a)&&this.grammar.tokens[a];if(!d)throw new Sk.builtin.ParseError("bad token",this.filename,c[0][0],c);return d};
+Parser.prototype.shift=function(a,b,c,d){var e=this.stack[this.stack.length-1].dfa,f=this.stack[this.stack.length-1].node;f.children.push({type:a,value:b,lineno:d[0][0],col_offset:d[0][1],children:null});this.stack[this.stack.length-1]={dfa:e,state:c,node:f}};
+Parser.prototype.push=function(a,b,c,d){a={type:a,value:null,lineno:d[0][0],col_offset:d[0][1],children:[]};this.stack[this.stack.length-1]={dfa:this.stack[this.stack.length-1].dfa,state:c,node:this.stack[this.stack.length-1].node};this.stack.push({dfa:b,state:0,node:a})};Parser.prototype.pop=function(){var a,b=this.stack.pop().node;b&&(0!==this.stack.length?(a=this.stack[this.stack.length-1].node,a.children.push(b)):(this.rootnode=b,this.rootnode.used_names=this.used_names))};
+function makeParser(a,b){var c,d,e,f,g;void 0===b&&(b="file_input");g=new Parser(a,Sk.ParseTables);"file_input"===b?g.setup(Sk.ParseTables.sym.file_input):goog.asserts.fail("todo;");f=Sk.Tokenizer.Tokens.T_COMMENT;e=Sk.Tokenizer.Tokens.T_NL;d=Sk.Tokenizer.Tokens.T_OP;c=new Sk.Tokenizer(a,"single_input"===b,function(a,b,c,h,n){if(a!==f&&a!==e&&(a===d&&(a=Sk.OpMap[b]),g.addtoken(a,b,[c,h,n])))return!0});var h=function(a){if(a=c.generateTokens(a)){if("done"!==a)throw new Sk.builtin.ParseError("incomplete input",
+this.filename);return g.rootnode}return!1};h.p_flags=g.p_flags;return h}Sk.parse=function(a,b){var c,d,e,f=makeParser(a);"\n"!==b.substr(b.length-1,1)&&(b+="\n");e=b.split("\n");for(c=0;c<e.length;++c)d=f(e[c]+(c===e.length-1?"":"\n"));return{cst:d,flags:f.p_flags}};
+Sk.parseTreeDump=function(a,b){var c,d;b=b||"";d=""+b;if(256<=a.type)for(d+=Sk.ParseTables.number2symbol[a.type]+"\n",c=0;c<a.children.length;++c)d+=Sk.parseTreeDump(a.children[c],b+" ");else d+=Sk.Tokenizer.tokenNames[a.type]+": "+(new Sk.builtin.str(a.value)).$r().v+"\n";return d};goog.exportSymbol("Sk.parse",Sk.parse);goog.exportSymbol("Sk.parseTreeDump",Sk.parseTreeDump);function Load(){}function Store(){}function Del(){}function AugLoad(){}function AugStore(){}function Param(){}function And(){}function Or(){}function Add(){}function Sub(){}function Mult(){}function Div(){}function Mod(){}function Pow(){}function LShift(){}function RShift(){}function BitOr(){}function BitXor(){}function BitAnd(){}function FloorDiv(){}function Invert(){}function Not(){}function UAdd(){}function USub(){}function Eq(){}function NotEq(){}function Lt(){}function LtE(){}
+function Gt(){}function GtE(){}function Is(){}function IsNot(){}function In_(){}function NotIn(){}function Module(a){this.body=a;return this}function Interactive(a){this.body=a;return this}function Expression(a){goog.asserts.assert(null!==a&&void 0!==a);this.body=a;return this}function Suite(a){this.body=a;return this}
+function FunctionDef(a,b,c,d,e,f){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);this.name=a;this.args=b;this.body=c;this.decorator_list=d;this.lineno=e;this.col_offset=f;return this}function ClassDef(a,b,c,d,e,f){goog.asserts.assert(null!==a&&void 0!==a);this.name=a;this.bases=b;this.body=c;this.decorator_list=d;this.lineno=e;this.col_offset=f;return this}function Return_(a,b,c){this.value=a;this.lineno=b;this.col_offset=c;return this}
+function Delete_(a,b,c){this.targets=a;this.lineno=b;this.col_offset=c;return this}function Assign(a,b,c,d){goog.asserts.assert(null!==b&&void 0!==b);this.targets=a;this.value=b;this.lineno=c;this.col_offset=d;return this}function AugAssign(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);goog.asserts.assert(null!==c&&void 0!==c);this.target=a;this.op=b;this.value=c;this.lineno=d;this.col_offset=e;return this}
+function Print(a,b,c,d,e){this.dest=a;this.values=b;this.nl=c;this.lineno=d;this.col_offset=e;return this}function For_(a,b,c,d,e,f){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);this.target=a;this.iter=b;this.body=c;this.orelse=d;this.lineno=e;this.col_offset=f;return this}function While_(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);this.test=a;this.body=b;this.orelse=c;this.lineno=d;this.col_offset=e;return this}
+function If_(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);this.test=a;this.body=b;this.orelse=c;this.lineno=d;this.col_offset=e;return this}function With_(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);this.context_expr=a;this.optional_vars=b;this.body=c;this.lineno=d;this.col_offset=e;return this}function Raise(a,b,c,d,e){this.type=a;this.inst=b;this.tback=c;this.lineno=d;this.col_offset=e;return this}
+function TryExcept(a,b,c,d,e){this.body=a;this.handlers=b;this.orelse=c;this.lineno=d;this.col_offset=e;return this}function TryFinally(a,b,c,d){this.body=a;this.finalbody=b;this.lineno=c;this.col_offset=d;return this}function Assert(a,b,c,d){goog.asserts.assert(null!==a&&void 0!==a);this.test=a;this.msg=b;this.lineno=c;this.col_offset=d;return this}function Import_(a,b,c){this.names=a;this.lineno=b;this.col_offset=c;return this}
+function ImportFrom(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);this.module=a;this.names=b;this.level=c;this.lineno=d;this.col_offset=e;return this}function Exec(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);this.body=a;this.globals=b;this.locals=c;this.lineno=d;this.col_offset=e;return this}function Global(a,b,c){this.names=a;this.lineno=b;this.col_offset=c;return this}
+function Expr(a,b,c){goog.asserts.assert(null!==a&&void 0!==a);this.value=a;this.lineno=b;this.col_offset=c;return this}function Pass(a,b){this.lineno=a;this.col_offset=b;return this}function Break_(a,b){this.lineno=a;this.col_offset=b;return this}function Continue_(a,b){this.lineno=a;this.col_offset=b;return this}function Debugger_(a,b){this.lineno=a;this.col_offset=b;return this}
+function BoolOp(a,b,c,d){goog.asserts.assert(null!==a&&void 0!==a);this.op=a;this.values=b;this.lineno=c;this.col_offset=d;return this}function BinOp(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);goog.asserts.assert(null!==c&&void 0!==c);this.left=a;this.op=b;this.right=c;this.lineno=d;this.col_offset=e;return this}
+function UnaryOp(a,b,c,d){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);this.op=a;this.operand=b;this.lineno=c;this.col_offset=d;return this}function Lambda(a,b,c,d){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);this.args=a;this.body=b;this.lineno=c;this.col_offset=d;return this}
+function IfExp(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);goog.asserts.assert(null!==c&&void 0!==c);this.test=a;this.body=b;this.orelse=c;this.lineno=d;this.col_offset=e;return this}function Dict(a,b,c,d){this.keys=a;this.values=b;this.lineno=c;this.col_offset=d;return this}function Set(a,b,c){this.elts=a;this.lineno=b;this.col_offset=c;return this}
+function ListComp(a,b,c,d){goog.asserts.assert(null!==a&&void 0!==a);this.elt=a;this.generators=b;this.lineno=c;this.col_offset=d;return this}function SetComp(a,b,c,d){goog.asserts.assert(null!==a&&void 0!==a);this.elt=a;this.generators=b;this.lineno=c;this.col_offset=d;return this}function DictComp(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);this.key=a;this.value=b;this.generators=c;this.lineno=d;this.col_offset=e;return this}
+function GeneratorExp(a,b,c,d){goog.asserts.assert(null!==a&&void 0!==a);this.elt=a;this.generators=b;this.lineno=c;this.col_offset=d;return this}function Yield(a,b,c){this.value=a;this.lineno=b;this.col_offset=c;return this}function Compare(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);this.left=a;this.ops=b;this.comparators=c;this.lineno=d;this.col_offset=e;return this}
+function Call(a,b,c,d,e,f,g){goog.asserts.assert(null!==a&&void 0!==a);this.func=a;this.args=b;this.keywords=c;this.starargs=d;this.kwargs=e;this.lineno=f;this.col_offset=g;return this}function Repr(a,b,c){goog.asserts.assert(null!==a&&void 0!==a);this.value=a;this.lineno=b;this.col_offset=c;return this}function Num(a,b,c){goog.asserts.assert(null!==a&&void 0!==a);this.n=a;this.lineno=b;this.col_offset=c;return this}
+function Str(a,b,c){goog.asserts.assert(null!==a&&void 0!==a);this.s=a;this.lineno=b;this.col_offset=c;return this}function Attribute(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);goog.asserts.assert(null!==c&&void 0!==c);this.value=a;this.attr=b;this.ctx=c;this.lineno=d;this.col_offset=e;return this}
+function Subscript(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);goog.asserts.assert(null!==c&&void 0!==c);this.value=a;this.slice=b;this.ctx=c;this.lineno=d;this.col_offset=e;return this}function Name(a,b,c,d){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);this.id=a;this.ctx=b;this.lineno=c;this.col_offset=d;return this}
+function List(a,b,c,d){goog.asserts.assert(null!==b&&void 0!==b);this.elts=a;this.ctx=b;this.lineno=c;this.col_offset=d;return this}function Tuple(a,b,c,d){goog.asserts.assert(null!==b&&void 0!==b);this.elts=a;this.ctx=b;this.lineno=c;this.col_offset=d;return this}function Ellipsis(){return this}function Slice(a,b,c){this.lower=a;this.upper=b;this.step=c;return this}function ExtSlice(a){this.dims=a;return this}function Index(a){goog.asserts.assert(null!==a&&void 0!==a);this.value=a;return this}
+function comprehension(a,b,c){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);this.target=a;this.iter=b;this.ifs=c;return this}function ExceptHandler(a,b,c,d,e){this.type=a;this.name=b;this.body=c;this.lineno=d;this.col_offset=e;return this}function arguments_(a,b,c,d){this.args=a;this.vararg=b;this.kwarg=c;this.defaults=d;return this}
+function keyword(a,b){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);this.arg=a;this.value=b;return this}function alias(a,b){goog.asserts.assert(null!==a&&void 0!==a);this.name=a;this.asname=b;return this}Module.prototype._astname="Module";Module.prototype._fields=["body",function(a){return a.body}];Interactive.prototype._astname="Interactive";Interactive.prototype._fields=["body",function(a){return a.body}];Expression.prototype._astname="Expression";
+Expression.prototype._fields=["body",function(a){return a.body}];Suite.prototype._astname="Suite";Suite.prototype._fields=["body",function(a){return a.body}];FunctionDef.prototype._astname="FunctionDef";FunctionDef.prototype._fields=["name",function(a){return a.name},"args",function(a){return a.args},"body",function(a){return a.body},"decorator_list",function(a){return a.decorator_list}];ClassDef.prototype._astname="ClassDef";
+ClassDef.prototype._fields=["name",function(a){return a.name},"bases",function(a){return a.bases},"body",function(a){return a.body},"decorator_list",function(a){return a.decorator_list}];Return_.prototype._astname="Return";Return_.prototype._fields=["value",function(a){return a.value}];Delete_.prototype._astname="Delete";Delete_.prototype._fields=["targets",function(a){return a.targets}];Assign.prototype._astname="Assign";Assign.prototype._fields=["targets",function(a){return a.targets},"value",function(a){return a.value}];
+AugAssign.prototype._astname="AugAssign";AugAssign.prototype._fields=["target",function(a){return a.target},"op",function(a){return a.op},"value",function(a){return a.value}];Print.prototype._astname="Print";Print.prototype._fields=["dest",function(a){return a.dest},"values",function(a){return a.values},"nl",function(a){return a.nl}];For_.prototype._astname="For";
+For_.prototype._fields=["target",function(a){return a.target},"iter",function(a){return a.iter},"body",function(a){return a.body},"orelse",function(a){return a.orelse}];While_.prototype._astname="While";While_.prototype._fields=["test",function(a){return a.test},"body",function(a){return a.body},"orelse",function(a){return a.orelse}];If_.prototype._astname="If";If_.prototype._fields=["test",function(a){return a.test},"body",function(a){return a.body},"orelse",function(a){return a.orelse}];
+With_.prototype._astname="With";With_.prototype._fields=["context_expr",function(a){return a.context_expr},"optional_vars",function(a){return a.optional_vars},"body",function(a){return a.body}];Raise.prototype._astname="Raise";Raise.prototype._fields=["type",function(a){return a.type},"inst",function(a){return a.inst},"tback",function(a){return a.tback}];TryExcept.prototype._astname="TryExcept";
+TryExcept.prototype._fields=["body",function(a){return a.body},"handlers",function(a){return a.handlers},"orelse",function(a){return a.orelse}];TryFinally.prototype._astname="TryFinally";TryFinally.prototype._fields=["body",function(a){return a.body},"finalbody",function(a){return a.finalbody}];Assert.prototype._astname="Assert";Assert.prototype._fields=["test",function(a){return a.test},"msg",function(a){return a.msg}];Import_.prototype._astname="Import";Import_.prototype._fields=["names",function(a){return a.names}];
+ImportFrom.prototype._astname="ImportFrom";ImportFrom.prototype._fields=["module",function(a){return a.module},"names",function(a){return a.names},"level",function(a){return a.level}];Exec.prototype._astname="Exec";Exec.prototype._fields=["body",function(a){return a.body},"globals",function(a){return a.globals},"locals",function(a){return a.locals}];Global.prototype._astname="Global";Global.prototype._fields=["names",function(a){return a.names}];Expr.prototype._astname="Expr";
+Expr.prototype._fields=["value",function(a){return a.value}];Pass.prototype._astname="Pass";Pass.prototype._fields=[];Break_.prototype._astname="Break";Break_.prototype._fields=[];Continue_.prototype._astname="Continue";Continue_.prototype._fields=[];Debugger_.prototype._astname="Debugger";Debugger_.prototype._fields=[];BoolOp.prototype._astname="BoolOp";BoolOp.prototype._fields=["op",function(a){return a.op},"values",function(a){return a.values}];BinOp.prototype._astname="BinOp";
+BinOp.prototype._fields=["left",function(a){return a.left},"op",function(a){return a.op},"right",function(a){return a.right}];UnaryOp.prototype._astname="UnaryOp";UnaryOp.prototype._fields=["op",function(a){return a.op},"operand",function(a){return a.operand}];Lambda.prototype._astname="Lambda";Lambda.prototype._fields=["args",function(a){return a.args},"body",function(a){return a.body}];IfExp.prototype._astname="IfExp";
+IfExp.prototype._fields=["test",function(a){return a.test},"body",function(a){return a.body},"orelse",function(a){return a.orelse}];Dict.prototype._astname="Dict";Dict.prototype._fields=["keys",function(a){return a.keys},"values",function(a){return a.values}];Set.prototype._astname="Set";Set.prototype._fields=["elts",function(a){return a.elts}];ListComp.prototype._astname="ListComp";ListComp.prototype._fields=["elt",function(a){return a.elt},"generators",function(a){return a.generators}];
+SetComp.prototype._astname="SetComp";SetComp.prototype._fields=["elt",function(a){return a.elt},"generators",function(a){return a.generators}];DictComp.prototype._astname="DictComp";DictComp.prototype._fields=["key",function(a){return a.key},"value",function(a){return a.value},"generators",function(a){return a.generators}];GeneratorExp.prototype._astname="GeneratorExp";GeneratorExp.prototype._fields=["elt",function(a){return a.elt},"generators",function(a){return a.generators}];
+Yield.prototype._astname="Yield";Yield.prototype._fields=["value",function(a){return a.value}];Compare.prototype._astname="Compare";Compare.prototype._fields=["left",function(a){return a.left},"ops",function(a){return a.ops},"comparators",function(a){return a.comparators}];Call.prototype._astname="Call";Call.prototype._fields=["func",function(a){return a.func},"args",function(a){return a.args},"keywords",function(a){return a.keywords},"starargs",function(a){return a.starargs},"kwargs",function(a){return a.kwargs}];
+Repr.prototype._astname="Repr";Repr.prototype._fields=["value",function(a){return a.value}];Num.prototype._astname="Num";Num.prototype._fields=["n",function(a){return a.n}];Str.prototype._astname="Str";Str.prototype._fields=["s",function(a){return a.s}];Attribute.prototype._astname="Attribute";Attribute.prototype._fields=["value",function(a){return a.value},"attr",function(a){return a.attr},"ctx",function(a){return a.ctx}];Subscript.prototype._astname="Subscript";
+Subscript.prototype._fields=["value",function(a){return a.value},"slice",function(a){return a.slice},"ctx",function(a){return a.ctx}];Name.prototype._astname="Name";Name.prototype._fields=["id",function(a){return a.id},"ctx",function(a){return a.ctx}];List.prototype._astname="List";List.prototype._fields=["elts",function(a){return a.elts},"ctx",function(a){return a.ctx}];Tuple.prototype._astname="Tuple";Tuple.prototype._fields=["elts",function(a){return a.elts},"ctx",function(a){return a.ctx}];
+Load.prototype._astname="Load";Load.prototype._isenum=!0;Store.prototype._astname="Store";Store.prototype._isenum=!0;Del.prototype._astname="Del";Del.prototype._isenum=!0;AugLoad.prototype._astname="AugLoad";AugLoad.prototype._isenum=!0;AugStore.prototype._astname="AugStore";AugStore.prototype._isenum=!0;Param.prototype._astname="Param";Param.prototype._isenum=!0;Ellipsis.prototype._astname="Ellipsis";Ellipsis.prototype._fields=[];Slice.prototype._astname="Slice";
+Slice.prototype._fields=["lower",function(a){return a.lower},"upper",function(a){return a.upper},"step",function(a){return a.step}];ExtSlice.prototype._astname="ExtSlice";ExtSlice.prototype._fields=["dims",function(a){return a.dims}];Index.prototype._astname="Index";Index.prototype._fields=["value",function(a){return a.value}];And.prototype._astname="And";And.prototype._isenum=!0;Or.prototype._astname="Or";Or.prototype._isenum=!0;Add.prototype._astname="Add";Add.prototype._isenum=!0;
+Sub.prototype._astname="Sub";Sub.prototype._isenum=!0;Mult.prototype._astname="Mult";Mult.prototype._isenum=!0;Div.prototype._astname="Div";Div.prototype._isenum=!0;Mod.prototype._astname="Mod";Mod.prototype._isenum=!0;Pow.prototype._astname="Pow";Pow.prototype._isenum=!0;LShift.prototype._astname="LShift";LShift.prototype._isenum=!0;RShift.prototype._astname="RShift";RShift.prototype._isenum=!0;BitOr.prototype._astname="BitOr";BitOr.prototype._isenum=!0;BitXor.prototype._astname="BitXor";
+BitXor.prototype._isenum=!0;BitAnd.prototype._astname="BitAnd";BitAnd.prototype._isenum=!0;FloorDiv.prototype._astname="FloorDiv";FloorDiv.prototype._isenum=!0;Invert.prototype._astname="Invert";Invert.prototype._isenum=!0;Not.prototype._astname="Not";Not.prototype._isenum=!0;UAdd.prototype._astname="UAdd";UAdd.prototype._isenum=!0;USub.prototype._astname="USub";USub.prototype._isenum=!0;Eq.prototype._astname="Eq";Eq.prototype._isenum=!0;NotEq.prototype._astname="NotEq";NotEq.prototype._isenum=!0;
+Lt.prototype._astname="Lt";Lt.prototype._isenum=!0;LtE.prototype._astname="LtE";LtE.prototype._isenum=!0;Gt.prototype._astname="Gt";Gt.prototype._isenum=!0;GtE.prototype._astname="GtE";GtE.prototype._isenum=!0;Is.prototype._astname="Is";Is.prototype._isenum=!0;IsNot.prototype._astname="IsNot";IsNot.prototype._isenum=!0;In_.prototype._astname="In";In_.prototype._isenum=!0;NotIn.prototype._astname="NotIn";NotIn.prototype._isenum=!0;comprehension.prototype._astname="comprehension";
+comprehension.prototype._fields=["target",function(a){return a.target},"iter",function(a){return a.iter},"ifs",function(a){return a.ifs}];ExceptHandler.prototype._astname="ExceptHandler";ExceptHandler.prototype._fields=["type",function(a){return a.type},"name",function(a){return a.name},"body",function(a){return a.body}];arguments_.prototype._astname="arguments";
+arguments_.prototype._fields=["args",function(a){return a.args},"vararg",function(a){return a.vararg},"kwarg",function(a){return a.kwarg},"defaults",function(a){return a.defaults}];keyword.prototype._astname="keyword";keyword.prototype._fields=["arg",function(a){return a.arg},"value",function(a){return a.value}];alias.prototype._astname="alias";alias.prototype._fields=["name",function(a){return a.name},"asname",function(a){return a.asname}];var SYM=Sk.ParseTables.sym,TOK=Sk.Tokenizer.Tokens,COMP_GENEXP=0,COMP_SETCOMP=1;function Compiling(a,b,c){this.c_encoding=a;this.c_filename=b;this.c_flags=c||0}function NCH(a){goog.asserts.assert(void 0!==a);return null===a.children?0:a.children.length}function CHILD(a,b){goog.asserts.assert(void 0!==a);goog.asserts.assert(void 0!==b);return a.children[b]}function REQ(a,b){goog.asserts.assert(a.type===b,"node wasn't expected type")}
+function strobj(a){goog.asserts.assert("string"===typeof a,"expecting string, got "+typeof a);return new Sk.builtin.str(a)}
+function numStmts(a){var b,c,d;switch(a.type){case SYM.single_input:if(CHILD(a,0).type===TOK.T_NEWLINE)break;else return numStmts(CHILD(a,0));case SYM.file_input:for(c=d=0;c<NCH(a);++c)b=CHILD(a,c),b.type===SYM.stmt&&(d+=numStmts(b));return d;case SYM.stmt:return numStmts(CHILD(a,0));case SYM.compound_stmt:return 1;case SYM.simple_stmt:return Math.floor(NCH(a)/2);case SYM.suite:if(1===NCH(a))return numStmts(CHILD(a,0));d=0;for(c=2;c<NCH(a)-1;++c)d+=numStmts(CHILD(a,c));return d;default:goog.asserts.fail("Non-statement found")}return 0}
+function forbiddenCheck(a,b,c,d){if("None"===c)throw new Sk.builtin.SyntaxError("assignment to None",a.c_filename,d);if("True"===c||"False"===c)throw new Sk.builtin.SyntaxError("assignment to True or False is forbidden",a.c_filename,d);}
+function setContext(a,b,c,d){var e,f;goog.asserts.assert(c!==AugStore&&c!==AugLoad);e=f=null;switch(b.constructor){case Attribute:case Name:c===Store&&forbiddenCheck(a,d,b.attr,d.lineno);b.ctx=c;break;case Subscript:b.ctx=c;break;case List:b.ctx=c;f=b.elts;break;case Tuple:if(0===b.elts.length)throw new Sk.builtin.SyntaxError("can't assign to ()",a.c_filename,d.lineno);b.ctx=c;f=b.elts;break;case Lambda:e="lambda";break;case Call:e="function call";break;case BoolOp:case BinOp:case UnaryOp:e="operator";
+break;case GeneratorExp:e="generator expression";break;case Yield:e="yield expression";break;case ListComp:e="list comprehension";break;case SetComp:e="set comprehension";break;case DictComp:e="dict comprehension";break;case Dict:case Set:case Num:case Str:e="literal";break;case Compare:e="comparison";break;case Repr:e="repr";break;case IfExp:e="conditional expression";break;default:goog.asserts.fail("unhandled expression in assignment")}if(e)throw new Sk.builtin.SyntaxError("can't "+(c===Store?"assign to":
+"delete")+" "+e,a.c_filename,d.lineno);if(f)for(b=0;b<f.length;++b)setContext(a,f[b],c,d)}var operatorMap={};(function(){operatorMap[TOK.T_VBAR]=BitOr;operatorMap[TOK.T_CIRCUMFLEX]=BitXor;operatorMap[TOK.T_AMPER]=BitAnd;operatorMap[TOK.T_LEFTSHIFT]=LShift;operatorMap[TOK.T_RIGHTSHIFT]=RShift;operatorMap[TOK.T_PLUS]=Add;operatorMap[TOK.T_MINUS]=Sub;operatorMap[TOK.T_STAR]=Mult;operatorMap[TOK.T_SLASH]=Div;operatorMap[TOK.T_DOUBLESLASH]=FloorDiv;operatorMap[TOK.T_PERCENT]=Mod})();
+function getOperator(a){goog.asserts.assert(void 0!==operatorMap[a.type]);return operatorMap[a.type]}
+function astForCompOp(a,b){REQ(b,SYM.comp_op);if(1===NCH(b))switch(b=CHILD(b,0),b.type){case TOK.T_LESS:return Lt;case TOK.T_GREATER:return Gt;case TOK.T_EQEQUAL:return Eq;case TOK.T_LESSEQUAL:return LtE;case TOK.T_GREATEREQUAL:return GtE;case TOK.T_NOTEQUAL:return NotEq;case TOK.T_NAME:if("in"===b.value)return In_;if("is"===b.value)return Is}else if(2===NCH(b)&&CHILD(b,0).type===TOK.T_NAME){if("in"===CHILD(b,1).value)return NotIn;if("is"===CHILD(b,0).value)return IsNot}goog.asserts.fail("invalid comp_op")}
+function seqForTestlist(a,b){var c,d=[];goog.asserts.assert(b.type===SYM.testlist||b.type===SYM.listmaker||b.type===SYM.testlist_comp||b.type===SYM.testlist_safe||b.type===SYM.testlist1);for(c=0;c<NCH(b);c+=2)goog.asserts.assert(CHILD(b,c).type===SYM.test||CHILD(b,c).type===SYM.old_test),d[c/2]=astForExpr(a,CHILD(b,c));return d}
+function astForSuite(a,b){var c,d,e,f,g;REQ(b,SYM.suite);g=[];f=0;if(CHILD(b,0).type===SYM.simple_stmt)for(b=CHILD(b,0),e=NCH(b)-1,CHILD(b,e-1).type===TOK.T_SEMI&&(e-=1),d=0;d<e;d+=2)g[f++]=astForStmt(a,CHILD(b,d));else for(d=2;d<NCH(b)-1;++d)if(e=CHILD(b,d),REQ(e,SYM.stmt),c=numStmts(e),1===c)g[f++]=astForStmt(a,e);else for(e=CHILD(e,0),REQ(e,SYM.simple_stmt),c=0;c<NCH(e);c+=2){if(0===NCH(CHILD(e,c))){goog.asserts.assert(c+1===NCH(e));break}g[f++]=astForStmt(a,CHILD(e,c))}goog.asserts.assert(f===
+numStmts(b));return g}
+function astForExceptClause(a,b,c){var d;REQ(b,SYM.except_clause);REQ(c,SYM.suite);if(1===NCH(b))return new ExceptHandler(null,null,astForSuite(a,c),b.lineno,b.col_offset);if(2===NCH(b))return new ExceptHandler(astForExpr(a,CHILD(b,1)),null,astForSuite(a,c),b.lineno,b.col_offset);if(4===NCH(b))return d=astForExpr(a,CHILD(b,3)),setContext(a,d,Store,CHILD(b,3)),new ExceptHandler(astForExpr(a,CHILD(b,1)),d,astForSuite(a,c),b.lineno,b.col_offset);goog.asserts.fail("wrong number of children for except clause")}
+function astForTryStmt(a,b){var c,d,e;d=NCH(b);c=(d-3)/3;var f,g=[],h=null;REQ(b,SYM.try_stmt);f=astForSuite(a,CHILD(b,2));if(CHILD(b,d-3).type===TOK.T_NAME)"finally"===CHILD(b,d-3).value?(9<=d&&CHILD(b,d-6).type===TOK.T_NAME&&(g=astForSuite(a,CHILD(b,d-4)),c--),h=astForSuite(a,CHILD(b,d-1))):g=astForSuite(a,CHILD(b,d-1)),c--;else if(CHILD(b,d-3).type!==SYM.except_clause)throw new Sk.builtin.SyntaxError("malformed 'try' statement",a.c_filename,b.lineno);if(0<c){e=[];for(d=0;d<c;++d)e[d]=astForExceptClause(a,
+CHILD(b,3+3*d),CHILD(b,5+3*d));c=new TryExcept(f,e,g,b.lineno,b.col_offset);if(!h)return c;f=[c]}goog.asserts.assert(null!==h);return new TryFinally(f,h,b.lineno,b.col_offset)}function astForDottedName(a,b){var c,d,e,f,g;REQ(b,SYM.dotted_name);g=b.lineno;f=b.col_offset;e=strobj(CHILD(b,0).value);d=new Name(e,Load,g,f);for(c=2;c<NCH(b);c+=2)e=strobj(CHILD(b,c).value),d=new Attribute(d,e,Load,g,f);return d}
+function astForDecorator(a,b){var c;REQ(b,SYM.decorator);REQ(CHILD(b,0),TOK.T_AT);REQ(CHILD(b,NCH(b)-1),TOK.T_NEWLINE);c=astForDottedName(a,CHILD(b,1));return 3===NCH(b)?c:5===NCH(b)?new Call(c,[],[],null,null,b.lineno,b.col_offset):astForCall(a,CHILD(b,3),c)}function astForDecorators(a,b){var c,d;REQ(b,SYM.decorators);d=[];for(c=0;c<NCH(b);++c)d[c]=astForDecorator(a,CHILD(b,c));return d}
+function astForDecorated(a,b){var c,d;REQ(b,SYM.decorated);d=astForDecorators(a,CHILD(b,0));goog.asserts.assert(CHILD(b,1).type===SYM.funcdef||CHILD(b,1).type===SYM.classdef);c=null;CHILD(b,1).type===SYM.funcdef?c=astForFuncdef(a,CHILD(b,1),d):CHILD(b,1)===SYM.classdef&&(c=astForClassdef(a,CHILD(b,1),d));c&&(c.lineno=b.lineno,c.col_offset=b.col_offset);return c}function astForWithVar(a,b){REQ(b,SYM.with_item);return astForExpr(a,CHILD(b,1))}
+function astForWithStmt(a,b){var c,d,e=3;goog.asserts.assert(b.type===SYM.with_stmt);d=astForExpr(a,CHILD(b,1));CHILD(b,2).type===SYM.with_item&&(c=astForWithVar(a,CHILD(b,2)),setContext(a,c,Store,b),e=4);return new With_(d,c,astForSuite(a,CHILD(b,e)),b.lineno,b.col_offset)}
+function astForExecStmt(a,b){var c,d=null,e=null,f=NCH(b);goog.asserts.assert(2===f||4===f||6===f);REQ(b,SYM.exec_stmt);c=astForExpr(a,CHILD(b,1));4<=f&&(d=astForExpr(a,CHILD(b,3)));6===f&&(e=astForExpr(a,CHILD(b,5)));return new Exec(c,d,e,b.lineno,b.col_offset)}
+function astForIfStmt(a,b){var c,d,e,f;REQ(b,SYM.if_stmt);if(4===NCH(b))return new If_(astForExpr(a,CHILD(b,1)),astForSuite(a,CHILD(b,3)),[],b.lineno,b.col_offset);e=CHILD(b,4).value.charAt(2);if("s"===e)return new If_(astForExpr(a,CHILD(b,1)),astForSuite(a,CHILD(b,3)),astForSuite(a,CHILD(b,6)),b.lineno,b.col_offset);if("i"===e){f=NCH(b)-4;c=!1;e=[];CHILD(b,f+1).type===TOK.T_NAME&&"s"===CHILD(b,f+1).value.charAt(2)&&(c=!0,f-=3);f/=4;c&&(e=[new If_(astForExpr(a,CHILD(b,NCH(b)-6)),astForSuite(a,CHILD(b,
+NCH(b)-4)),astForSuite(a,CHILD(b,NCH(b)-1)),CHILD(b,NCH(b)-6).lineno,CHILD(b,NCH(b)-6).col_offset)],f--);for(d=0;d<f;++d)c=5+4*(f-d-1),e=[new If_(astForExpr(a,CHILD(b,c)),astForSuite(a,CHILD(b,c+2)),e,CHILD(b,c).lineno,CHILD(b,c).col_offset)];return new If_(astForExpr(a,CHILD(b,1)),astForSuite(a,CHILD(b,3)),e,b.lineno,b.col_offset)}goog.asserts.fail("unexpected token in 'if' statement")}
+function astForExprlist(a,b,c){var d,e,f;REQ(b,SYM.exprlist);f=[];for(e=0;e<NCH(b);e+=2)d=astForExpr(a,CHILD(b,e)),f[e/2]=d,c&&setContext(a,d,c,CHILD(b,e));return f}function astForDelStmt(a,b){REQ(b,SYM.del_stmt);return new Delete_(astForExprlist(a,CHILD(b,1),Del),b.lineno,b.col_offset)}function astForGlobalStmt(a,b){var c,d=[];REQ(b,SYM.global_stmt);for(c=1;c<NCH(b);c+=2)d[(c-1)/2]=strobj(CHILD(b,c).value);return new Global(d,b.lineno,b.col_offset)}
+function astForAssertStmt(a,b){REQ(b,SYM.assert_stmt);if(2===NCH(b))return new Assert(astForExpr(a,CHILD(b,1)),null,b.lineno,b.col_offset);if(4===NCH(b))return new Assert(astForExpr(a,CHILD(b,1)),astForExpr(a,CHILD(b,3)),b.lineno,b.col_offset);goog.asserts.fail("improper number of parts to assert stmt")}
+function aliasForImportName(a,b){var c,d;a:for(;;)switch(b.type){case SYM.import_as_name:return d=null,c=strobj(CHILD(b,0).value),3===NCH(b)&&(d=CHILD(b,2).value),new alias(c,null==d?null:strobj(d));case SYM.dotted_as_name:if(1===NCH(b)){b=CHILD(b,0);continue a}else return d=aliasForImportName(a,CHILD(b,0)),goog.asserts.assert(!d.asname),d.asname=strobj(CHILD(b,2).value),d;case SYM.dotted_name:if(1===NCH(b))return new alias(strobj(CHILD(b,0).value),null);d="";for(c=0;c<NCH(b);c+=2)d+=CHILD(b,c).value+
+".";return new alias(strobj(d.substr(0,d.length-1)),null);case TOK.T_STAR:return new alias(strobj("*"),null);default:throw new Sk.builtin.SyntaxError("unexpected import name",a.c_filename,b.lineno);}}
+function astForImportStmt(a,b){var c,d,e,f,g,h;REQ(b,SYM.import_stmt);h=b.lineno;g=b.col_offset;b=CHILD(b,0);if(b.type===SYM.import_name){b=CHILD(b,1);REQ(b,SYM.dotted_as_names);d=[];for(f=0;f<NCH(b);f+=2)d[f/2]=aliasForImportName(a,CHILD(b,f));return new Import_(d,h,g)}if(b.type===SYM.import_from){c=null;e=0;for(d=1;d<NCH(b);++d){if(CHILD(b,d).type===SYM.dotted_name){c=aliasForImportName(a,CHILD(b,d));d++;break}else if(CHILD(b,d).type!==TOK.T_DOT)break;e++}++d;switch(CHILD(b,d).type){case TOK.T_STAR:b=
+CHILD(b,d);break;case TOK.T_LPAR:b=CHILD(b,d+1);NCH(b);break;case SYM.import_as_names:b=CHILD(b,d);d=NCH(b);if(0===d%2)throw new Sk.builtin.SyntaxError("trailing comma not allowed without surrounding parentheses",a.c_filename,b.lineno);break;default:throw new Sk.builtin.SyntaxError("Unexpected node-type in from-import",a.c_filename,b.lineno);}d=[];if(b.type===TOK.T_STAR)d[0]=aliasForImportName(a,b);else for(f=0;f<NCH(b);f+=2)d[f/2]=aliasForImportName(a,CHILD(b,f));c=c?c.name.v:"";return new ImportFrom(strobj(c),
+d,e,h,g)}throw new Sk.builtin.SyntaxError("unknown import statement",a.c_filename,b.lineno);}function astForTestlistComp(a,b){goog.asserts.assert(b.type===SYM.testlist_comp||b.type===SYM.argument);return 1<NCH(b)&&CHILD(b,1).type===SYM.comp_for?astForGenExpr(a,b):astForTestlist(a,b)}
+function astForListcomp(a,b){function c(a,b){for(var c=0;;){REQ(b,SYM.list_iter);if(CHILD(b,0).type===SYM.list_for)return c;b=CHILD(b,0);REQ(b,SYM.list_if);c++;if(2==NCH(b))return c;b=CHILD(b,2)}}var d,e,f,g,h,k,l,m,p;REQ(b,SYM.listmaker);goog.asserts.assert(1<NCH(b));p=astForExpr(a,CHILD(b,0));m=function(a,b){var c=0,d=CHILD(b,1);a:for(;;){c++;REQ(d,SYM.list_for);if(5===NCH(d))d=CHILD(d,4);else return c;b:for(;;){REQ(d,SYM.list_iter);d=CHILD(d,0);if(d.type===SYM.list_for)continue a;else if(d.type===
+SYM.list_if)if(3===NCH(d)){d=CHILD(d,2);continue b}else return c;break}break}}(a,b);l=[];k=CHILD(b,1);for(h=0;h<m;++h){REQ(k,SYM.list_for);f=CHILD(k,1);e=astForExprlist(a,f,Store);d=astForTestlist(a,CHILD(k,3));g=1===NCH(f)?new comprehension(e[0],d,[]):new comprehension(new Tuple(e,Store,k.lineno,k.col_offset),d,[]);if(5===NCH(k)){k=CHILD(k,4);f=c(a,k);e=[];for(d=0;d<f;++d)REQ(k,SYM.list_iter),k=CHILD(k,0),REQ(k,SYM.list_if),e[d]=astForExpr(a,CHILD(k,1)),3===NCH(k)&&(k=CHILD(k,2));k.type===SYM.list_iter&&
+(k=CHILD(k,0));g.ifs=e}l[h]=g}return new ListComp(p,l,b.lineno,b.col_offset)}
+function astForFactor(a,b){var c,d;if(CHILD(b,0).type===TOK.T_MINUS&&2===NCH(b)&&(c=CHILD(b,1),c.type===SYM.factor&&1===NCH(c)&&(c=CHILD(c,0),c.type===SYM.power&&1===NCH(c)&&(d=CHILD(c,0),d.type===SYM.atom&&(c=CHILD(d,0),c.type===TOK.T_NUMBER)))))return c.value="-"+c.value,astForAtom(a,d);c=astForExpr(a,CHILD(b,1));switch(CHILD(b,0).type){case TOK.T_PLUS:return new UnaryOp(UAdd,c,b.lineno,b.col_offset);case TOK.T_MINUS:return new UnaryOp(USub,c,b.lineno,b.col_offset);case TOK.T_TILDE:return new UnaryOp(Invert,
+c,b.lineno,b.col_offset)}goog.asserts.fail("unhandled factor")}function astForForStmt(a,b){var c,d,e=[];REQ(b,SYM.for_stmt);9===NCH(b)&&(e=astForSuite(a,CHILD(b,8)));d=CHILD(b,1);c=astForExprlist(a,d,Store);c=1===NCH(d)?c[0]:new Tuple(c,Store,b.lineno,b.col_offset);return new For_(c,astForTestlist(a,CHILD(b,3)),astForSuite(a,CHILD(b,5)),e,b.lineno,b.col_offset)}
+function astForCall(a,b,c){var d,e,f,g,h,k,l,m,p,n,r;REQ(b,SYM.arglist);for(p=g=n=r=0;p<NCH(b);p++)m=CHILD(b,p),m.type===SYM.argument&&(1===NCH(m)?r++:CHILD(m,1).type===SYM.comp_for?g++:n++);if(1<g||g&&(r||n))throw new Sk.builtin.SyntaxError("Generator expression must be parenthesized if not sole argument",a.c_filename,b.lineno);if(255<r+n+g)throw new Sk.builtin.SyntaxError("more than 255 arguments",a.c_filename,b.lineno);l=[];k=[];n=r=0;g=h=null;for(p=0;p<NCH(b);p++)if(m=CHILD(b,p),m.type===SYM.argument)if(1===
+NCH(m)){if(n)throw new Sk.builtin.SyntaxError("non-keyword arg after keyword arg",a.c_filename,b.lineno);if(h)throw new Sk.builtin.SyntaxError("only named arguments may follow *expression",a.c_filename,b.lineno);l[r++]=astForExpr(a,CHILD(m,0))}else if(CHILD(m,1).type===SYM.comp_for)l[r++]=astForGenExpr(a,m);else{d=astForExpr(a,CHILD(m,0));if(d.constructor===Lambda)throw new Sk.builtin.SyntaxError("lambda cannot contain assignment",a.c_filename,b.lineno);if(d.constructor!==Name)throw new Sk.builtin.SyntaxError("keyword can't be an expression",
+a.c_filename,b.lineno);f=d.id;forbiddenCheck(a,CHILD(m,0),f,b.lineno);for(e=0;e<n;++e)if(d=k[e].arg,d===f)throw new Sk.builtin.SyntaxError("keyword argument repeated",a.c_filename,b.lineno);k[n++]=new keyword(f,astForExpr(a,CHILD(m,2)))}else m.type===TOK.T_STAR?h=astForExpr(a,CHILD(b,++p)):m.type===TOK.T_DOUBLESTAR&&(g=astForExpr(a,CHILD(b,++p)));return new Call(c,l,k,h,g,c.lineno,c.col_offset)}
+function astForTrailer(a,b,c){var d,e,f,g;REQ(b,SYM.trailer);if(CHILD(b,0).type===TOK.T_LPAR)return 2===NCH(b)?new Call(c,[],[],null,null,b.lineno,b.col_offset):astForCall(a,CHILD(b,1),c);if(CHILD(b,0).type===TOK.T_DOT)return new Attribute(c,strobj(CHILD(b,1).value),Load,b.lineno,b.col_offset);REQ(CHILD(b,0),TOK.T_LSQB);REQ(CHILD(b,2),TOK.T_RSQB);b=CHILD(b,1);if(1===NCH(b))return new Subscript(c,astForSlice(a,CHILD(b,0)),Load,b.lineno,b.col_offset);g=!0;f=[];for(e=0;e<NCH(b);e+=2)d=astForSlice(a,
+CHILD(b,e)),d.constructor!==Index&&(g=!1),f[e/2]=d;if(!g)return new Subscript(c,new ExtSlice(f),Load,b.lineno,b.col_offset);a=[];for(e=0;e<f.length;++e)d=f[e],goog.asserts.assert(d.constructor===Index&&null!==d.value&&void 0!==d.value),a[e]=d.value;d=new Tuple(a,Load,b.lineno,b.col_offset);return new Subscript(c,new Index(d),Load,b.lineno,b.col_offset)}
+function astForFlowStmt(a,b){var c;REQ(b,SYM.flow_stmt);c=CHILD(b,0);switch(c.type){case SYM.break_stmt:return new Break_(b.lineno,b.col_offset);case SYM.continue_stmt:return new Continue_(b.lineno,b.col_offset);case SYM.yield_stmt:return new Expr(astForExpr(a,CHILD(c,0)),b.lineno,b.col_offset);case SYM.return_stmt:return 1===NCH(c)?new Return_(null,b.lineno,b.col_offset):new Return_(astForTestlist(a,CHILD(c,1)),b.lineno,b.col_offset);case SYM.raise_stmt:if(1===NCH(c))return new Raise(null,null,null,
+b.lineno,b.col_offset);if(2===NCH(c))return new Raise(astForExpr(a,CHILD(c,1)),null,null,b.lineno,b.col_offset);if(4===NCH(c))return new Raise(astForExpr(a,CHILD(c,1)),astForExpr(a,CHILD(c,3)),null,b.lineno,b.col_offset);if(6===NCH(c))return new Raise(astForExpr(a,CHILD(c,1)),astForExpr(a,CHILD(c,3)),astForExpr(a,CHILD(c,5)),b.lineno,b.col_offset);break;default:goog.asserts.fail("unexpected flow_stmt")}goog.asserts.fail("unhandled flow statement")}
+function astForArguments(a,b){var c,d,e,f,g,h,k,l,m,p=null,n=null;if(b.type===SYM.parameters){if(2===NCH(b))return new arguments_([],null,null,[]);b=CHILD(b,1)}REQ(b,SYM.varargslist);l=[];k=[];h=!1;for(e=f=g=0;g<NCH(b);)switch(m=CHILD(b,g),m.type){case SYM.fpdef:c=0;a:for(;;){if(g+1<NCH(b)&&CHILD(b,g+1).type===TOK.T_EQUAL)k[f++]=astForExpr(a,CHILD(b,g+2)),g+=2,h=!0;else if(h){if(c)throw new Sk.builtin.SyntaxError("parenthesized arg with default",a.c_filename,b.lineno);throw new Sk.builtin.SyntaxError("non-default argument follows default argument",
+a.c_filename,b.lineno);}if(3===NCH(m)){m=CHILD(m,1);if(1!==NCH(m))throw new Sk.builtin.SyntaxError("tuple parameter unpacking has been removed",a.c_filename,b.lineno);c=!0;m=CHILD(m,0);goog.asserts.assert(m.type===SYM.fpdef);continue a}CHILD(m,0).type===TOK.T_NAME&&(forbiddenCheck(a,b,CHILD(m,0).value,b.lineno),d=strobj(CHILD(m,0).value),l[e++]=new Name(d,Param,m.lineno,m.col_offset));g+=2;if(c)throw new Sk.builtin.SyntaxError("parenthesized argument names are invalid",a.c_filename,b.lineno);break}break;
+case TOK.T_STAR:forbiddenCheck(a,CHILD(b,g+1),CHILD(b,g+1).value,b.lineno);p=strobj(CHILD(b,g+1).value);g+=3;break;case TOK.T_DOUBLESTAR:forbiddenCheck(a,CHILD(b,g+1),CHILD(b,g+1).value,b.lineno);n=strobj(CHILD(b,g+1).value);g+=3;break;default:goog.asserts.fail("unexpected node in varargslist")}return new arguments_(l,p,n,k)}
+function astForFuncdef(a,b,c){var d,e;REQ(b,SYM.funcdef);e=strobj(CHILD(b,1).value);forbiddenCheck(a,CHILD(b,1),CHILD(b,1).value,b.lineno);d=astForArguments(a,CHILD(b,2));a=astForSuite(a,CHILD(b,4));return new FunctionDef(e,d,a,c,b.lineno,b.col_offset)}function astForClassBases(a,b){goog.asserts.assert(0<NCH(b));REQ(b,SYM.testlist);return 1===NCH(b)?[astForExpr(a,CHILD(b,0))]:seqForTestlist(a,b)}
+function astForClassdef(a,b,c){var d,e;REQ(b,SYM.classdef);forbiddenCheck(a,b,CHILD(b,1).value,b.lineno);e=strobj(CHILD(b,1).value);if(4===NCH(b))return new ClassDef(e,[],astForSuite(a,CHILD(b,3)),c,b.lineno,b.col_offset);if(CHILD(b,3).type===TOK.T_RPAR)return new ClassDef(e,[],astForSuite(a,CHILD(b,5)),c,b.lineno,b.col_offset);d=astForClassBases(a,CHILD(b,3));a=astForSuite(a,CHILD(b,6));return new ClassDef(e,d,a,c,b.lineno,b.col_offset)}
+function astForLambdef(a,b){var c,d;3===NCH(b)?(c=new arguments_([],null,null,[]),d=astForExpr(a,CHILD(b,2))):(c=astForArguments(a,CHILD(b,1)),d=astForExpr(a,CHILD(b,3)));return new Lambda(c,d,b.lineno,b.col_offset)}
+function astForComprehension(a,b){function c(a,b){for(var c=0;;){REQ(b,SYM.comp_iter);if(CHILD(b,0).type===SYM.comp_for)return c;b=CHILD(b,0);REQ(b,SYM.comp_if);c++;if(2==NCH(b))return c;b=CHILD(b,2)}}var d,e,f,g,h,k,l,m;k=function(a,b){var c=0;a:for(;;){c++;REQ(b,SYM.comp_for);if(5===NCH(b))b=CHILD(b,4);else return c;b:for(;;){REQ(b,SYM.comp_iter);b=CHILD(b,0);if(b.type===SYM.comp_for)continue a;else if(b.type===SYM.comp_if)if(3===NCH(b)){b=CHILD(b,2);continue b}else return c;break}break}goog.asserts.fail("logic error in countCompFors")}(a,
+b);l=[];for(h=0;h<k;++h){REQ(b,SYM.comp_for);e=CHILD(b,1);d=astForExprlist(a,e,Store);g=astForExpr(a,CHILD(b,3));m=1===NCH(e)?new comprehension(d[0],g,[]):new comprehension(new Tuple(d,Store,b.lineno,b.col_offset),g,[]);if(5===NCH(b)){b=CHILD(b,4);f=c(a,b);e=[];for(d=0;d<f;++d)REQ(b,SYM.comp_iter),b=CHILD(b,0),REQ(b,SYM.comp_if),g=astForExpr(a,CHILD(b,1)),e[d]=g,3===NCH(b)&&(b=CHILD(b,2));b.type===SYM.comp_iter&&(b=CHILD(b,0));m.ifs=e}l[h]=m}return l}
+function astForIterComp(a,b,c){var d;goog.asserts.assert(1<NCH(b));d=astForExpr(a,CHILD(b,0));a=astForComprehension(a,CHILD(b,1));if(c===COMP_GENEXP)return new GeneratorExp(d,a,b.lineno,b.col_offset);if(c===COMP_SETCOMP)return new SetComp(d,a,b.lineno,b.col_offset)}
+function astForDictComp(a,b){var c,d,e=[];goog.asserts.assert(3<NCH(b));REQ(CHILD(b,1),TOK.T_COLON);c=astForExpr(a,CHILD(b,0));d=astForExpr(a,CHILD(b,2));e=astForComprehension(a,CHILD(b,3));return new DictComp(c,d,e,b.lineno,b.col_offset)}function astForGenExpr(a,b){goog.asserts.assert(b.type===SYM.testlist_comp||b.type===SYM.argument);return astForIterComp(a,b,COMP_GENEXP)}function astForSetComp(a,b){goog.asserts.assert(b.type===SYM.dictorsetmaker);return astForIterComp(a,b,COMP_SETCOMP)}
+function astForWhileStmt(a,b){REQ(b,SYM.while_stmt);if(4===NCH(b))return new While_(astForExpr(a,CHILD(b,1)),astForSuite(a,CHILD(b,3)),[],b.lineno,b.col_offset);if(7===NCH(b))return new While_(astForExpr(a,CHILD(b,1)),astForSuite(a,CHILD(b,3)),astForSuite(a,CHILD(b,6)),b.lineno,b.col_offset);goog.asserts.fail("wrong number of tokens for 'while' stmt")}
+function astForAugassign(a,b){REQ(b,SYM.augassign);b=CHILD(b,0);switch(b.value.charAt(0)){case "+":return Add;case "-":return Sub;case "/":return"/"===b.value.charAt(1)?FloorDiv:Div;case "%":return Mod;case "<":return LShift;case ">":return RShift;case "&":return BitAnd;case "^":return BitXor;case "|":return BitOr;case "*":return"*"===b.value.charAt(1)?Pow:Mult;default:goog.asserts.fail("invalid augassign")}}
+function astForBinop(a,b){var c,d,e,f,g=new BinOp(astForExpr(a,CHILD(b,0)),getOperator(CHILD(b,1)),astForExpr(a,CHILD(b,2)),b.lineno,b.col_offset),h=(NCH(b)-1)/2;for(f=1;f<h;++f)e=CHILD(b,2*f+1),d=getOperator(e),c=astForExpr(a,CHILD(b,2*f+2)),g=new BinOp(g,d,c,e.lineno,e.col_offset);return g}
+function astForTestlist(a,b){goog.asserts.assert(0<NCH(b));b.type===SYM.testlist_comp?1<NCH(b)&&goog.asserts.assert(CHILD(b,1).type!==SYM.comp_for):goog.asserts.assert(b.type===SYM.testlist||b.type===SYM.testlist_safe||b.type===SYM.testlist1);return 1===NCH(b)?astForExpr(a,CHILD(b,0)):new Tuple(seqForTestlist(a,b),Load,b.lineno,b.col_offset)}
+function astForExprStmt(a,b){var c,d,e;REQ(b,SYM.expr_stmt);if(1===NCH(b))return new Expr(astForTestlist(a,CHILD(b,0)),b.lineno,b.col_offset);if(CHILD(b,1).type===SYM.augassign){c=CHILD(b,0);e=astForTestlist(a,c);switch(e.constructor){case GeneratorExp:throw new Sk.builtin.SyntaxError("augmented assignment to generator expression not possible",a.c_filename,b.lineno);case Yield:throw new Sk.builtin.SyntaxError("augmented assignment to yield expression not possible",a.c_filename,b.lineno);case Name:d=
+e.id;forbiddenCheck(a,c,d,b.lineno);break;case Attribute:case Subscript:break;default:throw new Sk.builtin.SyntaxError("illegal expression for augmented assignment",a.c_filename,b.lineno);}setContext(a,e,Store,c);c=CHILD(b,2);c=c.type===SYM.testlist?astForTestlist(a,c):astForExpr(a,c);return new AugAssign(e,astForAugassign(a,CHILD(b,1)),c,b.lineno,b.col_offset)}REQ(CHILD(b,1),TOK.T_EQUAL);e=[];for(d=0;d<NCH(b)-2;d+=2){c=CHILD(b,d);if(c.type===SYM.yield_expr)throw new Sk.builtin.SyntaxError("assignment to yield expression not possible",
+a.c_filename,b.lineno);c=astForTestlist(a,c);setContext(a,c,Store,CHILD(b,d));e[d/2]=c}c=CHILD(b,NCH(b)-1);c=c.type===SYM.testlist?astForTestlist(a,c):astForExpr(a,c);return new Assign(e,c,b.lineno,b.col_offset)}function astForIfexpr(a,b){goog.asserts.assert(5===NCH(b));return new IfExp(astForExpr(a,CHILD(b,2)),astForExpr(a,CHILD(b,0)),astForExpr(a,CHILD(b,4)),b.lineno,b.col_offset)}
+function parsestr(a,b){var c=b.charAt(0),d=!1,e=!1;if(a.c_flags&Parser.CO_FUTURE_UNICODE_LITERALS||!0===Sk.python3)e=!0;if("u"===c||"U"===c)b=b.substr(1),c=b.charAt(0),e=!0;else if("r"===c||"R"===c)b=b.substr(1),c=b.charAt(0),d=!0;goog.asserts.assert("b"!==c&&"B"!==c,"todo; haven't done b'' strings yet");goog.asserts.assert("'"===c||'"'===c&&b.charAt(b.length-1)===c);b=b.substr(1,b.length-2);e&&(b=unescape(encodeURIComponent(b)));4<=b.length&&(b.charAt(0)===c&&b.charAt(1)===c)&&(goog.asserts.assert(b.charAt(b.length-
+1)===c&&b.charAt(b.length-2)===c),b=b.substr(2,b.length-4));if(d||-1===b.indexOf("\\"))c=strobj(decodeURIComponent(escape(b)));else{for(var c=strobj,d=b,f,g,h,k,l=d.length,m="",e=0;e<l;++e)f=d.charAt(e),"\\"===f?(++e,f=d.charAt(e),"n"===f?m+="\n":"\\"===f?m+="\\":"t"===f?m+="\t":"r"===f?m+="\r":"b"===f?m+="\b":"f"===f?m+="\f":"v"===f?m+="\v":"0"===f?m+="\x00":'"'===f?m+='"':"'"===f?m+="'":"\n"!==f&&("x"===f?(k=d.charAt(++e),h=d.charAt(++e),m+=String.fromCharCode(parseInt(k+h,16))):"u"===f||"U"===
+f?(k=d.charAt(++e),h=d.charAt(++e),g=d.charAt(++e),f=d.charAt(++e),m+=String.fromCharCode(parseInt(k+h,16),parseInt(g+f,16))):m+="\\"+f)):m+=f;c=c(m)}return c}function parsestrplus(a,b){var c,d;REQ(CHILD(b,0),TOK.T_STRING);d=new Sk.builtin.str("");for(c=0;c<NCH(b);++c)try{d=d.sq$concat(parsestr(a,CHILD(b,c).value))}catch(e){throw new Sk.builtin.SyntaxError("invalid string (possibly contains a unicode character)",a.c_filename,CHILD(b,c).lineno);}return d}
+function parsenumber(a,b,c){a=b.charAt(b.length-1);if("j"===a||"J"===a)return Sk.builtin.complex.complex_subtype_from_string(b);if("l"===a||"L"===a)return Sk.longFromStr(b.substr(0,b.length-1),0);if(-1!==b.indexOf("."))return new Sk.builtin.float_(parseFloat(b));c=b;a=!1;"-"===b.charAt(0)&&(c=b.substr(1),a=!0);if("0"!==c.charAt(0)||"x"!==c.charAt(1)&&"X"!==c.charAt(1)){if(-1!==b.indexOf("e")||-1!==b.indexOf("E"))return new Sk.builtin.float_(parseFloat(b));if("0"!==c.charAt(0)||"b"!==c.charAt(1)&&
+"B"!==c.charAt(1))if("0"===c.charAt(0))if("0"===c)c=0;else{c=c.substring(1);if("o"===c.charAt(0)||"O"===c.charAt(0))c=c.substring(1);c=parseInt(c,8)}else c=parseInt(c,10);else c=c.substring(2),c=parseInt(c,2)}else c=c.substring(2),c=parseInt(c,16);return c>Sk.builtin.int_.threshold$&&Math.floor(c)===c&&-1===b.indexOf("e")&&-1===b.indexOf("E")?Sk.longFromStr(b,0):a?new Sk.builtin.int_(-c):new Sk.builtin.int_(c)}
+function astForSlice(a,b){var c,d,e,f;REQ(b,SYM.subscript);c=CHILD(b,0);d=e=f=null;if(c.type===TOK.T_DOT)return new Ellipsis;if(1===NCH(b)&&c.type===SYM.test)return new Index(astForExpr(a,c));c.type===SYM.test&&(f=astForExpr(a,c));c.type===TOK.T_COLON?1<NCH(b)&&(c=CHILD(b,1),c.type===SYM.test&&(e=astForExpr(a,c))):2<NCH(b)&&(c=CHILD(b,2),c.type===SYM.test&&(e=astForExpr(a,c)));c=CHILD(b,NCH(b)-1);c.type===SYM.sliceop&&(1===NCH(c)?(c=CHILD(c,0),d=new Name(strobj("None"),Load,c.lineno,c.col_offset)):
+(c=CHILD(c,1),c.type===SYM.test&&(d=astForExpr(a,c))));return new Slice(f,e,d)}
+function astForAtom(a,b){var c,d,e,f=CHILD(b,0);switch(f.type){case TOK.T_NAME:return new Name(strobj(f.value),Load,b.lineno,b.col_offset);case TOK.T_STRING:return new Str(parsestrplus(a,b),b.lineno,b.col_offset);case TOK.T_NUMBER:return new Num(parsenumber(a,f.value,b.lineno),b.lineno,b.col_offset);case TOK.T_LPAR:return f=CHILD(b,1),f.type===TOK.T_RPAR?new Tuple([],Load,b.lineno,b.col_offset):f.type===SYM.yield_expr?astForExpr(a,f):astForTestlistComp(a,f);case TOK.T_LSQB:f=CHILD(b,1);if(f.type===
+TOK.T_RSQB)return new List([],Load,b.lineno,b.col_offset);REQ(f,SYM.listmaker);return 1===NCH(f)||CHILD(f,1).type===TOK.T_COMMA?new List(seqForTestlist(a,f),Load,b.lineno,b.col_offset):astForListcomp(a,f);case TOK.T_LBRACE:e=[];d=[];f=CHILD(b,1);if(b.type===TOK.T_RBRACE)return new Dict([],null,b.lineno,b.col_offset);if(1===NCH(f)||0!==NCH(f)&&CHILD(f,1).type===TOK.T_COMMA){d=[];NCH(f);for(c=0;c<NCH(f);c+=2)e=astForExpr(a,CHILD(f,c)),d[c/2]=e;return new Set(d,b.lineno,b.col_offset)}if(0!==NCH(f)&&
+CHILD(f,1).type==SYM.comp_for)return astForSetComp(a,f);if(3<NCH(f)&&CHILD(f,3).type===SYM.comp_for)return astForDictComp(a,f);NCH(f);for(c=0;c<NCH(f);c+=4)e[c/4]=astForExpr(a,CHILD(f,c)),d[c/4]=astForExpr(a,CHILD(f,c+2));return new Dict(e,d,b.lineno,b.col_offset);case TOK.T_BACKQUOTE:return new Repr(astForTestlist(a,CHILD(b,1)),b.lineno,b.col_offset);default:goog.asserts.fail("unhandled atom",f.type)}}
+function astForPower(a,b){var c,d,e;REQ(b,SYM.power);e=astForAtom(a,CHILD(b,0));if(1===NCH(b))return e;for(c=1;c<NCH(b);++c){d=CHILD(b,c);if(d.type!==SYM.trailer)break;d=astForTrailer(a,d,e);d.lineno=e.lineno;d.col_offset=e.col_offset;e=d}CHILD(b,NCH(b)-1).type===SYM.factor&&(c=astForExpr(a,CHILD(b,NCH(b)-1)),e=new BinOp(e,Pow,c,b.lineno,b.col_offset));return e}
+function astForExpr(a,b){var c,d,e;a:for(;;){switch(b.type){case SYM.test:case SYM.old_test:if(CHILD(b,0).type===SYM.lambdef||CHILD(b,0).type===SYM.old_lambdef)return astForLambdef(a,CHILD(b,0));if(1<NCH(b))return astForIfexpr(a,b);case SYM.or_test:case SYM.and_test:if(1===NCH(b)){b=CHILD(b,0);continue a}d=[];for(c=0;c<NCH(b);c+=2)d[c/2]=astForExpr(a,CHILD(b,c));if("and"===CHILD(b,1).value)return new BoolOp(And,d,b.lineno,b.col_offset);goog.asserts.assert("or"===CHILD(b,1).value);return new BoolOp(Or,
+d,b.lineno,b.col_offset);case SYM.not_test:if(1===NCH(b)){b=CHILD(b,0);continue a}else return new UnaryOp(Not,astForExpr(a,CHILD(b,1)),b.lineno,b.col_offset);case SYM.comparison:if(1===NCH(b)){b=CHILD(b,0);continue a}else{e=[];d=[];for(c=1;c<NCH(b);c+=2)e[(c-1)/2]=astForCompOp(a,CHILD(b,c)),d[(c-1)/2]=astForExpr(a,CHILD(b,c+1));return new Compare(astForExpr(a,CHILD(b,0)),e,d,b.lineno,b.col_offset)}case SYM.expr:case SYM.xor_expr:case SYM.and_expr:case SYM.shift_expr:case SYM.arith_expr:case SYM.term:if(1===
+NCH(b)){b=CHILD(b,0);continue a}return astForBinop(a,b);case SYM.yield_expr:return c=null,2===NCH(b)&&(c=astForTestlist(a,CHILD(b,1))),new Yield(c,b.lineno,b.col_offset);case SYM.factor:if(1===NCH(b)){b=CHILD(b,0);continue a}return astForFactor(a,b);case SYM.power:return astForPower(a,b);default:goog.asserts.fail("unhandled expr","n.type: %d",b.type)}break}}
+function astForPrintStmt(a,b){var c,d,e;c=1;var f=null;REQ(b,SYM.print_stmt);2<=NCH(b)&&CHILD(b,1).type===TOK.T_RIGHTSHIFT&&(f=astForExpr(a,CHILD(b,2)),c=4);e=[];for(d=0;c<NCH(b);c+=2,++d)e[d]=astForExpr(a,CHILD(b,c));c=CHILD(b,NCH(b)-1).type===TOK.T_COMMA?!1:!0;return new Print(f,e,c,b.lineno,b.col_offset)}
+function astForStmt(a,b){var c;b.type===SYM.stmt&&(goog.asserts.assert(1===NCH(b)),b=CHILD(b,0));b.type===SYM.simple_stmt&&(goog.asserts.assert(1===numStmts(b)),b=CHILD(b,0));if(b.type===SYM.small_stmt)switch(REQ(b,SYM.small_stmt),b=CHILD(b,0),b.type){case SYM.expr_stmt:return astForExprStmt(a,b);case SYM.print_stmt:return astForPrintStmt(a,b);case SYM.del_stmt:return astForDelStmt(a,b);case SYM.pass_stmt:return new Pass(b.lineno,b.col_offset);case SYM.flow_stmt:return astForFlowStmt(a,b);case SYM.import_stmt:return astForImportStmt(a,
+b);case SYM.global_stmt:return astForGlobalStmt(a,b);case SYM.exec_stmt:return astForExecStmt(a,b);case SYM.assert_stmt:return astForAssertStmt(a,b);case SYM.debugger_stmt:return new Debugger_(b.lineno,b.col_offset);default:goog.asserts.fail("unhandled small_stmt")}else switch(c=CHILD(b,0),REQ(b,SYM.compound_stmt),c.type){case SYM.if_stmt:return astForIfStmt(a,c);case SYM.while_stmt:return astForWhileStmt(a,c);case SYM.for_stmt:return astForForStmt(a,c);case SYM.try_stmt:return astForTryStmt(a,c);
+case SYM.with_stmt:return astForWithStmt(a,c);case SYM.funcdef:return astForFuncdef(a,c,[]);case SYM.classdef:return astForClassdef(a,c,[]);case SYM.decorated:return astForDecorated(a,c);default:goog.asserts.assert("unhandled compound_stmt")}}
+Sk.astFromParse=function(a,b,c){var d,e,f=new Compiling("utf-8",b,c),g=[],h=0;switch(a.type){case SYM.file_input:for(e=0;e<NCH(a)-1;++e)if(d=CHILD(a,e),a.type!==TOK.T_NEWLINE)if(REQ(d,SYM.stmt),c=numStmts(d),1===c)g[h++]=astForStmt(f,d);else for(d=CHILD(d,0),REQ(d,SYM.simple_stmt),b=0;b<c;++b)g[h++]=astForStmt(f,CHILD(d,2*b));return new Module(g);case SYM.eval_input:goog.asserts.fail("todo;");case SYM.single_input:goog.asserts.fail("todo;");default:goog.asserts.fail("todo;")}};
+Sk.astDump=function(a){var b=function(a){var b,c="";for(b=0;b<a;++b)c+=" ";return c},c=function(a,e){var f,g,h,k,l,m;if(null===a)return e+"None";if(a.prototype&&void 0!==a.prototype._astname&&a.prototype._isenum)return e+a.prototype._astname+"()";if(void 0!==a._astname){h=b(a._astname.length+1);g=[];for(f=0;f<a._fields.length;f+=2)m=a._fields[f],l=a._fields[f+1](a),k=b(m.length+1),g.push([m,c(l,e+h+k)]);l=[];for(f=0;f<g.length;++f)k=g[f],l.push(k[0]+"="+k[1].replace(/^\s+/,""));f=l.join(",\n"+e+h);
+return e+a._astname+"("+f+")"}if(goog.isArrayLike(a)){h=[];for(f=0;f<a.length;++f)g=a[f],h.push(c(g,e+" "));f=h.join(",\n");return e+"["+f.replace(/^\s+/,"")+"]"}f=!0===a?"True":!1===a?"False":a instanceof Sk.builtin.lng?a.tp$str().v:a instanceof Sk.builtin.str?a.$r().v:""+a;return e+f};return c(a,"")};goog.exportSymbol("Sk.astFromParse",Sk.astFromParse);goog.exportSymbol("Sk.astDump",Sk.astDump);var DEF_GLOBAL=1,DEF_LOCAL=2,DEF_PARAM=4,USE=8,DEF_STAR=16,DEF_DOUBLESTAR=32,DEF_INTUPLE=64,DEF_FREE=128,DEF_FREE_GLOBAL=256,DEF_FREE_CLASS=512,DEF_IMPORT=1024,DEF_BOUND=DEF_LOCAL|DEF_PARAM|DEF_IMPORT,SCOPE_OFF=11,SCOPE_MASK=7,LOCAL=1,GLOBAL_EXPLICIT=2,GLOBAL_IMPLICIT=3,FREE=4,CELL=5,OPT_IMPORT_STAR=1,OPT_EXEC=2,OPT_BARE_EXEC=4,OPT_TOPLEVEL=8,GENERATOR=2,GENERATOR_EXPRESSION=2,ModuleBlock="module",FunctionBlock="function",ClassBlock="class";
+function Symbol(a,b,c){this.__name=a;this.__flags=b;this.__scope=b>>SCOPE_OFF&SCOPE_MASK;this.__namespaces=c||[]}Symbol.prototype.get_name=function(){return this.__name};Symbol.prototype.is_referenced=function(){return!!(this.__flags&USE)};Symbol.prototype.is_parameter=function(){return!!(this.__flags&DEF_PARAM)};Symbol.prototype.is_global=function(){return this.__scope===GLOBAL_IMPLICIT||this.__scope==GLOBAL_EXPLICIT};Symbol.prototype.is_declared_global=function(){return this.__scope==GLOBAL_EXPLICIT};
+Symbol.prototype.is_local=function(){return!!(this.__flags&DEF_BOUND)};Symbol.prototype.is_free=function(){return this.__scope==FREE};Symbol.prototype.is_imported=function(){return!!(this.__flags&DEF_IMPORT)};Symbol.prototype.is_assigned=function(){return!!(this.__flags&DEF_LOCAL)};Symbol.prototype.is_namespace=function(){return this.__namespaces&&0<this.__namespaces.length};Symbol.prototype.get_namespaces=function(){return this.__namespaces};var astScopeCounter=0;
+function SymbolTableScope(a,b,c,d,e){this.symFlags={};this.name=b;this.varnames=[];this.children=[];this.blockType=c;this.returnsValue=this.varkeywords=this.varargs=this.generator=this.childHasFree=this.hasFree=this.isNested=!1;this.lineno=e;this.table=a;a.cur&&(a.cur.nested||a.cur.blockType===FunctionBlock)&&(this.isNested=!0);d.scopeId=astScopeCounter++;a.stss[d.scopeId]=this;this.symbols={}}SymbolTableScope.prototype.get_type=function(){return this.blockType};
+SymbolTableScope.prototype.get_name=function(){return this.name};SymbolTableScope.prototype.get_lineno=function(){return this.lineno};SymbolTableScope.prototype.is_nested=function(){return this.isNested};SymbolTableScope.prototype.has_children=function(){return 0<this.children.length};SymbolTableScope.prototype.get_identifiers=function(){return this._identsMatching(function(){return!0})};
+SymbolTableScope.prototype.lookup=function(a){var b,c;this.symbols.hasOwnProperty(a)?a=this.symbols[a]:(c=this.symFlags[a],b=this.__check_children(a),a=this.symbols[a]=new Symbol(a,c,b));return a};SymbolTableScope.prototype.__check_children=function(a){var b,c,d=[];for(c=0;c<this.children.length;++c)b=this.children[c],b.name===a&&d.push(b);return d};
+SymbolTableScope.prototype._identsMatching=function(a){var b,c=[];for(b in this.symFlags)this.symFlags.hasOwnProperty(b)&&a(this.symFlags[b])&&c.push(b);c.sort();return c};SymbolTableScope.prototype.get_parameters=function(){goog.asserts.assert("function"==this.get_type(),"get_parameters only valid for function scopes");this._funcParams||(this._funcParams=this._identsMatching(function(a){return a&DEF_PARAM}));return this._funcParams};
+SymbolTableScope.prototype.get_locals=function(){goog.asserts.assert("function"==this.get_type(),"get_locals only valid for function scopes");this._funcLocals||(this._funcLocals=this._identsMatching(function(a){return a&DEF_BOUND}));return this._funcLocals};
+SymbolTableScope.prototype.get_globals=function(){goog.asserts.assert("function"==this.get_type(),"get_globals only valid for function scopes");this._funcGlobals||(this._funcGlobals=this._identsMatching(function(a){a=a>>SCOPE_OFF&SCOPE_MASK;return a==GLOBAL_IMPLICIT||a==GLOBAL_EXPLICIT}));return this._funcGlobals};
+SymbolTableScope.prototype.get_frees=function(){goog.asserts.assert("function"==this.get_type(),"get_frees only valid for function scopes");this._funcFrees||(this._funcFrees=this._identsMatching(function(a){return(a>>SCOPE_OFF&SCOPE_MASK)==FREE}));return this._funcFrees};
+SymbolTableScope.prototype.get_methods=function(){var a,b;goog.asserts.assert("class"==this.get_type(),"get_methods only valid for class scopes");if(!this._classMethods){b=[];for(a=0;a<this.children.length;++a)b.push(this.children[a].name);b.sort();this._classMethods=b}return this._classMethods};SymbolTableScope.prototype.getScope=function(a){a=this.symFlags[a];return void 0===a?0:a>>SCOPE_OFF&SCOPE_MASK};
+function SymbolTable(a){this.filename=a;this.top=this.cur=null;this.stack=[];this.curClass=this.global=null;this.tmpname=0;this.stss={}}SymbolTable.prototype.getStsForAst=function(a){goog.asserts.assert(void 0!==a.scopeId,"ast wasn't added to st?");a=this.stss[a.scopeId];goog.asserts.assert(void 0!==a,"unknown sym tab entry");return a};
+SymbolTable.prototype.SEQStmt=function(a){var b,c,d;goog.asserts.assert(goog.isArrayLike(a),"SEQ: nodes isn't array? got %s",a);d=a.length;for(c=0;c<d;++c)(b=a[c])&&this.visitStmt(b)};SymbolTable.prototype.SEQExpr=function(a){var b,c,d;goog.asserts.assert(goog.isArrayLike(a),"SEQ: nodes isn't array? got %s",a);d=a.length;for(c=0;c<d;++c)(b=a[c])&&this.visitExpr(b)};
+SymbolTable.prototype.enterBlock=function(a,b,c,d){var e;a=fixReservedNames(a);e=null;this.cur&&(e=this.cur,this.stack.push(this.cur));this.cur=new SymbolTableScope(this,a,b,c,d);"top"===a&&(this.global=this.cur.symFlags);e&&e.children.push(this.cur)};SymbolTable.prototype.exitBlock=function(){this.cur=null;0<this.stack.length&&(this.cur=this.stack.pop())};
+SymbolTable.prototype.visitParams=function(a,b){var c,d;for(d=0;d<a.length;++d)if(c=a[d],c.constructor===Name)goog.asserts.assert(c.ctx===Param||c.ctx===Store&&!b),this.addDef(c.id,DEF_PARAM,c.lineno);else throw new Sk.builtin.SyntaxError("invalid expression in parameter list",this.filename);};
+SymbolTable.prototype.visitArguments=function(a,b){a.args&&this.visitParams(a.args,!0);a.vararg&&(this.addDef(a.vararg,DEF_PARAM,b),this.cur.varargs=!0);a.kwarg&&(this.addDef(a.kwarg,DEF_PARAM,b),this.cur.varkeywords=!0)};SymbolTable.prototype.newTmpname=function(a){this.addDef(new Sk.builtin.str("_["+ ++this.tmpname+"]"),DEF_LOCAL,a)};
+SymbolTable.prototype.addDef=function(a,b,c){var d,e=mangleName(this.curClass,new Sk.builtin.str(a)).v,e=fixReservedNames(e);d=this.cur.symFlags[e];if(void 0!==d){if(b&DEF_PARAM&&d&DEF_PARAM)throw new Sk.builtin.SyntaxError("duplicate argument '"+a.v+"' in function definition",this.filename,c);d|=b}else d=b;this.cur.symFlags[e]=d;b&DEF_PARAM?this.cur.varnames.push(e):b&DEF_GLOBAL&&(d=b,a=this.global[e],void 0!==a&&(d|=a),this.global[e]=d)};
+SymbolTable.prototype.visitSlice=function(a){var b;switch(a.constructor){case Slice:a.lower&&this.visitExpr(a.lower);a.upper&&this.visitExpr(a.upper);a.step&&this.visitExpr(a.step);break;case ExtSlice:for(b=0;b<a.dims.length;++b)this.visitSlice(a.dims[b]);break;case Index:this.visitExpr(a.value)}};
+SymbolTable.prototype.visitStmt=function(a){var b,c,d,e;goog.asserts.assert(void 0!==a,"visitStmt called with undefined");switch(a.constructor){case FunctionDef:this.addDef(a.name,DEF_LOCAL,a.lineno);a.args.defaults&&this.SEQExpr(a.args.defaults);a.decorator_list&&this.SEQExpr(a.decorator_list);this.enterBlock(a.name.v,FunctionBlock,a,a.lineno);this.visitArguments(a.args,a.lineno);this.SEQStmt(a.body);this.exitBlock();break;case ClassDef:this.addDef(a.name,DEF_LOCAL,a.lineno);this.SEQExpr(a.bases);
+a.decorator_list&&this.SEQExpr(a.decorator_list);this.enterBlock(a.name.v,ClassBlock,a,a.lineno);this.curClass=a.name;this.SEQStmt(a.body);this.exitBlock();break;case Return_:if(a.value&&(this.visitExpr(a.value),this.cur.returnsValue=!0,this.cur.generator))throw new Sk.builtin.SyntaxError("'return' with argument inside generator",this.filename);break;case Delete_:this.SEQExpr(a.targets);break;case Assign:this.SEQExpr(a.targets);this.visitExpr(a.value);break;case AugAssign:this.visitExpr(a.target);
+this.visitExpr(a.value);break;case Print:a.dest&&this.visitExpr(a.dest);this.SEQExpr(a.values);break;case For_:this.visitExpr(a.target);this.visitExpr(a.iter);this.SEQStmt(a.body);a.orelse&&this.SEQStmt(a.orelse);break;case While_:this.visitExpr(a.test);this.SEQStmt(a.body);a.orelse&&this.SEQStmt(a.orelse);break;case If_:this.visitExpr(a.test);this.SEQStmt(a.body);a.orelse&&this.SEQStmt(a.orelse);break;case Raise:a.type&&(this.visitExpr(a.type),a.inst&&(this.visitExpr(a.inst),a.tback&&this.visitExpr(a.tback)));
+break;case TryExcept:this.SEQStmt(a.body);this.SEQStmt(a.orelse);this.visitExcepthandlers(a.handlers);break;case TryFinally:this.SEQStmt(a.body);this.SEQStmt(a.finalbody);break;case Assert:this.visitExpr(a.test);a.msg&&this.visitExpr(a.msg);break;case Import_:case ImportFrom:this.visitAlias(a.names,a.lineno);break;case Exec:this.visitExpr(a.body);a.globals&&(this.visitExpr(a.globals),a.locals&&this.visitExpr(a.locals));break;case Global:e=a.names.length;for(d=0;d<e;++d){c=mangleName(this.curClass,
+a.names[d]).v;c=fixReservedNames(c);b=this.cur.symFlags[c];if(b&(DEF_LOCAL|USE)){if(b&DEF_LOCAL)throw new Sk.builtin.SyntaxError("name '"+c+"' is assigned to before global declaration",this.filename,a.lineno);throw new Sk.builtin.SyntaxError("name '"+c+"' is used prior to global declaration",this.filename,a.lineno);}this.addDef(new Sk.builtin.str(c),DEF_GLOBAL,a.lineno)}break;case Expr:this.visitExpr(a.value);break;case Pass:case Break_:case Debugger_:case Continue_:break;case With_:this.newTmpname(a.lineno);
+this.visitExpr(a.context_expr);a.optional_vars&&(this.newTmpname(a.lineno),this.visitExpr(a.optional_vars));this.SEQStmt(a.body);break;default:goog.asserts.fail("Unhandled type "+a.constructor.name+" in visitStmt")}};
+SymbolTable.prototype.visitExpr=function(a){var b;goog.asserts.assert(void 0!==a,"visitExpr called with undefined");switch(a.constructor){case BoolOp:this.SEQExpr(a.values);break;case BinOp:this.visitExpr(a.left);this.visitExpr(a.right);break;case UnaryOp:this.visitExpr(a.operand);break;case Lambda:this.addDef(new Sk.builtin.str("lambda"),DEF_LOCAL,a.lineno);a.args.defaults&&this.SEQExpr(a.args.defaults);this.enterBlock("lambda",FunctionBlock,a,a.lineno);this.visitArguments(a.args,a.lineno);this.visitExpr(a.body);
+this.exitBlock();break;case IfExp:this.visitExpr(a.test);this.visitExpr(a.body);this.visitExpr(a.orelse);break;case Dict:this.SEQExpr(a.keys);this.SEQExpr(a.values);break;case DictComp:case SetComp:this.visitComprehension(a.generators,0);break;case ListComp:this.newTmpname(a.lineno);this.visitExpr(a.elt);this.visitComprehension(a.generators,0);break;case GeneratorExp:this.visitGenexp(a);break;case Yield:a.value&&this.visitExpr(a.value);this.cur.generator=!0;if(this.cur.returnsValue)throw new Sk.builtin.SyntaxError("'return' with argument inside generator",
+this.filename);break;case Compare:this.visitExpr(a.left);this.SEQExpr(a.comparators);break;case Call:this.visitExpr(a.func);this.SEQExpr(a.args);for(b=0;b<a.keywords.length;++b)this.visitExpr(a.keywords[b].value);a.starargs&&this.visitExpr(a.starargs);a.kwargs&&this.visitExpr(a.kwargs);break;case Num:case Str:break;case Attribute:this.visitExpr(a.value);break;case Subscript:this.visitExpr(a.value);this.visitSlice(a.slice);break;case Name:this.addDef(a.id,a.ctx===Load?USE:DEF_LOCAL,a.lineno);break;
+case List:case Tuple:case Set:this.SEQExpr(a.elts);break;default:goog.asserts.fail("Unhandled type "+a.constructor.name+" in visitExpr")}};SymbolTable.prototype.visitComprehension=function(a,b){var c,d,e=a.length;for(d=b;d<e;++d)c=a[d],this.visitExpr(c.target),this.visitExpr(c.iter),this.SEQExpr(c.ifs)};
+SymbolTable.prototype.visitAlias=function(a,b){var c,d,e,f;for(f=0;f<a.length;++f)if(c=a[f],d=e=null===c.asname?c.name.v:c.asname.v,c=e.indexOf("."),-1!==c&&(d=e.substr(0,c)),"*"!==e)this.addDef(new Sk.builtin.str(d),DEF_IMPORT,b);else if(this.cur.blockType!==ModuleBlock)throw new Sk.builtin.SyntaxError("import * only allowed at module level",this.filename);};
+SymbolTable.prototype.visitGenexp=function(a){var b=a.generators[0];this.visitExpr(b.iter);this.enterBlock("genexpr",FunctionBlock,a,a.lineno);this.cur.generator=!0;this.addDef(new Sk.builtin.str(".0"),DEF_PARAM,a.lineno);this.visitExpr(b.target);this.SEQExpr(b.ifs);this.visitComprehension(a.generators,1);this.visitExpr(a.elt);this.exitBlock()};SymbolTable.prototype.visitExcepthandlers=function(a){var b,c;for(b=0;c=a[b];++b)c.type&&this.visitExpr(c.type),c.name&&this.visitExpr(c.name),this.SEQStmt(c.body)};
+function _dictUpdate(a,b){for(var c in b)a[c]=b[c]}
+SymbolTable.prototype.analyzeBlock=function(a,b,c,d){var e,f,g;g={};var h={},k={},l={},m={};a.blockType==ClassBlock&&(_dictUpdate(k,d),b&&_dictUpdate(l,b));for(f in a.symFlags)e=a.symFlags[f],this.analyzeName(a,h,f,e,b,g,c,d);a.blockType!==ClassBlock&&(a.blockType===FunctionBlock&&_dictUpdate(l,g),b&&_dictUpdate(l,b),_dictUpdate(k,d));g={};f=a.children.length;for(e=0;e<f;++e)if(d=a.children[e],this.analyzeChildBlock(d,l,m,k,g),d.hasFree||d.childHasFree)a.childHasFree=!0;_dictUpdate(m,g);a.blockType===
+FunctionBlock&&this.analyzeCells(h,m);this.updateSymbols(a.symFlags,h,b,m,a.blockType===ClassBlock);_dictUpdate(c,m)};SymbolTable.prototype.analyzeChildBlock=function(a,b,c,d,e){var f={};_dictUpdate(f,b);b={};_dictUpdate(b,c);c={};_dictUpdate(c,d);this.analyzeBlock(a,f,b,c);_dictUpdate(e,b)};SymbolTable.prototype.analyzeCells=function(a,b){var c,d;for(d in a)c=a[d],c===LOCAL&&void 0!==b[d]&&(a[d]=CELL,delete b[d])};
+SymbolTable.prototype.updateSymbols=function(a,b,c,d,e){var f,g,h;for(h in a)g=a[h],f=b[h],g|=f<<SCOPE_OFF,a[h]=g;b=FREE<<SCOPE_OFF;for(h in d)d=a[h],void 0!==d?e&&d&(DEF_BOUND|DEF_GLOBAL)&&(d|=DEF_FREE_CLASS,a[h]=d):void 0!==c[h]&&(a[h]=b)};
+SymbolTable.prototype.analyzeName=function(a,b,c,d,e,f,g,h){if(d&DEF_GLOBAL){if(d&DEF_PARAM)throw new Sk.builtin.SyntaxError("name '"+c+"' is local and global",this.filename,a.lineno);b[c]=GLOBAL_EXPLICIT;h[c]=null;e&&void 0!==e[c]&&delete e[c]}else d&DEF_BOUND?(b[c]=LOCAL,f[c]=null,delete h[c]):e&&void 0!==e[c]?(b[c]=FREE,a.hasFree=!0,g[c]=null):(h&&void 0!==h[c]||!a.isNested||(a.hasFree=!0),b[c]=GLOBAL_IMPLICIT)};SymbolTable.prototype.analyze=function(){this.analyzeBlock(this.top,null,{},{})};
+Sk.symboltable=function(a,b){var c,d=new SymbolTable(b);d.enterBlock("top",ModuleBlock,a,0);d.top=d.cur;for(c=0;c<a.body.length;++c)d.visitStmt(a.body[c]);d.exitBlock();d.analyze();return d};
+Sk.dumpSymtab=function(a){var b=function(a){return a?"True":"False"},c=function(a){var b,c=[];for(b=0;b<a.length;++b)c.push((new Sk.builtin.str(a[b])).$r().v);return"["+c.join(", ")+"]"},d=function(a,f){var g,h,k,l,m,p,n,r,q;void 0===f&&(f="");q=""+(f+"Sym_type: "+a.get_type()+"\n");q+=f+"Sym_name: "+a.get_name()+"\n";q+=f+"Sym_lineno: "+a.get_lineno()+"\n";q+=f+"Sym_nested: "+b(a.is_nested())+"\n";q+=f+"Sym_haschildren: "+b(a.has_children())+"\n";"class"===a.get_type()?q+=f+"Class_methods: "+c(a.get_methods())+
+"\n":"function"===a.get_type()&&(q+=f+"Func_params: "+c(a.get_parameters())+"\n",q+=f+"Func_locals: "+c(a.get_locals())+"\n",q+=f+"Func_globals: "+c(a.get_globals())+"\n",q+=f+"Func_frees: "+c(a.get_frees())+"\n");q+=f+"-- Identifiers --\n";r=a.get_identifiers();n=r.length;for(p=0;p<n;++p){g=a.lookup(r[p]);q+=f+"name: "+g.get_name()+"\n";q+=f+" is_referenced: "+b(g.is_referenced())+"\n";q+=f+" is_imported: "+b(g.is_imported())+"\n";q+=f+" is_parameter: "+b(g.is_parameter())+"\n";q+=f+" is_global: "+
+b(g.is_global())+"\n";q+=f+" is_declared_global: "+b(g.is_declared_global())+"\n";q+=f+" is_local: "+b(g.is_local())+"\n";q+=f+" is_free: "+b(g.is_free())+"\n";q+=f+" is_assigned: "+b(g.is_assigned())+"\n";q+=f+" is_namespace: "+b(g.is_namespace())+"\n";m=g.get_namespaces();l=m.length;q+=f+" namespaces: [\n";k=[];for(h=0;h<l;++h)g=m[h],k.push(d(g,f+" "));q+=k.join("\n");q+=f+" ]\n"}return q};return d(a.top,"")};goog.exportSymbol("Sk.symboltable",Sk.symboltable);
+goog.exportSymbol("Sk.dumpSymtab",Sk.dumpSymtab);var out;Sk.gensymcount=0;function Compiler(a,b,c,d,e){this.filename=a;this.st=b;this.flags=c;this.canSuspend=d;this.interactive=!1;this.nestlevel=0;this.u=null;this.stack=[];this.result=[];this.allUnits=[];this.source=e?e.split("\n"):!1}
+function CompilerUnit(){this.name=this.ste=null;this.doesSuspend=this.canSuspend=!1;this.private_=null;this.lineno=this.firstlineno=0;this.linenoSet=!1;this.localnames=[];this.localtemps=[];this.tempsToSave=[];this.blocknum=0;this.blocks=[];this.curblock=0;this.scopename=null;this.suffixCode=this.switchCode=this.varDeclsCode=this.prefixCode="";this.breakBlocks=[];this.continueBlocks=[];this.exceptBlocks=[];this.finallyBlocks=[]}
+CompilerUnit.prototype.activateScope=function(){var a=this;out=function(){var b,c=a.blocks[a.curblock];if(null===c._next)for(b=0;b<arguments.length;++b)c.push(arguments[b])}};Compiler.prototype.getSourceLine=function(a){goog.asserts.assert(this.source);return this.source[a-1]};
+Compiler.prototype.annotateSource=function(a){var b,c;if(this.source){c=a.lineno;b=a.col_offset;out("\n//\n// line ",c,":\n// ",this.getSourceLine(c),"\n// ");for(a=0;a<b;++a)out(" ");out("^\n//\n");out("currLineNo = ",c,";\ncurrColNo = ",b,";\n\n")}};Compiler.prototype.gensym=function(a){a="$"+(a||"");return a+=Sk.gensymcount++};Compiler.prototype.niceName=function(a){return this.gensym(a.replace("<","").replace(">","").replace(" ","_"))};
+var reservedWords_={"abstract":!0,as:!0,"boolean":!0,"break":!0,"byte":!0,"case":!0,"catch":!0,"char":!0,"class":!0,"continue":!0,"const":!0,"debugger":!0,"default":!0,"delete":!0,"do":!0,"double":!0,"else":!0,"enum":!0,"export":!0,"extends":!0,"false":!0,"final":!0,"finally":!0,"float":!0,"for":!0,"function":!0,"goto":!0,"if":!0,"implements":!0,"import":!0,"in":!0,"instanceof":!0,"int":!0,"interface":!0,is:!0,"long":!0,namespace:!0,"native":!0,"new":!0,"null":!0,"package":!0,"private":!0,"protected":!0,
+"public":!0,"return":!0,"short":!0,"static":!0,"super":!1,"switch":!0,"synchronized":!0,"this":!0,"throw":!0,"throws":!0,"transient":!0,"true":!0,"try":!0,"typeof":!0,use:!0,"var":!0,"void":!0,"volatile":!0,"while":!0,"with":!0};function fixReservedWords(a){return!0!==reservedWords_[a]?a:a+"_$rw$"}
+var reservedNames_={__defineGetter__:!0,__defineSetter__:!0,apply:!0,call:!0,eval:!0,hasOwnProperty:!0,isPrototypeOf:!0,__lookupGetter__:!0,__lookupSetter__:!0,__noSuchMethod__:!0,propertyIsEnumerable:!0,toSource:!0,toLocaleString:!0,toString:!0,unwatch:!0,valueOf:!0,watch:!0,length:!0};function fixReservedNames(a){return reservedNames_[a]?a+"_$rn$":a}
+function mangleName(a,b){var c=b.v,d=null;if(null===a||(null===c||"_"!==c.charAt(0)||"_"!==c.charAt(1))||"_"===c.charAt(c.length-1)&&"_"===c.charAt(c.length-2))return b;d=a.v;d.replace(/_/g,"");if(""===d)return b;d=a.v;d.replace(/^_*/,"");return d=new Sk.builtin.str("_"+d+c)}Compiler.prototype._gr=function(a,b){var c,d=this.gensym(a);this.u.localtemps.push(d);out("var ",d,"=");for(c=1;c<arguments.length;++c)out(arguments[c]);out(";");return d};
+Compiler.prototype.outputInterruptTest=function(){var a="";if(null!==Sk.execLimit||null!==Sk.yieldLimit&&this.u.canSuspend)a+="var $dateNow = Date.now();",null!==Sk.execLimit&&(a+="if ($dateNow - Sk.execStart > Sk.execLimit) {throw new Sk.builtin.TimeLimitError(Sk.timeoutMsg())}"),null!==Sk.yieldLimit&&this.u.canSuspend&&(a=a+"if ($dateNow - Sk.lastYield > Sk.yieldLimit) {"+("var $susp = $saveSuspension({data: {type: 'Sk.yield'}, resume: function() {}}, '"+this.filename+"',currLineNo,currColNo);"),
+a+="$susp.$blk = $blk;",a+="$susp.optional = true;",a+="return $susp;",a+="}",this.u.doesSuspend=!0);return a};Compiler.prototype._jumpfalse=function(a,b){var c=this._gr("jfalse","(",a,"===false||!Sk.misceval.isTrue(",a,"))");out("if(",c,"){/*test failed */$blk=",b,";continue;}")};Compiler.prototype._jumpundef=function(a,b){out("if(",a,"===undefined){$blk=",b,";continue;}")};
+Compiler.prototype._jumptrue=function(a,b){var c=this._gr("jtrue","(",a,"===true||Sk.misceval.isTrue(",a,"))");out("if(",c,"){/*test passed */$blk=",b,";continue;}")};Compiler.prototype._jump=function(a){null===this.u.blocks[this.u.curblock]._next&&(out("$blk=",a,";"),this.u.blocks[this.u.curblock]._next=a)};
+Compiler.prototype._checkSuspension=function(a){var b;this.u.canSuspend?(b=this.newBlock("function return or resume suspension"),this._jump(b),this.setBlock(b),a=a||{lineno:"currLineNo",col_offset:"currColNo"},out("if ($ret && $ret.isSuspension) { return $saveSuspension($ret,'"+this.filename+"',"+a.lineno+","+a.col_offset+"); }"),this.u.doesSuspend=!0,this.u.tempsToSave=this.u.tempsToSave.concat(this.u.localtemps)):out("if ($ret && $ret.isSuspension) { $ret = Sk.misceval.retryOptionalSuspensionOrThrow($ret); }")};
+Compiler.prototype.ctuplelistorset=function(a,b,c){var d;goog.asserts.assert("tuple"===c||"list"===c||"set"===c);if(a.ctx===Store)for(d=this._gr("items","Sk.abstr.sequenceUnpack("+b+","+a.elts.length+")"),b=0;b<a.elts.length;++b)this.vexpr(a.elts[b],d+"["+b+"]");else if(a.ctx===Load||"set"===c){d=[];for(b=0;b<a.elts.length;++b)d.push(this._gr("elem",this.vexpr(a.elts[b])));return this._gr("load"+c,"new Sk.builtins['",c,"']([",d,"])")}};
+Compiler.prototype.cdict=function(a){var b,c,d;goog.asserts.assert(a.values.length===a.keys.length);d=[];for(c=0;c<a.values.length;++c)b=this.vexpr(a.values[c]),d.push(this.vexpr(a.keys[c])),d.push(b);return this._gr("loaddict","new Sk.builtins['dict']([",d,"])")};Compiler.prototype.clistcomp=function(a){goog.asserts.assert(a instanceof ListComp);var b=this._gr("_compr","new Sk.builtins['list']([])");return this.ccompgen("list",b,a.generators,0,a.elt,null,a)};
+Compiler.prototype.cdictcomp=function(a){goog.asserts.assert(a instanceof DictComp);var b=this._gr("_dcompr","new Sk.builtins.dict([])");return this.ccompgen("dict",b,a.generators,0,a.value,a.key,a)};Compiler.prototype.csetcomp=function(a){goog.asserts.assert(a instanceof SetComp);var b=this._gr("_setcompr","new Sk.builtins.set([])");return this.ccompgen("set",b,a.generators,0,a.elt,null,a)};
+Compiler.prototype.ccompgen=function(a,b,c,d,e,f,g){var h=this.newBlock(a+" comp start"),k=this.newBlock(a+" comp skip"),l=this.newBlock(a+" comp anchor"),m=c[d],p=this.vexpr(m.iter),p=this._gr("iter","Sk.abstr.iter(",p,")"),n,r;this._jump(h);this.setBlock(h);out("$ret = Sk.abstr.iternext(",p,", true);");this._checkSuspension(g);p=this._gr("next","$ret");this._jumpundef(p,l);this.vexpr(m.target,p);r=m.ifs.length;for(n=0;n<r;++n)p=this.vexpr(m.ifs[n]),this._jumpfalse(p,h);++d<c.length&&this.ccompgen(a,
+b,c,d,e,f,g);d>=c.length&&(c=this.vexpr(e),"dict"===a?(a=this.vexpr(f),out(b,".mp$ass_subscript(",a,",",c,");")):"list"===a?out(b,".v.push(",c,");"):"set"===a&&out(b,".v.mp$ass_subscript(",c,", true);"),this._jump(k),this.setBlock(k));this._jump(h);this.setBlock(l);return b};
+Compiler.prototype.cyield=function(a){if(this.u.ste.blockType!==FunctionBlock)throw new SyntaxError("'yield' outside function");var b="null";a.value&&(b=this.vexpr(a.value));a=this.newBlock("after yield");out("return [/*resume*/",a,",/*ret*/",b,"];");this.setBlock(a);return"$gen.gi$sentvalue"};
+Compiler.prototype.ccompare=function(a){var b,c,d,e,f,g;goog.asserts.assert(a.ops.length===a.comparators.length);g=this.vexpr(a.left);f=a.ops.length;e=this.newBlock("done");d=this._gr("compareres","null");for(c=0;c<f;++c)b=this.vexpr(a.comparators[c]),out("$ret = Sk.builtin.bool(Sk.misceval.richCompareBool(",g,",",b,",'",a.ops[c].prototype._astname,"', true));"),this._checkSuspension(a),out(d,"=$ret;"),this._jumpfalse("$ret",e),g=b;this._jump(e);this.setBlock(e);return d};
+Compiler.prototype.ccall=function(a){var b,c,d,e=this.vexpr(a.func),f=this.vseqexpr(a.args);if(0<a.keywords.length||a.starargs||a.kwargs){c=[];for(b=0;b<a.keywords.length;++b)c.push("'"+a.keywords[b].arg.v+"'"),c.push(this.vexpr(a.keywords[b].value));d="["+c.join(",")+"]";b=c="undefined";a.starargs&&(c=this.vexpr(a.starargs));a.kwargs&&(b=this.vexpr(a.kwargs));out("$ret;");out("$ret = Sk.misceval.callOrSuspend(",e,",",b,",",c,",",d,0<f.length?",":"",f,");")}else out("$ret;"),out("$ret = Sk.misceval.callsimOrSuspend(",
+e,0<f.length?",":"",f,");");this._checkSuspension(a);return this._gr("call","$ret")};Compiler.prototype.cslice=function(a){var b,c;goog.asserts.assert(a instanceof Slice);c=a.lower?this.vexpr(a.lower):a.step?"Sk.builtin.none.none$":"new Sk.builtin.int_(0)";b=a.upper?this.vexpr(a.upper):a.step?"Sk.builtin.none.none$":"new Sk.builtin.int_(2147483647)";a=a.step?this.vexpr(a.step):"Sk.builtin.none.none$";return this._gr("slice","new Sk.builtins['slice'](",c,",",b,",",a,")")};
+Compiler.prototype.eslice=function(a){var b,c;goog.asserts.assert(a instanceof Array);c=[];for(b=0;b<a.length;b++)c.push(this.vslicesub(a[b]));return this._gr("extslice","new Sk.builtins['tuple']([",c,"])")};Compiler.prototype.vslicesub=function(a){var b;switch(a.constructor){case Index:b=this.vexpr(a.value);break;case Slice:b=this.cslice(a);break;case Ellipsis:goog.asserts.fail("todo compile.js Ellipsis;");break;case ExtSlice:b=this.eslice(a.dims);break;default:goog.asserts.fail("invalid subscript kind")}return b};
+Compiler.prototype.vslice=function(a,b,c,d){a=this.vslicesub(a);return this.chandlesubscr(b,c,a,d)};Compiler.prototype.chandlesubscr=function(a,b,c,d){if(a===Load||a===AugLoad)return out("$ret = Sk.abstr.objectGetItem(",b,",",c,", true);"),this._checkSuspension(),this._gr("lsubscr","$ret");a===Store||a===AugStore?(out("$ret = Sk.abstr.objectSetItem(",b,",",c,",",d,", true);"),this._checkSuspension()):a===Del?out("Sk.abstr.objectDelItem(",b,",",c,");"):goog.asserts.fail("handlesubscr fail")};
+Compiler.prototype.cboolop=function(a){var b,c,d,e,f,g;goog.asserts.assert(a instanceof BoolOp);g=a.op===And?this._jumpfalse:this._jumptrue;f=this.newBlock("end of boolop");e=a.values;d=e.length;for(b=0;b<d;++b)a=this.vexpr(e[b]),0===b&&(c=this._gr("boolopsucc",a)),out(c,"=",a,";"),g.call(this,a,f);this._jump(f);this.setBlock(f);return c};
+Compiler.prototype.vexpr=function(a,b,c,d){var e;a.lineno>this.u.lineno&&(this.u.lineno=a.lineno,this.u.linenoSet=!1);switch(a.constructor){case BoolOp:return this.cboolop(a);case BinOp:return this._gr("binop","Sk.abstr.numberBinOp(",this.vexpr(a.left),",",this.vexpr(a.right),",'",a.op.prototype._astname,"')");case UnaryOp:return this._gr("unaryop","Sk.abstr.numberUnaryOp(",this.vexpr(a.operand),",'",a.op.prototype._astname,"')");case Lambda:return this.clambda(a);case IfExp:return this.cifexp(a);
+case Dict:return this.cdict(a);case ListComp:return this.clistcomp(a);case DictComp:return this.cdictcomp(a);case SetComp:return this.csetcomp(a);case GeneratorExp:return this.cgenexp(a);case Yield:return this.cyield(a);case Compare:return this.ccompare(a);case Call:return b=this.ccall(a),this.annotateSource(a),b;case Num:if("number"===typeof a.n)return a.n;if(a.n instanceof Sk.builtin.int_)return"new Sk.builtin.int_("+a.n.v+")";if(a.n instanceof Sk.builtin.float_)return a=0===a.n.v&&-Infinity===
+1/a.n.v?"-0":a.n.v,"new Sk.builtin.float_("+a+")";if(a.n instanceof Sk.builtin.lng)return"Sk.longFromStr('"+a.n.tp$str().v+"')";if(a.n instanceof Sk.builtin.complex)return"new Sk.builtin.complex(new Sk.builtin.float_("+(0===a.n.real.v&&-Infinity===1/a.n.real.v?"-0":a.n.real.v)+"), new Sk.builtin.float_("+(0===a.n.imag.v&&-Infinity===1/a.n.imag.v?"-0":a.n.imag.v)+"))";goog.asserts.fail("unhandled Num type");case Str:return this._gr("str","new Sk.builtins['str'](",a.s.$r().v,")");case Attribute:a.ctx!==
+AugLoad&&a.ctx!==AugStore&&(e=this.vexpr(a.value));d=a.attr.$r().v;d=d.substring(1,d.length-1);d=mangleName(this.u.private_,new Sk.builtin.str(d)).v;d=fixReservedWords(d);d=fixReservedNames(d);switch(a.ctx){case AugLoad:return out("$ret = Sk.abstr.gattr(",c,",'",d,"', true);"),this._checkSuspension(a),this._gr("lattr","$ret");case Load:return out("$ret = Sk.abstr.gattr(",e,",'",d,"', true);"),this._checkSuspension(a),this._gr("lattr","$ret");case AugStore:out("$ret = undefined;");out("if(",b,"!==undefined){");
+out("$ret = Sk.abstr.sattr(",c,",'",d,"',",b,", true);");out("}");this._checkSuspension(a);break;case Store:out("$ret = Sk.abstr.sattr(",e,",'",d,"',",b,", true);");this._checkSuspension(a);break;case Del:goog.asserts.fail("todo Del;");break;default:goog.asserts.fail("invalid attribute expression")}break;case Subscript:switch(a.ctx){case AugLoad:return out("$ret = Sk.abstr.objectGetItem(",c,",",d,", true);"),this._checkSuspension(a),this._gr("gitem","$ret");case Load:case Store:case Del:return this.vslice(a.slice,
+a.ctx,this.vexpr(a.value),b);case AugStore:out("$ret=undefined;");out("if(",b,"!==undefined){");out("$ret=Sk.abstr.objectSetItem(",c,",",d,",",b,", true)");out("}");this._checkSuspension(a);break;default:goog.asserts.fail("invalid subscript expression")}break;case Name:return this.nameop(a.id,a.ctx,b);case List:return this.ctuplelistorset(a,b,"list");case Tuple:return this.ctuplelistorset(a,b,"tuple");case Set:return this.ctuplelistorset(a,b,"set");default:goog.asserts.fail("unhandled case in vexpr")}};
+Compiler.prototype.vseqexpr=function(a,b){var c,d;goog.asserts.assert(void 0===b||a.length===b.length);d=[];for(c=0;c<a.length;++c)d.push(this.vexpr(a[c],void 0===b?void 0:b[c]));return d};
+Compiler.prototype.caugassign=function(a){var b,c,d,e,f;goog.asserts.assert(a instanceof AugAssign);f=a.target;switch(f.constructor){case Attribute:return b=this.vexpr(f.value),f=new Attribute(f.value,f.attr,AugLoad,f.lineno,f.col_offset),e=this.vexpr(f,void 0,b),d=this.vexpr(a.value),a=this._gr("inplbinopattr","Sk.abstr.numberInplaceBinOp(",e,",",d,",'",a.op.prototype._astname,"')"),f.ctx=AugStore,this.vexpr(f,a,b);case Subscript:return b=this.vexpr(f.value),c=this.vslicesub(f.slice),f=new Subscript(f.value,
+c,AugLoad,f.lineno,f.col_offset),e=this.vexpr(f,void 0,b,c),d=this.vexpr(a.value),a=this._gr("inplbinopsubscr","Sk.abstr.numberInplaceBinOp(",e,",",d,",'",a.op.prototype._astname,"')"),f.ctx=AugStore,this.vexpr(f,a,b,c);case Name:return b=this.nameop(f.id,Load),d=this.vexpr(a.value),a=this._gr("inplbinop","Sk.abstr.numberInplaceBinOp(",b,",",d,",'",a.op.prototype._astname,"')"),this.nameop(f.id,Store,a);default:goog.asserts.fail("unhandled case in augassign")}};
+Compiler.prototype.exprConstant=function(a){switch(a.constructor){case Num:return Sk.misceval.isTrue(a.n)?1:0;case Str:return Sk.misceval.isTrue(a.s)?1:0;default:return-1}};Compiler.prototype.newBlock=function(a){var b=this.u.blocknum++;this.u.blocks[b]=[];this.u.blocks[b]._name=a||"<unnamed>";this.u.blocks[b]._next=null;return b};Compiler.prototype.setBlock=function(a){goog.asserts.assert(0<=a&&a<this.u.blocknum);this.u.curblock=a};
+Compiler.prototype.pushBreakBlock=function(a){goog.asserts.assert(0<=a&&a<this.u.blocknum);this.u.breakBlocks.push(a)};Compiler.prototype.popBreakBlock=function(){this.u.breakBlocks.pop()};Compiler.prototype.pushContinueBlock=function(a){goog.asserts.assert(0<=a&&a<this.u.blocknum);this.u.continueBlocks.push(a)};Compiler.prototype.popContinueBlock=function(){this.u.continueBlocks.pop()};Compiler.prototype.pushExceptBlock=function(a){goog.asserts.assert(0<=a&&a<this.u.blocknum);this.u.exceptBlocks.push(a)};
+Compiler.prototype.popExceptBlock=function(){this.u.exceptBlocks.pop()};Compiler.prototype.pushFinallyBlock=function(a){goog.asserts.assert(0<=a&&a<this.u.blocknum);this.u.finallyBlocks.push(a)};Compiler.prototype.popFinallyBlock=function(){this.u.finallyBlocks.pop()};Compiler.prototype.setupExcept=function(a){out("$exc.push(",a,");")};Compiler.prototype.endExcept=function(){out("$exc.pop();")};
+Compiler.prototype.outputLocals=function(a){var b,c,d,e={};for(d=0;a.argnames&&d<a.argnames.length;++d)e[a.argnames[d]]=!0;a.localnames.sort();c=[];for(d=0;d<a.localnames.length;++d)b=a.localnames[d],void 0===e[b]&&(c.push(b),e[b]=!0);return 0<c.length?"var "+c.join(",")+"; /* locals */":""};
+Compiler.prototype.outputSuspensionHelpers=function(a){var b,c,d=[],e=a.localnames.concat(a.tempsToSave),f={},g=a.ste.blockType===FunctionBlock&&a.ste.childHasFree,h="var $wakeFromSuspension = function() {var susp = "+a.scopename+".wakingSuspension; delete "+a.scopename+".wakingSuspension;$blk=susp.$blk; $loc=susp.$loc; $gbl=susp.$gbl; $exc=susp.$exc; $err=susp.$err;currLineNo=susp.lineno; currColNo=susp.colno; Sk.lastYield=Date.now();"+(g?"$cell=susp.$cell;":"");for(b=0;b<e.length;b++)c=e[b],void 0===
+f[c]&&(h+=c+"=susp.$tmps."+c+";",f[c]=!0);h+="try { $ret=susp.child.resume(); } catch(err) { if (!(err instanceof Sk.builtin.BaseException)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: currLineNo, colno: currColNo, filename: '"+this.filename+"'}); if($exc.length>0) { $err=err; $blk=$exc.pop(); } else { throw err; } }};";h+="var $saveSuspension = function(child, filename, lineno, colno) {var susp = new Sk.misceval.Suspension(); susp.child=child;susp.resume=function(){"+
+a.scopename+".wakingSuspension=susp; return "+a.scopename+"("+(a.ste.generator?"$gen":"")+"); };susp.data=susp.child.data;susp.$blk=$blk;susp.$loc=$loc;susp.$gbl=$gbl;susp.$exc=$exc;susp.$err=$err;susp.filename=filename;susp.lineno=lineno;susp.colno=colno;susp.optional=child.optional;"+(g?"susp.$cell=$cell;":"");f={};for(b=0;b<e.length;b++)c=e[b],void 0===f[c]&&(d.push('"'+c+'":'+c),f[c]=!0);return h+="susp.$tmps={"+d.join(",")+"};return susp;};"};
+Compiler.prototype.outputAllUnits=function(){var a,b,c,d,e="",f,g;for(d=0;d<this.allUnits.length;++d){c=this.allUnits[d];e+=c.prefixCode;e+=this.outputLocals(c);c.doesSuspend&&(e+=this.outputSuspensionHelpers(c));e+=c.varDeclsCode;e+=c.switchCode;b=c.blocks;g=Object.create(null);for(a=0;a<b.length;++a)if(f=a,!(f in g))for(;;)if(g[f]=!0,e+="case "+f+": /* --- "+b[f]._name+" --- */",e+=b[f].join(""),null!==b[f]._next)if(b[f]._next in g){e+="/* jump */ continue;";break}else e+="/* allowing case fallthrough */",
+f=b[f]._next;else{e+="throw new Sk.builtin.SystemError('internal error: unterminated block');";break}e+=c.suffixCode}return e};
+Compiler.prototype.cif=function(a){var b,c,d;goog.asserts.assert(a instanceof If_);b=this.exprConstant(a.test);0===b?a.orelse&&0<a.orelse.length&&this.vseqstmt(a.orelse):1===b?this.vseqstmt(a.body):(d=this.newBlock("end of if"),a.orelse&&0<a.orelse.length&&(c=this.newBlock("next branch of if")),b=this.vexpr(a.test),a.orelse&&0<a.orelse.length?(this._jumpfalse(b,c),this.vseqstmt(a.body),this._jump(d),this.setBlock(c),this.vseqstmt(a.orelse)):(this._jumpfalse(b,d),this.vseqstmt(a.body)),this._jump(d),
+this.setBlock(d))};
+Compiler.prototype.cwhile=function(a){var b,c,d,e;0===this.exprConstant(a.test)?a.orelse&&this.vseqstmt(a.orelse):(e=this.newBlock("while test"),this._jump(e),this.setBlock(e),d=this.newBlock("after while"),c=0<a.orelse.length?this.newBlock("while orelse"):null,b=this.newBlock("while body"),this.annotateSource(a),this._jumpfalse(this.vexpr(a.test),c?c:d),this._jump(b),this.pushBreakBlock(d),this.pushContinueBlock(e),this.setBlock(b),this.vseqstmt(a.body),this._jump(e),this.popContinueBlock(),this.popBreakBlock(),
+0<a.orelse.length&&(this.setBlock(c),this.vseqstmt(a.orelse),this._jump(d)),this.setBlock(d))};
+Compiler.prototype.cfor=function(a){var b,c,d=this.newBlock("for start"),e=this.newBlock("for cleanup"),f=this.newBlock("for end");this.pushBreakBlock(f);this.pushContinueBlock(d);c=this.vexpr(a.iter);this.u.ste.generator?(b="$loc."+this.gensym("iter"),out(b,"=Sk.abstr.iter(",c,");")):(b=this._gr("iter","Sk.abstr.iter(",c,")"),this.u.tempsToSave.push(b));this._jump(d);this.setBlock(d);out("$ret = Sk.abstr.iternext(",b,this.u.canSuspend?", true":", false",");");this._checkSuspension(a);b=this._gr("next",
+"$ret");this._jumpundef(b,e);this.vexpr(a.target,b);this.vseqstmt(a.body);this._jump(d);this.setBlock(e);this.popContinueBlock();this.popBreakBlock();this.vseqstmt(a.orelse);this._jump(f);this.setBlock(f)};
+Compiler.prototype.craise=function(a){var b="";a.inst?(b=this.vexpr(a.inst),out("throw ",this.vexpr(a.type),"(",b,");")):a.type?a.type.func?out("throw ",this.vexpr(a.type),";"):(a=this._gr("err",this.vexpr(a.type)),out("if(",a," instanceof Sk.builtin.type) {","throw Sk.misceval.callsim(",a,");","} else if(typeof(",a,") === 'function') {","throw ",a,"();","} else {","throw ",a,";","}")):out("throw $err;")};
+Compiler.prototype.ctryexcept=function(a){var b,c,d,e,f,g,h,k=a.handlers.length,l=[];for(h=0;h<k;++h)l.push(this.newBlock("except_"+h+"_"));g=this.newBlock("unhandled");f=this.newBlock("orelse");e=this.newBlock("end");this.setupExcept(l[0]);this.vseqstmt(a.body);this.endExcept();this._jump(f);for(h=0;h<k;++h){this.setBlock(l[h]);d=a.handlers[h];if(!d.type&&h<k-1)throw new SyntaxError("default 'except:' must be last");d.type&&(b=this.vexpr(d.type),c=h==k-1?g:l[h+1],b=this._gr("instance","$err instanceof ",
+b),this._jumpfalse(b,c));d.name&&this.vexpr(d.name,"$err");this.vseqstmt(d.body);this._jump(e)}this.setBlock(g);out("throw $err;");this.setBlock(f);this.vseqstmt(a.orelse);this._jump(e);this.setBlock(e)};Compiler.prototype.ctryfinally=function(a){out("/*todo; tryfinally*/");this.ctryexcept(a.body[0])};Compiler.prototype.cassert=function(a){var b=this.vexpr(a.test),c=this.newBlock("end");this._jumptrue(b,c);out("throw new Sk.builtin.AssertionError(",a.msg?this.vexpr(a.msg):"",");");this.setBlock(c)};
+Compiler.prototype.cimportas=function(a,b,c){a=a.v;var d=a.indexOf("."),e=c;if(-1!==d)for(a=a.substr(d+1);-1!==d;)d=a.indexOf("."),c=-1!==d?a.substr(0,d):a,e=this._gr("lattr","Sk.abstr.gattr(",e,",'",c,"')"),a=a.substr(d+1);return this.nameop(b,Store,e)};
+Compiler.prototype.cimport=function(a){var b,c,d,e,f=a.names.length;for(e=0;e<f;++e)b=a.names[e],out("$ret = Sk.builtin.__import__(",b.name.$r().v,",$gbl,$loc,[]);"),this._checkSuspension(a),d=this._gr("module","$ret"),b.asname?this.cimportas(b.name,b.asname,d):(c=b.name,b=c.v.indexOf("."),-1!==b&&(c=new Sk.builtin.str(c.v.substr(0,b))),this.nameop(c,Store,d))};
+Compiler.prototype.cfromimport=function(a){var b,c,d,e,f,g=a.names.length;b=[];for(f=0;f<g;++f)b[f]=a.names[f].name.$r().v;out("$ret = Sk.builtin.__import__(",a.module.$r().v,",$gbl,$loc,[",b,"]);");this._checkSuspension(a);e=this._gr("module","$ret");for(f=0;f<g;++f){d=a.names[f];if(0===f&&"*"===d.name.v){goog.asserts.assert(1===g);out("Sk.importStar(",e,",$loc, $gbl);");break}c=this._gr("item","Sk.abstr.gattr(",e,",",d.name.$r().v,")");b=d.name;d.asname&&(b=d.asname);this.nameop(b,Store,c)}};
+Compiler.prototype.buildcodeobj=function(a,b,c,d,e){var f,g,h,k,l,m,p,n,r=[],q=null;f=null;c&&this.vseqexpr(c);d&&d.defaults&&(r=this.vseqexpr(d.defaults));d&&d.vararg&&(q=d.vararg);d&&d.kwarg&&(f=d.kwarg);c=this.enterScope(b,a,a.lineno,this.canSuspend);a=this.u.ste.generator;n=this.u.ste.hasFree;m=this.u.ste.childHasFree;l=this.newBlock("codeobj entry");this.u.prefixCode="var "+c+"=(function "+this.niceName(b.v)+"$(";h=[];if(a){if(f)throw new SyntaxError(b.v+"(): keyword arguments in generators not supported");
+if(q)throw new SyntaxError(b.v+"(): variable number of arguments in generators not supported");h.push("$gen")}else for(f&&(h.push("$kwa"),this.u.tempsToSave.push("$kwa")),k=0;d&&k<d.args.length;++k)h.push(this.nameop(d.args[k].id,Param));n&&(h.push("$free"),this.u.tempsToSave.push("$free"));this.u.prefixCode+=h.join(",");this.u.prefixCode+="){";a&&(this.u.prefixCode+="\n// generator\n");n&&(this.u.prefixCode+="\n// has free\n");m&&(this.u.prefixCode+="\n// has cell\n");p="{}";a&&(l="$gen.gi$resumeat",
+p="$gen.gi$locals");k="";m&&(k=a?",$cell=$gen.gi$cells":",$cell={}");this.u.varDeclsCode+="var $blk="+l+",$exc=[],$loc="+p+k+",$gbl=this,$err=undefined,$ret=undefined,currLineNo=undefined,currColNo=undefined;";null!==Sk.execLimit&&(this.u.varDeclsCode+="if (typeof Sk.execStart === 'undefined') {Sk.execStart = Date.now()}");null!==Sk.yieldLimit&&this.u.canSuspend&&(this.u.varDeclsCode+="if (typeof Sk.lastYield === 'undefined') {Sk.lastYield = Date.now()}");this.u.varDeclsCode+="if ("+c+".wakingSuspension!==undefined) { $wakeFromSuspension(); } else {";
+if(0<r.length)for(m=d.args.length-r.length,k=0;k<r.length;++k)l=this.nameop(d.args[k+m].id,Param),this.u.varDeclsCode+="if("+l+"===undefined)"+l+"="+c+".$defaults["+k+"];";for(k=0;d&&k<d.args.length;++k)l=d.args[k].id,this.isCell(l)&&(this.u.varDeclsCode+="$cell."+l.v+"="+l.v+";");a||(l=d?d.args.length-r.length:0,k=q?Infinity:d?d.args.length:0,this.u.varDeclsCode+='Sk.builtin.pyCheckArgs("'+b.v+'", arguments, '+l+", "+k+", "+(f?!0:!1)+", "+n+");");q&&(h=h.length,this.u.localnames.push(q.v),this.u.varDeclsCode+=
+q.v+"=new Sk.builtins['tuple'](Array.prototype.slice.call(arguments,"+h+")); /*vararg*/");f&&(this.u.localnames.push(f.v),this.u.varDeclsCode+=f.v+"=new Sk.builtins['dict']($kwa);");this.u.varDeclsCode+="}";this.u.switchCode="while(true){try{";this.u.switchCode+=this.outputInterruptTest();this.u.switchCode+="switch($blk){";this.u.suffixCode="} }catch(err){ if (!(err instanceof Sk.builtin.BaseException)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: currLineNo, colno: currColNo, filename: '"+
+this.filename+"'}); if ($exc.length>0) { $err = err; $blk=$exc.pop(); continue; } else { throw err; }} }});";e.call(this,c);if(d&&0<d.args.length){e=[];for(k=0;k<d.args.length;++k)e.push(d.args[k].id.v);g=e.join("', '");this.u.argnames=e}this.exitScope();0<r.length&&out(c,".$defaults=[",r.join(","),"];");g&&out(c,".co_varnames=['",g,"'];");f&&out(c,".co_kwargs=1;");g="";n&&(g=",$cell",(f=this.u.ste.hasFree)&&(g+=",$free"));return a?d&&0<d.args.length?this._gr("gener","new Sk.builtins['function']((function(){var $origargs=Array.prototype.slice.call(arguments);Sk.builtin.pyCheckArgs(\"",
+b.v,'",arguments,',d.args.length-r.length,",",d.args.length,");return new Sk.builtins['generator'](",c,",$gbl,$origargs",g,");}))"):this._gr("gener","new Sk.builtins['function']((function(){Sk.builtin.pyCheckArgs(\"",b.v,"\",arguments,0,0);return new Sk.builtins['generator'](",c,",$gbl,[]",g,");}))"):this._gr("funcobj","new Sk.builtins['function'](",c,",$gbl",g,")")};
+Compiler.prototype.cfunction=function(a){var b;goog.asserts.assert(a instanceof FunctionDef);b=this.buildcodeobj(a,a.name,a.decorator_list,a.args,function(b){this.vseqstmt(a.body);out("return Sk.builtin.none.none$;")});this.nameop(a.name,Store,b)};Compiler.prototype.clambda=function(a){goog.asserts.assert(a instanceof Lambda);return this.buildcodeobj(a,new Sk.builtin.str("<lambda>"),null,a.args,function(b){b=this.vexpr(a.body);out("return ",b,";")})};
+Compiler.prototype.cifexp=function(a){var b=this.newBlock("next of ifexp"),c=this.newBlock("end of ifexp"),d=this._gr("res","null"),e=this.vexpr(a.test);this._jumpfalse(e,b);out(d,"=",this.vexpr(a.body),";");this._jump(c);this.setBlock(b);out(d,"=",this.vexpr(a.orelse),";");this._jump(c);this.setBlock(c);return d};
+Compiler.prototype.cgenexpgen=function(a,b,c){var d,e,f,g=this.newBlock("start for "+b),h=this.newBlock("skip for "+b);this.newBlock("if cleanup for "+b);var k=this.newBlock("end for "+b),l=a[b];0===b?e="$loc.$iter0":(d=this.vexpr(l.iter),e="$loc."+this.gensym("iter"),out(e,"=","Sk.abstr.iter(",d,");"));this._jump(g);this.setBlock(g);this.annotateSource(c);out("$ret = Sk.abstr.iternext(",e,this.u.canSuspend?", true":", false",");");this._checkSuspension(c);d=this._gr("next","$ret");this._jumpundef(d,
+k);this.vexpr(l.target,d);f=l.ifs.length;for(e=0;e<f;++e)this.annotateSource(l.ifs[e]),d=this.vexpr(l.ifs[e]),this._jumpfalse(d,g);++b<a.length&&this.cgenexpgen(a,b,c);b>=a.length&&(this.annotateSource(c),a=this.vexpr(c),out("return [",h,"/*resume*/,",a,"/*ret*/];"),this.setBlock(h));this._jump(g);this.setBlock(k);1===b&&out("return Sk.builtin.none.none$;")};
+Compiler.prototype.cgenexp=function(a){var b=this.buildcodeobj(a,new Sk.builtin.str("<genexpr>"),null,null,function(b){this.cgenexpgen(a.generators,0,a.elt)}),b=this._gr("gener","Sk.misceval.callsim(",b,");");out(b,".gi$locals.$iter0=Sk.abstr.iter(",this.vexpr(a.generators[0].iter),");");return b};
+Compiler.prototype.cclass=function(a){var b,c,d;goog.asserts.assert(a instanceof ClassDef);d=this.vseqexpr(a.bases);c=this.enterScope(a.name,a,a.lineno);b=this.newBlock("class entry");this.u.prefixCode="var "+c+"=(function $"+a.name.v+"$class_outer($globals,$locals,$rest){var $gbl=$globals,$loc=$locals;";this.u.switchCode+="(function $"+a.name.v+"$_closure(){";this.u.switchCode+="var $blk="+b+",$exc=[],$ret=undefined,currLineNo=undefined,currColNo=undefined;";null!==Sk.execLimit&&(this.u.switchCode+=
+"if (typeof Sk.execStart === 'undefined') {Sk.execStart = Date.now()}");null!==Sk.yieldLimit&&this.u.canSuspend&&(this.u.switchCode+="if (typeof Sk.lastYield === 'undefined') {Sk.lastYield = Date.now()}");this.u.switchCode+="while(true){try{";this.u.switchCode+=this.outputInterruptTest();this.u.switchCode+="switch($blk){";this.u.suffixCode="}}catch(err){ if (!(err instanceof Sk.builtin.BaseException)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: currLineNo, colno: currColNo, filename: '"+
+this.filename+"'}); if ($exc.length>0) { $err = err; $blk=$exc.pop(); continue; } else { throw err; }}}";this.u.suffixCode+="}).apply(null,$rest);});";this.u.private_=a.name;this.cbody(a.body);out("return;");this.exitScope();b=this._gr("built","Sk.misceval.buildClass($gbl,",c,",",a.name.$r().v,",[",d,"])");this.nameop(a.name,Store,b)};
+Compiler.prototype.ccontinue=function(a){if(0===this.u.continueBlocks.length)throw new SyntaxError("'continue' outside loop");this._jump(this.u.continueBlocks[this.u.continueBlocks.length-1])};
+Compiler.prototype.vstmt=function(a){var b,c,d;this.u.lineno=a.lineno;this.u.linenoSet=!1;this.u.localtemps=[];Sk.debugging&&this.u.canSuspend&&(b=this.newBlock("debug breakpoint for line "+a.lineno),out("if (Sk.breakpoints('"+this.filename+"',"+a.lineno+","+a.col_offset+")) {","var $susp = $saveSuspension({data: {type: 'Sk.debug'}, resume: function() {}}, '"+this.filename+"',"+a.lineno+","+a.col_offset+");","$susp.$blk = "+b+";","$susp.optional = true;","return $susp;","}"),this._jump(b),this.setBlock(b),
+this.u.doesSuspend=!0);this.annotateSource(a);switch(a.constructor){case FunctionDef:this.cfunction(a);break;case ClassDef:this.cclass(a);break;case Return_:if(this.u.ste.blockType!==FunctionBlock)throw new SyntaxError("'return' outside function");a.value?out("return ",this.vexpr(a.value),";"):out("return Sk.builtin.none.none$;");break;case Delete_:this.vseqexpr(a.targets);break;case Assign:d=a.targets.length;c=this.vexpr(a.value);for(b=0;b<d;++b)this.vexpr(a.targets[b],c);break;case AugAssign:return this.caugassign(a);
+case Print:this.cprint(a);break;case For_:return this.cfor(a);case While_:return this.cwhile(a);case If_:return this.cif(a);case Raise:return this.craise(a);case TryExcept:return this.ctryexcept(a);case TryFinally:return this.ctryfinally(a);case Assert:return this.cassert(a);case Import_:return this.cimport(a);case ImportFrom:return this.cfromimport(a);case Global:break;case Expr:this.vexpr(a.value);break;case Pass:break;case Break_:if(0===this.u.breakBlocks.length)throw new SyntaxError("'break' outside loop");
+this._jump(this.u.breakBlocks[this.u.breakBlocks.length-1]);break;case Continue_:this.ccontinue(a);break;case Debugger_:out("debugger;");break;default:goog.asserts.fail("unhandled case in vstmt")}};Compiler.prototype.vseqstmt=function(a){var b;for(b=0;b<a.length;++b)this.vstmt(a[b])};var OP_FAST=0,OP_GLOBAL=1,OP_DEREF=2,OP_NAME=3,D_NAMES=0,D_FREEVARS=1,D_CELLVARS=2;Compiler.prototype.isCell=function(a){a=mangleName(this.u.private_,a).v;return this.u.ste.getScope(a)===CELL};
+Compiler.prototype.nameop=function(a,b,c){var d,e,f,g;if((b===Store||b===AugStore||b===Del)&&"__debug__"===a.v)throw new Sk.builtin.SyntaxError("can not assign to __debug__");if((b===Store||b===AugStore||b===Del)&&"None"===a.v)throw new Sk.builtin.SyntaxError("can not assign to None");if("None"===a.v)return"Sk.builtin.none.none$";if("True"===a.v)return"Sk.builtin.bool.true$";if("False"===a.v)return"Sk.builtin.bool.false$";if("NotImplemented"===a.v)return"Sk.builtin.NotImplemented.NotImplemented$";
+g=mangleName(this.u.private_,a).v;g=fixReservedNames(g);f=OP_NAME;e=this.u.ste.getScope(g);d=null;switch(e){case FREE:d="$free";f=OP_DEREF;break;case CELL:d="$cell";f=OP_DEREF;break;case LOCAL:this.u.ste.blockType!==FunctionBlock||this.u.ste.generator||(f=OP_FAST);break;case GLOBAL_IMPLICIT:this.u.ste.blockType===FunctionBlock&&(f=OP_GLOBAL);break;case GLOBAL_EXPLICIT:f=OP_GLOBAL}g=fixReservedWords(g);goog.asserts.assert(e||"_"===a.v.charAt(1));a=g;this.u.ste.generator||this.u.ste.blockType!==FunctionBlock?
+g="$loc."+g:f!==OP_FAST&&f!==OP_NAME||this.u.localnames.push(g);switch(f){case OP_FAST:switch(b){case Load:case Param:return out("if (",g," === undefined) { throw new Sk.builtin.UnboundLocalError('local variable \\'",g,"\\' referenced before assignment'); }\n"),g;case Store:out(g,"=",c,";");break;case Del:out("delete ",g,";");break;default:goog.asserts.fail("unhandled")}break;case OP_NAME:switch(b){case Load:return this._gr("loadname",g,"!==undefined?",g,":Sk.misceval.loadname('",a,"',$gbl);");case Store:out(g,
+"=",c,";");break;case Del:out("delete ",g,";");break;case Param:return g;default:goog.asserts.fail("unhandled")}break;case OP_GLOBAL:switch(b){case Load:return this._gr("loadgbl","Sk.misceval.loadname('",a,"',$gbl)");case Store:out("$gbl.",a,"=",c,";");break;case Del:out("delete $gbl.",a);break;default:goog.asserts.fail("unhandled case in name op_global")}break;case OP_DEREF:switch(b){case Load:return d+"."+a;case Store:out(d,".",a,"=",c,";");break;case Param:return a;default:goog.asserts.fail("unhandled case in name op_deref")}break;
+default:goog.asserts.fail("unhandled case")}};Compiler.prototype.enterScope=function(a,b,c,d){var e=new CompilerUnit;e.ste=this.st.getStsForAst(b);e.name=a;e.firstlineno=c;e.canSuspend=d||!1;this.u&&this.u.private_&&(e.private_=this.u.private_);this.stack.push(this.u);this.allUnits.push(e);a=this.gensym("scope");e.scopename=a;this.u=e;this.u.activateScope();this.nestlevel++;return a};
+Compiler.prototype.exitScope=function(){var a,b=this.u;this.nestlevel--;(this.u=0<=this.stack.length-1?this.stack.pop():null)&&this.u.activateScope();"<module>"!==b.name.v&&(a=b.name.$r().v,a=a.substring(1,a.length-1),a=fixReservedWords(a),a=fixReservedNames(a),out(b.scopename,".co_name=new Sk.builtins['str']('",a,"');"))};Compiler.prototype.cbody=function(a){var b;for(b=0;b<a.length;++b)this.vstmt(a[b])};
+Compiler.prototype.cprint=function(a){var b,c;goog.asserts.assert(a instanceof Print);a.dest&&this.vexpr(a.dest);c=a.values.length;for(b=0;b<c;++b)out("Sk.misceval.print_(","new Sk.builtins['str'](",this.vexpr(a.values[b]),").v);");a.nl&&out("Sk.misceval.print_(",'"\\n");')};
+Compiler.prototype.cmod=function(a){var b=this.enterScope(new Sk.builtin.str("<module>"),a,0,this.canSuspend),c=this.newBlock("module entry");this.u.prefixCode="var "+b+"=(function($modname){";this.u.varDeclsCode="var $gbl = {}, $blk="+c+",$exc=[],$loc=$gbl,$err=undefined;$gbl.__name__=$modname;$loc.__file__=new Sk.builtins.str('"+this.filename+"');var $ret=undefined,currLineNo=undefined,currColNo=undefined;";null!==Sk.execLimit&&(this.u.varDeclsCode+="if (typeof Sk.execStart === 'undefined') {Sk.execStart = Date.now()}");
+null!==Sk.yieldLimit&&this.u.canSuspend&&(this.u.varDeclsCode+="if (typeof Sk.lastYield === 'undefined') {Sk.lastYield = Date.now()}");this.u.varDeclsCode+="if ("+b+".wakingSuspension!==undefined) { $wakeFromSuspension(); }if (Sk.retainGlobals) { if (Sk.globals) { $gbl = Sk.globals; Sk.globals = $gbl; $loc = $gbl; } else { Sk.globals = $gbl; }} else { Sk.globals = $gbl; }";this.u.switchCode="while(true){try{";this.u.switchCode+=this.outputInterruptTest();this.u.switchCode+="switch($blk){";this.u.suffixCode=
+"}";this.u.suffixCode+="}catch(err){ if (!(err instanceof Sk.builtin.BaseException)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: currLineNo, colno: currColNo, filename: '"+this.filename+"'}); if ($exc.length>0) { $err = err; $blk=$exc.pop(); continue; } else { throw err; }} } });";switch(a.constructor){case Module:this.cbody(a.body);out("return $loc;");break;default:goog.asserts.fail("todo; unhandled case in compilerMod")}this.exitScope();this.result.push(this.outputAllUnits());
+return b};Sk.compile=function(a,b,c,d){var e=Sk.parse(b,a);c=Sk.astFromParse(e.cst,b,e.flags);var e=e.flags,f=Sk.symboltable(c,b);a=new Compiler(b,f,e,d,a);b=a.cmod(c);a=a.result.join("");return{funcname:b,code:a}};goog.exportSymbol("Sk.compile",Sk.compile);Sk.resetCompiler=function(){Sk.gensymcount=0};goog.exportSymbol("Sk.resetCompiler",Sk.resetCompiler);Sk.sysmodules=new Sk.builtin.dict([]);Sk.realsyspath=void 0;Sk.externalLibraryCache={};Sk.loadExternalLibraryInternal_=function(a,b){var c,d;if(null!=a){if(Sk.externalLibraryCache[a])return Sk.externalLibraryCache[a];c=new XMLHttpRequest;c.open("GET",a,!1);c.send();if(200===c.status)return d=c.responseText,b&&(c=document.createElement("script"),c.type="text/javascript",c.text=d,document.getElementsByTagName("head")[0].appendChild(c)),d}};
+Sk.loadExternalLibrary=function(a){var b,c,d,e,f,g;if(Sk.externalLibraryCache[a])return Sk.externalLibraryCache[a];if(b=Sk.externalLibraries&&Sk.externalLibraries[a]){c="string"===typeof b?b:b.path;if("string"!==typeof c)throw new Sk.builtin.ImportError("Invalid path specified for "+a);g=b.type;g||(g=(d=c.match(/\.(js|py)$/))&&d[1]);if(!g)throw new Sk.builtin.ImportError("Invalid file extension specified for "+a);d=Sk.loadExternalLibraryInternal_(c,!1);if(!d)throw new Sk.builtin.ImportError("Failed to load remote module '"+
+a+"'");if((e=b.dependencies)&&e.length)for(b=0;b<e.length;b++)if(f=Sk.loadExternalLibraryInternal_(e[b],!0),!f)throw new Sk.builtin.ImportError("Failed to load dependencies required for "+a);c="js"===g?{funcname:"$builtinmodule",code:d}:Sk.compile(d,c,"exec",!0);return Sk.externalLibraryCache[a]=c}};
+Sk.importSearchPathForName=function(a,b,c,d,e){var f,g=[],h=a.replace(/\./g,"/"),k,l;k=Sk.realsyspath.tp$iter();for(l=k.tp$iternext();void 0!==l;l=k.tp$iternext())g.push(l.v+"/"+h+b),g.push(l.v+"/"+h+"/__init__"+b);g.push(e+"/"+h+b);g.push(e+"/"+h+"/__init__"+b);f=0;return function p(){for(var b=function y(a){var b;return a instanceof Sk.misceval.Suspension?(b=new Sk.misceval.Suspension(void 0,a),b.resume=function(){try{return y(a.resume())}catch(b){return f++,p()}},b):{filename:g[f],code:a}},e;f<
+g.length;)try{return e=Sk.read(g[f]),d||(e=Sk.misceval.retryOptionalSuspensionOrThrow(e)),b(e)}catch(h){f++}if(c)return null;throw new Sk.builtin.ImportError("No module named "+a);}()};
+Sk.doOneTimeInitialization=function(){var a,b,c;Sk.builtin.type.basesStr_=new Sk.builtin.str("__bases__");Sk.builtin.type.mroStr_=new Sk.builtin.str("__mro__");for(a in Sk.builtin)if(b=Sk.builtin[a],(b.prototype instanceof Sk.builtin.object||b===Sk.builtin.object)&&!b.sk$abstract){c=[];for(var d=void 0,d=b.tp$base;void 0!==d;d=d.tp$base)c.push(d);b.$d=new Sk.builtin.dict([]);b.$d.mp$ass_subscript(Sk.builtin.type.basesStr_,new Sk.builtin.tuple(c));b.$d.mp$ass_subscript(Sk.builtin.type.mroStr_,new Sk.builtin.tuple([b]))}a=
+Sk.builtin.object.prototype;for(c=0;c<Sk.builtin.object.pythonFunctions.length;c++){b=Sk.builtin.object.pythonFunctions[c];if(a[b]instanceof Sk.builtin.func)break;a[b]=new Sk.builtin.func(a[b])}};Sk.importSetUpPath=function(){var a,b;if(!Sk.realsyspath){b=[new Sk.builtin.str("src/builtin"),new Sk.builtin.str("src/lib"),new Sk.builtin.str(".")];for(a=0;a<Sk.syspath.length;++a)b.push(new Sk.builtin.str(Sk.syspath[a]));Sk.realsyspath=new Sk.builtin.list(b);Sk.doOneTimeInitialization()}};
+if(COMPILED)var js_beautify=function(a){return a};
+Sk.importModuleInternal_=function(a,b,c,d,e,f){var g,h,k,l,m,p,n,r,q,t,y,v;Sk.importSetUpPath();void 0===c&&(c=a);v=null;y=c.split(".");try{return p=Sk.sysmodules.mp$subscript(c),1<y.length?Sk.sysmodules.mp$subscript(y[0]):p}catch(z){}if(1<y.length&&(t=y.slice(0,y.length-1).join("."),v=Sk.importModuleInternal_(t,b,void 0,void 0,e,f),v instanceof Sk.misceval.Suspension))return function w(g){return g instanceof Sk.misceval.Suspension?new Sk.misceval.Suspension(w,g):Sk.importModuleInternal_(a,b,c,d,
+e,f)}(v);q=new Sk.builtin.module;Sk.sysmodules.mp$ass_subscript(a,q);if(d)n=a+".py",p=Sk.compile(d,n,"exec",e);else{if(Sk.onBeforeImport&&"function"===typeof Sk.onBeforeImport){p=Sk.onBeforeImport(a);if(!1===p)throw new Sk.builtin.ImportError("Importing "+a+" is not allowed");if("string"===typeof p)throw new Sk.builtin.ImportError(p);}(p=Sk.loadExternalLibrary(a))?n=Sk.externalLibraries?Sk.externalLibraries[a].path:"unknown":(p=Sk.importSearchPathForName(a,".js",!0,e,f),p=function E(b){if(b instanceof
+Sk.misceval.Suspension)return new Sk.misceval.Suspension(E,b);if(b)return n=b.filename,r?Sk.compile(b.code,b.filename,"exec",e):{funcname:"$builtinmodule",code:b.code};goog.asserts.assert(!r,"Sk.importReadFileFromPath did not throw when loading Python file failed");r=!0;return E(Sk.importSearchPathForName(a,".py",!1,e,f))}(p))}return function x(d){if(d instanceof Sk.misceval.Suspension)return e?new Sk.misceval.Suspension(x,d):Sk.misceval.retryOptionalSuspensionOrThrow(d);m=q.$js=d.code;null==n&&(n=
+d.filename);null!=Sk.dateSet&&Sk.dateSet||(m="Sk.execStart = Sk.lastYield = new Date();\n"+d.code,Sk.dateSet=!0);b&&(l=function(a){var b,c,d=js_beautify(a).split("\n");for(c=1;c<=d.length;++c){b=(""+c).length;for(a="";5>b;++b)a+=" ";d[c-1]="/* "+a+c+" */ "+d[c-1]}return d.join("\n")},m=l(m),Sk.debugout(m));k="new Sk.builtin.str('"+c+"')";m+="\n"+d.funcname+"("+k+");";h=goog.global.eval(m);return function C(b){if(b instanceof Sk.misceval.Suspension){if(e)return new Sk.misceval.Suspension(C,b);b=Sk.misceval.retryOptionalSuspensionOrThrow(b,
+'Module "'+c+'" suspended or blocked during load, and it was loaded somewhere that does not permit this')}b.__name__||(b.__name__=new Sk.builtin.str(c));b.__path__=new Sk.builtin.str(n);q.$d=b;b.__doc__||(b.__doc__=Sk.builtin.none.none$);if(Sk.onAfterImport&&"function"===typeof Sk.onAfterImport)try{Sk.onAfterImport(a)}catch(d){}return v?(g=Sk.sysmodules.mp$subscript(t),g.tp$setattr(y[y.length-1],q),v):q}(h)}(p)};Sk.importModule=function(a,b,c){return Sk.importModuleInternal_(a,b,void 0,void 0,c)};
+Sk.importMain=function(a,b,c){Sk.dateSet=!1;Sk.filesLoaded=!1;Sk.sysmodules=new Sk.builtin.dict([]);Sk.realsyspath=void 0;Sk.resetCompiler();return Sk.importModuleInternal_(a,b,"__main__",void 0,c)};Sk.importMainWithBody=function(a,b,c,d){Sk.dateSet=!1;Sk.filesLoaded=!1;Sk.sysmodules=new Sk.builtin.dict([]);Sk.realsyspath=void 0;Sk.resetCompiler();return Sk.importModuleInternal_(a,b,"__main__",c,d)};
+Sk.builtin.__import__=function(a,b,c,d){var e=Sk.globals,f=void 0===c.__file__?void 0:c.__file__.v.substring(0,c.__file__.v.lastIndexOf("/"));return function h(b){if(b instanceof Sk.misceval.Suspension)return new Sk.misceval.Suspension(h,b);e!==Sk.globals&&(Sk.globals=e);if(d&&0!==d.length){var c,m,p,n=a.split("."),n=n[n.length-1];for(c=0;c<d.length;c++)p=d[c],"*"==p||(null!=b.$d[p]||null==b.$d[n]&&b.$d.__name__.v!=n)||(m=""+a+"."+p,m=Sk.importModuleInternal_(m,void 0,void 0,void 0,!0,f),b.$d[p]=
+m)}else return b;b=Sk.sysmodules.mp$subscript(a);goog.asserts.assert(b);return b}(Sk.importModuleInternal_(a,void 0,void 0,void 0,!0,f))};Sk.importStar=function(a,b,c){var d,e=c.__name__,f=Object.getOwnPropertyNames(a.$d);for(d in f)b[f[d]]=a.$d[f[d]];c.__name__!==e&&(c.__name__=e)};goog.exportSymbol("Sk.importMain",Sk.importMain);goog.exportSymbol("Sk.importMainWithBody",Sk.importMainWithBody);goog.exportSymbol("Sk.builtin.__import__",Sk.builtin.__import__);goog.exportSymbol("Sk.importStar",Sk.importStar);Sk.builtin.timSort=function(a,b){this.list=new Sk.builtin.list(a.v);this.MIN_GALLOP=7;this.listlength=b?b:a.sq$length()};Sk.builtin.timSort.prototype.lt=function(a,b){return Sk.misceval.richCompareBool(a,b,"Lt")};Sk.builtin.timSort.prototype.le=function(a,b){return!this.lt(b,a)};Sk.builtin.timSort.prototype.setitem=function(a,b){this.list.v[a]=b};
+Sk.builtin.timSort.prototype.binary_sort=function(a,b){var c,d,e,f,g;for(g=a.base+b;g<a.base+a.len;g++){f=a.base;e=g;for(c=a.getitem(e);f<e;)d=f+(e-f>>1),this.lt(c,a.getitem(d))?e=d:f=d+1;goog.asserts.assert(f===e);for(d=g;d>f;d--)a.setitem(d,a.getitem(d-1));a.setitem(f,c)}};
+Sk.builtin.timSort.prototype.count_run=function(a){var b,c,d;if(1>=a.len)b=a.len,d=!1;else if(b=2,this.lt(a.getitem(a.base+1),a.getitem(a.base)))for(d=!0,c=a.base+2;c<a.base+a.len;c++)if(this.lt(a.getitem(c),a.getitem(c-1)))b++;else break;else for(d=!1,c=a.base+2;c<a.base+a.len&&!this.lt(a.getitem(c),a.getitem(c-1));c++)b++;return{run:new Sk.builtin.listSlice(a.list,a.base,b),descending:d}};
+Sk.builtin.timSort.prototype.sort=function(){var a,b,c,d=new Sk.builtin.listSlice(this.list,0,this.listlength);if(!(2>d.len)){this.merge_init();for(a=this.merge_compute_minrun(d.len);0<d.len;)b=this.count_run(d),b.descending&&b.run.reverse(),b.run.len<a&&(c=b.run.len,b.run.len=a<d.len?a:d.len,this.binary_sort(b.run,c)),d.advance(b.run.len),this.pending.push(b.run),this.merge_collapse();goog.asserts.assert(d.base==this.listlength);this.merge_force_collapse();goog.asserts.assert(1==this.pending.length);
+goog.asserts.assert(0===this.pending[0].base);goog.asserts.assert(this.pending[0].len==this.listlength)}};
+Sk.builtin.timSort.prototype.gallop=function(a,b,c,d){var e,f,g,h,k;goog.asserts.assert(0<=c&&c<b.len);e=this;d=d?function(a,b){return e.le(a,b)}:function(a,b){return e.lt(a,b)};f=b.base+c;g=0;h=1;if(d(b.getitem(f),a)){for(k=b.len-c;h<k;)if(d(b.getitem(f+h),a)){g=h;try{h=(h<<1)+1}catch(l){h=k}}else break;h>k&&(h=k);g+=c;h+=c}else{for(k=c+1;h<k&&!d(b.getitem(f-h),a);){g=h;try{h=(h<<1)+1}catch(m){h=k}}h>k&&(h=k);f=c-g;g=c-h;h=f}goog.asserts.assert(-1<=g<h<=b.len);for(g+=1;g<h;)c=g+(h-g>>1),d(b.getitem(b.base+
+c),a)?g=c+1:h=c;goog.asserts.assert(g==h);return h};Sk.builtin.timSort.prototype.merge_init=function(){this.min_gallop=this.MIN_GALLOP;this.pending=[]};
+Sk.builtin.timSort.prototype.merge_lo=function(a,b){var c,d,e,f,g;goog.asserts.assert(0<a.len&&0<b.len&&a.base+a.len==b.base);c=this.min_gallop;d=a.base;a=a.copyitems();try{if(this.setitem(d,b.popleft()),d++,1!=a.len&&0!==b.len)for(;;){for(f=e=0;;)if(this.lt(b.getitem(b.base),a.getitem(a.base))){this.setitem(d,b.popleft());d++;if(0===b.len)return;f++;e=0;if(f>=c)break}else{this.setitem(d,a.popleft());d++;if(1==a.len)return;e++;f=0;if(e>=c)break}for(c+=1;;){this.min_gallop=c-=1<c;e=this.gallop(b.getitem(b.base),
+a,0,!0);for(g=a.base;g<a.base+e;g++)this.setitem(d,a.getitem(g)),d++;a.advance(e);if(1>=a.len)return;this.setitem(d,b.popleft());d++;if(0===b.len)return;f=this.gallop(a.getitem(a.base),b,0,!1);for(g=b.base;g<b.base+f;g++)this.setitem(d,b.getitem(g)),d++;b.advance(f);if(0===b.len)return;this.setitem(d,a.popleft());d++;if(1==a.len)return;if(e<this.MIN_GALLOP&&f<this.MIN_GALLOP)break;c++;this.min_gallop=c}}}finally{goog.asserts.assert(0<=a.len&&0<=b.len);for(g=b.base;g<b.base+b.len;g++)this.setitem(d,
+b.getitem(g)),d++;for(g=a.base;g<a.base+a.len;g++)this.setitem(d,a.getitem(g)),d++}};
+Sk.builtin.timSort.prototype.merge_hi=function(a,b){var c,d,e,f,g,h,k,l;goog.asserts.assert(0<a.len&&0<b.len&&a.base+a.len==b.base);c=this.min_gallop;d=b.base+b.len;b=b.copyitems();try{if(d--,this.setitem(d,a.popright()),0!==a.len&&1!=b.len)for(;;){for(f=e=0;;)if(g=a.getitem(a.base+a.len-1),h=b.getitem(b.base+b.len-1),this.lt(h,g)){d--;this.setitem(d,g);a.len--;if(0===a.len)return;e++;f=0;if(e>=c)break}else{d--;this.setitem(d,h);b.len--;if(1==b.len)return;f++;e=0;if(f>=c)break}for(c+=1;;){this.min_gallop=
+c-=1<c;h=b.getitem(b.base+b.len-1);k=this.gallop(h,a,a.len-1,!0);e=a.len-k;for(l=a.base+a.len-1;l>a.base+k-1;l--)d--,this.setitem(d,a.getitem(l));a.len-=e;if(0===a.len)return;d--;this.setitem(d,b.popright());if(1==b.len)return;g=a.getitem(a.base+a.len-1);k=this.gallop(g,b,b.len-1,!1);f=b.len-k;for(l=b.base+b.len-1;l>b.base+k-1;l--)d--,this.setitem(d,b.getitem(l));b.len-=f;if(1>=b.len)return;d--;this.setitem(d,a.popright());if(0===a.len)return;if(e<this.MIN_GALLOP&&f<this.MIN_GALLOP)break;c++;this.min_gallop=
+c}}}finally{goog.asserts.assert(0<=a.len&&0<=b.len);for(l=a.base+a.len-1;l>a.base-1;l--)d--,this.setitem(d,a.getitem(l));for(l=b.base+b.len-1;l>b.base-1;l--)d--,this.setitem(d,b.getitem(l))}};
+Sk.builtin.timSort.prototype.merge_at=function(a){var b,c;0>a&&(a=this.pending.length+a);b=this.pending[a];c=this.pending[a+1];goog.asserts.assert(0<b.len&&0<c.len);goog.asserts.assert(b.base+b.len==c.base);this.pending[a]=new Sk.builtin.listSlice(this.list,b.base,b.len+c.len);this.pending.splice(a+1,1);a=this.gallop(c.getitem(c.base),b,0,!0);b.advance(a);0!==b.len&&(c.len=this.gallop(b.getitem(b.base+b.len-1),c,c.len-1,!1),0!==c.len&&(b.len<=c.len?this.merge_lo(b,c):this.merge_hi(b,c)))};
+Sk.builtin.timSort.prototype.merge_collapse=function(){for(var a=this.pending;1<a.length;)if(3<=a.length&&a[a.length-3].len<=a[a.length-2].len+a[a.length-1].len)a[a.length-3].len<a[a.length-1].len?this.merge_at(-3):this.merge_at(-2);else if(a[a.length-2].len<=a[a.length-1].len)this.merge_at(-2);else break};Sk.builtin.timSort.prototype.merge_force_collapse=function(){for(var a=this.pending;1<a.length;)3<=a.length&&a[a.length-3].len<a[a.length-1].len?this.merge_at(-3):this.merge_at(-2)};
+Sk.builtin.timSort.prototype.merge_compute_minrun=function(a){for(var b=0;64<=a;)b|=a&1,a>>=1;return a+b};Sk.builtin.listSlice=function(a,b,c){this.list=a;this.base=b;this.len=c};Sk.builtin.listSlice.prototype.copyitems=function(){var a=this.base,b=this.base+this.len;goog.asserts.assert(0<=a<=b);return new Sk.builtin.listSlice(new Sk.builtin.list(this.list.v.slice(a,b)),0,this.len)};Sk.builtin.listSlice.prototype.advance=function(a){this.base+=a;this.len-=a;goog.asserts.assert(this.base<=this.list.sq$length())};
+Sk.builtin.listSlice.prototype.getitem=function(a){return this.list.v[a]};Sk.builtin.listSlice.prototype.setitem=function(a,b){this.list.v[a]=b};Sk.builtin.listSlice.prototype.popleft=function(){var a=this.list.v[this.base];this.base++;this.len--;return a};Sk.builtin.listSlice.prototype.popright=function(){this.len--;return this.list.v[this.base+this.len]};
+Sk.builtin.listSlice.prototype.reverse=function(){for(var a,b,c=this.list,d=this.base,e=d+this.len-1;d<e;)a=c.v[e],b=c.v[d],c.v[d]=a,c.v[e]=b,d++,e--};goog.exportSymbol("Sk.builtin.listSlice",Sk.builtin.listSlice);goog.exportSymbol("Sk.builtin.timSort",Sk.builtin.timSort);Sk.builtin.sorted=function(a,b,c,d){var e,f,g;if(void 0===d)d=!1;else{if(d instanceof Sk.builtin.float_)throw new Sk.builtin.TypeError("an integer is required, got float");if(d instanceof Sk.builtin.int_||d.prototype instanceof Sk.builtin.int_)d=Sk.misceval.isTrue(d);else throw new Sk.builtin.TypeError("an integer is required");}if(void 0===c||c instanceof Sk.builtin.none)b instanceof Sk.builtin.none||void 0===b||(g=b);else for(g=b instanceof Sk.builtin.none||void 0===b?function(a,b){return Sk.misceval.richCompareBool(a[0],
+b[0],"Lt")?new Sk.builtin.int_(-1):new Sk.builtin.int_(0)}:function(a,c){return Sk.misceval.callsim(b,a[0],c[0])},f=a.tp$iter(),e=f.tp$iternext(),a=[];void 0!==e;)a.push([Sk.misceval.callsim(c,e),e]),e=f.tp$iternext();a=new Sk.builtin.list(a);void 0!==g?a.list_sort_(a,g):a.list_sort_(a);d&&a.list_reverse_(a);if(void 0!==c&&!(c instanceof Sk.builtin.none)){f=a.tp$iter();e=f.tp$iternext();for(a=[];void 0!==e;)a.push(e[1]),e=f.tp$iternext();a=new Sk.builtin.list(a)}return a};Sk.builtins={range:Sk.builtin.range,round:Sk.builtin.round,len:Sk.builtin.len,min:Sk.builtin.min,max:Sk.builtin.max,sum:Sk.builtin.sum,zip:Sk.builtin.zip,abs:Sk.builtin.abs,fabs:Sk.builtin.abs,ord:Sk.builtin.ord,chr:Sk.builtin.chr,hex:Sk.builtin.hex,oct:Sk.builtin.oct,bin:Sk.builtin.bin,dir:Sk.builtin.dir,repr:Sk.builtin.repr,open:Sk.builtin.open,isinstance:Sk.builtin.isinstance,hash:Sk.builtin.hash,getattr:Sk.builtin.getattr,float_$rw$:Sk.builtin.float_,int_$rw$:Sk.builtin.int_,hasattr:Sk.builtin.hasattr,
+map:Sk.builtin.map,filter:Sk.builtin.filter,reduce:Sk.builtin.reduce,sorted:Sk.builtin.sorted,bool:Sk.builtin.bool,any:Sk.builtin.any,all:Sk.builtin.all,enumerate:Sk.builtin.enumerate,AttributeError:Sk.builtin.AttributeError,ValueError:Sk.builtin.ValueError,Exception:Sk.builtin.Exception,ZeroDivisionError:Sk.builtin.ZeroDivisionError,AssertionError:Sk.builtin.AssertionError,ImportError:Sk.builtin.ImportError,IndentationError:Sk.builtin.IndentationError,IndexError:Sk.builtin.IndexError,KeyError:Sk.builtin.KeyError,
+TypeError:Sk.builtin.TypeError,NameError:Sk.builtin.NameError,IOError:Sk.builtin.IOError,NotImplementedError:Sk.builtin.NotImplementedError,StandardError:Sk.builtin.StandardError,SystemExit:Sk.builtin.SystemExit,OverflowError:Sk.builtin.OverflowError,OperationError:Sk.builtin.OperationError,RuntimeError:Sk.builtin.RuntimeError,StopIteration:Sk.builtin.StopIteration,dict:Sk.builtin.dict,file:Sk.builtin.file,"function":Sk.builtin.func,generator:Sk.builtin.generator,list:Sk.builtin.list,long_$rw$:Sk.builtin.lng,
+method:Sk.builtin.method,object:Sk.builtin.object,slice:Sk.builtin.slice,str:Sk.builtin.str,set:Sk.builtin.set,tuple:Sk.builtin.tuple,type:Sk.builtin.type,input:Sk.builtin.input,raw_input:Sk.builtin.raw_input,setattr:Sk.builtin.setattr,jseval:Sk.builtin.jseval,jsmillis:Sk.builtin.jsmillis,quit:Sk.builtin.quit,exit:Sk.builtin.quit,print:Sk.builtin.print,divmod:Sk.builtin.divmod,format:Sk.builtin.format,globals:Sk.builtin.globals,issubclass:Sk.builtin.issubclass,iter:Sk.builtin.iter,complex:Sk.builtin.complex,
+bytearray:Sk.builtin.bytearray,callable:Sk.builtin.callable,delattr:Sk.builtin.delattr,eval_$rn$:Sk.builtin.eval_,execfile:Sk.builtin.execfile,frozenset:Sk.builtin.frozenset,help:Sk.builtin.help,locals:Sk.builtin.locals,memoryview:Sk.builtin.memoryview,next:Sk.builtin.next_,pow:Sk.builtin.pow,property:Sk.builtin.property,reload:Sk.builtin.reload,reversed:Sk.builtin.reversed,"super":Sk.builtin.superbi,unichr:Sk.builtin.unichr,vars:Sk.builtin.vars,xrange:Sk.builtin.xrange,apply_$rn$:Sk.builtin.apply_,
+buffer:Sk.builtin.buffer,coerce:Sk.builtin.coerce,intern:Sk.builtin.intern};goog.exportSymbol("Sk.builtins",Sk.builtins);Sk.builtin.str.$emptystr=new Sk.builtin.str("");Sk.builtin.bool.true$=Object.create(Sk.builtin.bool.prototype,{v:{value:1,enumerable:!0}});Sk.builtin.bool.false$=Object.create(Sk.builtin.bool.prototype,{v:{value:0,enumerable:!0}});Sk.builtin.int_.co_varnames=["base"];Sk.builtin.int_.co_numargs=2;Sk.builtin.int_.$defaults=[new Sk.builtin.int_(10)];Sk.builtin.lng.co_varnames=["base"];Sk.builtin.lng.co_numargs=2;Sk.builtin.lng.$defaults=[new Sk.builtin.int_(10)];
+Sk.builtin.sorted.co_varnames=["cmp","key","reverse"];Sk.builtin.sorted.co_numargs=4;Sk.builtin.sorted.$defaults=[Sk.builtin.none.none$,Sk.builtin.none.none$,Sk.builtin.bool.false$];}());
diff --git a/static/solarized.css b/static/solarized.css
new file mode 100644
index 0000000..23bf80e
--- /dev/null
+++ b/static/solarized.css
@@ -0,0 +1,167 @@
+/*
+Solarized theme for code-mirror
+http://ethanschoonover.com/solarized
+*/
+
+/*
+Solarized color pallet
+http://ethanschoonover.com/solarized/img/solarized-palette.png
+*/
+
+.solarized.base03 { color: #002b36; }
+.solarized.base02 { color: #073642; }
+.solarized.base01 { color: #586e75; }
+.solarized.base00 { color: #657b83; }
+.solarized.base0 { color: #839496; }
+.solarized.base1 { color: #93a1a1; }
+.solarized.base2 { color: #eee8d5; }
+.solarized.base3 { color: #fdf6e3; }
+.solarized.solar-yellow { color: #b58900; }
+.solarized.solar-orange { color: #cb4b16; }
+.solarized.solar-red { color: #dc322f; }
+.solarized.solar-magenta { color: #d33682; }
+.solarized.solar-violet { color: #6c71c4; }
+.solarized.solar-blue { color: #268bd2; }
+.solarized.solar-cyan { color: #2aa198; }
+.solarized.solar-green { color: #859900; }
+
+/* Color scheme for code-mirror */
+
+.cm-s-solarized {
+ line-height: 1.45em;
+ color-profile: sRGB;
+ rendering-intent: auto;
+}
+.cm-s-solarized.cm-s-dark {
+ color: #839496;
+ background-color: #002b36;
+ text-shadow: #002b36 0 1px;
+}
+.cm-s-solarized.cm-s-light {
+ background-color: #fdf6e3;
+ color: #657b83;
+ text-shadow: #eee8d5 0 1px;
+}
+
+.cm-s-solarized .CodeMirror-widget {
+ text-shadow: none;
+}
+
+
+.cm-s-solarized .cm-keyword { color: #cb4b16 }
+.cm-s-solarized .cm-atom { color: #d33682; }
+.cm-s-solarized .cm-number { color: #d33682; }
+.cm-s-solarized .cm-def { color: #2aa198; }
+
+.cm-s-solarized .cm-variable { color: #268bd2; }
+.cm-s-solarized .cm-variable-2 { color: #b58900; }
+.cm-s-solarized .cm-variable-3 { color: #6c71c4; }
+
+.cm-s-solarized .cm-property { color: #2aa198; }
+.cm-s-solarized .cm-operator {color: #6c71c4;}
+
+.cm-s-solarized .cm-comment { color: #586e75; font-style:italic; }
+
+.cm-s-solarized .cm-string { color: #859900; }
+.cm-s-solarized .cm-string-2 { color: #b58900; }
+
+.cm-s-solarized .cm-meta { color: #859900; }
+.cm-s-solarized .cm-qualifier { color: #b58900; }
+.cm-s-solarized .cm-builtin { color: #d33682; }
+.cm-s-solarized .cm-bracket { color: #cb4b16; }
+.cm-s-solarized .CodeMirror-matchingbracket { color: #859900; }
+.cm-s-solarized .CodeMirror-nonmatchingbracket { color: #dc322f; }
+.cm-s-solarized .cm-tag { color: #93a1a1 }
+.cm-s-solarized .cm-attribute { color: #2aa198; }
+.cm-s-solarized .cm-header { color: #586e75; }
+.cm-s-solarized .cm-quote { color: #93a1a1; }
+.cm-s-solarized .cm-hr {
+ color: transparent;
+ border-top: 1px solid #586e75;
+ display: block;
+}
+.cm-s-solarized .cm-link { color: #93a1a1; cursor: pointer; }
+.cm-s-solarized .cm-special { color: #6c71c4; }
+.cm-s-solarized .cm-em {
+ color: #999;
+ text-decoration: underline;
+ text-decoration-style: dotted;
+}
+.cm-s-solarized .cm-strong { color: #eee; }
+.cm-s-solarized .cm-tab:before {
+ content: ""; /*visualize tab character*/
+ color: #586e75;
+ position:absolute;
+}
+.cm-s-solarized .cm-error,
+.cm-s-solarized .cm-invalidchar {
+ color: #586e75;
+ border-bottom: 1px dotted #dc322f;
+}
+
+.cm-s-solarized.cm-s-dark .CodeMirror-selected {
+ background: #073642;
+}
+
+.cm-s-solarized.cm-s-light .CodeMirror-selected {
+ background: #eee8d5;
+}
+
+/* Editor styling */
+
+
+
+/* Little shadow on the view-port of the buffer view */
+.cm-s-solarized.CodeMirror {
+ -moz-box-shadow: inset 7px 0 12px -6px #000;
+ -webkit-box-shadow: inset 7px 0 12px -6px #000;
+ box-shadow: inset 7px 0 12px -6px #000;
+}
+
+/* Gutter border and some shadow from it */
+.cm-s-solarized .CodeMirror-gutters {
+ border-right: 1px solid;
+}
+
+/* Gutter colors and line number styling based of color scheme (dark / light) */
+
+/* Dark */
+.cm-s-solarized.cm-s-dark .CodeMirror-gutters {
+ background-color: #002b36;
+ border-color: #00232c;
+}
+
+.cm-s-solarized.cm-s-dark .CodeMirror-linenumber {
+ text-shadow: #021014 0 -1px;
+}
+
+/* Light */
+.cm-s-solarized.cm-s-light .CodeMirror-gutters {
+ background-color: #fdf6e3;
+ border-color: #eee8d5;
+}
+
+/* Common */
+.cm-s-solarized .CodeMirror-linenumber {
+ color: #586e75;
+ padding: 0 5px;
+}
+
+.cm-s-solarized .CodeMirror-gutter .CodeMirror-gutter-text {
+ color: #586e75;
+}
+
+.cm-s-solarized .CodeMirror-lines .CodeMirror-cursor {
+ border-left: 1px solid #819090;
+}
+
+/*
+Active line. Negative margin compensates left padding of the text in the
+view-port
+*/
+.cm-s-solarized.cm-s-dark .CodeMirror-activeline-background {
+ background: rgba(255, 255, 255, 0.10);
+}
+.cm-s-solarized.cm-s-light .CodeMirror-activeline-background {
+ background: rgba(0, 0, 0, 0.10);
+} \ No newline at end of file
diff --git a/static/v86.css b/static/v86.css
new file mode 100644
index 0000000..305d62f
--- /dev/null
+++ b/static/v86.css
@@ -0,0 +1,99 @@
+#log, #runtime_infos, #serial, #filesystem_panel, #debug_panel {
+ font-family: DejaVu Sans Mono, monospace;
+ font-size: 13px;
+ border: 1px solid #333;
+ background-color: #000;
+ padding: 4px;
+ color: #fff;
+}
+#runtime_infos, #filesystem_panel {
+ float: left;
+ width: 250px;
+ margin-bottom: 7px;
+ margin-right: 7px;
+ padding-bottom: 7px;
+}
+#log {
+ height: 100px;
+ width: 550px;
+}
+#debug_panel {
+ white-space: pre;
+ float: left;
+}
+#serial {
+ margin: 0px;
+}
+#serial:focus {
+ outline: 1px solid rgb(229, 151, 0);
+}
+#screen {
+ white-space: pre;
+ position: relative;
+ font-family: Liberation Mono, DejaVu Sans Mono, Courier New, monospace;
+ font-weight: bold;
+ font-size: 15px;
+ line-height: normal;
+}
+#screen, #vga {
+ -webkit-transform-origin: top left;
+ -moz-transform-origin: top left;
+ transform-origin: top left;
+}
+#vga {
+ background-color: #000;
+}
+body {
+ background-color: #111;
+ color: #fff;
+ line-height: 1.5;
+ padding: 10px;
+ font-family: sans-serif;
+}
+a {
+ color: wheat;
+}
+.phone_keyboard {
+ width: 0;
+ height: 0;
+ resize: none;
+ position: absolute;
+ opacity: 0;
+ left: -9999em;
+ top: 0;
+ z-index: -10;
+ white-space: nowrap;
+ overflow: hidden;
+}
+h4 {
+ margin: 0px 0px 20px 0px;
+}
+#start_emulation {
+ padding: 6px 18px;
+ font-size: 16px;
+ font-weight: bold;
+}
+#setup_error {
+ color: red;
+ font-weight: bold;
+ background-color: #222;
+ padding: 8px 18px;
+}
+#config_link {
+ font-weight: bold;
+ background-color: #222;
+ padding: 8px 18px;
+}
+#screen_container {
+ float: left;
+ margin-right: 10px;
+ margin-bottom: 10px;
+ border: 1px solid #555;
+ border-width: 2px 1px;
+}
+a img {
+ margin: 10px;
+}
+.screenshots a {
+ text-decoration: none;
+}
diff --git a/static/v86_all.min.js b/static/v86_all.min.js
new file mode 100644
index 0000000..e3fb82b
--- /dev/null
+++ b/static/v86_all.min.js
@@ -0,0 +1,594 @@
+var k,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ba="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this;function ca(){ca=function(){};ba.Symbol||(ba.Symbol=da)}var da=function(){var a=0;return function(b){return"jscomp_symbol_"+(b||"")+a++}}();
+function ea(){ca();var a=ba.Symbol.iterator;a||(a=ba.Symbol.iterator=ba.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&aa(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return fa(this)}});ea=function(){}}function fa(a){var b=0;return ha(function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}})}function ha(a){ea();a={next:a};a[ba.Symbol.iterator]=function(){return this};return a}function ia(a){ea();var b=a[Symbol.iterator];return b?b.call(a):fa(a)}
+function ja(a,b){if(b){var c=ba;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&aa(c,a,{configurable:!0,writable:!0,value:b})}}
+ja("String.prototype.endsWith",function(a){return a?a:function(a,c){if(null==this)throw new TypeError("The 'this' value for String.prototype.endsWith must not be null or undefined");if(a instanceof RegExp)throw new TypeError("First argument to String.prototype.endsWith must not be a regular expression");void 0===c&&(c=this.length);c=Math.max(0,Math.min(c|0,this.length));for(var b=a.length;0<b&&0<c;)if(this[--c]!=a[--b])return!1;return 0>=b}});
+ja("Math.trunc",function(a){return a?a:function(a){a=Number(a);if(isNaN(a)||Infinity===a||-Infinity===a||0===a)return a;var b=Math.floor(Math.abs(a));return 0>a?-b:b}});function la(a,b){ea();a instanceof String&&(a+="");var c=0,d={next:function(){if(c<a.length){var e=c++;return{value:b(e,a[e]),done:!1}}d.next=function(){return{done:!0,value:void 0}};return d.next()}};d[Symbol.iterator]=function(){return d};return d}
+ja("Array.prototype.entries",function(a){return a?a:function(){return la(this,function(a,c){return[a,c]})}});function ma(a,b){this.g=a;this.w=b;this.la=function(){};this.C=9;this.J=1;this.m=new Uint8Array([6,0,104,111,115,116,57,112]);this.v="9P2000.L";this.i=this.l=8192;this.Aa=new Uint8Array(2*this.i);this.Rf=0;this.a=[]}
+ma.prototype.Sa=function(){var a=[];a[0]=this.C;a[1]=this.J;a[2]=this.m;a[3]=this.v;a[4]=this.l;a[5]=this.i;a[6]=this.Aa;a[7]=this.Rf;a[8]=this.a.map(function(a){return[a.ca,a.type,a.uid]});return a};ma.prototype.fb=function(a){this.C=a[0];this.J=a[1];this.m=a[2];this.v=a[3];this.l=a[4];this.i=a[5];this.Aa=a[6];this.Rf=a[7];this.a=a[8].map(function(a){return{ca:a[0],type:a[1],uid:a[2]}})};function na(a,b,c,d){oa(["w","b","h"],[d+7,b+1,c],a.Aa,0);a.Rf=d+7}
+function pa(a,b,c){c=oa(["w"],[c],a.Aa,7);na(a,6,b,c)}
+function qa(a,b,c){var d=ra(["w","b","h"],c),e=d[0],f=d[1],h=d[2];switch(f){case 8:e=a.g.C;var g=[16914839];g[1]=a.l;g[2]=Math.floor(274877906944/g[1]);g[3]=g[2]-Math.floor(e/g[1]);g[4]=g[2]-Math.floor(e/g[1]);g[5]=a.g.a.length;g[6]=1048576;g[7]=0;g[8]=256;e=oa("wwddddddw".split(""),g,a.Aa,7);na(a,f,h,e);a.la(0,b);break;case 112:case 12:g=ra(["w","w"],c);var p=g[0];d=g[1];c=a.a[p].ca;var r=sa(a.g,c);c=ta(a.g,c);ua(a.g,a.a[p].ca,function(){g[0]=r.lb;g[1]=this.i-24;oa(["Q","w"],g,this.Aa,7);na(this,
+f,h,17);this.la(0,b)}.bind(a));break;case 70:g=ra(["w","w","s"],c);e=g[0];p=g[1];c=g[2];r=va(a.g);d=sa(a.g,a.a[p].ca);var v=a.g.g[a.a[p].ca];r.mode=d.mode;r.size=d.size;r.ff=d.ff;var E=a.g.g[a.g.a.length]=new Uint8Array(r.size);for(d=0;d<r.size;d++)E[d]=v[d];r.name=c;r.va=a.a[e].ca;wa(a.g,r);na(a,f,h,0);a.la(0,b);break;case 16:g=ra(["w","s","s","w"],c);p=g[0];c=g[1];e=g[3];c=xa(a.g,c,a.a[p].ca,g[2]);r=sa(a.g,c);r.uid=a.a[p].uid;r.pb=e;oa(["Q"],[r.lb],a.Aa,7);na(a,f,h,13);a.la(0,b);break;case 18:g=
+ra("wswwww".split(""),c);p=g[0];c=g[1];d=g[2];v=g[3];E=g[4];e=g[5];c=ya(a.g,c,a.a[p].ca,v,E);r=sa(a.g,c);r.mode=d;r.uid=a.a[p].uid;r.pb=e;oa(["Q"],[r.lb],a.Aa,7);na(a,f,h,13);a.la(0,b);break;case 22:g=ra(["w"],c);p=g[0];r=sa(a.g,a.a[p].ca);e=oa(["s"],[r.ff],a.Aa,7);na(a,f,h,e);a.la(0,b);break;case 72:g=ra(["w","s","w","w"],c);p=g[0];c=g[1];d=g[2];e=g[3];c=za(a.g,c,a.a[p].ca);r=sa(a.g,c);r.mode=d|Aa;r.uid=a.a[p].uid;r.pb=e;oa(["Q"],[r.lb],a.Aa,7);na(a,f,h,13);a.la(0,b);break;case 14:g=ra(["w","s",
+"w","w","w"],c);p=g[0];c=g[1];d=g[3];e=g[4];c=Ba(a.g,c,a.a[p].ca);a.a[p].ca=c;a.a[p].type=1;r=sa(a.g,c);r.uid=a.a[p].uid;r.pb=e;r.mode=d;oa(["Q","w"],[r.lb,a.i-24],a.Aa,7);na(a,f,h,17);a.la(0,b);break;case 52:oa(["w"],[0],a.Aa,7);na(a,f,h,1);a.la(0,b);break;case 24:g=ra(["w","d"],c);p=g[0];r=sa(a.g,a.a[p].ca);if(!r||r.status===Ca){pa(a,h,2);a.la(0,b);break}g[0]|=4096;g[0]=g[1];g[1]=r.lb;g[2]=r.mode;g[3]=r.uid;g[4]=r.pb;g[5]=r.Pb;g[6]=r.$g<<8|r.ah;g[7]=r.size;g[8]=a.l;g[9]=Math.floor(r.size/512+1);
+g[10]=r.mf;g[11]=0;g[12]=r.ne;g[13]=0;g[14]=r.dg;g[15]=0;g[16]=0;g[17]=0;g[18]=0;g[19]=0;oa("dQwwwddddddddddddddd".split(""),g,a.Aa,7);na(a,f,h,153);a.la(0,b);break;case 26:g=ra("wwwwwddddd".split(""),c);p=g[0];r=sa(a.g,a.a[p].ca);g[1]&1&&(r.mode=g[2]);g[1]&2&&(r.uid=g[3]);g[1]&4&&(r.pb=g[4]);g[1]&16&&(r.mf=Math.floor((new Date).getTime()/1E3));g[1]&32&&(r.ne=Math.floor((new Date).getTime()/1E3));g[1]&64&&(r.dg=Math.floor((new Date).getTime()/1E3));g[1]&128&&(r.mf=g[6]);g[1]&256&&(r.ne=g[8]);g[1]&
+8&&Da(a.g,a.a[p].ca,g[5]);na(a,f,h,0);a.la(0,b);break;case 50:g=ra(["w","d"],c);p=g[0];na(a,f,h,0);a.la(0,b);break;case 40:case 116:g=ra(["w","d","w"],c);p=g[0];var z=g[1],A=g[2];r=sa(a.g,a.a[p].ca);if(!r||r.status===Ca){pa(a,h,2);a.la(0,b);break}if(2==a.a[p].type){r.Pa.length<z+A&&(A=r.Pa.length-z);for(d=0;d<A;d++)a.Aa[11+d]=r.Pa[z+d];oa(["w"],[A],a.Aa,7);na(a,f,h,4+A);a.la(0,b)}else{var M=a.g.a[a.a[p].ca];a.w.send("9p-read-start");ta(a.g,a.a[p].ca);ua(a.g,a.a[p].ca,function(){this.w.send("9p-read-end",
+[M.name,A]);r.size<z+A&&(A=r.size-z);var a=this.g.g[this.a[p].ca];if(a)for(var c=0;c<A;c++)this.Aa[11+c]=a[z+c];oa(["w"],[A],this.Aa,7);na(this,f,h,4+A);this.la(0,b)}.bind(a))}break;case 118:g=ra(["w","d","w"],c);p=g[0];z=g[1];A=g[2];Ea(a.g,a.a[p].ca,z,A,c);M=a.g.a[a.a[p].ca];a.w.send("9p-write-end",[M.name,A]);oa(["w"],[A],a.Aa,7);na(a,f,h,4);a.la(0,b);break;case 74:g=ra(["w","s","w","s"],c);c=Fa(a.g,a.a[g[0]].ca,g[1],a.a[g[2]].ca,g[3]);if(0==c){pa(a,h,2);a.la(0,b);break}na(a,f,h,0);a.la(0,b);break;
+case 76:g=ra(["w","s","w"],c);d=g[0];c=g[1];p=Ga(a.g,a.a[d].ca,c);if(-1==p){pa(a,h,2);a.la(0,b);break}c=Ha(a.g,p);if(!c){pa(a,h,39);a.la(0,b);break}na(a,f,h,0);a.la(0,b);break;case 100:c=ra(["w","s"],c);a.i=c[0];e=oa(["w","s"],[a.i,a.v],a.Aa,7);na(a,f,h,e);a.la(0,b);break;case 104:g=ra(["w","w","s","s","w"],c);p=g[0];a.a[p]={ca:0,type:1,uid:g[4]};r=sa(a.g,a.a[p].ca);oa(["Q"],[r.lb],a.Aa,7);na(a,f,h,13);a.la(0,b);break;case 108:g=ra(["h"],c);na(a,f,h,0);a.la(0,b);break;case 110:g=ra(["w","w","h"],
+c);p=g[0];e=g[1];v=g[2];if(0==v){a.a[e]={ca:a.a[p].ca,type:1,uid:a.a[p].uid};oa(["h"],[0],a.Aa,7);na(a,f,h,2);a.la(0,b);break}E=[];for(d=0;d<v;d++)E.push("s");E=ra(E,c);c=a.a[p].ca;z=9;var ka=0;for(d=0;d<v;d++){c=Ga(a.g,c,E[d]);if(-1==c)break;z+=oa(["Q"],[a.g.a[c].lb],a.Aa,z);ka++;a.a[e]={ca:c,type:1,uid:a.a[p].uid}}oa(["h"],[ka],a.Aa,7);na(a,f,h,z-7);a.la(0,b);break;case 120:g=ra(["w"],c);a.a[g[0]]&&0<=a.a[g[0]].ca&&(Ia(a.g,a.a[g[0]].ca),a.a[g[0]].ca=-1,a.a[g[0]].type=-1);na(a,f,h,0);a.la(0,b);break;
+case 32:g=ra(["w","s","d","w"],c);p=g[0];c=g[1];na(a,f,h,0);a.la(0,b);break;case 30:g=ra(["w","w","s"],c),p=g[0],d=g[1],c=g[2],a.a[d]={ca:a.a[p].ca,type:-1,uid:a.a[p].uid},e=0,"security.capability"==c&&(e=Ja(a.g,a.a[p].ca),a.a[d].type=2),oa(["d"],[e],a.Aa,7),na(a,f,h,8),a.la(0,b)}}"undefined"===typeof window||window.requestAnimationFrame||(window.requestAnimationFrame=window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame);
+function Ka(a,b){function c(a){a=a.toString(16);return"#"+Array(7-a.length).join("0")+a}function d(a,b,c,d){a.style.width="";a.style.height="";d&&(a.style.transform=a.style.webkitTransform=a.style.MozTransform="");var f=a.getBoundingClientRect();d?a.style.transform=a.style.webkitTransform=a.style.MozTransform=(1===b?"":" scaleX("+b+")")+(1===c?"":" scaleY("+c+")"):(0===b%1&&0===c%1?(e.style.ti="pixelated",e.style["-ms-interpolation-mode"]="nearest-neighbor"):(e.style.ti="",e.style["-ms-interpolation-mode"]=
+""),d=window.devicePixelRatio||1,0!==d%1&&(b/=d,c/=d));1!==b&&(a.style.width=f.width*b+"px");1!==c&&(a.style.height=f.height*c+"px")}console.assert(a,"1st argument must be a DOM container");var e=a.getElementsByTagName("canvas")[0],f=e.getContext("2d"),h=a.getElementsByTagName("div")[0],g=document.createElement("div"),p,r,v,E,z=1,A=1,M,ka=!1,Y,Fb,yd,Ch=this;a=new Uint16Array([199,252,233,226,228,224,229,231,234,235,232,239,238,236,196,197,201,230,198,244,246,242,251,249,255,214,220,162,163,165,8359,
+402,225,237,243,250,241,209,170,186,191,8976,172,189,188,161,171,187,9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575,9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600,945,223,915,960,931,963,181,964,934,920,937,948,8734,966,949,8745,8801,177,8805,8804,8992,8993,247,8776,176,8729,183,8730,8319,178,9632,160]);for(var Dh=new Uint16Array([32,9786,9787,9829,9830,
+9827,9824,8226,9688,9675,9689,9794,9792,9834,9835,9788,9658,9668,8597,8252,182,167,9644,8616,8593,8595,8594,8592,8735,8596,9650,9660]),Nf=[],Gc,vb=0;256>vb;vb++)Gc=127<vb?a[vb-128]:32>vb?Dh[vb]:vb,Nf[vb]=String.fromCharCode(Gc);f.imageSmoothingEnabled=!1;g.style.position="absolute";g.style.backgroundColor="#ccc";g.style.width="7px";g.style.display="inline-block";h.style.display="block";e.style.display="none";this.w=b;b.register("screen-set-mode",function(a){this.wg(a)},this);b.register("screen-fill-buffer-end",
+function(a){this.yg(a)},this);b.register("screen-put-char",function(a){this.qg(a[0],a[1],a[2],a[3],a[4])},this);b.register("screen-update-cursor",function(a){this.Nd(a[0],a[1])},this);b.register("screen-update-cursor-scanline",function(a){this.Od(a[0],a[1])},this);b.register("screen-clear",function(){this.Dg()},this);b.register("screen-set-size-text",function(a){this.Jd(a[0],a[1])},this);b.register("screen-set-size-graphical",function(a){this.Id(a[0],a[1],a[2],a[3])},this);this.Ob=function(){this.Jd(80,
+25);this.Ic()};this.i=function(){try{window.open(e.toDataURL())}catch(If){}};this.qg=function(a,b,c,e,d){a<yd&&b<Fb&&(b=3*(a*Fb+b),Y[b]=c,Y[b+1]=e,Y[b+2]=d,M[a]=1)};this.Ic=function(){requestAnimationFrame(ka?Gf:Hf)};var Hf=function(){for(var a=0;a<yd;a++)M[a]&&(Ch.g(a),M[a]=0);this.Ic()}.bind(this),Gf=function(){this.w.send("screen-fill-buffer");this.Ic()}.bind(this);this.Mb=function(){};this.wg=function(a){(ka=a)?(h.style.display="none",e.style.display="block"):(h.style.display="block",e.style.display=
+"none")};this.Dg=function(){f.fillStyle="#000";f.fillRect(0,0,e.width,e.height)};this.Jd=function(a,b){if(a!==Fb||b!==yd){M=new Int8Array(b);Y=new Int32Array(a*b*3);Fb=a;for(yd=b;h.childNodes.length>b;)h.removeChild(h.firstChild);for(;h.childNodes.length<b;)h.appendChild(document.createElement("div"));for(a=0;a<b;a++)this.g(a);d(h,z,A,!0)}};this.Id=function(a,b,c,g){e.style.display="block";e.width=a;e.height=b;p=f.createImageData(c,g);new Uint8Array(p.data.buffer);r=new Int32Array(p.data.buffer);
+this.w.send("screen-tell-buffer",[r],[r.buffer]);d(e,z,A,!1)};this.a=function(a,b){z=a;A=b;d(h,z,A,!0);d(e,z,A,!1)};this.a(z,A);this.Od=function(a,b){a&32?g.style.display="none":(g.style.display="inline",g.style.height=Math.min(15,b-a)+"px",g.style.marginTop=Math.min(15,a)+"px")};this.Nd=function(a,b){if(a!==v||b!==E)M[a]=1,M[v]=1,v=a,E=b};this.g=function(a){for(var b=3*a*Fb,e,d=h.childNodes[a],f=document.createElement("div"),p=0;p<Fb;){var r=document.createElement("span"),A=Y[b+1],M=Y[b+2];r.style.backgroundColor=
+c(A);r.style.color=c(M);for(e="";p<Fb&&Y[b+1]===A&&Y[b+2]===M;)if(e+=Nf[Y[b]],p++,b+=3,a===v)if(p===E)break;else if(p===E+1){f.appendChild(g);break}r.textContent=e;f.appendChild(r)}d.parentNode.replaceChild(f,d)};this.yg=function(a){a.forEach(function(a){f.putImageData(p,a.ug-a.qf,a.vg-a.rf,a.qf,a.rf,a.ag,a.$f)})};this.Ob()}
+(function(){function a(a,c){a instanceof Array||(a=[a]);b(new Blob(a),c)}function b(a,b){var c=document.createElement("a");c.download=b;c.href=window.URL.createObjectURL(a);c.dataset.downloadurl=["application/octet-stream",c.download,c.href].join(":");document.createEvent?(a=document.createEvent("MouseEvent"),a.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),c.dispatchEvent(a)):c.click();window.URL.revokeObjectURL(c.href)}function c(){for(var a=location.search.substr(1).split("&"),
+b={},c=0;c<a.length;c++){var e=a[c].split("=");b[e[0]]=decodeURIComponent(e[1])}return b}function d(a,b){for(var c="";0<b--;)c+=a;return c}function e(a){return document.getElementById(a)}function f(){function a(a){e("boot_options").style.display="none";document.title=a.name+" - Virtual x86";d.filesystem=a.filesystem;a.state&&(e("reset").style.display="none",d.ke=a.state);d.Ra=a.Ra;d.Qa=a.Qa;d.Ma=a.Ma;d.oe=a.oe;d.Ia=a.Ia;d.Ja=a.Ja;d.id=a.id;void 0!==a.ae&&(d.ae=a.ae);a.description&&(e("description").style.display=
+"block",e("description").innerHTML="<br>"+a.description);h(d,b)}function b(a){g.c&&setTimeout(function(){a.Xg(g.c+"\n")},25)}if("responseType"in new XMLHttpRequest){var d={};e("start_emulation").onclick=function(){e("boot_options").style.display="none";var a=e("floppy_image").files[0];if(a){var b=a;d.Ra={buffer:a}}if(a=e("cd_image").files[0])b=a,d.Qa={buffer:a};if(a=e("hd_image").files[0])b=a,d.Ma={buffer:a};e("multiboot_image")&&(a=e("multiboot_image").files[0])&&(b=a,d.oe={buffer:a});b&&(document.title=
+b.name+" - Virtual x86");h(d)};var f=[{id:"linux26",Qa:{url:v+"images/linux.iso",size:5666816},name:"Linux"},{id:"linux3",Qa:{url:v+"images/linux3.iso",size:8624128},name:"Linux",filesystem:{}},{id:"openbsd",Ra:{url:v+"/static/openbsd.img",size:1474560},name:"OpenBSD"}],g=c();g.use_bochs_bios&&(d.tk=!0);for(var p=0;p<f.length;p++){var r=f[p];if("openbsd"===r.id){a(r);break}var E=e("start_"+r.id);E&&(E.onclick=function(b,c){c.blur();a(b)}.bind(this,r,E))}}else alert("Your browser is not supported because it doesn't have XMLHttpRequest.responseType")}
+function h(a,b){var c=a.Ia;c||(c=1048576*parseInt(e("memory_size").value,10),c||(alert("Invalid memory size - reset to 128MB"),c=134217728));var f=a.Ja;f||(f=1048576*parseInt(e("video_memory_size").value,10),f||(alert("Invalid video memory size - reset to 8MB"),f=8388608));if(!a.Ra){var h=e("floppy_image").files[0];h&&(a.Ra={buffer:h})}if(a.tk){h="bochs-bios.bin";var p="bochs-vgabios.bin"}else h="seabios.bin",p="vgabios.bin";if(!a.ke)var r={url:"/static/"+h},v={url:"/static/"+p};var A=new l({memory_size:c,
+vga_memory_size:f,screen_container:e("screen_container"),serial_container:e("serial"),boot_order:a.ae||parseInt(e("boot_order").value,16)||0,network_relay_url:"wss://relay.widgetry.org/",bios:r,vga_bios:v,fda:a.Ra,hda:a.Ma,cdrom:a.Qa,multiboot:a.oe,initial_state:a.ke,filesystem:a.filesystem||{},autostart:!0});A.$a("emulator-ready",function(){g(a,A);b&&b(A)});A.$a("download-progress",function(a){var b=e("loading");b.style.display="block";if(a.vf===a.uf-1&&a.loaded>=a.total-2048)b.textContent="Done downloading. Starting now ...";
+else{var c="Downloading images ";"number"===typeof a.vf&&a.uf&&(c+="["+(a.vf+1)+"/"+a.uf+"] ");if(a.total&&"number"===typeof a.loaded){a=Math.floor(a.loaded/a.total*100);a=Math.min(100,Math.max(0,a));var f=Math.floor(a/2);c=c+(a+"% [")+d("#",f);c+=d(" ",50-f)+"]"}else c+=d(".",E++%50);b.textContent=c}});A.$a("download-error",function(a){var b=e("loading");b.style.display="block";b.textContent="Loading "+a.Qg+" failed. Check your connection and reload the page to try again."})}function g(c,d){function f(){var a=
+Date.now(),b=d.ig(),c=b-z;z=b;var f=a-v;A+=f;v=a;e("speed").textContent=c/f|0;e("avg_speed").textContent=b/A|0;a=e("running_time");b=A/1E3|0;a.textContent=60>b?b+"s":3600>b?(b/60|0)+"m "+La(b%60,2)+"s":(b/3600|0)+"h "+La((b/60|0)%60,2)+"m "+La(b%60,2)+"s"}function g(f,g){var h=e("get_"+g+"_image");!f||104857600<f.size?h.style.display="none":h.onclick=function(){var e=d.kd[g],f=c.id+("cdrom"===g?".iso":".img");e.Tg?(e=e.Tg(f),b(e,f)):e.Se(function(b){b?a(b,f):alert("The file could not be loaded. Maybe it's too big?")});
+h.blur()}}function h(a){a.ctrlKey?window.onbeforeunload=function(){window.onbeforeunload=null;return"CTRL-W cannot be sent to the emulator."}:window.onbeforeunload=null}e("boot_options").style.display="none";e("loading").style.display="none";e("runtime_options").style.display="block";e("runtime_infos").style.display="block";e("screen_container").style.display="block";c.filesystem&&p(d);e("run").onclick=function(){d.Ge?(e("run").value="Run",d.stop()):(e("run").value="Pause",d.cf());e("run").blur()};
+e("exit").onclick=function(){d.stop();location.href=location.pathname};e("lock_mouse").onclick=function(){if(!r)e("toggle_mouse").onclick();d.Df();e("lock_mouse").blur()};var r=!0;e("toggle_mouse").onclick=function(){r=!r;d.m&&(d.m.a=r);e("toggle_mouse").value=(r?"Dis":"En")+"able mouse";e("toggle_mouse").blur()};var v=0,A=0,z=0,E,Gc=!1;d.$a("emulator-started",function(){v=Date.now();E=setInterval(f,1E3)});d.$a("emulator-stopped",function(){f();clearInterval(E)});var vb=0,Hf=0;d.$a("9p-read-start",
+function(){e("info_filesystem").style.display="block";e("info_filesystem_status").textContent="Loading ..."});d.$a("9p-read-end",function(a){vb+=a[1];e("info_filesystem_status").textContent="Idle";e("info_filesystem_last_file").textContent=a[0];e("info_filesystem_bytes_read").textContent=vb});d.$a("9p-write-end",function(a){Hf+=a[1];e("info_filesystem_last_file").textContent=a[0];e("info_filesystem_bytes_written").textContent=Hf});var Gf=0,If=0,Jf=0,Kf=0;d.$a("ide-read-start",function(){e("info_storage").style.display=
+"block";e("info_storage_status").textContent="Loading ..."});d.$a("ide-read-end",function(a){Gf+=a[1];If+=a[2];e("info_storage_status").textContent="Idle";e("info_storage_bytes_read").textContent=Gf;e("info_storage_sectors_read").textContent=If});d.$a("ide-write-end",function(a){Jf+=a[1];Kf+=a[2];e("info_storage_bytes_written").textContent=Jf;e("info_storage_sectors_written").textContent=Kf});var Lf=0,Mf=0;d.$a("eth-receive-end",function(a){Mf+=a[0];e("info_network").style.display="block";e("info_network_bytes_received").textContent=
+Mf});d.$a("eth-transmit-end",function(a){Lf+=a[0];e("info_network").style.display="block";e("info_network_bytes_transmitted").textContent=Lf});d.$a("mouse-enable",function(a){Gc=a;e("info_mouse_enabled").textContent=a?"Yes":"No"});d.$a("screen-set-mode",function(a){a?e("info_vga_mode").textContent="Graphical":(e("info_vga_mode").textContent="Text",e("info_res").textContent="-",e("info_bpp").textContent="-")});d.$a("screen-set-size-graphical",function(a){e("info_res").textContent=a[0]+"x"+a[1];e("info_bpp").textContent=
+a[4]});e("reset").onclick=function(){d.Sf();e("reset").blur()};g(c.Ma,"hda");g(c.zf,"hdb");g(c.Ra,"fda");g(c.Ng,"fdb");g(c.Qa,"cdrom");e("memory_dump").onclick=function(){a(d.a.j.da,"v86memory.bin");e("memory_dump").blur()};e("save_state").onclick=function(){d.we(function(b,c){b?(console.log(b.stack),console.log("Couldn't save state: ",b)):a(c,"v86state.bin")});e("save_state").blur()};e("load_state").onclick=function(){e("load_state_input").click();e("load_state").blur()};e("load_state_input").onchange=
+function(){var a=this.files[0];if(a){var b=d.Ge;b&&d.stop();var c=new FileReader;c.onload=function(a){try{d.Hd(a.target.result)}catch(Bh){throw alert("Something bad happened while restoring the state:\n"+Bh+"\n\nNote that the current configuration must be the same as the original"),Bh;}b&&d.cf()};c.readAsArrayBuffer(a);this.value=""}};e("ctrlaltdel").onclick=function(){d.Cf([29,56,83,157,184,211]);e("ctrlaltdel").blur()};e("alttab").onclick=function(){d.Cf([56,15]);setTimeout(function(){d.Cf([184,
+143])},100);e("alttab").blur()};e("scale").onchange=function(){var a=parseFloat(this.value);(a||0<a)&&d.Dh(a,a)};e("fullscreen").onclick=function(){d.Bh()};e("screen_container").onclick=function(){if(r&&Gc)d.Df(),e("lock_mouse").blur();else if(window.getSelection().isCollapsed){var a=document.getElementsByClassName("phone_keyboard")[0];a.style.top=document.body.scrollTop+100+"px";a.style.left=document.body.scrollLeft+100+"px";a.focus()}};var Hc=document.getElementsByClassName("phone_keyboard")[0];
+Hc.setAttribute("autocorrect","off");Hc.setAttribute("autocapitalize","off");Hc.setAttribute("spellcheck","false");Hc.tabIndex=0;e("screen_container").addEventListener("mousedown",function(){Hc.focus()},!1);e("take_screenshot").onclick=function(){d.Ch();e("take_screenshot").blur()};e("serial").style.display="block";window.addEventListener("keydown",h,!1);window.addEventListener("keyup",h,!1);window.addEventListener("blur",h,!1)}function p(b){e("filesystem_panel").style.display="block";e("filesystem_send_file").onchange=
+function(){Array.prototype.forEach.call(this.files,function(a){var c=new Ma(a);c.onload=function(){c.Se(function(c){b.Eg("/"+a.name,new Uint8Array(c))})};c.load()},this);this.value="";this.blur()};e("filesystem_get_file").onkeypress=function(c){13===c.which&&(this.disabled=!0,b.vh(this.value,function(b,c){this.disabled=!1;c?(b=this.value.replace(/\/$/,"").split("/"),b=b[b.length-1]||"root",a(c,b),this.value=""):alert("Can't read file")}.bind(this)))}}function r(){location.reload()}location.hostname.endsWith(".none");
+var v="",E=0;window.addEventListener("load",f,!1);window.addEventListener("load",function(){setTimeout(function(){window.addEventListener("popstate",r)},0)});"complete"===document.readyState&&f()})();function Na(a){this.ports=[];this.j=a;for(var b=0;65536>b;b++)this.ports[b]=Oa(this);var c=a.Ia;for(b=0;b<<17<c;b++)a.Ye[b]=a.Ze[b]=void 0,a.Ff[b]=a.Gf[b]=void 0;Pa(this,c,4294967296-c,function(){return 255},function(){},function(){return-1},function(){})}
+function Oa(a){return{ja:a.gi,ma:a.ei,th:a.fi,za:a.eg,ze:a.eg,fd:a.eg,ia:void 0}}k=Na.prototype;k.gi=function(){return 255};k.ei=function(){return 65535};k.fi=function(){return-1};k.eg=function(){};function m(a,b,c,d,e,f){d&&(a.ports[b].ja=d);e&&(a.ports[b].ma=e);f&&(a.ports[b].th=f);a.ports[b].ia=c}function n(a,b,c,d,e,f){d&&(a.ports[b].za=d);e&&(a.ports[b].ze=e);f&&(a.ports[b].fd=f);a.ports[b].ia=c}
+k.te=function(a,b,c,d,e,f){function h(){return c.call(this)|d.call(this)<<8}function g(){return e.call(this)|f.call(this)<<8}function p(){return c.call(this)|d.call(this)<<8|e.call(this)<<16|f.call(this)<<24}e&&f?(m(this,a,b,c,h,p),m(this,a+1,b,d),m(this,a+2,b,e,g),m(this,a+3,b,f)):(m(this,a,b,c,h),m(this,a+1,b,d))};
+k.Gc=function(a,b,c,d,e,f){function h(a){c.call(this,a&255);d.call(this,a>>8&255)}function g(a){e.call(this,a&255);f.call(this,a>>8&255)}function p(a){c.call(this,a&255);d.call(this,a>>8&255);e.call(this,a>>16&255);f.call(this,a>>>24)}e&&f?(n(this,a,b,c,h,p),n(this,a+1,b,d),n(this,a+2,b,e,g),n(this,a+3,b,f)):(n(this,a,b,c,h),n(this,a+1,b,d))};function Qa(a,b,c){b>>>=0;c=b+(c>>>0);if(c>=a.j.Ia)return!0;for(b&=-131072;b<c;){if(Ra(a.j,b))return!0;b+=131072}return!1}
+k.Ai=function(a){var b=this.j.Ye[a>>>17];return b(a)|b(a+1)<<8|b(a+2)<<16|b(a+3)<<24};k.Bi=function(a,b){var c=this.j.Ze[a>>>17];c(a,b&255);c(a+1,b>>8&255);c(a+2,b>>16&255);c(a+3,b>>>24)};function Pa(a,b,c,d,e,f,h){f||(f=a.Ai.bind(a));h||(h=a.Bi.bind(a));for(b>>>=17;0<c;b++)a.j.Ye[b]=d,a.j.Ze[b]=e,a.j.Ff[b]=f,a.j.Gf[b]=h,c-=131072}function Sa(a,b,c){a=a.ports[b];a.za.call(a.ia,c)}function Ta(a,b,c){a=a.ports[b];a.ze.call(a.ia,c)}function Ua(a,b,c){a=a.ports[b];a.fd.call(a.ia,c)}
+function Va(a,b){a=a.ports[b];return a.ja.call(a.ia)}function Wa(a,b){a=a.ports[b];return a.ma.call(a.ia)}function Xa(a,b){a=a.ports[b];return a.th.call(a.ia)}function Ya(a){this.g=this.a=!1;this.j=new q(a);this.w=a;a.register("cpu-init",this.Ob,this);a.register("cpu-run",this.cf,this);a.register("cpu-stop",this.stop,this);a.register("cpu-restart",this.Sf,this);this.hk()}Ya.prototype.cf=function(){this.a||(this.w.send("emulator-started"),this.fg())};
+function Za(a){if(a.g)a.g=a.a=!1,a.w.send("emulator-stopped");else{a.a=!0;a:{var b=a.j;if(b.Tc){var c=$a();b.G.If.Ic(c,!1);b.G.bd.Ic(c,!1);ab(b);if(b.Tc){b=0;break a}}for(var d=c=$a();1>d-c;){var e=b;e.G.If.Ic(d,!1);e.G.bd.Ic(d,!1);ab(b);b.qa();if(b.Tc)break;d=$a()}b=0}0>=b?a.fg():a.Ci(b)}}Ya.prototype.stop=function(){this.a&&(this.g=!0)};Ya.prototype.Sf=function(){this.j.reset();bb(this.j)};Ya.prototype.Ob=function(a){this.j.Ob(a,this.w);this.w.send("emulator-ready")};
+if("undefined"!==typeof setImmediate)var cb=function(){var a=this;setImmediate(function(){Za(a)})},db=function(){};else"undefined"!==typeof window&&"undefined"!==typeof postMessage?(cb=function(){window.postMessage(43605,"*")},db=function(){var a=this;window.addEventListener("message",function(b){b.source===window&&43605===b.data&&Za(a)},!1)}):(cb=function(){var a=this;setTimeout(function(){Za(a)},0)},db=function(){});k=Ya.prototype;k.fg=cb;k.hk=db;
+k.Ci="undefined"!==typeof document&&"boolean"===typeof document.hidden?function(a){var b=this;4>a||document.hidden?this.fg():setTimeout(function(){Za(b)},a)}:function(a){var b=this;setTimeout(function(){Za(b)},a)};k.we=function(){return this.j.we()};k.Hd=function(a){return this.j.Hd(a)};var $a="object"===typeof performance&&performance.now?function(){return performance.now()}:Date.now,Ma,eb,fb,gb,hb,ib;function La(a,b){for(a=a?a+"":"";a.length<b;)a="0"+a;return a}
+function jb(a,b){return"0x"+La((a?a.toString(16):"").toUpperCase(),b||1)}if("undefined"!==typeof window&&window.crypto&&window.crypto.getRandomValues)var kb=new Int32Array(1),lb=function(){return!0},mb=function(){window.crypto.getRandomValues(kb);return kb[0]};else lb=function(){return!1},mb=function(){console.assert(!1)};function nb(a){this.buffer=a;this.byteLength=a.byteLength;this.onload=void 0}nb.prototype.load=function(){this.onload&&this.onload({buffer:this.buffer})};
+nb.prototype.get=function(a,b,c){c(new Uint8Array(this.buffer,a,b))};nb.prototype.set=function(a,b,c){(new Uint8Array(this.buffer,a,b.byteLength)).set(b);c()};nb.prototype.Se=function(a){a(this.buffer)};(function(){for(var a=new Int8Array(256),b=0,c=-2;256>b;b++)b&b-1||c++,a[b]=c;eb=function(b){return a[b]};fb=function(b){var c=b>>>16;if(c){var d=c>>>8;return d?24+a[d]:16+a[c]}return(d=b>>>8)?8+a[d]:a[b]}})();
+function ob(a){var b=new Uint8Array(a),c,d;this.length=0;this.push=function(c){this.length!==a&&this.length++;b[d]=c;d=d+1&a-1};this.shift=function(){if(this.length){var e=b[c];c=c+1&a-1;this.length--;return e}return-1};this.clear=function(){this.length=d=c=0};this.clear()}function pb(){this.size=65536;this.data=new Float32Array(65536);this.length=this.a=this.start=0}
+pb.prototype.push=function(a){this.length===this.size?this.start=this.start+1&this.size-1:this.length++;this.data[this.a]=a;this.a=this.a+1&this.size-1};pb.prototype.shift=function(){if(this.length){var a=this.data[this.start];this.start=this.start+1&this.size-1;this.length--;return a}};
+function qb(a,b){var c=new Float32Array(b);b>a.length&&(b=a.length);var d=a.start+b,e=a.data.subarray(a.start,d);c.set(e);d>=a.size&&(d-=a.size,c.set(a.data.subarray(0,d),e.length));a.start=d;a.length-=b;return c}pb.prototype.clear=function(){this.length=this.a=this.start=0};
+function rb(a){this.j=a;this.I=new Float64Array(8);this.m=new Float32Array(1);new Uint8Array(this.m.buffer);this.v=new Int32Array(this.m.buffer);this.l=new Float64Array(1);this.g=new Uint8Array(this.l.buffer);this.i=new Int32Array(this.l.buffer);this.O=new Uint8Array(this.I.buffer);new Int32Array(this.I.buffer);this.fa=255;this.B=0;this.ec=895;this.od=this.nd=this.pd=this.Qe=this.Oc=this.a=0;this.C=NaN;this.J=new Float64Array([1,Math.log(10)/Math.LN2,Math.LOG2E,Math.PI,Math.log(2)/Math.LN10,Math.LN2,
+0])}k=rb.prototype;k.Sa=function(){var a=[];a[0]=this.I;a[1]=this.fa;a[2]=this.B;a[3]=this.ec;a[4]=this.od;a[5]=this.Oc;a[6]=this.Qe;a[7]=this.nd;a[8]=this.od;a[9]=this.pd;return a};k.fb=function(a){this.I.set(a[0]);this.fa=a[1];this.B=a[2];this.ec=a[3];this.Oc=a[5];this.Qe=a[6];this.nd=a[7];this.od=a[8];this.pd=a[9]};function sb(a){t(a.j)}function tb(a){a.a|=1}function ub(a,b){var c=wb(a);a.a&=-18177;c>b||(a.a=b>c?a.a|256:c===b?a.a|16384:a.a|17664)}
+function xb(a,b){var c=a.I[a.B];a.j.u&=-70;a.j.flags&=-70;c>b||(a.j.flags=b>c?a.j.flags|1:c===b?a.j.flags|64:a.j.flags|69)}function yb(a){a.ec=895;a.a=0;a.Oc=0;a.nd=0;a.pd=0;a.fa=255;a.B=0}function zb(a){return a.a&-14337|a.B<<11}
+function Ab(a,b){if(Bb(a.j)){Cb(a.j,b,26);u(a.j,b,a.ec);u(a.j,b+4,zb(a));for(var c=0,d,e=0;8>e;e++)d=a.I[e],a.fa>>e&1?c|=3<<(e<<1):0===d?c|=1<<(e<<1):isFinite(d)||(c|=2<<(e<<1));u(a.j,b+8,c);w(a.j,b+12,a.Oc);u(a.j,b+16,a.Qe);u(a.j,b+18,a.pd);w(a.j,b+20,a.nd);u(a.j,b+24,a.od)}else sb(a)}
+function Db(a,b){if(Bb(a.j)){a.ec=x(a.j,b);var c=x(a.j,b+4);a.a=c&-14337;a.B=c>>11&7;c=x(a.j,b+8);for(var d=a.fa=0;8>d;d++)a.fa|=c>>d&c>>d+1&1<<d;a.Oc=y(a.j,b+12);a.Qe=x(a.j,b+16);a.pd=x(a.j,b+18);a.nd=y(a.j,b+20);a.od=x(a.j,b+24)}else sb(a)}function Eb(a,b){a=a.ec>>10&3;return 0===a?(a=Math.round(b),.5===a-b&&a%2&&a--,a):1===a||3===a&&0<b?Math.floor(b):Math.ceil(b)}function Gb(a){return 0<a?Math.floor(a):Math.ceil(a)}
+k.push=function(a){this.B=this.B-1&7;this.fa>>this.B&1?(this.a&=-513,this.fa&=~(1<<this.B),this.I[this.B]=a):(this.a|=512,this.a|=65,this.I[this.B]=this.C)};k.pop=function(){this.fa|=1<<this.B;this.B=this.B+1&7};function Hb(a,b){b=b+a.B&7;return a.fa>>b&1?(a.a&=-513,a.a|=65,a.C):a.I[b]}function wb(a){return a.fa>>a.B&1?(a.a&=-513,a.a|=65,a.C):a.I[a.B]}
+function Ib(a,b){var c=x(a.j,b+8),d=y(a.j,b)>>>0,e=y(a.j,b+4)>>>0;b=c>>15;c&=-32769;if(0===c)return 0;if(!(32767>c))return a.g[7]=127|b<<7,a.g[6]=240|e>>30<<3&8,a.g[5]=0,a.g[4]=0,a.i[0]=0,a.l[0];a=d+4294967296*e;b&&(a=-a);return a*Math.pow(2,c-16383-63)}
+function Jb(a,b,c){a.l[0]=c;c=a.g[7]&128;var d=(a.g[7]&127)<<4|a.g[6]>>4;if(2047===d){d=32767;var e=0,f=2147483648|(a.i[1]&524288)<<11}else 0===d?f=e=0:(d+=15360,e=a.i[0]<<11,f=2147483648|(a.i[1]&1048575)<<11|a.i[0]>>>21);w(a.j,b,e);w(a.j,b+4,f);u(a.j,b+8,c<<8|d)}function Kb(a,b){var c=y(a.j,b);b=y(a.j,b+4);a.i[0]=c;a.i[1]=b;return a.l[0]}function Lb(a,b){Cb(a.j,b,8);a.l[0]=Hb(a,0);w(a.j,b,a.i[0]);w(a.j,b+4,a.i[1])}function Mb(a,b){a.v[0]=y(a.j,b);return a.m[0]}
+k.sign=function(a){return this.O[(this.B+a&7)<<3|7]>>7};
+function Nb(a,b,c,d,e){this.sa=new Ob(this,a,b,c,d,e);this.Ca=new Ob(this,a,void 0,!1,d,e);this.Ka=this.sa;this.j=a;0===d?(this.a=496,this.ua=14,this.Hb=240):1===d&&(this.a=368,this.ua=15,this.Hb=248);this.i=this.a|516;this.g=46080;this.pe=[134,128,16,112,5,0,160,2,0,128,1,1,0,0,0,0,this.a&255|1,this.a>>8,0,0,this.i&255|1,this.i>>8,0,0,0,0,0,0,0,0,0,0,this.g&255|1,this.g>>8,0,0,0,0,0,0,0,0,0,0,67,16,212,130,0,0,0,0,0,0,0,0,0,0,0,0,this.ua,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.nc=[{size:8},{size:4},void 0,void 0,{size:16}];this.name="ide"+d;this.m=2;m(a.o,this.a|7,this,function(){Pb(this.j,this.ua);return this.zh()});m(a.o,this.i|2,this,this.zh);n(a.o,this.i|2,this,this.xk);m(a.o,this.a|0,this,function(){return Qb(this.Ka,1)},function(){return Qb(this.Ka,2)},function(){return Qb(this.Ka,4)});m(a.o,this.a|1,this,function(){return this.Ka.error});
+m(a.o,this.a|2,this,function(){return this.Ka.pa&255});m(a.o,this.a|3,this,function(){return this.Ka.Na&255});m(a.o,this.a|4,this,function(){return this.Ka.Da&255});m(a.o,this.a|5,this,function(){return this.Ka.Ga&255});m(a.o,this.a|6,this,function(){return this.Ka.Mc});n(a.o,this.a|0,this,function(a){Rb(this.Ka,a,1)},function(a){Rb(this.Ka,a,2)},function(a){Rb(this.Ka,a,4)});n(a.o,this.a|1,this,function(a){this.sa.ud=(this.sa.ud<<8|a)&65535;this.Ca.ud=(this.Ca.ud<<8|a)&65535});n(a.o,this.a|2,this,
+function(a){this.sa.pa=(this.sa.pa<<8|a)&65535;this.Ca.pa=(this.Ca.pa<<8|a)&65535});n(a.o,this.a|3,this,function(a){this.sa.Na=(this.sa.Na<<8|a)&65535;this.Ca.Na=(this.Ca.Na<<8|a)&65535});n(a.o,this.a|4,this,function(a){this.sa.Da=(this.sa.Da<<8|a)&65535;this.Ca.Da=(this.Ca.Da<<8|a)&65535});n(a.o,this.a|5,this,function(a){this.sa.Ga=(this.sa.Ga<<8|a)&65535;this.Ca.Ga=(this.Ca.Ga<<8|a)&65535});n(a.o,this.a|6,this,function(a){this.Ka=a&16?this.Ca:this.sa;this.sa.Mc=a;this.Ca.Mc=a;this.sa.le=this.Ca.le=
+a>>6&1;this.sa.head=this.Ca.head=a&15});this.l=this.Ha=this.Dd=0;n(a.o,this.a|7,this,function(a){Pb(this.j,this.ua);var b=this.Ka;if(b.buffer)switch(b.v=a,b.error=0,a){case 8:b.i=0;b.a=0;b.g=0;Sb(b);b.ba();break;case 16:b.status=80;b.Da=0;b.ba();break;case 248:b.status=80;var c=b.l-1;b.Na=c&255;b.Da=c>>8&255;b.Ga=c>>16&255;b.Mc=b.Mc&240|c>>24&15;b.ba();break;case 39:b.status=80;c=b.l-1;b.Na=c&255;b.Da=c>>8&255;b.Ga=c>>16&255;b.Na|=c>>24<<8&65280;b.ba();break;case 32:case 36:case 41:case 196:Tb(b,
+a);break;case 48:case 52:case 57:case 197:var e=52===a||57===a;c=Ub(b,e);e=Vb(b,e);a=48===a||52===a;c*=b.m;e*=b.m;e+c>b.buffer.byteLength?(b.status=255,b.ba()):(b.status=88,Wb(b,c),b.a=a?512:Math.min(c,512*b.W),b.qa=e);break;case 144:b.ba();b.error=257;b.status=80;break;case 145:b.status=80;b.ba();break;case 160:b.R&&(b.status=88,Xb(b,12),b.a=12,b.pa=1,b.ba());break;case 161:b.R?(Yb(b),b.status=88,b.Da=20,b.Ga=235):b.status=65;b.ba();break;case 198:b.W=b.pa&255;b.status=80;b.ba();break;case 37:case 200:c=
+37===a;e=Ub(b,c);Vb(b,c)*b.m+e*b.m>b.buffer.byteLength?(b.status=255,b.ba()):(b.status=88,b.ia.Ha|=1);break;case 53:case 202:c=53===a;e=Ub(b,c);Vb(b,c)*b.m+e*b.m>b.buffer.byteLength?(b.status=255,b.ba()):(b.status=88,b.ia.Ha|=1);break;case 64:b.status=80;b.ba();break;case 218:b.status=65;b.error=4;b.ba();break;case 224:b.status=80;b.ba();break;case 225:b.status=80;b.ba();break;case 231:b.status=80;b.ba();break;case 236:if(b.R){b.status=65;b.error=4;b.ba();break}Yb(b);b.status=88;b.ba();break;case 234:b.status=
+80;b.ba();break;case 239:b.status=80;b.ba();break;case 245:b.status=80;b.ba();break;case 249:b.status=65;b.error=4;break;default:b.status=65,b.error=4}else b.error=4,b.status=65,b.ba()});m(a.o,this.g|4,this,void 0,void 0,this.Yh);n(a.o,this.g|4,this,void 0,void 0,this.bi);m(a.o,this.g,this,this.$h,void 0,this.Zh);n(a.o,this.g,this,this.Kg,void 0,this.ci);m(a.o,this.g|2,this,this.ai);n(a.o,this.g|2,this,this.Lg);m(a.o,this.g|8,this,function(){return 0});m(a.o,this.g|10,this,function(){return 0});Zb(a.G.wb,
+this)}k=Nb.prototype;k.zh=function(){return this.Ka.buffer?this.Ka.status:0};k.xk=function(a){a&4&&(Pb(this.j,this.ua),Sb(this.sa),Sb(this.Ca));this.m=a};k.Yh=function(){return this.Dd};k.bi=function(a){this.Dd=a};k.ai=function(){return this.Ha};k.Lg=function(a){this.Ha&=~(a&6)};k.Zh=function(){return this.l|this.Ha<<16};k.$h=function(){return this.l};k.ci=function(a){this.Kg(a&255);this.Lg(a>>16&255)};
+k.Kg=function(a){var b=this.l;this.l=a&9;if((b&1)!==(a&1))if(0===(a&1))this.Ha&=-2;else switch(this.Ha|=1,this.Ka.v){case 37:case 200:$b(this.Ka);break;case 202:case 53:ac(this.Ka);break;case 160:bc(this.Ka)}};k.ba=function(){0===(this.m&2)&&(this.Ha|=4,this.j.Cb(this.ua))};k.Sa=function(){var a=[];a[0]=this.sa;a[1]=this.Ca;a[2]=this.a;a[3]=this.ua;a[4]=this.Hb;a[5]=this.i;a[6]=this.g;a[7]=this.name;a[8]=this.m;a[9]=this.Dd;a[10]=this.Ha;a[11]=this.Ka===this.sa;a[12]=this.l;return a};
+k.fb=function(a){this.sa=a[0];this.Ca=a[1];this.a=a[2];this.ua=a[3];this.Hb=a[4];this.i=a[5];this.g=a[6];this.name=a[7];this.m=a[8];this.Dd=a[9];this.Ha=a[10];this.Ka=a[11]?this.sa:this.Ca;this.l=a[12]};
+function Ob(a,b,c,d,e,f){this.ia=a;this.w=f;this.Fa=e;this.j=b;this.buffer=c;this.m=d?2048:512;this.R=d;this.O=this.C=this.J=this.l=0;this.buffer&&(this.l=this.buffer.byteLength/this.m,this.l!==(this.l|0)&&(this.l=Math.ceil(this.l)),d?(this.J=1,this.C=0):(this.J=16,this.C=63),this.O=this.l/this.J/this.C,this.O!==(this.O|0)&&(this.O=Math.floor(this.O)),a=b.G.bd,a.ha[57]|=1<<4*this.Fa,a.ha[18]=a.ha[18]&15|240,a.ha[27]=this.O&255,a.ha[28]=this.O>>8&255,a.ha[29]=this.J&255,a.ha[30]=255,a.ha[31]=255,a.ha[32]=
+200,a.ha[33]=this.O&255,a.ha[34]=this.O>>8&255,a.ha[35]=this.C&255);this.Oa={Eh:0,Fh:0,Bg:0,Cg:0,Yg:!1};this.buffer=c;this.Mc=this.head=this.Ga=this.Da=this.ud=this.Na=this.pa=this.le=0;this.status=80;this.W=128;this.i=this.error=0;this.data=new Uint8Array(65536);this.oa=new Uint16Array(this.data.buffer);this.Z=new Int32Array(this.data.buffer);this.a=this.g=0;this.ka=this.v=-1;this.qa=0;Object.seal(this)}
+function Sb(a){a.R?(a.status=0,a.pa=1,a.error=1,a.Na=1,a.Da=20,a.Ga=235):(a.status=81,a.pa=1,a.error=1,a.Na=1,a.Da=0,a.Ga=0)}Ob.prototype.ba=function(){this.ia.ba()};Ob.prototype.Me=function(){this.status=80;var a=this.data.subarray(0,this.g);cc(this,this.v,this.g/512);this.ba();this.buffer.set(this.qa,a,function(){});dc(this,this.g)};
+function ec(a,b){var c=(b[7]<<8|b[8])*a.m;b=(b[2]<<24|b[3]<<16|b[4]<<8|b[5])*a.m;a.g=0;var d=a.Ga<<8&65280|a.Da&255;a.Da=a.Ga=0;65535===d&&d--;d>c&&(d=c);b>=a.buffer.byteLength?(a.status=255,a.ba()):0===c?(a.status=80,a.i=0):(c=Math.min(c,a.buffer.byteLength-b),a.status=208,fc(a),a.buffer.get(b,c,function(b){gc(a,b);a.status=88;a.pa=a.pa&-8|2;a.ba();d&=-4;a.a=d;a.a>a.g&&(a.a=a.g);a.Da=a.a&255;a.Ga=a.a>>8&255;hc(a,c)}))}
+function ic(a,b){var c=(b[7]<<8|b[8])*a.m;b=(b[2]<<24|b[3]<<16|b[4]<<8|b[5])*a.m;b>=a.buffer.byteLength?(a.status=255,a.ba()):(a.status=208,fc(a),a.buffer.get(b,c,function(b){hc(a,c);a.status=88;a.pa=a.pa&-8|2;gc(a,b);bc(a)}))}
+function bc(a){if(0!==(a.ia.Ha&1)&&0!==(a.status&8)){var b=a.ia.Dd,c=0,d=a.data;do{var e=jc(a.j,b),f=a.j.ma(b+4),h=a.j.ja(b+7)&128;f||(f=65536);a.j.da.set(d.subarray(c,Math.min(c+f,a.g)),e);c+=f;b+=8;if(c>=a.g&&!h)break}while(!h);a.status=80;a.ia.Ha&=-2;a.pa=a.pa&-8|3;a.ba()}}
+function Qb(a,b){if(a.i<a.a){var c=1===b?a.data[a.i]:2===b?a.oa[a.i>>>1]:a.Z[a.i>>>2];a.i+=b;a.i>=a.a&&(160===a.v?a.a===a.g?(a.status=80,a.pa=a.pa&-8|3,a.ba()):(a.status=88,a.pa=a.pa&-8|2,a.ba(),b=a.Ga<<8&65280|a.Da&255,a.a+b>a.g?(a.Da=a.g-a.a&255,a.Ga=a.g-a.a>>8&255,a.a=a.g):a.a+=b):(a.error=0,a.i>=a.g?a.status=80:(b=196===a.v||41===a.v?Math.min(a.W,(a.g-a.a)/512):1,cc(a,a.v,b),a.a+=512*b,a.status=88),a.ba()));return c}a.i+=b;return 0}
+function Rb(a,b,c){if(!(a.i>=a.a)&&(1===c?a.data[a.i++]=b:2===c?(a.oa[a.i>>>1]=b,a.i+=2):(a.Z[a.i>>>2]=b,a.i+=4),a.i===a.a))if(160===a.v){a.i=0;a.ka=a.data[0];switch(a.ka){case 0:Xb(a,0);a.a=a.g;a.status=80;break;case 3:Xb(a,a.data[4]);a.a=a.g;a.status=88;a.data[0]=240;a.data[2]=5;a.data[7]=8;break;case 18:b=a.data[4];a.status=88;a.data.set([5,128,1,49,31,0,0,0,83,79,78,89,32,32,32,32,67,68,45,82,79,77,32,67,68,85,45,49,48,48,48,32,49,46,49,97]);a.a=a.g=Math.min(36,b);break;case 26:Xb(a,a.data[4]);
+a.a=a.g;a.status=88;break;case 30:Xb(a,0);a.a=a.g;a.status=80;break;case 37:b=a.l-1;gc(a,new Uint8Array([b>>24&255,b>>16&255,b>>8&255,b&255,0,0,a.m>>8&255,a.m&255]));a.a=a.g;a.status=88;break;case 40:a.ud&1?ic(a,a.data):ec(a,a.data);break;case 66:b=a.data[8];Xb(a,Math.min(8,b));a.a=a.g;a.status=88;break;case 67:b=a.data[8]|a.data[7]<<8;c=a.data[9]>>6;Xb(a,b);a.a=a.g;0===c?(b=a.l,a.data.set(new Uint8Array([0,18,1,1,0,20,1,0,0,0,0,0,0,22,170,0,b>>24,b>>16&255,b>>8&255,b&255]))):1===c&&a.data.set(new Uint8Array([0,
+10,1,1,0,0,0,0,0,0,0,0]));a.status=88;break;case 70:b=a.data[8]|a.data[7]<<8;b=Math.min(b,32);Xb(a,b);a.a=a.g;a.data[0]=b-4>>24&255;a.data[1]=b-4>>16&255;a.data[2]=b-4>>8&255;a.data[3]=b-4&255;a.data[6]=8;a.data[10]=3;a.status=88;break;case 81:Xb(a,0);a.a=a.g;a.status=80;break;case 82:a.status=81;a.g=0;a.error=80;break;case 90:b=a.data[8]|a.data[7]<<8;42===a.data[2]&&Xb(a,Math.min(30,b));a.a=a.g;a.status=88;break;case 189:Xb(a,a.data[9]|a.data[8]<<8);a.a=a.g;a.data[5]=1;a.status=88;break;case 74:a.status=
+81;a.g=0;a.error=80;break;default:a.status=81,a.g=0,a.error=80}a.pa=a.pa&-8|2;0===(a.status&128)&&a.ba();0===(a.status&128)&&0===a.g&&(a.pa|=1,a.status&=-9)}else a.i>=a.g?a.Me():(a.status=88,a.a+=512,a.ba())}
+function cc(a,b,c){a.pa-=c;36===b||41===b||52===b||57===b||37===b||53===b?(b=c+kc(a),a.Na=b&255|b>>16&65280,a.Da=b>>8&255,a.Ga=b>>16&255):a.le?(b=c+lc(a),a.Na=b&255,a.Da=b>>8&255,a.Ga=b>>16&255,a.head=a.head&-16|b&15):(b=c+mc(a),c=b/(a.J*a.C)|0,a.Da=c&255,a.Ga=c>>8&255,a.head=(b/a.C|0)%a.J&15,a.Na=b%a.C+1&255,mc(a))}
+function Tb(a,b){var c=36===b||41===b,d=Ub(a,c);c=Vb(a,c);var e=32===b||36===b,f=d*a.m;c*=a.m;c+f>a.buffer.byteLength?(a.status=255,a.ba()):(a.status=192,fc(a),a.buffer.get(c,f,function(c){gc(a,c);a.status=88;a.a=e?512:Math.min(f,512*a.W);cc(a,b,e?1:Math.min(d,a.C));a.ba();hc(a,f)}))}
+function $b(a){var b=37===a.v,c=Ub(a,b);b=Vb(a,b);var d=c*a.m;b*=a.m;fc(a);a.buffer.get(b,d,function(b){var e=a.ia.Dd,h=0;do{var g=jc(a.j,e),p=a.j.ma(e+4),r=a.j.ja(e+7)&128;p||(p=65536);a.j.da.set(b.subarray(h,h+p),g);h+=p;e+=8}while(!r);cc(a,a.v,c);a.status=80;a.ia.Ha&=-2;a.v=-1;a.ba();hc(a,d)})}
+function ac(a){var b=53===a.v,c=Ub(a,b),d=Vb(a,b);b=c*a.m;d*=a.m;var e=a.ia.Dd,f=0,h=0,g=0;do{var p=jc(a.j,e),r=a.j.ma(e+4),v=a.j.ja(e+7)&128;r||(r=65536);a.buffer.set(d+g,a.j.da.subarray(p,p+r),function(){h++});g+=r;e+=8;f++}while(!v);h===f&&(cc(a,a.v,c),a.status=80,a.ba(),a.ia.Ha&=-2,a.v=-1);dc(a,b)}function mc(a){return((a.Da&255|a.Ga<<8&65280)*a.J+a.head)*a.C+(a.Na&255)-1}function lc(a){return a.Na&255|a.Da<<8&65280|a.Ga<<16&16711680|(a.head&15)<<24}
+function kc(a){return(a.Na&255|a.Da<<8&65280|a.Ga<<16&16711680|a.Na>>8<<24&4278190080)>>>0}function Vb(a,b){return b?kc(a):a.le?lc(a):mc(a)}function Ub(a,b){b?(a=a.pa,0===a&&(a=65536)):(a=a.pa&255,0===a&&(a=256));return a}
+function Yb(a){if(a.Mc&16)Xb(a,0);else{for(var b=0;512>b;b++)a.data[b]=0;b=Math.min(16383,a.O);gc(a,[64,a.R?133:0,b,b>>8,0,0,a.J,a.J>>8,a.C/512,a.C/512>>8,0,2,a.C,a.C>>8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,2,4,0,0,0,0,0,0,0,0,0,56,118,32,54,68,72,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,128,0,1,0,0,2,0,0,0,2,0,2,7,0,b,b>>8,a.J,a.J>>8,a.C,0,a.l&255,a.l>>8&255,a.l>>16&255,a.l>>24&255,0,0,a.l&255,a.l>>8&255,a.l>>16&255,
+a.l>>24&255,0,0,160===a.v?0:7,160===a.v?0:4,0,0,30,0,30,0,30,0,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,126,0,0,0,0,0,0,116,0,64,0,64,0,116,0,64,0,0,0,0,0,0,0,0,0,0,1,96,0,0,0,0,0,0,0,0,0,0,0,0,a.l&255,a.l>>8&255,a.l>>16&255,a.l>>24&255]);a.g=512;a.a=512}}function Xb(a,b){Wb(a,b);for(var c=0;c<b+3>>2;c++)a.Z[c]=0}function Wb(a,b){a.data.length<b&&(a.data=new Uint8Array(b+3&-4),a.oa=new Uint16Array(a.data.buffer),a.Z=new Int32Array(a.data.buffer));a.g=b;a.i=0}
+function gc(a,b){Wb(a,b.length);a.data.set(b)}function fc(a){a.Oa.Yg=!0;a.w.send("ide-read-start")}function hc(a,b){a.Oa.Yg=!1;var c=b/a.m|0;a.Oa.Eh+=c;a.Oa.Bg+=b;a.w.send("ide-read-end",[a.Fa,b,c])}function dc(a,b){var c=b/a.m|0;a.Oa.Fh+=c;a.Oa.Cg+=b;a.w.send("ide-write-end",[a.Fa,b,c])}
+Ob.prototype.Sa=function(){var a=[];a[0]=this.pa;a[1]=this.O;a[2]=this.Ga;a[3]=this.Da;a[4]=this.i;a[5]=0;a[6]=0;a[7]=0;a[8]=0;a[9]=this.Mc;a[10]=this.error;a[11]=this.head;a[12]=this.J;a[13]=this.R;a[14]=this.le;a[15]=this.ud;a[16]=this.data;a[17]=this.g;a[18]=this.Na;a[19]=this.l;a[20]=this.m;a[21]=this.W;a[22]=this.C;a[23]=this.status;a[24]=this.qa;a[25]=this.v;a[26]=this.a;a[27]=this.ka;return a};
+Ob.prototype.fb=function(a){this.pa=a[0];this.O=a[1];this.Ga=a[2];this.Da=a[3];this.i=a[4];this.Mc=a[9];this.error=a[10];this.head=a[11];this.J=a[12];this.R=a[13];this.le=a[14];this.ud=a[15];this.data=a[16];this.g=a[17];this.Na=a[18];this.l=a[19];this.m=a[20];this.W=a[21];this.C=a[22];this.status=a[23];this.qa=a[24];this.v=a[25];this.a=a[26];this.ka=a[27];this.oa=new Uint16Array(this.data.buffer);this.Z=new Int32Array(this.data.buffer)};
+function nc(a){this.mc=new Uint8Array(4);this.a=new Uint8Array(4);this.zd=new Uint8Array(4);this.Ad=new Uint8Array(4);this.yd=new Int32Array(this.mc.buffer);new Int32Array(this.a.buffer);this.eh=new Int32Array(this.zd.buffer);this.gh=new Int32Array(this.Ad.buffer);this.fc=[];this.G=[];this.j=a;for(var b=0;256>b;b++)this.fc[b]=void 0,this.G[b]=void 0;this.o=a.o;n(a.o,3324,this,function(a){oc(this,this.yd[0],a)},function(a){pc(this,this.yd[0],a)},function(a){var b=this.yd[0],c=b>>8&65535,f=b&255;b=
+this.fc[c];c=this.G[c];if(b)if(16<=f&&40>f)if(c=c.nc[f-16>>2]){f>>=2;var h=b[f]&1;-1===(a|3|c.size-1)?(a=~(c.size-1)|h,0===h&&(b[f]=a)):0===h&&(b[f]=c.dh);1===h&&(qc(this,c,b[f]&65534,a&65534),b[f]=a|1)}else b[f>>2]=0;else 48===f?b[f>>2]=c.fh?-1===(a|2047)?-c.fh|0:c.Ei|0:0:b[f>>>2]=a});n(a.o,3325,this,function(a){oc(this,this.yd[0]+1|0,a)});n(a.o,3326,this,function(a){oc(this,this.yd[0]+2|0,a)},function(a){pc(this,this.yd[0]+2|0,a)});n(a.o,3327,this,function(a){oc(this,this.yd[0]+3|0,a)});a.o.te(3324,
+this,function(){return this.zd[0]},function(){return this.zd[1]},function(){return this.zd[2]},function(){return this.zd[3]});a.o.te(3320,this,function(){return this.Ad[0]},function(){return this.Ad[1]},function(){return this.Ad[2]},function(){return this.Ad[3]});a.o.Gc(3320,this,function(a){this.mc[0]=a&252},function(a){this.mc[1]=a},function(a){this.mc[2]=a},function(a){this.mc[3]=a;a=this.mc[0]&252;var b=this.fc[this.mc[2]<<8|this.mc[1]];void 0!==b?(this.gh[0]=-2147483648,this.eh[0]=a<b.byteLength?
+b[a>>2]:0):(this.eh[0]=-1,this.gh[0]=0)});Zb(this,{Hb:0,pe:[134,128,55,18,0,0,0,0,2,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],nc:[],name:"82441FX PMC"});this.i={Hb:8,pe:[134,128,0,112,7,0,0,2,0,0,1,6,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],nc:[],name:"82371SB PIIX3 ISA"};this.l=Zb(this,this.i);this.g=new Uint8Array(this.l.buffer)}
+nc.prototype.Sa=function(){for(var a=[],b=0;256>b;b++)a[b]=this.fc[b];a[256]=this.mc;a[257]=this.a;a[258]=this.zd;a[259]=this.Ad;return a};nc.prototype.fb=function(a){for(var b=0;256>b;b++){var c=this.G[b],d=a[b];if(c&&d){for(var e=0;e<c.nc.length;e++){var f=d[4+e];if(f&1){var h=c.nc[e];qc(this,h,h.dh&65534,f&65534)}}this.fc[b].set(d)}}this.mc.set(a[256]);this.a.set(a[257]);this.zd.set(a[258]);this.Ad.set(a[259])};function oc(a,b,c){var d=b&255;(new Uint8Array(a.fc[b>>8&65535].buffer))[d]=c}
+function pc(a,b,c){var d=b&255;(new Uint16Array(a.fc[b>>8&65535].buffer))[d>>>1]=c}function Zb(a,b){var c=b.Hb,d=new Int32Array(64);d.set(new Int32Array((new Uint8Array(b.pe)).buffer));a.fc[c]=d;a.G[c]=b;c=d.slice(4,10);for(var e=0;e<b.nc.length;e++){var f=b.nc[e];if(f){var h=c[e],g=h&1;f.dh=h;f.entries=[];if(0!==g)for(h&=-2,g=0;g<f.size;g++)f.entries[g]=a.o.ports[h+g]}}return d}function qc(a,b,c,d){for(var e=b.size,f=a.o.ports,h=0;h<e;h++)f[c+h]=Oa(a.o),f[d+h]=b.entries[h]}
+nc.prototype.xb=function(a){this.j.Cb(this.g[96+((this.fc[a][15]>>8&255)-1+((a>>3)-1&255)&3)])};function rc(a,b){Pb(a.j,a.g[96+((a.fc[b][15]>>8&255)+(b>>3&255)-2&3)])}
+function sc(a,b){this.o=a.o;this.j=a;this.Ub=a.G.Ub;this.g=0;this.ka=new Uint8Array(10);this.oa=0;this.l=null;this.a=new Uint8Array(10);this.C=this.m=this.i=0;this.W=b;this.Z=this.O=this.Xa=this.Bb=this.Za=this.Ya=0;this.qa=1;this.v=0;if(b){this.C=b.byteLength;var c;if((c={160:{type:1,bc:40,ac:8,Yb:1},180:{type:1,bc:40,ac:9,Yb:1},200:{type:1,bc:40,ac:10,Yb:1},320:{type:1,bc:40,ac:8,Yb:2},360:{type:1,bc:40,ac:9,Yb:2},400:{type:1,bc:40,ac:10,Yb:2},720:{type:3,bc:80,ac:9,Yb:2},1200:{type:2,bc:80,ac:15,
+Yb:2},1440:{type:4,bc:80,ac:18,Yb:2},1722:{type:5,bc:82,ac:21,Yb:2},2880:{type:5,bc:80,ac:36,Yb:2}}[this.C>>10])&&0===(this.C&1023))a.G.bd.ha[16]=c.type<<4,a=c.ac,b=c.Yb,c=c.bc;else throw"Unknown floppy size: "+jb(b.byteLength);this.J=a;this.R=b;this.Fa=c}else a.G.bd.ha[16]=64,this.C=this.Fa=this.R=this.J=0;m(this.o,1008,this,this.Oj);m(this.o,1010,this,this.Pj);m(this.o,1012,this,this.Rj);m(this.o,1013,this,this.Sj);m(this.o,1015,this,this.Uj);n(this.o,1010,this,this.Qj);n(this.o,1013,this,this.Tj)}
+k=sc.prototype;k.Sa=function(){var a=[];a[0]=this.g;a[1]=this.ka;a[2]=this.oa;a[4]=this.a;a[5]=this.i;a[6]=this.m;a[7]=this.C;a[8]=this.Ya;a[9]=this.Za;a[10]=this.Bb;a[11]=this.Xa;a[12]=this.O;a[13]=this.Z;a[14]=this.qa;a[15]=this.v;a[16]=this.J;a[17]=this.R;a[18]=this.Fa;return a};
+k.fb=function(a){this.g=a[0];this.ka=a[1];this.oa=a[2];this.l=a[3];this.a=a[4];this.i=a[5];this.m=a[6];this.C=a[7];this.Ya=a[8];this.Za=a[9];this.Bb=a[10];this.Xa=a[11];this.O=a[12];this.Z=a[13];this.qa=a[14];this.v=a[15];this.J=a[16];this.R=a[17];this.Fa=a[18]};k.Oj=function(){return 0};k.Rj=function(){var a=128;this.i<this.m&&(a|=80);0===(this.v&8)&&(a|=32);return a};k.Uj=function(){return 0};k.Sj=function(){return this.i<this.m?(Pb(this.j,6),this.a[this.i++]):255};
+k.Tj=function(a){if(this.W)if(0<this.g)this.ka[this.oa++]=a,this.g--,0===this.g&&this.l.call(this,this.ka);else{switch(a){case 3:this.l=this.li;this.g=2;break;case 4:this.l=this.Qh;this.g=1;break;case 5:case 197:this.l=function(a){tc(this,!0,a)};this.g=8;break;case 230:this.l=function(a){tc(this,!1,a)};this.g=8;break;case 7:this.l=this.Ph;this.g=1;break;case 8:this.i=0;this.m=2;this.a[0]=32;this.a[1]=this.O;break;case 74:this.l=this.fk;this.g=1;break;case 15:this.g=2;this.l=this.Kh;break;case 14:this.a[0]=
+128,this.i=0,this.m=1,this.g=0}this.oa=0}};k.Pj=function(){return this.v};k.Qj=function(a){4===(a&4)&&0===(this.v&4)&&this.j.Cb(6);this.v=a};k.Qh=function(){this.i=0;this.m=1;this.a[0]=32};k.Kh=function(a){this.O=a[1];this.Z=a[0]>>2&1;this.xb()};k.Ph=function(){this.xb()};function tc(a,b,c){var d=c[2],e=c[1],f=c[3],h=128<<c[4],g=c[5]-c[3]+1,p=((d+a.R*e)*a.J+f-1)*h;a.W&&(b?a.Ub.Me(a.W,p,g*h,2,a.done.bind(a,c,e,d,f)):uc(a.Ub,a.W,p,a.done.bind(a,c,e,d,f)))}
+k.done=function(a,b,c,d,e){e||(d++,d>this.J&&(d=1,c++,c>=this.R&&(c=0,b++)),this.O=b,this.Z=c,this.qa=d,this.i=0,this.m=7,this.a[0]=c<<2|32,this.a[1]=0,this.a[2]=0,this.a[3]=b,this.a[4]=c,this.a[5]=d,this.a[6]=a[4],this.xb())};k.li=function(){};k.fk=function(){this.i=0;this.m=7;this.a[0]=0;this.a[1]=0;this.a[2]=0;this.a[3]=0;this.a[4]=0;this.a[5]=0;this.a[6]=0;this.xb()};k.xb=function(){this.v&8&&this.j.Cb(6)};function vc(a,b){a=a.Ye[b>>>17];return a(b)|a(b+1|0)<<8}
+function wc(a,b,c){a=a.Ze[b>>>17];a(b,c&255);a(b+1|0,c>>8&255)}function Ra(a,b){return 655360<=(b|0)&&786432>(b|0)||b>>>0>=a.Ia>>>0}k=q.prototype;k.ja=function(a){return Ra(this,a)?this.Ye[a>>>17](a):this.da[a]};k.ma=function(a){return Ra(this,a)?vc(this,a):this.da[a]|this.da[a+1|0]<<8};function xc(a,b){return Ra(a,b<<1)?vc(a,b<<1):a.Ef[b]}function jc(a,b){return Ra(a,b)?a.Ff[b>>>17](b):a.da[b]|a.da[b+1|0]<<8|a.da[b+2|0]<<16|a.da[b+3|0]<<24}
+function yc(a,b){Ra(a,b<<2)?(b<<=2,a=a.Ff[b>>>17](b)):a=a.Cc[b];return a}k.za=function(a,b){if(Ra(this,a))this.Ze[a>>>17](a,b);else this.da[a]=b};k.ze=function(a,b){Ra(this,a)?wc(this,a,b):(this.da[a]=b,this.da[a+1|0]=b>>8)};function zc(a,b,c){Ra(a,b<<1)?wc(a,b<<1,c):a.Ef[b]=c}k.fd=function(a,b){if(Ra(this,a))this.Gf[a>>>17](a,b);else this.da[a]=b,this.da[a+1|0]=b>>8,this.da[a+2|0]=b>>16,this.da[a+3|0]=b>>24};function Ac(a,b,c){Ra(a,b<<2)?(b<<=2,a.Gf[b>>>17](b,c)):a.Cc[b]=c}
+function Bc(a){this.j=a;this.v=new Uint8Array(8);this.C=new Uint8Array(8);this.a=new Uint16Array(8);this.l=new Uint16Array(8);this.g=new Uint16Array(8);this.m=new Uint16Array(8);this.vc=new Uint8Array(8);this.J=new Uint8Array(8);this.Wf=[];this.i=0;a=a.o;n(a,0,this,this.Xc.bind(this,0));n(a,2,this,this.Xc.bind(this,1));n(a,4,this,this.Xc.bind(this,2));n(a,6,this,this.Xc.bind(this,3));n(a,1,this,this.Zc.bind(this,0));n(a,3,this,this.Zc.bind(this,1));n(a,5,this,this.Zc.bind(this,2));n(a,7,this,this.Zc.bind(this,
+3));m(a,0,this,this.Wc.bind(this,0));m(a,2,this,this.Wc.bind(this,1));m(a,4,this,this.Wc.bind(this,2));m(a,6,this,this.Wc.bind(this,3));m(a,1,this,this.Yc.bind(this,0));m(a,3,this,this.Yc.bind(this,1));m(a,5,this,this.Yc.bind(this,2));m(a,7,this,this.Yc.bind(this,3));n(a,192,this,this.Xc.bind(this,4));n(a,196,this,this.Xc.bind(this,5));n(a,200,this,this.Xc.bind(this,6));n(a,204,this,this.Xc.bind(this,7));n(a,194,this,this.Zc.bind(this,4));n(a,198,this,this.Zc.bind(this,5));n(a,202,this,this.Zc.bind(this,
+6));n(a,206,this,this.Zc.bind(this,7));m(a,192,this,this.Wc.bind(this,4));m(a,196,this,this.Wc.bind(this,5));m(a,200,this,this.Wc.bind(this,6));m(a,204,this,this.Wc.bind(this,7));m(a,194,this,this.Yc.bind(this,4));m(a,198,this,this.Yc.bind(this,5));m(a,202,this,this.Yc.bind(this,6));m(a,206,this,this.Yc.bind(this,7));n(a,135,this,this.ad.bind(this,0));n(a,131,this,this.ad.bind(this,1));n(a,129,this,this.ad.bind(this,2));n(a,130,this,this.ad.bind(this,3));n(a,143,this,this.ad.bind(this,4));n(a,139,
+this,this.ad.bind(this,5));n(a,137,this,this.ad.bind(this,6));n(a,138,this,this.ad.bind(this,7));m(a,135,this,this.$c.bind(this,0));m(a,131,this,this.$c.bind(this,1));m(a,129,this,this.$c.bind(this,2));m(a,130,this,this.$c.bind(this,3));m(a,143,this,this.$c.bind(this,4));m(a,139,this,this.$c.bind(this,5));m(a,137,this,this.$c.bind(this,6));m(a,138,this,this.$c.bind(this,7));n(a,1159,this,this.Cd.bind(this,0));n(a,1155,this,this.Cd.bind(this,1));n(a,1153,this,this.Cd.bind(this,2));n(a,1154,this,this.Cd.bind(this,
+3));n(a,1163,this,this.Cd.bind(this,5));n(a,1161,this,this.Cd.bind(this,6));n(a,1162,this,this.Cd.bind(this,7));m(a,1159,this,this.Bd.bind(this,0));m(a,1155,this,this.Bd.bind(this,1));m(a,1153,this,this.Bd.bind(this,2));m(a,1154,this,this.Bd.bind(this,3));m(a,1163,this,this.Bd.bind(this,5));m(a,1161,this,this.Bd.bind(this,6));m(a,1162,this,this.Bd.bind(this,7));n(a,10,this,this.rh.bind(this,0));n(a,212,this,this.rh.bind(this,4));n(a,15,this,this.qh.bind(this,0));n(a,222,this,this.qh.bind(this,4));
+m(a,15,this,this.ph.bind(this,0));m(a,222,this,this.ph.bind(this,4));n(a,11,this,this.oh.bind(this,0));n(a,214,this,this.oh.bind(this,4));n(a,12,this,this.nh);n(a,216,this,this.nh)}k=Bc.prototype;k.Sa=function(){return[this.v,this.C,this.a,this.l,this.g,this.m,this.vc,this.J,this.i]};k.fb=function(a){this.v=a[0];this.C=a[1];this.a=a[2];this.l=a[3];this.g=a[4];this.m=a[5];this.vc=a[6];this.J=a[7];this.i=a[8]};k.Zc=function(a,b){this.g[a]=Cc(this,this.g[a],b,!1);this.m[a]=Cc(this,this.m[a],b,!0)};
+k.Yc=function(a){return Dc(this,this.g[a])};k.Xc=function(a,b){this.a[a]=Cc(this,this.a[a],b,!1);this.l[a]=Cc(this,this.l[a],b,!0)};k.Wc=function(a){return Dc(this,this.a[a])};k.Cd=function(a,b){this.C[a]=b};k.Bd=function(a){return this.C[a]};k.ad=function(a,b){this.v[a]=b};k.$c=function(a){return this.v[a]};k.rh=function(a,b){Ec(this,(b&3)+a,b&4?1:0)};k.qh=function(a,b){for(var c=0;4>c;c++)Ec(this,a+c,b&1<<c)};
+k.ph=function(a){var b=0|this.vc[a+0];b|=this.vc[a+1]<<1;b|=this.vc[a+2]<<2;return b|this.vc[a+3]<<3};k.oh=function(a,b){this.J[(b&3)+a]=b};k.nh=function(){this.i=0};function Ec(a,b,c){if(a.vc[b]!==c&&(a.vc[b]=c,!c))for(c=0;c<a.Wf.length;c++)a.Wf[c].wf.call(a.Wf[c].xg,b)}function uc(a,b,c,d){var e=a.g[2]+1,f=Fc(a,2);if(c+e>b.byteLength)d(!0);else{var h=a.j;a.a[2]+=e;b.get(c,e,function(a){h.da.set(a,f);d(!1)})}}
+k.Me=function(a,b,c,d,e){var f=this,h=this.g[d]+1&65535,g=5<=d?2:1,p=h*g,r=Fc(this,d),v=!1,E=!1,z=this.J[d]&16;c<p?(h=Math.floor(c/g),p=h*g,v=!0):c>p&&(E=!0);b+p>a.byteLength?e(!0):(this.a[d]+=h,this.g[d]-=h,!v&&z&&(this.a[d]=this.l[d],this.g[d]=this.m[d]),a.set(b,this.j.da.subarray(r,r+p),function(){E&&z?f.Me(a,b+p,c-p,d,e):e(!1)}))};function Fc(a,b){var c=a.a[b];5<=b&&(c<<=1);c=c&65535|a.v[b]<<16;return c|a.C[b]<<24}function Cc(a,b,c,d){d||(a.i^=1);return a.i?b&-256|c:b&-65281|c<<8}
+function Dc(a,b){a.i^=1;return a.i?b&255:b>>8&255}
+function Ic(a,b){this.j=a;this.w=b;this.m=new Float64Array(3);this.v=new Uint16Array(3);this.g=new Uint8Array(4);this.l=new Uint8Array(4);this.i=new Uint8Array(4);this.O=new Uint8Array(4);this.C=new Uint8Array(4);this.J=new Uint16Array(3);this.a=new Uint16Array(3);m(a.o,97,this,function(){var a=$a(),b=66.66666666666667*a&1;a=Jc(this,2,a);return b<<4|a<<5});n(a.o,97,this,function(a){this.w.send("pcspeaker-enable",a&1)});m(a.o,64,this,function(){return Kc(this,0)});m(a.o,65,this,function(){return Kc(this,
+1)});m(a.o,66,this,function(){return Kc(this,2)});n(a.o,64,this,function(a){Lc(this,0,a)});n(a.o,65,this,function(a){Lc(this,1,a)});n(a.o,66,this,function(a){Lc(this,2,a)});n(a.o,67,this,this.R)}Ic.prototype.Sa=function(){var a=[];a[0]=this.g;a[1]=this.l;a[2]=this.i;a[3]=this.O;a[4]=this.C;a[5]=this.J;a[6]=this.a;a[7]=this.m;a[8]=this.v;return a};Ic.prototype.fb=function(a){this.g=a[0];this.l=a[1];this.i=a[2];this.O=a[3];this.C=a[4];this.J=a[5];this.a=a[6];this.m=a[7];this.v=a[8]};
+Ic.prototype.Ic=function(a,b){b||(this.l[0]&&Jc(this,0,a)?(this.v[0]=Mc(this,0,a),this.m[0]=a,this.j.Cb(0),0===this.i[0]&&(this.l[0]=0)):Pb(this.j,0))};function Mc(a,b,c){if(!a.l[b])return 0;c=a.v[b]-Math.floor(1193.1816666*(c-a.m[b]));a=a.a[b];c>=a?c%=a:0>c&&(c=c%a+a);return c}function Jc(a,b,c){c-=a.m[b];return 0>c?!0:a.v[b]<Math.floor(1193.1816666*c)}
+function Kc(a,b){var c=a.C[b];if(c)return a.C[b]--,2===c?a.J[b]&255:a.J[b]>>8;c=a.g[b];3===a.i[b]&&(a.g[b]^=1);a=Mc(a,b,$a());return c?a&255:a>>8}function Lc(a,b,c){a.a[b]=a.g[b]?a.a[b]&-256|c:a.a[b]&255|c<<8;3===a.O[b]&&a.g[b]||(a.a[b]||(a.a[b]=65535),a.v[b]=a.a[b],a.l[b]=!0,a.m[b]=$a());3===a.O[b]&&(a.g[b]^=1);a.w.send("pcspeaker-update",[a.i[2],a.a[2]])}
+Ic.prototype.R=function(a){var b=a>>1&7,c=a>>6&3;a=a>>4&3;3!==c&&(0===a?(this.C[c]=2,b=Mc(this,c,$a()),this.J[c]=b?b-1:0):(6<=b&&(b&=-5),this.g[c]=1===a?0:1,0===c&&Pb(this.j,0),this.i[c]=b,this.O[c]=a,this.w.send("pcspeaker-update",[this.i[2],this.a[2]])))};var Nc=Uint32Array.from([655360,655360,720896,753664]),Oc=Uint32Array.from([131072,65536,32768,32768]);
+function Pc(a,b,c){var d=this;this.w=b;this.Ja=c;this.J=0;this.Ae=14;this.Be=15;this.R=80;this.Rd=25;this.Wg=this.sb=this.Pe=this.Fa=0;this.Bc=[];this.Re=this.Ua=0;this.qc=new Uint8Array(25);this.v=this.W=this.Ne=this.Z=this.a=this.i=this.uc=this.Jc=this.ab=0;this.Ce=!0;this.Wa=!1;setTimeout(function(){b.send("screen-set-mode",d.Wa)},0);this.Jb=new Int32Array(256);this.C=this.rb=this.g=0;this.ob=!1;this.Hc=32;this.kg=this.dc=0;this.pe=[222,16,32,10,7,0,0,0,162,0,0,3,0,0,128,0,8,14680064,57344,224,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,1,0,0];this.Hb=144;this.nc=[{size:c}];this.fh=65536;this.Ei=4272947200;this.name="vga";this.Oa={lg:!1,jk:0,kk:0,Ag:0};this.Ya=this.rc=this.Xa=this.O=0;this.Je=new Uint8Array(16);this.m=-1;this.Sd=32;this.hd=this.Qd=this.ce=this.tb=0;this.Vd=-1;this.Ud=15;this.pc=this.Wd=0;this.tc=-1;this.cc=this.Dc=this.He=0;this.Ee=255;this.qa=this.oa=this.ka=this.Bb=this.Fe=this.Td=0;this.l=this.yf=255;c=a.o;n(c,960,this,this.tj);
+m(c,960,this,this.kh,this.sj);m(c,961,this,this.lh);n(c,962,this,this.uj);c.Gc(964,this,this.wj,this.yj);m(c,964,this,this.vj);m(c,965,this,this.xj);c.Gc(974,this,this.Hj,this.Jj);m(c,974,this,this.Gj);m(c,975,this,this.Ij);n(c,967,this,this.Aj);m(c,967,this,this.zj);n(c,968,this,this.Cj);m(c,968,this,this.Bj);n(c,969,this,this.Ej);m(c,969,this,this.Dj);m(c,972,this,this.Fj);c.Gc(980,this,this.Lj,this.Nj);m(c,980,this,this.Kj);m(c,981,this,this.Mj);m(c,970,this,function(){return 0});m(c,986,this,
+this.mh);m(c,954,this,this.mh);this.sc=-1;this.Za=0;n(c,462,this,void 0,this.Gi);n(c,463,this,void 0,this.Ii);m(c,463,this,void 0,this.Hi);void 0===this.Ja||786432>this.Ja?this.Ja=786432:this.Ja&65535&&(this.Ja|=65535,this.Ja++);this.ya=new Uint8Array(this.Ja);this.hb=this.Ja;this.bb=0;this.ge=this.Ja;this.fe=0;this.ee=void 0;b.register("screen-tell-buffer",function(a){this.ee&&a[0]&&a[0].set(this.ee.subarray(0,a[0].length));this.ee=a[0]},this);b.register("screen-fill-buffer",function(){if(this.Wa&&
+this.ee)if(this.bb<this.hb&&this.fe<this.ge)this.w.send("screen-fill-buffer-end",this.Bc);else{if(this.ob){var a=this.ee,b=this.hb,c=this.bb;switch(this.Hc){case 32:var e=b>>2,d=(c>>2)+1;for(b=e;b<d;b++)c=this.Ih[b],a[b]=c<<16|c>>16&255|c&65280|4278190080;break;case 24:e=b/3|0;d=(c/3|0)+1;var v=3*e;for(b=e;v<c;b++){var E=this.ya[v++],z=this.ya[v++],A=this.ya[v++];a[b]=E<<16|z<<8|A|4278190080}break;case 16:e=b>>1;d=(c>>1)+1;for(b=e;b<d;b++)c=this.pk[b],A=255*(c>>11)/31|0,z=255*(c>>5&63)/63|0,E=255*
+(c&31)/31|0,a[b]=E<<16|z<<8|A|4278190080;break;case 8:for(e=b,d=c+1;b<=c;b++)z=this.Jb[this.ya[b]],a[b]=z&65280|z<<16|z>>16|4278190080}a=e/this.rb|0;this.w.send("screen-fill-buffer-end",[{ug:0,vg:a,qf:0,rf:a,ag:this.rb,$f:(d/this.rb|0)-a+1}])}else{d=Math.min(this.fe|15,524287);a=Qc(this);e=~this.ab&3;b=this.Dc&96;c=this.tb&64;for(z=this.ge&-16;z<=d;){var M=z>>>a;if(e){A=z/this.sb|0;v=z-this.sb*A;switch(e){case 1:M=(A&1)<<13;A>>>=1;break;case 2:M=(A&1)<<14;A>>>=1;break;case 3:M=(A&3)<<13,A>>>=2}M|=
+(A*this.sb+v>>>a)+this.Ua}A=this.Kf[M];v=this.Lf[M];E=this.Mf[M];var ka=this.Nf[M];M=new Uint8Array(8);switch(b){case 0:A<<=0;v<<=1;E<<=2;ka<<=3;for(var Y=7;0<=Y;Y--)M[7-Y]=A>>Y&1|v>>Y&2|E>>Y&4|ka>>Y&8;break;case 32:M[0]=A>>6&3|E>>4&12;M[1]=A>>4&3|E>>2&12;M[2]=A>>2&3|E>>0&12;M[3]=A>>0&3|E<<2&12;M[4]=v>>6&3|ka>>4&12;M[5]=v>>4&3|ka>>2&12;M[6]=v>>2&3|ka>>0&12;M[7]=v>>0&3|ka<<2&12;break;case 64:case 96:M[0]=A>>4&15,M[1]=A>>0&15,M[2]=v>>4&15,M[3]=v>>0&15,M[4]=E>>4&15,M[5]=E>>0&15,M[6]=ka>>4&15,M[7]=ka>>
+0&15}if(c)for(A=Y=0;4>Y;Y++,z++,A+=2)this.Jf[z]=M[A]<<4|M[A+1];else for(Y=0;8>Y;Y++,z++)this.Jf[z]=M[Y]}c=this.hb;d=Math.min(this.bb,524287);if(a=this.ee)if(e=255,b=0,this.tb&128&&(e&=207,b|=this.hd<<4&48),this.tb&64)for(;c<=d;c++)z=this.Jf[c]&e|b,z=this.Jb[z],a[c]=z&65280|z<<16|z>>16|4278190080;else for(e&=63,b|=this.hd<<4&192;c<=d;c++)z=this.Je[this.Jf[c]&this.ce]&e|b,z=this.Jb[z],a[c]=z&65280|z<<16|z>>16|4278190080;this.w.send("screen-fill-buffer-end",this.Bc)}this.hb=this.Ja;this.bb=0;this.ge=
+this.Ja;this.fe=0}Rc(this)},this);this.pk=new Uint16Array(this.ya.buffer);this.Ih=new Int32Array(this.ya.buffer);this.Xd=new Uint8Array(this.ya.buffer,0,262144);this.Kf=new Uint8Array(this.ya.buffer,0,65536);this.Lf=new Uint8Array(this.ya.buffer,65536,65536);this.Mf=new Uint8Array(this.ya.buffer,131072,65536);this.Nf=new Uint8Array(this.ya.buffer,196608,65536);this.Jf=new Uint8Array(this.ya.buffer,262144,524288);var e=this;Pa(c,655360,131072,function(a){return Sc(e,a)},function(a,b){if(e.ob&&e.Wa&&
+e.Ce){var c=a-655360|e.dc;e.hb=c<e.hb?c:e.hb;e.bb=c>e.bb?c:e.bb;e.ya[c]=b}else{var d=e.Bb>>2&3;a-=Nc[d];if(!(0>a||a>=Oc[d]))if(e.Wa){var f=b;b=Tc(e.Ee);var h=Uc(e.Td);d=Uc(e.Fe);switch(e.Dc&3){case 0:f=(f|f<<8)>>>(e.cc&7)&255;c=Tc(f);f=Uc(e.Td);c=Vc(e,(c|d&f)&(~d|f),e.g);c=b&c|~b&e.g;break;case 1:c=e.g;break;case 2:c=Uc(f);c=Vc(e,c,e.g);c=b&c|~b&e.g;break;case 3:f=(f|f<<8)>>>(e.cc&7)&255,b&=Tc(f),c=b&h|~b&e.g}b=15;switch(e.Wd&12){case 0:b=5<<(a&1);a&=-2;break;case 8:case 12:b=1<<(a&3),a&=-4}b&=e.Ud;
+b&1&&(e.Kf[a]=c>>0&255);b&2&&(e.Lf[a]=c>>8&255);b&4&&(e.Mf[a]=c>>16&255);b&8&&(e.Nf[a]=c>>24&255);b=Wc(e,a);c=b+7;b<e.ge&&(e.ge=b);c>e.fe&&(e.fe=c);b<e.hb&&(e.hb=b);c>e.bb&&(e.bb=c)}else e.Ud&3&&(c=a,d=(c>>1)-e.Ua,a=d/e.R|0,d%=e.R,c&1?(h=b,f=e.Xd[c&-2]):(f=b,h=e.Xd[c|1]),e.w.send("screen-put-char",[a,d,f,e.Jb[h>>4&15],e.Jb[h&15]]),e.Xd[c]=b)}});Pa(c,3758096384,this.Ja,function(a){return e.ya[a&268435455]},function(a,b){a&=268435455;e.ya[a]=b;e.hb=a<e.hb?a:e.hb;e.bb=a>e.bb?a:e.bb},function(a){a&=268435455;
+return a&3?e.ya[a]|e.ya[a+1]<<8|e.ya[a+2]<<16|e.ya[a+3]<<24:e.Ih[a>>2]},function(a,b){a&=268435455;e.hb=a<e.hb?a:e.hb;e.bb=a+3>e.bb?a+3:e.bb;e.ya[a]=b;e.ya[a+1]=b>>8;e.ya[a+2]=b>>16;e.ya[a+3]=b>>24});Zb(a.G.wb,this)}k=Pc.prototype;
+k.Sa=function(){var a=[];a[0]=this.Ja;a[1]=this.J;a[2]=this.Ae;a[3]=this.Be;a[4]=this.R;a[5]=this.Rd;a[6]=this.Bc;a[7]=this.Ya;a[8]=this.Ua;a[9]=this.Wa;a[10]=this.Jb;a[11]=this.g;a[12]=this.ka;a[13]=this.oa;a[14]=this.Bb;a[15]=this.rb;a[16]=this.C;a[17]=this.ab;a[18]=this.ob;a[19]=this.Hc;a[20]=this.dc;a[21]=this.kg;a[22]=this.O;a[23]=this.Xa;a[24]=this.rc;a[25]=this.Je;a[26]=this.Vd;a[27]=this.Ud;a[28]=this.Wd;a[29]=this.tc;a[30]=this.He;a[31]=this.Dc;a[32]=this.cc;a[33]=this.Ee;a[34]=this.qa;a[35]=
+this.yf;a[36]=this.l;a[37]=this.sc;a[38]=this.Za;a[39]=this.ya;a[40]=this.Ce;a[41]=this.m;a[42]=this.W;a[43]=this.Td;a[44]=this.Fe;a[45]=this.Re;a[46]=this.qc;a[47]=this.Jc;a[48]=this.uc;a[49]=this.i;a[50]=this.a;a[51]=this.Z;a[52]=this.Ne;a[53]=this.W;a[54]=this.Sd;a[55]=this.tb;a[56]=this.ce;a[57]=this.Qd;a[58]=this.hd;a[59]=this.pc;a[60]=this.v;return a};
+k.fb=function(a){this.Ja=a[0];this.J=a[1];this.Ae=a[2];this.Be=a[3];this.R=a[4];this.Rd=a[5];this.Bc=a[6];this.Ya=a[7];this.Ua=a[8];this.Wa=a[9];this.Jb=a[10];this.g=a[11];this.ka=a[12];this.oa=a[13];this.Bb=a[14];this.rb=a[15];this.C=a[16];this.ab=a[17];this.ob=a[18];this.Hc=a[19];this.dc=a[20];this.kg=a[21];this.O=a[22];this.Xa=a[23];this.rc=a[24];this.Je=a[25];this.Vd=a[26];this.Ud=a[27];this.Wd=a[28];this.tc=a[29];this.He=a[30];this.Dc=a[31];this.cc=a[32];this.Ee=a[33];this.qa=a[34];this.yf=a[35];
+this.l=a[36];this.sc=a[37];this.Za=a[38];this.ya.set(a[39]);this.Ce=a[40];this.m=a[41];this.W=a[42];this.Td=a[43];this.Fe=a[44];this.Re=a[45];this.qc.set(a[46]);this.Jc=a[47];this.uc=a[48];this.i=a[49];this.a=a[50];this.Z=a[51];this.Ne=a[52];this.W=a[53];this.Sd=a[54];this.tb=a[55];this.ce=a[56];this.Qd=a[57];this.hd=a[58];this.pc=a[59];this.v=a[60];this.w.send("screen-set-mode",this.Wa);this.Wa?(this.Pe=this.Fa=0,this.ob?(this.Id(this.rb,this.C,this.Hc,this.rb,this.C),Xc(this)):(Yc(this),Zc(this))):
+(this.Jd(this.R,this.Rd),this.Od(),this.Nd());$c(this)};function Sc(a,b){if(a.ob&&a.Ce)return b=b-655360|a.dc,a.ya[b];var c=a.Bb>>2&3;b-=Nc[c];if(0>b||b>=Oc[c])return 0;a.g=a.Kf[b];a.g|=a.Lf[b]<<8;a.g|=a.Mf[b]<<16;a.g|=a.Nf[b]<<24;if(a.Dc&8)return c=255,a.oa&1&&(c&=a.Kf[b]^~(a.ka&1?255:0)),a.oa&2&&(c&=a.Lf[b]^~(a.ka&2?255:0)),a.oa&4&&(c&=a.Mf[b]^~(a.ka&4?255:0)),a.oa&8&&(c&=a.Nf[b]^~(a.ka&8?255:0)),c;c=a.He;a.Wa?a.Wd&8?(c=b&3,b&=-4):a.Dc&16&&(c=b&1,b&=-2):c=0;return a.Xd[c<<16|b]}
+function Tc(a){return a|a<<8|a<<16|a<<24}function Uc(a){return(a&1?255:0)|(a&2?255:0)<<8|(a&4?255:0)<<16|(a&8?255:0)<<24}function Vc(a,b,c){switch(a.cc&24){case 8:return b&c;case 16:return b|c;case 24:return b^c}return b}function ad(a){for(var b=a.Ua<<1,c,d,e=0;e<a.Rd;e++)for(var f=0;f<a.R;f++)c=a.Xd[b],d=a.Xd[b|1],a.w.send("screen-put-char",[e,f,c,a.Jb[d>>4&15],a.Jb[d&15]]),b+=2}
+k.Nd=function(){var a=(this.J-this.Ua)/this.R|0,b=(this.J-this.Ua)%this.R;a=Math.min(this.Rd-1,a);this.w.send("screen-update-cursor",[a,b])};function $c(a){a.Wa?(a.hb=0,a.ob?a.bb=a.Ja:a.bb=524288):ad(a)}function Zc(a){a.Wa&&!a.ob&&(a.ge=0,a.fe=524288,$c(a))}k.Mb=function(){};function Qc(a){var b=128+(~a.Z&a.ab&64);b-=a.Z&64;b-=a.tb&64;return b>>>6}
+function Wc(a,b){var c=Qc(a);if(~a.ab&3){var d=b-a.Ua;d&=a.ab<<13|-24577;d<<=c;var e=d/a.sb|0;d%=a.sb;switch(a.ab&3){case 2:e=e<<1|b>>13&1;break;case 1:e=e<<1|b>>14&1;break;case 0:e=e<<2|b>>13&3}return e*a.sb+d+(a.Ua<<c)}return b<<c}function bd(a,b){a.qa&128&&(b>>>=1);b=Math.ceil(b/(1+(a.qa&31)));a.ab&1||(b<<=1);a.ab&2||(b<<=1);return b}k.Jd=function(a,b){this.R=a;this.Rd=b;this.w.send("screen-set-size-text",[a,b])};
+k.Id=function(a,b,c,d,e){this.Oa.lg&&this.Oa.Ag===c&&this.Fa===a&&this.Pe===b&&this.sb===d&&this.Wg===e||(this.Fa=a,this.Pe=b,this.sb=d,this.Wg=e,this.Oa.Ag=c,this.Oa.lg=!0,this.Oa.jk=a,this.Oa.kk=b,this.w.send("screen-set-size-graphical",[a,b,d,e,c]))};
+function Yc(a){if(!a.ob){var b=Math.min(1+a.Jc,a.uc),c=Math.min(1+a.i,a.a);if(b&&c)if(a.Wa){b<<=3;var d=a.W<<4;a.tb&64&&(b>>>=1,d>>>=1);var e=a.W<<2;a.Z&64?e<<=1:a.ab&64&&(e>>>=1);a.Id(b,bd(a,c),8,d,Math.ceil(Oc[0]/e));Rc(a);Xc(a)}else a.qa&128&&(c>>>=1),c=c/(1+(a.qa&31))|0,b&&c&&a.Jd(b,c)}}
+function Xc(a){a.Wa||ad(a);if(a.ob)a.Bc=[];else if(a.sb&&a.Fa)if(!a.Sd||a.pc&32)a.Bc=[],a.w.send("screen-clear");else{var b=a.Re,c=a.Qd;a.tb&64&&(c>>>=1);var d=a.Ne>>5&3,e=Wc(a,b+d);b=e/a.sb|0;var f=e%a.sb+c;e=bd(a,1+a.v);e=Math.min(e,a.Pe);var h=a.Pe-e;a.Bc=[];f=-f;for(var g=0;f<a.Fa;f+=a.sb,g++)a.Bc.push({ug:f,vg:0,qf:0,rf:b+g,ag:a.sb,$f:e});b=0;a.tb&32||(b=Wc(a,d)+c);f=-b;for(g=0;f<a.Fa;f+=a.sb,g++)a.Bc.push({ug:f,vg:e,qf:0,rf:g,ag:a.sb,$f:h})}}
+function Rc(a){a.l|=8;a.Re!==a.Ua&&(a.Re=a.Ua,Xc(a))}k.Od=function(){this.w.send("screen-update-cursor-scanline",[this.Ae,this.Be])};
+k.tj=function(a){if(-1===this.m)this.m=a&31,this.Sd!==(a&32)&&(this.Sd=a&32,Xc(this));else{if(16>this.m)this.Je[this.m]=a,this.tb&64||$c(this);else switch(this.m){case 16:if(this.tb!==a){var b=this.tb;this.tb=a;var c=0<(a&1);this.ob||this.Wa===c||(this.Wa=c,this.w.send("screen-set-mode",this.Wa));(b^a)&64&&Zc(this);Yc(this);$c(this)}break;case 18:this.ce!==a&&(this.ce=a,$c(this));break;case 19:this.Qd!==a&&(this.Qd=a&15,Xc(this));break;case 20:this.hd!==a&&(this.hd=a,$c(this))}this.m=-1}};
+k.kh=function(){return this.m|this.Sd};k.sj=function(){return this.kh()&255|this.lh()<<8&65280};k.lh=function(){if(16>this.m)return this.Je[this.m];switch(this.m){case 16:return this.tb;case 18:return this.ce;case 19:return this.Qd;case 20:return this.hd}return-1};k.uj=function(a){this.yf=a};k.wj=function(a){this.Vd=a};k.vj=function(){return this.Vd};k.yj=function(a){switch(this.Vd){case 1:var b=this.pc;this.pc=a;(b^a)&32&&Xc(this);break;case 2:this.Ud=a;break;case 4:this.Wd=a}};
+k.xj=function(){switch(this.Vd){case 1:return this.pc;case 2:return this.Ud;case 4:return this.Wd;case 6:return 18}return 0};k.Aj=function(a){this.rc=3*a;this.Ya&=0};k.zj=function(){return this.Ya};k.Cj=function(a){this.Xa=3*a;this.Ya|=3};k.Bj=function(){return this.Xa/3|0};k.Ej=function(a){var b=this.Xa/3|0,c=this.Xa%3,d=this.Jb[b];a=255*(a&63)/63|0;d=0===c?d&-16711681|a<<16:1===c?d&-65281|a<<8:d&-256|a;this.Jb[b]!==d&&(this.Jb[b]=d,$c(this));this.Xa++};
+k.Dj=function(){var a=this.rc%3,b=this.Jb[this.rc/3|0];this.rc++;return(b>>8*(2-a)&255)/255*63|0};k.Fj=function(){return this.yf};k.Hj=function(a){this.tc=a};k.Gj=function(){return this.tc};k.Jj=function(a){switch(this.tc){case 0:this.Td=a;break;case 1:this.Fe=a;break;case 2:this.ka=a;break;case 3:this.cc=a;break;case 4:this.He=a;break;case 5:var b=this.Dc;this.Dc=a;(b^a)&96&&Zc(this);break;case 6:this.Bb!==a&&(this.Bb=a,Yc(this));break;case 7:this.oa=a;break;case 8:this.Ee=a}};
+k.Ij=function(){switch(this.tc){case 0:return this.Td;case 1:return this.Fe;case 2:return this.ka;case 3:return this.cc;case 4:return this.He;case 5:return this.Dc;case 6:return this.Bb;case 7:return this.oa;case 8:return this.Ee}return 0};k.Lj=function(a){this.O=a};k.Kj=function(){return this.O};
+k.Nj=function(a){switch(this.O){case 1:this.Jc!==a&&(this.Jc=a,Yc(this));break;case 2:this.uc!==a&&(this.uc=a,Yc(this));break;case 7:var b=this.i;this.i&=255;this.i=this.i|a<<3&512|a<<7&256;b!=this.i&&Yc(this);this.v=this.v&767|a<<4&256;b=this.a;this.a=this.a&767|a<<5&256;b!==this.a&&Yc(this);Xc(this);break;case 8:this.Ne=a;Xc(this);break;case 9:this.qa=a;this.v=this.v&511|a<<3&512;b=this.a;this.a=this.a&511|a<<4&512;b!==this.a&&Yc(this);Xc(this);break;case 10:this.Ae=a;this.Od();break;case 11:this.Be=
+a;this.Od();break;case 12:(this.Ua>>8&255)!==a&&(this.Ua=this.Ua&255|a<<8,Xc(this),~this.ab&3&&Zc(this));break;case 13:(this.Ua&255)!==a&&(this.Ua=this.Ua&65280|a,Xc(this),~this.ab&3&&Zc(this));break;case 14:this.J=this.J&255|a<<8;this.Nd();break;case 15:this.J=this.J&65280|a;this.Nd();break;case 18:(this.i&255)!==a&&(this.i=this.i&768|a,Yc(this));break;case 19:this.W!==a&&(this.W=a,Yc(this),~this.ab&3&&Zc(this));break;case 20:this.Z!==a&&(b=this.Z,this.Z=a,Yc(this),(b^a)&64&&Zc(this));break;case 21:(this.a&
+255)!==a&&(this.a=this.a&768|a,Yc(this));break;case 23:this.ab!==a&&(b=this.ab,this.ab=a,Yc(this),(b^a)&67&&Zc(this));break;case 24:this.v=this.v&768|a;Xc(this);break;default:this.O<this.qc.length&&(this.qc[this.O]=a)}};
+k.Mj=function(){switch(this.O){case 1:return this.Jc;case 2:return this.uc;case 7:return this.i>>7&2|this.a>>5&8|this.v>>4&16|this.i>>3&64;case 8:return this.Ne;case 9:return this.qa;case 10:return this.Ae;case 11:return this.Be;case 12:return this.Ua&255;case 13:return this.Ua>>8;case 14:return this.J>>8;case 15:return this.J&255;case 18:return this.i&255;case 19:return this.W;case 20:return this.Z;case 21:return this.a&255;case 23:return this.ab;case 24:return this.v&255}return this.O<this.qc.length?
+this.qc[this.O]:0};k.mh=function(){var a=this.l;this.Wa?(this.l^=1,this.l&=1):(this.l&1&&(this.l^=8),this.l^=1);this.m=-1;return a};k.Gi=function(a){this.sc=a};
+k.Ii=function(a){switch(this.sc){case 1:this.rb=a;2560<this.rb&&(this.rb=2560);break;case 2:this.C=a;1600<this.C&&(this.C=1600);break;case 3:this.Hc=a;break;case 4:this.ob=1===(a&1);this.Za=a;break;case 5:this.dc=a<<16;break;case 9:this.kg=this.rb*(15===this.Hc?16:this.Hc)/8*a,$c(this)}!this.ob||this.rb&&this.C||(this.ob=!1);this.ob&&4===this.sc&&(this.Id(this.rb,this.C,this.Hc,this.rb,this.C),this.w.send("screen-set-mode",!0),this.Ce=this.Wa=!0);this.ob||(this.dc=0);Xc(this)};
+k.Hi=function(){return cd(this,this.sc)};function cd(a,b){switch(b){case 0:return 45248;case 1:return a.Za&2?2560:a.rb;case 2:return a.Za&2?1600:a.C;case 3:return a.Za&2?32:a.Hc;case 4:return a.Za;case 5:return a.dc>>>16;case 6:return a.Fa?a.Fa:1;case 8:return 0;case 10:return a.Ja/65536|0}return 255}
+function dd(a,b){this.j=a;this.w=b;this.ed=this.Nc=!1;this.Ue=!0;this.xd=this.lc=this.kc=0;this.qa=!0;this.W=this.R=this.C=this.O=this.Z=this.J=this.Oe=!1;this.ra=new ob(1024);this.i=0;this.cd=100;this.ue=4;this.m=!1;this.a=new ob(1024);this.v=this.l=!1;this.w.register("keyboard-code",function(a){this.Oe&&(this.ra.push(a),this.xb())},this);this.w.register("mouse-click",function(a){this.Ue&&this.ed&&(this.xd=a[0]|a[2]<<1|a[1]<<2,this.Nc&&ed(this,0,0))},this);this.w.register("mouse-delta",function(a){var b=
+a[1];if(this.Ue&&this.ed){var c=this.ue*this.cd/80;this.kc+=a[0]*c;this.lc+=b*c;this.Nc&&(a=this.kc|0,b=this.lc|0,a||b)&&(this.kc-=a,this.lc-=b,ed(this,a,b))}},this);this.w.register("mouse-wheel",function(){},this);this.g=5;this.ka=this.oa=!1;m(a.o,96,this,this.ak);m(a.o,100,this,this.ck);n(a.o,96,this,this.bk);n(a.o,100,this,this.dk)}k=dd.prototype;
+k.Sa=function(){var a=[];a[0]=this.Nc;a[1]=this.ed;a[2]=this.Ue;a[3]=this.kc;a[4]=this.lc;a[5]=this.xd;a[6]=this.qa;a[7]=this.Oe;a[8]=this.J;a[9]=this.Z;a[10]=this.O;a[11]=this.C;a[12]=this.R;a[13]=this.W;a[15]=this.i;a[16]=this.cd;a[17]=this.ue;a[18]=this.m;a[20]=this.g;a[21]=this.oa;a[22]=this.ka;return a};
+k.fb=function(a){this.Nc=a[0];this.ed=a[1];this.Ue=a[2];this.kc=a[3];this.lc=a[4];this.xd=a[5];this.qa=a[6];this.Oe=a[7];this.J=a[8];this.Z=a[9];this.O=a[10];this.C=a[11];this.R=a[12];this.W=a[13];this.i=a[15];this.cd=a[16];this.ue=a[17];this.m=a[18];this.g=a[20];this.oa=a[21];this.ka=a[22];this.v=this.l=!1;this.ra.clear();this.a.clear();this.w.send("mouse-enable",this.ed)};k.xb=function(){this.l||(this.ra.length?fd(this):this.a.length&&gd(this))};
+function gd(a){a.l=!0;a.v=!0;a.g&2&&(Pb(a.j,12),a.j.Cb(12))}function fd(a){a.l=!0;a.v=!1;a.g&1&&(Pb(a.j,1),a.j.Cb(1))}function ed(a,b,c){a.a.push((0>c)<<5|(0>b)<<4|8|a.xd);a.a.push(b);a.a.push(c);a.xb()}k.ak=function(){this.l=!1;if(!this.ra.length&&!this.a.length)return this.i;this.v?(Pb(this.j,12),this.i=this.a.shift()):(Pb(this.j,1),this.i=this.ra.shift());(this.ra.length||this.a.length)&&this.xb();return this.i};k.ck=function(){var a=16;this.l&&(a|=1);this.v&&(a|=32);return a};
+k.bk=function(a){if(this.ka)this.g=a,this.ka=!1;else if(this.oa)this.oa=!1,this.a.clear(),this.a.push(a),gd(this);else if(this.Z)this.Z=!1,this.a.clear(),this.a.push(250),(this.cd=a)||(this.cd=100),gd(this);else if(this.W)this.W=!1,this.a.clear(),this.a.push(250),this.ue=3<a?4:1<<a,gd(this);else if(this.O)this.O=!1,this.ra.push(250),fd(this);else if(this.C)this.C=!1,this.ra.push(250),fd(this),a||this.ra.push(2);else if(this.R)this.R=!1,this.ra.push(250),fd(this);else if(this.J){if(this.J=!1,this.Ue){this.ra.clear();
+this.a.clear();this.a.push(250);switch(a){case 230:this.m=!1;break;case 231:this.m=!0;break;case 232:this.W=!0;break;case 233:ed(this,0,0);break;case 235:ed(this,0,0);break;case 242:this.a.push(0);this.a.push(0);this.xd=this.kc=this.lc=0;break;case 243:this.Z=!0;break;case 244:this.ed=this.Nc=!0;this.w.send("mouse-enable",!0);this.xd=this.kc=this.lc=0;break;case 245:this.Nc=!1;break;case 246:this.Nc=!1;this.cd=100;this.m=!1;this.ue=4;break;case 255:this.a.push(170),this.a.push(0),this.ed=!0,this.w.send("mouse-enable",
+!0),this.Nc=!1,this.cd=100,this.m=!1,this.ue=4,this.xd=this.kc=this.lc=0}gd(this)}}else{this.a.clear();this.ra.clear();this.ra.push(250);switch(a){case 237:this.O=!0;break;case 240:this.C=!0;break;case 242:this.ra.push(171);this.ra.push(83);break;case 243:this.R=!0;break;case 244:this.Oe=!0;break;case 245:this.Oe=!1;break;case 255:this.ra.clear(),this.ra.push(250),this.ra.push(170),this.ra.push(0)}fd(this)}};
+k.dk=function(a){switch(a){case 32:this.ra.clear();this.a.clear();this.ra.push(this.g);fd(this);break;case 96:this.ka=!0;break;case 211:this.oa=!0;break;case 212:this.J=!0;break;case 167:this.g|=32;break;case 168:this.g&=-33;break;case 169:this.ra.clear();this.a.clear();this.ra.push(0);fd(this);break;case 170:this.ra.clear();this.a.clear();this.ra.push(85);fd(this);break;case 171:this.ra.clear();this.a.clear();this.ra.push(0);fd(this);break;case 173:this.g|=16;break;case 174:this.g&=-17;break;case 254:throw a=
+this.j,a.reset(),bb(a),233495534;}};
+function hd(a,b){this.g=this.a=this.aa=this.v=this.m=0;this.i=-1;this.sa=b;this.O=void 0===this.sa;this.Ca=void 0;this.name=this.O?"master":"slave ";this.R=!1;this.W=this.state=0;this.C=1;this.J=this.Z=0;this.j=a;this.O?(this.Ca=new hd(this.j,this),this.l=function(){if(0<=this.i)ab(this.j);else{var a=this.a&this.m;if(a){a&=-a;var b=this.Z?this.m:-1;this.aa&&(this.aa&-this.aa&b)<=a||(this.i=eb(a),ab(this.j))}}},this.lf=function(){if(-1!==this.i)if(0===this.a)this.i=-1,id(this.j,this.v|7);else{var a=
+1<<this.i;0===(this.J&a)&&(this.a&=~a);this.C||(this.aa|=a);2===this.i?this.Ca.lf():id(this.j,this.v|this.i);this.i=-1;this.l()}}):(this.l=function(){if(0<=this.i)ab(this.j);else{var a=this.a&this.m;if(a){a&=-a;var b=this.Z?this.m:-1;this.aa&&(this.aa&-this.aa&b)<=a||(this.i=eb(a),this.sa.ef(2))}}},this.lf=function(){if(-1!==this.i)if(0===this.a)this.i=-1,this.sa.g&=-5,id(this.j,this.v|7);else{var a=1<<this.i;0===(this.J&a)&&(this.a&=~a);this.C||(this.aa|=a);this.sa.g&=-5;id(this.j,this.v|this.i);
+this.i=-1;this.l()}});this.O?(a=32,b=1232):(a=160,b=1233);n(this.j.o,a,this,this.Ki);m(this.j.o,a,this,this.Ji);n(this.j.o,a|1,this,this.Mi);m(this.j.o,a|1,this,this.Li);n(this.j.o,b,this,this.$j);m(this.j.o,b,this,this.Zj);this.O?(this.ef=function(a){8<=a?this.Ca.ef(a-8):(a=1<<a,0===(this.g&a)&&(this.a|=a,this.g|=a,this.l()))},this.sf=function(a){8<=a?this.Ca.sf(a-8):(a=1<<a,this.g&a&&(this.g&=~a,this.a&=~a,this.l()))}):(this.ef=function(a){a=1<<a;0===(this.g&a)&&(this.a|=a,this.g|=a,this.l())},
+this.sf=function(a){a=1<<a;this.g&a&&(this.g&=~a,this.a&=~a,this.l())})}k=hd.prototype;k.Sa=function(){var a=[];a[0]=this.m;a[1]=this.v;a[2]=this.aa;a[3]=this.a;a[4]=this.O;a[5]=this.Ca;a[6]=this.R;a[7]=this.state;a[8]=this.W;a[9]=this.C;a[10]=this.J;return a};k.fb=function(a){this.m=a[0];this.v=a[1];this.aa=a[2];this.a=a[3];this.O=a[4];this.Ca=a[5];this.R=a[6];this.state=a[7];this.W=a[8];this.C=a[9];this.J=a[10]};
+k.Ki=function(a){if(a&16)this.g=this.m=this.a=this.aa=0,this.C=1,this.i=-1,this.R=a&1,this.state=1;else if(a&8)a&2&&(this.W=a&1),a&64&&(this.Z=32===(a&32));else{var b=a>>5;1===b?this.aa&=this.aa-1:3===b?this.aa&=~(1<<(a&7)):192!==(a&200)&&(this.aa&=this.aa-1);this.l()}};k.Ji=function(){return this.W?this.aa:this.a};k.Mi=function(a){0===this.state?this.R?(this.R=!1,this.C=a&2):(this.m=~a,this.l()):1===this.state?(this.v=a,this.state++):2===this.state&&(this.state=0)};
+k.Li=function(){return~this.m&255};k.Zj=function(){return this.J};k.$j=function(a){this.J=a};function jd(a){this.j=a;this.be=0;this.ha=new Uint8Array(128);this.C=this.a=Date.now();this.l=0;this.J=!1;this.v=.9765625;this.m=38;this.g=2;this.pg=this.i=0;n(a.o,112,this,function(a){this.be=a&127;this.pg=a>>7});n(a.o,113,this,this.Th);m(a.o,113,this,this.Sh)}k=jd.prototype;
+k.Sa=function(){var a=[];a[0]=this.be;a[1]=this.ha;a[2]=this.a;a[3]=this.C;a[4]=this.l;a[6]=this.J;a[7]=this.v;a[8]=this.m;a[9]=this.g;a[10]=this.i;a[11]=this.pg;return a};k.fb=function(a){this.be=a[0];this.ha=a[1];this.a=a[2];this.C=a[3];this.l=a[4];this.J=a[6];this.v=a[7];this.m=a[8];this.g=a[9];this.i=a[10];this.pg=a[11]};k.Ic=function(a){a=Date.now();this.a+=a-this.C;this.C=a;this.J&&this.l<a&&(this.j.Cb(8),this.i|=192,this.l+=this.v*Math.ceil((a-this.l)/this.v))};
+function kd(a,b){if(a.g&4)a=b;else{a=b;for(var c=b=0,d;a;)d=a%10,c|=d<<4*b,b++,a=(a-d)/10;a=c}return a}
+k.Sh=function(){switch(this.be){case 0:return kd(this,(new Date(this.a)).getUTCSeconds());case 2:return kd(this,(new Date(this.a)).getUTCMinutes());case 4:return kd(this,(new Date(this.a)).getUTCHours());case 7:return kd(this,(new Date(this.a)).getUTCDate());case 8:return kd(this,(new Date(this.a)).getUTCMonth()+1);case 9:return kd(this,(new Date(this.a)).getUTCFullYear()%100);case 10:return this.m;case 11:return this.g;case 12:Pb(this.j,8);var a=this.i;this.i&=-241;return a;case 13:return 255;case 50:return kd(this,
+(new Date(this.a)).getUTCFullYear()/100|0);default:return this.ha[this.be]}};k.Th=function(a){switch(this.be){case 10:this.m=a&127;this.v=1E3/(32768>>(this.m&15)-1);break;case 11:this.g=a,this.g&64&&(this.l=Date.now())}this.J=64===(this.g&64)&&0<(this.m&15)};
+function ld(a,b){this.w=b;this.j=a;this.Eb=4;this.Uc=this.Kc=0;this.wd=96;this.rd=this.gg=0;this.Sc=1;this.ua=this.Uf=this.og=this.Hf=0;this.input=new ob(4096);this.a=[];this.ua=4;this.w.register("serial0-input",function(a){this.input.push(a);this.wd|=1;this.Eb|=4096;md(this)},this);a=a.o;n(a,1016,this,function(a){nd(this,a)},function(a){nd(this,a&255);nd(this,a>>8)});n(a,1017,this,function(a){this.Uc&128?this.Kc=this.Kc&255|a<<8:(this.rd=a&15,md(this))});m(a,1016,this,function(){if(this.Uc&128)return this.Kc&
+255;var a=this.input.shift();0===this.input.length&&(this.wd&=-2,this.Eb&=-4097,md(this));return a});m(a,1017,this,function(){return this.Uc&128?this.Kc>>8:this.rd&15});m(a,1018,this,function(){var a=this.Sc&15|192;2==this.Sc&&(this.Eb&=-5,md(this));return a});n(a,1018,this,function(a){this.gg=a});m(a,1019,this,function(){return this.Uc});n(a,1019,this,function(a){this.Uc=a});m(a,1020,this,function(){return this.Hf});n(a,1020,this,function(a){this.Hf=a});m(a,1021,this,function(){return this.wd});
+n(a,1021,this,function(){});m(a,1022,this,function(){return this.og});n(a,1022,this,function(){});m(a,1023,this,function(){return this.Uf});n(a,1023,this,function(a){this.Uf=a})}ld.prototype.Sa=function(){var a=[];a[0]=this.Eb;a[1]=this.Kc;a[2]=this.Uc;a[3]=this.wd;a[4]=this.gg;a[5]=this.rd;a[6]=this.Sc;a[7]=this.Hf;a[8]=this.og;a[9]=this.Uf;a[10]=this.ua;return a};
+ld.prototype.fb=function(a){this.Eb=a[0];this.Kc=a[1];this.Uc=a[2];this.wd=a[3];this.gg=a[4];this.rd=a[5];this.Sc=a[6];this.Hf=a[7];this.og=a[8];this.Uf=a[9];this.ua=a[10]};function md(a){a.Eb&4096&&a.rd&1?(a.Sc=12,a.j.Cb(a.ua)):a.Eb&4&&a.rd&2?(a.Sc=2,a.j.Cb(a.ua)):a.Eb&1&&a.rd&8?(a.Sc=0,a.j.Cb(a.ua)):(a.Sc=1,Pb(a.j,a.ua))}
+function nd(a,b){if(a.Uc&128)a.Kc=a.Kc&-256|b;else if(a.Eb|=4,md(a),255!==b){var c=String.fromCharCode(b);a.w.send("serial0-output-char",c);a.a.push(b);"\n"===c&&(a.w.send("serial0-output-line",String.fromCharCode.apply("",a.a)),a.a=[])}}function od(a){this.message=a}od.prototype=Error();
+function pd(a,b){if("object"!==typeof a||null===a||a instanceof Array)return a;if(a.BYTES_PER_ELEMENT){var c=new Uint8Array(a.buffer,a.byteOffset,a.length*a.BYTES_PER_ELEMENT);return{__state_type__:a.constructor.name,buffer_id:b.push(c)-1}}a=a.Sa();c=[];for(var d=0;d<a.length;d++)c[d]=pd(a[d],b);return c}
+function qd(a,b,c){if("object"!==typeof b||null===b||a instanceof Array)return b;var d=b.__state_type__;if(void 0===d){d=a.Sa();for(var e=0;e<b.length;e++)b[e]=qd(d[e],b[e],c);a.fb(b);return a}a={Uint8Array:Uint8Array,Int8Array:Int8Array,Uint16Array:Uint16Array,Int16Array:Int16Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Float32Array:Float32Array,Float64Array:Float64Array}[d];b=c.ui[b.buffer_id];return 1048576<=b.length&&a===Uint8Array?new Uint8Array(c.Sg,b.offset,b.length):new a(c.Sg.slice(b.offset,
+b.offset+b.length))}q.prototype.we=function(){for(var a=[],b=pd(this,a),c=[],d=0,e=0;e<a.length;e++){var f=a[e].byteLength;c[e]={offset:d,length:f};d+=f;d=d+3&-4}b=JSON.stringify({buffer_infos:c,state:b});e=16+2*b.length;e=e+3&-4;var h=e+d;d=new ArrayBuffer(h);var g=new Int32Array(d,0,4);f=new Uint16Array(d,16,b.length);var p=new Uint8Array(d,e);g[0]=-2039052682;g[1]=5;g[2]=h;g[3]=2*b.length;for(e=0;e<b.length;e++)f[e]=b.charCodeAt(e);for(e=0;e<a.length;e++)p.set(a[e],c[e].offset);return d};
+q.prototype.Hd=function(a){var b=a.byteLength;if(16>b)throw new od("Invalid length: "+b);var c=new Int32Array(a,0,4);if(-2039052682!==c[0])throw new od("Invalid header: "+jb(c[0]>>>0));if(5!==c[1])throw new od("Version mismatch: dump="+c[1]+" we=5");if(c[2]!==b)throw new od("Length doesn't match header: real="+b+" header="+c[2]);c=c[3];if(0>c||c+12>=b||c%2)throw new od("Invalid info block length: "+c);var d=c/2,e=new Uint16Array(a,16,d),f="";for(b=0;b<d-8;)f+=String.fromCharCode(e[b++],e[b++],e[b++],
+e[b++],e[b++],e[b++],e[b++],e[b++]);for(;b<d;)f+=String.fromCharCode(e[b++]);b=JSON.parse(f);d=b.state;e=b.buffer_infos;c=c+19&-4;for(b=0;b<e.length;b++)e[b].offset+=c;qd(this,d,{Sg:a,ui:e})};
+function rd(a,b){this.j=a;this.wb=a.G.wb;this.w=b;this.w.register("net0-receive",function(a){if(!(this.K&1)&&(this.w.send("eth-receive-end",[a.length]),this.Tf&16||this.Tf&4&&255===a[0]&&255===a[1]&&255===a[2]&&255===a[3]&&255===a[4]&&255===a[5]||!(this.Tf&8&&1===(a[0]&1)||a[0]!==this.memory[0]||a[1]!==this.memory[2]||a[2]!==this.memory[4]||a[3]!==this.memory[6]||a[4]!==this.memory[8]||a[5]!==this.memory[10]))){var b=this.jd<<8,c=Math.max(60,a.length)+4,d=b+4,g=this.jd+1+(c>>8);if(b+c>this.memory.length){var p=
+this.memory.length-d;this.memory.set(a.subarray(0,p),d);this.memory.set(a.subarray(p),76)}else if(this.memory.set(a,d),60>a.length)for(a=a.length;60>a;a++)this.memory[d+a]=0;g>=this.Ed&&(g+=this.qe-this.Ed);this.memory[b]=1;this.memory[b+1]=g;this.memory[b+2]=c;this.memory[b+3]=c>>8;this.jd=g;sd(this,1)}},this);this.port=768;this.name="ne2k";this.pe=[236,16,41,128,3,1,0,0,0,0,0,2,0,0,0,0,this.port&255|1,this.port>>8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,244,26,0,17,0,0,184,254,0,0,0,
+0,0,0,0,0,0,1,0,0];this.Hb=40;this.nc=[{size:32}];this.Af=this.aa=0;this.K=1;this.Vf=this.Ld=this.Zb=this.Ke=0;this.memory=new Uint8Array(32768);this.Tf=0;this.sk=1;b=[0,34,21,255*Math.random()|0,255*Math.random()|0,255*Math.random()|0];for(var c=0;6>c;c++)this.memory[c<<1]=this.memory[c<<1|1]=b[c];this.memory[14]=this.memory[15]=87;this.nb=0;this.qe=64;this.Ed=128;this.pf=this.jd=76;b=a.o;m(b,this.port|0,this,function(){return this.K});n(b,this.port|0,this,function(a){this.K=a&-5;this.K&1||(a|24&&
+0===this.Zb&&sd(this,64),a&4&&(a=this.Vf<<8,a=this.memory.subarray(a,a+this.Ld),this.w.send("net0-send",a),this.w.send("eth-transmit-end",[a.length]),sd(this,2)))});m(b,this.port|13,this,function(){return 0});m(b,this.port|14,this,function(){return 0});m(b,this.port|15,this,function(){return 0});m(b,this.port|31,this,function(){0===(this.K&192)&&sd(this,128);return 0});n(b,this.port|31,this,function(){});n(b,this.port|1,this,function(a){0===(this.K&192)&&(this.qe=a)});n(b,this.port|2,this,function(a){0===
+(this.K&192)&&(this.Ed=a)});m(b,this.port|7,this,function(){return 0===(this.K&192)?this.aa:this.jd});n(b,this.port|7,this,function(a){0===(this.K&192)?(this.aa&=~a,td(this)):this.jd=a});n(b,this.port|13,this,function(){});n(b,this.port|14,this,function(a){0===(this.K&192)&&(this.Ke=a)});n(b,this.port|10,this,function(a){0===(this.K&192)&&(this.Zb=this.Zb&65280|a&255)});n(b,this.port|11,this,function(a){0===(this.K&192)&&(this.Zb=this.Zb&255|a<<8&65280)});n(b,this.port|8,this,function(a){0===(this.K&
+192)&&(this.nb=this.nb&65280|a&255)});n(b,this.port|9,this,function(a){0===(this.K&192)&&(this.nb=this.nb&255|a<<8&65280)});n(b,this.port|15,this,function(a){0===(this.K&192)&&(this.Af=a,td(this))});m(b,this.port|3,this,function(){return 0===(this.K&192)?this.pf:0});n(b,this.port|3,this,function(a){0===(this.K&192)&&(this.pf=a)});m(b,this.port|4,this,function(){return 0===(this.K&192)?this.sk:0});n(b,this.port|4,this,function(a){0===(this.K&192)&&(this.Vf=a)});n(b,this.port|5,this,function(a){0===
+(this.K&192)&&(this.Ld=this.Ld&-256|a)});n(b,this.port|6,this,function(a){0===(this.K&192)&&(this.Ld=this.Ld&255|a<<8)});m(b,this.port|12,this,function(){return 0===(this.K&192)?9:0});n(b,this.port|12,this,function(a){this.Tf=a});m(b,this.port|16,this,this.Wh,this.Ig,this.Vh);n(b,this.port|16,this,this.Jg,this.Jg,this.Xh);Zb(a.G.wb,this)}k=rd.prototype;
+k.Sa=function(){var a=[];a[0]=this.aa;a[1]=this.Af;a[2]=this.K;a[3]=this.Ke;a[4]=this.Zb;a[5]=this.Ld;a[6]=this.Vf;a[7]=this.nb;a[8]=this.qe;a[9]=this.jd;a[10]=this.pf;return a};k.fb=function(a){this.aa=a[0];this.Af=a[1];this.K=a[2];this.Ke=a[3];this.Zb=a[4];this.Ld=a[5];this.Vf=a[6];this.nb=a[7];this.qe=a[8];this.jd=a[9];this.pf=a[10]};function sd(a,b){a.aa|=b;td(a)}function td(a){a.Af&a.aa?a.wb.xb(a.Hb):rc(a.wb,a.Hb)}
+function ud(a,b){16<a.nb&&16384>a.nb||(a.Zb--,a.memory[a.nb++]=b,a.nb>=a.Ed<<8&&(a.nb+=a.qe-a.Ed<<8),0===a.Zb&&sd(a,64))}k.Jg=function(a){ud(this,a);this.Ke&1&&ud(this,a>>8)};k.Xh=function(a){ud(this,a);ud(this,a>>8);ud(this,a>>16);ud(this,a>>24)};function vd(a){var b=a.memory[a.nb++];a.Zb--;a.nb>=a.Ed<<8&&(a.nb+=a.qe-a.Ed<<8);0===a.Zb&&sd(a,64);return b}k.Wh=function(){return this.Ig()&255};k.Ig=function(){return this.Ke&1?vd(this)|vd(this)<<8:vd(this)};
+k.Vh=function(){return vd(this)|vd(this)<<8|vd(this)<<16|vd(this)<<24};var wd=new Uint8Array(256),xd=[],zd=[],Ad=[],Bd=[];
+function Cd(a,b){this.j=a;this.bg=!1;this.w=b;this.Va=new ob(64);this.Ea=new ob(64);this.l=this.C=this.Tb=this.oa=0;this.ka=new Uint8Array(256);this.he=!1;this.hf=0;this.Xb=this.Wb=this.yc=this.xc=!1;this.Lc=[new pb,new pb];this.O=2;this.Bb=1024;this.Ub=a.G.Ub;this.Nb=this.wc=this.m=this.g=this.v=this.W=0;this.hc=1;this.ld=5;this.gc=!1;this.a=new ArrayBuffer(65536);this.dc=new Int8Array(this.a);this.R=new Uint8Array(this.a);this.cc=new Int16Array(this.a);this.pc=new Uint16Array(this.a);this.rc=new nb(this.a);
+this.Vb=this.J=!1;this.ve=22050;this.i=1;this.Fa=170;this.qa=0;this.gd=new Uint8Array(256);this.Z=new ob(64);this.Ya=this.Xa=this.uc=0;this.mi=!1;this.ua=5;this.sd=new Uint8Array(16);this.nf=48E3;a.o.te(544,this,this.Ni,this.Pi,this.Ri,this.Ti);a.o.te(548,this,this.Vi,this.Xi);m(a.o,550,this,this.Zi);m(a.o,551,this,this.aj);m(a.o,552,this,this.cj);m(a.o,553,this,this.ej);m(a.o,554,this,this.gj);m(a.o,555,this,this.ij);m(a.o,556,this,this.kj);m(a.o,557,this,this.mj);a.o.te(558,this,this.oj,this.qj);
+a.o.Gc(544,this,this.Oi,this.Qi,this.Si,this.Ui);a.o.Gc(548,this,this.Wi,this.Yi);n(a.o,550,this,this.$i);n(a.o,551,this,this.bj);a.o.Gc(552,this,this.dj,this.fj);n(a.o,554,this,this.hj);n(a.o,555,this,this.jj);n(a.o,556,this,this.lj);n(a.o,557,this,this.nj);n(a.o,558,this,this.pj);n(a.o,559,this,this.rj);a.o.te(816,this,this.Vj,this.Xj);a.o.Gc(816,this,this.Wj,this.Yj);this.Ub.Wf.push({wf:this.qc,xg:this});b.register("speaker-tell-samplerate",function(a){this.nf=a},this);b.send("speaker-request-samplerate");
+b.register("speaker-request-data",function(a){Dd(this,a)},this);b.register("cpu-stop",function(){this.bg=!0;b.send("speaker-update-enable",!1)},this);b.register("cpu-run",function(){this.bg=!1;b.send("speaker-update-enable",!this.Vb)},this);Ed(this)}
+function Ed(a){a.Va.clear();a.Ea.clear();a.Tb=0;a.C=0;a.he=!1;a.hf=0;a.xc=!1;a.yc=!1;a.Wb=!1;a.Xb=!1;a.Lc[0].clear();a.Lc[1].clear();a.O=2;a.W=0;a.v=0;a.g=0;a.m=0;a.wc=0;a.Nb=0;a.gc=!1;a.R.fill(0);a.J=!1;a.Vb=!1;a.Fa=170;a.qa=0;a.ve=22050;a.i=1;Fd(a,1);a.sd.fill(0);a.gd.fill(0);a.gd[5]=1;a.gd[9]=248}k=Cd.prototype;
+k.Sa=function(){var a=[];a[2]=this.oa;a[3]=this.Tb;a[4]=this.C;a[5]=this.l;a[6]=this.ka;a[7]=this.he;a[8]=this.hf;a[9]=this.xc;a[10]=this.yc;a[11]=this.Wb;a[12]=this.Xb;a[14]=this.O;a[15]=this.W;a[16]=this.v;a[17]=this.g;a[18]=this.m;a[19]=this.wc;a[20]=this.Nb;a[21]=this.hc;a[22]=this.ld;a[23]=this.gc;a[24]=this.R;a[25]=this.J;a[26]=this.Vb;a[27]=this.ve;a[28]=this.i;a[29]=this.Fa;a[30]=this.qa;a[31]=this.gd;a[33]=this.Jc;a[34]=this.ua;a[35]=this.sd;a[36]=this.nf;return a};
+k.fb=function(a){this.oa=a[2];this.Tb=a[3];this.C=a[4];this.l=a[5];this.ka=a[6];this.he=a[7];this.hf=a[8];this.xc=a[9];this.yc=a[10];this.Wb=a[11];this.Xb=a[12];this.O=a[14];this.W=a[15];this.v=a[16];this.g=a[17];this.m=a[18];this.wc=a[19];this.Nb=a[20];this.hc=a[21];this.ld=a[22];this.gc=a[23];this.R=a[24];this.J=a[25];this.Vb=a[26];this.ve=a[27];this.i=a[28];this.Fa=a[29];this.qa=a[30];this.gd=a[31];this.Jc=a[33];this.ua=a[34];this.sd=a[35];this.nf=a[36];this.a=this.R.buffer;this.dc=new Int8Array(this.a);
+this.cc=new Int16Array(this.a);this.pc=new Uint16Array(this.a);this.rc=new nb(this.a);this.w.send("speaker-update-enable",!this.Vb)};k.Ni=function(){return 255};k.Pi=function(){return 255};k.Ri=function(){return 255};k.Ti=function(){return 255};k.Vi=function(){return this.l};k.Xi=function(){var a=zd[this.l];a||(a=this.sc);return a.call(this)};k.Zi=function(){return 255};k.aj=function(){return 255};k.cj=function(){return 255};k.ej=function(){return 255};
+k.gj=function(){this.Ea.length&&(this.oa=this.Ea.shift());return this.oa};k.ij=function(){return 255};k.kj=function(){return 127};k.mj=function(){return 255};k.oj=function(){this.sd[1]&&Fd(this,1);return(this.Ea.length&&!this.xc)<<7|127};k.qj=function(){Fd(this,2);return 0};k.Oi=function(){this.Xa=0};k.Qi=function(a){var b=Bd[this.Xa];b||(b=this.Za);b.call(this,a,0,this.Xa)};k.Si=function(){this.Ya=0};k.Ui=function(a){var b=Bd[this.Ya];b||(b=this.Za);b.call(this,a,1,this.Ya)};
+k.Wi=function(a){this.l=a};k.Yi=function(a){var b=Ad[this.l];b||(b=this.tc);b.call(this,a)};k.$i=function(a){this.xc?this.xc=!1:a&&Ed(this);this.Ea.clear();this.Ea.push(170)};k.bj=function(){};k.dj=function(){};k.fj=function(){};k.hj=function(){};k.jj=function(){};k.lj=function(a){0===this.Tb?(this.Tb=a,this.Va.clear(),this.C=wd[a]):this.Va.push(a);this.Va.length>=this.C&&(a=xd[this.Tb],a||(a=this.Mg),a.call(this),this.C=this.Tb=0,this.Va.clear())};k.nj=function(){};k.pj=function(){};k.rj=function(){};
+k.Vj=function(){this.Z.length&&(this.uc=this.Z.shift());return this.uc};k.Wj=function(){};k.Xj=function(){return 0|128*!this.Z.length};k.Yj=function(a){255==a&&(this.Z.clear(),this.Z.push(254))};k.Mg=function(){};function B(a,b,c){c||(c=Cd.prototype.Mg);for(var d=0;d<a.length;d++)wd[a[d]]=b,xd[a[d]]=c}function Gd(a){for(var b=[],c=0;16>c;c++)b.push(a+c);return b}B([14],2,function(){this.gd[this.Va.shift()]=this.Va.shift()});B([15],1,function(){this.Ea.clear();this.Ea.push(this.gd[this.Va.shift()])});
+B([16],1,function(){var a=this.Va.shift();a=Hd(a/127.5+-1);this.Lc[0].push(a);this.Lc[1].push(a);this.w.send("speaker-update-enable",!0)});B([20,21],2,function(){this.wc=1;this.Nb=this.hc;this.xc=this.Wb=this.Xb=this.gc=!1;Id(this);Jd(this)});B([22],2);B([23],2);B([28],0,function(){this.wc=1;this.Nb=this.hc;this.gc=!0;this.xc=this.Wb=this.Xb=!1;Jd(this)});B([31],0);B([32],0,function(){this.Ea.clear();this.Ea.push(127)});B([36],2);B([44],0);B([48],0);B([49],0);B([52],0);B([53],0);B([54],0);
+B([55],0);B([56],0);B([64],1,function(){this.ve=1E6/(256-this.Va.shift())/(this.yc?2:1)});B([65,66],2,function(){this.ve=this.Va.shift()<<8|this.Va.shift()});B([72],2,function(){Id(this)});B([116],2);B([117],2);B([118],2);B([119],2);B([125],0);B([127],0);B([128],2);B([144],0,function(){this.wc=1;this.Nb=this.hc;this.gc=!0;this.Xb=!1;this.xc=!0;this.Wb=!1;Jd(this)});B([145],0);B([152],0);B([153],0);B([160],0);B([168],0);
+B(Gd(176),3,function(){if(!(this.Tb&8)){var a=this.Va.shift();this.wc=2;this.Nb=this.ld;this.gc=!!(this.Tb&4);this.Xb=!!(a&16);this.yc=!!(a&32);this.Wb=!0;Id(this);Jd(this)}});B(Gd(192),3,function(){if(!(this.Tb&8)){var a=this.Va.shift();this.wc=1;this.Nb=this.hc;this.gc=!!(this.Tb&4);this.Xb=!!(a&16);this.yc=!!(a&32);this.Wb=!1;Id(this);Jd(this)}});B([208],0,function(){this.Vb=!0;this.w.send("speaker-update-enable",!1)});B([209],0,function(){this.he=!0});B([211],0,function(){this.he=!1});
+B([212],0,function(){this.Vb=!1;this.w.send("speaker-update-enable",!0)});B([213],0,function(){this.Vb=!0;this.w.send("speaker-update-enable",!1)});B([214],0,function(){this.Vb=!1;this.w.send("speaker-update-enable",!0)});B([216],0,function(){this.Ea.clear();this.Ea.push(255*this.he)});B([217,218],0,function(){this.gc=!1});B([224],1,function(){this.Ea.clear();this.Ea.push(~this.Va.shift())});B([225],0,function(){this.Ea.clear();this.Ea.push(4);this.Ea.push(5)});B([226],1);
+B([227],0,function(){this.Ea.clear();for(var a=0;44>a;a++)this.Ea.push("COPYRIGHT (C) CREATIVE TECHNOLOGY LTD, 1992.".charCodeAt(a));this.Ea.push(0)});B([228],1,function(){this.hf=this.Va.shift()});B([232],0,function(){this.Ea.clear();this.Ea.push(this.hf)});B([242,243],0,function(){this.xb()});var Kd=new Uint8Array(256);Kd[14]=255;Kd[15]=7;Kd[55]=56;B([249],1,function(){var a=this.Va.shift();this.Ea.clear();this.Ea.push(Kd[a])});Cd.prototype.sc=function(){return this.ka[this.l]};
+Cd.prototype.tc=function(a){this.ka[this.l]=a};function Ld(a,b){b||(b=Cd.prototype.sc);zd[a]=b}function Md(a,b){b||(b=Cd.prototype.tc);Ad[a]=b}Ld(0,function(){return 0});Md(0);Md(14,function(a){this.yc=a&2;this.w.send("speaker-stereo",this.yc);this.w.send("speaker-filter",a&32)});Ld(128,function(){switch(this.ua){case 2:return 1;case 5:return 2;case 7:return 4;case 10:return 8;default:return 0}});Md(128,function(a){a&1&&(this.ua=2);a&2&&(this.ua=5);a&4&&(this.ua=7);a&8&&(this.ua=10)});
+Ld(129,function(){var a=0;switch(this.hc){case 0:a|=1;break;case 1:a|=2;break;case 3:a|=8}switch(this.ld){case 5:a|=32;break;case 6:a|=64;break;case 7:a|=128}return a});Md(129,function(a){a&1&&(this.hc=0);a&2&&(this.hc=1);a&8&&(this.hc=3);a&32&&(this.ld=5);a&64&&(this.ld=6);a&128&&(this.ld=7)});Ld(130,function(){for(var a=32,b=0;16>b;b++)a|=b*this.sd[b];return a});Cd.prototype.Za=function(){};function Nd(a,b){b||(b=Cd.prototype.Za);for(var c=0;c<a.length;c++)Bd[a[c]]=b}
+function Od(a,b){for(var c=[];a<=b;a++)c.push(a);return c}var Pd=new Uint8Array(32);Pd[0]=0;Pd[1]=1;Pd[2]=2;Pd[3]=3;Pd[4]=4;Pd[5]=5;Pd[8]=6;Pd[9]=7;Pd[10]=8;Pd[11]=9;Pd[12]=10;Pd[13]=11;Pd[16]=12;Pd[17]=13;Pd[18]=14;Pd[19]=15;Pd[20]=16;Pd[21]=17;Nd([1],function(a,b){this.mi[b]=a&1});Nd([2]);Nd([3]);Nd([4],function(){});Nd([5],function(){});Nd([8],function(){});Nd(Od(32,53),function(){});Nd(Od(64,85),function(){});Nd(Od(96,117),function(){});Nd(Od(128,149),function(){});Nd(Od(160,168),function(){});
+Nd(Od(176,184),function(){});Nd([189],function(){});Nd(Od(192,200),function(){});Nd(Od(224,245),function(){});function Id(a){a.W=1+(a.Va.shift()<<0)+(a.Va.shift()<<8)}function Jd(a){a.i=1;a.Wb&&(a.i*=2);a.O=Math.round(a.nf/a.ve);a.v=a.W*a.i;a.m=1024*a.i;a.m=Math.min(a.v>>2,a.m);a.J=!0;a.Ub.vc[a.Nb]||a.qc(a.Nb)}Cd.prototype.qc=function(a){a===this.Nb&&this.J&&(this.J=!1,this.g=this.v,this.Vb=!1,this.w.send("speaker-update-enable",!0),Qd(this))};
+function Qd(a){if(a.g&&!(a.Lc[0].length>2*a.Bb||a.bg||a.Vb)){var b=Math.min(a.g,a.m),c=Math.floor(b/a.i);a.Ub.Me(a.rc,0,b,a.Nb,function(d){d||(Rd(a,c),a.g-=b,a.g||(a.xb(a.wc),a.gc&&(a.g=a.v)),setTimeout(function(){Qd(a)},0))})}}function Rd(a,b){var c=a.Wb?32767.5:127.5,d=a.Xb?0:-1,e=(a.yc?1:2)*a.O,f;a.Wb?f=a.Xb?a.cc:a.pc:f=a.Xb?a.dc:a.R;for(var h=0,g=0;g<b;g++)for(var p=Hd(f[g]/c+d),r=0;r<e;r++)a.Lc[h].push(p),h^=1}
+function Dd(a,b){a.Bb=b;var c=qb(a.Lc[0],b);b=qb(a.Lc[1],b);a.w.send("speaker-update-data",[c,b],[c.buffer,b.buffer]);setTimeout(function(){Qd(a)},0)}Cd.prototype.xb=function(a){this.sd[a]=1;this.j.Cb(this.ua)};function Fd(a,b){a.sd[b]=0;Pb(a.j,a.ua)}function Hd(a){return-1*(-1>a)+1*(1<a)+(-1<=a&&1>=a)*a}
+function Sd(a,b,c){this.pe=[244,26,9,16,7,5,16,0,0,0,2,0,0,0,0,0,1,168,0,0,0,16,191,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,244,26,9,0,0,0,0,0,64,0,0,0,0,0,0,0,0,1,0,0];this.Hb=48;this.nc=[{size:256}];this.name="virtio";var d=a.o;m(d,43008,this,function(){return 1},void 0,function(){return 1});n(d,43012,this,void 0,void 0,function(){});n(d,43022,this,void 0,function(a){this.bf=a},void 0);m(d,43020,this,void 0,function(){return this.Fc},void 0);m(d,43016,this,void 0,void 0,function(){return 0===
+this.bf?this.Ec:0});n(d,43016,this,void 0,void 0,function(a){this.Ec=a});n(d,43026,this,function(a){0===a&&this.reset();this.Le=a});m(d,43026,this,function(){return this.Le});m(d,43027,this,function(){var a=this.aa;this.aa=0;rc(this.wb,this.Hb);return a});n(d,43024,this,void 0,function(){var a=(this.Ec<<12)+16*this.Fc,b=a+4;a=this.j.ma(a+2);var c=this.Fc-1;for(a&=c;this.td!==a;){var e=this.j.ma(b+2*this.td);Td(this,e);this.td=this.td+1&c}});this.j=a;this.wb=a.G.wb;this.w=b;this.td=this.aa=this.Le=
+this.bf=0;this.Fc=32;for(var e=this.Ec=0;128>e;e++)m(d,43028+e,this,function(a){return a<this.ia.m.length?this.ia.m[a]:0}.bind(this,e),void 0,void 0),n(d,43028+e,this,function(){}.bind(this,e),void 0,void 0);this.ia=new ma(c,b);this.ia.la=this.a.bind(this);Zb(a.G.wb,this)}Sd.prototype.Sa=function(){var a=[0];a[1]=this.bf;a[2]=this.Le;a[3]=this.aa;a[4]=this.td;a[5]=this.Fc;a[6]=this.Ec;a[7]=this.ia;return a};
+Sd.prototype.fb=function(a){this.bf=a[1];this.Le=a[2];this.aa=a[3];this.td=a[4];this.Fc=a[5];this.Ec=a[6];this.ia=a[7];this.ia.la=this.a.bind(this)};Sd.prototype.reset=function(){this.td=this.aa=this.Le=this.bf=0;this.Fc=32;this.Ec=0};
+function Td(a,b){var c=b,d=a.Ec<<12,e=0,f=[];do{var h=d+16*c,g=a.j.ma(h+12);if(g&2)break;var p=jc(a.j,h);c=jc(a.j,h+4);var r=jc(a.j,h+8)>>>0;f.push({Yf:p,Nh:c,ng:r});if(g&1)c=a.j.ma(h+14);else{c=-1;break}}while(1);var v=-1,E=0;qa(a.ia,{start:b,next:c},function(){if(E>=v){if(e===f.length)return 0;var a=f[e++];p=a.Yf;v=a.ng;E=0}return this.j.ja(p+E++)}.bind(a))}
+Sd.prototype.a=function(a,b){if(-1!==b.next){var c=this.Fc-1;a=this.ia.Rf;var d=b.next,e=this.Ec<<12,f=0,h=[];do{d=e+16*d;var g=this.j.ma(d+12);if(0===(g&2))break;var p=jc(this.j,d),r=jc(this.j,d+4),v=jc(this.j,d+8)>>>0;h.push({Yf:p,Nh:r,ng:v});if(g&1)d=this.j.ma(d+14);else break}while(1);g=-1;for(e=r=0;e<a;e++){d=this.ia.Aa[e];if(r>=g){if(f===h.length)return 0;g=h[f++];p=g.Yf;g=g.ng;r=0}this.j.za(p+r++,d)}p=(this.Ec<<12)+16*this.Fc+4+2*this.Fc;p=p+4095&-4096;this.j.ma(p);f=this.j.ma(p+2);this.j.ze(p+
+2,f+1);c=p+4+8*(f&c);this.j.fd(c,b.start);this.j.fd(c+4,a);this.aa|=1;this.wb.xb(this.Hb)}};function Ud(){this.Xe={};this.a=void 0}Ud.prototype.register=function(a,b,c){var d=this.Xe[a];void 0===d&&(d=this.Xe[a]=[]);d.push({wf:b,xg:c})};Ud.prototype.unregister=function(a,b){var c=this.Xe[a];void 0!==c&&(this.Xe[a]=c.filter(function(a){return a.wf!==b}))};Ud.prototype.send=function(a,b){if(this.a&&(a=this.a.Xe[a],void 0!==a))for(var c=0;c<a.length;c++){var d=a[c];d.wf.call(d.xg,b)}};
+function Vd(){var a=new Ud,b=new Ud;a.a=b;b.a=a;return[a,b]}
+function q(a){this.Ia=0;this.W=!0;this.da=new Uint8Array(0);this.Ef=new Uint16Array(this.da.buffer);this.Cc=new Int32Array(this.da.buffer);this.eb=new Uint8Array(8);this.La=new Uint32Array(8);this.xa=new Int32Array(8);this.R=new Int32Array(1048576);this.oc=new Uint8Array(1048576);this.jf=new Uint8Array(1048576);this.ta=!1;this.Qc=this.ie=this.Rc=this.je=0;this.J=this.Md=!1;this.K=new Int32Array(8);this.K[0]=0;this.K[2]=0;this.K[3]=0;this.af=this.N=this.K[4]=0;this.Tc=this.qb=this.C=!1;this.F=this.l=
+this.S=this.kb=this.jb=this.u=this.flags=this.H=this.xe=this.ye=this.Kd=this.Xa=this.me=this.O=this.jc=0;this.ka=new Int32Array(2);this.Z=new Float64Array(2);this.v=this.m=this.f=this.kf=0;this.G={};this.oa=[];this.V=!1;this.ga=this.A=0;this.Oh=!0;this.Y=0;this.b=new Int32Array(8);this.Fd=new Uint32Array(this.b.buffer);this.se=new Int16Array(this.b.buffer);this.h=new Uint16Array(this.b.buffer);this.sg=new Int8Array(this.b.buffer);this.D=new Uint8Array(this.b.buffer);this.s=new Int32Array(16);new Uint32Array(this.s.buffer);
+this.Gd=new Int8Array(this.s.buffer);this.tg=new Uint8Array(this.s.buffer);this.na=new Int32Array(32);this.$e=8064;this.M=new Uint16Array(8);this.md=new Int32Array(8);this.Ye=[];this.Ze=[];this.Ff=[];this.Gf=[];this.$d={Zg:null,Pd:null};this.zc=0;this.T=this.o=void 0;this.w=a;Wd(this);this.kf=$a();Xd(this)}k=q.prototype;
+k.Sa=function(){var a=[];a[0]=this.Ia;a[1]=this.eb;a[2]=this.xa;a[3]=this.La;a[4]=this.ta;a[5]=this.Rc;a[6]=this.je;a[7]=this.Qc;a[8]=this.ie;a[9]=this.J;a[10]=this.K;a[11]=this.N;a[12]=this.af;a[13]=this.C;a[16]=this.qb;a[17]=this.Tc;a[18]=this.jc;a[19]=this.O;a[20]=this.me;a[21]=this.Xa;a[22]=this.Kd;a[23]=this.xe;a[24]=this.ye;a[25]=this.H;a[26]=this.flags;a[27]=this.u;a[28]=this.jb;a[29]=this.kb;a[30]=this.S;a[31]=this.l;a[32]=this.f;a[36]=this.V;a[37]=this.A;a[38]=this.ga;a[39]=this.b;a[40]=
+this.M;a[41]=this.md;a[42]=this.da;a[43]=this.T;a[45]=this.G.Xf;a[46]=this.G.Zf;a[47]=this.G.bd;a[48]=this.G.wb;a[49]=this.G.Ub;a[50]=this.G.Mh;a[51]=this.G.si;a[52]=this.G.Pd;a[53]=this.G.Of;a[54]=this.G.Jh;a[55]=this.G.Og;a[56]=this.G.Qa;a[57]=this.G.Ma;a[58]=this.G.If;a[59]=this.G.bh;a[60]=this.G.Vc;a[61]=this.G.Ah;a[62]=this.W;a[63]=this.zc;a[64]=this.G.Ve;a[65]=this.Md;a[66]=this.s;return a};
+k.fb=function(a){this.Ia=a[0];this.eb=a[1];this.xa=a[2];this.La=a[3];this.ta=a[4];this.Rc=a[5];this.je=a[6];this.Qc=a[7];this.ie=a[8];this.J=a[9];this.K=a[10];this.N=a[11];this.af=a[12];this.C=a[13];this.qb=a[16];this.Tc=a[17];this.jc=a[18];this.O=a[19];this.me=a[20];this.Xa=a[21];this.Kd=a[22];this.xe=a[23];this.ye=a[24];this.H=a[25];this.flags=a[26];this.u=a[27];this.jb=a[28];this.kb=a[29];this.S=a[30];this.l=a[31];this.f=a[32];this.V=a[36];this.A=a[37];this.ga=a[38];this.b=a[39];this.M=a[40];this.md=
+a[41];this.da=a[42];this.T=a[43];this.G.Xf=a[45];this.G.Zf=a[46];this.G.bd=a[47];this.G.wb=a[48];this.G.Ub=a[49];this.G.Mh=a[50];this.G.si=a[51];this.G.Pd=a[52];this.G.Of=a[53];this.G.Jh=a[54];this.G.Og=a[55];this.G.Qa=a[56];this.G.Ma=a[57];this.G.If=a[58];this.G.bh=a[59];this.G.Vc=a[60];this.G.Ah=a[61];this.W=a[62];this.zc=a[63];this.G.Ve=a[64];this.Md=a[65];this.s=a[66];this.Ef=new Uint16Array(this.da.buffer,this.da.byteOffset,this.da.length>>1);this.Cc=new Int32Array(this.da.buffer,this.da.byteOffset,
+this.da.length>>2);Yd(this);this.Fd=new Uint32Array(this.b.buffer);this.se=new Int16Array(this.b.buffer);this.h=new Uint16Array(this.b.buffer);this.sg=new Int8Array(this.b.buffer);this.D=new Uint8Array(this.b.buffer);new Uint32Array(this.s.buffer);this.Gd=new Int8Array(this.s.buffer);this.tg=new Uint8Array(this.s.buffer);Wd(this)};k.tf=function(a){if(233495534===a)this.J=!1,this.H=0;else throw console.log(a),console.log(a.stack),a;};
+k.reset=function(){this.W=!0;for(var a=0;8>a;a++)this.eb[a]=0,this.La[a]=0,this.xa[a]=0;Yd(this);for(a=0;8>a;a++)this.b[a]=0,this.M[a]=0,this.K[a]=0,this.md[a]=0;for(a=0;a<this.s.length;a++)this.s[a]=0;for(a=0;a<this.na.length;a++)this.na[a]=0;this.$e=8064;this.ta=!1;this.Qc=this.ie=this.Rc=this.je=0;this.J=!1;this.K[0]=1610612752;this.K[2]=0;this.K[3]=0;this.K[4]=0;this.md[6]=-61456;this.md[7]=1024;this.N=0;this.V=!1;this.af=0;this.qb=this.C=!1;this.H=0;this.me=this.jc=-1;Wd(this);this.ga=this.Y=
+0;this.Tc=!1;this.xe=this.ye=this.Kd=0;this.flags=2;this.S=this.kb=this.jb=this.l=this.F=this.u=0;this.kf=$a();this.A=1048560;Zd(this,61440);$d(this,2,48);this.h[8]=256;this.G.Xf&&this.G.Xf.reset();this.zc=0};k.Fg=function(a){1048576>a?a=1048576:0>(a|0)&&(a=Math.pow(2,31)-131072);this.Ia=a=(a-1|131071)+1|0;a=new ArrayBuffer(a);this.da=new Uint8Array(a);this.Ef=new Uint16Array(a);this.Cc=new Int32Array(a)};q.prototype.create_memory=q.prototype.Fg;
+q.prototype.Ob=function(a,b){this.Fg("number"===typeof a.Ia?a.Ia:67108864);this.reset();var c=new Na(this);this.o=c;this.$d.Zg=a.$d;this.$d.Pd=a.wk;bb(this);var d=0;m(c,179,this,function(){return 0});m(c,146,this,function(){return d});n(c,146,this,function(a){d=a});m(c,1297,this,function(){var a=this.zc&255;this.zc>>>=8;return a});n(c,1296,this,void 0,function(a){0===a?this.zc=-89064784:3===a?this.zc=this.Ia:this.zc=5===a?1:0});this.G={};a.yi&&(this.G.Vc=new hd(this),this.G.wb=new nc(this),this.G.bd=
+new jd(this),ae(this,this.G.bd,a),this.G.Ub=new Bc(this),this.G.Pd=new Pc(this,b,a.Ja||8388608),this.T=new rb(this),this.G.Of=new dd(this,b),this.G.Jh=new ld(this,b),this.G.Og=new sc(this,a.Ra),c=0,a.Ma&&(this.G.Ma=new Nb(this,a.Ma,!1,c++,b)),a.Qa&&(this.G.Qa=new Nb(this,a.Qa,!0,c++,b)),a.zf&&(this.G.zf=new Nb(this,a.zf,!1,c++,b)),this.G.If=new Ic(this,b),a.hi&&(this.G.bh=new rd(this,b)),a.Pc&&(this.G.Xf=new Sd(this,b,a.Pc)),this.G.Ah=new Cd(this,b));a.oe&&be(this,a.oe.buffer)};
+function be(a,b){if(8192>b.byteLength){var c=new Int32Array(2048);(new Uint8Array(c.buffer)).set(new Uint8Array(b))}else c=new Int32Array(b,0,2048);for(var d=0;8192>d;d+=4)if(464367618===c[d>>2]){var e=c[d+4>>2];if(!(464367618+e+c[d+8>>2]|0)){a.b[0]=732803074;a.b[3]=31744;a.fd(31744,0);a.K[0]=1;a.ta=!0;a.flags=2;ce(a,!0);a.qb=!0;for(var f=0;6>f;f++)a.eb[f]=0,a.xa[f]=0,a.La[f]=4294967295,a.M[f]=45058;if(e&65536){e=c[d+16>>2];var h=c[d+20>>2];f=c[d+28>>2];b=new Uint8Array(b,d-(c[d+12>>2]-e),0===h?void 0:
+h-e);a.da.set(b,e);a.A=C(a,1)+f|0}else if(1179403647===c[0])for(c=de(b),a.A=C(a,1)+c.jg.ii|0,c=ia(c.ek),d=c.next();!d.done;d=c.next())d=d.value,0!==d.type&&1===d.type&&(e=new Uint8Array(b,d.offset,d.ki),a.da.set(e,d.Di));a.o.Gc(244,a,function(a){console.log("Test exited with code "+jb(a,2));throw"HALT";},function(){},function(){},function(){});for(b={qd:14};15>=b.qd;b={qd:b.qd},b.qd++)n(a.o,8192+b.qd,a,function(a){return function(b){b?this.Cb(a.qd):Pb(this,a.qd)}}(b));break}}}
+function ae(a,b,c){var d=c.ae||531;b.ha[56]=1|d>>4&240;b.ha[61]=d&255;b.ha[21]=128;b.ha[22]=2;d=0;1048576<=a.Ia&&(d=a.Ia-1048576>>10,d=Math.min(d,65535));b.ha[23]=d&255;b.ha[24]=d>>8&255;b.ha[48]=d&255;b.ha[49]=d>>8&255;d=0;16777216<=a.Ia&&(d=a.Ia-16777216>>16,d=Math.min(d,65535));b.ha[52]=d&255;b.ha[53]=d>>8&255;b.ha[91]=0;b.ha[92]=0;b.ha[93]=0;b.ha[20]=47;b.ha[95]=0;c.ji&&(b.ha[63]=1)}
+function bb(a){var b=a.$d.Zg,c=a.$d.Pd;if(b){var d=new Uint8Array(b);a.da.set(d,1048576-b.byteLength);if(c){var e=new Uint8Array(c);a.da.set(e,786432);Pa(a.o,4272947200,1048576,function(a){a=a-4272947200|0;return a<e.length?e[a]:0},function(){})}Pa(a.o,4293918720,1048576,function(a){return this.da[a&1048575]}.bind(a),function(a,b){this.da[a&1048575]=b}.bind(a))}}q.prototype.qa=function(){try{this.Fa()}catch(a){this.tf(a)}};q.prototype.Fa=function(){for(var a=11001;a--;)ee(this)};
+"undefined"!==typeof window&&(window.__no_inline_for_closure_compiler__=[q.prototype.tf,q.prototype.Fa,q.prototype.qa]);function ee(a){a.ga=a.A;a.Y++;var b=a.$b();a.oa[b](a)}q.prototype.Uh=function(){try{ee(this)}catch(a){this.tf(a)}};q.prototype.cycle=q.prototype.Uh;function fe(a,b){a.H|=b+1;ge(a);a.H=0}function ge(a){if(Bb(a))a.Za[a.$b()](a);else a.Ya[a.$b()](a)}
+function he(a,b){if(-2147483648===(b&-2147483647))throw a.debug.P("#GP handler");a.K[0]=b;a.T||(a.K[0]|=4);a.K[0]|=16;b=-2147483648===(a.K[0]&-2147483648);b!==a.V&&(a.V=b,Yd(a));a.ta=1===(a.K[0]&1)}function ie(a){a.jc=-1;a.me=-1}k=q.prototype;k.$b=function(){this.A&-4096^this.jc&&(this.O=je(this,this.A)^this.A,this.jc=this.A&-4096);var a=this.ja(this.O^this.A);this.A=this.A+1|0;return a};k.xh=function(){return this.$b()<<24>>24};
+k.Qf=function(){if(4094<(this.A^this.jc)>>>0)return this.$b()|this.$b()<<8;var a=this.ma(this.O^this.A);this.A=this.A+2|0;return a};k.wh=function(){if(4092<(this.A^this.jc)>>>0)return this.Qf()|this.Qf()<<16;var a=jc(this,this.O^this.A);this.A=this.A+4|0;return a};function ke(a,b){var c=new Int32Array(2);c[0]=a;c[1]=b;return c}function le(a,b,c,d){var e=new Int32Array(4);e[0]=a;e[1]=b;e[2]=c;e[3]=d;return e}function D(a){a.f=a.$b()}k.yh=q.prototype.$b;k.gk=q.prototype.$b;k.L=q.prototype.$b;k.wa=q.prototype.xh;
+k.U=q.prototype.Qf;k.ea=q.prototype.wh;k.uh=q.prototype.$b;k.mb=q.prototype.xh;k.Ib=q.prototype.Qf;k.X=q.prototype.wh;function F(a,b){return(me(a)?a.i:a.g)[b](a)}function ne(a,b){return a.a[a.gk()](a,b)}function oe(a,b,c,d){a.za(b,d);a.za(c,d>>24);b&1?b&2?(a.za(c-2,d>>8),a.za(c-1,d>>16)):(a.za(b+1|0,d>>8),a.za(b+2|0,d>>16)):(a.za(b+1|0,d>>8),a.za(c-1,d>>16))}function pe(a,b){return a.ja(je(a,b))}function x(a,b){return a.V&&4095===(b&4095)?pe(a,b)|pe(a,b+1|0)<<8:a.ma(je(a,b))}
+function y(a,b){return a.V&&4093<=(b&4095)?x(a,b)|x(a,b+2|0)<<16:jc(a,je(a,b))}function qe(a,b){var c=ke(0,0);a.V&&4089<=(b&4095)?(c[0]=y(a,b),c[1]=y(a,b+4|0)):(c[0]=jc(a,je(a,b)),c[1]=jc(a,je(a,b+4|0)));return c}function re(a,b,c){a.za(se(a,b),c)}function u(a,b,c){var d=se(a,b);4095===(b&4095)?(b=se(a,b+1|0),a.za(d,c),a.za(b,c>>8)):a.ze(d,c)}function w(a,b,c){var d=se(a,b);4093<=(b&4095)?oe(a,d,se(a,b+3&-4)|b+3&3,c):a.fd(d,c)}function te(a,b,c,d){Cb(a,b,8);w(a,b,c);w(a,b+4|0,d)}
+function ue(a,b,c,d,e,f){Cb(a,b,16);w(a,b,c);w(a,b+4|0,d);w(a,b+8|0,e);w(a,b+12|0,f)}function ve(a){return me(a)?we(a,3)+a.ea()|0:we(a,3)+a.U()|0}function xe(a){return a.flags>>12&3}function ye(a){return!!(a.flags&131072)}function ze(a){return a.flags&-2262|!!a.cb()|!!a.Ug()<<2|!!Ae(a)<<4|!!a.Ac()<<6|!!a.xf()<<7|!!a.Te()<<11}function Be(a,b){var c=1769472,d=2588629;a.flags&131072?(c|=12288,d|=1572864):a.N&&(c|=12288,a.N>xe(a)&&(c|=512));a.flags=(b^(a.flags^b)&c)&d|2;a.u=0}
+function Ce(a){return a.qb?a.b[4]:a.h[8]}function De(a,b){a.qb?a.b[4]=b:a.h[8]=b}function Ee(a,b){a.qb?a.b[4]+=b:a.h[8]+=b}function G(a,b){return a.qb?C(a,2)+a.b[4]+b|0:C(a,2)+(a.h[8]+b&65535)|0}function Fe(a){return a.A-C(a,1)|0}
+function Ge(a,b,c,d){a.Tc=!1;if(a.ta){if(ye(a)&&a.K[4]&1)throw a.debug.P("VME");ye(a)&&c&&3>xe(a)&&H(a,0);if((b<<3|7)>a.je)throw a.debug.P("#GP handler");var e=a.Rc+(b<<3)|0;a.V&&(e=He(a,e));var f=a.ma(e)|a.ma(e+6|0)<<16,h=a.ma(e+2|0),g=a.ja(e+5|0),p=g>>5&3;e=g&31;if(0===(g&128))throw a.debug.P("#NP handler");c&&p<a.N&&H(a,b<<3|2);if(5===e){f=Ie(a,h);c=3>=f.type;g=2===(f.type&2);if(!f.Gb||f.Ta||!f.hg)throw a.debug.P("#GP handler");if(11===(f.Sb&31))throw a.debug.P("#GP handler");if(!f.ib)throw a.debug.P("#NP handler");
+if(103>f.Db)throw a.debug.P("#NP handler");e=a.xa[6];b=ze(a);g&&(b&=-16385);Cb(a,e,102);w(a,e+32,Fe(a));w(a,e+36,b);w(a,e+40,a.b[0]);w(a,e+44,a.b[1]);w(a,e+48,a.b[2]);w(a,e+52,a.b[3]);w(a,e+56,a.b[4]);w(a,e+60,a.b[5]);w(a,e+64,a.b[6]);w(a,e+68,a.b[7]);w(a,e+72,a.M[0]);w(a,e+76,a.M[1]);w(a,e+80,a.M[2]);w(a,e+84,a.M[3]);w(a,e+88,a.M[4]);w(a,e+92,a.M[5]);a.za(f.gf+5|0,a.ja(f.gf+5|0)|2);g=f.gb;u(a,g+0,a.M[6]);b=y(a,g+28);a.flags&=-131073;p=y(a,g+32);var r=x(a,g+76),v=Ie(a,r);if(v.Ta)throw a.debug.P("#TS handler");
+if(!v.Gb)throw a.debug.P("#TS handler");if(v.Fb)throw a.debug.P("#TS handler");if(!v.ic)throw a.debug.P("#TS handler");if(v.Lb&&v.$>v.Ba)throw a.debug.P("#TS handler");if(!v.Lb&&v.$!==v.Ba)throw a.debug.P("#TS handler");if(!v.ib)throw a.debug.P("#TS handler");a.eb[1]=0;a.La[1]=v.Db;a.xa[1]=v.gb;a.M[1]=r;a.N=v.$;ie(a);ce(a,v.size);r=y(a,g+36);w(a,e+0,h);r|=16384;if(r&131072)throw a.debug.P("task switch to VM mode");Be(a,r);a.flags|=16384;e=x(a,g+96);Je(a,e);a.b[0]=y(a,g+40);a.b[1]=y(a,g+44);a.b[2]=
+y(a,g+48);a.b[3]=y(a,g+52);a.b[4]=y(a,g+56);a.b[5]=y(a,g+60);a.b[6]=y(a,g+64);a.b[7]=y(a,g+68);$d(a,0,x(a,g+72));$d(a,2,x(a,g+80));$d(a,3,x(a,g+84));$d(a,4,x(a,g+88));$d(a,5,x(a,g+92));a.A=C(a,1)+p|0;a.xa[6]=f.gb;a.La[6]=f.Db;a.M[6]=h;a.K[3]=b;Ke(a);a.K[0]|=8;!1!==d&&(c?I(a,d&65535):J(a,d))}else{if(6!==(e&-10))throw a.debug.P("#GP handler");c=1===(e&1);e=0===(e&8);g=Ie(a,h);if(g.Ta)throw a.debug.P("#GP handler");if(!g.ic||g.$>a.N)throw a.debug.P("#GP handler");g.ib||Le(a,b<<3|2);b=ze(a);if(!g.Lb&&
+g.$<a.N){r=Me(a,g.$);a.Md?(p=jc(a,r),r=a.ma(r+4|0)):(p=a.ma(r),r=a.ma(r+2|0));v=Ie(a,r);if(v.Ta)throw a.debug.P("#TS handler");if(v.Ba!==g.$)throw a.debug.P("#TS handler");if(v.$!==g.$||!v.df)throw a.debug.P("#TS handler");if(!v.ib)throw a.debug.P("#TS handler");var E=a.b[4],z=a.M[2],A=(e?2:4)*(5+(!1!==d)+4*(131072===(b&131072)));Ne(a,v.gb+(v.size?p-A:p-A&65535));Ne(a,v.gb+p-1);a.N=g.$;ie(a);ce(a,g.size);a.flags&=-196609;$d(a,2,r);De(a,p);b&131072&&!e&&(J(a,a.M[5]),J(a,a.M[4]),J(a,a.M[3]),J(a,a.M[0]));
+e?(I(a,z),I(a,E)):(J(a,z),J(a,E))}else if(g.Lb||g.$===a.N)a.flags&131072&&H(a,h&-4),A=(e?2:4)*(3+(!1!==d)),Cb(a,G(a,-A),A);else throw a.debug.P("#GP handler");e?(I(a,b),I(a,a.M[1]),I(a,Fe(a)),!1!==d&&I(a,d),f&=65535):(J(a,b),J(a,a.M[1]),J(a,Fe(a)),!1!==d&&J(a,d));b&131072&&($d(a,5,0),$d(a,4,0),$d(a,3,0),$d(a,0,0));a.M[1]=h&-4|a.N;ce(a,g.size);a.La[1]=g.Db;a.xa[1]=g.gb;a.A=C(a,1)+f|0;a.flags&=-213249;c?a.J||ab(a):a.flags&=-513}}else h=b<<2,d=a.ma(h),h=a.ma(h+2|0),I(a,ze(a)),I(a,a.M[1]),I(a,Fe(a)),
+a.flags&=-513,Zd(a,h),a.A=C(a,1)+d|0}
+function Oe(a,b){ye(a)&&3>xe(a)&&H(a,0);if(b)var c=x(a,G(a,0)),d=x(a,G(a,2)),e=x(a,G(a,4));else c=y(a,G(a,0)),d=x(a,G(a,4)),e=y(a,G(a,8));if(!a.ta||ye(a)&&3===xe(a)){if(c&4294901760)throw a.debug.P("#GP handler");Zd(a,d);a.A=c+C(a,1)|0;b?(Be(a,e|a.flags&-65536),Ee(a,6)):(Be(a,e),Ee(a,12))}else{a.flags&16384&&H(a,0);if(e&131072){if(0===a.N){var f=y(a,G(a,12)),h=x(a,G(a,16));b=x(a,G(a,20));var g=x(a,G(a,24)),p=x(a,G(a,28)),r=x(a,G(a,32));Be(a,e);a.flags|=131072;Zd(a,d);a.A=(c&65535)+C(a,1)|0;$d(a,0,
+b);$d(a,3,g);$d(a,4,p);$d(a,5,r);Ee(a,36);a.b[4]=f;$d(a,2,h);a.N=3;ie(a);ce(a,!1);return}e&=-131073}g=Ie(a,d);if(g.Ta)throw a.debug.P("is null");if(!g.ib)throw a.debug.P("not present");if(!g.ic)throw a.debug.P("not exec");if(g.Ba<a.N)throw a.debug.P("rpl < cpl");if(g.Lb&&g.$>g.Ba)throw a.debug.P("conforming and dpl > rpl");g.Lb||g.Ba===g.$||H(a,d&-4);if(g.Ba>a.N){b?(f=x(a,G(a,6)),h=x(a,G(a,8))):(f=y(a,G(a,12)),h=x(a,G(a,16)));p=Ie(a,h);r=g.Ba;p.Ta&&H(a,0);p.Gb&&!p.Fb&&p.Ba===r&&p.Bf&&p.$===r||H(a,
+h&-4);if(!p.ib)throw a.A=a.ga,Ge(a,12,!1,h&-4),233495534;b?Be(a,e|a.flags&-65536):Be(a,e);a.N=g.Ba;ie(a);$d(a,2,h);De(a,f);0===a.N&&(a.flags=a.flags&-1572865|e&1572864)}else g.Ba===a.N&&(b?(Ee(a,6),Be(a,e|a.flags&-65536)):(Ee(a,12),Be(a,e)),0===a.N&&(a.flags=a.flags&-1572865|e&1572864));a.M[1]=d;ce(a,g.size);a.La[1]=g.Db;a.xa[1]=g.gb;a.A=c+C(a,1)|0}ab(a)}function Zd(a,b){a.M[1]=b;a.eb[1]=0;a.xa[1]=b<<4}
+function Pe(a,b,c,d){if(!a.ta||ye(a))Zd(a,c),a.A=C(a,1)+b|0,Ee(a,2*(Bb(a)?4:2)+d);else{var e=Ie(a,c);e.Ta&&H(a,0);e.Gb||H(a,c&-4);e.Fb&&H(a,c&-4);e.ic||H(a,c&-4);e.Ba<a.N&&H(a,c&-4);e.Lb&&e.$>e.Ba&&H(a,c&-4);e.Lb||e.$===e.Ba||H(a,c&-4);e.ib||Le(a,c&-4);if(e.Ba>a.N){if(Bb(a))var f=y(a,G(a,d+8)),h=x(a,G(a,d+12));else f=x(a,G(a,d+4)),h=x(a,G(a,d+6));a.N=e.Ba;ie(a);$d(a,2,h);De(a,f+d)}else Bb(a)?Ee(a,8+d):Ee(a,4+d);ce(a,e.size);a.eb[1]=0;a.La[1]=e.Db;a.xa[1]=e.gb;a.M[1]=c;a.A=C(a,1)+b|0}}
+function Qe(a,b,c,d){if(!a.ta||ye(a))d&&(Bb(a)?(Cb(a,G(a,-8),8),J(a,a.M[1]),J(a,Fe(a))):(Cb(a,G(a,-4),4),I(a,a.M[1]),I(a,Fe(a)))),Zd(a,c),a.A=C(a,1)+b|0;else{var e=Ie(a,c);e.Ta&&H(a,0);e.Gb||H(a,c&-4);if(e.Fb)if(12===e.type||4===e.type){b=4===e.type;(e.$<a.N||e.$<e.Ba)&&H(a,c&-4);e.ib||Le(a,c&-4);c=e.rg>>>16;var f=Ie(a,c);f.Ta&&H(a,0);f.Gb||H(a,c&-4);f.ic||H(a,c&-4);f.$>a.N&&H(a,c&-4);f.ib||Le(a,c&-4);if(!f.Lb&&f.$<a.N){var h=Me(a,f.$);if(a.Md){var g=jc(a,h);h=a.ma(h+4|0)}else g=a.ma(h),h=a.ma(h+
+2|0);var p=Ie(a,h);if(p.Ta)throw a.debug.P("#TS handler");if(p.Ba!==f.$)throw a.debug.P("#TS handler");if(p.$!==f.$||!p.df)throw a.debug.P("#TS handler");if(!p.ib)throw a.debug.P("#SS handler");var r=e.Pf&31,v=b?4:8;d&&(v+=b?4+2*r:8+4*r);p.size?Cb(a,p.gb+g-v|0,v):Cb(a,p.gb+(g-v&65535)|0,v);v=a.b[4];var E=a.M[2];p=G(a,0);a.N=f.$;ie(a);ce(a,f.size);$d(a,2,h);De(a,g);b?(I(a,E),I(a,v)):(J(a,E),J(a,v));if(d)if(b){for(d=r-1;0<=d;d--)g=x(a,p+2*d),I(a,g);I(a,a.M[1]);I(a,Fe(a))}else{for(d=r-1;0<=d;d--)g=y(a,
+p+4*d),J(a,g);J(a,a.M[1]);J(a,Fe(a))}}else d&&(b?(Cb(a,G(a,-4),4),I(a,a.M[1]),I(a,Fe(a))):(Cb(a,G(a,-8),8),J(a,a.M[1]),J(a,Fe(a))));d=e.rg&65535;b||(d|=e.Pf&4294901760);ce(a,f.size);a.eb[1]=0;a.La[1]=f.Db;a.xa[1]=f.gb;a.M[1]=c&-4|a.N;a.A=C(a,1)+d|0}else throw a.debug.P("load system segment descriptor, type = "+(e.Sb&15)+" ("+{9:"Available 386 TSS",11:"Busy 386 TSS",4:"286 Call Gate",12:"386 Call Gate"}[e.Sb&15]+")");else e.ic||H(a,c&-4),e.Lb?e.$>a.N&&H(a,c&-4):(e.Ba>a.N||e.$!==a.N)&&H(a,c&-4),e.ib||
+Le(a,c&-4),d&&(Bb(a)?(Cb(a,G(a,-8),8),J(a,a.M[1]),J(a,Fe(a))):(Cb(a,G(a,-4),4),I(a,a.M[1]),I(a,Fe(a)))),ce(a,e.size),a.eb[1]=0,a.La[1]=e.Db,a.xa[1]=e.gb,a.M[1]=c&-4|a.N,a.A=C(a,1)+b|0}}function Me(a,b){b=a.Md?(b<<3)+4|0:(b<<2)+2|0;if((b+5|0)>a.La[6])throw a.debug.P("#TS handler");b=b+a.xa[6]|0;a.V&&(b=He(a,b));return b}function Re(a){a.A=a.ga;Ge(a,0,!1,!1);throw 233495534;}function t(a){a.A=a.ga;Ge(a,6,!1,!1);throw 233495534;}function Se(a){a.A=a.ga;Ge(a,7,!1,!1);throw 233495534;}
+function H(a,b){a.A=a.ga;Ge(a,13,!1,b);throw 233495534;}function Le(a,b){a.A=a.ga;Ge(a,11,!1,b);throw 233495534;}function Te(a){a.K[0]&12&&Se(a)}function K(a){a.K[0]&12&&(a.K[0]&8?Se(a):t(a))}function L(a){return we(a,3)}function N(a){return we(a,2)}function we(a,b){var c=a.H&7;return c?7===c?0:C(a,c-1):C(a,b)}function C(a,b){a.ta&&a.eb[b]&&H(a,0);return a.xa[b]}function Ue(a){return 192>a.f?pe(a,F(a,a.f)):a.D[a.f<<2&12|a.f>>2&1]}function O(a){return 192>a.f?x(a,F(a,a.f)):a.h[a.f<<1&14]}
+function Ve(a){return 192>a.f?y(a,F(a,a.f)):a.b[a.f&7]}function We(a){return 192>a.f?y(a,F(a,a.f)):a.s[2*(a.f&7)]}function P(a){return 192>a.f?qe(a,F(a,a.f)):ke(a.s[2*(a.f&7)],a.s[2*(a.f&7)+1])}function Xe(a){if(192>a.f)return qe(a,F(a,a.f));var b=(a.f&7)<<2;return ke(a.na[b],a.na[b|1])}function Ye(a){if(192>a.f){var b=F(a,a.f);b=je(a,b);return le(jc(a,b),jc(a,b+4|0),jc(a,b+8|0),jc(a,b+12|0))}b=(a.f&7)<<2;return le(a.na[b],a.na[b|1],a.na[b|2],a.na[b|3])}
+function Ze(a,b){if(192>a.f){var c=F(a,a.f);re(a,c,b)}else a.D[a.f<<2&12|a.f>>2&1]=b}function $e(a,b){if(192>a.f){var c=F(a,a.f);u(a,c,b)}else a.h[a.f<<1&14]=b}function af(a,b){if(192>a.f){var c=F(a,a.f);w(a,c,b)}else a.b[a.f&7]=b}function bf(a){if(192>a.f){var b=F(a,a.f);a.m=se(a,b);return a.ja(a.m)}return a.D[a.f<<2&12|a.f>>2&1]}function cf(a,b){192>a.f?a.za(a.m,b):a.D[a.f<<2&12|a.f>>2&1]=b}
+function Q(a){if(192>a.f){var b=F(a,a.f);a.m=se(a,b);if(a.V&&4095===(b&4095))return a.v=se(a,b+1|0),b=a.v,a.ja(a.m)|a.ja(b)<<8;a.v=0;return a.ma(a.m)}return a.h[a.f<<1&14]}function R(a,b){if(192>a.f)if(a.v){var c=a.v;a.za(a.m,b);a.za(c,b>>8)}else a.ze(a.m,b);else a.h[a.f<<1&14]=b}
+function df(a){if(192>a.f){var b=F(a,a.f);a.m=se(a,b);if(a.V&&4093<=(b&4095)){a.v=se(a,b+3&-4)|b+3&3;b=a.m;var c=a.v;if(b&1)var d=b&2?xc(a,c-2>>1):xc(a,b+1>>1);else d=c-1|0,d=a.ja(b+1|0)|a.ja(d)<<8;return a.ja(b)|d<<8|a.ja(c)<<24}a.v=0;return jc(a,a.m)}return a.b[a.f&7]}function ef(a,b){192>a.f?a.v?oe(a,a.m,a.v,b):a.fd(a.m,b):a.b[a.f&7]=b}function ff(a){return a.h[a.f<<1&14]}function gf(a,b){a.h[a.f<<1&14]=b}function hf(a){return a.b[a.f&7]}function jf(a,b){a.b[a.f&7]=b}
+function kf(a){return a.D[a.f>>1&12|a.f>>5&1]}function lf(a,b){a.D[a.f>>1&12|a.f>>5&1]=b}function mf(a){return a.h[a.f>>2&14]}function nf(a){return a.se[a.f>>2&14]}function of(a,b){a.h[a.f>>2&14]=b}function S(a){return a.b[a.f>>3&7]}function pf(a,b){a.Fd[a.f>>3&7]=b}function qf(a){return ke(a.na[(a.f>>3&7)<<2],a.na[(a.f>>3&7)<<2|1])}function rf(a){var b=(a.f>>3&7)<<2;return le(a.na[b|0],a.na[b|1],a.na[b|2],a.na[b|3])}function sf(a){return ke(a.s[2*(a.f>>3&7)],a.s[2*(a.f>>3&7)+1])}
+function T(a,b,c){a.s[2*(a.f>>3&7)]=b;a.s[2*(a.f>>3&7)+1]=c}function tf(a,b,c,d,e){var f=(a.f>>3&7)<<2;a.na[f]=b;a.na[f+1]=c;a.na[f+2]=d;a.na[f+3]=e}function id(a,b){try{a.ga=a.A,Ge(a,b,!1,!1)}catch(c){a.tf(c)}}function ab(a){a.flags&512&&!a.J&&(a.G.Vc&&a.G.Vc.lf(),a.G.Zf&&a.G.Zf.lf())}k.Cb=function(a){this.G.Vc&&this.G.Vc.ef(a);this.G.Ve&&this.G.Ve.ef(a)};function Pb(a,b){a.G.Vc&&a.G.Vc.sf(b);a.G.Ve&&a.G.Ve.sf(b)}
+function uf(a,b,c){if(a.ta&&(a.N>xe(a)||a.flags&131072)){a.Md||H(a,0);var d=a.La[6],e=a.xa[6];if(103<=d){var f=a.ma(He(a,e+100+2|0));if(d>=(f+((b+c-1|0)>>3)|0)&&(c=(1<<c)-1<<(b&7),b=He(a,e+f+(b>>3)|0),!((c&65280?a.ma(b):a.ja(b))&c)))return}H(a,0)}}function ce(a,b){a.C!==b&&(a.C=b,Wd(a))}function Wd(a){a.oa=a.C?a.Za:a.Ya}
+function Ie(a,b){var c=0===(b&4),d=b&-8,e={Ba:b&3,hg:c,Ta:!1,Gb:!0,gb:0,Sb:0,flags:0,type:0,$:0,Fb:!1,ib:!1,ic:!1,df:!1,Lb:!1,size:!1,We:!1,Db:0,Bf:!1,mg:!1,gf:0,rg:0,Pf:0};if(c)var f=a.Qc,h=a.ie;else f=a.xa[7],h=a.La[7];if(c&&0===d)return e.Ta=!0,e;if((b|7)>h)return e.Gb=!1,e;f=f+d|0;a.V&&(f=He(a,f));e.gf=f;e.gb=a.ma(f+2|0)|a.ja(f+4|0)<<16|a.ja(f+7|0)<<24;e.Sb=a.ja(f+5|0);e.flags=a.ja(f+6|0)>>4;e.rg=jc(a,f|0);e.Pf=jc(a,f+4|0);e.type=e.Sb&15;e.$=e.Sb>>5&3;e.Fb=0===(e.Sb&16);e.ib=128===(e.Sb&128);
+e.ic=8===(e.Sb&8);e.df=2===(e.Sb&2);e.Lb=4===(e.Sb&4);e.We=e.Lb&&e.ic;e.size=4===(e.flags&4);a=a.ma(f)|(a.ja(f+6|0)&15)<<16;e.Db=e.flags&8?(a<<12|4095)>>>0:a;e.Bf=e.df&&!e.ic;e.mg=e.df||!e.ic;return e}
+function $d(a,b,c){if(!a.ta||ye(a))a.M[b]=c,a.eb[b]=0,a.xa[b]=c<<4,2===b&&(a.qb=!1);else{var d=Ie(a,c);if(2===b){d.Ta&&H(a,0);d.Gb&&!d.Fb&&d.Ba===a.N&&d.Bf&&d.$===a.N||H(a,c&-4);if(!d.ib)throw a.A=a.ga,Ge(a,12,!1,c&-4),233495534;a.qb=d.size}else if(1!==b){if(d.Ta){a.M[b]=c;a.eb[b]=1;return}(!d.Gb||d.Fb||!d.mg||!d.We&&(d.Ba>d.$||a.N>d.$))&&H(a,c&-4);d.ib||Le(a,c&-4)}a.eb[b]=0;a.La[b]=d.Db;a.xa[b]=d.gb;a.M[b]=c}}
+function Je(a,b){var c=Ie(a,b);if(c.Ta)a.xa[7]=0,a.La[7]=0;else{if(!c.hg)throw a.debug.P("LDTR can only be loaded from GDT");if(!c.ib)throw a.debug.P("#GP handler");if(!c.Fb)throw a.debug.P("#GP handler");if(2!==c.type)throw a.debug.P("#GP handler");a.xa[7]=c.gb;a.La[7]=c.Db;a.M[7]=b}}function vf(a,b,c){b=Ie(a,b);a.u&=-65;var d=b.$<a.N||b.$<b.Ba;if(b.Ta||!b.Gb||(b.Fb?58817>>b.type&1||d:!b.We&&d))return a.flags&=-65,c;a.flags|=64;return b.Pf&16776960}
+function wf(a,b,c){b=Ie(a,b);a.u&=-65;var d=b.$<a.N||b.$<b.Ba;if(b.Ta||!b.Gb||(b.Fb?62833>>b.type&1||d:!b.We&&d))return a.flags&=-65,c;a.flags|=64;return b.Db|0}function Ke(a){a.jc=-1;a.me=-1;a.oc.set(a.jf)}function Yd(a){for(var b=new Int32Array(a.jf.buffer),c=0;262144>c;)b[c++]=b[c++]=b[c++]=b[c++]=0;Ke(a)}function je(a,b){if(a.V)if(3===a.N)if(a.V){var c=b>>>12;a=a.oc[c]&4?a.R[c]^b:xf(a,b,0,1)|b&4095}else a=b;else a=He(a,b);else a=b;return a}
+function se(a,b){if(a.V)if(3===a.N)if(a.V){var c=b>>>12;a=a.oc[c]&8?a.R[c]^b:xf(a,b,1,1)|b&4095}else a=b;else a=Ne(a,b);else a=b;return a}function Ne(a,b){if(!a.V)return b;var c=b>>>12;return a.oc[c]&2?a.R[c]^b:xf(a,b,1,0)|b&4095}function He(a,b){if(!a.V)return b;var c=b>>>12;return a.oc[c]&1?a.R[c]^b:xf(a,b,0,0)|b&4095}
+function xf(a,b,c,d){var e=b>>>12,f=(a.K[3]>>>2)+(e>>10)|0,h=a.Cc[f],g=!0,p=!0;h&1||(a.K[2]=b,yf(a,c,d,0));0===(h&2)&&(g=!1,c&&(d||a.K[0]&65536)&&(a.K[2]=b,yf(a,c,d,1)));0===(h&4)&&(p=!1,d&&(a.K[2]=b,yf(a,c,d,1)));if(h&a.af)a.Cc[f]=h|32|c<<6,b=h&4290772992|b&4190208,h&=256;else{var r=((h&4294963200)>>>2)+(e&1023)|0,v=a.Cc[r];0===(v&1)&&(a.K[2]=b,yf(a,c,d,0));0===(v&2)&&(g=!1,c&&(d||a.K[0]&65536)&&(a.K[2]=b,yf(a,c,d,1)));0===(v&4)&&(p=!1,d&&(a.K[2]=b,yf(a,c,d,1)));Ac(a,f,h|32);Ac(a,r,v|32|c<<6);b=
+v&4294963200;h=v&256}a.R[e]=b^e<<12;g=p?g?15:5:g?3:1;a.oc[e]=g;h&&a.K[4]&128&&(a.jf[e]=g);return b}function Cb(a,b,c){if(a.V){var d=3===a.N?1:0,e=d?8:2,f=b>>>12;0===(a.oc[f]&e)&&xf(a,b,1,d);4096<=(b&4095)+c-1&&0===(a.oc[f+1|0]&e)&&xf(a,b+c-1|0,1,d)}}function yf(a,b,c,d){if(a.J)throw a.debug.P("Double fault");var e=a.K[2]>>>12;a.oc[e]=0;a.jf[e]=0;a.A=a.ga;a.J=!0;Ge(a,14,!1,c<<2|b<<1|d);throw 233495534;}function Bb(a){return a.C!==(32===(a.H&32))}function me(a){return a.C!==(64===(a.H&64))}
+function U(a,b){b=a.b[b];return me(a)?b:b&65535}function zf(a,b){me(a)?a.b[1]=b:a.h[2]=b}function V(a,b,c){me(a)?a.b[b]+=c:a.h[b<<1]+=c}function Af(a){return me(a)?--a.b[1]:--a.h[2]}"undefined"!==typeof window?window.CPU=q:"undefined"!==typeof module&&"undefined"!==typeof module.exports?module.exports.CPU=q:"function"===typeof importScripts&&(self.CPU=q);
+(function(){q.prototype.g=Array(192);q.prototype.i=Array(192);q.prototype.a=Array(256);q.prototype.g[0]=function(a){return L(a)+(a.h[6]+a.h[12]&65535)|0};q.prototype.g[64]=function(a){return L(a)+(a.h[6]+a.h[12]+a.mb()&65535)|0};q.prototype.g[128]=function(a){return L(a)+(a.h[6]+a.h[12]+a.Ib()&65535)|0};q.prototype.g[1]=function(a){return L(a)+(a.h[6]+a.h[14]&65535)|0};q.prototype.g[65]=function(a){return L(a)+(a.h[6]+a.h[14]+a.mb()&65535)|0};q.prototype.g[129]=function(a){return L(a)+(a.h[6]+a.h[14]+
+a.Ib()&65535)|0};q.prototype.g[2]=function(a){return N(a)+(a.h[10]+a.h[12]&65535)|0};q.prototype.g[66]=function(a){return N(a)+(a.h[10]+a.h[12]+a.mb()&65535)|0};q.prototype.g[130]=function(a){return N(a)+(a.h[10]+a.h[12]+a.Ib()&65535)|0};q.prototype.g[3]=function(a){return N(a)+(a.h[10]+a.h[14]&65535)|0};q.prototype.g[67]=function(a){return N(a)+(a.h[10]+a.h[14]+a.mb()&65535)|0};q.prototype.g[131]=function(a){return N(a)+(a.h[10]+a.h[14]+a.Ib()&65535)|0};q.prototype.g[4]=function(a){return L(a)+(a.h[12]&
+65535)|0};q.prototype.g[68]=function(a){return L(a)+(a.h[12]+a.mb()&65535)|0};q.prototype.g[132]=function(a){return L(a)+(a.h[12]+a.Ib()&65535)|0};q.prototype.g[5]=function(a){return L(a)+(a.h[14]&65535)|0};q.prototype.g[69]=function(a){return L(a)+(a.h[14]+a.mb()&65535)|0};q.prototype.g[133]=function(a){return L(a)+(a.h[14]+a.Ib()&65535)|0};q.prototype.g[6]=function(a){return N(a)+(a.h[10]&65535)|0};q.prototype.g[70]=function(a){return N(a)+(a.h[10]+a.mb()&65535)|0};q.prototype.g[134]=function(a){return N(a)+
+(a.h[10]+a.Ib()&65535)|0};q.prototype.g[7]=function(a){return L(a)+(a.h[6]&65535)|0};q.prototype.g[71]=function(a){return L(a)+(a.h[6]+a.mb()&65535)|0};q.prototype.g[135]=function(a){return L(a)+(a.h[6]+a.Ib()&65535)|0};q.prototype.i[0]=function(a){return L(a)+a.b[0]|0};q.prototype.i[64]=function(a){return L(a)+a.b[0]+a.mb()|0};q.prototype.i[128]=function(a){return L(a)+a.b[0]+a.X()|0};q.prototype.i[1]=function(a){return L(a)+a.b[1]|0};q.prototype.i[65]=function(a){return L(a)+a.b[1]+a.mb()|0};q.prototype.i[129]=
+function(a){return L(a)+a.b[1]+a.X()|0};q.prototype.i[2]=function(a){return L(a)+a.b[2]|0};q.prototype.i[66]=function(a){return L(a)+a.b[2]+a.mb()|0};q.prototype.i[130]=function(a){return L(a)+a.b[2]+a.X()|0};q.prototype.i[3]=function(a){return L(a)+a.b[3]|0};q.prototype.i[67]=function(a){return L(a)+a.b[3]+a.mb()|0};q.prototype.i[131]=function(a){return L(a)+a.b[3]+a.X()|0};q.prototype.i[5]=function(a){return N(a)+a.b[5]|0};q.prototype.i[69]=function(a){return N(a)+a.b[5]+a.mb()|0};q.prototype.i[133]=
+function(a){return N(a)+a.b[5]+a.X()|0};q.prototype.i[6]=function(a){return L(a)+a.b[6]|0};q.prototype.i[70]=function(a){return L(a)+a.b[6]+a.mb()|0};q.prototype.i[134]=function(a){return L(a)+a.b[6]+a.X()|0};q.prototype.i[7]=function(a){return L(a)+a.b[7]|0};q.prototype.i[71]=function(a){return L(a)+a.b[7]+a.mb()|0};q.prototype.i[135]=function(a){return L(a)+a.b[7]+a.X()|0};q.prototype.g[6]=function(a){return L(a)+a.Ib()|0};q.prototype.i[5]=function(a){return L(a)+a.X()|0};q.prototype.i[4]=function(a){return ne(a,
+!1)|0};q.prototype.i[68]=function(a){return ne(a,!0)+a.mb()|0};q.prototype.i[132]=function(a){return ne(a,!0)+a.X()|0};for(var a=0;8>a;a++)for(var b=0;3>b;b++)for(var c=a|b<<6,d=1;8>d;d++)q.prototype.i[c|d<<3]=q.prototype.i[c],q.prototype.g[c|d<<3]=q.prototype.g[c];q.prototype.a[0]=function(a){return a.b[0]+L(a)+a.b[0]|0};q.prototype.a[1]=function(a){return a.b[0]+L(a)+a.b[1]|0};q.prototype.a[2]=function(a){return a.b[0]+L(a)+a.b[2]|0};q.prototype.a[3]=function(a){return a.b[0]+L(a)+a.b[3]|0};q.prototype.a[4]=
+function(a){return a.b[0]+N(a)+a.b[4]|0};q.prototype.a[5]=function(a,b){return a.b[0]+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[6]=function(a){return a.b[0]+L(a)+a.b[6]|0};q.prototype.a[7]=function(a){return a.b[0]+L(a)+a.b[7]|0};q.prototype.a[64]=function(a){return(a.b[0]<<1)+L(a)+a.b[0]|0};q.prototype.a[65]=function(a){return(a.b[0]<<1)+L(a)+a.b[1]|0};q.prototype.a[66]=function(a){return(a.b[0]<<1)+L(a)+a.b[2]|0};q.prototype.a[67]=function(a){return(a.b[0]<<1)+L(a)+a.b[3]|0};q.prototype.a[68]=
+function(a){return(a.b[0]<<1)+N(a)+a.b[4]|0};q.prototype.a[69]=function(a,b){return(a.b[0]<<1)+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[70]=function(a){return(a.b[0]<<1)+L(a)+a.b[6]|0};q.prototype.a[71]=function(a){return(a.b[0]<<1)+L(a)+a.b[7]|0};q.prototype.a[128]=function(a){return(a.b[0]<<2)+L(a)+a.b[0]|0};q.prototype.a[129]=function(a){return(a.b[0]<<2)+L(a)+a.b[1]|0};q.prototype.a[130]=function(a){return(a.b[0]<<2)+L(a)+a.b[2]|0};q.prototype.a[131]=function(a){return(a.b[0]<<2)+L(a)+a.b[3]|
+0};q.prototype.a[132]=function(a){return(a.b[0]<<2)+N(a)+a.b[4]|0};q.prototype.a[133]=function(a,b){return(a.b[0]<<2)+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[134]=function(a){return(a.b[0]<<2)+L(a)+a.b[6]|0};q.prototype.a[135]=function(a){return(a.b[0]<<2)+L(a)+a.b[7]|0};q.prototype.a[192]=function(a){return(a.b[0]<<3)+L(a)+a.b[0]|0};q.prototype.a[193]=function(a){return(a.b[0]<<3)+L(a)+a.b[1]|0};q.prototype.a[194]=function(a){return(a.b[0]<<3)+L(a)+a.b[2]|0};q.prototype.a[195]=function(a){return(a.b[0]<<
+3)+L(a)+a.b[3]|0};q.prototype.a[196]=function(a){return(a.b[0]<<3)+N(a)+a.b[4]|0};q.prototype.a[197]=function(a,b){return(a.b[0]<<3)+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[198]=function(a){return(a.b[0]<<3)+L(a)+a.b[6]|0};q.prototype.a[199]=function(a){return(a.b[0]<<3)+L(a)+a.b[7]|0};q.prototype.a[8]=function(a){return a.b[1]+L(a)+a.b[0]|0};q.prototype.a[9]=function(a){return a.b[1]+L(a)+a.b[1]|0};q.prototype.a[10]=function(a){return a.b[1]+L(a)+a.b[2]|0};q.prototype.a[11]=function(a){return a.b[1]+
+L(a)+a.b[3]|0};q.prototype.a[12]=function(a){return a.b[1]+N(a)+a.b[4]|0};q.prototype.a[13]=function(a,b){return a.b[1]+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[14]=function(a){return a.b[1]+L(a)+a.b[6]|0};q.prototype.a[15]=function(a){return a.b[1]+L(a)+a.b[7]|0};q.prototype.a[72]=function(a){return(a.b[1]<<1)+L(a)+a.b[0]|0};q.prototype.a[73]=function(a){return(a.b[1]<<1)+L(a)+a.b[1]|0};q.prototype.a[74]=function(a){return(a.b[1]<<1)+L(a)+a.b[2]|0};q.prototype.a[75]=function(a){return(a.b[1]<<
+1)+L(a)+a.b[3]|0};q.prototype.a[76]=function(a){return(a.b[1]<<1)+N(a)+a.b[4]|0};q.prototype.a[77]=function(a,b){return(a.b[1]<<1)+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[78]=function(a){return(a.b[1]<<1)+L(a)+a.b[6]|0};q.prototype.a[79]=function(a){return(a.b[1]<<1)+L(a)+a.b[7]|0};q.prototype.a[136]=function(a){return(a.b[1]<<2)+L(a)+a.b[0]|0};q.prototype.a[137]=function(a){return(a.b[1]<<2)+L(a)+a.b[1]|0};q.prototype.a[138]=function(a){return(a.b[1]<<2)+L(a)+a.b[2]|0};q.prototype.a[139]=function(a){return(a.b[1]<<
+2)+L(a)+a.b[3]|0};q.prototype.a[140]=function(a){return(a.b[1]<<2)+N(a)+a.b[4]|0};q.prototype.a[141]=function(a,b){return(a.b[1]<<2)+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[142]=function(a){return(a.b[1]<<2)+L(a)+a.b[6]|0};q.prototype.a[143]=function(a){return(a.b[1]<<2)+L(a)+a.b[7]|0};q.prototype.a[200]=function(a){return(a.b[1]<<3)+L(a)+a.b[0]|0};q.prototype.a[201]=function(a){return(a.b[1]<<3)+L(a)+a.b[1]|0};q.prototype.a[202]=function(a){return(a.b[1]<<3)+L(a)+a.b[2]|0};q.prototype.a[203]=
+function(a){return(a.b[1]<<3)+L(a)+a.b[3]|0};q.prototype.a[204]=function(a){return(a.b[1]<<3)+N(a)+a.b[4]|0};q.prototype.a[205]=function(a,b){return(a.b[1]<<3)+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[206]=function(a){return(a.b[1]<<3)+L(a)+a.b[6]|0};q.prototype.a[207]=function(a){return(a.b[1]<<3)+L(a)+a.b[7]|0};q.prototype.a[16]=function(a){return a.b[2]+L(a)+a.b[0]|0};q.prototype.a[17]=function(a){return a.b[2]+L(a)+a.b[1]|0};q.prototype.a[18]=function(a){return a.b[2]+L(a)+a.b[2]|0};q.prototype.a[19]=
+function(a){return a.b[2]+L(a)+a.b[3]|0};q.prototype.a[20]=function(a){return a.b[2]+N(a)+a.b[4]|0};q.prototype.a[21]=function(a,b){return a.b[2]+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[22]=function(a){return a.b[2]+L(a)+a.b[6]|0};q.prototype.a[23]=function(a){return a.b[2]+L(a)+a.b[7]|0};q.prototype.a[80]=function(a){return(a.b[2]<<1)+L(a)+a.b[0]|0};q.prototype.a[81]=function(a){return(a.b[2]<<1)+L(a)+a.b[1]|0};q.prototype.a[82]=function(a){return(a.b[2]<<1)+L(a)+a.b[2]|0};q.prototype.a[83]=
+function(a){return(a.b[2]<<1)+L(a)+a.b[3]|0};q.prototype.a[84]=function(a){return(a.b[2]<<1)+N(a)+a.b[4]|0};q.prototype.a[85]=function(a,b){return(a.b[2]<<1)+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[86]=function(a){return(a.b[2]<<1)+L(a)+a.b[6]|0};q.prototype.a[87]=function(a){return(a.b[2]<<1)+L(a)+a.b[7]|0};q.prototype.a[144]=function(a){return(a.b[2]<<2)+L(a)+a.b[0]|0};q.prototype.a[145]=function(a){return(a.b[2]<<2)+L(a)+a.b[1]|0};q.prototype.a[146]=function(a){return(a.b[2]<<2)+L(a)+a.b[2]|
+0};q.prototype.a[147]=function(a){return(a.b[2]<<2)+L(a)+a.b[3]|0};q.prototype.a[148]=function(a){return(a.b[2]<<2)+N(a)+a.b[4]|0};q.prototype.a[149]=function(a,b){return(a.b[2]<<2)+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[150]=function(a){return(a.b[2]<<2)+L(a)+a.b[6]|0};q.prototype.a[151]=function(a){return(a.b[2]<<2)+L(a)+a.b[7]|0};q.prototype.a[208]=function(a){return(a.b[2]<<3)+L(a)+a.b[0]|0};q.prototype.a[209]=function(a){return(a.b[2]<<3)+L(a)+a.b[1]|0};q.prototype.a[210]=function(a){return(a.b[2]<<
+3)+L(a)+a.b[2]|0};q.prototype.a[211]=function(a){return(a.b[2]<<3)+L(a)+a.b[3]|0};q.prototype.a[212]=function(a){return(a.b[2]<<3)+N(a)+a.b[4]|0};q.prototype.a[213]=function(a,b){return(a.b[2]<<3)+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[214]=function(a){return(a.b[2]<<3)+L(a)+a.b[6]|0};q.prototype.a[215]=function(a){return(a.b[2]<<3)+L(a)+a.b[7]|0};q.prototype.a[24]=function(a){return a.b[3]+L(a)+a.b[0]|0};q.prototype.a[25]=function(a){return a.b[3]+L(a)+a.b[1]|0};q.prototype.a[26]=function(a){return a.b[3]+
+L(a)+a.b[2]|0};q.prototype.a[27]=function(a){return a.b[3]+L(a)+a.b[3]|0};q.prototype.a[28]=function(a){return a.b[3]+N(a)+a.b[4]|0};q.prototype.a[29]=function(a,b){return a.b[3]+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[30]=function(a){return a.b[3]+L(a)+a.b[6]|0};q.prototype.a[31]=function(a){return a.b[3]+L(a)+a.b[7]|0};q.prototype.a[88]=function(a){return(a.b[3]<<1)+L(a)+a.b[0]|0};q.prototype.a[89]=function(a){return(a.b[3]<<1)+L(a)+a.b[1]|0};q.prototype.a[90]=function(a){return(a.b[3]<<1)+
+L(a)+a.b[2]|0};q.prototype.a[91]=function(a){return(a.b[3]<<1)+L(a)+a.b[3]|0};q.prototype.a[92]=function(a){return(a.b[3]<<1)+N(a)+a.b[4]|0};q.prototype.a[93]=function(a,b){return(a.b[3]<<1)+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[94]=function(a){return(a.b[3]<<1)+L(a)+a.b[6]|0};q.prototype.a[95]=function(a){return(a.b[3]<<1)+L(a)+a.b[7]|0};q.prototype.a[152]=function(a){return(a.b[3]<<2)+L(a)+a.b[0]|0};q.prototype.a[153]=function(a){return(a.b[3]<<2)+L(a)+a.b[1]|0};q.prototype.a[154]=function(a){return(a.b[3]<<
+2)+L(a)+a.b[2]|0};q.prototype.a[155]=function(a){return(a.b[3]<<2)+L(a)+a.b[3]|0};q.prototype.a[156]=function(a){return(a.b[3]<<2)+N(a)+a.b[4]|0};q.prototype.a[157]=function(a,b){return(a.b[3]<<2)+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[158]=function(a){return(a.b[3]<<2)+L(a)+a.b[6]|0};q.prototype.a[159]=function(a){return(a.b[3]<<2)+L(a)+a.b[7]|0};q.prototype.a[216]=function(a){return(a.b[3]<<3)+L(a)+a.b[0]|0};q.prototype.a[217]=function(a){return(a.b[3]<<3)+L(a)+a.b[1]|0};q.prototype.a[218]=
+function(a){return(a.b[3]<<3)+L(a)+a.b[2]|0};q.prototype.a[219]=function(a){return(a.b[3]<<3)+L(a)+a.b[3]|0};q.prototype.a[220]=function(a){return(a.b[3]<<3)+N(a)+a.b[4]|0};q.prototype.a[221]=function(a,b){return(a.b[3]<<3)+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[222]=function(a){return(a.b[3]<<3)+L(a)+a.b[6]|0};q.prototype.a[223]=function(a){return(a.b[3]<<3)+L(a)+a.b[7]|0};q.prototype.a[32]=function(a){return L(a)+a.b[0]|0};q.prototype.a[33]=function(a){return L(a)+a.b[1]|0};q.prototype.a[34]=
+function(a){return L(a)+a.b[2]|0};q.prototype.a[35]=function(a){return L(a)+a.b[3]|0};q.prototype.a[36]=function(a){return N(a)+a.b[4]|0};q.prototype.a[37]=function(a,b){return(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[38]=function(a){return L(a)+a.b[6]|0};q.prototype.a[39]=function(a){return L(a)+a.b[7]|0};q.prototype.a[96]=function(a){return L(a)+a.b[0]|0};q.prototype.a[97]=function(a){return L(a)+a.b[1]|0};q.prototype.a[98]=function(a){return L(a)+a.b[2]|0};q.prototype.a[99]=function(a){return L(a)+
+a.b[3]|0};q.prototype.a[100]=function(a){return N(a)+a.b[4]|0};q.prototype.a[101]=function(a,b){return(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[102]=function(a){return L(a)+a.b[6]|0};q.prototype.a[103]=function(a){return L(a)+a.b[7]|0};q.prototype.a[160]=function(a){return L(a)+a.b[0]|0};q.prototype.a[161]=function(a){return L(a)+a.b[1]|0};q.prototype.a[162]=function(a){return L(a)+a.b[2]|0};q.prototype.a[163]=function(a){return L(a)+a.b[3]|0};q.prototype.a[164]=function(a){return N(a)+a.b[4]|0};
+q.prototype.a[165]=function(a,b){return(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[166]=function(a){return L(a)+a.b[6]|0};q.prototype.a[167]=function(a){return L(a)+a.b[7]|0};q.prototype.a[224]=function(a){return L(a)+a.b[0]|0};q.prototype.a[225]=function(a){return L(a)+a.b[1]|0};q.prototype.a[226]=function(a){return L(a)+a.b[2]|0};q.prototype.a[227]=function(a){return L(a)+a.b[3]|0};q.prototype.a[228]=function(a){return N(a)+a.b[4]|0};q.prototype.a[229]=function(a,b){return(b?N(a)+a.b[5]:L(a)+a.X())|
+0};q.prototype.a[230]=function(a){return L(a)+a.b[6]|0};q.prototype.a[231]=function(a){return L(a)+a.b[7]|0};q.prototype.a[40]=function(a){return a.b[5]+L(a)+a.b[0]|0};q.prototype.a[41]=function(a){return a.b[5]+L(a)+a.b[1]|0};q.prototype.a[42]=function(a){return a.b[5]+L(a)+a.b[2]|0};q.prototype.a[43]=function(a){return a.b[5]+L(a)+a.b[3]|0};q.prototype.a[44]=function(a){return a.b[5]+N(a)+a.b[4]|0};q.prototype.a[45]=function(a,b){return a.b[5]+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[46]=function(a){return a.b[5]+
+L(a)+a.b[6]|0};q.prototype.a[47]=function(a){return a.b[5]+L(a)+a.b[7]|0};q.prototype.a[104]=function(a){return(a.b[5]<<1)+L(a)+a.b[0]|0};q.prototype.a[105]=function(a){return(a.b[5]<<1)+L(a)+a.b[1]|0};q.prototype.a[106]=function(a){return(a.b[5]<<1)+L(a)+a.b[2]|0};q.prototype.a[107]=function(a){return(a.b[5]<<1)+L(a)+a.b[3]|0};q.prototype.a[108]=function(a){return(a.b[5]<<1)+N(a)+a.b[4]|0};q.prototype.a[109]=function(a,b){return(a.b[5]<<1)+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[110]=function(a){return(a.b[5]<<
+1)+L(a)+a.b[6]|0};q.prototype.a[111]=function(a){return(a.b[5]<<1)+L(a)+a.b[7]|0};q.prototype.a[168]=function(a){return(a.b[5]<<2)+L(a)+a.b[0]|0};q.prototype.a[169]=function(a){return(a.b[5]<<2)+L(a)+a.b[1]|0};q.prototype.a[170]=function(a){return(a.b[5]<<2)+L(a)+a.b[2]|0};q.prototype.a[171]=function(a){return(a.b[5]<<2)+L(a)+a.b[3]|0};q.prototype.a[172]=function(a){return(a.b[5]<<2)+N(a)+a.b[4]|0};q.prototype.a[173]=function(a,b){return(a.b[5]<<2)+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[174]=
+function(a){return(a.b[5]<<2)+L(a)+a.b[6]|0};q.prototype.a[175]=function(a){return(a.b[5]<<2)+L(a)+a.b[7]|0};q.prototype.a[232]=function(a){return(a.b[5]<<3)+L(a)+a.b[0]|0};q.prototype.a[233]=function(a){return(a.b[5]<<3)+L(a)+a.b[1]|0};q.prototype.a[234]=function(a){return(a.b[5]<<3)+L(a)+a.b[2]|0};q.prototype.a[235]=function(a){return(a.b[5]<<3)+L(a)+a.b[3]|0};q.prototype.a[236]=function(a){return(a.b[5]<<3)+N(a)+a.b[4]|0};q.prototype.a[237]=function(a,b){return(a.b[5]<<3)+(b?N(a)+a.b[5]:L(a)+a.X())|
+0};q.prototype.a[238]=function(a){return(a.b[5]<<3)+L(a)+a.b[6]|0};q.prototype.a[239]=function(a){return(a.b[5]<<3)+L(a)+a.b[7]|0};q.prototype.a[48]=function(a){return a.b[6]+L(a)+a.b[0]|0};q.prototype.a[49]=function(a){return a.b[6]+L(a)+a.b[1]|0};q.prototype.a[50]=function(a){return a.b[6]+L(a)+a.b[2]|0};q.prototype.a[51]=function(a){return a.b[6]+L(a)+a.b[3]|0};q.prototype.a[52]=function(a){return a.b[6]+N(a)+a.b[4]|0};q.prototype.a[53]=function(a,b){return a.b[6]+(b?N(a)+a.b[5]:L(a)+a.X())|0};
+q.prototype.a[54]=function(a){return a.b[6]+L(a)+a.b[6]|0};q.prototype.a[55]=function(a){return a.b[6]+L(a)+a.b[7]|0};q.prototype.a[112]=function(a){return(a.b[6]<<1)+L(a)+a.b[0]|0};q.prototype.a[113]=function(a){return(a.b[6]<<1)+L(a)+a.b[1]|0};q.prototype.a[114]=function(a){return(a.b[6]<<1)+L(a)+a.b[2]|0};q.prototype.a[115]=function(a){return(a.b[6]<<1)+L(a)+a.b[3]|0};q.prototype.a[116]=function(a){return(a.b[6]<<1)+N(a)+a.b[4]|0};q.prototype.a[117]=function(a,b){return(a.b[6]<<1)+(b?N(a)+a.b[5]:
+L(a)+a.X())|0};q.prototype.a[118]=function(a){return(a.b[6]<<1)+L(a)+a.b[6]|0};q.prototype.a[119]=function(a){return(a.b[6]<<1)+L(a)+a.b[7]|0};q.prototype.a[176]=function(a){return(a.b[6]<<2)+L(a)+a.b[0]|0};q.prototype.a[177]=function(a){return(a.b[6]<<2)+L(a)+a.b[1]|0};q.prototype.a[178]=function(a){return(a.b[6]<<2)+L(a)+a.b[2]|0};q.prototype.a[179]=function(a){return(a.b[6]<<2)+L(a)+a.b[3]|0};q.prototype.a[180]=function(a){return(a.b[6]<<2)+N(a)+a.b[4]|0};q.prototype.a[181]=function(a,b){return(a.b[6]<<
+2)+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[182]=function(a){return(a.b[6]<<2)+L(a)+a.b[6]|0};q.prototype.a[183]=function(a){return(a.b[6]<<2)+L(a)+a.b[7]|0};q.prototype.a[240]=function(a){return(a.b[6]<<3)+L(a)+a.b[0]|0};q.prototype.a[241]=function(a){return(a.b[6]<<3)+L(a)+a.b[1]|0};q.prototype.a[242]=function(a){return(a.b[6]<<3)+L(a)+a.b[2]|0};q.prototype.a[243]=function(a){return(a.b[6]<<3)+L(a)+a.b[3]|0};q.prototype.a[244]=function(a){return(a.b[6]<<3)+N(a)+a.b[4]|0};q.prototype.a[245]=function(a,
+b){return(a.b[6]<<3)+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[246]=function(a){return(a.b[6]<<3)+L(a)+a.b[6]|0};q.prototype.a[247]=function(a){return(a.b[6]<<3)+L(a)+a.b[7]|0};q.prototype.a[56]=function(a){return a.b[7]+L(a)+a.b[0]|0};q.prototype.a[57]=function(a){return a.b[7]+L(a)+a.b[1]|0};q.prototype.a[58]=function(a){return a.b[7]+L(a)+a.b[2]|0};q.prototype.a[59]=function(a){return a.b[7]+L(a)+a.b[3]|0};q.prototype.a[60]=function(a){return a.b[7]+N(a)+a.b[4]|0};q.prototype.a[61]=function(a,
+b){return a.b[7]+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[62]=function(a){return a.b[7]+L(a)+a.b[6]|0};q.prototype.a[63]=function(a){return a.b[7]+L(a)+a.b[7]|0};q.prototype.a[120]=function(a){return(a.b[7]<<1)+L(a)+a.b[0]|0};q.prototype.a[121]=function(a){return(a.b[7]<<1)+L(a)+a.b[1]|0};q.prototype.a[122]=function(a){return(a.b[7]<<1)+L(a)+a.b[2]|0};q.prototype.a[123]=function(a){return(a.b[7]<<1)+L(a)+a.b[3]|0};q.prototype.a[124]=function(a){return(a.b[7]<<1)+N(a)+a.b[4]|0};q.prototype.a[125]=
+function(a,b){return(a.b[7]<<1)+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[126]=function(a){return(a.b[7]<<1)+L(a)+a.b[6]|0};q.prototype.a[127]=function(a){return(a.b[7]<<1)+L(a)+a.b[7]|0};q.prototype.a[184]=function(a){return(a.b[7]<<2)+L(a)+a.b[0]|0};q.prototype.a[185]=function(a){return(a.b[7]<<2)+L(a)+a.b[1]|0};q.prototype.a[186]=function(a){return(a.b[7]<<2)+L(a)+a.b[2]|0};q.prototype.a[187]=function(a){return(a.b[7]<<2)+L(a)+a.b[3]|0};q.prototype.a[188]=function(a){return(a.b[7]<<2)+N(a)+a.b[4]|
+0};q.prototype.a[189]=function(a,b){return(a.b[7]<<2)+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[190]=function(a){return(a.b[7]<<2)+L(a)+a.b[6]|0};q.prototype.a[191]=function(a){return(a.b[7]<<2)+L(a)+a.b[7]|0};q.prototype.a[248]=function(a){return(a.b[7]<<3)+L(a)+a.b[0]|0};q.prototype.a[249]=function(a){return(a.b[7]<<3)+L(a)+a.b[1]|0};q.prototype.a[250]=function(a){return(a.b[7]<<3)+L(a)+a.b[2]|0};q.prototype.a[251]=function(a){return(a.b[7]<<3)+L(a)+a.b[3]|0};q.prototype.a[252]=function(a){return(a.b[7]<<
+3)+N(a)+a.b[4]|0};q.prototype.a[253]=function(a,b){return(a.b[7]<<3)+(b?N(a)+a.b[5]:L(a)+a.X())|0};q.prototype.a[254]=function(a){return(a.b[7]<<3)+L(a)+a.b[6]|0};q.prototype.a[255]=function(a){return(a.b[7]<<3)+L(a)+a.b[7]|0}})();function Bf(a,b){return 0>a?(b&4095)>>(-a>>1):(~b&4095)>>a}function Cf(a,b,c){return Math.min(Bf(a,b),Bf(a,c))}function Df(a,b,c){return a.add(b,c,7)}function Ef(a,b,c){return a.add(b,c,15)}function Ff(a,b,c){return a.add(b,c,31)}function Of(a,b,c){return Pf(a,b,c,7)}
+function Qf(a,b,c){return Pf(a,b,c,15)}function Rf(a,b,c){return Pf(a,b,c,31)}function Sf(a,b,c){return a.sub(b,c,7)}function Tf(a,b,c){return a.sub(b,c,15)}function Uf(a,b,c){return a.sub(b,c,31)}function Vf(a,b,c){return Wf(a,b,c,7)}function Xf(a,b,c){return Wf(a,b,c,15)}function Yf(a,b,c){return Wf(a,b,c,31)}k=q.prototype;k.add=function(a,b,c){this.jb=a;this.kb=b;this.l=this.F=a+b|0;this.S=c;this.u=2261;return this.F};
+function Pf(a,b,c,d){var e=a.cb();a.jb=b;a.kb=c;a.l=a.F=(b+c|0)+e|0;a.S=d;a.u=2261;return a.F}k.sub=function(a,b,c){this.l=a;this.kb=b;this.jb=this.F=a-b|0;this.S=c;this.u=2261;return this.F};function Wf(a,b,c,d){var e=a.cb();a.l=b;a.kb=c;a.jb=a.F=b-c-e|0;a.S=d;a.u=2261;return a.F}function Zf(a,b,c){a.flags=a.flags&-2|a.cb();a.jb=b;a.kb=1;a.l=a.F=b+1|0;a.S=c;a.u=2260;return a.F}function $f(a,b,c){a.flags=a.flags&-2|a.cb();a.l=b;a.kb=1;a.jb=a.F=b-1|0;a.S=c;a.u=2260;return a.F}
+function ag(a,b,c){a.jb=a.F=-b|0;a.u=2261;a.l=0;a.kb=b;a.S=c;return a.F}function bg(a,b,c){b*=c;a.F=b&65535;a.S=15;a.flags=32767<b||-32768>b?a.flags|2049:a.flags&-2050;a.u=212;return b}function cg(a,b,c){var d=b&65535;b>>>=16;var e=c&65535;c>>>=16;var f=d*e;e=(f>>>16)+(b*e|0)|0;var h=e>>>16;e=(e&65535)+(d*c|0)|0;a.ka[0]=e<<16|f&65535;a.ka[1]=((e>>>16)+(b*c|0)|0)+h|0;return a.ka}
+function dg(a,b,c){var d=!1;0>b&&(d=!0,b=-b|0);0>c&&(d=!d,c=-c|0);a=cg(a,b,c);d&&(a[0]=-a[0]|0,a[1]=~a[1]+!a[0]|0);return a}function eg(a,b,c){b=dg(a,b,c);a.F=b[0];a.S=31;a.flags=b[1]===b[0]>>31?a.flags&-2050:a.flags|2049;a.u=212;return b[0]}function fg(a,b,c,d){(c>=d||0===d)&&Re(a);var e=0;if(1048576<c){for(var f=32,h=d;h>c;)h>>>=1,f--;for(;1048576<c;){if(c>=h){c-=h;var g=d<<f>>>0;g>b&&c--;b=b-g>>>0;e|=1<<f}f--;h>>=1}e>>>=0}b+=4294967296*c;a.Z[0]=e+(b/d|0);a.Z[1]=b%d;return a.Z}
+function gg(a,b,c){return a.and(b,c,7)}function hg(a,b,c){return a.and(b,c,15)}function ig(a,b,c){return a.and(b,c,31)}function jg(a,b,c){return a.or(b,c,7)}function kg(a,b,c){return a.or(b,c,15)}function lg(a,b,c){return a.or(b,c,31)}function mg(a,b,c){return a.xor(b,c,7)}function ng(a,b,c){return a.xor(b,c,15)}function og(a,b,c){return a.xor(b,c,31)}k.and=function(a,b,c){this.F=a&b;this.S=c;this.flags&=-2066;this.u=196;return this.F};
+k.or=function(a,b,c){this.F=a|b;this.S=c;this.flags&=-2066;this.u=196;return this.F};k.xor=function(a,b,c){this.F=a^b;this.S=c;this.flags&=-2066;this.u=196;return this.F};function pg(a,b,c){if(!c)return b;c&=7;b=b<<c|b>>8-c;a.u&=-2050;a.flags=a.flags&-2050|b&1|(b<<11^b<<4)&2048;return b}function qg(a,b,c){if(!c)return b;c&=15;b=b<<c|b>>16-c;a.u&=-2050;a.flags=a.flags&-2050|b&1|(b<<11^b>>4)&2048;return b}
+function rg(a,b,c){if(!c)return b;b=b<<c|b>>>32-c;a.u&=-2050;a.flags=a.flags&-2050|b&1|(b<<11^b>>20)&2048;return b}function sg(a,b,c){c%=9;if(!c)return b;b=b<<c|a.cb()<<c-1|b>>9-c;a.u&=-2050;a.flags=a.flags&-2050|b>>8&1|(b<<3^b<<4)&2048;return b}function tg(a,b,c){c%=17;if(!c)return b;b=b<<c|a.cb()<<c-1|b>>17-c;a.u&=-2050;a.flags=a.flags&-2050|b>>16&1|(b>>5^b>>4)&2048;return b}
+function ug(a,b,c){if(!c)return b;var d=b<<c|a.cb()<<c-1;1<c&&(d|=b>>>33-c);a.u&=-2050;a.flags=a.flags&-2050|b>>>32-c&1;a.flags|=(a.flags<<11^d>>20)&2048;return d}function vg(a,b,c){if(!c)return b;c&=7;b=b>>c|b<<8-c;a.u&=-2050;a.flags=a.flags&-2050|b>>7&1|(b<<4^b<<5)&2048;return b}function wg(a,b,c){if(!c)return b;c&=15;b=b>>c|b<<16-c;a.u&=-2050;a.flags=a.flags&-2050|b>>15&1|(b>>4^b>>3)&2048;return b}
+function xg(a,b,c){if(!c)return b;b=b>>>c|b<<32-c;a.u&=-2050;a.flags=a.flags&-2050|b>>31&1|(b>>20^b>>19)&2048;return b}function yg(a,b,c){c%=9;if(!c)return b;b=b>>c|a.cb()<<8-c|b<<9-c;a.u&=-2050;a.flags=a.flags&-2050|b>>8&1|(b<<4^b<<5)&2048;return b}function zg(a,b,c){c%=17;if(!c)return b;b=b>>c|a.cb()<<16-c|b<<17-c;a.u&=-2050;a.flags=a.flags&-2050|b>>16&1|(b>>4^b>>3)&2048;return b}
+function Ag(a,b,c){if(!c)return b;var d=b>>>c|a.cb()<<32-c;1<c&&(d|=b<<33-c);a.u&=-2050;a.flags=a.flags&-2050|b>>c-1&1|(d>>20^d>>19)&2048;return d}function Bg(a,b,c){if(0===c)return b;a.F=b<<c;a.S=7;a.u=212;a.flags=a.flags&-2050|a.F>>8&1|(a.F<<3^a.F<<4)&2048;return a.F}function Cg(a,b,c){if(0===c)return b;a.F=b<<c;a.S=15;a.u=212;a.flags=a.flags&-2050|a.F>>16&1|(a.F>>5^a.F>>4)&2048;return a.F}
+function Dg(a,b,c){if(0===c)return b;a.F=b<<c;a.S=31;a.u=212;a.flags=a.flags&-2050|b>>>32-c&1;a.flags|=(a.flags&1^a.F>>31&1)<<11&2048;return a.F}function Eg(a,b,c){if(0===c)return b;a.F=b>>c;a.S=7;a.u=212;a.flags=a.flags&-2050|b>>c-1&1|(b>>7&1)<<11&2048;return a.F}function Fg(a,b,c){if(0===c)return b;a.F=b>>c;a.S=15;a.u=212;a.flags=a.flags&-2050|b>>c-1&1|b>>4&2048;return a.F}function Gg(a,b,c){if(0===c)return b;a.F=b>>>c;a.S=31;a.u=212;a.flags=a.flags&-2050|b>>>c-1&1|b>>20&2048;return a.F}
+function Hg(a,b,c){if(0===c)return b;8>c?(a.F=b<<24>>c+24,a.flags=a.flags&-2050|b>>c-1&1):(a.F=b<<24>>31,a.flags=a.flags&-2050|a.F&1);a.S=7;a.u=212;return a.F}function Ig(a,b,c){if(0===c)return b;16>c?(a.F=b<<16>>c+16,a.flags=a.flags&-2050|b>>c-1&1):(a.F=b<<16>>31,a.flags=a.flags&-2050|a.F&1);a.S=15;a.u=212;return a.F}function Jg(a,b,c){if(0===c)return b;a.F=b>>c;a.S=31;a.u=212;a.flags=a.flags&-2050|b>>>c-1&1;return a.F}
+function Kg(a,b,c,d){if(0===d)return b;16>=d?(a.F=b>>d|c<<16-d,a.flags=a.flags&-2|b>>d-1&1):(a.F=b<<32-d|c>>d-16,a.flags=a.flags&-2|c>>d-17&1);a.S=15;a.u=212;a.flags=a.flags&-2049|(a.F^b)>>4&2048;return a.F}function Lg(a,b,c,d){if(0===d)return b;a.F=b>>>d|c<<32-d;a.S=31;a.u=212;a.flags=a.flags&-2|b>>>d-1&1;a.flags=a.flags&-2049|(a.F^b)>>20&2048;return a.F}
+function Mg(a,b,c,d){if(0===d)return b;16>=d?(a.F=b<<d|c>>>16-d,a.flags=a.flags&-2|b>>>16-d&1):(a.F=b>>32-d|c<<d-16,a.flags=a.flags&-2|c>>>32-d&1);a.S=15;a.u=212;a.flags=a.flags&-2049|(a.flags&1^a.F>>15&1)<<11;return a.F}function Ng(a,b,c,d){if(0===d)return b;a.F=b<<d|c>>>32-d;a.S=31;a.u=212;a.flags=a.flags&-2|b>>>32-d&1;a.flags=1===d?a.flags&-2049|(a.flags&1^a.F>>31&1)<<11:a.flags&-2049;return a.F}function Og(a,b,c){a.flags=a.flags&-2|b>>c&1;a.u&=-2}
+function Pg(a,b,c){a.flags=a.flags&-2|b>>c&1;a.u&=-2;return b^1<<c}function Qg(a,b,c){a.flags=a.flags&-2|b>>c&1;a.u&=-2;return b|1<<c}function Rg(a,b,c){a.flags=a.flags&-2|b>>c&1;a.u&=-2;return b&~(1<<c)}function Sg(a,b,c){b=pe(a,b+(c>>3)|0);a.flags=a.flags&-2|b>>(c&7)&1;a.u&=-2}function Tg(a,b,c){b=se(a,b+(c>>3)|0);var d=a.ja(b);c&=7;a.flags=a.flags&-2|d>>c&1;a.u&=-2;a.za(b,d^1<<c)}function Ug(a,b,c){b=se(a,b+(c>>3)|0);var d=a.ja(b);c&=7;a.flags=a.flags&-2|d>>c&1;a.u&=-2;a.za(b,d&~(1<<c))}
+function Vg(a,b,c){b=se(a,b+(c>>3)|0);var d=a.ja(b);c&=7;a.flags=a.flags&-2|d>>c&1;a.u&=-2;a.za(b,d|1<<c)}function Wg(a,b){a.u=0;a.flags&=-2262;if(b)return b-=b>>1&1431655765,b=(b&858993459)+(b>>2&858993459),16843009*(b+(b>>4)&252645135)>>24;a.flags|=64;return 0}function Xg(a){a>>>=0;32768<=a?a=0:255<a&&(a=255);return a}function Yg(a){65408<a?a&=255:32767<a?a=128:127<a&&(a=127);return a}function Zg(a){a>>>=0;4294934528<a?a&=65535:2147483647<a?a=32768:32767<a&&(a=32767);return a}
+function $g(a){a>>>=0;4294967168<a?a&=255:2147483647<a?a=128:127<a&&(a=127);return a}function ah(a){a|=0;0>a&&(a=0);return a}function bh(a){a>>>=0;255<a&&(a=255);return a}function ch(a){return 65535<a?65535:a}function dh(a,b){var c=a.wa();b&&(a.A=a.A+c|0)}function eh(a,b){var c=C(a,1);a.A-=c;a.A=a.A+b&65535;a.A=a.A+c|0}function fh(a,b){var c=a.U();b&&eh(a,c)}function gh(a,b){var c=a.ea();b&&(a.A=a.A+c|0)}function hh(a,b){var c=O(a);b&&of(a,c)}function ih(a,b){var c=Ve(a);b&&pf(a,c)}
+function jh(a,b){Ze(a,b?1:0)}k=q.prototype;k.loop=function(a){Af(this)&&(this.A=this.A+a|0)};k.cb=function(){return this.u&1?(this.jb^(this.jb^this.kb)&(this.kb^this.l))>>>this.S&1:this.flags&1};k.Ug=function(){return this.u&4?154020>>((this.F^this.F>>4)&15)&4:this.flags&4};function Ae(a){return a.u&16?(a.jb^a.kb^a.l)&16:a.flags&16}k.Ac=function(){return this.u&64?(~this.F&this.F-1)>>>this.S&1:this.flags&64};k.xf=function(){return this.u&128?this.F>>>this.S&1:this.flags&128};
+k.Te=function(){return this.u&2048?((this.jb^this.l)&(this.kb^this.l))>>>this.S&1:this.flags&2048};k.Qb=q.prototype.Te;k.yb=q.prototype.cb;k.Ab=q.prototype.Ac;k.Rb=q.prototype.xf;k.zb=q.prototype.Ug;function kh(a){return a.cb()||a.Ac()}function lh(a){return!a.xf()!==!a.Te()}function mh(a){return a.Ac()||!a.xf()!==!a.Te()}function I(a,b){var c=G(a,-2);u(a,c,b);Ee(a,-2)}function J(a,b){var c=G(a,-4);w(a,c,b);Ee(a,-4)}function nh(a){var b=C(a,2)+Ce(a)|0;b=x(a,b);Ee(a,2);return b}
+function oh(a){var b=C(a,2)+Ce(a)|0;b=y(a,b);Ee(a,4);return b}function ph(a,b){var c=a.h[0];a.h[0]=a.h[b];a.h[b]=c}function qh(a,b){var c=a.b[0];a.b[0]=a.b[b];a.b[b]=c}function rh(a,b){192<=a.f&&t(a);var c=F(a,a.f),d=x(a,c);c=x(a,c+2|0);$d(a,b,c);a.h[a.f>>2&14]=d}function sh(a,b){192<=a.f&&t(a);var c=F(a,a.f),d=y(a,c);c=x(a,c+4|0);$d(a,b,c);a.b[a.f>>3&7]=d}function th(a,b){var c=a.b[b];a.b[b]=c>>>24|c<<24|c>>8&65280|c<<8&16711680}var W=[],X=[],Z=[];W[0]=function(a){D(a);cf(a,Df(a,bf(a),kf(a)))};
+X[1]=function(a){D(a);R(a,Ef(a,Q(a),mf(a)))};Z[1]=function(a){D(a);ef(a,Ff(a,df(a),S(a)))};W[2]=function(a){D(a);lf(a,Df(a,kf(a),Ue(a)))};X[3]=function(a){D(a);of(a,Ef(a,mf(a),O(a)))};Z[3]=function(a){D(a);pf(a,Ff(a,S(a),Ve(a)))};W[4]=function(a){a.D[0]=Df(a,a.D[0],a.L())};X[5]=function(a){a.h[0]=Ef(a,a.h[0],a.U())};Z[5]=function(a){a.b[0]=Ff(a,a.b[0],a.ea())};X[6]=function(a){I(a,a.M[0])};Z[6]=function(a){J(a,a.M[0])};X[7]=function(a){$d(a,0,x(a,G(a,0)));Ee(a,2)};
+Z[7]=function(a){$d(a,0,y(a,G(a,0))&65535);Ee(a,4)};W[8]=function(a){D(a);cf(a,jg(a,bf(a),kf(a)))};X[9]=function(a){D(a);R(a,kg(a,Q(a),mf(a)))};Z[9]=function(a){D(a);ef(a,lg(a,df(a),S(a)))};W[10]=function(a){D(a);lf(a,jg(a,kf(a),Ue(a)))};X[11]=function(a){D(a);of(a,kg(a,mf(a),O(a)))};Z[11]=function(a){D(a);pf(a,lg(a,S(a),Ve(a)))};W[12]=function(a){a.D[0]=jg(a,a.D[0],a.L())};X[13]=function(a){a.h[0]=kg(a,a.h[0],a.U())};Z[13]=function(a){a.b[0]=lg(a,a.b[0],a.ea())};X[14]=function(a){I(a,a.M[1])};
+Z[14]=function(a){J(a,a.M[1])};X[15]=function(a){a.qk[a.yh()](a)};Z[15]=function(a){a.rk[a.yh()](a)};W[16]=function(a){D(a);cf(a,Of(a,bf(a),kf(a)))};X[17]=function(a){D(a);R(a,Qf(a,Q(a),mf(a)))};Z[17]=function(a){D(a);ef(a,Rf(a,df(a),S(a)))};W[18]=function(a){D(a);lf(a,Of(a,kf(a),Ue(a)))};X[19]=function(a){D(a);of(a,Qf(a,mf(a),O(a)))};Z[19]=function(a){D(a);pf(a,Rf(a,S(a),Ve(a)))};W[20]=function(a){a.D[0]=Of(a,a.D[0],a.L())};X[21]=function(a){a.h[0]=Qf(a,a.h[0],a.U())};
+Z[21]=function(a){a.b[0]=Rf(a,a.b[0],a.ea())};X[22]=function(a){I(a,a.M[2])};Z[22]=function(a){J(a,a.M[2])};X[23]=function(a){$d(a,2,x(a,G(a,0)));Ee(a,2);a.H=0;ee(a)};Z[23]=function(a){$d(a,2,y(a,G(a,0))&65535);Ee(a,4);a.H=0;ee(a)};W[24]=function(a){D(a);cf(a,Vf(a,bf(a),kf(a)))};X[25]=function(a){D(a);R(a,Xf(a,Q(a),mf(a)))};Z[25]=function(a){D(a);ef(a,Yf(a,df(a),S(a)))};W[26]=function(a){D(a);lf(a,Vf(a,kf(a),Ue(a)))};X[27]=function(a){D(a);of(a,Xf(a,mf(a),O(a)))};
+Z[27]=function(a){D(a);pf(a,Yf(a,S(a),Ve(a)))};W[28]=function(a){a.D[0]=Vf(a,a.D[0],a.L())};X[29]=function(a){a.h[0]=Xf(a,a.h[0],a.U())};Z[29]=function(a){a.b[0]=Yf(a,a.b[0],a.ea())};X[30]=function(a){I(a,a.M[3])};Z[30]=function(a){J(a,a.M[3])};X[31]=function(a){$d(a,3,x(a,G(a,0)));Ee(a,2)};Z[31]=function(a){$d(a,3,y(a,G(a,0))&65535);Ee(a,4)};W[32]=function(a){D(a);cf(a,gg(a,bf(a),kf(a)))};X[33]=function(a){D(a);R(a,hg(a,Q(a),mf(a)))};Z[33]=function(a){D(a);ef(a,ig(a,df(a),S(a)))};
+W[34]=function(a){D(a);lf(a,gg(a,kf(a),Ue(a)))};X[35]=function(a){D(a);of(a,hg(a,mf(a),O(a)))};Z[35]=function(a){D(a);pf(a,ig(a,S(a),Ve(a)))};W[36]=function(a){a.D[0]=gg(a,a.D[0],a.L())};X[37]=function(a){a.h[0]=hg(a,a.h[0],a.U())};Z[37]=function(a){a.b[0]=ig(a,a.b[0],a.ea())};W[38]=function(a){fe(a,0)};W[39]=function(a){var b=a.D[0],c=a.cb(),d=Ae(a);a.flags&=-18;if(9<(b&15)||d)a.D[0]+=6,a.flags|=16;if(153<b||c)a.D[0]+=96,a.flags|=1;a.F=a.D[0];a.S=7;a.jb=a.kb=0;a.u=196};
+W[40]=function(a){D(a);cf(a,Sf(a,bf(a),kf(a)))};X[41]=function(a){D(a);R(a,Tf(a,Q(a),mf(a)))};Z[41]=function(a){D(a);ef(a,Uf(a,df(a),S(a)))};W[42]=function(a){D(a);lf(a,Sf(a,kf(a),Ue(a)))};X[43]=function(a){D(a);of(a,Tf(a,mf(a),O(a)))};Z[43]=function(a){D(a);pf(a,Uf(a,S(a),Ve(a)))};W[44]=function(a){a.D[0]=Sf(a,a.D[0],a.L())};X[45]=function(a){a.h[0]=Tf(a,a.h[0],a.U())};Z[45]=function(a){a.b[0]=Uf(a,a.b[0],a.ea())};W[46]=function(a){fe(a,1)};
+W[47]=function(a){var b=a.D[0],c=a.cb();a.flags&=-2;9<(b&15)||Ae(a)?(a.D[0]-=6,a.flags|=16,a.flags=a.flags&-2|c|6>b):a.flags&=-17;if(153<b||c)a.D[0]-=96,a.flags|=1;a.F=a.D[0];a.S=7;a.jb=a.kb=0;a.u=196};W[48]=function(a){D(a);cf(a,mg(a,bf(a),kf(a)))};X[49]=function(a){D(a);R(a,ng(a,Q(a),mf(a)))};Z[49]=function(a){D(a);ef(a,og(a,df(a),S(a)))};W[50]=function(a){D(a);lf(a,mg(a,kf(a),Ue(a)))};X[51]=function(a){D(a);of(a,ng(a,mf(a),O(a)))};Z[51]=function(a){D(a);pf(a,og(a,S(a),Ve(a)))};
+W[52]=function(a){a.D[0]=mg(a,a.D[0],a.L())};X[53]=function(a){a.h[0]=ng(a,a.h[0],a.U())};Z[53]=function(a){a.b[0]=og(a,a.b[0],a.ea())};W[54]=function(a){fe(a,2)};W[55]=function(a){9<(a.D[0]&15)||Ae(a)?(a.h[0]+=6,a.D[1]+=1,a.flags|=17):a.flags&=-18;a.D[0]&=15;a.u&=-18};W[56]=function(a){D(a);var b=Ue(a);a.sub(b,kf(a),7)};X[57]=function(a){D(a);var b=O(a);a.sub(b,mf(a),15)};Z[57]=function(a){D(a);var b=Ve(a);a.sub(b,S(a),31)};W[58]=function(a){D(a);var b=Ue(a);a.sub(kf(a),b,7)};
+X[59]=function(a){D(a);var b=O(a);a.sub(mf(a),b,15)};Z[59]=function(a){D(a);var b=Ve(a);a.sub(S(a),b,31)};W[60]=function(a){var b=a.L();a.sub(a.D[0],b,7)};X[61]=function(a){var b=a.U();a.sub(a.h[0],b,15)};Z[61]=function(a){var b=a.ea();a.sub(a.b[0],b,31)};W[62]=function(a){fe(a,3)};W[63]=function(a){9<(a.D[0]&15)||Ae(a)?(a.h[0]-=6,--a.D[1],a.flags|=17):a.flags&=-18;a.D[0]&=15;a.u&=-18};X[64]=function(a){a.h[0]=Zf(a,a.h[0],15)};Z[64]=function(a){a.b[0]=Zf(a,a.b[0],31)};
+X[65]=function(a){a.h[2]=Zf(a,a.h[2],15)};Z[65]=function(a){a.b[1]=Zf(a,a.b[1],31)};X[66]=function(a){a.h[4]=Zf(a,a.h[4],15)};Z[66]=function(a){a.b[2]=Zf(a,a.b[2],31)};X[67]=function(a){a.h[6]=Zf(a,a.h[6],15)};Z[67]=function(a){a.b[3]=Zf(a,a.b[3],31)};X[68]=function(a){a.h[8]=Zf(a,a.h[8],15)};Z[68]=function(a){a.b[4]=Zf(a,a.b[4],31)};X[69]=function(a){a.h[10]=Zf(a,a.h[10],15)};Z[69]=function(a){a.b[5]=Zf(a,a.b[5],31)};X[70]=function(a){a.h[12]=Zf(a,a.h[12],15)};
+Z[70]=function(a){a.b[6]=Zf(a,a.b[6],31)};X[71]=function(a){a.h[14]=Zf(a,a.h[14],15)};Z[71]=function(a){a.b[7]=Zf(a,a.b[7],31)};X[72]=function(a){a.h[0]=$f(a,a.h[0],15)};Z[72]=function(a){a.b[0]=$f(a,a.b[0],31)};X[73]=function(a){a.h[2]=$f(a,a.h[2],15)};Z[73]=function(a){a.b[1]=$f(a,a.b[1],31)};X[74]=function(a){a.h[4]=$f(a,a.h[4],15)};Z[74]=function(a){a.b[2]=$f(a,a.b[2],31)};X[75]=function(a){a.h[6]=$f(a,a.h[6],15)};Z[75]=function(a){a.b[3]=$f(a,a.b[3],31)};
+X[76]=function(a){a.h[8]=$f(a,a.h[8],15)};Z[76]=function(a){a.b[4]=$f(a,a.b[4],31)};X[77]=function(a){a.h[10]=$f(a,a.h[10],15)};Z[77]=function(a){a.b[5]=$f(a,a.b[5],31)};X[78]=function(a){a.h[12]=$f(a,a.h[12],15)};Z[78]=function(a){a.b[6]=$f(a,a.b[6],31)};X[79]=function(a){a.h[14]=$f(a,a.h[14],15)};Z[79]=function(a){a.b[7]=$f(a,a.b[7],31)};X[80]=function(a){I(a,a.h[0])};Z[80]=function(a){J(a,a.b[0])};X[81]=function(a){I(a,a.h[2])};Z[81]=function(a){J(a,a.b[1])};X[82]=function(a){I(a,a.h[4])};
+Z[82]=function(a){J(a,a.b[2])};X[83]=function(a){I(a,a.h[6])};Z[83]=function(a){J(a,a.b[3])};X[84]=function(a){I(a,a.h[8])};Z[84]=function(a){J(a,a.b[4])};X[85]=function(a){I(a,a.h[10])};Z[85]=function(a){J(a,a.b[5])};X[86]=function(a){I(a,a.h[12])};Z[86]=function(a){J(a,a.b[6])};X[87]=function(a){I(a,a.h[14])};Z[87]=function(a){J(a,a.b[7])};X[88]=function(a){a.h[0]=nh(a)};Z[88]=function(a){a.b[0]=oh(a)};X[89]=function(a){a.h[2]=nh(a)};Z[89]=function(a){a.b[1]=oh(a)};X[90]=function(a){a.h[4]=nh(a)};
+Z[90]=function(a){a.b[2]=oh(a)};X[91]=function(a){a.h[6]=nh(a)};Z[91]=function(a){a.b[3]=oh(a)};X[92]=function(a){a.h[8]=nh(a)};Z[92]=function(a){a.b[4]=oh(a)};X[93]=function(a){a.h[10]=nh(a)};Z[93]=function(a){a.b[5]=oh(a)};X[94]=function(a){a.h[12]=nh(a)};Z[94]=function(a){a.b[6]=oh(a)};X[95]=function(a){a.h[14]=nh(a)};Z[95]=function(a){a.b[7]=oh(a)};X[96]=function(a){var b=a.h[8];Cb(a,G(a,-16),16);I(a,a.h[0]);I(a,a.h[2]);I(a,a.h[4]);I(a,a.h[6]);I(a,b);I(a,a.h[10]);I(a,a.h[12]);I(a,a.h[14])};
+Z[96]=function(a){var b=a.b[4];Cb(a,G(a,-32),32);J(a,a.b[0]);J(a,a.b[1]);J(a,a.b[2]);J(a,a.b[3]);J(a,b);J(a,a.b[5]);J(a,a.b[6]);J(a,a.b[7])};X[97]=function(a){je(a,G(a,0));je(a,G(a,15));a.h[14]=nh(a);a.h[12]=nh(a);a.h[10]=nh(a);Ee(a,2);a.h[6]=nh(a);a.h[4]=nh(a);a.h[2]=nh(a);a.h[0]=nh(a)};Z[97]=function(a){je(a,G(a,0));je(a,G(a,31));a.b[7]=oh(a);a.b[6]=oh(a);a.b[5]=oh(a);Ee(a,4);a.b[3]=oh(a);a.b[2]=oh(a);a.b[1]=oh(a);a.b[0]=oh(a)};W[98]=function(){};
+W[99]=function(a){D(a);if(a.ta&&!ye(a)){var b=Q(a),c=a.f>>2&14;a.u&=-65;(b&3)<(a.h[c]&3)?(a.flags|=64,b=b&-4|a.h[c]&3):a.flags&=-65;R(a,b)}else t(a)};W[100]=function(a){fe(a,4)};W[101]=function(a){fe(a,5)};W[102]=function(a){a.H|=32;ge(a);a.H=0};W[103]=function(a){a.H|=64;ge(a);a.H=0};X[104]=function(a){I(a,a.U())};Z[104]=function(a){J(a,a.ea())};X[105]=function(a){D(a);of(a,bg(a,O(a)<<16>>16,a.U()<<16>>16))};Z[105]=function(a){D(a);pf(a,eg(a,Ve(a),a.ea()))};X[106]=function(a){I(a,a.wa())};
+Z[106]=function(a){J(a,a.wa())};X[107]=function(a){D(a);of(a,bg(a,O(a)<<16>>16,a.wa()))};Z[107]=function(a){D(a);pf(a,eg(a,Ve(a),a.wa()))};W[108]=function(a){var b=a.h[4];uf(a,b,1);var c=C(a,0)+U(a,7)|0,d=a.flags&1024?-1:1;if(a.H&24){var e=U(a,1)>>>0;if(0!==e){var f=e,h=4096,g=se(a,c);a.V&&(h=Bf(d,c));do a.za(g,Va(a.o,b)),g+=d,c=0!==--e;while(c&&h--);V(a,7,d*(f-e)|0);zf(a,e);a.Y+=f-e;c&&(a.A=a.ga)}}else Cb(a,c,1),re(a,c,Va(a.o,b)),V(a,7,d)};
+X[109]=function(a){var b=a.h[4];uf(a,b,2);var c=C(a,0)+U(a,7)|0,d=a.flags&1024?-2:2;if(a.H&24){var e=U(a,1)>>>0;if(0!==e){var f=e,h=4096;if(c&1){do{u(a,c,Wa(a.o,b));c+=d;V(a,7,d);var g=0!==Af(a)}while(g&&h--)}else{var p=0>d?-1:1,r=se(a,c)>>>1;a.V&&(h=Bf(d,c));do zc(a,r,Wa(a.o,b)),r+=p,g=0!==--e;while(g&&h--);V(a,7,d*(f-e)|0);zf(a,e);a.Y+=f-e}g&&(a.A=a.ga)}}else Cb(a,c,2),u(a,c,Wa(a.o,b)),V(a,7,d)};
+Z[109]=function(a){var b=a.h[4];uf(a,b,4);var c=C(a,0)+U(a,7)|0,d=a.flags&1024?-4:4;if(a.H&24){var e=U(a,1)>>>0;if(0!==e){var f=e,h=4096;if(c&3){do{w(a,c,Xa(a.o,b));c+=d;V(a,7,d);var g=0!==Af(a)}while(g&&h--)}else{var p=0>d?-1:1,r=se(a,c)>>>2;a.V&&(h=Bf(d,c));do Ac(a,r,Xa(a.o,b)),r+=p,g=0!==--e;while(g&&h--);V(a,7,d*(f-e)|0);zf(a,e);a.Y+=f-e}g&&(a.A=a.ga)}}else Cb(a,c,4),w(a,c,Xa(a.o,b)),V(a,7,d)};
+W[110]=function(a){var b=a.h[4];uf(a,b,1);var c=we(a,3)+U(a,6)|0,d=a.flags&1024?-1:1;if(a.H&24){var e=U(a,1)>>>0;if(0!==e){var f=e,h=4096,g=je(a,c);a.V&&(h=Bf(d,c));do Sa(a.o,b,a.ja(g)),g+=d,c=0!==--e;while(c&&h--);V(a,6,d*(f-e)|0);zf(a,e);a.Y+=f-e;c&&(a.A=a.ga)}}else Sa(a.o,b,pe(a,c)),V(a,6,d)};
+X[111]=function(a){var b=a.h[4];uf(a,b,2);var c=we(a,3)+U(a,6)|0,d=a.flags&1024?-2:2;if(a.H&24){var e=U(a,1)>>>0;if(0!==e){var f=e,h=4096;if(c&1){do{Ta(a.o,b,x(a,c));c+=d;V(a,6,d);var g=0!==Af(a)}while(g&&h--)}else{var p=0>d?-1:1,r=je(a,c)>>>1;a.V&&(h=Bf(d,c));do Ta(a.o,b,xc(a,r)),r+=p,g=0!==--e;while(g&&h--);V(a,6,d*(f-e)|0);zf(a,e);a.Y+=f-e}g&&(a.A=a.ga)}}else Ta(a.o,b,x(a,c)),V(a,6,d)};
+Z[111]=function(a){var b=a.h[4];uf(a,b,4);var c=we(a,3)+U(a,6)|0,d=a.flags&1024?-4:4;if(a.H&24){var e=U(a,1)>>>0;if(0!==e){var f=e,h=4096;if(c&3){do{Ua(a.o,b,y(a,c));c+=d;V(a,6,d);var g=0!==Af(a)}while(g&&h--)}else{var p=0>d?-1:1,r=je(a,c)>>>2;a.V&&(h=Bf(d,c));do Ua(a.o,b,yc(a,r)),r+=p,g=0!==--e;while(g&&h--);V(a,6,d*(f-e)|0);zf(a,e);a.Y+=f-e}g&&(a.A=a.ga)}}else Ua(a.o,b,y(a,c)),V(a,6,d)};W[112]=function(a){dh(a,a.Qb())};W[113]=function(a){dh(a,!a.Qb())};W[114]=function(a){dh(a,a.yb())};
+W[115]=function(a){dh(a,!a.yb())};W[116]=function(a){dh(a,a.Ab())};W[117]=function(a){dh(a,!a.Ab())};W[118]=function(a){dh(a,kh(a))};W[119]=function(a){dh(a,!kh(a))};W[120]=function(a){dh(a,a.Rb())};W[121]=function(a){dh(a,!a.Rb())};W[122]=function(a){dh(a,a.zb())};W[123]=function(a){dh(a,!a.zb())};W[124]=function(a){dh(a,lh(a))};W[125]=function(a){dh(a,!lh(a))};W[126]=function(a){dh(a,mh(a))};W[127]=function(a){dh(a,!mh(a))};
+W[128]=function(a){D(a);switch(a.f>>3&7){case 0:cf(a,Df(a,bf(a),a.L()));break;case 1:cf(a,jg(a,bf(a),a.L()));break;case 2:cf(a,Of(a,bf(a),a.L()));break;case 3:cf(a,Vf(a,bf(a),a.L()));break;case 4:cf(a,gg(a,bf(a),a.L()));break;case 5:cf(a,Sf(a,bf(a),a.L()));break;case 6:cf(a,mg(a,bf(a),a.L()));break;case 7:var b=Ue(a),c=a.L();a.sub(b,c,7)}};
+X[129]=function(a){D(a);switch(a.f>>3&7){case 0:R(a,Ef(a,Q(a),a.U()));break;case 1:R(a,kg(a,Q(a),a.U()));break;case 2:R(a,Qf(a,Q(a),a.U()));break;case 3:R(a,Xf(a,Q(a),a.U()));break;case 4:R(a,hg(a,Q(a),a.U()));break;case 5:R(a,Tf(a,Q(a),a.U()));break;case 6:R(a,ng(a,Q(a),a.U()));break;case 7:var b=O(a),c=a.U();a.sub(b,c,15)}};
+Z[129]=function(a){D(a);switch(a.f>>3&7){case 0:ef(a,Ff(a,df(a),a.ea()));break;case 1:ef(a,lg(a,df(a),a.ea()));break;case 2:ef(a,Rf(a,df(a),a.ea()));break;case 3:ef(a,Yf(a,df(a),a.ea()));break;case 4:ef(a,ig(a,df(a),a.ea()));break;case 5:ef(a,Uf(a,df(a),a.ea()));break;case 6:ef(a,og(a,df(a),a.ea()));break;case 7:var b=Ve(a),c=a.ea();a.sub(b,c,31)}};W[130]=W[128];
+X[131]=function(a){D(a);switch(a.f>>3&7){case 0:R(a,Ef(a,Q(a),a.wa()));break;case 1:R(a,kg(a,Q(a),a.wa()));break;case 2:R(a,Qf(a,Q(a),a.wa()));break;case 3:R(a,Xf(a,Q(a),a.wa()));break;case 4:R(a,hg(a,Q(a),a.wa()));break;case 5:R(a,Tf(a,Q(a),a.wa()));break;case 6:R(a,ng(a,Q(a),a.wa()));break;case 7:var b=O(a),c=a.wa();a.sub(b,c,15)}};
+Z[131]=function(a){D(a);switch(a.f>>3&7){case 0:ef(a,Ff(a,df(a),a.wa()));break;case 1:ef(a,lg(a,df(a),a.wa()));break;case 2:ef(a,Rf(a,df(a),a.wa()));break;case 3:ef(a,Yf(a,df(a),a.wa()));break;case 4:ef(a,ig(a,df(a),a.wa()));break;case 5:ef(a,Uf(a,df(a),a.wa()));break;case 6:ef(a,og(a,df(a),a.wa()));break;case 7:var b=Ve(a),c=a.wa();a.sub(b,c,31)}};W[132]=function(a){D(a);var b=Ue(a);a.and(b,kf(a),7)};X[133]=function(a){D(a);var b=O(a);a.and(b,mf(a),15)};
+Z[133]=function(a){D(a);var b=Ve(a);a.and(b,S(a),31)};W[134]=function(a){D(a);var b=bf(a),c=a.f;c=c>>1&12|c>>5&1;var d=a.D[c];a.D[c]=b;cf(a,d)};X[135]=function(a){D(a);var b=Q(a),c=a.f>>2&14,d=a.h[c];a.h[c]=b;R(a,d)};Z[135]=function(a){D(a);var b=df(a),c=a.f>>3&7,d=a.b[c];a.b[c]=b;ef(a,d)};W[136]=function(a){D(a);Ze(a,kf(a))};X[137]=function(a){D(a);$e(a,mf(a))};Z[137]=function(a){D(a);af(a,S(a))};W[138]=function(a){D(a);var b=Ue(a);lf(a,b)};X[139]=function(a){D(a);var b=O(a);of(a,b)};
+Z[139]=function(a){D(a);var b=Ve(a);pf(a,b)};X[140]=function(a){D(a);$e(a,a.M[a.f>>3&7])};Z[140]=function(a){D(a);af(a,a.M[a.f>>3&7])};X[141]=function(a){D(a);192<=a.f&&t(a);var b=a.f>>3&7;a.H|=7;a.h[b<<1]=F(a,a.f);a.H=0};Z[141]=function(a){D(a);192<=a.f&&t(a);var b=a.f>>3&7;a.H|=7;a.b[b]=F(a,a.f);a.H=0};W[142]=function(a){D(a);var b=a.f>>3&7,c=O(a);$d(a,b,c);2===b&&(a.H=0,ee(a))};X[143]=function(a){D(a);var b=x(a,G(a,0));Ee(a,2);if(192>a.f){var c=F(a,a.f);Ee(a,-2);u(a,c,b);Ee(a,2)}else gf(a,b)};
+Z[143]=function(a){D(a);var b=y(a,G(a,0));Ee(a,4);if(192>a.f){var c=F(a,a.f);Ee(a,-4);w(a,c,b);Ee(a,4)}else jf(a,b)};W[144]=function(){};X[145]=function(a){ph(a,2)};Z[145]=function(a){qh(a,1)};X[146]=function(a){ph(a,4)};Z[146]=function(a){qh(a,2)};X[147]=function(a){ph(a,6)};Z[147]=function(a){qh(a,3)};X[148]=function(a){ph(a,8)};Z[148]=function(a){qh(a,4)};X[149]=function(a){ph(a,10)};Z[149]=function(a){qh(a,5)};X[150]=function(a){ph(a,12)};Z[150]=function(a){qh(a,6)};X[151]=function(a){ph(a,14)};
+Z[151]=function(a){qh(a,7)};X[152]=function(a){a.h[0]=a.sg[0]};Z[152]=function(a){a.b[0]=a.se[0]};X[153]=function(a){a.h[4]=a.se[0]>>15};Z[153]=function(a){a.b[2]=a.b[0]>>31};X[154]=function(a){var b=a.U(),c=a.Ib();Qe(a,b,c,!0);me(a)||Fe(a)};Z[154]=function(a){var b=a.ea(),c=a.Ib();if((!a.ta||ye(a))&&b&4294901760)throw a.debug.P("#GP handler");Qe(a,b,c,!0);me(a)||Fe(a)};W[155]=function(a){10===(a.K[0]&10)&&Se(a)};X[156]=function(a){a.flags&131072&&3>xe(a)?H(a,0):I(a,ze(a))};
+Z[156]=function(a){a.flags&131072&&3>xe(a)?H(a,0):J(a,ze(a)&16580607)};X[157]=function(a){a.flags&131072&&3>xe(a)&&H(a,0);Be(a,a.flags&-65536|nh(a));a.flags&256?a.flags&=-257:ab(a)};Z[157]=function(a){a.flags&131072&&3>xe(a)&&H(a,0);Be(a,oh(a));ab(a)};W[158]=function(a){a.flags=a.flags&-256|a.D[1];a.flags=a.flags&4161493|2;a.u=0};W[159]=function(a){a.D[1]=ze(a)};W[160]=function(a){var b=pe(a,ve(a));a.D[0]=b};X[161]=function(a){var b=x(a,ve(a));a.h[0]=b};
+Z[161]=function(a){var b=y(a,ve(a));a.b[0]=b};W[162]=function(a){re(a,ve(a),a.D[0])};X[163]=function(a){u(a,ve(a),a.h[0])};Z[163]=function(a){w(a,ve(a),a.b[0])};W[164]=function(a){var b=we(a,3)+U(a,6)|0,c=C(a,0)+U(a,7)|0,d=a.flags&1024?-1:1;if(a.H&24){var e=U(a,1)>>>0;if(0!==e){var f=e,h=4096,g=je(a,b),p=se(a,c);a.V&&(h=Cf(d,b,c));do a.za(p,a.ja(g)),p+=d,g+=d,b=0!==--e;while(b&&h--);d=d*(f-e)|0;V(a,7,d);V(a,6,d);zf(a,e);a.Y+=f-e;b&&(a.A=a.ga)}}else re(a,c,pe(a,b)),V(a,7,d),V(a,6,d)};
+X[165]=function(a){var b=we(a,3)+U(a,6)|0,c=C(a,0)+U(a,7)|0,d=a.flags&1024?-2:2;if(a.H&24){var e=U(a,1)>>>0;if(0!==e){var f=e,h=4096;if(c&1||b&1){do{u(a,c,x(a,b));c+=d;V(a,7,d);b+=d;V(a,6,d);var g=0!==Af(a)}while(g&&h--)}else{var p=0>d?-1:1,r=je(a,b)>>>1,v=se(a,c)>>>1;a.V&&(h=Cf(d,b,c));do zc(a,v,xc(a,r)),v+=p,r+=p,g=0!==--e;while(g&&h--);b=d*(f-e)|0;V(a,7,b);V(a,6,b);zf(a,e);a.Y+=f-e}g&&(a.A=a.ga)}}else u(a,c,x(a,b)),V(a,7,d),V(a,6,d)};
+Z[165]=function(a){a:{if(a.H&24){var b=we(a,3)+U(a,6)|0,c=C(a,0)+U(a,7)|0,d=U(a,1)>>>0;if(!d)break a;var e=a.V?4095:3;if(0===(c&e)&&0===(b&e)&&0===(a.flags&1024)&&(e=!1,a.V&&(b=je(a,b),c=se(a,c),1024<d&&(d=1024,e=!0)),!Qa(a.o,b,d)&&!Qa(a.o,c,d))){var f=d<<2;V(a,1,-d);V(a,7,f);V(a,6,f);b>>>=2;a.Cc.set(a.Cc.subarray(b,b+d),c>>>2);e&&(a.A=a.ga);break a}}b=we(a,3)+U(a,6)|0;c=C(a,0)+U(a,7)|0;f=a.flags&1024?-4:4;if(a.H&24){if(d=U(a,1)>>>0,0!==d){var h=d,g=4096;if(c&3||b&3){do w(a,c,y(a,b)),c+=f,V(a,7,f),
+b+=f,V(a,6,f),e=0!==Af(a);while(e&&g--)}else{var p=0>f?-1:1,r=je(a,b)>>>2,v=se(a,c)>>>2;a.V&&(g=Cf(f,b,c));do Ac(a,v,yc(a,r)),v+=p,r+=p,e=0!==--d;while(e&&g--);f=f*(h-d)|0;V(a,7,f);V(a,6,f);zf(a,d);a.Y+=h-d}e&&(a.A=a.ga)}}else w(a,c,y(a,b)),V(a,7,f),V(a,6,f)}};
+W[166]=function(a){a:{var b=we(a,3)+U(a,6)|0,c=C(a,0)+U(a,7)|0,d=a.flags&1024?-1:1;if(a.H&24){var e=U(a,1)>>>0;if(0===e)break a;var f=e,h=8===(a.H&24),g=4096,p=je(a,b),r=je(a,c);a.V&&(g=Cf(d,b,c));do{c=a.ja(r);b=a.ja(p);r+=d;p+=d;var v=0!==--e&&b===c===h}while(v&&g--);d=d*(f-e)|0;V(a,7,d);V(a,6,d);zf(a,e);a.Y+=f-e;v&&(a.A=a.ga)}else b=pe(a,b),c=pe(a,c),V(a,7,d),V(a,6,d);a.sub(b,c,7)}};
+X[167]=function(a){a:{var b=we(a,3)+U(a,6)|0,c=C(a,0)+U(a,7)|0,d=a.flags&1024?-2:2;if(a.H&24){var e=U(a,1)>>>0;if(0===e)break a;var f=e,h=8===(a.H&24),g=4096;if(c&1||b&1){do{var p=x(a,c),r=x(a,b);c+=d;V(a,7,d);b+=d;V(a,6,d);var v=0!==Af(a)&&r===p===h}while(v&&g--)}else{var E=0>d?-1:1,z=je(a,b)>>>1,A=je(a,c)>>>1;a.V&&(g=Cf(d,b,c));do p=xc(a,A),r=xc(a,z),A+=E,z+=E,v=0!==--e&&r===p===h;while(v&&g--);b=d*(f-e)|0;V(a,7,b);V(a,6,b);zf(a,e);a.Y+=f-e}v&&(a.A=a.ga)}else p=x(a,c),r=x(a,b),V(a,7,d),V(a,6,d);
+a.sub(r,p,15)}};
+Z[167]=function(a){a:{var b=we(a,3)+U(a,6)|0,c=C(a,0)+U(a,7)|0,d=a.flags&1024?-4:4;if(a.H&24){var e=U(a,1)>>>0;if(0===e)break a;var f=e,h=8===(a.H&24),g=4096;if(c&3||b&3){do{var p=y(a,c),r=y(a,b);c+=d;V(a,7,d);b+=d;V(a,6,d);var v=0!==Af(a)&&r===p===h}while(v&&g--)}else{var E=0>d?-1:1,z=je(a,b)>>>2,A=je(a,c)>>>2;a.V&&(g=Cf(d,b,c));do p=yc(a,A),r=yc(a,z),A+=E,z+=E,v=0!==--e&&r===p===h;while(v&&g--);b=d*(f-e)|0;V(a,7,b);V(a,6,b);zf(a,e);a.Y+=f-e}v&&(a.A=a.ga)}else p=y(a,c),r=y(a,b),V(a,7,d),V(a,6,d);
+a.sub(r,p,31)}};W[168]=function(a){var b=a.L();a.and(a.D[0],b,7)};X[169]=function(a){var b=a.U();a.and(a.h[0],b,15)};Z[169]=function(a){var b=a.ea();a.and(a.b[0],b,31)};W[170]=function(a){var b=a.D[0],c=C(a,0)+U(a,7)|0,d=a.flags&1024?-1:1;if(a.H&24){var e=U(a,1)>>>0;if(0!==e){var f=e,h=4096,g=se(a,c);a.V&&(h=Bf(d,c));do a.za(g,b),g+=d,c=0!==--e;while(c&&h--);V(a,7,d*(f-e)|0);zf(a,e);a.Y+=f-e;c&&(a.A=a.ga)}}else re(a,c,b),V(a,7,d)};
+X[171]=function(a){var b=a.h[0],c=C(a,0)+U(a,7)|0,d=a.flags&1024?-2:2;if(a.H&24){var e=U(a,1)>>>0;if(0!==e){var f=e,h=4096;if(c&1){do{u(a,c,b);c+=d;V(a,7,d);var g=0!==Af(a)}while(g&&h--)}else{var p=0>d?-1:1,r=se(a,c)>>>1;a.V&&(h=Bf(d,c));do zc(a,r,b),r+=p,g=0!==--e;while(g&&h--);V(a,7,d*(f-e)|0);zf(a,e);a.Y+=f-e}g&&(a.A=a.ga)}}else u(a,c,b),V(a,7,d)};
+Z[171]=function(a){var b=a.b[0],c=C(a,0)+U(a,7)|0,d=a.flags&1024?-4:4;if(a.H&24){var e=U(a,1)>>>0;if(0!==e){var f=e,h=4096;if(c&3){do{w(a,c,b);c+=d;V(a,7,d);var g=0!==Af(a)}while(g&&h--)}else{var p=0>d?-1:1,r=se(a,c)>>>2;a.V&&(h=Bf(d,c));do Ac(a,r,b),r+=p,g=0!==--e;while(g&&h--);V(a,7,d*(f-e)|0);zf(a,e);a.Y+=f-e}g&&(a.A=a.ga)}}else w(a,c,b),V(a,7,d)};
+W[172]=function(a){var b=we(a,3)+U(a,6)|0,c=a.flags&1024?-1:1;if(a.H&24){var d=U(a,1)>>>0;if(0!==d){var e=d,f=4096,h=je(a,b);a.V&&(f=Bf(c,b));do a.D[0]=a.ja(h),h+=c,b=0!==--d;while(b&&f--);V(a,6,c*(e-d)|0);zf(a,d);a.Y+=e-d;b&&(a.A=a.ga)}}else a.D[0]=pe(a,b),V(a,6,c)};X[173]=function(a){var b=we(a,3)+U(a,6)|0,c=a.flags&1024?-2:2;if(a.H&24){if(0!==U(a,1)>>>0){var d=4096;do{a.h[0]=x(a,b);b+=c;V(a,6,c);var e=0!==Af(a)}while(e&&d--);e&&(a.A=a.ga)}}else a.h[0]=x(a,b),V(a,6,c)};
+Z[173]=function(a){var b=we(a,3)+U(a,6)|0,c=a.flags&1024?-4:4;if(a.H&24){if(0!==U(a,1)>>>0){var d=4096;do{a.b[0]=y(a,b);b+=c;V(a,6,c);var e=0!==Af(a)}while(e&&d--);e&&(a.A=a.ga)}}else a.b[0]=y(a,b),V(a,6,c)};
+W[174]=function(a){a:{var b=C(a,0)+U(a,7)|0,c=a.flags&1024?-1:1,d=a.D[0];if(a.H&24){var e=U(a,1)>>>0;if(0===e)break a;var f=e,h=8===(a.H&24),g=4096,p=je(a,b);a.V&&(g=Bf(c,b));do{b=a.ja(p);p+=c;var r=0!==--e&&d===b===h}while(r&&g--);V(a,7,c*(f-e)|0);zf(a,e);a.Y+=f-e;r&&(a.A=a.ga)}else b=pe(a,b),V(a,7,c);a.sub(d,b,7)}};
+X[175]=function(a){a:{var b=C(a,0)+U(a,7)|0,c=a.flags&1024?-2:2,d=a.h[0];if(a.H&24){var e=U(a,1)>>>0;if(0===e)break a;var f=e,h=8===(a.H&24),g=4096;if(b&1){do{var p=x(a,b);b+=c;V(a,7,c);var r=0!==Af(a)&&d===p===h}while(r&&g--)}else{var v=0>c?-1:1,E=je(a,b)>>>1;a.V&&(g=Bf(c,b));do p=xc(a,E),E+=v,r=0!==--e&&d===p===h;while(r&&g--);V(a,7,c*(f-e)|0);zf(a,e);a.Y+=f-e}r&&(a.A=a.ga)}else p=x(a,b),V(a,7,c);a.sub(d,p,15)}};
+Z[175]=function(a){a:{var b=C(a,0)+U(a,7)|0,c=a.flags&1024?-4:4,d=a.b[0];if(a.H&24){var e=U(a,1)>>>0;if(0===e)break a;var f=e,h=8===(a.H&24),g=4096;if(b&3){do{var p=y(a,b);b+=c;V(a,7,c);var r=0!==Af(a)&&d===p===h}while(r&&g--)}else{var v=0>c?-1:1,E=je(a,b)>>>2;a.V&&(g=Bf(c,b));do p=yc(a,E),E+=v,r=0!==--e&&d===p===h;while(r&&g--);V(a,7,c*(f-e)|0);zf(a,e);a.Y+=f-e}r&&(a.A=a.ga)}else p=y(a,b),V(a,7,c);a.sub(d,p,31)}};W[176]=function(a){a.D[0]=a.L()};W[177]=function(a){a.D[4]=a.L()};
+W[178]=function(a){a.D[8]=a.L()};W[179]=function(a){a.D[12]=a.L()};W[180]=function(a){a.D[1]=a.L()};W[181]=function(a){a.D[5]=a.L()};W[182]=function(a){a.D[9]=a.L()};W[183]=function(a){a.D[13]=a.L()};X[184]=function(a){a.h[0]=a.U()};Z[184]=function(a){a.b[0]=a.ea()};X[185]=function(a){a.h[2]=a.U()};Z[185]=function(a){a.b[1]=a.ea()};X[186]=function(a){a.h[4]=a.U()};Z[186]=function(a){a.b[2]=a.ea()};X[187]=function(a){a.h[6]=a.U()};Z[187]=function(a){a.b[3]=a.ea()};X[188]=function(a){a.h[8]=a.U()};
+Z[188]=function(a){a.b[4]=a.ea()};X[189]=function(a){a.h[10]=a.U()};Z[189]=function(a){a.b[5]=a.ea()};X[190]=function(a){a.h[12]=a.U()};Z[190]=function(a){a.b[6]=a.ea()};X[191]=function(a){a.h[14]=a.U()};Z[191]=function(a){a.b[7]=a.ea()};
+W[192]=function(a){D(a);var b=bf(a),c=a.L()&31,d=0;switch(a.f>>3&7){case 0:d=pg(a,b,c);break;case 1:d=vg(a,b,c);break;case 2:d=sg(a,b,c);break;case 3:d=yg(a,b,c);break;case 4:d=Bg(a,b,c);break;case 5:d=Eg(a,b,c);break;case 6:d=Bg(a,b,c);break;case 7:d=Hg(a,b,c)}cf(a,d)};
+X[193]=function(a){D(a);var b=Q(a),c=a.L()&31,d=0;switch(a.f>>3&7){case 0:d=qg(a,b,c);break;case 1:d=wg(a,b,c);break;case 2:d=tg(a,b,c);break;case 3:d=zg(a,b,c);break;case 4:d=Cg(a,b,c);break;case 5:d=Fg(a,b,c);break;case 6:d=Cg(a,b,c);break;case 7:d=Ig(a,b,c)}R(a,d)};
+Z[193]=function(a){D(a);var b=df(a),c=a.L()&31,d=0;switch(a.f>>3&7){case 0:d=rg(a,b,c);break;case 1:d=xg(a,b,c);break;case 2:d=ug(a,b,c);break;case 3:d=Ag(a,b,c);break;case 4:d=Dg(a,b,c);break;case 5:d=Gg(a,b,c);break;case 6:d=Dg(a,b,c);break;case 7:d=Jg(a,b,c)}ef(a,d)};X[194]=function(a){var b=a.U();a.A=C(a,1)+nh(a)|0;me(a)||Fe(a);Ee(a,b)};Z[194]=function(a){var b=a.U(),c=oh(a);a.A=C(a,1)+c|0;Ee(a,b)};X[195]=function(a){a.A=C(a,1)+nh(a)|0};Z[195]=function(a){var b=oh(a);a.A=C(a,1)+b|0};
+X[196]=function(a){D(a);rh(a,0)};Z[196]=function(a){D(a);sh(a,0)};X[197]=function(a){D(a);rh(a,3)};Z[197]=function(a){D(a);sh(a,3)};W[198]=function(a){D(a);192>a.f?re(a,F(a,a.f),a.L()):a.D[a.f<<2&12|a.f>>2&1]=a.L()};X[199]=function(a){D(a);192>a.f?u(a,F(a,a.f),a.U()):a.h[a.f<<1&14]=a.U()};Z[199]=function(a){D(a);192>a.f?w(a,F(a,a.f),a.ea()):a.b[a.f&7]=a.ea()};
+X[200]=function(a){var b=a.U(),c=a.uh();c&=31;I(a,a.h[10]);var d=a.h[8];if(0<c){for(var e=a.h[5],f=1;f<c;f++)e-=2,I(a,x(a,C(a,2)+e|0));I(a,d)}a.h[10]=d;Ee(a,-b)};Z[200]=function(a){var b=a.U(),c=a.uh();c&=31;J(a,a.b[5]);var d=a.b[4];if(0<c){for(var e=a.b[5],f=1;f<c;f++)e-=4,J(a,y(a,C(a,2)+e|0));J(a,d)}a.b[5]=d;Ee(a,-b)};X[201]=function(a){var b=a.qb?a.b[5]:a.h[10],c=x(a,C(a,2)+b|0);De(a,b+2|0);a.h[10]=c};Z[201]=function(a){var b=a.qb?a.b[5]:a.h[10],c=y(a,C(a,2)+b|0);De(a,b+4|0);a.b[5]=c};
+X[202]=function(a){var b=a.U(),c=x(a,G(a,0)),d=x(a,G(a,2));Pe(a,c,d,b)};Z[202]=function(a){var b=a.U(),c=y(a,G(a,0)),d=y(a,G(a,4))&65535;Pe(a,c,d,b);me(a)||Fe(a)};X[203]=function(a){var b=x(a,G(a,0)),c=x(a,G(a,2));Pe(a,b,c,0);me(a)||Fe(a)};Z[203]=function(a){var b=y(a,G(a,0)),c=y(a,G(a,4))&65535;Pe(a,b,c,0);me(a)||Fe(a)};W[204]=function(a){Ge(a,3,!0,!1)};W[205]=function(a){var b=a.L();Ge(a,b,!0,!1)};W[206]=function(a){a.Te()&&Ge(a,4,!0,!1)};X[207]=function(a){Oe(a,!0)};Z[207]=function(a){Oe(a,!1)};
+W[208]=function(a){D(a);var b=bf(a),c=0;switch(a.f>>3&7){case 0:c=pg(a,b,1);break;case 1:c=vg(a,b,1);break;case 2:c=sg(a,b,1);break;case 3:c=yg(a,b,1);break;case 4:c=Bg(a,b,1);break;case 5:c=Eg(a,b,1);break;case 6:c=Bg(a,b,1);break;case 7:c=Hg(a,b,1)}cf(a,c)};
+X[209]=function(a){D(a);var b=Q(a),c=0;switch(a.f>>3&7){case 0:c=qg(a,b,1);break;case 1:c=wg(a,b,1);break;case 2:c=tg(a,b,1);break;case 3:c=zg(a,b,1);break;case 4:c=Cg(a,b,1);break;case 5:c=Fg(a,b,1);break;case 6:c=Cg(a,b,1);break;case 7:c=Ig(a,b,1)}R(a,c)};
+Z[209]=function(a){D(a);var b=df(a),c=0;switch(a.f>>3&7){case 0:c=rg(a,b,1);break;case 1:c=xg(a,b,1);break;case 2:c=ug(a,b,1);break;case 3:c=Ag(a,b,1);break;case 4:c=Dg(a,b,1);break;case 5:c=Gg(a,b,1);break;case 6:c=Dg(a,b,1);break;case 7:c=Jg(a,b,1)}ef(a,c)};
+W[210]=function(a){D(a);var b=bf(a),c=a.D[4]&31,d=0;switch(a.f>>3&7){case 0:d=pg(a,b,c);break;case 1:d=vg(a,b,c);break;case 2:d=sg(a,b,c);break;case 3:d=yg(a,b,c);break;case 4:d=Bg(a,b,c);break;case 5:d=Eg(a,b,c);break;case 6:d=Bg(a,b,c);break;case 7:d=Hg(a,b,c)}cf(a,d)};
+X[211]=function(a){D(a);var b=Q(a),c=a.D[4]&31,d=0;switch(a.f>>3&7){case 0:d=qg(a,b,c);break;case 1:d=wg(a,b,c);break;case 2:d=tg(a,b,c);break;case 3:d=zg(a,b,c);break;case 4:d=Cg(a,b,c);break;case 5:d=Fg(a,b,c);break;case 6:d=Cg(a,b,c);break;case 7:d=Ig(a,b,c)}R(a,d)};
+Z[211]=function(a){D(a);var b=df(a),c=a.D[4]&31,d=0;switch(a.f>>3&7){case 0:d=rg(a,b,c);break;case 1:d=xg(a,b,c);break;case 2:d=ug(a,b,c);break;case 3:d=Ag(a,b,c);break;case 4:d=Dg(a,b,c);break;case 5:d=Gg(a,b,c);break;case 6:d=Dg(a,b,c);break;case 7:d=Jg(a,b,c)}ef(a,d)};W[212]=function(a){var b=a.L();if(0===b)Re(a);else{var c=a.D[0];a.D[1]=c/b;a.D[0]=c%b;a.F=a.D[0];a.u=196;a.flags&=-2066}};
+W[213]=function(a){var b=a.L();b=a.D[0]+a.D[1]*b;a.F=b&255;a.h[0]=a.F;a.S=7;a.u=196;a.flags&=-2066;65535<b&&(a.flags|=1)};W[214]=function(a){a.D[0]=-a.cb()};W[215]=function(a){a.D[0]=me(a)?pe(a,we(a,3)+a.b[3]+a.D[0]|0):pe(a,we(a,3)+(a.h[6]+a.D[0]&65535)|0)};
+W[216]=function(a){D(a);Te(a);if(192>a.f){var b=a.T,c=a.f,d=F(a,a.f);a=c>>3&7;c=Mb(b,d);d=wb(b);switch(a){case 0:b.I[b.B]=d+c;break;case 1:b.I[b.B]=d*c;break;case 2:ub(b,c);break;case 3:ub(b,c);b.pop();break;case 4:b.I[b.B]=d-c;break;case 5:b.I[b.B]=c-d;break;case 6:b.I[b.B]=d/c;break;case 7:b.I[b.B]=c/d}}else switch(b=a.T,c=a.f,a=c>>3&7,c=Hb(b,c&7),d=wb(b),a){case 0:b.I[b.B]=d+c;break;case 1:b.I[b.B]=d*c;break;case 2:ub(b,c);break;case 3:ub(b,c);b.pop();break;case 4:b.I[b.B]=d-c;break;case 5:b.I[b.B]=
+c-d;break;case 6:b.I[b.B]=d/c;break;case 7:b.I[b.B]=c/d}};
+W[217]=function(a){D(a);Te(a);if(192>a.f){var b=a.T,c=a.f;a=F(a,a.f);switch(c>>3&7){case 0:a=Mb(b,a);b.push(a);break;case 1:sb(b);break;case 2:c=wb(b);b.m[0]=c;w(b.j,a,b.v[0]);break;case 3:c=wb(b);b.m[0]=c;w(b.j,a,b.v[0]);b.pop();break;case 4:Db(b,a);break;case 5:b.ec=x(b.j,a);break;case 6:Ab(b,a);break;case 7:u(b.j,a,b.ec)}}else switch(b=a.T,c=a.f,a=c&7,c>>3&7){case 0:c=Hb(b,a);b.push(c);break;case 1:c=Hb(b,a);b.I[b.B+a&7]=wb(b);b.I[b.B]=c;break;case 2:switch(a){case 0:break;default:sb(b)}break;
+case 3:sb(b);break;case 4:c=wb(b);switch(a){case 0:b.I[b.B]=-c;break;case 1:b.I[b.B]=Math.abs(c);break;case 4:a=c;b.a&=-18177;isNaN(a)?b.a|=17664:0===a?b.a|=16384:0>a&&(b.a|=256);break;case 5:a=c;b.a&=-18177;b.a|=b.sign(0)<<9;b.a=b.fa>>b.B&1?b.a|16640:isNaN(a)?b.a|256:0===a?b.a|16384:Infinity===a||-Infinity===a?b.a|1280:b.a|1024;break;default:sb(b)}break;case 5:b.push(b.J[a]);break;case 6:c=wb(b);switch(a){case 0:b.I[b.B]=Math.pow(2,c)-1;break;case 1:b.I[b.B+1&7]=Hb(b,1)*Math.log(c)/Math.LN2;b.pop();
+break;case 2:b.I[b.B]=Math.tan(c);b.push(1);break;case 3:b.I[b.B+1&7]=Math.atan2(Hb(b,1),c);b.pop();break;case 4:b.l[0]=wb(b);a=((b.g[7]&127)<<4|b.g[6]>>4)-1023;b.g[7]=63|b.g[7]&128;b.g[6]|=240;b.I[b.B]=a;b.push(b.l[0]);break;case 5:b.I[b.B]=c%Hb(b,1);break;case 6:b.B=b.B-1&7;b.a&=-513;break;case 7:b.B=b.B+1&7,b.a&=-513}break;case 7:switch(c=wb(b),a){case 0:a=Hb(b,1);var d=Math.trunc(c/a);b.I[b.B]=c%a;b.a&=-17153;d&1&&(b.a|=512);d&2&&(b.a|=16384);d&4&&(b.a|=256);b.a&=-1025;break;case 1:b.I[b.B+1&
+7]=Hb(b,1)*Math.log(c+1)/Math.LN2;b.pop();break;case 2:b.I[b.B]=Math.sqrt(c);break;case 3:b.I[b.B]=Math.sin(c);b.push(Math.cos(c));break;case 4:b.I[b.B]=Eb(b,c);break;case 5:b.I[b.B]=c*Math.pow(2,Gb(Hb(b,1)));break;case 6:b.I[b.B]=Math.sin(c);break;case 7:b.I[b.B]=Math.cos(c)}}};
+W[218]=function(a){D(a);Te(a);if(192>a.f){var b=a.T,c=a.f,d=F(a,a.f);a=c>>3&7;c=y(b.j,d);d=wb(b);switch(a){case 0:b.I[b.B]=d+c;break;case 1:b.I[b.B]=d*c;break;case 2:ub(b,c);break;case 3:ub(b,c);b.pop();break;case 4:b.I[b.B]=d-c;break;case 5:b.I[b.B]=c-d;break;case 6:b.I[b.B]=d/c;break;case 7:b.I[b.B]=c/d}}else switch(b=a.T,a=a.f,c=a&7,a>>3&7){case 0:b.j.yb()&&(b.I[b.B]=Hb(b,c),b.fa&=~(1<<b.B));break;case 1:b.j.Ab()&&(b.I[b.B]=Hb(b,c),b.fa&=~(1<<b.B));break;case 2:kh(b.j)&&(b.I[b.B]=Hb(b,c),b.fa&=
+~(1<<b.B));break;case 3:b.j.zb()&&(b.I[b.B]=Hb(b,c),b.fa&=~(1<<b.B));break;case 5:1===c?(a=Hb(b,1),ub(b,a),b.pop(),b.pop()):sb(b);break;default:sb(b)}};
+W[219]=function(a){D(a);Te(a);if(192>a.f){var b=a.T,c=a.f;a=F(a,a.f);switch(c>>3&7){case 0:a=y(b.j,a);b.push(a);break;case 2:c=Eb(b,wb(b));2147483647>=c&&-2147483648<=c?w(b.j,a,c):(tb(b),w(b.j,a,-2147483648));break;case 3:c=Eb(b,wb(b));2147483647>=c&&-2147483648<=c?w(b.j,a,c):(tb(b),w(b.j,a,-2147483648));b.pop();break;case 5:b.push(Ib(b,a));break;case 7:Cb(b.j,a,10);Jb(b,a,wb(b));b.pop();break;default:sb(b)}}else switch(b=a.T,a=a.f,c=a&7,a>>3&7){case 0:b.j.yb()||(b.I[b.B]=Hb(b,c),b.fa&=~(1<<b.B));
+break;case 1:b.j.Ab()||(b.I[b.B]=Hb(b,c),b.fa&=~(1<<b.B));break;case 2:kh(b.j)||(b.I[b.B]=Hb(b,c),b.fa&=~(1<<b.B));break;case 3:b.j.zb()||(b.I[b.B]=Hb(b,c),b.fa&=~(1<<b.B));break;case 4:227===a?yb(b):228!==a&&225!==a&&(226===a?b.a=0:sb(b));break;case 5:a=Hb(b,c);xb(b,a);break;case 6:xb(b,Hb(b,c));break;default:sb(b)}};
+W[220]=function(a){D(a);Te(a);if(192>a.f){var b=a.T,c=a.f,d=F(a,a.f);a=c>>3&7;c=Kb(b,d);d=wb(b);switch(a){case 0:b.I[b.B]=d+c;break;case 1:b.I[b.B]=d*c;break;case 2:ub(b,c);break;case 3:ub(b,c);b.pop();break;case 4:b.I[b.B]=d-c;break;case 5:b.I[b.B]=c-d;break;case 6:b.I[b.B]=d/c;break;case 7:b.I[b.B]=c/d}}else{b=a.T;c=a.f;a=c>>3&7;d=c&7;c=b.B+d&7;d=Hb(b,d);var e=wb(b);switch(a){case 0:b.I[c]=d+e;break;case 1:b.I[c]=d*e;break;case 2:ub(b,d);break;case 3:ub(b,d);b.pop();break;case 4:b.I[c]=e-d;break;
+case 5:b.I[c]=d-e;break;case 6:b.I[c]=e/d;break;case 7:b.I[c]=d/e}}};
+W[221]=function(a){D(a);Te(a);if(192>a.f){var b=a.T,c=a.f;a=F(a,a.f);switch(c>>3&7){case 0:a=Kb(b,a);b.push(a);break;case 1:sb(b);break;case 2:Lb(b,a);break;case 3:Lb(b,a);b.pop();break;case 4:Db(b,a);a+=28;for(c=0;8>c;c++)b.I[c+b.B&7]=Ib(b,a),a+=10;break;case 5:sb(b);break;case 6:Cb(b.j,a,108);Ab(b,a);a+=28;for(c=0;8>c;c++)Jb(b,a,b.I[b.B+c&7]),a+=10;yb(b);break;case 7:u(b.j,a,zb(b))}}else switch(b=a.T,a=a.f,c=a&7,a>>3&7){case 0:b.fa|=1<<(b.B+c&7);break;case 2:b.I[b.B+c&7]=wb(b);break;case 3:0!==
+c&&(b.I[b.B+c&7]=wb(b));b.pop();break;case 4:a=Hb(b,c);ub(b,a);break;case 5:a=Hb(b,c);ub(b,a);b.pop();break;default:sb(b)}};
+W[222]=function(a){D(a);Te(a);if(192>a.f){var b=a.T,c=a.f,d=F(a,a.f);a=c>>3&7;c=x(b.j,d)<<16>>16;d=wb(b);switch(a){case 0:b.I[b.B]=d+c;break;case 1:b.I[b.B]=d*c;break;case 2:ub(b,c);break;case 3:ub(b,c);b.pop();break;case 4:b.I[b.B]=d-c;break;case 5:b.I[b.B]=c-d;break;case 6:b.I[b.B]=d/c;break;case 7:b.I[b.B]=c/d}}else{b=a.T;c=a.f;a=c>>3&7;c&=7;d=b.B+c&7;var e=Hb(b,c),f=wb(b);switch(a){case 0:b.I[d]=e+f;break;case 1:b.I[d]=e*f;break;case 2:ub(b,e);break;case 3:1===c?(ub(b,b.I[d]),b.pop()):sb(b);break;
+case 4:b.I[d]=f-e;break;case 5:b.I[d]=e-f;break;case 6:b.I[d]=f/e;break;case 7:b.I[d]=e/f}b.pop()}};
+W[223]=function(a){D(a);Te(a);if(192>a.f){var b=a.T,c=a.f;a=F(a,a.f);switch(c>>3&7){case 0:a=x(b.j,a)<<16>>16;b.push(a);break;case 1:sb(b);break;case 2:c=Eb(b,wb(b));32767>=c&&-32768<=c?u(b.j,a,c):(tb(b),u(b.j,a,32768));break;case 3:c=Eb(b,wb(b));32767>=c&&-32768<=c?u(b.j,a,c):(tb(b),u(b.j,a,32768));b.pop();break;case 4:sb(b);break;case 5:c=y(b.j,a)>>>0;a=y(b.j,a+4);b.push(c+4294967296*a);break;case 6:sb(b);break;case 7:Cb(b.j,a,8);c=Eb(b,wb(b));if(0x7fffffffffffffff>c&&-9223372036854775808<=c){var d=
+c|0,e=c/4294967296|0;0===e&&0>c&&(e=-1)}else d=0,e=-2147483648,tb(b);w(b.j,a,d);w(b.j,a+4,e);b.pop()}}else switch(b=a.T,a=a.f,c=a&7,a>>3&7){case 4:224===a?b.j.h[0]=zb(b):sb(b);break;case 5:a=Hb(b,c);xb(b,a);b.pop();break;case 6:xb(b,Hb(b,c));b.pop();break;default:sb(b)}};W[224]=function(a){var b=a.wa();Af(a)&&!a.Ac()&&(a.A=a.A+b|0)};W[225]=function(a){var b=a.wa();Af(a)&&a.Ac()&&(a.A=a.A+b|0)};W[226]=function(a){a.loop(a.wa())};W[227]=function(a){var b=a.wa();0===U(a,1)&&(a.A=a.A+b|0)};
+W[228]=function(a){var b=a.L();uf(a,b,1);a.D[0]=Va(a.o,b)};X[229]=function(a){var b=a.L();uf(a,b,2);a.h[0]=Wa(a.o,b)};Z[229]=function(a){var b=a.L();uf(a,b,4);a.b[0]=Xa(a.o,b)};W[230]=function(a){var b=a.L();uf(a,b,1);Sa(a.o,b,a.D[0])};X[231]=function(a){var b=a.L();uf(a,b,2);Ta(a.o,b,a.h[0])};Z[231]=function(a){var b=a.L();uf(a,b,4);Ua(a.o,b,a.b[0])};X[232]=function(a){var b=a.U();I(a,Fe(a));eh(a,b)};Z[232]=function(a){var b=a.ea();J(a,Fe(a));a.A=a.A+b|0;me(a)||Fe(a)};
+X[233]=function(a){var b=a.U();eh(a,b)};Z[233]=function(a){var b=a.ea();a.A=a.A+b|0;me(a)||Fe(a)};X[234]=function(a){var b=a.U(),c=a.Ib();Qe(a,b,c,!1);me(a)||Fe(a)};Z[234]=function(a){var b=a.ea(),c=a.Ib();Qe(a,b,c,!1);me(a)||Fe(a)};W[235]=function(a){var b=a.wa();a.A=a.A+b|0;me(a)||Fe(a)};W[236]=function(a){var b=a.h[4];uf(a,b,1);a.D[0]=Va(a.o,b)};X[237]=function(a){var b=a.h[4];uf(a,b,2);a.h[0]=Wa(a.o,b)};Z[237]=function(a){var b=a.h[4];uf(a,b,4);a.b[0]=Xa(a.o,b)};
+W[238]=function(a){var b=a.h[4];uf(a,b,1);Sa(a.o,b,a.D[0])};X[239]=function(a){var b=a.h[4];uf(a,b,2);Ta(a.o,b,a.h[0])};Z[239]=function(a){var b=a.h[4];uf(a,b,4);Ua(a.o,b,a.b[0])};W[240]=function(a){ge(a)};W[241]=function(a){throw a.debug.P("int1 instruction");};W[242]=function(a){a.H|=16;ge(a);a.H=0};W[243]=function(a){a.H|=8;ge(a);a.H=0};W[244]=function(a){a.N&&H(a,0);if(0===(a.flags&512))throw a.debug.show("cpu halted"),a.w.send("cpu-event-halt"),"HALT";a.Tc=!0;throw 233495534;};
+W[245]=function(a){a.flags=(a.flags|1)^a.cb();a.u&=-2};
+W[246]=function(a){D(a);switch(a.f>>3&7){case 0:var b=Ue(a),c=a.L();a.and(b,c,7);break;case 1:b=Ue(a);c=a.L();a.and(b,c,7);break;case 2:b=bf(a);cf(a,~b);break;case 3:b=bf(a);cf(a,ag(a,b,7));break;case 4:b=Ue(a);b*=a.D[0];a.h[0]=b;a.F=b&255;a.S=7;a.flags=256>b?a.flags&-2050:a.flags|2049;a.u=212;break;case 5:b=Ue(a)<<24>>24;b*=a.sg[0];a.h[0]=b;a.F=b&255;a.S=7;a.flags=127<b||-128>b?a.flags|2049:a.flags&-2050;a.u=212;break;case 6:b=Ue(a);if(0===b)Re(a);else{c=a.h[0];var d=c/b|0;256<=d?Re(a):(a.D[0]=d,
+a.D[1]=c%b)}break;case 7:b=Ue(a)<<24>>24,0===b?Re(a):(c=a.se[0],d=c/b|0,128<=d||-129>=d?Re(a):(a.D[0]=d,a.D[1]=c%b))}};
+X[247]=function(a){D(a);switch(a.f>>3&7){case 0:var b=O(a),c=a.U();a.and(b,c,15);break;case 1:b=O(a);c=a.U();a.and(b,c,15);break;case 2:b=Q(a);R(a,~b);break;case 3:b=Q(a);R(a,ag(a,b,15));break;case 4:b=O(a);b*=a.h[0];c=b>>>16;a.h[0]=b;a.h[4]=c;a.F=b&65535;a.S=15;a.flags=0===c?a.flags&-2050:a.flags|2049;a.u=212;break;case 5:b=O(a)<<16>>16;b*=a.se[0];a.h[0]=b;a.h[4]=b>>16;a.F=b&65535;a.S=15;a.flags=32767<b||-32768>b?a.flags|2049:a.flags&-2050;a.u=212;break;case 6:b=O(a);if(0===b)Re(a);else{c=(a.h[0]|
+a.h[4]<<16)>>>0;var d=c/b|0;65536<=d||0>d?Re(a):(a.h[0]=d,a.h[4]=c%b)}break;case 7:b=O(a)<<16>>16,0===b?Re(a):(c=a.h[0]|a.h[4]<<16,d=c/b|0,32768<=d||-32769>=d?Re(a):(a.h[0]=d,a.h[4]=c%b))}};
+Z[247]=function(a){D(a);switch(a.f>>3&7){case 0:var b=Ve(a),c=a.ea();a.and(b,c,31);break;case 1:b=Ve(a);c=a.ea();a.and(b,c,31);break;case 2:b=df(a);ef(a,~b);break;case 3:b=df(a);ef(a,ag(a,b,31));break;case 4:b=Ve(a)>>>0;b=cg(a,a.b[0],b);a.b[0]=b[0];a.b[2]=b[1];a.F=b[0];a.S=31;a.flags=0===b[1]?a.flags&-2050:a.flags|2049;a.u=212;break;case 5:b=Ve(a);b=dg(a,a.b[0],b);a.b[0]=b[0];a.b[2]=b[1];a.F=b[0];a.S=31;a.flags=b[1]===b[0]>>31?a.flags&-2050:a.flags|2049;a.u=212;break;case 6:b=Ve(a)>>>0;c=fg(a,a.Fd[0],
+a.Fd[2],b);b=c[0];c=c[1];4294967296<=b?Re(a):(a.b[0]=b,a.b[2]=c);break;case 7:var d=Ve(a),e=a.Fd[0],f=a.b[2];c=b=!1;0>d&&(c=!0,d=-d);0>f&&(b=!0,c=!c,e=-e>>>0,f=~f+!e);e=fg(a,e,f,d);d=e[0];e=e[1];c&&(d=-d|0);b&&(e=-e|0);2147483648<=d||-2147483649>=d?Re(a):(a.b[0]=d,a.b[2]=e)}};W[248]=function(a){a.flags&=-2;a.u&=-2};W[249]=function(a){a.flags|=1;a.u&=-2};W[250]=function(a){!a.ta||(a.flags&131072?3===xe(a):xe(a)>=a.N)?a.flags&=-513:H(a,0)};
+W[251]=function(a){!a.ta||(a.flags&131072?3===xe(a):xe(a)>=a.N)?(a.flags|=512,a.H=0,ee(a),ab(a)):H(a,0)};W[252]=function(a){a.flags&=-1025};W[253]=function(a){a.flags|=1024};W[254]=function(a){D(a);var b=a.f&56;0===b?(b=bf(a),cf(a,Zf(a,b,7))):8===b?(b=bf(a),cf(a,$f(a,b,7))):t(a)};
+X[255]=function(a){D(a);switch(a.f>>3&7){case 0:var b=Q(a);R(a,Zf(a,b,15));break;case 1:b=Q(a);R(a,$f(a,b,15));break;case 2:b=O(a);I(a,Fe(a));a.A=C(a,1)+b|0;me(a)||Fe(a);break;case 3:192<=a.f&&t(a);var c=F(a,a.f);b=x(a,c);c=x(a,c+2|0);Qe(a,b,c,!0);me(a)||Fe(a);break;case 4:b=O(a);a.A=C(a,1)+b|0;me(a)||Fe(a);break;case 5:192<=a.f&&t(a);c=F(a,a.f);b=x(a,c);c=x(a,c+2|0);Qe(a,b,c,!1);me(a)||Fe(a);break;case 6:b=O(a);I(a,b);break;case 7:t(a)}};
+Z[255]=function(a){D(a);switch(a.f>>3&7){case 0:var b=df(a);ef(a,Zf(a,b,31));break;case 1:b=df(a);ef(a,$f(a,b,31));break;case 2:b=Ve(a);J(a,Fe(a));a.A=C(a,1)+b|0;break;case 3:192<=a.f&&t(a);var c=F(a,a.f);b=y(a,c);c=x(a,c+4|0);if((!a.ta||ye(a))&&b&4294901760)throw a.debug.P("#GP handler");Qe(a,b,c,!0);break;case 4:b=Ve(a);a.A=C(a,1)+b|0;break;case 5:192<=a.f&&t(a);c=F(a,a.f);b=y(a,c);c=x(a,c+4|0);if((!a.ta||ye(a))&&b&4294901760)throw a.debug.P("#GP handler");Qe(a,b,c,!1);break;case 6:b=Ve(a);J(a,
+b);break;case 7:t(a)}};var uh=[],vh=[];q.prototype.Ya=uh;q.prototype.Za=vh;for(var wh=0;256>wh;wh++)W[wh]?uh[wh]=vh[wh]=W[wh]:X[wh]&&(uh[wh]=X[wh],vh[wh]=Z[wh]);W=[];X=[];Z=[];
+W[0]=function(a){D(a);a.ta&&!ye(a)||t(a);switch(a.f>>3&7){case 0:$e(a,a.M[7]);Bb(a)&&192<=a.f&&(a.b[a.f&7]&=65535);break;case 1:$e(a,a.M[6]);Bb(a)&&192<=a.f&&(a.b[a.f&7]&=65535);break;case 2:a.N&&H(a,0);var b=O(a);Je(a,b);break;case 3:a.N&&H(a,0);b=O(a);var c=Ie(a,b);if(!c.hg)throw a.debug.P("TR can only be loaded from GDT");if(c.Ta)throw a.debug.P("#GP handler");if(!c.Fb)throw a.debug.P("#GP handler (happens when running kvm-unit-test without ACPI)");if(9!==c.type&&1!==c.type)throw a.debug.P("#GP handler");
+if(!c.ib)throw a.debug.P("#NT handler");a.Md=9===c.type;a.xa[6]=c.gb;a.La[6]=c.Db;a.M[6]=b;a.za(c.gf+5|0,a.ja(c.gf+5|0)|2);break;case 4:b=O(a);b=Ie(a,b);a.u&=-65;a.flags=b.Ta||!b.Gb||b.Fb||!b.mg||!b.We&&(b.$<a.N||b.$<b.Ba)?a.flags&-65:a.flags|64;break;case 5:b=O(a);b=Ie(a,b);a.u&=-65;a.flags=b.Ta||!b.Gb||b.Fb||!b.Bf||b.$<a.N||b.$<b.Ba?a.flags&-65:a.flags|64;break;default:t(a)}};
+W[1]=function(a){D(a);var b=a.f>>3&7;if(4===b)192<=a.f&&Bb(a)?af(a,a.K[0]):$e(a,a.K[0]);else if(6===b){a.N&&H(a,0);var c=O(a);c=a.K[0]&-16|c&15;a.ta&&(c|=1);he(a,c)}else switch(192<=a.f&&t(a),c=F(a,a.f),b){case 0:Cb(a,c,6);u(a,c,a.ie);b=Bb(a)?-1:16777215;w(a,c+2,a.Qc&b);break;case 1:Cb(a,c,6);u(a,c,a.je);b=Bb(a)?-1:16777215;w(a,c+2,a.Rc&b);break;case 2:a.N&&H(a,0);b=x(a,c);c=y(a,c+2);a.ie=b;a.Qc=c;Bb(a)||(a.Qc&=16777215);break;case 3:a.N&&H(a,0);b=x(a,c);c=y(a,c+2);a.je=b;a.Rc=c;Bb(a)||(a.Rc&=16777215);
+break;case 7:a.N&&H(a,0);c>>>=12;a.oc[c]=0;a.jf[c]=0;a.jc=-1;a.me=-1;break;default:t(a)}};X[2]=function(a){D(a);a.ta&&!ye(a)||t(a);var b=O(a);of(a,vf(a,b,mf(a)))};Z[2]=function(a){D(a);a.ta&&!ye(a)||t(a);var b=O(a);pf(a,vf(a,b,S(a)))};X[3]=function(a){D(a);a.ta&&!ye(a)||t(a);var b=O(a);of(a,wf(a,b,mf(a)))};Z[3]=function(a){D(a);a.ta&&!ye(a)||t(a);var b=O(a);pf(a,wf(a,b,S(a)))};W[4]=function(a){t(a)};W[5]=function(a){t(a)};W[6]=function(a){a.N?H(a,0):a.K[0]&=-9};W[7]=function(a){t(a)};W[8]=function(a){t(a)};
+W[9]=function(a){a.N&&H(a,0)};W[10]=function(a){t(a)};W[11]=function(a){t(a)};W[12]=function(a){t(a)};W[13]=function(a){t(a)};W[14]=function(a){t(a)};W[15]=function(a){t(a)};W[16]=function(a){t(a)};W[17]=function(a){t(a)};W[18]=function(a){K(a);D(a);var b=Xe(a),c=b[1],d=(a.f>>3&7)<<2;a.na[d]=b[0];a.na[d+1]=c};W[19]=function(a){K(a);D(a);var b=qf(a),c=F(a,a.f);te(a,c,b[0],b[1])};W[20]=function(a){t(a)};W[21]=function(a){t(a)};W[22]=function(a){t(a)};W[23]=function(a){t(a)};
+W[24]=function(a){D(a);192>a.f&&F(a,a.f)};W[25]=function(a){t(a)};W[26]=function(a){t(a)};W[27]=function(a){t(a)};W[28]=function(a){t(a)};W[29]=function(a){t(a)};W[30]=function(a){t(a)};W[31]=function(a){D(a);192>a.f&&F(a,a.f)};W[32]=function(a){D(a);a.N&&H(a,0);switch(a.f>>3&7){case 0:jf(a,a.K[0]);break;case 2:jf(a,a.K[2]);break;case 3:jf(a,a.K[3]);break;case 4:jf(a,a.K[4]);break;default:t(a)}};W[33]=function(a){D(a);a.N&&H(a,0);var b=a.f>>3&7;a.K[4]&8&&(4===b||5===b)&&t(a);a.b[a.f&7]=a.md[b]};
+W[34]=function(a){D(a);a.N&&H(a,0);var b=hf(a);switch(a.f>>3&7){case 0:he(a,b);break;case 2:a.K[2]=b;break;case 3:a.K[3]=b&-4072;Ke(a);break;case 4:b&-3565568&&H(a,0);(a.K[4]^b)&128&&(b&128?Ke(a):Yd(a));a.K[4]=b;a.af=b&16?128:0;if(b&32)throw a.debug.P("PAE");b&4294965504&&t(a);break;default:t(a)}};W[35]=function(a){D(a);a.N&&H(a,0);var b=a.f>>3&7;a.K[4]&8&&(4===b||5===b)&&t(a);a.md[b]=hf(a)};W[36]=function(a){t(a)};W[37]=function(a){t(a)};W[38]=function(a){t(a)};W[39]=function(a){t(a)};
+W[40]=function(a){K(a);D(a);var b=Ye(a);tf(a,b[0],b[1],b[2],b[3])};W[41]=function(a){K(a);D(a);if(32===(a.H&56))var b=rf(a),c=F(a,a.f);else b=rf(a),c=F(a,a.f);ue(a,c,b[0],b[1],b[2],b[3])};W[42]=function(a){t(a)};W[43]=function(a){t(a)};W[44]=function(a){t(a)};W[45]=function(a){t(a)};W[46]=function(a){t(a)};W[47]=function(a){t(a)};
+W[48]=function(a){a.N&&H(a,0);var b=a.b[0],c=a.b[2];switch(a.b[1]){case 372:a.Kd=b&65535;break;case 374:a.xe=b;break;case 373:a.ye=b;break;case 27:a.Oh=2048===(b&2048);break;case 16:b=(b>>>0)+4294967296*(c>>>0),a.kf=$a()-b/8192}};W[49]=function(a){if(a.N&&a.K[4]&4)H(a,0);else{var b=$a()-a.kf;a.b[0]=8192*b;a.b[2]=1.9073486328125E-6*b}};
+W[50]=function(a){a.N&&H(a,0);var b=0,c=0;switch(a.b[1]){case 372:b=a.Kd;break;case 374:b=a.xe;break;case 373:b=a.ye;break;case 16:c=$a()-a.kf;b=8192*c;c*=1.9073486328125E-6;break;case 44:b=16777216}a.b[0]=b;a.b[2]=c};W[51]=function(a){t(a)};W[52]=function(a){var b=a.Kd&65532;a.ta&&0!==b||H(a,0);a.flags&=-131585;a.A=a.xe;a.b[4]=a.ye;a.M[1]=b;a.eb[1]=0;a.La[1]=-1;a.xa[1]=0;ce(a,!0);a.N=0;ie(a);a.M[2]=b+8;a.eb[2]=0;a.La[2]=-1;a.xa[2]=0;a.qb=!0};
+W[53]=function(a){var b=a.Kd&65532;a.ta&&!a.N&&0!==b||H(a,0);a.A=a.b[2];a.b[4]=a.b[1];a.M[1]=b+16|3;a.eb[1]=0;a.La[1]=-1;a.xa[1]=0;ce(a,!0);a.N=3;ie(a);a.M[2]=b+24|3;a.eb[2]=0;a.La[2]=-1;a.xa[2]=0;a.qb=!0};W[54]=function(a){t(a)};W[55]=function(a){t(a)};W[56]=function(a){t(a)};W[57]=function(a){t(a)};W[58]=function(a){t(a)};W[59]=function(a){t(a)};W[60]=function(a){t(a)};W[61]=function(a){t(a)};W[62]=function(a){t(a)};W[63]=function(a){t(a)};X[64]=function(a){D(a);hh(a,a.Qb())};
+Z[64]=function(a){D(a);ih(a,a.Qb())};X[65]=function(a){D(a);hh(a,!a.Qb())};Z[65]=function(a){D(a);ih(a,!a.Qb())};X[66]=function(a){D(a);hh(a,a.yb())};Z[66]=function(a){D(a);ih(a,a.yb())};X[67]=function(a){D(a);hh(a,!a.yb())};Z[67]=function(a){D(a);ih(a,!a.yb())};X[68]=function(a){D(a);hh(a,a.Ab())};Z[68]=function(a){D(a);ih(a,a.Ab())};X[69]=function(a){D(a);hh(a,!a.Ab())};Z[69]=function(a){D(a);ih(a,!a.Ab())};X[70]=function(a){D(a);hh(a,kh(a))};Z[70]=function(a){D(a);ih(a,kh(a))};
+X[71]=function(a){D(a);hh(a,!kh(a))};Z[71]=function(a){D(a);ih(a,!kh(a))};X[72]=function(a){D(a);hh(a,a.Rb())};Z[72]=function(a){D(a);ih(a,a.Rb())};X[73]=function(a){D(a);hh(a,!a.Rb())};Z[73]=function(a){D(a);ih(a,!a.Rb())};X[74]=function(a){D(a);hh(a,a.zb())};Z[74]=function(a){D(a);ih(a,a.zb())};X[75]=function(a){D(a);hh(a,!a.zb())};Z[75]=function(a){D(a);ih(a,!a.zb())};X[76]=function(a){D(a);hh(a,lh(a))};Z[76]=function(a){D(a);ih(a,lh(a))};X[77]=function(a){D(a);hh(a,!lh(a))};
+Z[77]=function(a){D(a);ih(a,!lh(a))};X[78]=function(a){D(a);hh(a,mh(a))};Z[78]=function(a){D(a);ih(a,mh(a))};X[79]=function(a){D(a);hh(a,!mh(a))};Z[79]=function(a){D(a);ih(a,!mh(a))};W[80]=function(a){t(a)};W[81]=function(a){t(a)};W[82]=function(a){t(a)};W[83]=function(a){t(a)};W[84]=function(a){t(a)};W[85]=function(a){t(a)};W[86]=function(a){t(a)};W[87]=function(a){K(a);D(a);var b=Ye(a),c=rf(a);tf(a,b[0]^c[0],b[1]^c[1],b[2]^c[2],b[3]^c[3])};W[88]=function(a){t(a)};W[89]=function(a){t(a)};W[90]=function(a){t(a)};
+W[91]=function(a){t(a)};W[92]=function(a){t(a)};W[93]=function(a){t(a)};W[94]=function(a){t(a)};W[95]=function(a){t(a)};
+W[96]=function(a){K(a);D(a);if(32==(a.H&56)){var b=Xe(a);b=new Uint8Array(b.buffer);var c=qf(a);c=new Uint8Array(c.buffer);tf(a,c[0]|b[0]<<8|c[1]<<16|b[1]<<24,c[2]|b[2]<<8|c[3]<<16|b[3]<<24,c[4]|b[4]<<8|c[5]<<16|b[5]<<24,c[6]|b[6]<<8|c[7]<<16|b[7]<<24)}else b=We(a),c=a.s[2*(a.f>>3&7)],T(a,c&255|(b&255)<<8|(c>>8&255)<<16|(b>>8&255)<<24,c>>16&255|(b>>16&255)<<8|c>>>24<<16|b>>>24<<24)};
+W[97]=function(a){K(a);D(a);if(32==(a.H&56)){var b=Xe(a);b=new Uint16Array(b.buffer);var c=qf(a);c=new Uint16Array(c.buffer);tf(a,c[0]|b[0]<<16,c[1]|b[1]<<16,c[2]|b[2]<<16,c[3]|b[3]<<16)}else b=We(a),c=a.s[2*(a.f>>3&7)],T(a,c&65535|(b&65535)<<16,c>>>16|b>>>16<<16)};W[98]=function(a){K(a);D(a);var b=We(a);T(a,a.s[2*(a.f>>3&7)],b)};
+W[99]=function(a){K(a);D(a);var b=P(a),c=a.s[2*(a.f>>3&7)],d=a.s[2*(a.f>>3&7)+1],e=0|Yg(c&65535);e|=Yg(c>>>16)<<8;e|=Yg(d&65535)<<16;e|=Yg(d>>>16)<<24;c=0|Yg(b[0]&65535);c|=Yg(b[0]>>>16)<<8;c|=Yg(b[1]&65535)<<16;c|=Yg(b[1]>>>16)<<24;T(a,e,c)};
+W[100]=function(a){K(a);D(a);var b=P(a);b=new Int8Array(b.buffer);var c=8*(a.f>>3&7),d=a.Gd;T(a,(d[c]>b[0]?255:0)|(d[c+1]>b[1]?255:0)<<8|(d[c+2]>b[2]?255:0)<<16|(d[c+3]>b[3]?255:0)<<24,(d[c+4]>b[4]?255:0)|(d[c+5]>b[5]?255:0)<<8|(d[c+6]>b[6]?255:0)<<16|(d[c+7]>b[7]?255:0)<<24)};W[101]=function(a){K(a);D(a);var b=P(a),c=a.s[2*(a.f>>3&7)],d=a.s[2*(a.f>>3&7)+1];T(a,(c<<16>>16>b[0]<<16>>16?65535:0)|(c>>16>b[0]>>16?65535:0)<<16,(d<<16>>16>b[1]<<16>>16?65535:0)|(d>>16>b[1]>>16?65535:0)<<16)};
+W[102]=function(a){K(a);D(a);var b=P(a);T(a,a.s[2*(a.f>>3&7)]>b[0]?-1:0,a.s[2*(a.f>>3&7)+1]>b[1]?-1:0)};
+W[103]=function(a){K(a);D(a);if(32==(a.H&56)){var b=Ye(a);b=new Int16Array(b.buffer);var c=rf(a);c=new Int16Array(c.buffer);for(var d=le(0,0,0,0),e=new Uint8Array(d.buffer),f=0;8>f;f++)e[f]=Xg(c[f]),e[f|8]=Xg(b[f]);tf(a,d[0],d[1],d[2],d[3])}else b=P(a),d=a.s[2*(a.f>>3&7)],e=a.s[2*(a.f>>3&7)+1],c=0|Xg(d&65535),c|=Xg(d>>>16)<<8,c|=Xg(e&65535)<<16,c|=Xg(e>>>16)<<24,d=0|Xg(b[0]&65535),d|=Xg(b[0]>>>16)<<8,d|=Xg(b[1]&65535)<<16,d|=Xg(b[1]>>>16)<<24,T(a,c,d)};
+W[104]=function(a){K(a);D(a);if(32==(a.H&56)){var b=Ye(a);b=new Uint8Array(b.buffer);var c=rf(a);c=new Uint8Array(c.buffer);tf(a,c[8]|b[8]<<8|c[9]<<16|b[9]<<24,c[10]|b[10]<<8|c[11]<<16|b[11]<<24,c[12]|b[12]<<8|c[13]<<16|b[13]<<24,c[14]|b[14]<<8|c[15]<<16|b[15]<<24)}else b=P(a),c=a.s[2*(a.f>>3&7)+1],T(a,c&255|(b[1]&255)<<8|(c>>8&255)<<16|(b[1]>>8&255)<<24,c>>16&255|(b[1]>>16&255)<<8|c>>>24<<16|b[1]>>>24<<24)};
+W[105]=function(a){K(a);D(a);var b=P(a),c=a.s[2*(a.f>>3&7)+1];T(a,c&65535|(b[1]&65535)<<16,c>>>16|b[1]>>>16<<16)};W[106]=function(a){K(a);D(a);var b=P(a);T(a,a.s[2*(a.f>>3&7)+1],b[1])};W[107]=function(a){K(a);D(a);var b=P(a),c=a.s[2*(a.f>>3&7)+1],d=0|Zg(a.s[2*(a.f>>3&7)]);d|=Zg(c)<<16;c=0|Zg(b[0]);c|=Zg(b[1])<<16;T(a,d,c)};W[108]=function(a){t(a)};W[109]=function(a){t(a)};W[110]=function(a){K(a);D(a);if(32===(a.H&56)){var b=Ve(a);tf(a,b,0,0,0)}else b=Ve(a),T(a,b,0)};
+W[111]=function(a){K(a);D(a);if(32==(a.H&56)){var b=Ye(a);tf(a,b[0],b[1],b[2],b[3])}else 8==(a.H&56)?(192>a.f?(b=F(a,a.f),b=le(y(a,b),y(a,b+4|0),y(a,b+8|0),y(a,b+12|0))):(b=(a.f&7)<<2,b=le(a.na[b],a.na[b|1],a.na[b|2],a.na[b|3])),tf(a,b[0],b[1],b[2],b[3])):(b=P(a),T(a,b[0],b[1]))};
+W[112]=function(a){K(a);D(a);if(32===(a.H&56)){var b=Ye(a),c=a.L();tf(a,b[c&3],b[c>>2&3],b[c>>4&3],b[c>>6&3])}else if(16===(a.H&56)){b=Ye(a);c=new Uint16Array(b.buffer);var d=a.L();tf(a,c[d&3]|c[d>>2&3]<<16,c[d>>4&3]|c[d>>6&3]<<16,b[2],b[3])}else if(8===(a.H&56))b=Ye(a),c=new Uint16Array(b.buffer),d=a.L(),tf(a,b[0],b[1],c[d&3|4]|c[d>>2&3|4]<<16,c[d>>4&3|4]|c[d>>6&3|4]<<16);else{b=P(a);var e=a.L();c=e&3;d=e>>2&3;var f=e>>4&3;e>>>=6;T(a,b[c>>1]>>>16*(c&1)&65535|b[d>>1]>>>16*(d&1)<<16,b[f>>1]>>>16*(f&
+1)&65535|b[e>>1]>>>16*(e&1)<<16)}};
+W[113]=function(a){D(a);K(a);192>a.f&&t(a);switch(a.f>>3&7){case 2:var b=a.L(),c=a.f&7,d=a.s[2*c],e=a.s[2*c+1],f=0,h=0;15>=b&&(f=(d&65535)>>>b|d>>>16>>>b<<16,h=(e&65535)>>>b|e>>>16>>>b<<16);a.s[2*c]=f;a.s[2*c+1]=h;break;case 4:b=a.L();c=a.f&7;d=a.s[2*c];e=a.s[2*c+1];15<b&&(b=16);a.s[2*c]=d<<16>>16>>b&65535|(d>>16>>b&65535)<<16;a.s[2*c+1]=e<<16>>16>>b&65535|(e>>16>>b&65535)<<16;break;case 6:b=a.L();c=a.f&7;d=a.s[2*c];e=a.s[2*c+1];h=f=0;15>=b&&(f=(d&65535)<<b&65535|d>>>16<<b<<16,h=(e&65535)<<b&65535|
+e>>>16<<b<<16);a.s[2*c]=f;a.s[2*c+1]=h;break;default:t(a)}};W[114]=function(a){D(a);K(a);192>a.f&&t(a);switch(a.f>>3&7){case 2:var b=a.L(),c=a.f&7,d=a.s[2*c],e=a.s[2*c+1],f=0,h=0;31>=b&&(f=d>>>b,h=e>>>b);a.s[2*c]=f;a.s[2*c+1]=h;break;case 4:b=a.L();c=a.f&7;d=a.s[2*c];e=a.s[2*c+1];31<b&&(b=31);a.s[2*c]=d>>b;a.s[2*c+1]=e>>b;break;case 6:b=a.L();c=a.f&7;d=a.s[2*c];e=a.s[2*c+1];h=f=0;31>=b&&(f=d<<b,h=e<<b);a.s[2*c]=f;a.s[2*c+1]=h;break;default:t(a)}};
+W[115]=function(a){D(a);K(a);192>a.f&&t(a);switch(a.f>>3&7){case 2:var b=a.L(),c=a.f&7,d=a.s[2*c],e=a.s[2*c+1],f=0,h=0;31>=b?(f=d>>>b|e<<32-b,h=e>>>b):63>=b&&(f=e>>>(b&31),h=0);a.s[2*c]=f;a.s[2*c+1]=h;break;case 6:b=a.L();c=a.f&7;d=a.s[2*c];e=a.s[2*c+1];h=f=0;31>=b?(f=d<<b,h=e<<b|d>>>32-b):63>=b&&(h=d<<(b&31),f=0);a.s[2*c]=f;a.s[2*c+1]=h;break;default:t(a)}};
+W[116]=function(a){K(a);D(a);if(32==(a.H&56)){var b=Ye(a);b=new Uint8Array(b.buffer);var c=rf(a);c=new Uint8Array(c.buffer);for(var d=le(0,0,0,0),e=new Uint8Array(d.buffer),f=0;16>f;f++)e[f]=b[f]===c[f]?255:0;tf(a,d[0],d[1],d[2],d[3])}else b=P(a),b=new Int8Array(b.buffer),c=8*(a.f>>3&7),d=a.Gd,T(a,(d[c]===b[0]?255:0)|(d[c+1]===b[1]?255:0)<<8|(d[c+2]===b[2]?255:0)<<16|(d[c+3]===b[3]?255:0)<<24,(d[c+4]===b[4]?255:0)|(d[c+5]===b[5]?255:0)<<8|(d[c+6]===b[6]?255:0)<<16|(d[c+7]===b[7]?255:0)<<24)};
+W[117]=function(a){K(a);D(a);var b=P(a),c=a.s[2*(a.f>>3&7)],d=a.s[2*(a.f>>3&7)+1];T(a,((c&65535)===(b[0]&65535)?65535:0)|((c&4294901760)===(b[0]&4294901760)?65535:0)<<16,((d&65535)===(b[1]&65535)?65535:0)|((d&4294901760)===(b[1]&4294901760)?65535:0)<<16)};W[118]=function(a){K(a);D(a);if(32==(a.H&56)){var b=Ye(a),c=rf(a);tf(a,b[0]===c[0]?-1:0,b[1]===c[1]?-1:0,b[2]===c[2]?-1:0,b[3]===c[3]?-1:0)}else b=P(a),T(a,a.s[2*(a.f>>3&7)]===b[0]?-1:0,a.s[2*(a.f>>3&7)+1]===b[1]?-1:0)};
+W[119]=function(a){K(a);a.T.fa=255};W[120]=function(a){t(a)};W[121]=function(a){t(a)};W[122]=function(a){t(a)};W[123]=function(a){t(a)};W[124]=function(a){t(a)};W[125]=function(a){t(a)};W[126]=function(a){K(a);D(a);if(8===(a.H&56)){var b=Xe(a);tf(a,b[0],b[1],0,0)}else 32==(a.H&56)?(b=qf(a),af(a,b[0])):(b=sf(a),af(a,b[0]))};
+W[127]=function(a){K(a);D(a);if(8==(a.H&56)){var b=rf(a),c=F(a,a.f);ue(a,c,b[0],b[1],b[2],b[3])}else if(32==(a.H&56))b=rf(a),c=F(a,a.f),ue(a,c,b[0],b[1],b[2],b[3]);else if(c=sf(a),b=c[0],c=c[1],192>a.f){var d=F(a,a.f);te(a,d,b,c)}else a.s[2*(a.f&7)]=b,a.s[2*(a.f&7)+1]=c};X[128]=function(a){fh(a,a.Qb())};Z[128]=function(a){gh(a,a.Qb())};X[129]=function(a){fh(a,!a.Qb())};Z[129]=function(a){gh(a,!a.Qb())};X[130]=function(a){fh(a,a.yb())};Z[130]=function(a){gh(a,a.yb())};X[131]=function(a){fh(a,!a.yb())};
+Z[131]=function(a){gh(a,!a.yb())};X[132]=function(a){fh(a,a.Ab())};Z[132]=function(a){gh(a,a.Ab())};X[133]=function(a){fh(a,!a.Ab())};Z[133]=function(a){gh(a,!a.Ab())};X[134]=function(a){fh(a,kh(a))};Z[134]=function(a){gh(a,kh(a))};X[135]=function(a){fh(a,!kh(a))};Z[135]=function(a){gh(a,!kh(a))};X[136]=function(a){fh(a,a.Rb())};Z[136]=function(a){gh(a,a.Rb())};X[137]=function(a){fh(a,!a.Rb())};Z[137]=function(a){gh(a,!a.Rb())};X[138]=function(a){fh(a,a.zb())};Z[138]=function(a){gh(a,a.zb())};
+X[139]=function(a){fh(a,!a.zb())};Z[139]=function(a){gh(a,!a.zb())};X[140]=function(a){fh(a,lh(a))};Z[140]=function(a){gh(a,lh(a))};X[141]=function(a){fh(a,!lh(a))};Z[141]=function(a){gh(a,!lh(a))};X[142]=function(a){fh(a,mh(a))};Z[142]=function(a){gh(a,mh(a))};X[143]=function(a){fh(a,!mh(a))};Z[143]=function(a){gh(a,!mh(a))};W[144]=function(a){D(a);jh(a,a.Qb())};W[145]=function(a){D(a);jh(a,!a.Qb())};W[146]=function(a){D(a);jh(a,a.yb())};W[147]=function(a){D(a);jh(a,!a.yb())};
+W[148]=function(a){D(a);jh(a,a.Ab())};W[149]=function(a){D(a);jh(a,!a.Ab())};W[150]=function(a){D(a);jh(a,kh(a))};W[151]=function(a){D(a);jh(a,!kh(a))};W[152]=function(a){D(a);jh(a,a.Rb())};W[153]=function(a){D(a);jh(a,!a.Rb())};W[154]=function(a){D(a);jh(a,a.zb())};W[155]=function(a){D(a);jh(a,!a.zb())};W[156]=function(a){D(a);jh(a,lh(a))};W[157]=function(a){D(a);jh(a,!lh(a))};W[158]=function(a){D(a);jh(a,mh(a))};W[159]=function(a){D(a);jh(a,!mh(a))};X[160]=function(a){I(a,a.M[4])};
+Z[160]=function(a){J(a,a.M[4])};X[161]=function(a){$d(a,4,x(a,G(a,0)));Ee(a,2)};Z[161]=function(a){$d(a,4,y(a,G(a,0))&65535);Ee(a,4)};
+W[162]=function(a){var b=0,c=0,d=0,e=0;switch(a.b[0]){case 0:b=5;e=1970169159;d=1231384169;c=1818588270;break;case 1:b=3939;e=67584;c=-1065353216;d=(a.T?1:0)|43320;break;case 2:b=1717260289;c=e=0;d=8024064;break;case 4:switch(a.b[1]){case 0:b=289;e=29360191;c=63;d=1;break;case 1:b=290;e=29360191;c=63;d=1;break;case 2:b=323,e=96469055,c=4095,d=1}break;case 5:e=b=64;c=3;d=1319200;break;case -2147483648:b=5;break;case 1073741824:e=1635208534,c=1297507698,d=1701994871}a.b[0]=b;a.b[1]=c;a.b[2]=d;a.b[3]=
+e};X[163]=function(a){D(a);192>a.f?Sg(a,F(a,a.f),nf(a)):Og(a,ff(a),mf(a)&15)};Z[163]=function(a){D(a);192>a.f?Sg(a,F(a,a.f),S(a)):Og(a,hf(a),S(a)&31)};X[164]=function(a){D(a);var b=Q(a);R(a,Mg(a,b,mf(a),a.L()&31))};Z[164]=function(a){D(a);var b=df(a);ef(a,Ng(a,b,S(a),a.L()&31))};X[165]=function(a){D(a);var b=Q(a);R(a,Mg(a,b,mf(a),a.D[4]&31))};Z[165]=function(a){D(a);var b=df(a);ef(a,Ng(a,b,S(a),a.D[4]&31))};W[166]=function(a){t(a)};W[167]=function(a){t(a)};X[168]=function(a){I(a,a.M[5])};
+Z[168]=function(a){J(a,a.M[5])};X[169]=function(a){$d(a,5,x(a,G(a,0)));Ee(a,2)};Z[169]=function(a){$d(a,5,y(a,G(a,0))&65535);Ee(a,4)};W[170]=function(a){t(a)};X[171]=function(a){D(a);192>a.f?Vg(a,F(a,a.f),nf(a)):gf(a,Qg(a,ff(a),nf(a)&15))};Z[171]=function(a){D(a);192>a.f?Vg(a,F(a,a.f),S(a)):jf(a,Qg(a,hf(a),S(a)&31))};X[172]=function(a){D(a);var b=Q(a);R(a,Kg(a,b,mf(a),a.L()&31))};Z[172]=function(a){D(a);var b=df(a);ef(a,Lg(a,b,S(a),a.L()&31))};
+X[173]=function(a){D(a);var b=Q(a);R(a,Kg(a,b,mf(a),a.D[4]&31))};Z[173]=function(a){D(a);var b=df(a);ef(a,Lg(a,b,S(a),a.D[4]&31))};
+W[174]=function(a){D(a);a.H&56&&t(a);switch(a.f>>3&7){case 0:192<=a.f&&t(a);var b=F(a,a.f);Cb(a,b,512);u(a,b+0|0,a.T.ec);u(a,b+2|0,zb(a.T));re(a,b+4|0,~a.T.fa&255);u(a,b+6|0,a.T.pd);w(a,b+8|0,a.T.Oc);u(a,b+12|0,a.T.Qe);w(a,b+16|0,a.T.nd);u(a,b+20|0,a.T.od);w(a,b+24|0,a.$e);w(a,b+28|0,65471);for(var c=0;8>c;c++)Jb(a.T,b+32+(c<<4)|0,a.T.I[a.T.B+c&7]);for(c=0;8>c;c++)w(a,b+160+(c<<4)+0|0,a.na[c<<2|0]),w(a,b+160+(c<<4)+4|0,a.na[c<<2|1]),w(a,b+160+(c<<4)+8|0,a.na[c<<2|2]),w(a,b+160+(c<<4)+12|0,a.na[c<<
+2|3]);break;case 1:192<=a.f&&t(a);b=F(a,a.f);je(a,b|0);je(a,b+511|0);c=y(a,b+24|0);c&-65472&&H(a,0);a.T.ec=x(a,b+0|0);var d=a.T,e=x(a,b+2|0);d.a=e&-14337;d.B=e>>11&7;a.T.fa=~pe(a,b+4|0)&255;a.T.pd=x(a,b+6|0);a.T.Oc=y(a,b+8|0);a.T.Oc=x(a,b+12|0);a.T.nd=y(a,b+16|0);a.T.od=x(a,b+20|0);a.$e=c;for(c=0;8>c;c++)a.T.I[a.T.B+c&7]=Ib(a.T,b+32+(c<<4)|0);for(c=0;8>c;c++)a.na[c<<2|0]=y(a,b+160+(c<<4)+0|0),a.na[c<<2|1]=y(a,b+160+(c<<4)+4|0),a.na[c<<2|2]=y(a,b+160+(c<<4)+8|0),a.na[c<<2|3]=y(a,b+160+(c<<4)+12|0);
+break;case 2:192<=a.f&&t(a);b=F(a,a.f);b=y(a,b);b&-65472&&H(a,0);a.$e=b;break;case 3:192<=a.f&&t(a);b=F(a,a.f);w(a,b,a.$e);break;case 5:192>a.f&&t(a);break;case 6:192>a.f&&t(a);break;case 7:192>a.f&&t(a);break;default:t(a)}};X[175]=function(a){D(a);var b=O(a)<<16>>16;of(a,bg(a,nf(a),b))};Z[175]=function(a){D(a);var b=Ve(a);pf(a,eg(a,S(a),b))};
+W[176]=function(a){D(a);if(192>a.f){var b=F(a,a.f);Cb(a,b,1);var c=pe(a,b)}else c=a.D[a.f<<2&12|a.f>>2&1];a.sub(a.D[0],c,7);a.Ac()?192>a.f?re(a,b,kf(a)):a.D[a.f<<2&12|a.f>>2&1]=kf(a):(192>a.f&&re(a,b,c),a.D[0]=c)};X[177]=function(a){D(a);if(192>a.f){var b=F(a,a.f);Cb(a,b,2);var c=x(a,b)}else c=ff(a);a.sub(a.h[0],c,15);a.Ac()?192>a.f?u(a,b,mf(a)):gf(a,mf(a)):(192>a.f&&u(a,b,c),a.h[0]=c)};
+Z[177]=function(a){D(a);if(192>a.f){var b=F(a,a.f);Cb(a,b,4);var c=y(a,b)}else c=hf(a);a.sub(a.b[0],c,31);a.Ac()?192>a.f?w(a,b,S(a)):jf(a,S(a)):(192>a.f&&w(a,b,c),a.b[0]=c)};X[178]=function(a){D(a);rh(a,2)};Z[178]=function(a){D(a);sh(a,2)};X[179]=function(a){D(a);192>a.f?Ug(a,F(a,a.f),nf(a)):gf(a,Rg(a,ff(a),nf(a)&15))};Z[179]=function(a){D(a);192>a.f?Ug(a,F(a,a.f),S(a)):jf(a,Rg(a,hf(a),S(a)&31))};X[180]=function(a){D(a);rh(a,4)};Z[180]=function(a){D(a);sh(a,4)};X[181]=function(a){D(a);rh(a,5)};
+Z[181]=function(a){D(a);sh(a,5)};X[182]=function(a){D(a);var b=Ue(a);of(a,b)};Z[182]=function(a){D(a);var b=Ue(a);pf(a,b)};X[183]=function(a){D(a);var b=O(a);of(a,b)};Z[183]=function(a){D(a);var b=O(a);pf(a,b)};X[184]=function(a){D(a);0===(a.H&8)&&t(a);var b=O(a);of(a,Wg(a,b))};Z[184]=function(a){D(a);0===(a.H&8)&&t(a);var b=Ve(a);pf(a,Wg(a,b))};W[185]=function(a){t(a)};
+X[186]=function(a){D(a);switch(a.f>>3&7){case 4:192>a.f?Sg(a,F(a,a.f),a.L()&15):Og(a,ff(a),a.L()&15);break;case 5:192>a.f?Vg(a,F(a,a.f),a.L()&15):gf(a,Qg(a,ff(a),a.L()&15));break;case 6:192>a.f?Ug(a,F(a,a.f),a.L()&15):gf(a,Rg(a,ff(a),a.L()&15));break;case 7:192>a.f?Tg(a,F(a,a.f),a.L()&15):gf(a,Pg(a,ff(a),a.L()&15));break;default:t(a)}};
+Z[186]=function(a){D(a);switch(a.f>>3&7){case 4:192>a.f?Sg(a,F(a,a.f),a.L()&31):Og(a,hf(a),a.L()&31);break;case 5:192>a.f?Vg(a,F(a,a.f),a.L()&31):jf(a,Qg(a,hf(a),a.L()&31));break;case 6:192>a.f?Ug(a,F(a,a.f),a.L()&31):jf(a,Rg(a,hf(a),a.L()&31));break;case 7:192>a.f?Tg(a,F(a,a.f),a.L()&31):jf(a,Pg(a,hf(a),a.L()&31));break;default:t(a)}};X[187]=function(a){D(a);192>a.f?Tg(a,F(a,a.f),nf(a)):gf(a,Pg(a,ff(a),nf(a)&15))};Z[187]=function(a){D(a);192>a.f?Tg(a,F(a,a.f),S(a)):jf(a,Pg(a,hf(a),S(a)&31))};
+X[188]=function(a){D(a);var b=O(a),c=mf(a);a.u=2197;a.S=15;0===b?(a.flags|=64,a.F=b,b=c):(a.flags&=-65,b=a.F=fb(-b&b));of(a,b)};Z[188]=function(a){D(a);var b=Ve(a),c=S(a);a.u=2197;a.S=31;0===b?(a.flags|=64,a.F=b,b=c):(a.flags&=-65,b=a.F=fb((-b&b)>>>0));pf(a,b)};X[189]=function(a){D(a);var b=O(a),c=mf(a);a.u=2197;a.S=15;0===b?(a.flags|=64,a.F=b,b=c):(a.flags&=-65,b=a.F=fb(b));of(a,b)};
+Z[189]=function(a){D(a);var b=Ve(a),c=S(a);a.u=2197;a.S=31;0===b?(a.flags|=64,a.F=b,b=c):(a.flags&=-65,b=a.F=fb(b>>>0));pf(a,b)};X[190]=function(a){D(a);var b=Ue(a)<<24>>24;of(a,b)};Z[190]=function(a){D(a);var b=Ue(a)<<24>>24;pf(a,b)};X[191]=function(a){D(a);var b=O(a);of(a,b)};Z[191]=function(a){D(a);var b=O(a)<<16>>16;pf(a,b)};W[192]=function(a){D(a);var b=bf(a),c=a.f>>1&12|a.f>>5&1,d=a.D[c];a.D[c]=b;b=a.add(b,d,7);cf(a,b)};
+X[193]=function(a){D(a);var b=Q(a),c=a.f>>2&14,d=a.h[c];a.h[c]=b;b=a.add(b,d,15);R(a,b)};Z[193]=function(a){D(a);var b=df(a),c=a.f>>3&7,d=a.b[c];a.b[c]=b;b=a.add(b,d,31);ef(a,b)};W[194]=function(a){t(a)};W[195]=function(a){D(a);192<=a.f&&t(a);af(a,S(a))};W[196]=function(a){t(a)};W[197]=function(a){t(a)};W[198]=function(a){t(a)};
+W[199]=function(a){D(a);switch(a.f>>3&7){case 1:192<=a.f&&t(a);var b=F(a,a.f);Cb(a,b,8);var c=y(a,b),d=y(a,b+4|0);a.b[0]===c&&a.b[2]===d?(a.flags|=64,w(a,b,a.b[3]),w(a,b+4|0,a.b[1])):(a.flags&=-65,a.b[0]=c,a.b[2]=d,w(a,b,c),w(a,b+4|0,d));a.u&=-65;break;case 6:c=(b=lb())?mb():0;Bb(a)?af(a,c):$e(a,c);a.flags&=-2262;a.flags|=b;a.u=0;break;default:t(a)}};W[200]=function(a){th(a,0)};W[201]=function(a){th(a,1)};W[202]=function(a){th(a,2)};W[203]=function(a){th(a,3)};W[204]=function(a){th(a,4)};
+W[205]=function(a){th(a,5)};W[206]=function(a){th(a,6)};W[207]=function(a){th(a,7)};W[208]=function(a){t(a)};W[209]=function(a){K(a);D(a);var b=P(a),c=a.s[2*(a.f>>3&7)],d=a.s[2*(a.f>>3&7)+1];b=b[0]>>>0;var e=0,f=0;15>=b&&(e=(c&65535)>>>b|c>>>16>>>b<<16,f=(d&65535)>>>b|d>>>16>>>b<<16);T(a,e,f)};W[210]=function(a){K(a);D(a);var b=P(a),c=a.s[2*(a.f>>3&7)],d=a.s[2*(a.f>>3&7)+1];b=b[0]>>>0;var e=0,f=0;31>=b&&(e=c>>>b,f=d>>>b);T(a,e,f)};
+W[211]=function(a){K(a);D(a);var b=P(a),c=a.s[2*(a.f>>3&7)],d=a.s[2*(a.f>>3&7)+1];b=b[0]>>>0;if(0!==b){var e=0,f=0;31>=b?(e=c>>>b|d<<32-b,f=d>>>b):63>=b&&(e=d>>>(b&31),f=0);T(a,e,f)}};W[212]=function(a){t(a)};
+W[213]=function(a){K(a);D(a);if(32==(a.H&56)){var b=Ye(a);b=new Int16Array(b.buffer);var c=rf(a);c=new Int16Array(c.buffer);tf(a,b[0]*c[0]&65535|b[1]*c[1]<<16,b[2]*c[2]&65535|b[3]*c[3]<<16,b[4]*c[4]&65535|b[5]*c[5]<<16,b[6]*c[6]&65535|b[7]*c[7]<<16)}else{b=P(a);c=a.s[2*(a.f>>3&7)];var d=a.s[2*(a.f>>3&7)+1];T(a,(c&65535)*(b[0]&65535)&65535|((c>>>16)*(b[0]>>>16)&65535)<<16,(d&65535)*(b[1]&65535)&65535|((d>>>16)*(b[1]>>>16)&65535)<<16)}};
+W[214]=function(a){K(a);D(a);var b=qf(a),c=F(a,a.f);te(a,c,b[0],b[1])};W[215]=function(a){K(a);D(a);192>a.f&&t(a);var b=Ye(a);b=new Uint8Array(b.buffer);pf(a,b[0]>>7<<0|b[1]>>7<<1|b[2]>>7<<2|b[3]>>7<<3|b[4]>>7<<4|b[5]>>7<<5|b[6]>>7<<6|b[7]>>7<<7|b[8]>>7<<8|b[9]>>7<<9|b[10]>>7<<10|b[11]>>7<<11|b[12]>>7<<12|b[13]>>7<<13|b[14]>>7<<14|b[15]>>7<<15)};
+W[216]=function(a){K(a);D(a);var b=P(a),c=new Uint8Array(b.buffer),d=8*(a.f>>3&7),e=a.tg;b=ah(e[d]-c[0]);var f=ah(e[d+1]-c[1]),h=ah(e[d+2]-c[2]),g=ah(e[d+3]-c[3]),p=ah(e[d+4]-c[4]),r=ah(e[d+5]-c[5]),v=ah(e[d+6]-c[6]);c=ah(e[d+7]-c[7]);T(a,b|f<<8|h<<16|g<<24,p|r<<8|v<<16|c<<24)};
+W[217]=function(a){K(a);D(a);var b=P(a),c=a.s[2*(a.f>>3&7)],d=a.s[2*(a.f>>3&7)+1],e=(c&65535)-(b[0]&65535);c=(c>>>16)-(b[0]>>>16);0>e&&(e=0);0>c&&(c=0);var f=(d&65535)-(b[1]&65535);b=(d>>>16)-(b[1]>>>16);0>f&&(f=0);0>b&&(b=0);T(a,e|c<<16,f|b<<16)};W[218]=function(a){K(a);D(a);var b=Ye(a);b=new Uint8Array(b.buffer);var c=rf(a);c=new Uint8Array(c.buffer);for(var d=le(0,0,0,0),e=new Uint8Array(d.buffer),f=0;16>f;f++)e[f]=b[f]<c[f]?b[f]:c[f];tf(a,d[0],d[1],d[2],d[3])};
+W[219]=function(a){K(a);D(a);var b=P(a);T(a,b[0]&a.s[2*(a.f>>3&7)],b[1]&a.s[2*(a.f>>3&7)+1])};
+W[220]=function(a){K(a);D(a);if(32==(a.H&56)){var b=Ye(a);b=new Uint8Array(b.buffer);var c=rf(a);c=new Uint8Array(c.buffer);for(var d=le(0,0,0,0),e=new Uint8Array(d.buffer),f=0;16>f;f++)e[f]=bh(b[f]+c[f]);tf(a,d[0],d[1],d[2],d[3])}else{b=P(a);var h=new Uint8Array(b.buffer),g=8*(a.f>>3&7),p=a.tg;b=bh(p[g]+h[0]);c=bh(p[g+1]+h[1]);d=bh(p[g+2]+h[2]);e=bh(p[g+3]+h[3]);f=bh(p[g+4]+h[4]);var r=bh(p[g+5]+h[5]),v=bh(p[g+6]+h[6]);h=bh(p[g+7]+h[7]);T(a,b|c<<8|d<<16|e<<24,f|r<<8|v<<16|h<<24)}};
+W[221]=function(a){K(a);D(a);if(32==(a.H&56)){var b=Ye(a);b=new Uint16Array(b.buffer);var c=rf(a);c=new Uint16Array(c.buffer);tf(a,ch(b[0]+c[0])|ch(b[1]+c[1])<<16,ch(b[2]+c[2])|ch(b[3]+c[3])<<16,ch(b[4]+c[4])|ch(b[5]+c[5])<<16,ch(b[6]+c[6])|ch(b[7]+c[7])<<16)}else{c=P(a);var d=a.s[2*(a.f>>3&7)],e=a.s[2*(a.f>>3&7)+1];b=ch((d&65535)+(c[0]&65535));d=ch((d>>>16)+(c[0]>>>16));var f=ch((e&65535)+(c[1]&65535));c=ch((e>>>16)+(c[1]>>>16));T(a,b|d<<16,f|c<<16)}};
+W[222]=function(a){K(a);D(a);if(32==(a.H&56)){var b=Ye(a);b=new Uint8Array(b.buffer);var c=rf(a);c=new Uint8Array(c.buffer);for(var d=le(0,0,0,0),e=new Uint8Array(d.buffer),f=0;16>f;f++)e[f]=b[f]>c[f]?b[f]:c[f];tf(a,d[0],d[1],d[2],d[3])}};W[223]=function(a){K(a);D(a);var b=P(a);T(a,b[0]&~a.s[2*(a.f>>3&7)],b[1]&~a.s[2*(a.f>>3&7)+1])};W[224]=function(a){t(a)};
+W[225]=function(a){K(a);D(a);var b=P(a),c=a.s[2*(a.f>>3&7)],d=a.s[2*(a.f>>3&7)+1];b=b[0]>>>0;15<b&&(b=16);T(a,c<<16>>16>>b&65535|(c>>16>>b&65535)<<16,d<<16>>16>>b&65535|(d>>16>>b&65535)<<16)};W[226]=function(a){K(a);D(a);var b=P(a),c=a.s[2*(a.f>>3&7)],d=a.s[2*(a.f>>3&7)+1];b=b[0]>>>0;31<b&&(b=31);T(a,c>>b,d>>b)};W[227]=function(a){t(a)};
+W[228]=function(a){K(a);D(a);var b=Ye(a);b=new Uint16Array(b.buffer);var c=rf(a);c=new Uint16Array(c.buffer);tf(a,b[0]*c[0]>>>16|b[1]*c[1]&4294901760,b[2]*c[2]>>>16|b[3]*c[3]&4294901760,b[4]*c[4]>>>16|b[5]*c[5]&4294901760,b[6]*c[6]>>>16|b[7]*c[7]&4294901760)};W[229]=function(a){K(a);D(a);var b=P(a),c=a.s[2*(a.f>>3&7)],d=a.s[2*(a.f>>3&7)+1];T(a,(c<<16>>16)*(b[0]<<16>>16)>>>16|(c>>16)*(b[0]>>16)>>>16<<16,(d<<16>>16)*(b[1]<<16>>16)>>>16|(d>>16)*(b[1]>>16)>>>16<<16)};W[230]=function(a){t(a)};
+W[231]=function(a){K(a);D(a);192<=a.f&&t(a);if(32==(a.H&56)){var b=rf(a),c=F(a,a.f);ue(a,c,b[0],b[1],b[2],b[3])}};W[232]=function(a){K(a);D(a);var b=P(a),c=new Int8Array(b.buffer),d=8*(a.f>>3&7),e=a.Gd;b=$g(e[d]-c[0]);var f=$g(e[d+1]-c[1]),h=$g(e[d+2]-c[2]),g=$g(e[d+3]-c[3]),p=$g(e[d+4]-c[4]),r=$g(e[d+5]-c[5]),v=$g(e[d+6]-c[6]);c=$g(e[d+7]-c[7]);T(a,b|f<<8|h<<16|g<<24,p|r<<8|v<<16|c<<24)};
+W[233]=function(a){K(a);D(a);var b=P(a),c=a.s[2*(a.f>>3&7)],d=a.s[2*(a.f>>3&7)+1],e=Zg((c<<16>>16)-(b[0]<<16>>16));c=Zg((c>>16)-(b[0]>>16));var f=Zg((d<<16>>16)-(b[1]<<16>>16));b=Zg((d>>16)-(b[1]>>16));T(a,e|c<<16,f|b<<16)};W[234]=function(a){t(a)};W[235]=function(a){K(a);D(a);if(32===(a.H&56)){var b=Ye(a),c=rf(a);tf(a,b[0]|c[0],b[1]|c[1],b[2]|c[2],b[3]|c[3])}else b=P(a),T(a,b[0]|a.s[2*(a.f>>3&7)],b[1]|a.s[2*(a.f>>3&7)+1])};
+W[236]=function(a){K(a);D(a);var b=P(a),c=new Int8Array(b.buffer),d=8*(a.f>>3&7),e=a.Gd;b=$g(e[d]+c[0]);var f=$g(e[d+1]+c[1]),h=$g(e[d+2]+c[2]),g=$g(e[d+3]+c[3]),p=$g(e[d+4]+c[4]),r=$g(e[d+5]+c[5]),v=$g(e[d+6]+c[6]);c=$g(e[d+7]+c[7]);T(a,b|f<<8|h<<16|g<<24,p|r<<8|v<<16|c<<24)};W[237]=function(a){K(a);D(a);var b=P(a),c=a.s[2*(a.f>>3&7)],d=a.s[2*(a.f>>3&7)+1],e=Zg((c<<16>>16)+(b[0]<<16>>16));c=Zg((c>>16)+(b[0]>>16));var f=Zg((d<<16>>16)+(b[1]<<16>>16));b=Zg((d>>16)+(b[1]>>16));T(a,e|c<<16,f|b<<16)};
+W[238]=function(a){t(a)};W[239]=function(a){K(a);D(a);if(32==(a.H&56)){var b=Ye(a),c=rf(a);tf(a,b[0]^c[0],b[1]^c[1],b[2]^c[2],b[3]^c[3])}else b=P(a),T(a,b[0]^a.s[2*(a.f>>3&7)],b[1]^a.s[2*(a.f>>3&7)+1])};W[240]=function(a){t(a)};W[241]=function(a){K(a);D(a);var b=P(a),c=a.s[2*(a.f>>3&7)],d=a.s[2*(a.f>>3&7)+1];b=b[0]>>>0;var e=0,f=0;15>=b&&(e=(c&65535)<<b&65535|c>>>16<<b<<16,f=(d&65535)<<b&65535|d>>>16<<b<<16);T(a,e,f)};
+W[242]=function(a){K(a);D(a);var b=P(a),c=a.s[2*(a.f>>3&7)],d=a.s[2*(a.f>>3&7)+1];b=b[0]>>>0;var e=0,f=0;31>=b&&(e=c<<b,f=d<<b);T(a,e,f)};W[243]=function(a){K(a);D(a);var b=P(a),c=a.s[2*(a.f>>3&7)],d=a.s[2*(a.f>>3&7)+1];b=b[0]>>>0;if(0!==b){var e=0,f=0;31>=b?(e=c<<b,f=d<<b|c>>>32-b):63>=b&&(f=c<<(b&31),e=0);T(a,e,f)}};W[244]=function(a){t(a)};
+W[245]=function(a){K(a);D(a);var b=P(a),c=a.s[2*(a.f>>3&7)],d=a.s[2*(a.f>>3&7)+1];T(a,(c<<16>>16)*(b[0]<<16>>16)+(c>>16)*(b[0]>>16)|0,(d<<16>>16)*(b[1]<<16>>16)+(d>>16)*(b[1]>>16)|0)};W[246]=function(a){t(a)};W[247]=function(a){t(a)};W[248]=function(a){K(a);D(a);var b=P(a);b=new Int8Array(b.buffer);var c=8*(a.f>>3&7),d=a.Gd;T(a,d[c]-b[0]&255|(d[c+1]-b[1]&255)<<8|(d[c+2]-b[2]&255)<<16|(d[c+3]-b[3]&255)<<24,d[c+4]-b[4]&255|(d[c+5]-b[5]&255)<<8|(d[c+6]-b[6]&255)<<16|(d[c+7]-b[7]&255)<<24)};
+W[249]=function(a){K(a);D(a);var b=P(a),c=a.s[2*(a.f>>3&7)],d=a.s[2*(a.f>>3&7)+1];T(a,c-b[0]&65535|((c>>>16)-(b[0]>>>16)&65535)<<16,d-b[1]&65535|((d>>>16)-(b[1]>>>16)&65535)<<16)};W[250]=function(a){K(a);D(a);var b=P(a);T(a,a.s[2*(a.f>>3&7)]-b[0],a.s[2*(a.f>>3&7)+1]-b[1])};W[251]=function(a){t(a)};
+W[252]=function(a){K(a);D(a);var b=P(a);b=new Int8Array(b.buffer);var c=8*(a.f>>3&7),d=a.Gd;T(a,d[c]+b[0]&255|(d[c+1]+b[1]&255)<<8|(d[c+2]+b[2]&255)<<16|(d[c+3]+b[3]&255)<<24,d[c+4]+b[4]&255|(d[c+5]+b[5]&255)<<8|(d[c+6]+b[6]&255)<<16|(d[c+7]+b[7]&255)<<24)};W[253]=function(a){K(a);D(a);var b=P(a),c=a.s[2*(a.f>>3&7)],d=a.s[2*(a.f>>3&7)+1];T(a,c+b[0]&65535|((c>>>16)+(b[0]>>>16)&65535)<<16,d+b[1]&65535|((d>>>16)+(b[1]>>>16)&65535)<<16)};
+W[254]=function(a){K(a);D(a);var b=P(a);T(a,a.s[2*(a.f>>3&7)]+b[0]|0,a.s[2*(a.f>>3&7)+1]+b[1]|0)};W[255]=function(a){t(a)};var xh=[],yh=[];q.prototype.qk=xh;q.prototype.rk=yh;for(wh=0;256>wh;wh++)W[wh]?xh[wh]=yh[wh]=W[wh]:X[wh]&&(xh[wh]=X[wh],yh[wh]=Z[wh]);
+function Xd(a){var b={};a.debug=b;b.Zk=!1;b.Tk=void 0;b.Bk=[];b.$k=!1;b.show=function(a){if("undefined"!==typeof document){var b=document.getElementById("log");if(b){b.textContent+=a+"\n";b.style.display="block";b.scrollTop=1E9;return}}console.log(a)};b.Ob=function(){};b.Nk=function(){for(var b={eax:0,ecx:1,edx:2,ebx:3,esp:4,ebp:5,esi:6,edi:7},d="eax ecx edx ebx esp ebp esi edi".split(" "),e="",f="",h=0;4>h;h++)e+=d[h]+"="+jb(a.Fd[b[d[h]]],8)+" ",f+=d[h+4]+"="+jb(a.Fd[b[d[h+4]]],8)+" ";e+=" ds="+
+jb(a.M[3],4)+" es="+jb(a.M[0],4)+" fs="+jb(a.M[4],4);f+=" gs="+jb(a.M[5],4)+" cs="+jb(a.M[1],4)+" ss="+jb(a.M[2],4);return[e,f]};b.Hk=function(){};b.Fk=function(){};b.Lk=function(){};b.Sa=function(){var b=a.flags&131072?1:0;b=a.ta?b?"vm86":"prot":"real";var d=ze(a),e=xe(a),f=a.N,h=jb(a.M[1],4)+":"+jb(Fe(a)>>>0,8),g=jb(a.M[2],4)+":"+jb(Ce(a)>>>0,8),p=a.C?"32":"16",r=a.flags&512?1:0,v={};v=(v[1]="c",v[4]="p",v[16]="a",v[64]="z",v[128]="s",v[256]="t",v[512]="i",v[1024]="d",v[2048]="o",v);for(var E=
+"",z=0;16>z;z++)v[1<<z]&&(d&1<<z?E+=v[1<<z]:E+=" ");return"mode="+b+"/"+p+" paging="+ +a.V+" iopl="+e+" cpl="+f+" if="+r+" cs:eip="+h+" cs_off="+jb(C(a,1)>>>0,8)+" flgs="+jb(ze(a)>>>0,6)+" ("+E+") ss:esp="+g+" ssize="+ +a.qb};b.Jk=function(){};b.Ik=function(){};b.Gk=function(){};b.Dk=function(){};b.Ek=function(){};b.Mk=function(){};b.Rk=function(){};b.al=function(){};b.step=function(){};b.Wk=function(){};b.P=function(a){a="Unimplemented"+(a?": "+a:"");b.show(a);b.show("Execution stopped");return a};
+b.Pk=function(){};b.Ck=function(){}}var zh=DataView.prototype,Ah={size:1,get:zh.getUint8,set:zh.setUint8},Eh={size:2,get:zh.getUint16,set:zh.setUint16},Fh={size:4,get:zh.getUint32,set:zh.setUint32},Hh=Gh([{zi:Fh},{Rh:Ah},{data:Ah},{uk:Ah},{Uk:Ah},{yk:Ah},{Vk:function(a){return{size:a,get:function(){return-1}}}(7)},{type:Eh},{Qk:Eh},{vk:Fh},{ii:Fh},{Fi:Fh},{mk:Fh},{flags:Fh},{di:Eh},{hh:Eh},{ih:Eh},{Gh:Eh},{Hh:Eh},{Yk:Eh}]);console.assert(52===Hh.reduce(function(a,b){return a+b.size},0));
+var Ih=Gh([{type:Fh},{offset:Fh},{bl:Fh},{Di:Fh},{ki:Fh},{Sk:Fh},{flags:Fh},{align:Fh}]);console.assert(32===Ih.reduce(function(a,b){return a+b.size},0));var Jh=Gh([{name:Fh},{type:Fh},{flags:Fh},{zk:Fh},{offset:Fh},{size:Fh},{link:Fh},{info:Fh},{Ak:Fh},{Kk:Fh}]);console.assert(40===Jh.reduce(function(a,b){return a+b.size},0));
+function Gh(a){return a.map(function(a){var b=Object.keys(a);console.assert(1===b.length);b=b[0];a=a[b];console.assert(0<a.size);return{name:b,type:a,size:a.size,get:a.get,set:a.set}})}
+function de(a){var b=new DataView(a),c=ia(Kh(b,Hh));a=c.next().value;c=c.next().value;console.assert(52===c);console.assert(1179403647===a.zi,"Bad magic");console.assert(1===a.Rh,"Unimplemented: 64 bit elf");console.assert(1===a.data,"Unimplemented: big endian");console.assert(1===a.uk,"Bad version0");console.assert(2===a.type,"Unimplemented type");console.assert(1===a.vk,"Bad version1");console.assert(52===a.di,"Bad header size");console.assert(32===a.hh,"Bad program header size");console.assert(40===
+a.Gh,"Bad section header size");var d=ia(Lh(new DataView(b.buffer,b.byteOffset+a.Fi,a.hh*a.ih),Ih,a.ih));c=d.next().value;d.next();b=ia(Lh(new DataView(b.buffer,b.byteOffset+a.mk,a.Gh*a.Hh),Jh,a.Hh));d=b.next().value;b.next();return{jg:a,ek:c,Xk:d}}function Kh(a,b){var c={},d=0;b=ia(b);for(var e=b.next();!e.done;e=b.next()){e=e.value;var f=e.get.call(a,d,!0);console.assert(void 0===c[e.name]);c[e.name]=f;d+=e.size}return[c,d]}
+function Lh(a,b,c){for(var d=[],e=0,f=0;f<c;f++){var h=ia(Kh(new DataView(a.buffer,a.byteOffset+e,void 0),b)),g=h.next().value;h=h.next().value;d.push(g);e+=h}return[d,e]}var Aa=16384,Ca=4;function Mh(a){this.a=[];this.i=[];this.v=a;this.l=this.J=0;this.m=function(){};this.g={};this.C=0;za(this,"",-1)}function ua(a,b,c){0==sa(a,b).status?c():a.i.push({id:b,Lh:c})}function Nh(a,b){0==a.l&&(a.m=function(){});for(var c=[],d=0;d<a.i.length;d++)a.i[d].id==b?a.i[d].Lh():c.push(a.i[d]);a.i=c}
+function Oh(a,b){b=JSON.parse(b);if(2!==b.version)throw"The filesystem JSON format has changed. Please update your fs2json (https://github.com/copy/fs2json) and recreate the filesystem JSON.";var c=b.fsroot;a.C=b.size;setTimeout(function(){for(var b=0;b<c.length;b++)Ph(a,c[b],0);a.m=function(){}},0)}
+function Ph(a,b,c){var d=va(a);d.name=b[0];d.size=b[1];d.ne=b[2];d.dg=d.ne;d.mf=d.ne;d.mode=b[3];d.uid=b[4];d.pb=b[5];d.va=c;a.a[d.va].Pb++;c=d.mode&61440;if(c===Aa)for(b=b[6],d.dd=!0,d.Pb=2,c=a.a.length,wa(a,d),d=0;d<b.length;d++)Ph(a,b[d],c);else 32768===c?(d.status=2,wa(a,d)):40960===c&&(d.ff=b[6],wa(a,d))}
+function Qh(a,b){var c=a.a[b];2==c.status&&(c.status=3,a.l++,a.v&&Rh(a.v+Sh(a,c.Pg),function(a){a=this.g[b]=new Uint8Array(a);c.size=a.length;c.status=0;this.l--;Nh(this,b)}.bind(a),function(a){throw a;}))}function wa(a,b){if(-1!=b.va){a.a.push(b);b.Pg=a.a.length-1;var c=a.a[b.va];c.dd=!0;b.vb=c.ub;c.ub=a.a.length-1}else 0==a.a.length&&a.a.push(b)}
+function Th(a){this.dd=!1;this.vb=this.ub=this.va=-1;this.status=0;this.name="";this.ah=this.$g=this.ne=this.mf=this.dg=this.Pg=this.pb=this.uid=this.size=0;this.ff="";this.Pb=1;this.mode=493;this.lb={type:0,version:0,path:a};this.Pa=void 0}function va(a){return new Th(++a.J)}function za(a,b,c){var d=va(a);d.name=b;d.va=c;d.mode=511|Aa;d.dd=!0;d.Pb=2;0<=c&&(d.uid=a.a[c].uid,d.pb=a.a[c].pb,d.mode=a.a[c].mode&511|Aa,a.a[c].Pb++);d.lb.type=Aa>>8;wa(a,d);return a.a.length-1}
+function Ba(a,b,c){var d=va(a);d.name=b;d.va=c;d.uid=a.a[c].uid;d.pb=a.a[c].pb;a.a[c].Pb++;d.lb.type=128;d.mode=a.a[c].mode&438|32768;wa(a,d);return a.a.length-1}function ya(a,b,c,d,e){var f=va(a);f.name=b;f.va=c;f.$g=d;f.ah=e;f.uid=a.a[c].uid;f.pb=a.a[c].pb;a.a[c].Pb++;f.lb.type=192;f.mode=a.a[c].mode&438;wa(a,f);return a.a.length-1}function xa(a,b,c,d){var e=va(a);e.name=b;e.va=c;e.uid=a.a[c].uid;e.pb=a.a[c].pb;a.a[c].Pb++;e.lb.type=160;e.ff=d;e.mode=40960;wa(a,e);return a.a.length-1}
+function Uh(a,b,c,d){b=Ba(a,b,c);c=a.a[b];(a.g[b]=new Uint8Array(d.length)).set(d);c.size=d.length}
+function ta(a,b){var c=sa(a,b);if((c.mode&61440)==Aa){var d=sa(a,b);if(d.dd){var e=d.va;-1==e&&(e=0);for(var f=0,h=a.a[b].ub;-1!=h;)f+=24+Vh(a.a[h].name),h=a.a[h].vb;f=f+25+26;var g=a.g[b]=new Uint8Array(f);d.size=f;f=0;f+=oa(["Q","d","b","s"],[a.a[b].lb,f+25,a.a[b].mode>>12,"."],g,f);f+=oa(["Q","d","b","s"],[a.a[e].lb,f+13+8+1+2+2,a.a[e].mode>>12,".."],g,f);for(h=a.a[b].ub;-1!=h;)f+=oa(["Q","d","b","s"],[a.a[h].lb,f+13+8+1+2+Vh(a.a[h].name),a.a[h].mode>>12,a.a[h].name],g,f),h=a.a[h].vb;d.dd=!1}}return 2==
+c.status?(Qh(a,b),!1):!0}function Ia(a,b){var c=sa(a,b);c.status==Ca&&(c.status=-1,delete a.g[b],c.size=0)}function Fa(a,b,c,d,e){if(b==d&&c==e)return!0;c=Ga(a,b,c);if(-1==c)return!1;var f=Ga(a,d,e);-1!=f&&Ha(a,f);f=a.a[c];if(a.a[f.va].ub==c)a.a[f.va].ub=f.vb;else{var h=Wh(a,c);a.a[h].vb=f.vb}f.va=d;f.name=e;f.lb.version++;f.vb=a.a[f.va].ub;a.a[f.va].ub=c;a.a[b].dd=!0;a.a[d].dd=!0;a.a[b].Pb--;a.a[d].Pb++;return!0}
+function Ea(a,b,c,d,e){var f=a.a[b],h=a.g[b];!h||h.length<c+d?(Da(a,b,Math.floor(3*(c+d)/2)),f.size=c+d,h=a.g[b]):f.size<c+d&&(f.size=c+d);for(a=0;a<d;a++)h[c+a]=e()}function Ga(a,b,c){for(b=a.a[b].ub;-1!=b;){if(a.a[b].name==c)return b;b=a.a[b].vb}return-1}function Sh(a,b){for(var c="";0!=b;)c="/"+a.a[b].name+c,b=a.a[b].va;return c.substring(1)}function Wh(a,b){var c=sa(a,b);for(c=a.a[c.va].ub;-1!=c&&a.a[c].vb!=b;)c=a.a[c].vb;return c}
+function Ha(a,b){if(0==b)return!1;var c=sa(a,b);if((c.mode&61440)==Aa&&-1!=c.ub)return!1;a.a[c.va].ub==b?a.a[c.va].ub=c.vb:(b=Wh(a,b),a.a[b].vb=c.vb);a.a[c.va].dd=!0;a.a[c.va].Pb--;c.status=Ca;c.vb=-1;c.ub=-1;c.va=-1;c.Pb--;return!0}function sa(a,b){return isNaN(b)||0>b||b>a.a.length?0:a.a[b]}function Da(a,b,c){var d=sa(a,b),e=a.g[b];if(c!=d.size&&(a=a.g[b]=new Uint8Array(c),d.size=c,e))for(c=Math.min(e.length,d.size),d=0;d<c;d++)a[d]=e[d]}
+function Xh(a,b){b=b.replace("//","/");b=b.split("/");var c=b.length;0==b[c-1].length&&b.pop();0==b[0].length&&b.shift();c=b.length;for(var d=0,e=-1,f=0;f<c;f++){e=Ga(a,d,b[f]);if(-1==e)return f<c-1?{id:-1,va:-1,name:b[f]}:{id:-1,va:d,name:b[f]};d=e}return{id:e,va:d,name:b[f]}}
+function Ja(a,b){a=sa(a,b);if(a.Pa)return a.Pa.length;a.Pa=new Uint8Array(12);a.Pa[0]=0;a.Pa[1]=0;a.Pa[2]=0;a.Pa[3]=1;a.Pa[4]=255;a.Pa[5]=255;a.Pa[6]=255;a.Pa[7]=255;a.Pa[8]=255;a.Pa[9]=255;a.Pa[10]=255;a.Pa[11]=255;return a.Pa.length}var Rh;
+Rh="undefined"!==typeof XMLHttpRequest?function(a,b,c){var d=new XMLHttpRequest;d.open("GET",a,!0);d.responseType="arraybuffer";d.onreadystatechange=function(){if(4==d.readyState)if(200!=d.status&&0!=d.status)c("Error: Could not load file "+a);else{var e=d.response;e?b(e):c("Error: No data received from: "+a)}};d.send(null)}:function(a,b,c){require("fs").readFile(a,function(a,e){a?c(a):b((new Uint8Array(e)).buffer)})};
+function oa(a,b,c,d){for(var e,f=0,h=0;h<a.length;h++)switch(e=b[h],a[h]){case "w":c[d++]=e&255;c[d++]=e>>8&255;c[d++]=e>>16&255;c[d++]=e>>24&255;f+=4;break;case "d":c[d++]=e&255;c[d++]=e>>8&255;c[d++]=e>>16&255;c[d++]=e>>24&255;c[d++]=0;c[d++]=0;c[d++]=0;c[d++]=0;f+=8;break;case "h":c[d++]=e&255;c[d++]=e>>8;f+=2;break;case "b":c[d++]=e;f+=1;break;case "s":var g=d,p=0;c[d++]=0;c[d++]=0;f+=2;for(var r in e)Yh(e.charCodeAt(r)).forEach(function(a){c[d++]=a;f+=1;p++});c[g+0]=p&255;c[g+1]=p>>8&255;break;
+case "Q":oa(["b","w","d"],[e.type,e.version,e.path],c,d),d+=13,f+=13}return f}function ra(a,b){for(var c=[],d=0;d<a.length;d++)switch(a[d]){case "w":var e=b();e+=b()<<8;e+=b()<<16;e+=b()<<24>>>0;c.push(e);break;case "d":e=b();e+=b()<<8;e+=b()<<16;e+=b()<<24>>>0;b();b();b();b();c.push(e);break;case "h":e=b();c.push(e+(b()<<8));break;case "b":c.push(b());break;case "s":e=b();e+=b()<<8;for(var f="",h=new Zh,g=0;g<e;g++){var p=h.i(b());-1!=p&&(f+=String.fromCharCode(p))}c.push(f)}return c}
+function Zh(){this.a=new Uint8Array(5);this.g=0;this.i=function(a){this.a[this.g]=a;this.g++;switch(this.g){case 1:if(128>this.a[0])return this.g=0,this.a[0];break;case 2:if(192==(this.a[0]&224)&&128==(this.a[1]&192))return this.g=0,(this.a[0]&31)<<6|this.a[1]&63}return-1}}function Yh(a){if(128>a)return[a];if(2048>a)return[192|a>>6&31,128|a&63]}function Vh(a){for(var b=0,c=0;c<a.length;c++)b+=128>a.charCodeAt(c)?1:2;return b}
+function $h(a){function b(a){!a.altKey&&g[56]&&f(56,!1);return e(a,!1)}function c(a){!a.altKey&&g[56]&&f(56,!1);return e(a,!0)}function d(){for(var a=Object.keys(g),b,c=0;c<a.length;c++)b=+a[c],g[b]&&f(b,!1);g={}}function e(a,b){if(p.w&&(a.shiftKey&&a.ctrlKey&&(74===a.keyCode||75===a.keyCode)||!p.g?0:a.target?"phone_keyboard"===a.target.className||"INPUT"!==a.target.nodeName&&"TEXTAREA"!==a.target.nodeName:1)){a:{if(void 0!==a.code){var c=z[a.code];if(void 0!==c)break a}c=r[a.keyCode]}if(c)return f(c,
+b),a.preventDefault&&a.preventDefault(),!1;console.log("Missing char in map: "+a.keyCode.toString(16))}}function f(a,b){if(b)g[a]&&f(a,!1);else if(!g[a])return;(g[a]=b)||(a|=128);255<a?(h(a>>8),h(a&255)):h(a)}function h(a){p.w.send("keyboard-code",a)}var g={},p=this;this.g=!0;var r=new Uint16Array([0,0,0,0,0,0,0,0,14,15,0,0,0,28,0,0,42,29,56,0,58,0,0,0,0,0,0,1,0,0,0,0,57,57417,57425,57423,57415,57419,57416,57421,80,0,0,0,0,82,83,0,11,2,3,4,5,6,7,8,9,10,0,39,0,13,0,0,0,30,48,46,32,18,33,34,35,23,36,
+37,38,50,49,24,25,16,19,31,20,22,47,17,45,21,44,57435,57436,57437,0,0,82,79,80,81,75,76,77,71,72,73,0,0,0,0,0,0,59,60,61,62,63,64,65,66,67,68,87,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,69,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,39,13,51,12,52,53,41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,43,27,40,0,57435,57400,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),v={10:13,32:32,39:222,44:188,45:189,46:190,47:191,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,
+56:56,57:57,59:186,61:187,91:219,92:220,93:221,96:192,97:65,98:66,99:67,100:68,101:69,102:70,103:71,104:72,105:73,106:74,107:75,108:76,109:77,110:78,111:79,112:80,113:81,114:82,115:83,116:84,117:85,118:86,119:87,120:88,121:89,122:90},E={33:49,34:222,35:51,36:52,37:53,38:55,40:57,41:48,42:56,43:187,58:186,60:188,62:190,63:191,64:50,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,94:54,95:189,
+123:219,124:220,125:221,126:192},z={Escape:1,Digit1:2,Digit2:3,Digit3:4,Digit4:5,Digit5:6,Digit6:7,Digit7:8,Digit8:9,Digit9:10,Digit0:11,Minus:12,Equal:13,Backspace:14,Tab:15,KeyQ:16,KeyW:17,KeyE:18,KeyR:19,KeyT:20,KeyY:21,KeyU:22,KeyI:23,KeyO:24,KeyP:25,BracketLeft:26,BracketRight:27,Enter:28,ControlLeft:29,KeyA:30,KeyS:31,KeyD:32,KeyF:33,KeyG:34,KeyH:35,KeyJ:36,KeyK:37,KeyL:38,Semicolon:39,Quote:40,Backquote:41,ShiftLeft:42,Backslash:43,KeyZ:44,KeyX:45,KeyC:46,KeyV:47,KeyB:48,KeyN:49,KeyM:50,Comma:51,
+Period:52,Slash:53,ShiftRight:54,NumpadMultiply:55,AltLeft:56,Space:57,CapsLock:58,F1:59,F2:60,F3:61,F4:62,F5:63,F6:64,F7:65,F8:66,F9:67,F10:68,NumLock:69,ScrollLock:70,Numpad7:71,Numpad8:72,Numpad9:73,NumpadSubtract:74,Numpad4:75,Numpad5:76,Numpad6:77,NumpadAdd:78,Numpad1:79,Numpad2:80,Numpad3:81,Numpad0:82,NumpadDecimal:83,IntlBackslash:86,F11:87,F12:88,NumpadEnter:57372,ControlRight:57373,NumpadDivide:57397,AltRight:57400,Home:57423,ArrowUp:57416,PageUp:57417,ArrowLeft:57419,ArrowRight:57421,End:57423,
+ArrowDown:57424,PageDown:57425,Insert:57426,Delete:57427,OSLeft:57435,OSRight:57436,ContextMenu:57437};this.w=a;this.Mb=function(){"undefined"!==typeof window&&(window.removeEventListener("keyup",b,!1),window.removeEventListener("keydown",c,!1),window.removeEventListener("blur",d,!1))};this.Ob=function(){"undefined"!==typeof window&&(this.Mb(),window.addEventListener("keyup",b,!1),window.addEventListener("keydown",c,!1),window.addEventListener("blur",d,!1))};this.Ob();this.a=function(a){a={keyCode:a};
+e(a,!0);e(a,!1)};this.i=function(a){var b=a.charCodeAt(0);b in v?this.a(v[b]):b in E?(h(42),this.a(E[b]),h(170)):console.log("ascii -> keyCode not found: ",b,a)}}
+function ai(a,b){function c(a){if(ka.enabled&&ka.a)if("mousemove"===a.type||"touchmove"===a.type)a=!0;else if("mousewheel"===a.type||"DOMMouseScroll"===a.type)a:{for(a=a.target;a.parentNode;){if(a===(b||document.body)){a=!0;break a}a=a.parentNode}a=!1}else a=!a.target||"INPUT"!==a.target.nodeName&&"TEXTAREA"!==a.target.nodeName;else a=!1;return a}function d(a){c(a)&&(a=a.changedTouches)&&a.length&&(a=a[a.length-1],A=a.clientX,M=a.clientY)}function e(){if(v||z||E)ka.w.send("mouse-click",[!1,!1,!1]),
+v=z=E=!1}function f(a){if(ka.w&&c(a)){var d=0,e=0,f=a.changedTouches;f?f.length&&(f=f[f.length-1],d=f.clientX-A,e=f.clientY-M,A=f.clientX,M=f.clientY,a.preventDefault()):"number"===typeof a.movementX?(d=a.movementX,e=a.movementY):"number"===typeof a.webkitMovementX?(d=a.webkitMovementX,e=a.webkitMovementY):"number"===typeof a.mozMovementX?(d=a.mozMovementX,e=a.mozMovementY):(d=a.clientX-A,e=a.clientY-M,A=a.clientX,M=a.clientY);ka.w.send("mouse-delta",[.15*d,-(.15*e)]);ka.w.send("mouse-absolute",[a.pageX-
+b.offsetLeft,a.pageY-b.offsetTop,b.offsetWidth,b.offsetHeight])}}function h(a){c(a)&&p(a,!0)}function g(a){c(a)&&p(a,!1)}function p(a,b){ka.w&&(1===a.which?v=b:2===a.which?z=b:3===a.which?E=b:console.log("Unknown event.which: "+a.which),ka.w.send("mouse-click",[v,z,E]))}function r(a){if(c(a)){var b=a.wheelDelta||-a.detail;0>b?b=-1:0<b&&(b=1);ka.w.send("mouse-wheel",[b,0]);a.preventDefault()}}var v=!1,E=!1,z=!1,A=0,M=0,ka=this;this.enabled=!1;this.a=!0;this.w=a;this.w.register("mouse-enable",function(a){this.enabled=
+a},this);this.Mb=function(){window.removeEventListener("touchstart",d,!1);window.removeEventListener("touchend",e,!1);window.removeEventListener("touchmove",f,!1);window.removeEventListener("mousemove",f,!1);window.removeEventListener("mousedown",h,!1);window.removeEventListener("mouseup",g,!1);window.removeEventListener("DOMMouseScroll",r,!1);window.removeEventListener("mousewheel",r,!1)};this.Ob=function(){"undefined"!==typeof window&&(this.Mb(),window.addEventListener("touchstart",d,!1),window.addEventListener("touchend",
+e,!1),window.addEventListener("touchmove",f,!1),window.addEventListener("mousemove",f,!1),window.addEventListener("mousedown",h,!1),window.addEventListener("mouseup",g,!1),window.addEventListener("DOMMouseScroll",r,!1),window.addEventListener("mousewheel",r,!1))};this.Ob()}
+function bi(a){"undefined"!==typeof window&&(window.AudioContext||window.webkitAudioContext?(this.w=a,this.Kb=new (window.AudioContext||window.webkitAudioContext),this.a=this.Kb.createGain(),this.a.gain.setValueAtTime(0,this.Kb.currentTime),this.a.connect(this.Kb.destination),this.Zd=this.Kb.createOscillator(),this.Zd.type="square",this.Zd.frequency.setValueAtTime(440,this.Kb.currentTime),this.Zd.connect(this.a),this.Zd.start(),this.zg=this.g=!1,this.Yd=440,this.jh=!1,this.cg=!0,this.de=this.Kb.createScriptProcessor(2048,
+0,2),this.de.onaudioprocess=this.i.bind(this),this.de.connect(this.Kb.destination),this.Gg=new Float32Array(this.de.bufferSize),this.Hg=new Float32Array(this.de.bufferSize),this.Ie=!0,a.register("emulator-stopped",function(){this.cg=!1;ci(this)},this),a.register("emulator-started",function(){this.cg=!0;ci(this)},this),a.register("pcspeaker-enable",function(a){this.zg=a;ci(this)},this),a.register("pcspeaker-update",function(a){var b=a[1];this.jh=3==a[0];this.Yd=1193181.6665999999/b;this.Yd=Math.min(this.Yd,
+this.Zd.frequency.maxValue);this.Yd=Math.max(this.Yd,0);ci(this)},this),a.register("speaker-update-data",function(a){this.Gg=a[0];this.Hg=a[1]},this),a.register("speaker-request-samplerate",function(){a.send("speaker-tell-samplerate",this.Kb.sampleRate)},this),a.send("speaker-tell-samplerate",this.Kb.sampleRate),a.register("speaker-update-enable",function(a){this.Ie&&!a?(this.de.disconnect(this.Kb.destination),this.Ie=!1):!this.Ie&&a&&(this.de.connect(this.Kb.destination),this.Ie=!0)},this)):console.warn("Web browser doesn't support Web Audio API"))}
+function ci(a){var b=a.Kb.currentTime;a.jh&&a.zg&&a.cg?(a.Zd.frequency.setValueAtTime(a.Yd,b),a.g||(a.a.gain.setValueAtTime(.05,b),a.g=!0)):a.g&&(a.a.gain.setValueAtTime(0,b),a.g=!1)}bi.prototype.i=function(a){this.Ie&&(a=a.outputBuffer,a.copyToChannel(this.Gg,0),a.copyToChannel(this.Hg,1),this.w.send("speaker-request-data",a.length))};
+function di(a,b){function c(a){h.w&&h.enabled&&(h.i(a.which),a.preventDefault())}function d(a){var b=a.which;8===b?(h.i(127),a.preventDefault()):9===b&&(h.i(9),a.preventDefault())}function e(a){if(h.enabled){for(var b=a.clipboardData.getData("text/plain"),c=0;c<b.length;c++)h.i(b.charCodeAt(c));a.preventDefault()}}function f(b){b.target!==a&&a.blur()}var h=this;this.enabled=!0;this.w=b;this.a="";this.m=!1;this.l=0;this.w.register("serial0-output-char",function(a){this.nk(a)},this);this.Mb=function(){a.removeEventListener("keypress",
+c,!1);a.removeEventListener("keydown",d,!1);a.removeEventListener("paste",e,!1);window.removeEventListener("mousedown",f,!1)};this.Ob=function(){this.Mb();a.addEventListener("keypress",c,!1);a.addEventListener("keydown",d,!1);a.addEventListener("paste",e,!1);window.addEventListener("mousedown",f,!1)};this.Ob();this.nk=function(a){"\b"===a?(this.a=this.a.slice(0,-1),this.v()):"\r"!==a&&(this.a+=a,"\n"===a&&(this.m=!0),this.v())};this.v=function(){var a=this,b=Date.now(),c=b-this.l;16>c?void 0===this.g&&
+(this.g=setTimeout(function(){a.g=void 0;a.l=Date.now();a.C()},16-c)):(void 0!==this.g&&(clearTimeout(this.g),this.g=void 0),this.l=b,this.C())};this.C=function(){a.value=this.a;this.m&&(this.m=!1,a.scrollTop=1E9)};this.i=function(a){h.w&&h.w.send("serial0-input",a)}}function ei(a,b){this.w=b;this.a=void 0;this.g=[];this.url=a;this.i=Date.now()-1E4;this.w.register("net0-send",function(a){this.send(a)},this)}k=ei.prototype;k.pi=function(a){this.w&&this.w.send("net0-receive",new Uint8Array(a.data))};
+k.Vg=function(){this.connect();setTimeout(this.connect.bind(this),1E4)};k.ri=function(){for(var a=0;a<this.g.length;a++)this.send(this.g[a]);this.g=[]};k.oi=function(){};k.Mb=function(){this.a&&this.a.close()};
+k.connect=function(){if(this.a){var a=this.a.readyState;if(0===a||1===a)return}if(!(this.i+1E4>Date.now())){this.i=Date.now();try{this.a=new WebSocket(this.url)}catch(b){this.Vg(void 0);return}this.a.binaryType="arraybuffer";this.a.onopen=this.ri.bind(this);this.a.onmessage=this.pi.bind(this);this.a.onclose=this.Vg.bind(this);this.a.onerror=this.oi.bind(this)}};k.send=function(a){this.a&&1===this.a.readyState?this.a.send(a):(this.g.push(a),128<this.g.length&&(this.g=this.g.slice(-64)),this.connect())};
+(function(){function a(a,b){var c=new XMLHttpRequest;c.open(b.method||"get",a,!0);b.De||(c.responseType="arraybuffer");if(b.headers)for(var d=Object.keys(b.headers),e=0;e<d.length;e++){var f=d[e];c.setRequestHeader(f,b.headers[f])}b.re&&(d=b.re.start,c.setRequestHeader("Range","bytes="+d+"-"+(d+b.re.length-1)));c.onload=function(){4===c.readyState&&(200!==c.status&&206!==c.status?console.error("Loading the image `"+a+"` failed (status %d)",c.status):c.response&&b.done&&b.done(c.response,c))};b.sh&&
+(c.onprogress=function(a){b.sh(a)});c.send(null)}function b(a,b){var c=require("fs");b.re?c.open(a,"r",function(a,d){if(a)throw a;a=b.re.length;var e=new global.Buffer(a);c.read(d,e,0,a,b.re.start,function(a){if(a)throw a;b.done&&b.done(new Uint8Array(e));c.close(d,function(a){if(a)throw a;})})}):c.readFile(a,{encoding:b.De?"utf-8":null},function(c,d){c?console.log("Could not read file:",a,c):(c=d,b.De||(c=(new Uint8Array(c)).buffer),b.done(c))})}function c(a,b){this.filename=a;this.a=256;this.byteLength=
+b;this.g={};this.onload=void 0}function d(a){this.a=a;this.byteLength=a.size;1073741824<a.size&&console.warn("SyncFileBuffer: Allocating buffer of "+(a.size>>20)+" MB ...");this.buffer=new ArrayBuffer(a.size);this.onload=void 0}function e(a){this.i=a;this.byteLength=a.size;this.a=256;this.g={};this.onload=void 0}"undefined"===typeof XMLHttpRequest?gb=b:gb=a;hb=c;ib=e;Ma=d;var f="undefined"===typeof XMLHttpRequest?function(a,b){require("fs").stat(a,function(a,c){a?b(a):b(null,c.size)})}:function(a,
+b){gb(a,{done:function(a,c){a=c.getResponseHeader("Content-Range")||"";(c=a.match(/\/(\d+)\s*$/))?b(null,+c[1]):b({jg:a})},headers:{Range:"bytes=0-0"}})};c.prototype.load=function(){var a=this;void 0!==this.byteLength?this.onload&&this.onload({}):f(this.filename,function(b,c){b?console.assert(!1,"Cannot use: "+a.filename+". `Range: bytes=...` header not supported (Got `"+b.jg+"`)"):(a.byteLength=c,a.onload&&a.onload({}))})};c.prototype.i=function(a,b){var c=b/this.a;a/=this.a;for(var d=0;d<c;d++)if(!this.g[a+
+d])return;if(1===c)return this.g[a];b=new Uint8Array(b);for(d=0;d<c;d++)b.set(this.g[a+d],d*this.a);return b};c.prototype.get=function(a,b,c){console.assert(a+b<=this.byteLength);console.assert(0===a%this.a);console.assert(0===b%this.a);console.assert(b);var d=this.i(a,b,c);d?c(d):gb(this.filename,{done:function(d){d=new Uint8Array(d);this.l(a,b,d);c(d)}.bind(this),re:{start:a,length:b}})};c.prototype.set=function(a,b,c){console.assert(a+b.byteLength<=this.byteLength);var d=b.length;console.assert(0===
+a%this.a);console.assert(0===d%this.a);console.assert(d);a/=this.a;d/=this.a;for(var e=0;e<d;e++){var f=this.g[a+e];void 0===f&&(f=this.g[a+e]=new Uint8Array(this.a));var g=b.subarray(e*this.a,(e+1)*this.a);f.set(g);console.assert(f.byteLength===g.length)}c()};c.prototype.l=function(a,b,c){a/=this.a;b/=this.a;for(var d=0;d<b;d++){var e=this.g[a+d];e&&c.set(e,d*this.a)}};c.prototype.Se=function(a){a()};d.prototype.load=function(){this.g(0)};d.prototype.g=function(a){var b=new FileReader;b.onload=function(b){b=
+new Uint8Array(b.target.result);(new Uint8Array(this.buffer,a)).set(b);this.g(a+4194304)}.bind(this);a<this.byteLength?b.readAsArrayBuffer(this.a.slice(a,Math.min(a+4194304,this.byteLength))):(this.a=void 0,this.onload&&this.onload({buffer:this.buffer}))};d.prototype.get=function(a,b,c){console.assert(a+b<=this.byteLength);c(new Uint8Array(this.buffer,a,b))};d.prototype.set=function(a,b,c){console.assert(a+b.byteLength<=this.byteLength);(new Uint8Array(this.buffer,a,b.byteLength)).set(b);c()};d.prototype.Se=
+function(a){a(this.buffer)};e.prototype.load=function(){this.onload&&this.onload({})};e.prototype.get=function(a,b,c){console.assert(0===a%this.a);console.assert(0===b%this.a);console.assert(b);var d=this.l(a,b,c);d?c(d):(d=new FileReader,d.onload=function(d){d=new Uint8Array(d.target.result);this.m(a,b,d);c(d)}.bind(this),d.readAsArrayBuffer(this.i.slice(a,a+b)))};e.prototype.l=c.prototype.i;e.prototype.set=c.prototype.set;e.prototype.m=c.prototype.l;e.prototype.Se=function(a){a()};e.prototype.Tg=
+function(a){for(var b=[],c=Object.keys(this.g).map(Number).sort(function(a,b){return a-b}),d=0,e=0;e<c.length;e++){var f=c[e],h=this.g[f];f*=this.a;console.assert(f>=d);f!==d&&(b.push(this.i.slice(d,f)),d=f);b.push(h);d+=h.length}d!==this.i.size&&b.push(this.i.slice(d));a=new File(b,a);console.assert(a.size===this.i.size);return a}})();
+function l(a){function b(a,b){switch(a){case "hda":g.Ma=this.kd.hda=b;break;case "hdb":g.zf=this.kd.hdb=b;break;case "cdrom":g.Qa=this.kd.cdrom=b;break;case "fda":g.Ra=this.kd.fda=b;break;case "fdb":g.Ng=this.kd.fdb=b;break;case "multiboot":g.oe=this.kd.multiboot=b;break;case "bios":g.$d=b.buffer;break;case "vga_bios":g.wk=b.buffer;break;case "initial_state":g.ke=b.buffer;break;case "fs9p_json":g.Rg=b.buffer}}function c(a,b){if(b)if(b.get&&b.set&&b.load)p.push({name:a,vd:b});else{b={buffer:b.buffer,
+async:b.async,url:b.url,size:b.size};if("bios"===a||"vga_bios"===a||"initial_state"===a||"multiboot"===a)b.async=!1;b.buffer instanceof ArrayBuffer?(b=new nb(b.buffer),p.push({name:a,vd:b})):"undefined"!==typeof File&&b.buffer instanceof File?(void 0===b.async&&(b.async=268435456<=b.buffer.size),b=b.async?new ib(b.buffer):new Ma(b.buffer),p.push({name:a,vd:b})):b.url&&(b.async?(b=new hb(b.url,b.size),p.push({name:a,vd:b})):p.push({name:a,url:b.url,size:b.size}))}}function d(){g.ke&&(g.Ia=0);this.w.send("cpu-init",
+g);setTimeout(function(){g.ke&&h.Hd(g.ke);setTimeout(function(){g.Pc&&g.Rg&&Oh(g.Pc,g.Rg);a.autostart&&this.w.send("cpu-run")}.bind(this),0)}.bind(this),0)}this.Ge=!1;var e=Vd(),f=this.w=e[0];this.l=e[1];var h=this.a=new Ya(this.l);this.w.register("emulator-stopped",function(){this.Ge=!1},this);this.w.register("emulator-started",function(){this.Ge=!0},this);var g={};this.kd={fda:void 0,fdb:void 0,hda:void 0,hdb:void 0,cdrom:void 0};g.yi=!0;g.Ia=a.memory_size||67108864;g.Ja=a.vga_memory_size||8388608;
+g.ae=a.boot_order||531;g.ji=a.fastboot||!1;g.Ra=void 0;g.Ng=void 0;a.network_relay_url&&(new ei(a.network_relay_url,f),g.hi=!0);a.disable_keyboard||(this.i=new $h(f));a.disable_mouse||(this.m=new ai(f,a.screen_container));a.screen_container?this.g=new Ka(a.screen_container,f):a.screen_dummy&&(this.g=new fi(f));a.serial_container&&new di(a.serial_container,f);a.disable_speaker||new bi(f);var p=[];e="bios vga_bios cdrom hda hdb fda fdb initial_state multiboot".split(" ");for(f=0;f<e.length;f++)c(e[f],
+a[e[f]]);if(a.filesystem&&(e=a.filesystem.basefs,f=a.filesystem.baseurl,this.Pc=new Mh(f),g.Pc=this.Pc,e)){console.assert(f,"Filesystem: baseurl must be specified");if("object"===typeof e){var r=e.size;e=e.url}p.push({name:"fs9p_json",url:e,size:r,De:!0})}var v=this,E=p.length,z=function(a){if(a===E)setTimeout(d.bind(this),0);else{var c=p[a];c.vd?(c.vd.onload=function(){b.call(this,c.name,c.vd);z(a+1)}.bind(this),c.vd.load()):gb(c.url,{done:function(d){b.call(this,c.name,new nb(d));z(a+1)}.bind(this),
+sh:function(b){200===b.target.status?v.l.send("download-progress",{vf:a,uf:E,Qg:c.url,lengthComputable:b.lengthComputable,total:b.total||c.size,loaded:b.loaded}):v.l.send("download-error",{vf:a,uf:E,Qg:c.url,request:b.target})},De:c.De})}}.bind(this);z(0)}l.prototype.cf=function(){this.w.send("cpu-run")};l.prototype.run=l.prototype.cf;l.prototype.stop=function(){this.w.send("cpu-stop")};l.prototype.stop=l.prototype.stop;l.prototype.Mb=function(){this.i.Mb()};l.prototype.destroy=l.prototype.Mb;
+l.prototype.Sf=function(){this.w.send("cpu-restart")};l.prototype.restart=l.prototype.Sf;l.prototype.$a=function(a,b){this.w.register(a,b,this)};l.prototype.add_listener=l.prototype.$a;l.prototype.ik=function(a,b){this.w.unregister(a,b)};l.prototype.remove_listener=l.prototype.ik;l.prototype.Hd=function(a){this.a.Hd(a)};l.prototype.restore_state=l.prototype.Hd;l.prototype.we=function(a){setTimeout(function(){try{a(null,this.a.we())}catch(b){a(b,null)}}.bind(this),0)};l.prototype.save_state=l.prototype.we;
+l.prototype.ni=function(){console.warn("V86Starter.prototype.get_statistics is deprecated. Use events instead.");var a={j:{Ok:this.ig()}};if(!this.a)return a;var b=this.a.j.G;b.Ma&&(a.Ma=b.Ma.Oa);b.Qa&&(a.Qa=b.Qa.Oa);b.Of&&(a.mouse={enabled:b.Of.ed});b.Pd&&(a.vga={is_graphical:b.Pd.Oa.lg});return a};l.prototype.get_statistics=l.prototype.ni;l.prototype.ig=function(){return this.a?this.a.j.Y:0};l.prototype.get_instruction_counter=l.prototype.ig;l.prototype.vi=function(){return this.Ge};
+l.prototype.is_running=l.prototype.vi;l.prototype.Cf=function(a){for(var b=0;b<a.length;b++)this.w.send("keyboard-code",a[b])};l.prototype.keyboard_send_scancodes=l.prototype.Cf;l.prototype.wi=function(a){for(var b=0;b<a.length;b++)this.i.a(a[b])};l.prototype.keyboard_send_keys=l.prototype.wi;l.prototype.Xg=function(a){for(var b=0;b<a.length;b++)this.i.i(a[b])};l.prototype.keyboard_send_text=l.prototype.Xg;l.prototype.Ch=function(){this.g&&this.g.i()};l.prototype.screen_make_screenshot=l.prototype.Ch;
+l.prototype.Dh=function(a,b){this.g&&this.g.a(a,b)};l.prototype.screen_set_scale=l.prototype.Dh;l.prototype.Bh=function(){if(this.g){var a=document.getElementById("screen_container");if(a){var b=a.requestFullScreen||a.webkitRequestFullscreen||a.mozRequestFullScreen||a.msRequestFullScreen;b&&(b.call(a),(a=document.getElementsByClassName("phone_keyboard")[0])&&a.focus());this.Df()}}};l.prototype.screen_go_fullscreen=l.prototype.Bh;
+l.prototype.Df=function(){var a=document.body,b=a.requestPointerLock||a.mozRequestPointerLock||a.webkitRequestPointerLock;b&&b.call(a)};l.prototype.lock_mouse=l.prototype.Df;l.prototype.xi=function(a){this.i&&(this.i.g=a)};l.prototype.keyboard_set_status=l.prototype.xi;l.prototype.lk=function(a){for(var b=0;b<a.length;b++)this.w.send("serial0-input",a.charCodeAt(b))};l.prototype.serial0_send=l.prototype.lk;
+l.prototype.Eg=function(a,b,c){var d=this.Pc;if(d){var e=a.split("/");e=e[e.length-1];a=Xh(d,a).va;var f=""===e||-1===a;f||Uh(d,e,a,b);c&&setTimeout(function(){f?c(new gi):c(null)},0)}};l.prototype.create_file=l.prototype.Eg;l.prototype.vh=function(a,b){var c=this.Pc;if(c){var d=Xh(c,a).id;-1===d?b(new gi,null):(ta(c,d),ua(c,d,function(){var a=c.g[d];a?b(null,a.subarray(0,c.a[d].size)):b(new gi,null)}))}};l.prototype.read_file=l.prototype.vh;function gi(){this.message="File not found"}
+gi.prototype=Error.prototype;"undefined"!==typeof window?(window.V86Starter=l,window.V86=l):"undefined"!==typeof module&&"undefined"!==typeof module.exports?(module.exports.V86Starter=l,module.exports.V86=l):"function"===typeof importScripts&&(self.V86Starter=l,self.V86=l);
+function fi(a){var b,c,d,e,f,h,g;this.w=a;a.register("screen-set-mode",function(a){this.wg(a)},this);a.register("screen-fill-buffer-end",function(a){this.yg(a[0])},this);a.register("screen-put-char",function(a){this.qg(a[0],a[1],a[2],a[3],a[4])},this);a.register("screen-text-scroll",function(a){console.log("scroll",a)},this);a.register("screen-update-cursor",function(a){this.Nd(a[0],a[1])},this);a.register("screen-update-cursor-scanline",function(a){this.Od(a[0],a[1])},this);a.register("screen-set-size-text",
+function(a){this.Jd(a[0],a[1])},this);a.register("screen-set-size-graphical",function(a){this.Id(a[0],a[1])},this);this.qg=function(a,b,c,d,e){a<g&&b<h&&(a=3*(a*h+b),f[a]=c,f[a+1]=d,f[a+2]=e)};this.Mb=function(){};this.wg=function(){};this.Dg=function(){};this.Jd=function(a,b){if(a!==h||b!==g)f=new Int32Array(a*b*3),h=a,g=b};this.Id=function(a,d){b=new Uint8Array(4*a*d);c=new Int32Array(b.buffer);this.w.send("screen-tell-buffer",[c],[c.buffer])};this.a=function(){};this.Od=function(){};this.Nd=function(a,
+b){if(a!==d||b!==e)d=a,e=b};this.yg=function(){}}; \ No newline at end of file
diff --git a/static/vgabios.bin b/static/vgabios.bin
new file mode 100644
index 0000000..b5f925e
--- /dev/null
+++ b/static/vgabios.bin
Binary files differ