From 8aab279f53477e4a43c8f014daf0ec34c65575be Mon Sep 17 00:00:00 2001 From: Jan Krems <jankrems@google.com> Date: Wed, 23 Dec 2020 21:13:28 -0800 Subject: [PATCH 01/14] Add preview page --- preview/index.html | 56 ++++++++++++++ preview/render.js | 177 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 233 insertions(+) create mode 100644 preview/index.html create mode 100644 preview/render.js diff --git a/preview/index.html b/preview/index.html new file mode 100644 index 0000000..781cb88 --- /dev/null +++ b/preview/index.html @@ -0,0 +1,56 @@ +<!DOCTYPE html> +<meta charset="utf-8" /> +<title>FinFiddle</title> +<script id="vshader" type="x-shader/x-vertex"> +attribute vec3 pos; +attribute vec4 colorIn; +uniform float pointSize; +varying vec4 color; + +void main() +{ + gl_PointSize = pointSize; + color = colorIn; + gl_Position = vec4(pos.xyz, 3.0); +} +</script> +<script id="fshader" type="x-shader/x-fragment"> +#ifdef GL_ES +precision mediump float; +#endif +varying vec4 color; + +void main() +{ + gl_FragColor = color; +} +</script> +<style> +html, body { + height: 100%; + margin: 0; + padding: 0; +} + +main { + display: flex; + height: 100%; +} + +textarea#source { + flex: 1 1 50%; +} + +canvas#preview { + flex: 1 1 50%; +} +</style> +<main> +<textarea id="source" readonly>Loading...</textarea> +<canvas id="preview"></canvas> +</main> +<pre id="output" ></pre> +<pre id="Python/coords.txt" class="coords"></pre> +<script src="http://www.skulpt.org/js/skulpt.min.js" type="text/javascript"></script> +<script src="http://www.skulpt.org/js/skulpt-stdlib.js" type="text/javascript"></script> +<script type="module" src="render.js" async></script> diff --git a/preview/render.js b/preview/render.js new file mode 100644 index 0000000..e3bedb0 --- /dev/null +++ b/preview/render.js @@ -0,0 +1,177 @@ +globalThis.DELAY_MS = 250; + +function createShader(gl, type, source) { + const shader = gl.createShader(type); + gl.shaderSource(shader, source); + gl.compileShader(shader); + const success = gl.getShaderParameter(shader, gl.COMPILE_STATUS); + if (success) { + return shader; + } + + console.log(gl.getShaderInfoLog(shader)); + gl.deleteShader(shader); +} + +function loadVertices() { + const text = document.querySelector('pre.coords').textContent; + const lines = text.split(/\n/g).filter(Boolean).map(line => JSON.parse(line)); + + const vertices = new Float32Array(lines.length * 3); + for (let i = 0; i < lines.length; ++i) { + const offset = i * 3; + vertices[offset + 0] = lines[i][1] * 0.005; + vertices[offset + 1] = lines[i][2] * 0.005; + vertices[offset + 2] = lines[i][0] * 0.005; + } + + return vertices; +} + +async function runProgram() { + /** + * Load initial data: + */ + const coordsSource = await fetch('../coords.txt').then(res => res.text()); + document.querySelector('pre.coords').textContent = coordsSource + '\n'; + const spinSource = await fetch('../xmaslights-spin.py').then(res => res.text()); + document.getElementById('source').textContent = spinSource + '\n'; + + const source = document.getElementById('source').textContent; + + const vertices = loadVertices(); + + /** @type {HTMLCanvasElement} */ + const preview = document.getElementById('preview'); + const gl = preview.getContext('webgl'); + gl.enable(gl.DEPTH_TEST); + gl.enable(gl.BLEND); + gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); + + const program = gl.createProgram(); + { + const vertexShaderSource = document.getElementById('vshader').text; + const fragmentShaderSource = document.getElementById('fshader').text; + const vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexShaderSource); + const fragmentShader = createShader(gl, gl.FRAGMENT_SHADER, fragmentShaderSource); + gl.attachShader(program, vertexShader); + gl.attachShader(program, fragmentShader); + gl.linkProgram(program); + + gl.bindAttribLocation(program, 0, 'pos'); + gl.bindAttribLocation(program, 1, 'colorIn'); + } + gl.useProgram(program); + + /** + * @param {Uint8Array} colors + */ + function renderPixels(colors) { + gl.viewport(0, 0, + gl.drawingBufferWidth, gl.drawingBufferHeight); + gl.clearColor(0.05, 0.05, 0.05, 1); + gl.clear(gl.COLOR_BUFFER_BIT); + + const colorOffset = vertices.byteLength; + + const buffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, buffer); + gl.bufferData(gl.ARRAY_BUFFER, colorOffset + colors.byteLength, gl.STATIC_DRAW); + gl.bufferSubData(gl.ARRAY_BUFFER, 0, vertices); + gl.bufferSubData(gl.ARRAY_BUFFER, colorOffset, colors); + + const verticesLoc = gl.getAttribLocation(program, 'pos'); + gl.vertexAttribPointer(verticesLoc, 3, gl.FLOAT, false, 0, 0); + gl.enableVertexAttribArray(verticesLoc); + const colorsLoc = gl.getAttribLocation(program, 'colorIn'); + gl.vertexAttribPointer(colorsLoc, 4, gl.UNSIGNED_BYTE, true, 0, colorOffset); + gl.enableVertexAttribArray(colorsLoc); + + const locPointSize = gl.getUniformLocation(program, 'pointSize'); + gl.uniform1f(locPointSize, 2.0); + gl.drawArrays(gl.POINTS, 0, vertices.length / 3); + + gl.deleteBuffer(buffer); + } + globalThis.renderPixels = renderPixels; + + Sk.builtinFiles.files['src/builtin/board.py'] = ` +D18 = 'D18' +`; + + Sk.builtinFiles.files['src/lib/neopixel.js'] = ` +var $builtinmodule = ${function () { + const mod = {__name__: new Sk.builtin.str('neopixel')}; + mod.__file__ = 'src/lib/neopixel.js'; + mod.__package__ = new Sk.builtin.str(''); + + mod.NeoPixel = Sk.misceval.buildClass(mod, ($gbl, $loc) => { + function initNeoPixel(kwargs, self, pin, pixelCount) { + self.pin = pin; + self.pixelCount = pixelCount; + // console.log({kwargs}); + // self.autoWrite = kwargs['auto_write'] ?? false; + self.pixels = new Uint8Array(Sk.ffi.remapToJs(pixelCount) * 4); + } + initNeoPixel['co_kwargs'] = true; + $loc.__init__ = new Sk.builtin.func(initNeoPixel); + + $loc.__setitem__ = new Sk.builtin.func((self, offset, value) => { + const [r, g, b] = Sk.ffi.remapToJs(value); + const scaledOffset = Sk.ffi.remapToJs(offset) * 4; + self.pixels[scaledOffset + 1] = r; + self.pixels[scaledOffset + 0] = g; + self.pixels[scaledOffset + 2] = b; + self.pixels[scaledOffset + 3] = 255; // alpha + return value; + }); + + $loc.show = new Sk.builtin.func((self) => { + return new Sk.misceval.promiseToSuspension((async () => { + return new Promise((resolve) => { + renderPixels(self.pixels); + // TODO: Maybe use animation frame..? + Sk.setTimeout(() => { + resolve(Sk.builtin.none.none$); + }, DELAY_MS); + }); + })()); + }); + }, 'NeoPixel', []); + + return mod; +}};`; + + Sk.pre = 'output'; + Sk.configure({ + output: (text) => { + console.log(text); + }, + read: (filename) => { + if (Sk.builtinFiles === undefined || Sk.builtinFiles["files"][filename] === undefined) { + // console.log('not found', filename, Sk.builtinFiles); + throw "File not found: '" + filename + "'"; + } + let fileContents = Sk.builtinFiles["files"][filename]; + + // HACK + if (filename === 'src/lib/re.js') { + fileContents = fileContents.replace('__name__:', `sub: new Sk.builtin.func(function (pattern, replacement, original) { + const patternStr = Sk.ffi.remapToJs(pattern); + const replStr = Sk.ffi.remapToJs(replacement); + const originalStr = Sk.ffi.remapToJs(original); + // TODO: Do this properly, maybe using other re.* things. + const regex = new RegExp(patternStr, 'g'); + return new Sk.builtin.str(originalStr.replace(regex, replStr)); + }),__name__:`); + } + + return fileContents; + }, + }); + + await Sk.misceval.asyncToPromise(() => { + return Sk.importMainWithBody("<stdin>", false, source, true); + }); +} +runProgram(); From a4dad30ffc3f6282a4e7e52f75ac939f5745be15 Mon Sep 17 00:00:00 2001 From: Jan Krems <jankrems@google.com> Date: Wed, 23 Dec 2020 21:19:06 -0800 Subject: [PATCH 02/14] Stop hot-linking skulpt --- preview/index.html | 4 +- preview/skulpt-stdlib.js | 1 + preview/skulpt.min.js | 1112 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 1115 insertions(+), 2 deletions(-) create mode 100644 preview/skulpt-stdlib.js create mode 100644 preview/skulpt.min.js diff --git a/preview/index.html b/preview/index.html index 781cb88..8422fb0 100644 --- a/preview/index.html +++ b/preview/index.html @@ -51,6 +51,6 @@ </main> <pre id="output" ></pre> <pre id="Python/coords.txt" class="coords"></pre> -<script src="http://www.skulpt.org/js/skulpt.min.js" type="text/javascript"></script> -<script src="http://www.skulpt.org/js/skulpt-stdlib.js" type="text/javascript"></script> +<script src="skulpt.min.js" type="text/javascript"></script> +<script src="skulpt-stdlib.js" type="text/javascript"></script> <script type="module" src="render.js" async></script> diff --git a/preview/skulpt-stdlib.js b/preview/skulpt-stdlib.js new file mode 100644 index 0000000..ba73cd5 --- /dev/null +++ b/preview/skulpt-stdlib.js @@ -0,0 +1 @@ +Sk.builtinFiles={"files":{"src/builtin/sys.js":"var $builtinmodule=function(){var b,a=Math.pow,c={},d=[],e=Sk.getSysArgv();for(b=0;b<e.length;++b)d.push(new Sk.builtin.str(e[b]));return c.argv=new Sk.builtins.list(d),c.copyright=new Sk.builtin.str(\"Copyright 2009-2010 Scott Graham.\\nAll Rights Reserved.\\n\"),Sk.__future__.python3?(c.version=\"3.7(ish) [Skulpt]\",c.version_info=new Sk.builtin.tuple([new Sk.builtin.int_(3),new Sk.builtin.int_(7)])):(c.version=\"2.7(ish) [Skulpt]\",c.version_info=new Sk.builtin.tuple([new Sk.builtin.int_(2),new Sk.builtin.int_(7)])),c.maxint=new Sk.builtin.int_(a(2,53)-1),c.maxsize=new Sk.builtin.int_(a(2,53)-1),c.modules=Sk.sysmodules,c.path=Sk.realsyspath,c.getExecutionLimit=new Sk.builtin.func(function(){return null===Sk.execLimit?Sk.builtin.none.none$:new Sk.builtin.int_(Sk.execLimit)}),c.setExecutionLimit=new Sk.builtin.func(function(a){if(null===Sk.execLimit)throw new Sk.builtin.NotImplementedError(\"Execution limiting is not enabled\");void 0!==a&&(Sk.execLimit=Sk.builtin.asnum$(a))}),c.resetTimeout=new Sk.builtin.func(function(){Sk.execStart=new Date}),c.getYieldLimit=new Sk.builtin.func(function(){return null===Sk.yieldLimit?Sk.builtin.none.none$:new Sk.builtin.int_(Sk.yieldLimit)}),c.setYieldLimit=new Sk.builtin.func(function(a){if(null===Sk.yieldLimit)throw new Sk.builtin.NotImplementedError(\"Yielding is not enabled\");void 0!==a&&(Sk.yieldLimit=Sk.builtin.asnum$(a))}),c.debug=new Sk.builtin.func(function(){return Sk.builtin.none.none$}),c.__stdout__=new Sk.builtin.file(new Sk.builtin.str(\"/dev/stdout\"),new Sk.builtin.str(\"w\")),c.__stdin__=new Sk.builtin.file(new Sk.builtin.str(\"/dev/stdin\"),new Sk.builtin.str(\"r\")),c.stdout=c.__stdout__,c.stdin=c.__stdin__,c};","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/BaseHTTPServer.py":"raise NotImplementedError(\"BaseHTTPServer is not yet implemented in Skulpt\")\n","src/lib/Bastion.py":"raise NotImplementedError(\"Bastion is not yet implemented in Skulpt\")\n","src/lib/CGIHTTPServer.py":"raise NotImplementedError(\"CGIHTTPServer is not yet implemented in Skulpt\")\n","src/lib/ConfigParser.py":"raise NotImplementedError(\"ConfigParser is not yet implemented in Skulpt\")\n","src/lib/Cookie.py":"raise NotImplementedError(\"Cookie is not yet implemented in Skulpt\")\n","src/lib/DocXMLRPCServer.py":"raise NotImplementedError(\"DocXMLRPCServer is not yet implemented in Skulpt\")\n","src/lib/HTMLParser.py":"raise NotImplementedError(\"HTMLParser is not yet implemented in Skulpt\")\n","src/lib/MimeWriter.py":"raise NotImplementedError(\"MimeWriter is not yet implemented in Skulpt\")\n","src/lib/Queue.py":"raise NotImplementedError(\"Queue is not yet implemented in Skulpt\")\n","src/lib/SimpleHTTPServer.py":"raise NotImplementedError(\"SimpleHTTPServer is not yet implemented in Skulpt\")\n","src/lib/SimpleXMLRPCServer.py":"raise NotImplementedError(\"SimpleXMLRPCServer is not yet implemented in Skulpt\")\n","src/lib/SocketServer.py":"raise NotImplementedError(\"SocketServer 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/UserDict.py":"raise NotImplementedError(\"UserDict is not yet implemented in Skulpt\")\n","src/lib/UserList.py":"raise NotImplementedError(\"UserList is not yet implemented in Skulpt\")\n","src/lib/UserString.py":"raise NotImplementedError(\"UserString is not yet implemented in Skulpt\")\n","src/lib/_LWPCookieJar.py":"raise NotImplementedError(\"_LWPCookieJar is not yet implemented in Skulpt\")\n","src/lib/_MozillaCookieJar.py":"raise NotImplementedError(\"_MozillaCookieJar is not yet implemented in Skulpt\")\n","src/lib/__future__.py":"raise NotImplementedError(\"__future__ 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/_abcoll.py":"raise NotImplementedError(\"_abcoll is not yet implemented in Skulpt\")\n","src/lib/_strptime.py":"raise NotImplementedError(\"_strptime 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/abc.py":"raise NotImplementedError(\"abc is not yet implemented in Skulpt\")\n","src/lib/aifc.py":"raise NotImplementedError(\"aifc is not yet implemented in Skulpt\")\n","src/lib/antigravity.py":"import webbrowser\n\nwebbrowser.open(\"https://xkcd.com/353/\")\n","src/lib/anydbm.py":"raise NotImplementedError(\"anydbm is not yet implemented in Skulpt\")\n","src/lib/array.js":"$builtinmodule=function(){var a={},b=[\"c\",\"b\",\"B\",\"u\",\"h\",\"H\",\"i\",\"I\",\"l\",\"L\",\"f\",\"d\"];return a.__name__=new Sk.builtin.str(\"array\"),a.array=Sk.misceval.buildClass(a,function(a,c){c.__init__=new Sk.builtin.func(function(a,c,d){if(Sk.builtin.pyCheckArgsLen(\"__init__\",arguments.length,2,3),-1==b.indexOf(Sk.ffi.remapToJs(c)))throw new Sk.builtin.ValueError(\"bad typecode (must be c, b, B, u, h, H, i, I, l, L, f or d)\");if(d&&!Sk.builtin.checkIterable(d))throw new Sk.builtin.TypeError(\"iteration over non-sequence\");if(a.$d.mp$ass_subscript(new Sk.builtin.str(\"typecode\"),c),a.$d.mp$ass_subscript(new Sk.builtin.str(\"__module__\"),new Sk.builtin.str(\"array\")),a.typecode=c,void 0===d)a.internalIterable=new Sk.builtin.list;else if(d instanceof Sk.builtin.list)a.internalIterable=d;else for(a.internalIterable=new Sk.builtin.list,iter=Sk.abstr.iter(d),item=iter.tp$iternext();void 0!==item;item=iter.tp$iternext())Sk.misceval.callsimArray(a.internalIterable.append,[a.internalIterable,item])}),c.__repr__=new Sk.builtin.func(function(a){var b=Sk.ffi.remapToJs(a.typecode),c=\"\";return Sk.ffi.remapToJs(a.internalIterable).length&&(\"c\"==Sk.ffi.remapToJs(a.typecode)?c=\", '\"+Sk.ffi.remapToJs(a.internalIterable).join(\"\")+\"'\":c=\", \"+Sk.ffi.remapToJs(Sk.misceval.callsimArray(a.internalIterable.__repr__,[a.internalIterable]))),new Sk.builtin.str(\"array('\"+b+\"'\"+c+\")\")}),c.__str__=c.__repr__,c.__getattribute__=new Sk.builtin.func(function(a,b){return a.tp$getattr(b)}),c.append=new Sk.builtin.func(function(a,b){return Sk.misceval.callsimArray(a.internalIterable.append,[a.internalIterable,b]),Sk.builtin.none.none$}),c.extend=new Sk.builtin.func(function(a,b){if(Sk.builtin.pyCheckArgsLen(\"__init__\",arguments.length,2,2),!Sk.builtin.checkIterable(b))throw new Sk.builtin.TypeError(\"iteration over non-sequence\");for(iter=Sk.abstr.iter(b),item=iter.tp$iternext();void 0!==item;item=iter.tp$iternext())Sk.misceval.callsimArray(a.internalIterable.append,[a.internalIterable,item])})},\"array\",[]),a};","src/lib/ast.py":"raise NotImplementedError(\"ast is not yet implemented in Skulpt\")\n","src/lib/asynchat.py":"raise NotImplementedError(\"asynchat is not yet implemented in Skulpt\")\n","src/lib/asyncore.py":"raise NotImplementedError(\"asyncore is not yet implemented in Skulpt\")\n","src/lib/atexit.py":"raise NotImplementedError(\"atexit is not yet implemented in Skulpt\")\n","src/lib/audiodev.py":"raise NotImplementedError(\"audiodev is not yet implemented in Skulpt\")\n","src/lib/base64.py":"raise NotImplementedError(\"base64 is not yet implemented in Skulpt\")\n","src/lib/bdb.py":"raise NotImplementedError(\"bdb is not yet implemented in Skulpt\")\n","src/lib/binhex.py":"raise NotImplementedError(\"binhex is not yet implemented in Skulpt\")\n","src/lib/bisect.py":"\"\"\"Bisection algorithms.\"\"\"\n\ndef insort_right(a, x, lo=0, hi=None):\n \"\"\"Insert item x in list a, and keep it sorted assuming a is sorted.\n\n If x is already in a, insert it to the right of the rightmost x.\n\n Optional args lo (default 0) and hi (default len(a)) bound the\n slice of a to be searched.\n \"\"\"\n\n if lo < 0:\n raise ValueError('lo must be non-negative')\n if hi is None:\n hi = len(a)\n while lo < hi:\n mid = (lo+hi)//2\n if x < a[mid]: hi = mid\n else: lo = mid+1\n a.insert(lo, x)\n\ndef bisect_right(a, x, lo=0, hi=None):\n \"\"\"Return the index where to insert item x in list a, assuming a is sorted.\n\n The return value i is such that all e in a[:i] have e <= x, and all e in\n a[i:] have e > x. So if x already appears in the list, a.insert(x) will\n insert just after the rightmost x already there.\n\n Optional args lo (default 0) and hi (default len(a)) bound the\n slice of a to be searched.\n \"\"\"\n\n if lo < 0:\n raise ValueError('lo must be non-negative')\n if hi is None:\n hi = len(a)\n while lo < hi:\n mid = (lo+hi)//2\n if x < a[mid]: hi = mid\n else: lo = mid+1\n return lo\n\ndef insort_left(a, x, lo=0, hi=None):\n \"\"\"Insert item x in list a, and keep it sorted assuming a is sorted.\n\n If x is already in a, insert it to the left of the leftmost x.\n\n Optional args lo (default 0) and hi (default len(a)) bound the\n slice of a to be searched.\n \"\"\"\n\n if lo < 0:\n raise ValueError('lo must be non-negative')\n if hi is None:\n hi = len(a)\n while lo < hi:\n mid = (lo+hi)//2\n if a[mid] < x: lo = mid+1\n else: hi = mid\n a.insert(lo, x)\n\n\ndef bisect_left(a, x, lo=0, hi=None):\n \"\"\"Return the index where to insert item x in list a, assuming a is sorted.\n\n The return value i is such that all e in a[:i] have e < x, and all e in\n a[i:] have e >= x. So if x already appears in the list, a.insert(x) will\n insert just before the leftmost x already there.\n\n Optional args lo (default 0) and hi (default len(a)) bound the\n slice of a to be searched.\n \"\"\"\n\n if lo < 0:\n raise ValueError('lo must be non-negative')\n if hi is None:\n hi = len(a)\n while lo < hi:\n mid = (lo+hi)//2\n if a[mid] < x: lo = mid+1\n else: hi = mid\n return lo\n\n# Overwrite above definitions with a fast C implementation\ntry:\n from _bisect import *\nexcept ImportError:\n pass\n\n# Create aliases\nbisect = bisect_right\ninsort = insort_right\n","src/lib/bsddb/__init__.py":"raise NotImplementedError(\"bsddb is not yet implemented in Skulpt\")\n","src/lib/cProfile.py":"raise NotImplementedError(\"cProfile is not yet implemented in Skulpt\")\n","src/lib/calendar.py":"raise NotImplementedError(\"calendar is not yet implemented in Skulpt\")\n","src/lib/cgi.py":"raise NotImplementedError(\"cgi is not yet implemented in Skulpt\")\n","src/lib/cgitb.py":"raise NotImplementedError(\"cgitb is not yet implemented in Skulpt\")\n","src/lib/chunk.py":"raise NotImplementedError(\"chunk is not yet implemented in Skulpt\")\n","src/lib/cmd.py":"raise NotImplementedError(\"cmd is not yet implemented in Skulpt\")\n","src/lib/code.py":"raise NotImplementedError(\"code is not yet implemented in Skulpt\")\n","src/lib/codecs.py":"raise NotImplementedError(\"codecs is not yet implemented in Skulpt\")\n","src/lib/codeop.py":"raise NotImplementedError(\"codeop is not yet implemented in Skulpt\")\n","src/lib/collections.js":"var $builtinmodule=function(){return Sk.misceval.chain(Sk.importModule(\"keyword\",!1,!0),function(a){var b=Number.MAX_SAFE_INTEGER,c=Number.isInteger,d={};d.defaultdict=function defaultdict(a,b){if(!(this instanceof d.defaultdict))return new d.defaultdict(a,b);if(Sk.abstr.superConstructor(d.defaultdict,this,b),void 0===a)this.default_factory=Sk.builtin.none.none$;else{if(!Sk.builtin.checkCallable(a)&&a!==Sk.builtin.none.none$)throw new Sk.builtin.TypeError(\"first argument must be callable\");this.default_factory=a}return this.$d?this.$d.default_factory=this.default_factory:this.$d={default_factory:this.default_factory},this},Sk.abstr.setUpInheritance(\"defaultdict\",d.defaultdict,Sk.builtin.dict),d.defaultdict.prototype.$r=function(){var a=Sk.misceval.objectRepr(this.default_factory).v,b=Sk.builtin.dict.prototype.$r.call(this).v;return new Sk.builtin.str(\"defaultdict(\"+a+\", \"+b+\")\")},d.defaultdict.prototype.__copy__=function(a){var b,c,e,f=[];for(c=Sk.abstr.iter(a),e=c.tp$iternext();void 0!==e;e=c.tp$iternext())b=a.mp$subscript(e),f.push(e),f.push(b);return new d.defaultdict(a.$d.default_factory,f)},d.defaultdict.prototype.__missing__=function(a){if(Sk.builtin.pyCheckArgsLen(\"__missing__\",arguments.length,0,1),a)throw new Sk.builtin.KeyError(Sk.misceval.objectRepr(a));else return Sk.misceval.callsimArray(this.default_factory)},d.defaultdict.prototype.mp$subscript=function(a){try{return Sk.builtin.dict.prototype.mp$subscript.call(this,a)}catch(b){return this.default_factory===Sk.builtin.none.none$?this.__missing__(a):(ret=this.__missing__(),this.mp$ass_subscript(a,ret),ret)}},d.Counter=function Counter(a){if(!(this instanceof d.Counter))return new d.Counter(a);if(a instanceof Sk.builtin.dict||void 0===a)Sk.abstr.superConstructor(d.Counter,this,a);else{if(!Sk.builtin.checkIterable(a))throw new Sk.builtin.TypeError(\"'\"+Sk.abstr.typeName(a)+\"' object is not iterable\");Sk.abstr.superConstructor(d.Counter,this);for(var b,c=new Sk.builtin.int_(1),e=a.tp$iter(),f=e.tp$iternext();void 0!==f;f=e.tp$iternext())b=this.mp$subscript(f),b=b.nb$add(c),this.mp$ass_subscript(f,b)}return this},Sk.abstr.setUpInheritance(\"Counter\",d.Counter,Sk.builtin.dict),d.Counter.prototype.$r=function(){var a=0<this.size?Sk.builtin.dict.prototype.$r.call(this).v:\"\";return new Sk.builtin.str(\"Counter(\"+a+\")\")},d.Counter.prototype.mp$subscript=function(a){try{return Sk.builtin.dict.prototype.mp$subscript.call(this,a)}catch(a){return new Sk.builtin.int_(0)}},d.Counter.prototype.elements=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen(\"elements\",arguments.length,1,1);for(var b=[],c=a.tp$iter(),d=c.tp$iternext();void 0!==d;d=c.tp$iternext())for(var e=0;e<a.mp$subscript(d).v;e++)b.push(d);var f={tp$iter:function(){return f},$obj:this,$index:0,$elem:b,tp$iternext:function(){return f.$index>=f.$elem.length?void 0:f.$elem[f.$index++]}};return f}),d.Counter.prototype.most_common=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgsLen(\"most_common\",arguments.length,1,2);var c=a.mp$length();if(void 0===b)b=c;else{if(!Sk.builtin.checkInt(b))if(b instanceof Sk.builtin.float_)throw new Sk.builtin.TypeError(\"integer argument expected, got float\");else throw new Sk.builtin.TypeError(\"an integer is required\");b=Sk.builtin.asnum$(b),b=b<=c?b:c,b=0<=b?b:0}for(var d=[],e=a.tp$iter(),f=e.tp$iternext();void 0!==f;f=e.tp$iternext())d.push([f,a.mp$subscript(f)]);d=d.sort(function(c,a){return c[1].v<a[1].v?1:c[1].v>a[1].v?-1:0});for(var g=[],h=0;h<b;h++)g.push(new Sk.builtin.tuple(d.shift()));return new Sk.builtin.list(g)}),d.Counter.prototype.update=new Sk.builtin.func(function(a,b){if(Sk.builtin.pyCheckArgsLen(\"update\",arguments.length,1,2),b instanceof Sk.builtin.dict)for(var c,d=b.tp$iter(),e=d.tp$iternext();void 0!==e;e=d.tp$iternext())c=a.mp$subscript(e),a.mp$ass_subscript(e,c.nb$add(b.mp$subscript(e)));else if(void 0!==b){if(!Sk.builtin.checkIterable(b))throw new Sk.builtin.TypeError(\"'\"+Sk.abstr.typeName(b)+\"' object is not iterable\");for(var c,f=new Sk.builtin.int_(1),d=b.tp$iter(),e=d.tp$iternext();void 0!==e;e=d.tp$iternext())c=a.mp$subscript(e),a.mp$ass_subscript(e,c.nb$add(f))}}),d.Counter.prototype.subtract=new Sk.builtin.func(function(a,b){if(Sk.builtin.pyCheckArgsLen(\"subtract\",arguments.length,1,2),b instanceof Sk.builtin.dict)for(var c,d=b.tp$iter(),e=d.tp$iternext();void 0!==e;e=d.tp$iternext())c=a.mp$subscript(e),a.mp$ass_subscript(e,c.nb$subtract(b.mp$subscript(e)));else if(void 0!==b){if(!Sk.builtin.checkIterable(b))throw new Sk.builtin.TypeError(\"'\"+Sk.abstr.typeName(b)+\"' object is not iterable\");for(var c,f=new Sk.builtin.int_(1),d=b.tp$iter(),e=d.tp$iternext();void 0!==e;e=d.tp$iternext())c=a.mp$subscript(e),a.mp$ass_subscript(e,c.nb$subtract(f))}}),d.OrderedDict=function OrderedDict(a){return this instanceof d.OrderedDict?(this.orderedkeys=[],Sk.abstr.superConstructor(d.OrderedDict,this,a),this):new d.OrderedDict(a)},Sk.abstr.setUpInheritance(\"OrderedDict\",d.OrderedDict,Sk.builtin.dict),d.OrderedDict.prototype.$r=function(){var a,b,c,d,e=[];for(b=this.tp$iter(),c=b.tp$iternext();void 0!==c;c=b.tp$iternext())a=this.mp$subscript(c),void 0===a&&(a=null),e.push(\"(\"+Sk.misceval.objectRepr(c).v+\", \"+Sk.misceval.objectRepr(a).v+\")\");return d=e.join(\", \"),0<e.length&&(d=\"[\"+d+\"]\"),new Sk.builtin.str(\"OrderedDict(\"+d+\")\")},d.OrderedDict.prototype.mp$ass_subscript=function(a,b){var c=this.orderedkeys.indexOf(a);return-1==c&&this.orderedkeys.push(a),Sk.builtin.dict.prototype.mp$ass_subscript.call(this,a,b)},d.OrderedDict.prototype.mp$del_subscript=function(a){var b=this.orderedkeys.indexOf(a);return-1!=b&&this.orderedkeys.splice(b,1),Sk.builtin.dict.prototype.mp$del_subscript.call(this,a)},d.OrderedDict.prototype.__iter__=new Sk.builtin.func(function(a){return Sk.builtin.pyCheckArgsLen(\"__iter__\",arguments.length,0,0,!1,!0),d.OrderedDict.prototype.tp$iter.call(a)}),d.OrderedDict.prototype.tp$iter=function(){var a;return a={tp$iter:function(){return a},$obj:this,$index:0,$keys:this.orderedkeys.slice(0),tp$iternext:function(){return a.$index>=a.$keys.length?void 0:a.$keys[a.$index++]}},a},d.OrderedDict.prototype.ob$eq=function(a){var b,c,e,f,g;if(!(a instanceof d.OrderedDict))return Sk.builtin.dict.prototype.ob$eq.call(this,a);if(b=this.mp$length(),c=a.mp$length(),b!==c)return Sk.builtin.bool.false$;for(e=this.tp$iter(),otheriter=a.tp$iter(),f=e.tp$iternext(),otherk=otheriter.tp$iternext();void 0!==f;f=e.tp$iternext(),otherk=otheriter.tp$iternext()){if(!Sk.misceval.isTrue(Sk.misceval.richCompareBool(f,otherk,\"Eq\")))return Sk.builtin.bool.false$;if(g=this.mp$subscript(f),otherv=a.mp$subscript(otherk),!Sk.misceval.isTrue(Sk.misceval.richCompareBool(g,otherv,\"Eq\")))return Sk.builtin.bool.false$}return Sk.builtin.bool.true$},d.OrderedDict.prototype.ob$ne=function(a){var b,c,e,f,g;if(!(a instanceof d.OrderedDict))return Sk.builtin.dict.prototype.ob$ne.call(this,a);if(b=this.size,c=a.size,b!==c)return Sk.builtin.bool.true$;for(e=this.tp$iter(),otheriter=a.tp$iter(),f=e.tp$iternext(),otherk=otheriter.tp$iternext();void 0!==f;f=e.tp$iternext(),otherk=otheriter.tp$iternext()){if(!Sk.misceval.isTrue(Sk.misceval.richCompareBool(f,otherk,\"Eq\")))return Sk.builtin.bool.true$;if(g=this.mp$subscript(f),otherv=a.mp$subscript(otherk),!Sk.misceval.isTrue(Sk.misceval.richCompareBool(g,otherv,\"Eq\")))return Sk.builtin.bool.true$}return Sk.builtin.bool.false$},d.OrderedDict.prototype.pop=new Sk.builtin.func(function(a,b,c){var d;return Sk.builtin.pyCheckArgsLen(\"pop\",arguments.length,2,3),d=a.orderedkeys.indexOf(b),-1!=d&&a.orderedkeys.splice(d,1),Sk.misceval.callsimArray(Sk.builtin.dict.prototype.pop,[a,b,c])}),d.OrderedDict.prototype.popitem=new Sk.builtin.func(function(a,b){var c,d,e;if(Sk.builtin.pyCheckArgsLen(\"popitem\",arguments.length,1,2),0==a.orderedkeys.length)throw e=new Sk.builtin.str(\"dictionary is empty\"),new Sk.builtin.KeyError(e.v);return c=a.orderedkeys[0],(void 0===b||Sk.misceval.isTrue(b))&&(c=a.orderedkeys[a.orderedkeys.length-1]),d=Sk.misceval.callsimArray(a.pop,[a,c]),new Sk.builtin.tuple([c,d])}),d.deque=function(a,b){if(!(this instanceof d.deque))return new d.deque(a,b);if(this.$d?this.$d.maxlen=b?b:Sk.builtin.none.none$:this.$d={maxlen:b?b:Sk.builtin.none.none$},this.head=0,this.tail=0,this.mask=1,b&&!Sk.builtin.checkNone(b))if(b=Sk.builtin.asnum$(b),!c(b))throw new Sk.builtin.TypeError(\"an integer is required\");else if(0>b)throw new Sk.builtin.ValueError(\"maxlen must be non-negative\");else this.maxlen=b;if(void 0===a)this.v=[,,];else if(Sk.builtin.checkIterable(a))this.v=[,,],d.deque.prototype.extend.func_code(this,a);else throw new Sk.builtin.TypeError(\"'\"+Sk.abstr.typeName(a)+\"' object is not iterable\");return this.__class__=d.deque,this},d.deque.minArgs=1,d.deque.maxArgs=2,d.deque.co_varnames=[\"iterable\",\"maxlen\"],d.deque.co_name=new Sk.builtin.str(\"mod.deque\"),d.deque.co_argcount=2,d.deque.$defaults=[new Sk.builtin.tuple([]),Sk.builtin.none.none$],Sk.abstr.setUpInheritance(\"collections.deque\",d.deque,Sk.builtin.seqtype),Sk.abstr.markUnhashable(d.deque),d.deque.prototype.$init$=d.deque,d.deque.prototype.__init__=new Sk.builtin.func(function(a,b,c){a.$init$(b,c)}),d.deque.prototype.$resize=function(a,b){var c=this.head,d=this.mask;if(this.head=0,this.tail=a,this.mask=b-1,0===c)return void(this.v.length=b);const e=Array(b);for(let f=0;f<a;f++)e[f]=this.v[c+f&d];this.v=e},d.deque.prototype.$push=function(a){this.v[this.tail]=a,this.tail=this.tail+1&this.mask,this.head===this.tail&&this.$resize(this.v.length,this.v.length<<1);var b=this.tail-this.head&this.mask;return void 0!==this.maxlen&&b>this.maxlen&&d.deque.prototype.popleft.func_code(this),this},d.deque.prototype.$pushLeft=function(a){this.head=this.head-1&this.mask,this.v[this.head]=a,this.head===this.tail&&this.$resize(this.v.length,this.v.length<<1);var b=this.tail-this.head&this.mask;return void 0!==this.maxlen&&b>this.maxlen&&d.deque.prototype.pop.func_code(this),this},d.deque.prototype.append=new Sk.builtin.func(function(a,b){return Sk.builtin.pyCheckArgsLen(\"append\",arguments.length,1,1,!0,!1),a.$push(b),Sk.builtin.none.none$}),d.deque.prototype.appendleft=new Sk.builtin.func(function(a,b){return Sk.builtin.pyCheckArgsLen(\"appendleft\",arguments.length,1,1,!0,!1),a.$pushLeft(b),Sk.builtin.none.none$}),d.deque.prototype.extend=new Sk.builtin.func(function(a,b){if(Sk.builtin.pyCheckArgsLen(\"extend\",arguments.length,1,1,!0,!1),!Sk.builtin.checkIterable(b))throw new Sk.builtin.TypeError(\"'\"+Sk.abstr.typeName(b)+\"' object is not iterable\");for(it=Sk.abstr.iter(b),i=it.tp$iternext();void 0!==i;i=it.tp$iternext())a.$push(i);return Sk.builtin.none.none$}),d.deque.prototype.extendleft=new Sk.builtin.func(function(a,b){if(Sk.builtin.pyCheckArgsLen(\"extendleft\",arguments.length,1,1,!0,!1),!Sk.builtin.checkIterable(b))throw new Sk.builtin.TypeError(\"'\"+Sk.abstr.typeName(b)+\"' object is not iterable\");for(it=Sk.abstr.iter(b),i=it.tp$iternext();void 0!==i;i=it.tp$iternext())a.$pushLeft(i);return Sk.builtin.none.none$}),d.deque.prototype.clear=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen(\"clear\",arguments.length,0,0,!0,!1),a.head=0,a.tail=0,a.mask=1,a.maxlen=void 0,a.v=[,,]}),d.deque.prototype.insert=new Sk.builtin.func(function(a,b,d){if(Sk.builtin.pyCheckArgsLen(\"insert\",arguments.length,2,2,!0,!1),index=Sk.builtin.asnum$(b),!c(index))throw new Sk.builtin.TypeError(\"integer argument expected, got \"+Sk.abstr.typeName(b));var e=a.tail-a.head&a.mask;if(void 0!==a.maxlen&&e>=a.maxlen)throw new Sk.builtin.IndexError(\"deque already at its maximum size\");index>e&&(index=e),index<=-e&&(index=0);const f=(0<=index?a.head:a.tail)+index&a.mask;var g=a.tail;for(a.tail=a.tail+1&a.mask;g!==f;){const b=g-1&a.mask;a.v[g]=a.v[b],g=b}return a.v[f]=d,a.head===a.tail&&a.$resize(a.v.length,a.v.length<<1),Sk.builtin.none.none$}),d.deque.prototype.index=new Sk.builtin.func(function(a,b,d,e){Sk.builtin.pyCheckArgsLen(\"index\",arguments.length,1,3,!0,!1);var f=a.tail-a.head&a.mask;if(!d)var d=0;else if(d=Sk.builtin.asnum$(d),!c(d))throw new Sk.builtin.TypeError(\"slice indices must be integers or have an __index__ method\");if(!e)var e=f;else if(e=Sk.builtin.asnum$(e),!c(e))throw new Sk.builtin.TypeError(\"slice indices must be integers or have an __index__ method\");var g=a.head,h=a.mask,k=a.v;const l=0<=d?d:d<-f?0:f+d;e=0<=e?e:e<-f?0:f+e;for(var m=l;m<e;m++)if(k[g+m&h]===b)return m;throw new Sk.builtin.ValueError(Sk.ffi.remapToJs(b)+\" is not in deque\")}),d.deque.prototype.__delitem__=new Sk.builtin.func(function(a,b){var d=a.tail-a.head&a.mask;if(index=Sk.builtin.asnum$(b),!c(index))throw new Sk.builtin.TypeError(\"'\"+Sk.abstr.typeName(b)+\"' object cannot be interpreted as an integer\");if((0|index)!==index||index>=d||index<-d)throw new Sk.builtin.IndexError(\"deque index out of range\");const e=(0<=index?a.head:a.tail)+index&a.mask;for(var f=e;f!==a.tail;){const b=f+1&a.mask;a.v[f]=a.v[b],f=b}return a.tail=a.tail-1&a.mask,d<a.mask>>>1&&a.$resize(d,a.v.length>>>1),Sk.builtin.none.none$}),d.deque.prototype.mp$del_subscript=function(a){d.deque.prototype.__delitem__.func_code(this,a)},d.deque.prototype.count=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgsLen(\"count\",arguments.length,1,1,!0,!1);var c=a.head,d=a.tail-a.head&a.mask,e=a.mask,f=a.v,g=0;for(var h=0;h<d;h++)f[c+h&e]==b&&g++;return new Sk.builtin.int_(g)}),d.deque.prototype.pop=new Sk.builtin.func(function(a){if(Sk.builtin.pyCheckArgsLen(\"pop\",arguments.length,0,0,!0,!1),a.head===a.tail)throw new Sk.builtin.IndexError(\"pop from an empty deque\");a.tail=a.tail-1&a.mask;const b=a.v[a.tail];a.v[a.tail]=void 0;var c=a.tail-a.head&a.mask;return c<a.mask>>>1&&a.$resize(c,a.v.length>>>1),b}),d.deque.prototype.popleft=new Sk.builtin.func(function(a){if(Sk.builtin.pyCheckArgsLen(\"popleft\",arguments.length,0,0,!0,!1),a.head===a.tail)throw new Sk.builtin.IndexError(\"pop from an empty deque\");const b=a.v[a.head];a.v[a.head]=void 0,a.head=a.head+1&a.mask;var c=a.tail-a.head&a.mask;return c<a.mask>>>1&&a.$resize(c,a.v.length>>>1),b}),d.deque.prototype.__iter__=new Sk.builtin.func(function(a){return Sk.builtin.pyCheckArgsLen(\"__iter__\",arguments.length,0,0,!0,!1),new d.deque.deque_iter_(a)}),d.deque.prototype.mp$subscript=function(a){if(index=Sk.builtin.asnum$(a),!c(index))throw new Sk.builtin.TypeError(\"sequence index must be integer, not '\"+Sk.abstr.typeName(a)+\"'\");var b=this.tail-this.head&this.mask;if((0|index)!==index||index>=b||index<-b)throw new Sk.builtin.IndexError(\"deque index out of range\");const d=(0<=index?this.head:this.tail)+index&this.mask;return this.v[d]},d.deque.prototype.mp$ass_subscript=function(a,b){if(index=Sk.builtin.asnum$(a),!c(index))throw new Sk.builtin.TypeError(\"sequence index must be integer, not '\"+Sk.abstr.typeName(a)+\"'\");var d=this.tail-this.head&this.mask;if((0|index)!==index||index>=d||index<-d)throw new Sk.builtin.IndexError(\"deque index out of range\");const e=(0<=index?this.head:this.tail)+index&this.mask;this.v[e]=b},d.deque.prototype.__reversed__=new Sk.builtin.func(function(a){var b=new d.deque(a);return d.deque.prototype.reverse.func_code(b),new d._deque_reverse_iterator(b)}),d.deque.prototype.tp$setattr=function(a){if(!(Sk.ffi.remapToJs(a)in this.$d))throw new Sk.builtin.AttributeError(\"'collections.deque' object has no attribute '\"+Sk.ffi.remapToJs(a)+\"'\");throw new Sk.builtin.AttributeError(\"attribute '\"+Sk.ffi.remapToJs(a)+\"' of 'collections.deque' objects is not writable\")},d.deque.__class__=d.deque,d.deque.deque_iter_=function(a){if(!(this instanceof d.deque.deque_iter_))return new d.deque.deque_iter_(a);this.$index=0,this.dq=a.v,this.sq$length=a.tail-a.head&a.mask,this.tp$iter=()=>this,this.$head=a.head,this.$tail=a.tail,this.$mask=a.mask;var b;return this.tp$iternext=function(){if(!(this.$index>=this.sq$length))return b=(0<=this.$index?this.$head:this.$tail)+this.$index&this.$mask,this.$index++,this.dq[b]},this.$r=function(){return new Sk.builtin.str(\"_collections._deque_iterator\")},this},Sk.abstr.setUpInheritance(\"_collections._deque_iterator\",d.deque.deque_iter_,Sk.builtin.object),d.deque.deque_iter_.prototype.__class__=d.deque.deque__iter_,d.deque.deque_iter_.prototype.__iter__=new Sk.builtin.func(function(a){return a}),d.deque.deque_iter_.prototype.next$=function(a){var b=a.tp$iternext();if(void 0===b)throw new Sk.builtin.StopIteration;return b},d.deque.prototype.tp$iter=function(){return new d.deque.deque_iter_(this)},d.deque.prototype.remove=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgsLen(\"remove\",arguments.length,1,1,!0,!1);var c=d.deque.prototype.index.func_code(a,b);const e=a.head+c&a.mask;for(var f=e;f!==a.tail;){const b=f+1&a.mask;a.v[f]=a.v[b],f=b}a.tail=a.tail-1&a.mask;var g=a.tail-a.head&a.mask;g<a.mask>>>1&&a.$resize(g,a.v.length>>>1)}),d.deque.prototype.__add__=new Sk.builtin.func(function(a,b){if(\"collections.deque\"!=Sk.abstr.typeName(b))throw new Sk.builtin.TypeError(\"can only concatenate deque (not \\\"\"+Sk.abstr.typeName(b)+\"\\\") to deque\");for(var c=d.deque(a,a.maxlen),e=b.tp$iter(),f=e.tp$iternext();void 0!==f;f=e.tp$iternext())c.$push(f);return c}),d.deque.prototype.__iadd__=new Sk.builtin.func(function(a,b){if(!Sk.builtin.checkIterable(b))throw new Sk.builtin.TypeError(\"'\"+Sk.abstr.typeName(b)+\"' object is not iterable\");for(it=Sk.abstr.iter(b),i=it.tp$iternext();void 0!==i;i=it.tp$iternext())a.$push(i);return a}),d.deque.prototype.sq$repeat=function(a){var e;if(n=Sk.builtin.asnum$(a),!c(n))throw new Sk.builtin.TypeError(\"can't multiply sequence by non-int of type '\"+Sk.abstr.typeName(a)+\"'\");if(n>b)throw new Sk.builtin.OverflowError(\"Python int too large to convert to ssize_t\");e=[];var f,g=this.tail-this.head&this.mask;for(i=0;i<n;++i)for(j=0;j<g;++j)f=this.head+j&this.mask,e.push(this.v[f]);return void 0===this.maxlen?new d.deque(Sk.builtin.list(e)):new d.deque(Sk.builtin.list(e),Sk.builtin.int_(this.maxlen))},d.deque.prototype.reverse=new Sk.builtin.func(function(c){Sk.builtin.pyCheckArgsLen(\"reverse\",arguments.length,0,0,!0,!1);for(var d=c.head,e=c.tail,f=c.mask,g=c.tail-c.head&c.mask,h=0;h<~~(g/2);h++){const g=e-h-1&f,a=d+h&f,b=c.v[g];c.v[g]=c.v[a],c.v[a]=b}return Sk.builtin.none.none$}),d.deque.prototype.rotate=new Sk.builtin.func(function(d,e=Sk.builtin.int_(1)){if(Sk.builtin.pyCheckArgsLen(\"rotate\",arguments.length,0,1,!0,!1),n=Sk.builtin.asnum$(e),!c(n))throw new Sk.builtin.TypeError(\"'\"+Sk.abstr.typeName(e)+\"' object cannot be interpreted as an integer\");if(n>b)throw new Sk.builtin.OverflowError(\"Python int too large to convert to ssize_t\");var f=d.head,g=d.tail;if(0===n||f===g)return d;if(d.head=f-n&d.mask,d.tail=g-n&d.mask,0<n)for(var h=1;h<=n;h++){const c=f-h&d.mask,a=g-h&d.mask;d.v[c]=d.v[a],d.v[a]=void 0}else for(let c=0;c>n;c--){const e=g-c&d.mask,a=f-c&d.mask;d.v[e]=d.v[a],d.v[a]=void 0}return Sk.builtin.none.none$}),d.deque.prototype.sq$length=function(){return this.tail-this.head&this.mask},d.deque.prototype.sq$contains=function(a){var b,c;for(b=this.tp$iter(),c=b.tp$iternext();void 0!==c;c=b.tp$iternext())if(Sk.misceval.richCompareBool(c,a,\"Eq\"))return!0;return!1},d.deque.prototype.__contains__=new Sk.builtin.func(function(a,b){return Sk.builtin.pyCheckArgsLen(\"__contains__\",arguments.length-1,1,1),new Sk.builtin.bool(a.sq$contains(b))}),d.deque.prototype.$r=function(){for(var a=[],b=this.tail-this.head&this.mask,c=0;c<b;c++)this.v[this.head+c&this.mask]&&(this.v[this.head+c&this.mask]==this?a.push(\"[...]\"):a.push(Sk.misceval.objectRepr(this.v[this.head+c&this.mask]).v));return void 0===this.maxlen?new Sk.builtin.str(\"deque([\"+a.filter(Boolean).join(\", \")+\"])\"):new Sk.builtin.str(\"deque([\"+a.filter(Boolean).join(\", \")+\"], maxlen=\"+this.maxlen+\")\")},d.deque.prototype.__repr__=new Sk.builtin.func(function(a){return Sk.builtin.pyCheckArgsLen(\"__repr__\",arguments.length,0,0,!1,!0),d.deque.prototype.$r.call(a)}),d.deque.prototype.tp$richcompare=function(a,b){var c,e,f,g,h;if(this===a&&Sk.misceval.opAllowsEquality(b))return!0;if(!a.__class__||a.__class__!=d.deque)return\"Eq\"!==b&&\"NotEq\"===b;var l=a;for(h=this.v,a=a.v,g=this.tail-this.head&this.mask,f=l.tail-l.head&l.mask,e=0;e<g&&e<f&&(c=Sk.misceval.richCompareBool(h[this.head+e&this.mask],a[l.head+e&l.mask],\"Eq\"),!!c);++e);if(e>=g||e>=f)switch(b){case\"Lt\":return g<f;case\"LtE\":return g<=f;case\"Eq\":return g===f;case\"NotEq\":return g!==f;case\"Gt\":return g>f;case\"GtE\":return g>=f;default:Sk.asserts.fail();}return\"Eq\"!==b&&(\"NotEq\"===b||Sk.misceval.richCompareBool(h[this.head+e&this.mask],a[l.head+e&l.mask],b))},d._deque_reverse_iterator=function(a){this.v=a},Sk.abstr.setUpInheritance(\"_collections._deque_reverse_iterator\",d._deque_reverse_iterator,Sk.builtin.seqtype),d._deque_reverse_iterator._deque_reverse_iterator_iter_=function(a){if(!(this instanceof d._deque_reverse_iterator._deque_reverse_iterator_iter_))return new d._deque_reverse_iterator._deque_reverse_iterator_iter_(a);this.$index=0,this.dq=a.v.v,this.sq$length=this.dq.length,this.tp$iter=()=>this;var b;return this.tp$iternext=function(){if(!(this.$index>=this.sq$length))return b=(0<=this.$index?a.v.head:a.v.tail)+this.$index&a.v.mask,this.$index++,this.dq[b]},this.$r=function(){return new Sk.builtin.str(\"_collections._deque_reverse_iterator_iter_\")},this},d._deque_reverse_iterator.prototype.tp$iter=function(){return new d._deque_reverse_iterator._deque_reverse_iterator_iter_(this)},Sk.abstr.setUpInheritance(\"_deque_reverse_iterator_iterator\",d._deque_reverse_iterator._deque_reverse_iterator_iter_,Sk.builtin.object),d._deque_reverse_iterator._deque_reverse_iterator_iter_.prototype.__class__=d._deque_reverse_iterator._deque_reverse_iterator_iter_,d._deque_reverse_iterator._deque_reverse_iterator_iter_.prototype.__iter__=new Sk.builtin.func(function(a){return a}),d._deque_reverse_iterator._deque_reverse_iterator_iter_.prototype.next$=function(a){var b=a.tp$iternext();if(void 0===b)throw new Sk.builtin.StopIteration;return b},d._deque_reverse_iterator.prototype.$r=function(){return Sk.builtin.str(\"<_collections._deque_reverse_iterator object>\")},d.namedtuples={};var e=function(a,b){function tempCtor(){}tempCtor.prototype=b.prototype,a.superClass_=b.prototype,a.prototype=new tempCtor,a.prototype.constructor=a},f=function(b,c,f,g,h){if(Sk.ffi.remapToJs(Sk.misceval.callsimArray(a.$d.iskeyword,[b])))throw new Sk.builtin.ValueError(\"Type names and field names cannot be a keyword: '\"+b.v+\"'\");const k=b.$jsstr(),l=new RegExp(/^[0-9].*/),m=new RegExp(/^[0-9_].*/),o=new RegExp(/^\\w*$/);if(l.test(k)||!o.test(k)||!k)throw new Sk.builtin.ValueError(\"Type names and field names must be valid identifiers: '\"+k+\"'\");let p;if(!Sk.builtin.checkIterable(c))throw new Sk.builtin.TypeError(\"'\"+Sk.abstr.typeName(c)+\"' object is not iterable\");if(Sk.builtin.checkString(c))p=c.$jsstr(),p=p.replace(/,/g,\" \").split(/\\s+/),1==p.length&&\"\"===p[0]&&(p=[]);else for(p=[],iter=Sk.abstr.iter(c),i=iter.tp$iternext();void 0!==i;i=iter.tp$iternext())p.push(Sk.ffi.remapToJs(i));if(f=Sk.misceval.isTrue(Sk.builtin.bool(f)),f){let b=new Set;for(i=0;i<p.length;i++)(Sk.ffi.remapToJs(Sk.misceval.callsimArray(a.$d.iskeyword,[Sk.ffi.remapToPy(p[i])]))||m.test(p[i])||!o.test(p[i])||!p[i]||b.has(p[i]))&&(p[i]=\"_\"+i),b.add(p[i])}for(i=0;i<p.length;i++)if(Sk.ffi.remapToJs(Sk.misceval.callsimArray(a.$d.iskeyword,[Sk.ffi.remapToPy(p[i])])))throw new Sk.builtin.ValueError(\"Type names and field names cannot be a keyword: '\"+p[i]+\"'\");else if((m.test(p[i])||!p[i])&&!f)throw new Sk.builtin.ValueError(\"Field names cannot start with an underscore: '\"+p[i]+\"'\");else if(!o.test(p[i]))throw new Sk.builtin.ValueError(\"Type names and field names must be valid identifiers: '\"+p[i]+\"'\");let q=new Set;for(i=0;i<p.length;i++){if(q.has(p[i]))throw new Sk.builtin.ValueError(\"Encountered duplicate field name: '\"+p[i]+\"'\");q.add(p[i])}const r=[];if(!Sk.builtin.checkNone(g)){if(!Sk.builtin.checkIterable(g))throw new Sk.builtin.TypeError(\"'\"+Sk.abstr.typeName(g)+\"' object is not iterable\");g=Sk.abstr.iter(g);for(let a=g.tp$iternext();void 0!==a;a=g.tp$iternext())r.push(a)}if(r.length>p.length)throw new Sk.builtin.TypeError(\"Got more default values than field names\");var s=function nametuple_constructor(...a){return Sk.builtin.pyCheckArgsLen(\"__new__\",arguments.length,p.length,p.length),this instanceof d.namedtuples[k]?void(this.__class__=d.namedtuples[k],this.v=a):new d.namedtuples[k](...a)};s.co_name=new Sk.builtin.str(\"__new__\"),s.co_varnames=p,s.$defaults=r;const t=function(a,...b){if(Sk.builtin.pyCheckArgsLen(\"__new__\",arguments.length,p.length+1,p.length+1),Sk.builtin.pyCheckType(\"___new___(X): X\",\"type object\",Sk.builtin.checkClass(a)),Sk.builtin.issubclass(a,Sk.builtin.tuple)){let c;try{c=new a(...b)}catch(d){d instanceof Sk.builtin.TypeError&&(c=new a(b))}return c}throw new Sk.builtin.TypeError(a.tp$name+\" is not a subtype of tuple\")};t.co_name=new Sk.builtin.str(\"__new__\"),t.co_varnames=[\"cls\"].concat(p),t.$defaults=r,__new__=function(a){Sk.builtin.func.call(this,a),this.$d.__defaults__=Sk.builtin.checkNone(g)?g:new Sk.builtin.tuple(r)},__new__.prototype=Object.create(Sk.builtin.func.prototype),s.__new__=new __new__(t);for(let a=0;a<p.length;a++)fld=Sk.fixReserved(p[a]),s[fld]={},s[fld].tp$descr_set=function(){throw new Sk.builtin.AttributeError(\"can't set attribute\")},s[fld].tp$descr_get=function(b){return b.v[a]},s[fld].$r=function(){return new Sk.builtin.str(\"<property object>\")};d.namedtuples[k]=s,s.__class__=s,e(s,Sk.builtin.tuple),s.prototype.tp$name=k,s.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj(k,d.namedtuples[k]),s.prototype.$r=function(){let a,b,c;if(0===this.v.length)return new Sk.builtin.str(k+\"()\");for(c=[],b=0;b<this.v.length;++b)c[b]=p[b]+\"=\"+Sk.misceval.objectRepr(this.v[b]).v;return a=c.join(\", \"),cls=Sk.abstr.typeName(this),new Sk.builtin.str(cls+\"(\"+a+\")\")},s.prototype._fields=s._fields=new Sk.builtin.tuple(p.map(a=>Sk.builtin.str(a)));const u=function(a){if(Sk.builtin.pyCheckArgsLen(\"_make\",arguments.length,1,1),!Sk.builtin.checkIterable(a))throw new Sk.builtin.TypeError(\"'\"+Sk.abstr.typeName(a)+\"' object is not iterable\");a=Sk.abstr.iter(a),values=[];for(let b=a.tp$iternext();void 0!==b;b=a.tp$iternext())values.push(b);return s(...values)};u.co_name=new Sk.builtin.str(\"_make\"),s._make=new Sk.builtin.func(u);const v=function(a){const b=[];for(let c=0;c<a._fields.v.length;c++)b.push(a._fields.v[c]),b.push(a.v[c]);return new Sk.builtin.dict(b)};v.co_name=new Sk.builtin.str(\"_asdict\"),s.prototype._asdict=new Sk.builtin.func(v);const w=[];for(let a=p.length-r.length;a<p.length;a++)w.push(Sk.builtin.str(p[a])),w.push(r[a-(p.length-r.length)]);s.prototype._field_defaults=s._field_defaults=new Sk.builtin.dict(w);const x=function(a,b){const c={};for(let d=0;d<a.length;d+=2)c[a[d].$jsstr()]=a[d+1];const d=[];for(let e=0;e<p.length;e++){const a=p[e],f=a in c?c[a]:b.v[e];d.push(f),delete c[a]}for(let d in c){const a=Object.keys(c).map(a=>\"'\"+a+\"'\");throw new Sk.builtin.ValueError(\"Got unexpectd field names: [\"+a+\"]\")}return s(...d)};x.co_name=new Sk.builtin.str(\"replace\"),x.co_kwargs=1,x.co_varnames=[\"_self\"],s.prototype._replace=new Sk.builtin.func(x),Sk.builtin.checkNone(h)&&(h=Sk.globals.__name__),s.__module__=h,s.__doc__=new Sk.builtin.str(k+\"(\"+p.join(\", \")+\")\"),s.__slots__=new Sk.builtin.tuple([]),s.prototype.__getnewargs__=new Sk.builtin.func(function(a){return new Sk.builtin.tuple(a.v)});const y=new Sk.builtin.tuple([s,Sk.builtin.tuple,Sk.builtin.object]);s.tp$mro=y;let z=[\"_make\",s._make,\"__bases__\",new Sk.builtin.tuple([Sk.builtin.tuple]),\"__mro__\",new Sk.builtin.tuple([s,Sk.builtin.tuple,Sk.builtin.object]),\"__new__\",s.__new__,\"__name__\",b];return z=z.map(a=>\"string\"==typeof a?Sk.builtin.str(a):a),s.$d=new Sk.builtin.dict(z),s};return f.co_name=new Sk.builtin.str(\"namedtuple\"),f.co_argcount=2,f.co_kwonlyargcount=3,f.$kwdefs=[Sk.builtin.bool.false$,Sk.builtin.none.none$,Sk.builtin.none.none$],f.co_varnames=[\"typename\",\"field_names\",\"rename\",\"defaults\",\"module\"],d.namedtuple=new Sk.builtin.func(f),d})};","src/lib/colorsys.py":"raise NotImplementedError(\"colorsys is not yet implemented in Skulpt\")\n","src/lib/commands.py":"raise NotImplementedError(\"commands is not yet implemented in Skulpt\")\n","src/lib/compileall.py":"raise NotImplementedError(\"compileall is not yet implemented in Skulpt\")\n","src/lib/compiler/__init__.py":"raise NotImplementedError(\"compiler is not yet implemented in Skulpt\")\n","src/lib/config/__init__.py":"raise NotImplementedError(\"config is not yet implemented in Skulpt\")\n","src/lib/contextlib.py":"raise NotImplementedError(\"contextlib is not yet implemented in Skulpt\")\n","src/lib/cookielib.py":"raise NotImplementedError(\"cookielib 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\n# def _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_atomic\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/copy_reg.py":"raise NotImplementedError(\"copy_reg is not yet implemented in Skulpt\")\n","src/lib/csv.py":"raise NotImplementedError(\"csv is not yet implemented in Skulpt\")\n","src/lib/ctypes/__init__.py":"raise NotImplementedError(\"ctypes 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/curses/__init__.py":"raise NotImplementedError(\"curses 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# Python 2-vs-3 compat hack\nimport sys\nunicode = unicode if sys.version_info < (3,) else str\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/dbhash.py":"raise NotImplementedError(\"dbhash is not yet implemented in Skulpt\")\n","src/lib/decimal.py":"raise NotImplementedError(\"decimal is not yet implemented in Skulpt\")\n","src/lib/difflib.py":"raise NotImplementedError(\"difflib is not yet implemented in Skulpt\")\n","src/lib/dircache.py":"raise NotImplementedError(\"dircache is not yet implemented in Skulpt\")\n","src/lib/dis.py":"raise NotImplementedError(\"dis is not yet implemented in Skulpt\")\n","src/lib/distutils/__init__.py":"raise NotImplementedError(\"distutils 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/distutils/tests/__init__.py":"raise NotImplementedError(\"tests is not yet implemented in Skulpt\")\n","src/lib/doctest.py":"raise NotImplementedError(\"doctest is not yet implemented in Skulpt\")\n","src/lib/document.js":"var $builtinmodule=function(){var a,b={__name__:new Sk.builtin.str(\"document\")};return b.getElementById=new Sk.builtin.func(function(a){var c=document.getElementById(a.v);return c?Sk.misceval.callsimArray(b.Element,[c]):Sk.builtin.none.none$}),b.createElement=new Sk.builtin.func(function(a){var c=document.createElement(a.v);if(c)return Sk.misceval.callsimArray(b.Element,[c])}),b.getElementsByTagName=new Sk.builtin.func(function(a){for(var c=document.getElementsByTagName(a.v),d=[],e=c.length-1;0<=e;e--)d.push(Sk.misceval.callsimArray(b.Element,[c[e]]));return new Sk.builtin.list(d)}),b.getElementsByClassName=new Sk.builtin.func(function(a){for(var c=document.getElementsByClassName(a.v),d=[],e=0;e<c.length;e++)d.push(Sk.misceval.callsimArray(b.Element,[c[e]]));return new Sk.builtin.list(d)}),b.getElementsByName=new Sk.builtin.func(function(a){for(var c=document.getElementsByName(a.v),d=[],e=0;e<c.length;e++)d.push(Sk.misceval.callsimArray(b.Element,[c[e]]));return new Sk.builtin.list(d)}),b.currentDiv=new Sk.builtin.func(function(){if(void 0!==Sk.divid)return new Sk.builtin.str(Sk.divid);throw new Sk.builtin.AttributeError(\"There is no value set for divid\")}),a=function(a,b){b.__init__=new Sk.builtin.func(function(a,b){a.v=b,a.innerHTML=b.innerHTML,a.innerText=b.innerText,void 0!==b.value&&(a.value=b.value,Sk.abstr.objectSetItem(a.$d,new Sk.builtin.str(\"value\"),new Sk.builtin.str(a.value))),void 0!==b.checked&&(a.checked=b.checked,Sk.abstr.objectSetItem(a.$d,new Sk.builtin.str(\"checked\"),new Sk.builtin.str(a.checked))),Sk.abstr.objectSetItem(a.$d,new Sk.builtin.str(\"innerHTML\"),new Sk.builtin.str(a.innerHTML)),Sk.abstr.objectSetItem(a.$d,new Sk.builtin.str(\"innerText\"),new Sk.builtin.str(a.innerText))}),b.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr,b.__setattr__=new Sk.builtin.func(function(a,b,c){b=Sk.ffi.remapToJs(b),\"innerHTML\"===b&&(a.innerHTML=c,a.v.innerHTML=c.v,Sk.abstr.objectSetItem(a.$d,new Sk.builtin.str(\"innerHTML\"),c)),\"innerText\"===b&&(a.innerText=c,a.v.innerText=c.v,Sk.abstr.objectSetItem(a.$d,new Sk.builtin.str(\"innerText\"),c))}),b.appendChild=new Sk.builtin.func(function(a,b){a.v.appendChild(b.v)}),b.removeChild=new Sk.builtin.func(function(a,b){a.v.removeChild(b.v)}),b.getCSS=new Sk.builtin.func(function(a,b){return new Sk.builtin.str(a.v.style[b.v])}),b.setCSS=new Sk.builtin.func(function(a,b,c){a.v.style[b.v]=c.v}),b.getAttribute=new Sk.builtin.func(function(a,b){var c=a.v.getAttribute(b.v);return c?new Sk.builtin.str(c):Sk.builtin.none.none$}),b.setAttribute=new Sk.builtin.func(function(a,b,c){a.v.setAttribute(b.v,c.v)}),b.getProperty=new Sk.builtin.func(function(a,b){var c=a.v[b.v];return c?new Sk.builtin.str(c):Sk.builtin.none.none$}),b.__str__=new Sk.builtin.func(function(a){return console.log(a.v.tagName),new Sk.builtin.str(a.v.tagName)}),b.__repr__=new Sk.builtin.func(function(){return new Sk.builtin.str(\"[DOM Element]\")})},b.Element=Sk.misceval.buildClass(b,a,\"Element\",[]),b};","src/lib/dumbdbm.py":"raise NotImplementedError(\"dumbdbm is not yet implemented in Skulpt\")\n","src/lib/dummy_thread.py":"raise NotImplementedError(\"dummy_thread is not yet implemented in Skulpt\")\n","src/lib/dummy_threading.py":"raise NotImplementedError(\"dummy_threading is not yet implemented in Skulpt\")\n","src/lib/email/__init__.py":"raise NotImplementedError(\"email 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/email/test/data/__init__.py":"raise NotImplementedError(\"data is not yet implemented in Skulpt\")\n","src/lib/encodings/__init__.py":"raise NotImplementedError(\"encodings is not yet implemented in Skulpt\")\n","src/lib/filecmp.py":"raise NotImplementedError(\"filecmp is not yet implemented in Skulpt\")\n","src/lib/fileinput.py":"raise NotImplementedError(\"fileinput is not yet implemented in Skulpt\")\n","src/lib/fnmatch.py":"raise NotImplementedError(\"fnmatch is not yet implemented in Skulpt\")\n","src/lib/formatter.py":"raise NotImplementedError(\"formatter is not yet implemented in Skulpt\")\n","src/lib/fpformat.py":"raise NotImplementedError(\"fpformat is not yet implemented in Skulpt\")\n","src/lib/fractions.py":"raise NotImplementedError(\"fractions is not yet implemented in Skulpt\")\n","src/lib/ftplib.py":"raise NotImplementedError(\"ftplib is not yet implemented in Skulpt\")\n","src/lib/functools.py":"raise NotImplementedError(\"functools is not yet implemented in Skulpt\")\n","src/lib/genericpath.py":"raise NotImplementedError(\"genericpath is not yet implemented in Skulpt\")\n","src/lib/getopt.py":"raise NotImplementedError(\"getopt is not yet implemented in Skulpt\")\n","src/lib/getpass.py":"raise NotImplementedError(\"getpass is not yet implemented in Skulpt\")\n","src/lib/gettext.py":"raise NotImplementedError(\"gettext is not yet implemented in Skulpt\")\n","src/lib/glob.py":"raise NotImplementedError(\"glob is not yet implemented in Skulpt\")\n","src/lib/gzip.py":"raise NotImplementedError(\"gzip is not yet implemented in Skulpt\")\n","src/lib/hashlib.py":"raise NotImplementedError(\"hashlib is not yet implemented in Skulpt\")\n","src/lib/heapq.py":"raise NotImplementedError(\"heapq is not yet implemented in Skulpt\")\n","src/lib/hmac.py":"raise NotImplementedError(\"hmac is not yet implemented in Skulpt\")\n","src/lib/hotshot/__init__.py":"raise NotImplementedError(\"hotshot is not yet implemented in Skulpt\")\n","src/lib/htmlentitydefs.py":"raise NotImplementedError(\"htmlentitydefs is not yet implemented in Skulpt\")\n","src/lib/htmllib.py":"raise NotImplementedError(\"htmllib is not yet implemented in Skulpt\")\n","src/lib/httplib.py":"raise NotImplementedError(\"httplib 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/idlelib/__init__.py":"raise NotImplementedError(\"idlelib is not yet implemented in Skulpt\")\n","src/lib/ihooks.py":"raise NotImplementedError(\"ihooks is not yet implemented in Skulpt\")\n","src/lib/image.js":"var ImageMod,$builtinmodule;ImageMod||(ImageMod={},ImageMod.canvasLib=[]),$builtinmodule=function(){var a,b,c,d,e,f,g,h={__name__:new Sk.builtin.str(\"image\")};return h.Image=Sk.misceval.buildClass(h,function(a,b){var c=Math.floor;e=function(a){a.width=a.image.width,a.height=a.image.height,a.delay=0,a.updateCount=0,a.updateInterval=1,a.lastx=0,a.lasty=0,a.canvas=document.createElement(\"canvas\"),a.canvas.height=a.height,a.canvas.width=a.width,a.ctx=a.canvas.getContext(\"2d\"),a.ctx.drawImage(a.image,0,0),a.imagedata=a.ctx.getImageData(0,0,a.width,a.height)},b.__init__=new Sk.builtin.func(function(a,b){var c;Sk.builtin.pyCheckArgsLen(\"__init__\",arguments.length,2,2);try{a.image=document.getElementById(Sk.ffi.remapToJs(b)),e(a)}catch(b){a.image=null}if(null==a.image)return c=new Sk.misceval.Suspension,c.resume=function(){if(c.data.error)throw new Sk.builtin.IOError(c.data.error.message)},c.data={type:\"Sk.promise\",promise:new Promise(function(c,d){var f=new Image;f.crossOrigin=\"\",f.onerror=function(){d(Error(\"Failed to load URL: \"+f.src))},f.onload=function(){a.image=this,e(a),c()},f.src=g(b)})},c}),g=function(a){var b,c,d=\"function\"==typeof Sk.imageProxy?Sk.imageProxy:function(a){return b=document.createElement(\"a\"),b.href=c,window.location.host===b.host?a:Sk.imageProxy+\"/\"+a};return c=Sk.ffi.remapToJs(a),c=d(c),c},f=function(a,b,c){if(0>b||0>c||b>=a.width||c>=a.height)throw new Sk.builtin.ValueError(\"Pixel index out of range.\")};var i=function(a,b,c){var d;Sk.builtin.pyCheckArgsLen(\"setdelay\",arguments.length,2,3),a.delay=Sk.ffi.remapToJs(b),d=Sk.builtin.asnum$(c),a.updateInterval=d?d:1};b.set_delay=new Sk.builtin.func(i),b.setDelay=new Sk.builtin.func(i);var j=function(a){var b,d=[];for(Sk.builtin.pyCheckArgsLen(\"getpixels\",arguments.length,1,1),b=0;b<a.image.height*a.image.width;b++)d[b]=Sk.misceval.callsimArray(a.getPixel,[a,b%a.image.width,c(b/a.image.width)]);return new Sk.builtin.tuple(d)};b.get_pixels=new Sk.builtin.func(j),b.getPixels=new Sk.builtin.func(j),b.getData=new Sk.builtin.func(function(a){var b,d,e,g,h,j,k,l=[];for(Sk.builtin.pyCheckArgsLen(\"getData\",arguments.length,1,1),b=0;b<a.image.height*a.image.width;b++)d=b%a.image.width,e=c(b/a.image.width),f(a,d,e),k=4*e*a.width+4*d,g=a.imagedata.data[k],h=a.imagedata.data[k+1],j=a.imagedata.data[k+2],l[b]=new Sk.builtin.tuple([new Sk.builtin.int_(g),new Sk.builtin.int_(h),new Sk.builtin.int_(j)]);return new Sk.builtin.list(l)});var k=function(a,b,c){var d,e,g,i;return Sk.builtin.pyCheckArgsLen(\"getpixel\",arguments.length,3,3),b=Sk.builtin.asnum$(b),c=Sk.builtin.asnum$(c),f(a,b,c),i=4*c*a.width+4*b,d=a.imagedata.data[i],g=a.imagedata.data[i+1],e=a.imagedata.data[i+2],Sk.misceval.callsimArray(h.Pixel,[d,g,e,b,c])};b.get_pixel=new Sk.builtin.func(k),b.getPixel=new Sk.builtin.func(k),d=function(a,b,c){var d=new Sk.misceval.Suspension;return d.resume=function(){return Sk.builtin.none.none$},d.data={type:\"Sk.promise\",promise:new Promise(function(d){var e=Math.max,f=Math.abs,g=Math.min;a.updateCount++,0==a.updateCount%a.updateInterval?(a.lastx+a.updateInterval>=a.width?a.lastCtx.putImageData(a.imagedata,a.lastUlx,a.lastUly,0,a.lasty,a.width,2):a.lasty+a.updateInterval>=a.height?a.lastCtx.putImageData(a.imagedata,a.lastUlx,a.lastUly,a.lastx,0,2,a.height):a.lastCtx.putImageData(a.imagedata,a.lastUlx,a.lastUly,g(b,a.lastx),g(c,a.lasty),e(f(b-a.lastx),1),e(f(c-a.lasty),1)),a.lastx=b,a.lasty=c,0<a.delay?window.setTimeout(d,a.delay):d()):d()})},d};var l=function(a,b,c,e){var g;return Sk.builtin.pyCheckArgsLen(\"setpixel\",arguments.length,4,4),b=Sk.builtin.asnum$(b),c=Sk.builtin.asnum$(c),f(a,b,c),g=4*c*a.width+4*b,a.imagedata.data[g]=Sk.builtin.asnum$(Sk.misceval.callsimArray(e.getRed,[e])),a.imagedata.data[g+1]=Sk.builtin.asnum$(Sk.misceval.callsimArray(e.getGreen,[e])),a.imagedata.data[g+2]=Sk.builtin.asnum$(Sk.misceval.callsimArray(e.getBlue,[e])),a.imagedata.data[g+3]=255,d(a,b,c)};b.set_pixel=new Sk.builtin.func(l),b.setPixel=new Sk.builtin.func(l);var m=function(a,b,e){var g,h,i;return Sk.builtin.pyCheckArgsLen(\"setpixelat\",arguments.length,3,3),b=Sk.builtin.asnum$(b),g=b%a.image.width,h=c(b/a.image.width),f(a,g,h),i=4*h*a.width+4*g,a.imagedata.data[i]=Sk.builtin.asnum$(Sk.misceval.callsimArray(e.getRed,[e])),a.imagedata.data[i+1]=Sk.builtin.asnum$(Sk.misceval.callsimArray(e.getGreen,[e])),a.imagedata.data[i+2]=Sk.builtin.asnum$(Sk.misceval.callsimArray(e.getBlue,[e])),a.imagedata.data[i+3]=255,d(a,g,h)};b.set_pixel_at=new Sk.builtin.func(m),b.setPixelAt=new Sk.builtin.func(m);var n=function(a,b){var c,e,g;return Sk.builtin.pyCheckArgsLen(\"updatepixel\",arguments.length,2,2),c=Sk.builtin.asnum$(Sk.misceval.callsimArray(b.getX,[b])),e=Sk.builtin.asnum$(Sk.misceval.callsimArray(b.getY,[b])),f(a,c,e),g=4*e*a.width+4*c,a.imagedata.data[g]=Sk.builtin.asnum$(Sk.misceval.callsimArray(b.getRed,[b])),a.imagedata.data[g+1]=Sk.builtin.asnum$(Sk.misceval.callsimArray(b.getGreen,[b])),a.imagedata.data[g+2]=Sk.builtin.asnum$(Sk.misceval.callsimArray(b.getBlue,[b])),a.imagedata.data[g+3]=255,d(a,c,e)};b.update_pixel=new Sk.builtin.func(n),b.updatePixel=new Sk.builtin.func(n);var o=function(a){return Sk.builtin.pyCheckArgsLen(\"getheight\",arguments.length,1,1),new Sk.builtin.int_(a.height)};b.get_height=new Sk.builtin.func(o),b.getHeight=new Sk.builtin.func(o);var p=function(a){return Sk.builtin.pyCheckArgsLen(\"getwidth\",arguments.length,1,1),new Sk.builtin.int_(a.width)};b.get_width=new Sk.builtin.func(p),b.getWidth=new Sk.builtin.func(p),b.__getattr__=new Sk.builtin.func(function(a,b){return(b=Sk.ffi.remapToJs(b),\"height\"===b)?Sk.builtin.assk$(a.height):\"width\"===b?Sk.builtin.assk$(a.width):void 0}),b.__setattr__=new Sk.builtin.func(function(a,b){if(b=Sk.ffi.remapToJs(b),\"height\"===b||\"width\"===b)throw new Sk.builtin.Exception(\"Cannot change height or width they can only be set on creation\");else throw new Sk.builtin.Exception(\"Unknown attribute: \"+b)}),b.draw=new Sk.builtin.func(function(a,b,c,d){var e;return Sk.builtin.pyCheckArgsLen(\"draw\",arguments.length,2,4),e=new Sk.misceval.Suspension,e.resume=function(){return Sk.builtin.none.none$},e.data={type:\"Sk.promise\",promise:new Promise(function(e){var f,g;b=Sk.builtin.asnum$(b),c=Sk.builtin.asnum$(c),d=Sk.builtin.asnum$(d),f=Sk.misceval.callsimArray(b.getWin,[b]),g=f.getContext(\"2d\"),void 0===c&&(c=0,d=0),a.lastUlx=c,a.lastUly=d,a.lastCtx=g,g.putImageData(a.imagedata,c,d),0<a.delay?window.setTimeout(e,a.delay):window.setTimeout(e,200)})},e})},\"Image\",[]),c=function(a,b){b.__init__=new Sk.builtin.func(function(a,b,c){Sk.builtin.pyCheckArgsLen(\"__init__\",arguments.length,3,3),a.width=Sk.builtin.asnum$(b),a.height=Sk.builtin.asnum$(c),a.canvas=document.createElement(\"canvas\"),a.ctx=a.canvas.getContext(\"2d\"),a.canvas.height=a.height,a.canvas.width=a.width,a.imagedata=a.ctx.getImageData(0,0,a.width,a.height)})},h.EmptyImage=Sk.misceval.buildClass(h,c,\"EmptyImage\",[h.Image]),b=function(a,b){b.__init__=new Sk.builtin.func(function(a,c,d,e,b,f){Sk.builtin.pyCheckArgsLen(\"__init__\",arguments.length,4,6),a.red=Sk.builtin.asnum$(c),a.green=Sk.builtin.asnum$(d),a.blue=Sk.builtin.asnum$(e),a.x=Sk.builtin.asnum$(b),a.y=Sk.builtin.asnum$(f)});var c=function(a){return Sk.builtin.pyCheckArgsLen(\"getred\",arguments.length,1,1),Sk.builtin.assk$(a.red)};b.get_red=new Sk.builtin.func(c),b.getRed=new Sk.builtin.func(c);var d=function(a){return Sk.builtin.pyCheckArgsLen(\"getgreen\",arguments.length,1,1),Sk.builtin.assk$(a.green)};b.get_green=new Sk.builtin.func(d),b.getGreen=new Sk.builtin.func(d);var e=function(a){return Sk.builtin.pyCheckArgsLen(\"getblue\",arguments.length,1,1),Sk.builtin.assk$(a.blue)};b.get_blue=new Sk.builtin.func(e),b.getBlue=new Sk.builtin.func(e);var f=function(a){return Sk.builtin.pyCheckArgsLen(\"getx\",arguments.length,1,1),Sk.builtin.assk$(a.x)};b.get_x=new Sk.builtin.func(f),b.getX=new Sk.builtin.func(f);var g=function(a){return Sk.builtin.pyCheckArgsLen(\"gety\",arguments.length,1,1),Sk.builtin.assk$(a.y)};b.get_y=new Sk.builtin.func(g),b.getY=new Sk.builtin.func(g);var h=function(a,b){Sk.builtin.pyCheckArgsLen(\"setred\",arguments.length,2,2),a.red=Sk.builtin.asnum$(b)};b.set_red=new Sk.builtin.func(h),b.setRed=new Sk.builtin.func(h);var i=function(a,b){Sk.builtin.pyCheckArgsLen(\"setgreen\",arguments.length,2,2),a.green=Sk.builtin.asnum$(b)};b.set_green=new Sk.builtin.func(i),b.setGreen=new Sk.builtin.func(i);var j=function(a,c){Sk.builtin.pyCheckArgsLen(\"setblue\",arguments.length,2,2),a.blue=Sk.builtin.asnum$(c)};b.set_blue=new Sk.builtin.func(j),b.setBlue=new Sk.builtin.func(j),b.__getattr__=new Sk.builtin.func(function(a,b){return(b=Sk.ffi.remapToJs(b),\"red\"===b)?Sk.builtin.assk$(a.red):\"green\"===b?Sk.builtin.assk$(a.green):\"blue\"===b?Sk.builtin.assk$(a.blue):void 0}),b.__setattr__=new Sk.builtin.func(function(a,b,c){b=Sk.ffi.remapToJs(b),(\"red\"===b||\"green\"===b||\"blue\"===b)&&(a[b]=Sk.builtin.asnum$(c))});var k=function(a,b){Sk.builtin.pyCheckArgsLen(\"setx\",arguments.length,2,2),a.x=Sk.builtin.asnum$(b)};b.set_x=new Sk.builtin.func(k),b.setX=new Sk.builtin.func(k);var l=function(a,b){Sk.builtin.pyCheckArgsLen(\"sety\",arguments.length,2,2),a.y=Sk.builtin.asnum$(b)};b.set_y=new Sk.builtin.func(l),b.setY=new Sk.builtin.func(l),b.__getitem__=new Sk.builtin.func(function(a,b){return(b=Sk.builtin.asnum$(b),0===b)?a.red:1==b?a.green:2==b?a.blue:void 0}),b.__str__=new Sk.builtin.func(function(a){return Sk.ffi.remapToPy(\"[\"+a.red+\",\"+a.green+\",\"+a.blue+\"]\")}),b.getColorTuple=new Sk.builtin.func(function(){}),b.setRange=new Sk.builtin.func(function(a,b){a.max=Sk.builtin.asnum$(b)})},h.Pixel=Sk.misceval.buildClass(h,b,\"Pixel\",[]),a=function(a,b){b.__init__=new Sk.builtin.func(function(a,b,c){var d,e,f;Sk.builtin.pyCheckArgsLen(\"__init__\",arguments.length,1,3),d=ImageMod.canvasLib[Sk.canvas],void 0===d?(e=document.createElement(\"canvas\"),f=document.getElementById(Sk.canvas),a.theScreen=e,f.appendChild(e),ImageMod.canvasLib[Sk.canvas]=e,ImageMod.canvasLib[Sk.canvas]=a.theScreen):(a.theScreen=d,a.theScreen.height=a.theScreen.height),void 0===b?(Sk.availableHeight&&(a.theScreen.height=Sk.availableHeight),Sk.availableWidth&&(a.theScreen.width=Sk.availableWidth)):(a.theScreen.height=c.v,a.theScreen.width=b.v),a.theScreen.style.display=\"block\"}),b.getWin=new Sk.builtin.func(function(a){return a.theScreen}),b.exitonclick=new Sk.builtin.func(function(a){var b=a.theScreen.id;a.theScreen.onclick=function(){document.getElementById(b).style.display=\"none\",document.getElementById(b).onclick=null,delete ImageMod.canvasLib[b]}})},h.ImageWin=Sk.misceval.buildClass(h,a,\"ImageWin\",[]),h};","src/lib/imaplib.py":"raise NotImplementedError(\"imaplib is not yet implemented in Skulpt\")\n","src/lib/imghdr.py":"raise NotImplementedError(\"imghdr is not yet implemented in Skulpt\")\n","src/lib/imputil.py":"raise NotImplementedError(\"imputil is not yet implemented in Skulpt\")\n","src/lib/io.py":"raise NotImplementedError(\"io is not yet implemented in Skulpt\")\n","src/lib/itertools.js":"Sk.builtin.itertools_gen=function(a,b,c,d,e){Sk.builtin.generator.call(this,a,b,c,d,e)},Sk.builtin.itertools_gen.prototype=Object.create(Sk.builtin.generator.prototype),Sk.builtin.itertools_gen.prototype.$r=function(){return new Sk.builtin.str(\"<itertools.\"+this.func_code.co_name.v+\" object>\")},Sk.builtin.itertools_repeat=function(a,b,c,d,e){Sk.builtin.generator.call(this,a,b,c,d,e)},Sk.builtin.itertools_repeat.prototype=Object.create(Sk.builtin.generator.prototype),Sk.builtin.itertools_repeat.prototype.$r=function(){return object_repr=this.gi$locals.object.$r().$jsstr(),times=this.gi$locals.times,times_repr=void 0===times?\"\":\", \"+times,new Sk.builtin.str(this.func_code.co_name.v+\"(\"+object_repr+times_repr+\")\")},Sk.builtin.itertools_count=function(a,b,c,d,e){Sk.builtin.generator.call(this,a,b,c,d,e)},Sk.builtin.itertools_count.prototype=Object.create(Sk.builtin.generator.prototype),Sk.builtin.itertools_count.prototype.$r=function(){return start_repr=this.gi$locals.n.$r().$jsstr(),step_repr=this.gi$locals.step.$r().$jsstr(),step_repr=\"1\"===step_repr?\"\":\", \"+step_repr,new Sk.builtin.str(this.func_code.co_name.v+\"(\"+start_repr+step_repr+\")\")};var $builtinmodule=function(){var a={},b=function(a){const b=a.gi$locals.it,c=a.gi$locals.func;let d=a.gi$locals.total;const e=a.gi$locals.initial;return e?(d=Sk.builtin.checkNone(d)?b.tp$iternext():d,a.gi$locals.total=d,a.gi$locals.initial=!1,[,d]):(element=b.tp$iternext(),void 0===element?[,]:(d=c.tp$call?c.tp$call([d,element],void 0):Sk.misceval.applyOrSuspend(c,void 0,void 0,void 0,[d,element]),a.gi$locals.total=d,[,d]))},c=function(c,d,e){Sk.builtin.pyCheckArgsLen(\"accumulate\",arguments.length,1,3,!0);const f=Sk.abstr.iter(c);return new Sk.builtin.itertools_gen(b,a,[f,d,e,!0])};const d=new Sk.builtin.func(function(c,a){return Sk.abstr.numberBinOp(c,a,\"Add\")});b.co_name=new Sk.builtin.str(\"accumulate\"),b.co_varnames=[\"it\",\"func\",\"total\",\"initial\"],c.$defaults=[d],c.co_name=new Sk.builtin.str(\"accumulate\"),c.co_argcount=2,c.co_kwonlyargcount=1,c.$kwdefs=[Sk.builtin.none.none$],c.co_varnames=[\"iterable\",\"func\",\"initial\"],a.accumulate=new Sk.builtin.func(c),_chain_gen=function(a){const b=a.gi$locals.iterables;let c,d=a.gi$locals.current_it,e=a.gi$locals.made_iter;for(;void 0===c;){if(void 0===d)return[,];e||(d=Sk.abstr.iter(d),e=!0),c=d.tp$iternext(),void 0===c&&(d=b.tp$iternext(),e=!1)}return a.gi$locals.current_it=d,a.gi$locals.made_iter=e,[,c]},_chain=function(){let b=Array.from(arguments);b=Sk.abstr.iter(Sk.builtin.list(b));const c=b.tp$iternext();return new Sk.builtin.itertools_gen(_chain_gen,a,[b,c])},_chain_from_iterable=function(b){Sk.builtin.pyCheckArgsLen(\"from_iterable\",arguments.length,1,1),b=Sk.abstr.iter(b);const c=b.tp$iternext();return new Sk.builtin.itertools_gen(_chain_gen,a,[b,c])},Sk.builtin.chain_func=function(a){Sk.builtin.func.call(this,a),this.$d.from_iterable=new Sk.builtin.func(_chain_from_iterable)},Sk.builtin.chain_func.prototype=Object.create(Sk.builtin.func.prototype),_chain_from_iterable.co_name=new Sk.builtin.str(\"from_iterable\"),_chain.co_name=new Sk.builtin.str(\"chain\"),_chain_gen.co_name=new Sk.builtin.str(\"chain\"),_chain_gen.co_varnames=[\"iterables\",\"current_it\"],a.chain=new Sk.builtin.chain_func(_chain);var e=function(a){const b=a.gi$locals.indices,c=a.gi$locals.pool,d=a.gi$locals.n,e=a.gi$locals.r,f=a.gi$locals.initial;if(e>d)return[,];if(void 0===f)return a.gi$locals.initial=!1,[,new Sk.builtin.tuple(c.slice(0,e))];let g,h=!1;for(g=e-1;0<=g;g--)if(b[g]!=g+d-e){h=!0;break}if(!h)return a.gi$locals.r=0,[,];b[g]++;for(let c=g+1;c<e;c++)b[c]=b[c-1]+1;const k=b.map(a=>c[a]);return[,new Sk.builtin.tuple(k)]},f=function(b,c){Sk.builtin.pyCheckArgsLen(\"combinations\",arguments.length,2,2);const d=Sk.misceval.arrayFromIterable(b);Sk.builtin.pyCheckType(\"r\",\"int\",Sk.builtin.checkInt(c));const f=d.length;if(c=Sk.builtin.asnum$(c),0>c)throw new Sk.builtin.ValueError(\"r must be non-negative\");const g=Array(c).fill().map((a,b)=>b);return new Sk.builtin.itertools_gen(e,a,[g,d,f,c])};e.co_name=new Sk.builtin.str(\"combinations\"),e.co_varnames=[\"indices\",\"pool\",\"n\",\"r\"],f.co_name=new Sk.builtin.str(\"combinations\"),f.co_varnames=[\"iterable\",\"r\"],a.combinations=new Sk.builtin.func(f);var g=function(a){const b=a.gi$locals.indices,c=a.gi$locals.pool,d=a.gi$locals.n,e=a.gi$locals.r,f=a.gi$locals.initial;if(e&&!d)return[,];if(void 0===f){const d=b.map(a=>c[a]);return a.gi$locals.initial=!1,[,new Sk.builtin.tuple(d)]}let g,h=!1;for(g=e-1;0<=g;g--)if(b[g]!=d-1){h=!0;break}if(!h)return a.gi$locals.r=0,[,];const k=b[g]+1;for(let c=g;c<e;c++)b[c]=k;const l=b.map(a=>c[a]);return[,new Sk.builtin.tuple(l)]},h=function(b,c){Sk.builtin.pyCheckArgsLen(\"combinations\",arguments.length,2,2);const d=Sk.misceval.arrayFromIterable(b);Sk.builtin.pyCheckType(\"r\",\"int\",Sk.builtin.checkInt(c));const e=d.length;if(c=Sk.builtin.asnum$(c),0>c)throw new Sk.builtin.ValueError(\"r must be non-negative\");const f=Array(c).fill(0);return new Sk.builtin.itertools_gen(g,a,[f,d,e,c])};g.co_name=new Sk.builtin.str(\"combinations_with_replacement\"),g.co_varnames=[\"indices\",\"pool\",\"n\",\"r\"],h.co_name=new Sk.builtin.str(\"combinations_with_replacement\"),h.co_varnames=[\"iterable\",\"r\"],a.combinations_with_replacement=new Sk.builtin.func(h),_compress_gen=function(a){const b=a.gi$locals.data,c=a.gi$locals.selectors;let e=b.tp$iternext(),f=c.tp$iternext();for(;void 0!==e&&void 0!==f;){if(Sk.misceval.isTrue(f))return[,e];e=b.tp$iternext(),f=c.tp$iternext()}return[,]},_compress=function(b,c){return Sk.builtin.pyCheckArgsLen(\"compress\",arguments.length,2,2),b=Sk.abstr.iter(b),c=Sk.abstr.iter(c),new Sk.builtin.itertools_gen(_compress_gen,a,[b,c])},_compress_gen.co_name=new Sk.builtin.str(\"compress\"),_compress_gen.co_varnames=[\"data\",\"selectors\"],_compress.co_name=new Sk.builtin.str(\"compress\"),_compress.co_varnames=[\"data\",\"selectors\"],a.compress=new Sk.builtin.func(_compress);var i=function(a){const b=a.gi$locals.n,c=a.gi$locals.step;try{return[,b]}finally{a.gi$locals.n=Sk.abstr.numberInplaceBinOp(b,c,\"Add\")}},k=function(b,c){if(Sk.builtin.pyCheckArgsLen(\"count\",arguments.length,0,2),!Sk.builtin.checkNumber(b)&&!Sk.builtin.checkComplex(b))throw new Sk.builtin.TypeError(\"a number is required\");if(!Sk.builtin.checkNumber(c)&&!Sk.builtin.checkComplex(c))throw new Sk.builtin.TypeError(\"a number is required\");return new Sk.builtin.itertools_count(i,a,[b,c])};k.co_name=new Sk.builtin.str(\"count\"),k.$defaults=[new Sk.builtin.int_(0),new Sk.builtin.int_(1)],k.co_varnames=[\"start\",\"step\"],i.co_name=new Sk.builtin.str(\"count\"),i.co_varnames=[\"n\",\"step\"],a.count=new Sk.builtin.func(k);var l=function(a){let b,c,d;return b=a.gi$locals.iter,c=a.gi$locals.saved,d=b.tp$iternext(),void 0===d?c.length?(d=c.shift(),c.push(d),[,d]):[,]:(c.push(d),[,d])},m=function(b){Sk.builtin.pyCheckArgsLen(\"cycle\",arguments.length,1,1),b=Sk.abstr.iter(b);return new Sk.builtin.itertools_gen(l,a,[b,[]])};m.co_name=new Sk.builtin.str(\"cycle\"),l.co_name=new Sk.builtin.str(\"cycle\"),l.co_varnames=[\"iter\",\"saved\"],a.cycle=new Sk.builtin.func(m);var n=function(a){const b=a.gi$locals.predicate,c=a.gi$locals.it,d=a.gi$locals.passed;let e=c.tp$iternext();for(;void 0===d&&void 0!==e;){const d=b.tp$call?b.tp$call([e],void 0):Sk.misceval.applyOrSuspend(b,void 0,void 0,void 0,[e]);if(!Sk.misceval.isTrue(d))return a.gi$locals.passed=!0,[,e];e=c.tp$iternext()}return[,e]};_dropwhile=function(b,c){Sk.builtin.pyCheckArgsLen(\"dropwhile\",arguments.length,2,2);const d=Sk.abstr.iter(c);return new Sk.builtin.itertools_gen(n,a,[b,d])},n.co_name=new Sk.builtin.str(\"dropwhile\"),n.co_varnames=[\"predicate\",\"it\"],_dropwhile.co_name=new Sk.builtin.str(\"dropwhile\"),_dropwhile.co_varnames=[\"predicate\",\"iterable\"],a.dropwhile=new Sk.builtin.func(_dropwhile);var o=function(a){const b=a.gi$locals.predicate;let c=a.gi$locals.it;const d=a.gi$locals.initial;void 0===d&&(a.gi$locals.it=Sk.abstr.iter(c),c=a.gi$locals.it,a.gi$locals.initial=!1);let e=c.tp$iternext();if(void 0===e)return[,];for(let d=b.tp$call?b.tp$call([e],void 0):Sk.misceval.applyOrSuspend(b,void 0,void 0,void 0,[e]);Sk.misceval.isTrue(d);){if(e=c.tp$iternext(),void 0===e)return[,];d=b.tp$call?b.tp$call([e],void 0):Sk.misceval.applyOrSuspend(b,void 0,void 0,void 0,[e])}return[,e]};_filterfalse=function(b,c){if(Sk.builtin.pyCheckArgsLen(\"filterfalse\",arguments.length,2,2),!Sk.builtin.checkIterable(c))throw new Sk.builtin.TypeError(\"'\"+Sk.abstr.typeName(c)+\"' object is not iterable\");return b=Sk.builtin.checkNone(b)?Sk.builtin.bool:b,new Sk.builtin.itertools_gen(o,a,[b,c])},o.co_name=new Sk.builtin.str(\"filterfalse\"),o.co_varnames=[\"predicate\",\"it\"],_filterfalse.co_name=new Sk.builtin.str(\"filterfalse\"),_filterfalse.co_varnames=[\"predicate\",\"iterable\"],a.filterfalse=new Sk.builtin.func(_filterfalse),_grouper=function(a){const b=a.gi$locals.groupby_gen,c=a.gi$locals.tgtkey,d=a.gi$locals.id;let e=b.gi$locals.currval,f=b.gi$locals.currkey;const g=b.gi$locals.keyfunc,h=b.gi$locals.it,i=b.gi$locals.id,k=Sk.misceval.richCompareBool(f,c,\"Eq\",!0);if(i===d&&k)try{return[,e]}finally{e=h.tp$iternext(),void 0!==e&&(f=g.tp$call?g.tp$call([e],void 0):Sk.misceval.applyOrSuspend(g,void 0,void 0,void 0,[e])),b.gi$locals.currkey=f,b.gi$locals.currval=e}return[,]},_groupby_gen=function(b){const c=b.gi$locals.tgtkey;let d=b.gi$locals.currval,e=b.gi$locals.currkey;const f=b.gi$locals.keyfunc,g=b.gi$locals.it;b.gi$locals.id={};for(let a=Sk.misceval.richCompareBool(e,c,\"Eq\",!0);a;){if(d=g.tp$iternext(),void 0===d)return[,];e=f.tp$call?f.tp$call([d],void 0):Sk.misceval.applyOrSuspend(f,void 0,void 0,void 0,[d]),a=Sk.misceval.richCompareBool(e,c,\"Eq\",!0)}b.gi$locals.tgtkey=b.gi$locals.currkey=e,b.gi$locals.currval=d;const h=new Sk.builtin.itertools_gen(_grouper,a,[b,b.gi$locals.tgtkey,b.gi$locals.id]);return[,new Sk.builtin.tuple([e,h])]},_groupby=function(b,c){Sk.builtin.pyCheckArgsLen(\"groupby\",arguments.length,1,2),b=Sk.abstr.iter(b),Sk.builtin.checkNone(c)&&(c=new Sk.builtin.func(function(a){return a}));const d=currkey=tgtkey=Sk.builtin.object();return new Sk.builtin.itertools_gen(_groupby_gen,a,[b,c,d,currkey,tgtkey])},_groupby_gen.co_name=new Sk.builtin.str(\"groupby\"),_groupby_gen.co_varnames=[\"it\",\"keyfunc\",\"currval\",\"currkey\",\"tgtkey\"],_groupby.co_name=new Sk.builtin.str(\"groupby\"),_groupby.$defaults=[Sk.builtin.none.none$],_groupby.co_varnames=[\"iterable\",\"key\"],_grouper.co_name=new Sk.builtin.str(\"_grouper\"),_grouper.co_varnames=[\"groupby_gen\",\"tgtkey\",\"id\"],a.groupby=new Sk.builtin.func(_groupby);var p=function(a){let b,c,d,e,f;if(b=a.gi$locals.iter,c=a.gi$locals.previt,d=a.gi$locals.stop,e=a.gi$locals.step,f=a.gi$locals.initial,void 0===f){if(a.gi$locals.initial=!1,c>=d){for(let a=0;a<d;a++)b.tp$iternext();return[,]}for(let a=0;a<c;a++)b.tp$iternext();return[,b.tp$iternext()]}if(c+e>=d){for(let f=c+1;f<d;f++)a.gi$locals.previt=c+e,b.tp$iternext();return[,]}for(let d=c+1;d<c+e;d++)b.tp$iternext();return a.gi$locals.previt=c+e,[,b.tp$iternext()]},q=function(b,c,d,e){var f=Number.MAX_SAFE_INTEGER;if(Sk.builtin.pyCheckArgsLen(\"islice\",arguments.length,2,4),b=Sk.abstr.iter(b),void 0===d?(d=c,c=Sk.builtin.none.none$,e=Sk.builtin.none.none$):void 0===e&&(e=Sk.builtin.none.none$),!(Sk.builtin.checkNone(d)||Sk.misceval.isIndex(d)))throw new Sk.builtin.ValueError(\"Stop for islice() must be None or an integer: 0 <= x <= sys.maxsize.\");else if(d=Sk.builtin.checkNone(d)?f:Sk.misceval.asIndex(d),0>d||d>f)throw new Sk.builtin.ValueError(\"Stop for islice() must be None or an integer: 0 <= x <= sys.maxsize.\");if(!(Sk.builtin.checkNone(c)||Sk.misceval.isIndex(c)))throw new Sk.builtin.ValueError(\"Indices for islice() must be None or an integer: 0 <= x <= sys.maxsize.\");else if(c=Sk.builtin.checkNone(c)?0:Sk.misceval.asIndex(c),0>c||c>f)throw new Sk.builtin.ValueError(\"Indices for islice() must be None or an integer: 0 <= x <= sys.maxsize.\");if(!(Sk.builtin.checkNone(e)||Sk.misceval.isIndex(e)))throw new Sk.builtin.ValueError(\"Step for islice() must be a positive integer or None\");else if(e=Sk.builtin.checkNone(e)?1:Sk.misceval.asIndex(e),0>=e||e>f)throw new Sk.builtin.ValueError(\"Step for islice() must be a positive integer or None.\");const g=c;return new Sk.builtin.itertools_gen(p,a,[b,g,d,e])};p.co_varnames=[\"iter\",\"previt\",\"stop\",\"step\"],p.co_name=new Sk.builtin.str(\"islice\"),q.co_name=new Sk.builtin.str(\"islice\"),a.islice=new Sk.builtin.func(q);var s=function(a){const b=a.gi$locals.indices,c=a.gi$locals.cycles,d=a.gi$locals.pool,e=a.gi$locals.n,f=a.gi$locals.r,g=a.gi$locals.initial;if(f>e)return[,];if(void 0===g)return a.gi$locals.initial=!1,[,new Sk.builtin.tuple(d.slice(0,f))];for(let g=f-1;0<=g;g--)if(c[g]--,0==c[g])b.push(b.splice(g,1)[0]),c[g]=e-g;else{j=c[g],[b[g],b[e-j]]=[b[e-j],b[g]];const a=b.map(a=>d[a]).slice(0,f);return[,new Sk.builtin.tuple(a)]}return a.gi$locals.r=0,[,]},t=function(b,c){Sk.builtin.pyCheckArgsLen(\"permutations\",arguments.length,1,2);const d=Sk.misceval.arrayFromIterable(b),e=d.length;if(c=Sk.builtin.checkNone(c)?new Sk.builtin.int_(e):c,Sk.builtin.pyCheckType(\"r\",\"int\",Sk.builtin.checkInt(c)),c=Sk.builtin.asnum$(c),0>c)throw new Sk.builtin.ValueError(\"r must be non-negative\");const f=Array(e).fill().map((a,b)=>b),g=Array(c).fill().map((a,b)=>e-b);return new Sk.builtin.itertools_gen(s,a,[f,g,d,e,c])};s.co_name=new Sk.builtin.str(\"permutations\"),s.co_varnames=[\"indices\",\"cycles\",\"pool\",\"n\",\"r\"],t.co_name=new Sk.builtin.str(\"permutations\"),t.co_varnames=[\"iterable\",\"r\"],t.$defaults=[Sk.builtin.none.none$],a.permutations=new Sk.builtin.func(t);var u=function(a){const b=a.gi$locals.pools,c=a.gi$locals.pool_sizes,d=a.gi$locals.n,e=a.gi$locals.indices,f=a.gi$locals.initial;if(void 0===f){a.gi$locals.initial=!1;const c=e.map((a,c)=>b[c][e[c]]);return c.some(a=>void 0===a)?(a.gi$locals.n=0,[,]):[,new Sk.builtin.tuple(c)]}for(let b=d-1;0<=b&&b<d;)e[b]++,e[b]>=c[b]?(e[b]=-1,b--):b++;if(!d||e.every(a=>-1===a))return a.gi$locals.n=0,[,];else{const a=e.map((a,c)=>b[c][e[c]]);return[,new Sk.builtin.tuple(a)]}},v=function(b,c){if(Sk.builtin.pyCheckArgsLen(\"product\",arguments.length,0,1/0,!0),Sk.builtin.pyCheckType(\"repeat\",\"integer\",Sk.builtin.checkInt(b)),b=Sk.builtin.asnum$(b),0>b)throw new Sk.builtin.ValueError(\"repeat argument cannot be negative\");c=c.v;for(let a=0;a<c.length;a++){if(!Sk.builtin.checkIterable(c[a]))throw new Sk.builtin.TypeError(\"'\"+Sk.abstr.typeName(c[a])+\"' object is not iterable\");c[a]=Sk.misceval.arrayFromIterable(c[a])}const d=[].concat(...Array(b).fill(c)),e=d.length,f=d.map(a=>a.length),g=Array(e).fill(0);return new Sk.builtin.itertools_gen(u,a,[d,f,e,g])};u.co_name=new Sk.builtin.str(\"product\"),u.co_varnames=[\"pools\",\"pool_sizes\",\"n\",\"indices\"],v.co_name=new Sk.builtin.str(\"product\"),v.co_kwonlyargcount=1,v.co_argcount=0,v.co_varnames=[\"repeat\"],v.co_varargs=1,v.$kwdefs=[new Sk.builtin.int_(1)],a.product=new Sk.builtin.func(v);var w=function(a){const b=a.gi$locals.times,c=a.gi$locals.object;return void 0===b?[,c]:0<b?(a.gi$locals.times=b-1,[,c]):[,]},x=function(b,c){return Sk.builtin.pyCheckArgsLen(\"repeat\",arguments.length,1,2),Sk.builtin.checkNone(c)?c=void 0:(Sk.builtin.pyCheckType(\"times\",\"integer\",Sk.builtin.checkInt(c)),c=Sk.builtin.asnum$(c),c=0>c?0:c),new Sk.builtin.itertools_repeat(w,a,[b,c])};w.co_varnames=[\"object\",\"times\"],w.co_name=new Sk.builtin.str(\"repeat\"),x.co_varnames=[\"object\",\"times\"],x.co_name=new Sk.builtin.str(\"repeat\"),x.$defaults=[Sk.builtin.none.none$],a.repeat=new Sk.builtin.func(x);var y=function(a){const b=a.gi$locals.func,c=a.gi$locals.it,d=[],e=c.tp$iternext();if(void 0===e)return[,];Sk.misceval.iterFor(Sk.abstr.iter(e),function(a){d.push(a)});const f=b.tp$call?b.tp$call(d,void 0):Sk.misceval.applyOrSuspend(b,void 0,void 0,void 0,d);return[,f]};_starmap=function(b,c){return Sk.builtin.pyCheckArgsLen(\"starmap\",arguments.length,2,2),it=Sk.abstr.iter(c),b=Sk.builtin.checkNone(b)?Sk.builtin.bool:b,new Sk.builtin.itertools_gen(y,a,[b,it])},y.co_name=new Sk.builtin.str(\"starmap\"),y.co_varnames=[\"func\",\"it\"],_starmap.co_name=new Sk.builtin.str(\"starmap\"),_starmap.co_varnames=[\"func\",\"iterable\"],a.starmap=new Sk.builtin.func(_starmap);var z=function(a){const b=a.gi$locals.predicate,c=a.gi$locals.it,d=a.gi$locals.failed;let e=c.tp$iternext();if(void 0===d&&void 0!==e){const c=b.tp$call?b.tp$call([e],void 0):Sk.misceval.applyOrSuspend(b,void 0,void 0,void 0,[e]);if(Sk.misceval.isTrue(c))return[,e];a.gi$locals.failed=!0}return[,]};return _takewhile=function(b,c){return Sk.builtin.pyCheckArgsLen(\"takewhile\",arguments.length,2,2),it=Sk.abstr.iter(c),new Sk.builtin.itertools_gen(z,a,[b,it])},z.co_name=new Sk.builtin.str(\"takewhile\"),z.co_varnames=[\"predicate\",\"it\"],_takewhile.co_name=new Sk.builtin.str(\"takewhile\"),_takewhile.co_varnames=[\"predicate\",\"iterable\"],a.takewhile=new Sk.builtin.func(_takewhile),a.tee=new Sk.builtin.func(function(){throw new Sk.builtin.NotImplementedError(\"tee is not yet implemented in Skulpt\")}),_zip_longest_gen=function(a){const b=a.gi$locals.its;let c=a.gi$locals.active;const d=a.gi$locals.fillvalue;if(!c)return[,];values=[];for(let e=0;e<b.length;e++){if(val=b[e].tp$iternext(),void 0===val){if(c--,a.gi$locals.active=c,!c)return[,];b[e]=x(d,Sk.builtin.none.none$),val=d}values.push(val)}return[,new Sk.builtin.tuple(values)]},_zip_longest=function(b,c){Sk.builtin.pyCheckArgsLen(\"zip_longest\",arguments.length,0,1/0),c=c.v;for(let a=0;a<c.length;a++){const b=c[a];if(!Sk.builtin.checkIterable(b))throw new Sk.builtin.TypeError(\"zip_longest argument #\"+a+\" must support iteration\");c[a]=Sk.abstr.iter(b)}const d=c.length;return new Sk.builtin.itertools_gen(_zip_longest_gen,a,[c,d,b])},_zip_longest_gen.co_name=new Sk.builtin.str(\"zip_longest\"),_zip_longest_gen.co_varnames=[\"its\",\"active\",\"fillvalue\"],_zip_longest.co_name=new Sk.builtin.str(\"zip_longest\"),_zip_longest.co_argcount=0,_zip_longest.co_kwonlyargcount=1,_zip_longest.$kwdefs=[Sk.builtin.none.none$],_zip_longest.co_varnames=[\"fillvalue\"],_zip_longest.co_varargs=1,a.zip_longest=new Sk.builtin.func(_zip_longest),a.__doc__=new Sk.builtin.str(\"An implementation of the python itertools module in Skulpt\"),a.__package__=new Sk.builtin.str(\"\"),a};","src/lib/json/__init__.py":"raise NotImplementedError(\"json 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/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\niskeyword = frozenset(kwlist).__contains__\n\n","src/lib/lib-dynload/__init__.py":"raise NotImplementedError(\"lib-dynload is not yet implemented in Skulpt\")\n","src/lib/lib-tk/__init__.py":"raise NotImplementedError(\"lib-tk is not yet implemented in Skulpt\")\n","src/lib/lib2to3/__init__.py":"raise NotImplementedError(\"lib2to3 is not yet implemented in Skulpt\")\n","src/lib/lib2to3/fixes/__init__.py":"raise NotImplementedError(\"fixes 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/lib2to3/tests/__init__.py":"raise NotImplementedError(\"tests is not yet implemented in Skulpt\")\n","src/lib/linecache.py":"raise NotImplementedError(\"linecache is not yet implemented in Skulpt\")\n","src/lib/locale.py":"raise NotImplementedError(\"locale is not yet implemented in Skulpt\")\n","src/lib/logging/__init__.py":"raise NotImplementedError(\"logging is not yet implemented in Skulpt\")\n","src/lib/macpath.py":"raise NotImplementedError(\"macpath is not yet implemented in Skulpt\")\n","src/lib/macurl2path.py":"raise NotImplementedError(\"macurl2path is not yet implemented in Skulpt\")\n","src/lib/mailbox.py":"raise NotImplementedError(\"mailbox is not yet implemented in Skulpt\")\n","src/lib/mailcap.py":"raise NotImplementedError(\"mailcap is not yet implemented in Skulpt\")\n","src/lib/markupbase.py":"raise NotImplementedError(\"markupbase is not yet implemented in Skulpt\")\n","src/lib/math.js":"var $builtinmodule=function(){var a=Math.sqrt,b=Number.MAX_SAFE_INTEGER,c=Math.log,d=Math.exp,e=Math.pow,f=Math.log2,g=Number.isFinite,h=Math.floor,i=Math.E,j=Math.PI,k=Math.abs;function get_sign(a){return a=a?0>a?-1:1:0>1/a?-1:1,a}function isclose(c,a,b,d){Sk.builtin.pyCheckArgsLen(\"isclose\",arguments.length,2,4,!0),Sk.builtin.pyCheckType(\"a\",\"number\",Sk.builtin.checkNumber(c)),Sk.builtin.pyCheckType(\"b\",\"number\",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType(\"rel_tol\",\"number\",Sk.builtin.checkNumber(b)),Sk.builtin.pyCheckType(\"abs_tol\",\"number\",Sk.builtin.checkNumber(d));const e=Sk.builtin.asnum$(c),f=Sk.builtin.asnum$(a),g=Sk.builtin.asnum$(b),h=Sk.builtin.asnum$(d);if(0>g||0>h)throw new Sk.builtin.ValueError(\"tolerances must be non-negative\");if(e==f)return Sk.builtin.bool.true$;if(e==1/0||e==-Infinity||f==1/0||f==-Infinity)return Sk.builtin.bool.false$;const i=k(f-e),j=i<=k(g*f)||i<=k(g*e)||i<=h;return new Sk.builtin.bool(j)}var l={pi:new Sk.builtin.float_(j),e:new Sk.builtin.float_(i),tau:new Sk.builtin.float_(2*j),nan:new Sk.builtin.float_(NaN),inf:new Sk.builtin.float_(1/0),ceil:new Sk.builtin.func(function ceil(a){var b=Math.ceil;Sk.builtin.pyCheckArgsLen(\"ceil\",arguments.length,1,1),Sk.builtin.pyCheckType(\"\",\"real number\",Sk.builtin.checkNumber(a));const c=Sk.builtin.asnum$(a);return Sk.__future__.ceil_floor_int?new Sk.builtin.int_(b(c)):new Sk.builtin.float_(b(c))}),comb:new Sk.builtin.func(function(){throw new Sk.builtin.NotImplementedError(\"math.comb() is not yet implemented in Skulpt\")}),copysign:new Sk.builtin.func(function copysign(a,b){Sk.builtin.pyCheckArgsLen(\"copysign\",arguments.length,2,2),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType(\"y\",\"number\",Sk.builtin.checkNumber(b));const c=Sk.builtin.asnum$(b),d=Sk.builtin.asnum$(a),e=get_sign(d),f=get_sign(c);return new Sk.builtin.float_(d*(e*f))}),fabs:new Sk.builtin.func(function fabs(a){Sk.builtin.pyCheckArgsLen(\"fabs\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));let b=Sk.builtin.asnum$(new Sk.builtin.float_(a));return b=k(b),new Sk.builtin.float_(b)})};const m=18;return l.factorial=new Sk.builtin.func(function factorial(a){function bigup(a){Sk.builtin.asnum$nofloat(a);return new Sk.builtin.biginteger(a)}Sk.builtin.pyCheckArgsLen(\"factorial\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));let b=Sk.builtin.asnum$(a);if(a=h(b),a!=b)throw new Sk.builtin.ValueError(\"factorial() only accepts integral values\");if(0>a)throw new Sk.builtin.ValueError(\"factorial() not defined for negative numbers\");let c=1;for(let b=2;b<=a&&b<=m;b++)c*=b;if(a<=m)return new Sk.builtin.int_(c);c=bigup(c);for(var d,e=19;e<=a;e++)d=bigup(e),c=c.multiply(d);return new Sk.builtin.lng(c)}),l.floor=new Sk.builtin.func(function floor(a){return Sk.builtin.pyCheckArgsLen(\"floor\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),Sk.__future__.ceil_floor_int?new Sk.builtin.int_(h(Sk.builtin.asnum$(a))):new Sk.builtin.float_(h(Sk.builtin.asnum$(a)))}),l.fmod=new Sk.builtin.func(function fmod(a,b){Sk.builtin.pyCheckArgsLen(\"fmod\",arguments.length,2,2),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType(\"y\",\"number\",Sk.builtin.checkNumber(b));const c=Sk.builtin.asnum$(new Sk.builtin.float_(a)),d=Sk.builtin.asnum$(new Sk.builtin.float_(b));if((d==1/0||d==-Infinity)&&isFinite(c))return new Sk.builtin.float_(c);const e=c%d;if(isNaN(e)&&!isNaN(c)&&!isNaN(d))throw new Sk.builtin.ValueError(\"math domain error\");return new Sk.builtin.float_(e)}),l.frexp=new Sk.builtin.func(function frexp(a){var b=Math.max;Sk.builtin.pyCheckArgsLen(\"frexp\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));const c=Sk.builtin.asnum$(a),d=[c,0];if(0!==c&&g(c)){const a=k(c);let g=b(-1023,h(f(a))+1),i=a*e(2,-g);for(;.5>i;)i*=2,g--;for(;1<=i;)i*=.5,g++;0>c&&(i=-i),d[0]=i,d[1]=g}return d[0]=new Sk.builtin.float_(d[0]),d[1]=new Sk.builtin.int_(d[1]),new Sk.builtin.tuple(d)}),l.fsum=new Sk.builtin.func(function fsum(a){if(Sk.builtin.pyCheckArgsLen(\"fsum\",arguments.length,1,1),!Sk.builtin.checkIterable(a))throw new Sk.builtin.TypeError(\"'\"+Sk.abstr.typeName(a)+\"' object is not iterable\");let b=[];a=Sk.abstr.iter(a);let c,d,e;for(let f=a.tp$iternext();void 0!==f;f=a.tp$iternext()){Sk.builtin.pyCheckType(\"\",\"real number\",Sk.builtin.checkNumber(f)),c=0,f=Sk.builtin.asnum$(new Sk.builtin.float_(f));for(let a,g=0,h=b.length;g<h;g++){if(a=b[g],k(f)<k(a)){let b=f;f=a,a=b}d=f+a,e=a-(d-f),e&&(b[c]=e,c++),f=d}b=b.slice(0,c).concat([f])}const f=b.reduce(function(c,a){return c+a},0);return new Sk.builtin.float_(f)}),l.gcd=new Sk.builtin.func(function gcd(c,a){function _gcd(c,a){return 0==a?c:_gcd(a,c%a)}function _biggcd(c,a){return 0===a.trueCompare(Sk.builtin.biginteger.ZERO)?c:_biggcd(a,c.remainder(a))}if(Sk.builtin.pyCheckArgsLen(\"gcd\",arguments.length,2,2),Sk.builtin.pyCheckType(\"a\",\"integer\",Sk.builtin.checkInt(c)),Sk.builtin.pyCheckType(\"b\",\"integer\",Sk.builtin.checkInt(a)),c instanceof Sk.builtin.lng||a instanceof Sk.builtin.lng){let b=Sk.builtin.lng(c).biginteger,d=Sk.builtin.lng(a).biginteger,e=_biggcd(b,d);return e=e.abs(),new Sk.builtin.lng(e)}else{let b=k(Sk.builtin.asnum$(c)),d=k(Sk.builtin.asnum$(a)),e=_gcd(b,d);return e=0>e?-e:e,new Sk.builtin.int_(e)}}),(isclose.co_varnames=[\"a\",\"b\",\"rel_tol\",\"abs_tol\"],isclose.co_argcount=2,isclose.co_kwonlyargcount=2,isclose.$kwdefs=[1e-9,0],l.isclose=new Sk.builtin.func(isclose),l.isfinite=new Sk.builtin.func(function isfinite(a){Sk.builtin.pyCheckArgsLen(\"isfinite\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));const b=Sk.builtin.asnum$(a);return Sk.builtin.checkInt(a)?Sk.builtin.bool.true$:isFinite(b)?Sk.builtin.bool.true$:Sk.builtin.bool.false$}),l.isinf=new Sk.builtin.func(function isinf(a){Sk.builtin.pyCheckArgsLen(\"isinf\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));const b=Sk.builtin.asnum$(a);return Sk.builtin.checkInt(a)?Sk.builtin.bool.false$:isFinite(b)||isNaN(b)?Sk.builtin.bool.false$:Sk.builtin.bool.true$}),l.isnan=new Sk.builtin.func(function isnan(a){Sk.builtin.pyCheckArgsLen(\"isnan\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"float\",Sk.builtin.checkFloat(a));const b=Sk.builtin.asnum$(a);return isNaN(b)?Sk.builtin.bool.true$:Sk.builtin.bool.false$}),l.isqrt=new Sk.builtin.func(function issqrt(){throw new Sk.builtin.NotImplementedError(\"math.isqrt() is not yet implemented in Skulpt\")}),l.ldexp=new Sk.builtin.func(function ldexp(a,b){Sk.builtin.pyCheckArgsLen(\"ldexp\",arguments.length,2,2),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType(\"i\",\"integer\",Sk.builtin.checkInt(b));const c=Sk.builtin.asnum$(new Sk.builtin.float_(a)),d=Sk.builtin.asnum$(b);if(c==1/0||c==-Infinity||0==c||isNaN(c))return a;const f=c*e(2,d);if(!isFinite(f))throw new Sk.builtin.OverflowError(\"math range error\");return new Sk.builtin.float_(f)}),l.modf=new Sk.builtin.func(function modf(a){Sk.builtin.pyCheckArgsLen(\"modf\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));let b=Sk.builtin.asnum$(a);if(!isFinite(b)){if(b==1/0)return new Sk.builtin.tuple([new Sk.builtin.float_(0),new Sk.builtin.float_(b)]);if(b==-Infinity)return new Sk.builtin.tuple([new Sk.builtin.float_(-0),new Sk.builtin.float_(b)]);if(isNaN(b))return new Sk.builtin.tuple([new Sk.builtin.float_(b),new Sk.builtin.float_(b)])}const c=get_sign(b);b=k(b);const e=c*h(b),f=c*(b-h(b));return new Sk.builtin.tuple([new Sk.builtin.float_(f),new Sk.builtin.float_(e)])}),l.perm=new Sk.builtin.func(function perm(){throw new Sk.builtin.NotImplementedError(\"math.perm() is not yet implemented in Skulpt\")}),l.prod=new Sk.builtin.func(function prod(){throw new Sk.builtin.NotImplementedError(\"math.prod() is not yet implemented in Skulpt\")}),l.remainder=new Sk.builtin.func(function remainder(a,b){if(Sk.builtin.pyCheckArgsLen(\"reamainder\",arguments.length,2,2),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType(\"y\",\"number\",Sk.builtin.checkNumber(b)),_x=Sk.builtin.asnum$(new Sk.builtin.float_(a)),_y=Sk.builtin.asnum$(new Sk.builtin.float_(b)),isFinite(_x)&&isFinite(_y)){let a,b,d,c,e;if(0==_y)throw new Sk.builtin.ValueError(\"math domain error\");if(a=k(_x),b=k(_y),c=a%b,d=b-c,c<d)e=c;else if(c>d)e=-d;else{if(c!=d)throw new Sk.builtin.AssertionError;e=c-2*(.5*(a-c)%b)}return new Sk.builtin.float_(get_sign(_x)*e)}if(isNaN(_x))return a;if(isNaN(_y))return b;if(_x==1/0||_x==-Infinity)throw new Sk.builtin.ValueError(\"math domain error\");if(_y!=1/0&&_y!=-Infinity)throw new Sk.builtin.AssertionError;return new Sk.builtin.float_(_x)}),l.trunc=new Sk.builtin.func(function trunc(a){return Sk.builtin.pyCheckArgsLen(\"trunc\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),Sk.builtin.checkInt(a)?a:new Sk.builtin.int_(0|Sk.builtin.asnum$(a))}),l.exp=new Sk.builtin.func(function exp(a){Sk.builtin.pyCheckArgsLen(\"exp\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));const b=Sk.builtin.asnum$(new Sk.builtin.float_(a));if(b==1/0||b==-Infinity||isNaN(b))return new Sk.builtin.float_(d(b));const c=d(b);if(!isFinite(c))throw new Sk.builtin.OverflowError(\"math range error\");return new Sk.builtin.float_(c)}),l.expm1=new Sk.builtin.func(function expm1(a){Sk.builtin.pyCheckArgsLen(\"expm1\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));const b=Sk.builtin.asnum$(a);if(.7>k(b)){const a=d(b);if(1==a)return new Sk.builtin.float_(b);else{const d=(a-1)*b/c(a);return new Sk.builtin.float_(d)}}else{const a=d(b)-1;return new Sk.builtin.float_(a)}}),l.log=new Sk.builtin.func(function log(a,d){Sk.builtin.pyCheckArgsLen(\"log\",arguments.length,1,2),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));let e,f,g=Sk.builtin.asnum$(a);if(0>=g)throw new Sk.builtin.ValueError(\"math domain error\");if(void 0===d?e=i:(Sk.builtin.pyCheckType(\"base\",\"number\",Sk.builtin.checkNumber(d)),e=Sk.builtin.asnum$(d)),0>=e)throw new Sk.builtin.ValueError(\"math domain error\");else if(Sk.builtin.checkFloat(a)||g<b)f=c(g)/c(e);else{g=new Sk.builtin.str(a).$jsstr();const b=g.length,d=parseFloat(\"0.\"+g);f=(b*c(10)+c(d))/c(e)}return new Sk.builtin.float_(f)}),l.log1p=new Sk.builtin.func(function log1p(a){var b=Number.EPSILON;Sk.builtin.pyCheckArgsLen(\"log1p\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));const d=Sk.builtin.asnum$(new Sk.builtin.float_(a));if(-1>=d)throw new Sk.builtin.ValueError(\"math domain error\");else{if(0==d)return new Sk.builtin.float_(d);if(k(d)<b/2)return new Sk.builtin.float_(d);if(-.5<=d&&1>=d){const a=1+d,b=c(a)-(a-1-d)/a;return new Sk.builtin.float_(b)}else{const a=c(1+d);return new Sk.builtin.float_(a)}}}),l.log2=new Sk.builtin.func(function log2(a){Sk.builtin.pyCheckArgsLen(\"log2\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));let c,d=Sk.builtin.asnum$(a);if(0>d)throw new Sk.builtin.ValueError(\"math domain error\");else if(Sk.builtin.checkFloat(a)||d<b)c=f(d);else{d=new Sk.builtin.str(a).$jsstr();const b=d.length,e=parseFloat(\"0.\"+d);c=b*f(10)+f(e)}return new Sk.builtin.float_(c)}),l.log10=new Sk.builtin.func(function log10(a){var c=Math.log10;Sk.builtin.pyCheckArgsLen(\"log10\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));let d,e=Sk.builtin.asnum$(a);if(0>e)throw new Sk.builtin.ValueError(\"math domain error\");else if(Sk.builtin.checkFloat(a)||e<b)d=c(e);else{e=new Sk.builtin.str(a).$jsstr();const b=e.length,f=parseFloat(\"0.\"+e);d=b+c(f)}return new Sk.builtin.float_(d)}),l.pow=new Sk.builtin.func(function pow(a,b){var c=Number.isInteger;Sk.builtin.pyCheckArgsLen(\"pow\",arguments.length,2,2),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType(\"y\",\"number\",Sk.builtin.checkNumber(b));const d=Sk.builtin.asnum$(new Sk.builtin.float_(a)),f=Sk.builtin.asnum$(new Sk.builtin.float_(b));if(0==d&&0>f)throw new Sk.builtin.ValueError(\"math domain error\");else{if(1==d)return new Sk.builtin.float_(1);if(g(d)&&g(f)&&0>d&&!c(f))throw new Sk.builtin.ValueError(\"math domain error\");else if(-1==d&&(f==-Infinity||f==1/0))return new Sk.builtin.float_(1)}const h=e(d,f);if(!g(d)||!g(f))return new Sk.builtin.float_(h);if(h==1/0||h==-Infinity)throw new Sk.builtin.OverflowError(\"math range error\");return new Sk.builtin.float_(h)}),l.sqrt=new Sk.builtin.func(function sqrt(b){return Sk.builtin.pyCheckArgsLen(\"sqrt\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(b)),new Sk.builtin.float_(a(Sk.builtin.asnum$(b)))}),l.asin=new Sk.builtin.func(function asin(a){var b=Math.asin;return Sk.builtin.pyCheckArgsLen(\"asin\",arguments.length,1,1),Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(a)),new Sk.builtin.float_(b(Sk.builtin.asnum$(a)))}),l.acos=new Sk.builtin.func(function acos(a){var b=Math.acos;return Sk.builtin.pyCheckArgsLen(\"acos\",arguments.length,1,1),Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(a)),new Sk.builtin.float_(b(Sk.builtin.asnum$(a)))}),l.atan=new Sk.builtin.func(function atan(a){var b=Math.atan;return Sk.builtin.pyCheckArgsLen(\"atan\",arguments.length,1,1),Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(a)),new Sk.builtin.float_(b(Sk.builtin.asnum$(a)))}),l.atan2=new Sk.builtin.func(function atan2(a,b){var c=Math.atan2;return Sk.builtin.pyCheckArgsLen(\"atan2\",arguments.length,2,2),Sk.builtin.pyCheckType(\"y\",\"number\",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(b)),new Sk.builtin.float_(c(Sk.builtin.asnum$(a),Sk.builtin.asnum$(b)))}),l.sin=new Sk.builtin.func(function(a){var b=Math.sin;return Sk.builtin.pyCheckArgsLen(\"sin\",arguments.length,1,1),Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(a)),new Sk.builtin.float_(b(Sk.builtin.asnum$(a)))}),l.cos=new Sk.builtin.func(function cos(a){var b=Math.cos;return Sk.builtin.pyCheckArgsLen(\"cos\",arguments.length,1,1),Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(a)),new Sk.builtin.float_(b(Sk.builtin.asnum$(a)))}),l.tan=new Sk.builtin.func(function tan(a){var b=Math.tan;return Sk.builtin.pyCheckArgsLen(\"tan\",arguments.length,1,1),Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(a)),new Sk.builtin.float_(b(Sk.builtin.asnum$(a)))}),l.dist=new Sk.builtin.func(function dist(){throw new Sk.builtin.NotImplementedError(\"math.dist() is not yet implemented in Skulpt\")}),l.hypot=new Sk.builtin.func(function hypot(b,c){return Sk.builtin.pyCheckArgsLen(\"hypot\",arguments.length,2,2),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(b)),Sk.builtin.pyCheckType(\"y\",\"number\",Sk.builtin.checkNumber(c)),b=Sk.builtin.asnum$(b),c=Sk.builtin.asnum$(c),new Sk.builtin.float_(a(b*b+c*c))}),l.asinh=new Sk.builtin.func(function asinh(b){Sk.builtin.pyCheckArgsLen(\"asinh\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(b)),b=Sk.builtin.asnum$(b);const d=b+a(b*b+1);return new Sk.builtin.float_(c(d))}),l.acosh=new Sk.builtin.func(function acosh(b){Sk.builtin.pyCheckArgsLen(\"acosh\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(b)),b=Sk.builtin.asnum$(b);const d=b+a(b*b-1);return new Sk.builtin.float_(c(d))}),l.atanh=new Sk.builtin.func(function atanh(a){Sk.builtin.pyCheckArgsLen(\"atanh\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),a=Sk.builtin.asnum$(a);const b=(1+a)/(1-a);return new Sk.builtin.float_(c(b)/2)}),l.sinh=new Sk.builtin.func(function sinh(a){Sk.builtin.pyCheckArgsLen(\"sinh\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),a=Sk.builtin.asnum$(a);const b=e(i,a);return new Sk.builtin.float_((b-1/b)/2)}),l.cosh=new Sk.builtin.func(function cosh(a){Sk.builtin.pyCheckArgsLen(\"cosh\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),a=Sk.builtin.asnum$(a);const b=e(i,a);return new Sk.builtin.float_((b+1/b)/2)}),l.tanh=new Sk.builtin.func(function tanh(a){Sk.builtin.pyCheckArgsLen(\"tanh\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));const b=Sk.builtin.asnum$(a);if(0===b)return new Sk.builtin.float_(b);const c=e(i,b),d=1/c;return new Sk.builtin.float_((c-d)/2/((c+d)/2))}),l.radians=new Sk.builtin.func(function radians(a){Sk.builtin.pyCheckArgsLen(\"radians\",arguments.length,1,1),Sk.builtin.pyCheckType(\"deg\",\"number\",Sk.builtin.checkNumber(a));const b=j/180*Sk.builtin.asnum$(a);return new Sk.builtin.float_(b)}),l.degrees=new Sk.builtin.func(function degrees(a){Sk.builtin.pyCheckArgsLen(\"degrees\",arguments.length,1,1),Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(a));const b=180/j*Sk.builtin.asnum$(a);return new Sk.builtin.float_(b)}),l.erf=new Sk.builtin.func(function erf(){throw new Sk.builtin.NotImplementedError(\"math.erf() is not yet implemented in Skulpt\")}),l.erfc=new Sk.builtin.func(function erfc(){throw new Sk.builtin.NotImplementedError(\"math.erfc() is not yet implemented in Skulpt\")}),l.gamma=new Sk.builtin.func(function gamma(){throw new Sk.builtin.NotImplementedError(\"math.gamma() is not yet implemented in Skulpt\")}),l.lgamma=new Sk.builtin.func(function lgamma(){throw new Sk.builtin.NotImplementedError(\"math.lgamma() is not yet implemented in Skulpt\")}),l)};","src/lib/md5.py":"raise NotImplementedError(\"md5 is not yet implemented in Skulpt\")\n","src/lib/mhlib.py":"raise NotImplementedError(\"mhlib is not yet implemented in Skulpt\")\n","src/lib/mimetools.py":"raise NotImplementedError(\"mimetools is not yet implemented in Skulpt\")\n","src/lib/mimetypes.py":"raise NotImplementedError(\"mimetypes is not yet implemented in Skulpt\")\n","src/lib/mimify.py":"raise NotImplementedError(\"mimify is not yet implemented in Skulpt\")\n","src/lib/modulefinder.py":"raise NotImplementedError(\"modulefinder is not yet implemented in Skulpt\")\n","src/lib/multifile.py":"raise NotImplementedError(\"multifile is not yet implemented in Skulpt\")\n","src/lib/multiprocessing/__init__.py":"raise NotImplementedError(\"multiprocessing 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/mutex.py":"raise NotImplementedError(\"mutex is not yet implemented in Skulpt\")\n","src/lib/netrc.py":"raise NotImplementedError(\"netrc is not yet implemented in Skulpt\")\n","src/lib/new.py":"raise NotImplementedError(\"new is not yet implemented in Skulpt\")\n","src/lib/nntplib.py":"raise NotImplementedError(\"nntplib is not yet implemented in Skulpt\")\n","src/lib/ntpath.py":"raise NotImplementedError(\"ntpath is not yet implemented in Skulpt\")\n","src/lib/nturl2path.py":"raise NotImplementedError(\"nturl2path is not yet implemented in Skulpt\")\n","src/lib/numbers.py":"Number = (int, float, complex)\nIntegral = int\nComplex = complex\n","src/lib/opcode.py":"raise NotImplementedError(\"opcode is not yet implemented in Skulpt\")\n","src/lib/operator.js":"var $builtinmodule=function(){var a={};return a.lt=new Sk.builtin.func(function(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,\"Lt\"))}),a.__lt__=a.lt,a.le=new Sk.builtin.func(function(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,\"LtE\"))}),a.__le__=a.le,a.eq=new Sk.builtin.func(function(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,\"Eq\"))}),a.__eq__=a.eq,a.ne=new Sk.builtin.func(function(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,\"NotEq\"))}),a.__ne__=a.ne,a.ge=new Sk.builtin.func(function(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,\"GtE\"))}),a.__ge__=a.ge,a.gt=new Sk.builtin.func(function(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,\"Gt\"))}),a.__gt__=a.gt,a.not_=new Sk.builtin.func(function(){throw new Sk.builtin.NotImplementedError(\"operator.not_() is not yet implemented in Skulpt\")}),a.truth=new Sk.builtin.func(function(a){return Sk.builtin.bool(a)}),a.is_=new Sk.builtin.func(function(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,\"Is\"))}),a.is_not=new Sk.builtin.func(function(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,\"IsNot\"))}),a.abs=new Sk.builtin.func(function(a){return Sk.builtin.abs(a)}),a.__abs__=a.abs,a.add=new Sk.builtin.func(function(c,a){return Sk.abstr.objectAdd(c,a)}),a.__add__=a.add,a.and_=new Sk.builtin.func(function(c,a){return Sk.abstr.binary_op_(c,a,\"BitAnd\")}),a.__and__=a.and_,a.div=new Sk.builtin.func(function(c,a){return Sk.abstr.binary_op_(c,a,\"Div\")}),a.__div__=a.div,a.floordiv=new Sk.builtin.func(function(c,a){return Sk.abstr.binary_op_(c,a,\"FloorDiv\")}),a.__floordiv__=a.floordiv,a.index=new Sk.builtin.func(function(b){return new Sk.builtin.int_(Sk.misceval.asIndex(b))}),a.__index__=a.index,a.inv=new Sk.builtin.func(function(a){return Sk.abstr.numberUnaryOp(a,\"Invert\")}),a.__inv__=a.inv,a.invert=a.inv,a.__invert__=a.inv,a.lshift=new Sk.builtin.func(function(c,a){return Sk.abstr.binary_op_(c,a,\"LShift\")}),a.__lshift__=a.lshift,a.mod=new Sk.builtin.func(function(c,a){return Sk.abstr.binary_op_(c,a,\"Mod\")}),a.__mod__=a.mod,a.divmod=new Sk.builtin.func(function(c,a){return Sk.abstr.binary_op_(c,a,\"DivMod\")}),a.__divmod__=a.divmod,a.mul=new Sk.builtin.func(function(c,a){return Sk.abstr.binary_op_(c,a,\"Mult\")}),a.__mul__=a.mul,a.neg=new Sk.builtin.func(function(a){return Sk.abstr.objectNegative(a)}),a.__neg__=a.neg,a.or_=new Sk.builtin.func(function(c,a){return Sk.abstr.binary_op_(c,a,\"BitOr\")}),a.__or__=a.or_,a.pos=new Sk.builtin.func(function(a){return Sk.abstr.objectPositive(a)}),a.__pos__=a.pos,a.pow=new Sk.builtin.func(function(c,a){return Sk.abstr.binary_op_(c,a,\"Pow\")}),a.__pow__=a.pow,a.rshift=new Sk.builtin.func(function(c,a){return Sk.abstr.binary_op_(c,a,\"RShift\")}),a.__rshift__=a.rshift,a.sub=new Sk.builtin.func(function(c,a){return Sk.abstr.binary_op_(c,a,\"Sub\")}),a.__sub__=a.sub,a.truediv=a.div,a.__truediv__=a.div,a.xor=new Sk.builtin.func(function(c,a){return Sk.abstr.binary_op_(c,a,\"BitXor\")}),a.__xor__=a.xor,a.concat=new Sk.builtin.func(function(c,a){return Sk.abstr.sequenceConcat(c,a)}),a.__concat__=a.concat,a.contains=new Sk.builtin.func(function(c,a){return Sk.builtin.bool(Sk.abstr.sequenceContains(c,a))}),a.__contains__=a.contains,a.countOf=new Sk.builtin.func(function(c,a){return Sk.abstr.sequenceGetCountOf(c,a)}),a.delitem=new Sk.builtin.func(function(c,a){return Sk.abstr.sequenceDelItem(c,a)}),a.__delitem__=a.delitem,a.getitem=new Sk.builtin.func(function(c,a){return Sk.abstr.sequenceGetItem(c,a)}),a.__getitem__=a.getitem,a.indexOf=new Sk.builtin.func(function(c,a){return Sk.abstr.sequenceGetIndexOf(c,a)}),a.setitem=new Sk.builtin.func(function(d,a,b){return Sk.abstr.sequenceSetItem(d,a,b)}),a.__setitem__=a.setitem,a};","src/lib/optparse.py":"raise NotImplementedError(\"optparse is not yet implemented in Skulpt\")\n","src/lib/os.py":"raise NotImplementedError(\"os is not yet implemented in Skulpt\")\n","src/lib/os2emxpath.py":"raise NotImplementedError(\"os2emxpath is not yet implemented in Skulpt\")\n","src/lib/pdb.py":"raise NotImplementedError(\"pdb is not yet implemented in Skulpt\")\n","src/lib/pickle.py":"raise NotImplementedError(\"pickle is not yet implemented in Skulpt\")\n","src/lib/pickletools.py":"raise NotImplementedError(\"pickletools is not yet implemented in Skulpt\")\n","src/lib/pipes.py":"raise NotImplementedError(\"pipes is not yet implemented in Skulpt\")\n","src/lib/pkgutil.py":"raise NotImplementedError(\"pkgutil is not yet implemented in Skulpt\")\n","src/lib/platform.js":"var $builtinmodule=function(){var a={},b=\"undefined\"!=typeof window&&\"undefined\"!=typeof window.navigator;return a.python_implementation=new Sk.builtin.func(function(){return Sk.builtin.pyCheckArgsLen(\"python_implementation\",arguments.length,0,0),new Sk.builtin.str(\"Skulpt\")}),a.node=new Sk.builtin.func(function(){return Sk.builtin.pyCheckArgsLen(\"node\",arguments.length,0,0),new Sk.builtin.str(\"\")}),a.version=new Sk.builtin.func(function(){return Sk.builtin.pyCheckArgsLen(\"version\",arguments.length,0,0),new Sk.builtin.str(\"\")}),a.python_version=new Sk.builtin.func(function(){var a;return Sk.builtin.pyCheckArgsLen(\"python_version\",arguments.length,0,0),a=Sk.__future__.python_version?\"3.2.0\":\"2.7.0\",new Sk.builtin.str(a)}),a.system=new Sk.builtin.func(function(){var a;return Sk.builtin.pyCheckArgsLen(\"system\",arguments.length,0,0),a=b?window.navigator.appCodeName:\"\",new Sk.builtin.str(a)}),a.machine=new Sk.builtin.func(function(){var a;return Sk.builtin.pyCheckArgsLen(\"machine\",arguments.length,0,0),a=b?window.navigator.platform:\"\",new Sk.builtin.str(a)}),a.release=new Sk.builtin.func(function(){var a;return Sk.builtin.pyCheckArgsLen(\"release\",arguments.length,0,0),a=b?window.navigator.appVersion:\"\",new Sk.builtin.str(a)}),a.architecture=new Sk.builtin.func(function(){return Sk.builtin.pyCheckArgsLen(\"architecture\",arguments.length,0,0),new Sk.builtin.tuple([new Sk.builtin.str(\"64bit\"),new Sk.builtin.str(\"\")])}),a.processor=new Sk.builtin.func(function(){return Sk.builtin.pyCheckArgsLen(\"processor\",arguments.length,0,0),new Sk.builtin.str(\"\")}),a};","src/lib/platform.py":"raise NotImplementedError(\"platform is not yet implemented in Skulpt\")\n","src/lib/plistlib.py":"raise NotImplementedError(\"plistlib is not yet implemented in Skulpt\")\n","src/lib/popen2.py":"raise NotImplementedError(\"popen2 is not yet implemented in Skulpt\")\n","src/lib/poplib.py":"raise NotImplementedError(\"poplib is not yet implemented in Skulpt\")\n","src/lib/posixfile.py":"raise NotImplementedError(\"posixfile is not yet implemented in Skulpt\")\n","src/lib/posixpath.py":"raise NotImplementedError(\"posixpath is not yet implemented in Skulpt\")\n","src/lib/pprint.py":"raise NotImplementedError(\"pprint is not yet implemented in Skulpt\")\n","src/lib/processing.js":"var $builtinmodule=function(){var b,c,d,e,f,g,h,a=Math.PI,j={__name__:new Sk.builtin.str(\"processing\")},k=[],l=!0,m=null;return j.processing=null,j.p=null,j.X=new Sk.builtin.int_(0),j.Y=new Sk.builtin.int_(1),j.Z=new Sk.builtin.int_(2),j.R=new Sk.builtin.int_(3),j.G=new Sk.builtin.int_(4),j.B=new Sk.builtin.int_(5),j.A=new Sk.builtin.int_(6),j.U=new Sk.builtin.int_(7),j.V=new Sk.builtin.int_(8),j.NX=new Sk.builtin.int_(9),j.NY=new Sk.builtin.int_(10),j.NZ=new Sk.builtin.int_(11),j.EDGE=new Sk.builtin.int_(12),j.SR=new Sk.builtin.int_(13),j.SG=new Sk.builtin.int_(14),j.SB=new Sk.builtin.int_(15),j.SA=new Sk.builtin.int_(16),j.SW=new Sk.builtin.int_(17),j.TX=new Sk.builtin.int_(18),j.TY=new Sk.builtin.int_(19),j.TZ=new Sk.builtin.int_(20),j.VX=new Sk.builtin.int_(21),j.VY=new Sk.builtin.int_(22),j.VZ=new Sk.builtin.int_(23),j.VW=new Sk.builtin.int_(24),j.AR=new Sk.builtin.int_(25),j.AG=new Sk.builtin.int_(26),j.AB=new Sk.builtin.int_(27),j.DR=new Sk.builtin.int_(3),j.DG=new Sk.builtin.int_(4),j.DB=new Sk.builtin.int_(5),j.DA=new Sk.builtin.int_(6),j.SPR=new Sk.builtin.int_(28),j.SPG=new Sk.builtin.int_(29),j.SPB=new Sk.builtin.int_(30),j.SHINE=new Sk.builtin.int_(31),j.ER=new Sk.builtin.int_(32),j.EG=new Sk.builtin.int_(33),j.EB=new Sk.builtin.int_(34),j.BEEN_LIT=new Sk.builtin.int_(35),j.VERTEX_FIELD_COUNT=new Sk.builtin.int_(36),j.CENTER=new Sk.builtin.int_(3),j.RADIUS=new Sk.builtin.int_(2),j.CORNERS=new Sk.builtin.int_(1),j.CORNER=new Sk.builtin.int_(0),j.DIAMETER=new Sk.builtin.int_(3),j.BASELINE=new Sk.builtin.int_(0),j.TOP=new Sk.builtin.int_(101),j.BOTTOM=new Sk.builtin.int_(102),j.NORMAL=new Sk.builtin.int_(1),j.NORMALIZED=new Sk.builtin.int_(1),j.IMAGE=new Sk.builtin.int_(2),j.MODEL=new Sk.builtin.int_(4),j.SHAPE=new Sk.builtin.int_(5),j.AMBIENT=new Sk.builtin.int_(0),j.DIRECTIONAL=new Sk.builtin.int_(1),j.SPOT=new Sk.builtin.int_(3),j.RGB=new Sk.builtin.int_(1),j.ARGB=new Sk.builtin.int_(2),j.HSB=new Sk.builtin.int_(3),j.ALPHA=new Sk.builtin.int_(4),j.CMYK=new Sk.builtin.int_(5),j.TIFF=new Sk.builtin.int_(0),j.TARGA=new Sk.builtin.int_(1),j.JPEG=new Sk.builtin.int_(2),j.GIF=new Sk.builtin.int_(3),j.MITER=new Sk.builtin.str(\"miter\"),j.BEVEL=new Sk.builtin.str(\"bevel\"),j.ROUND=new Sk.builtin.str(\"round\"),j.SQUARE=new Sk.builtin.str(\"butt\"),j.PROJECT=new Sk.builtin.str(\"square\"),j.P2D=new Sk.builtin.int_(1),j.JAVA2D=new Sk.builtin.int_(1),j.WEBGL=new Sk.builtin.int_(2),j.P3D=new Sk.builtin.int_(2),j.OPENGL=new Sk.builtin.int_(2),j.PDF=new Sk.builtin.int_(0),j.DXF=new Sk.builtin.int_(0),j.OTHER=new Sk.builtin.int_(0),j.WINDOWS=new Sk.builtin.int_(1),j.MAXOSX=new Sk.builtin.int_(2),j.LINUX=new Sk.builtin.int_(3),j.EPSILON=new Sk.builtin.float_(1e-4),j.MAX_FLOAT=new Sk.builtin.float_(34028235e31),j.MIN_FLOAT=new Sk.builtin.float_(-34028235e31),j.MAX_INT=new Sk.builtin.int_(2147483647),j.MIN_INT=new Sk.builtin.int_(-2147483648),j.HALF_PI=new Sk.builtin.float_(a/2),j.THIRD_PI=new Sk.builtin.float_(a/3),j.PI=new Sk.builtin.float_(a),j.TWO_PI=new Sk.builtin.float_(2*a),j.TAU=new Sk.builtin.float_(2*a),j.QUARTER_PI=new Sk.builtin.float_(a/4),j.DEG_TO_RAD=new Sk.builtin.float_(a/180),j.RAD_TO_DEG=new Sk.builtin.float_(180/a),j.WHITESPACE=new Sk.builtin.str(\" \\t\\n\\r\\f\\xA0\"),j.POINT=new Sk.builtin.int_(2),j.POINTS=new Sk.builtin.int_(2),j.LINE=new Sk.builtin.int_(4),j.LINES=new Sk.builtin.int_(4),j.TRIANGLE=new Sk.builtin.int_(8),j.TRIANGLES=new Sk.builtin.int_(9),j.TRIANGLE_FAN=new Sk.builtin.int_(11),j.TRIANGLE_STRIP=new Sk.builtin.int_(10),j.QUAD=new Sk.builtin.int_(16),j.QUADS=new Sk.builtin.int_(16),j.QUAD_STRIP=new Sk.builtin.int_(17),j.POLYGON=new Sk.builtin.int_(20),j.PATH=new Sk.builtin.int_(21),j.RECT=new Sk.builtin.int_(30),j.ELLIPSE=new Sk.builtin.int_(31),j.ARC=new Sk.builtin.int_(32),j.SPHERE=new Sk.builtin.int_(40),j.BOX=new Sk.builtin.int_(41),j.GROUP=new Sk.builtin.int_(0),j.PRIMITIVE=new Sk.builtin.int_(1),j.GEOMETRY=new Sk.builtin.int_(3),j.VERTEX=new Sk.builtin.int_(0),j.BEZIER_VERTEX=new Sk.builtin.int_(1),j.CURVE_VERTEX=new Sk.builtin.int_(2),j.BREAK=new Sk.builtin.int_(3),j.CLOSESHAPE=new Sk.builtin.int_(4),j.REPLACE=new Sk.builtin.int_(0),j.BLEND=new Sk.builtin.int_(1),j.ADD=new Sk.builtin.int_(2),j.SUBTRACT=new Sk.builtin.int_(4),j.LIGHTEST=new Sk.builtin.int_(8),j.DARKEST=new Sk.builtin.int_(16),j.DIFFERENCE=new Sk.builtin.int_(32),j.EXCLUSION=new Sk.builtin.int_(64),j.MULTIPLY=new Sk.builtin.int_(128),j.SCREEN=new Sk.builtin.int_(256),j.OVERLAY=new Sk.builtin.int_(512),j.HARD_LIGHT=new Sk.builtin.int_(1024),j.SOFT_LIGHT=new Sk.builtin.int_(2048),j.DODGE=new Sk.builtin.int_(4096),j.BURN=new Sk.builtin.int_(8192),j.ALPHA_MASK=new Sk.builtin.int_(4278190080),j.RED_MASK=new Sk.builtin.int_(16711680),j.GREEN_MASK=new Sk.builtin.int_(65280),j.BLUE_MASK=new Sk.builtin.int_(255),j.CUSTOM=new Sk.builtin.int_(0),j.ORTHOGRAPHIC=new Sk.builtin.int_(2),j.PERSPECTIVE=new Sk.builtin.int_(3),j.ARROW=new Sk.builtin.str(\"default\"),j.CROSS=new Sk.builtin.str(\"crosshair\"),j.HAND=new Sk.builtin.str(\"pointer\"),j.MOVE=new Sk.builtin.str(\"move\"),j.TEXT=new Sk.builtin.str(\"text\"),j.WAIT=new Sk.builtin.str(\"wait\"),j.NOCURSOR=Sk.builtin.assk$(\"url('data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='), auto\"),j.DISABLE_OPENGL_2X_SMOOTH=new Sk.builtin.int_(1),j.ENABLE_OPENGL_2X_SMOOTH=new Sk.builtin.int_(-1),j.ENABLE_OPENGL_4X_SMOOTH=new Sk.builtin.int_(2),j.ENABLE_NATIVE_FONTS=new Sk.builtin.int_(3),j.DISABLE_DEPTH_TEST=new Sk.builtin.int_(4),j.ENABLE_DEPTH_TEST=new Sk.builtin.int_(-4),j.ENABLE_DEPTH_SORT=new Sk.builtin.int_(5),j.DISABLE_DEPTH_SORT=new Sk.builtin.int_(-5),j.DISABLE_OPENGL_ERROR_REPORT=new Sk.builtin.int_(6),j.ENABLE_OPENGL_ERROR_REPORT=new Sk.builtin.int_(-6),j.ENABLE_ACCURATE_TEXTURES=new Sk.builtin.int_(7),j.DISABLE_ACCURATE_TEXTURES=new Sk.builtin.int_(-7),j.HINT_COUNT=new Sk.builtin.int_(10),j.OPEN=new Sk.builtin.int_(1),j.CLOSE=new Sk.builtin.int_(2),j.BLUR=new Sk.builtin.int_(11),j.GRAY=new Sk.builtin.int_(12),j.INVERT=new Sk.builtin.int_(13),j.OPAQUE=new Sk.builtin.int_(14),j.POSTERIZE=new Sk.builtin.int_(15),j.THRESHOLD=new Sk.builtin.int_(16),j.ERODE=new Sk.builtin.int_(17),j.DILATE=new Sk.builtin.int_(18),j.BACKSPACE=new Sk.builtin.int_(8),j.TAB=new Sk.builtin.int_(9),j.ENTER=new Sk.builtin.int_(10),j.RETURN=new Sk.builtin.int_(13),j.ESC=new Sk.builtin.int_(27),j.DELETE=new Sk.builtin.int_(127),j.CODED=new Sk.builtin.int_(65535),j.SHIFT=new Sk.builtin.int_(16),j.CONTROL=new Sk.builtin.int_(17),j.ALT=new Sk.builtin.int_(18),j.CAPSLK=new Sk.builtin.int_(20),j.PGUP=new Sk.builtin.int_(33),j.PGDN=new Sk.builtin.int_(34),j.END=new Sk.builtin.int_(35),j.HOME=new Sk.builtin.int_(36),j.LEFT=new Sk.builtin.int_(37),j.UP=new Sk.builtin.int_(38),j.RIGHT=new Sk.builtin.int_(39),j.DOWN=new Sk.builtin.int_(40),j.F1=new Sk.builtin.int_(112),j.F2=new Sk.builtin.int_(113),j.F3=new Sk.builtin.int_(114),j.F4=new Sk.builtin.int_(115),j.F5=new Sk.builtin.int_(116),j.F6=new Sk.builtin.int_(117),j.F7=new Sk.builtin.int_(118),j.F8=new Sk.builtin.int_(119),j.F9=new Sk.builtin.int_(120),j.F10=new Sk.builtin.int_(121),j.F11=new Sk.builtin.int_(122),j.F12=new Sk.builtin.int_(123),j.NUMLK=new Sk.builtin.int_(144),j.META=new Sk.builtin.int_(157),j.INSERT=new Sk.builtin.int_(155),j.SINCOS_LENGTH=new Sk.builtin.int_(720),j.PRECISIONB=new Sk.builtin.int_(15),j.PRECISIONF=new Sk.builtin.int_(32768),j.PREC_MAXVAL=new Sk.builtin.int_(32767),j.PREC_ALPHA_SHIFT=new Sk.builtin.int_(9),j.PREC_RED_SHIFT=new Sk.builtin.int_(1),j.NORMAL_MODE_AUTO=new Sk.builtin.int_(0),j.NORMAL_MODE_SHAPE=new Sk.builtin.int_(1),j.NORMAL_MODE_VERTEX=new Sk.builtin.int_(2),j.MAX_LIGHTS=new Sk.builtin.int_(8),j.line=new Sk.builtin.func(function(a,b,c,d){j.processing.line(a.v,b.v,c.v,d.v)}),j.ellipse=new Sk.builtin.func(function(a,b,c,d){j.processing.ellipse(a.v,b.v,c.v,d.v)}),j.text=new Sk.builtin.func(function(a,b,c){j.processing.text(a.v,b.v,c.v)}),j.point=new Sk.builtin.func(function(a,b){j.processing.point(a.v,b.v)}),j.arc=new Sk.builtin.func(function(a,b,c,d,e,f){j.processing.arc(a.v,b.v,c.v,d.v,e.v,f.v)}),j.quad=new Sk.builtin.func(function(a,b,c,d,e,f,g,h){j.processing.quad(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v)}),j.rect=new Sk.builtin.func(function(a,b,c,d,e){\"undefined\"==typeof e?j.processing.rect(a.v,b.v,c.v,d.v):j.processing.rect(a.v,b.v,c.v,d.v,e.v)}),j.triangle=new Sk.builtin.func(function(a,b,c,d,e,f){j.processing.triangle(a.v,b.v,c.v,d.v,e.v,f.v)}),j.bezier=new Sk.builtin.func(function(a,b,c,d,e,f,g,h,i,k,l,m){\"undefined\"==typeof i?j.processing.bezier(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v):j.processing.bezier(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v,i.v,k.v,l.v,m.v)}),j.alpha=new Sk.builtin.func(function(a,c,d){return\"undefined\"==typeof c?new Sk.builtin.float_(j.processing.alpha(a.v)):\"undefined\"==typeof d?new Sk.builtin.float_(j.processing.alpha(a.v,c.v)):new Sk.builtin.float_(j.processing.alpha(a.v,c.v,d.v))}),j.ambient=new Sk.builtin.func(function(a,c,d){\"undefined\"==typeof c?j.processing.ambient(a.v):\"undefined\"==typeof d?j.processing.ambient(a.v,c.v):j.processing.ambient(a.v,c.v,d.v)}),j.ambientLight=new Sk.builtin.func(function(a,b,c,d,e,f){\"undefined\"==typeof d?j.processing.ambientLight(a.v,b.v,c.v):\"undefined\"==typeof e?j.processing.ambientLight(a.v,b.v,c.v,d.v):\"undefined\"==typeof f?j.processing.ambientLight(a.v,b.v,c.v,d.v,e.v):j.processing.ambientLight(a.v,b.v,c.v,d.v,e.v,f.v)}),j.beginCamera=new Sk.builtin.func(function(){j.processing.beginCamera()}),j.beginShape=new Sk.builtin.func(function(a){\"undefined\"==typeof a&&(a=j.POLYGON),j.processing.beginShape(a.v)}),j.bezierDetail=new Sk.builtin.func(function(a){a=\"undefined\"==typeof a?20:a.v,j.processing.bezierDetail(a)}),j.bezierPoint=new Sk.builtin.func(function(e,a,b,c,d){j.processing.bezierPoint(e.v,a.v,b.v,c.v,d.v)}),j.bezierTangent=new Sk.builtin.func(function(e,a,b,c,d){j.processing.bezierTangent(e.v,a.v,b.v,c.v,d.v)}),j.bezierVertex=new Sk.builtin.func(function(a,b,c,d,e,f,g,h,i){\"undefined\"==typeof g?j.processing.bezierVertex(a.v,b.v,c.v,d.v,e.v,f.v):\"undefined\"==typeof h?j.processing.bezierVertex(a.v,b.v,c.v,d.v,e.v,f.v,g.v):\"undefined\"==typeof i?j.processing.bezierVertex(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v):j.processing.bezierVertex(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v,i.v)}),j.blend=new Sk.builtin.func(function(a,b,c,d,e,f,g,h,i,k){other instanceof Sk.builtin.int_||other instanceof Sk.builtin.float_?j.processing.blend(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v,i.v):j.processing.blend(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v,i.v,k.v)}),j.blendColor=new Sk.builtin.func(function(a,b,d){var e=Sk.misceval.callsimArray(j.color,[new Sk.builtin.int_(0),new Sk.builtin.int_(0),new Sk.builtin.int_(0)]);return e.v=j.processing.blendColor(a.v,b.v,d.v),e}),j.brightness=new Sk.builtin.func(function(a,c,d){return\"undefined\"==typeof c?new Sk.builtin.float_(j.processing.brightness(a.v)):\"undefined\"==typeof d?new Sk.builtin.float_(j.processing.brightness(a.v,c.v)):new Sk.builtin.float_(j.processing.brightness(a.v,c.v,d.v))}),j.camera=new Sk.builtin.func(function(a,b,c,d,e,f,g,h,i){\"undefined\"==typeof a?j.processing.camera():j.processing.camera(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v,i.v)}),j.constrain=new Sk.builtin.func(function(a,b,c){return new Sk.builtin.float_(j.processing.constrain(a.v,b.v,c.v))}),j.copy=new Sk.builtin.func(function(a,b,c,d,e,f,g,h,i){other instanceof Sk.builtin.int_||other instanceof Sk.builtin.float_?j.processing.copy(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v):j.processing.copy(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v,i.v)}),j.createFont=new Sk.builtin.func(function(a,b,c,d){var e=Sk.misceval.callsimArray(j.PFont);return e.v=\"undefined\"==typeof c?j.processing.createFont(a.v,b.v):\"undefined\"==typeof d?j.processing.createFont(a.v,b.v,c.v):j.processing.createFont(a.v,b.v,c.v,d.v),e}),j.createGraphics=new Sk.builtin.func(function(a,b,c,d){var e=Sk.misceval.callsimArray(j.PGraphics);return e.v=\"undefined\"==typeof d?j.processing.createGraphics(a.v,b.v,c.v):j.processing.createGraphics(a.v,b.v,c.v,d.v),e}),j.createImage=new Sk.builtin.func(function(a,b,c){var d=Sk.misceval.callsimArray(j.PImage);return d.v=j.processing.createImage(a.v,b.v,c.v),d}),j.cursor=new Sk.builtin.func(function(a,b,c){\"undefined\"==typeof a?j.processing.cursor():\"undefined\"==typeof b?j.processing.cursor(a.v):\"undefined\"==typeof c?j.processing.cursor(a.v,b.v):j.processing.cursor(a.v,b.v,c.v)}),j.curve=new Sk.builtin.func(function(a,b,c,d,e,f,g,h,i,k,l,m){\"undefined\"==typeof i?j.processing.curve(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v):\"undefined\"==typeof k?j.processing.curve(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v,i.v):\"undefined\"==typeof l?j.processing.curve(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v,i.v,k.v):\"undefined\"==typeof m?j.processing.curve(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v,i.v,k.v,l.v):j.processing.curve(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v,i.v,k.v,l.v,m.v)}),j.curveDetail=new Sk.builtin.func(function(a){j.processing.curveDetail(a.v)}),j.curvePoint=new Sk.builtin.func(function(e,a,b,c,d){j.processing.curvePoint(e.v,a.v,b.v,c.v,d.v)}),j.curveTangent=new Sk.builtin.func(function(e,a,b,c,d){j.processing.curveTangent(e.v,a.v,b.v,c.v,d.v)}),j.curveTightness=new Sk.builtin.func(function(a){j.processing.curveTightness(a.v)}),j.curveVertex=new Sk.builtin.func(function(a,b,c){\"undefined\"==typeof c?j.processing.curveVertex(a.v,b.v):j.processing.curveVertex(a.v,b.v,c.v)}),j.day=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.day())}),j.degrees=new Sk.builtin.func(function(a){return new Sk.builtin.float_(j.processing.degrees(a.v))}),j.directionalLight=new Sk.builtin.func(function(a,b,c,d,e,f){j.processing.directionalLight(a.v,b.v,c.v,d.v,e.v,f.v)}),j.dist=new Sk.builtin.func(function(a,b,c,d,e,f){return\"undefined\"==typeof e?new Sk.builtin.float_(j.processing.dist(a.v,b.v,c.v,d.v)):\"undefined\"==typeof f?new Sk.builtin.float_(j.processing.dist(a.v,b.v,c.v,d.v,e.v)):new Sk.builtin.float_(j.processing.dist(a.v,b.v,c.v,d.v,e.v,f.v))}),j.emissive=new Sk.builtin.func(function(a,b,c){\"undefined\"==typeof b?j.processing.emissive(a.v):\"undefined\"==typeof c?j.processing.emissive(a.v,b.v):j.processing.emissive(a.v,b.v,c.v)}),j.endCamera=new Sk.builtin.func(function(){j.processing.endCamera()}),j.endShape=new Sk.builtin.func(function(a){\"undefined\"==typeof a?j.processing.endShape():j.processing.endShape(a.v)}),j.filter=new Sk.builtin.func(function(a,b){\"undefined\"==typeof b?j.processing.filter(a.v):j.processing.filter(a.v,b.v)}),j.frustum=new Sk.builtin.func(function(a,b,c,d,e,f){j.processing.frustum(a,b,c,d,e,f)}),j.hint=new Sk.builtin.func(function(a){j.processing.hint(a)}),j.hour=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.hour())}),j.hue=new Sk.builtin.func(function(a){return new Sk.builtin.float_(j.processing.hue(a.v))}),j.imageMode=new Sk.builtin.func(function(a){j.processing.imageMode(a.v)}),j.lerp=new Sk.builtin.func(function(a,b,c){return new Sk.builtin.float_(j.processing.lerp(a.v,b.v,c.v))}),j.lerpColor=new Sk.builtin.func(function(a,b,d){var e=Sk.misceval.callsimArray(j.color,[new Sk.builtin.int_(0),new Sk.builtin.int_(0),new Sk.builtin.int_(0)]);return e.v=j.processing.lerpColor(a.v,b.v,d.v),e}),j.lightFalloff=new Sk.builtin.func(function(a,b,c){j.processing.lightFalloff(a.v,b.v,c.v)}),j.lights=new Sk.builtin.func(function(){j.processing.lights()}),j.lightSpecular=new Sk.builtin.func(function(a,b,c){j.processing.lightSpecular(a.v,b.v,c.v)}),j.loadBytes=new Sk.builtin.func(function(a){return new Sk.builtin.list(j.processing.loadBytes(a.v))}),j.loadFont=new Sk.builtin.func(function(a){var b=Sk.misceval.callsimArray(j.PFont);return b.v=j.processing.loadFont(a.v),b}),j.loadShape=new Sk.builtin.func(function(a){var b=Sk.misceval.callsimArray(j.PShapeSVG,[new Sk.builtin.str(\"string\"),a]);return b}),j.loadStrings=new Sk.builtin.func(function(a){return new Sk.builtin.list(j.processing.loadStrings(a.v))}),j.mag=new Sk.builtin.func(function(d,a,b){return\"undefined\"==typeof b?new Sk.builtin.float_(j.processing.mag(d.v,a.v)):new Sk.builtin.float_(j.processing.mag(d.v,a.v,b.v))}),j.map=new Sk.builtin.func(function(a,b,c,d,e){return new Sk.builtin.float_(j.processing.map(a.v,b.v,c.v,d.v,e.v))}),j.millis=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.millis())}),j.minute=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.minute())}),j.modelX=new Sk.builtin.func(function(a,b,c){return new Sk.builtin.float_(j.processing.modelX(a.v,b.v,c.v))}),j.modelY=new Sk.builtin.func(function(a,b,c){return new Sk.builtin.float_(j.processing.modelY(a.v,b.v,c.v))}),j.modelZ=new Sk.builtin.func(function(a,b,c){return new Sk.builtin.float_(j.processing.modelZ(a.v,b.v,c.v))}),j.month=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.month())}),j.noCursor=new Sk.builtin.func(function(){j.processing.noCursor()}),j.noise=new Sk.builtin.func(function(a,b,c){return\"undefined\"==typeof b?new Sk.builtin.float_(j.processing.noise(a.v)):\"undefined\"==typeof c?new Sk.builtin.float_(j.processing.noise(a.v,b.v)):new Sk.builtin.float_(j.processing.noise(a.v,b.v,c.v))}),j.noiseDetail=new Sk.builtin.func(function(a,b){j.processing.noiseDetail(a.v,b.v)}),j.noiseSeed=new Sk.builtin.func(function(a){return new Sk.builtin.float_(j.processing.noiseSeed(a.v))}),j.noLights=new Sk.builtin.func(function(){j.processing.noLights()}),j.norm=new Sk.builtin.func(function(a,b,c){return new Sk.builtin.float_(j.processing.norm(a.v,b.v,c.v))}),j.normal=new Sk.builtin.func(function(a,b,c){j.processing.normal(a.v,b.v,c.v)}),j.noTint=new Sk.builtin.func(function(){j.processing.noTint()}),j.ortho=new Sk.builtin.func(function(a,b,c,d,e,f){j.processing.ortho(a.v,b.v,c.v,d.v,e.v,f.v)}),j.perspective=new Sk.builtin.func(function(a,b,c,d){\"undefined\"==typeof a?j.processing.perspective():\"undefined\"==typeof b?j.processing.perspective(a.v):\"undefined\"==typeof c?j.processing.perspective(a.v,b.v):\"undefined\"==typeof d?j.processing.perspective(a.v,b.v,c.v):j.processing.perspective(a.v,b.v,c.v,d.v)}),j.pointLight=new Sk.builtin.func(function(a,b,c,d,e,f){j.processing.pointLight(a.v,b.v,c.v,d.v,e.v,f.v)}),j.printCamera=new Sk.builtin.func(function(){j.processing.printCamera()}),j.println=new Sk.builtin.func(function(a){j.processing.println(a.v)}),j.printProjection=new Sk.builtin.func(function(){j.processing.printProjection()}),j.radians=new Sk.builtin.func(function(a){return new Sk.builtin.float_(j.processing.radians(a.v))}),j.randomSeed=new Sk.builtin.func(function(a){return new Sk.builtin.float_(j.processing.randomSeed(a.v))}),j.random=new Sk.builtin.func(function(a,b){return\"undefined\"==typeof a?new Sk.builtin.float_(j.processing.random()):\"undefined\"==typeof b?new Sk.builtin.float_(j.processing.random(a.v)):new Sk.builtin.float_(j.processing.random(a.v,b.v))}),j.requestImage=new Sk.builtin.func(function(a,b){var c=Sk.misceval.callsimArray(j.PImage);return c.v=\"undefined\"==typeof b?j.processing.requestImage(a.v):j.processing.requestImage(a.v,b.v),c}),j.saturation=new Sk.builtin.func(function(a){return new Sk.builtin.float_(j.processing.saturation(a.v))}),j.save=new Sk.builtin.func(function(a){j.processing.save(a.v)}),j.saveFrame=new Sk.builtin.func(function(a){\"undefined\"==typeof a?j.processing.saveFrame():j.processing.saveFrame(a.v)}),j.saveStrings=new Sk.builtin.func(function(a,b){j.processing.saveStrings(a.v,b.v)}),j.screenX=new Sk.builtin.func(function(a,b,c){return new Sk.builtin.float_(j.processing.screenX(a.v,b.v,c.v))}),j.screenY=new Sk.builtin.func(function(a,b,c){return new Sk.builtin.float_(j.processing.screenY(a.v,b.v,c.v))}),j.screenZ=new Sk.builtin.func(function(a,b,c){return new Sk.builtin.float_(j.processing.screenZ(a.v,b.v,c.v))}),j.second=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.second())}),j.shape=new Sk.builtin.func(function(a,b,c,d,e){\"undefined\"==typeof b?j.processing.shape(a.v):\"undefined\"==typeof c?j.processing.shape(a.v,b.v):\"undefined\"==typeof d?j.processing.shape(a.v,b.v,c.v):\"undefined\"==typeof e?j.processing.shape(a.v,b.v,c.v,d.v):j.processing.shape(a.v,b.v,c.v,d.v,e.v)}),j.shapeMode=new Sk.builtin.func(function(a){j.processing.shapeMode(a.v)}),j.shininess=new Sk.builtin.func(function(a){j.processing.shininess(a.v)}),j.specular=new Sk.builtin.func(function(a,b,c){\"undefined\"==typeof b?j.processing.specular(a.v):\"undefined\"==typeof c?j.processing.specular(a.v,b.v):j.processing.specular(a.v,b.v,c.v)}),j.spotLight=new Sk.builtin.func(function(a,b,c,d,e,f,g,h){j.processing.spotLight(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v)}),j.sq=new Sk.builtin.func(function(a){return new Sk.builtin.float_(j.processing.sq(a))}),j.status=new Sk.builtin.func(function(a){j.processing.status(a.v)}),j.textAlign=new Sk.builtin.func(function(a,b){\"undefined\"==typeof b?j.processing.textAlign(a.v):j.processing.textAlign(a.v,b.v)}),j.textAscent=new Sk.builtin.func(function(){return new Sk.builtin.float_(j.processing.textAscent())}),j.textDescent=new Sk.builtin.func(function(){return new Sk.builtin.float_(j.processing.textDescent())}),j.textFont=new Sk.builtin.func(function(a,b){\"undefined\"==typeof b?j.processing.textFont(a.v):j.processing.textFont(a.v,b.v)}),j.textLeading=new Sk.builtin.func(function(a){j.processing.textLeading(a.v)}),j.textMode=new Sk.builtin.func(function(a){j.processing.textMode(a.v)}),j.textSize=new Sk.builtin.func(function(a){j.processing.textSize(a.v)}),j.texture=new Sk.builtin.func(function(a){j.processing.texture(a.v)}),j.textureMode=new Sk.builtin.func(function(a){j.processing.textureMode(a.v)}),j.textWidth=new Sk.builtin.func(function(a){return new Sk.builtin.float_(j.processing.textWidth(a.v))}),j.tint=new Sk.builtin.func(function(a,b,c,d){\"undefined\"==typeof b?j.processing.tint(a.v):\"undefined\"==typeof c?j.processing.tint(a.v,b.v):\"undefined\"==typeof d?j.processing.tint(a.v,b.v,c.v):j.processing.tint(a.v,b.v,c.v,d.v)}),j.updatePixels=new Sk.builtin.func(function(){j.processing.updatePixels()}),j.vertex=new Sk.builtin.func(function(a,b,c,d,e){\"undefined\"==typeof c?j.processing.vertex(a.v,b.v):\"undefined\"==typeof d?j.processing.vertex(a.v,b.v,c.v):\"undefined\"==typeof e?j.processing.vertex(a.v,b.v,c.v,d.v):j.processing.vertex(a.v,b.v,c.v,d.v,e.v)}),j.year=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.year())}),j.box=new Sk.builtin.func(function(a){j.processing.box(a.v)}),j.sphere=new Sk.builtin.func(function(a){j.processing.sphere(a.v)}),j.sphereDetail=new Sk.builtin.func(function(a,b){\"undefined\"==typeof b?j.processing.sphereDetail(a.v):j.processing.sphereDetail(a.v,b.v)}),j.background=new Sk.builtin.func(function(a,c,d){\"undefined\"!=typeof c&&(c=c.v),\"undefined\"!=typeof d&&(d=d.v),j.processing.background(a.v,c,d)}),j.fill=new Sk.builtin.func(function(a,c,d,e){\"undefined\"!=typeof c&&(c=c.v),\"undefined\"!=typeof d&&(d=d.v),\"undefined\"!=typeof e&&(e=e.v),j.processing.fill(a.v,c,d,e)}),j.stroke=new Sk.builtin.func(function(a,c,d,e){\"undefined\"!=typeof c&&(c=c.v),\"undefined\"!=typeof d&&(d=d.v),\"undefined\"!=typeof e&&(e=e.v),j.processing.stroke(a.v,c,d,e)}),j.noStroke=new Sk.builtin.func(function(){j.processing.noStroke()}),j.colorMode=new Sk.builtin.func(function(a,b,c,d,e){b=\"undefined\"==typeof b?255:b.v,\"undefined\"!=typeof c&&(c=c.v),\"undefined\"!=typeof d&&(d=d.v),\"undefined\"!=typeof e&&(e=e.v),j.processing.colorMode(a.v,b,c,d,e)}),j.noFill=new Sk.builtin.func(function(){j.processing.noFill()}),j.loop=new Sk.builtin.func(function(){if(null===j.processing)throw new Sk.builtin.Exception(\"loop() should be called after run()\");l=!0,j.processing.loop()}),j.noLoop=new Sk.builtin.func(function(){if(null===j.processing)throw new Sk.builtin.Exception(\"noLoop() should be called after run()\");l=!1,j.processing.noLoop()}),j.frameRate=new Sk.builtin.func(function(a){j.processing.frameRate(a.v)}),j.width=new Sk.builtin.int_(0),j.height=new Sk.builtin.int_(0),j.renderMode=j.P2D,j.size=new Sk.builtin.func(function(a,b,c){\"undefined\"==typeof c&&(c=j.P2D),j.processing.size(a.v,b.v,c.v),j.width=new Sk.builtin.int_(j.processing.width),j.height=new Sk.builtin.int_(j.processing.height),j.renderMode=c}),j.exitp=new Sk.builtin.func(function(){j.processing.exit()}),j.mouseX=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.mouseX)}),j.mouseY=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.mouseY)}),j.pmouseX=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.pmouseX)}),j.pmouseY=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.pmouseY)}),j.rectMode=new Sk.builtin.func(function(a){j.processing.rectMode(a.v)}),j.strokeWeight=new Sk.builtin.func(function(a){j.processing.strokeWeight(a.v)}),j.smooth=new Sk.builtin.func(function(){j.processing.smooth()}),j.noSmooth=new Sk.builtin.func(function(){j.processing.noSmooth()}),j.ellipseMode=new Sk.builtin.func(function(a){j.processing.ellipseMode(a.v)}),j.strokeCap=new Sk.builtin.func(function(a){j.processing.strokeCap(a.v)}),j.strokeJoin=new Sk.builtin.func(function(a){j.processing.strokeJoin(a.v)}),j.rotate=new Sk.builtin.func(function(a){j.processing.rotate(a.v)}),j.rotateX=new Sk.builtin.func(function(a){j.processing.rotateX(a.v)}),j.rotateY=new Sk.builtin.func(function(a){j.processing.rotateY(a.v)}),j.rotateZ=new Sk.builtin.func(function(a){j.processing.rotateZ(a.v)}),j.scale=new Sk.builtin.func(function(a,b,c){b=\"undefined\"==typeof b?1:b.v,c=\"undefined\"==typeof c?1:c.v,j.processing.scale(a.v,b,c)}),j.translate=new Sk.builtin.func(function(a,b,c){b=\"undefined\"==typeof b?1:b.v,c=\"undefined\"==typeof c?1:c.v,j.processing.translate(a.v,b,c)}),j.popMatrix=new Sk.builtin.func(function(){j.processing.popMatrix()}),j.pushMatrix=new Sk.builtin.func(function(){j.processing.pushMatrix()}),j.applyMatrix=new Sk.builtin.func(function(){var a,b=Array.prototype.slice.call(arguments,0,16);for(a=0;a<b.length;a++)b[a]=\"undefined\"==typeof b[a]?0:b[a].v;j.processing.applyMatrix.apply(j.processing,b)}),j.resetMatrix=new Sk.builtin.func(function(){j.processing.resetMatrix()}),j.printMatrix=new Sk.builtin.func(function(){return Sk.ffi.remapToPy(j.processing.printMatrix())}),j.run=new Sk.builtin.func(function(){var a=document.getElementById(Sk.canvas);if(!a)throw new Error(\"Processing module: Canvas element not specified\");if(window.Processing.logger={log:function(a){Sk.misceval.print_(a)}},m=window.Processing.getInstanceById(Sk.canvas),m&&m.exit(),j.p=new window.Processing(a,function sketchProc(a){j.processing=a,a.draw=function(){var b=!1;for(var c in k)0===k[c].width&&(b=!0);if(!0==b)return!0===l?void 0:void a.loop();if(!1===l&&a.noLoop(),j.frameCount=a.frameCount,Sk.globals.draw)try{Sk.misceval.callsimArray(Sk.globals.draw)}catch(a){Sk.uncaughtException(a)}};var b=[\"setup\",\"mouseMoved\",\"mouseClicked\",\"mouseDragged\",\"mouseMoved\",\"mouseOut\",\"mouseOver\",\"mousePressed\",\"mouseReleased\",\"keyPressed\",\"keyReleased\",\"keyTyped\"];for(var c in b)Sk.globals[b[c]]&&(a[b[c]]=new Function(\"try {Sk.misceval.callsimArray(Sk.globals['\"+b[c]+\"']);} catch(e) {Sk.uncaughtException(e);}\"))}),0===j.width.v&&0===j.height.v){var b=a.offsetWidth,c=a.offsetHeight;Sk.misceval.callsimArray(j.size,[new Sk.builtin.int_(b),new Sk.builtin.int_(c),j.renderMode])}}),g=function(a,b){b.__getattr__=new Sk.builtin.func(function(a,b){return(b=Sk.ffi.remapToJs(b),\"x\"===b)?Sk.builtin.assk$(j.processing.mouseX):\"y\"===b?Sk.builtin.assk$(j.processing.mouseY):\"px\"===b?Sk.builtin.assk$(j.processing.pmouseX):\"py\"===b?Sk.builtin.assk$(j.processing.pmouseY):\"pressed\"===b?new Sk.builtin.bool(j.processing.__mousePressed):\"button\"===b?Sk.builtin.assk$(j.processing.mouseButton):void 0})},j.Mouse=Sk.misceval.buildClass(j,g,\"Mouse\",[]),j.mouse=Sk.misceval.callsimArray(j.Mouse),f=function(a,b){b.__getattr__=new Sk.builtin.func(function(a,b){return(b=Sk.ffi.remapToJs(b),\"key\"===b)?new Sk.builtin.str(j.processing.key.toString()):\"keyCode\"===b?Sk.builtin.assk$(j.processing.keyCode):\"keyPressed\"===b?new Sk.builtin.str(j.processing.keyPressed):void 0})},j.Keyboard=Sk.misceval.buildClass(j,f,\"Keyboard\",[]),j.keyboard=Sk.misceval.callsimArray(j.Keyboard),e=function(a,b){b.__getattr__=new Sk.builtin.func(function(a,b){return(b=Sk.ffi.remapToJs(b),\"frameCount\"===b)?Sk.builtin.assk$(j.processing.frameCount):\"frameRate\"===b?Sk.builtin.assk$(j.processing.frameRate):\"height\"===b?Sk.builtin.assk$(j.processing.height):\"width\"===b?Sk.builtin.assk$(j.processing.width):\"online\"===b?new Sk.builtin.bool(j.processing.online):\"focused\"===b?new Sk.builtin.bool(j.processing.focused):void 0})},j.Environment=Sk.misceval.buildClass(j,e,\"Environment\",[]),j.environment=Sk.misceval.callsimArray(j.Environment),d=function(a,b){b.__init__=new Sk.builtin.func(function(a){a.pixels=null}),b.__getattr__=new Sk.builtin.func(function(a,b){return(b=Sk.ffi.remapToJs(b),\"height\"===b)?Sk.builtin.assk$(j.processing.height):\"width\"===b?Sk.builtin.assk$(j.processing.width):(\"pixels\"===b&&null==a.pixels&&(a.pixels=new Sk.builtin.list(j.processing.pixels.toArray())),a.pixels)})},j.Screen=Sk.misceval.buildClass(j,d,\"Screen\",[]),j.screen=Sk.misceval.callsimArray(j.Screen),j.loadPixels=new Sk.builtin.func(function(){j.processing.loadPixels()}),c=function(a,b){b.__init__=new Sk.builtin.func(function(a,b,c,d,e){\"undefined\"!=typeof c&&(c=c.v),\"undefined\"!=typeof d&&(d=d.v),\"undefined\"!=typeof e&&(e=e.v),a.v=j.processing.color(b.v,c,d,e)})},j.color=Sk.misceval.buildClass(j,c,\"color\",[]),j.red=new Sk.builtin.func(function(a){return new Sk.builtin.int_(j.processing.red(a.v))}),j.green=new Sk.builtin.func(function(a){return new Sk.builtin.int_(j.processing.green(a.v))}),j.blue=new Sk.builtin.func(function(a){return new Sk.builtin.int_(j.processing.blue(a.v))}),b=function(a,b){b.__init__=new Sk.builtin.func(function(a,b,c,d){a.v=\"undefined\"==typeof b?new j.processing.PImage:\"undefined\"==typeof c?new j.processing.PImage(b.v):\"undefined\"==typeof d?new j.processing.PImage(b.v,c.v):new j.processing.PImage(b.v,c.v,d.v)}),b.__getattr__=new Sk.builtin.func(function(a,b){return b=Sk.ffi.remapToJs(b),\"width\"===b?Sk.builtin.assk$(a.v.width):\"height\"===b?Sk.builtin.assk$(a.v.height):void 0})},j.loadImage=new Sk.builtin.func(function(a){var b=j.processing.loadImage(a.v);k.push(b);var c=Sk.misceval.callsimArray(j.PImage);return c.v=b,c}),j.image=new Sk.builtin.func(function(a,b,c,d,e){\"undefined\"==typeof d?j.processing.image(a.v,b.v,c.v):j.processing.image(a.v,b.v,c.v,d.v,e.v)}),j.get=new Sk.builtin.func(function(a,b){var c=j.processing.get(a.v,b.v);return Sk.misceval.callsimArray(j.color,[new Sk.builtin.int_(j.processing.red(c)),new Sk.builtin.int_(j.processing.green(c)),new Sk.builtin.int_(j.processing.blue(c))])}),j.set=new Sk.builtin.func(function(a,b,c){j.processing.set(a.v,b.v,c.v)}),h=function(a,b){b.__init__=new Sk.builtin.func(function(a,b,c,d){a.v=\"undefined\"==typeof b?new j.processing.PVector:\"undefined\"==typeof d?new j.processing.PVector(b.v,c.v):new j.processing.PVector(b.v,c.v,d.v)}),b.__getattr__=new Sk.builtin.func(function(a,b){return(b=Sk.ffi.remapToJs(b),\"x\"===b)?Sk.builtin.assk$(a.v.x):\"y\"===b?Sk.builtin.assk$(a.v.y):\"z\"===b?Sk.builtin.assk$(a.v.z):void 0}),b.get=new Sk.builtin.func(function(a){var b=Sk.misceval.callsimArray(j.PVector);return b.v=a.v.get(),b}),b.set=new Sk.builtin.func(function(a,b,c,b){\"undefined\"==typeof z?a.v.set(b.v,c.v):a.v.set(b.v,c.v,z.v)}),b.mag=new Sk.builtin.func(function(a){return Sk.builtin.assk$(a.v.mag())}),b.add=new Sk.builtin.func(function(a,b){var c=Sk.misceval.callsimArray(j.PVector);return c.v=a.v.add(b.v),c}),b.sub=new Sk.builtin.func(function(a,b){var c=Sk.misceval.callsimArray(j.PVector);return c.v=a.v.sub(b.v),c}),b.mult=new Sk.builtin.func(function(a,b){var c=Sk.misceval.callsimArray(j.PVector);return c.v=a.v.mult(b.v),c}),b.div=new Sk.builtin.func(function(a,b){var c=Sk.misceval.callsimArray(j.PVector);return c.v=a.v.dic(b.v),c}),b.dist=new Sk.builtin.func(function(a,b){return Sk.builtin.assk$(a.v.dist(b.v))}),b.dot=new Sk.builtin.func(function(a,b,c,d){return\"undefined\"==typeof c?Sk.builtin.assk$(a.v.dot(b.v)):Sk.builtin.assk$(a.v.dot(b.v,c.v,d.v))}),b.cross=new Sk.builtin.func(function(a,b){var c=Sk.misceval.callsimArray(j.PVector);return c.v=a.v.cross(b.v),c}),b.normalize=new Sk.builtin.func(function(a){a.v.normalize()}),b.limit=new Sk.builtin.func(function(a,b){a.v.limit(b.v)}),b.angleBetween=new Sk.builtin.func(function(a,b){return Sk.builtin.assk$(a.v.angleBetween(b.v))}),b.array=new Sk.builtin.func(function(a){return new Sk.builtin.list(a.v.array())})},fontClass=function(a,b){b.__init__=new Sk.builtin.func(function(a,b){a.v=\"undefined\"==typeof b?new j.processing.PFont:new j.processing.PVector(b.v)}),b.list=new Sk.builtin.func(function(a){return new Sk.builtin.list(a.v.list())})},graphicsClass=function(a,b){b.__init__=new Sk.builtin.func(function(a,b,c,d){a.v=\"undefined\"==typeof b?new j.processing.PVector:\"undefined\"==typeof d?new j.processing.PVector(b.v,c.v):new j.processing.PVector(b.v,c.v,d.v)}),b.beginDraw=new Sk.builtin.func(function(a){a.v.beginDraw()}),b.endDraw=new Sk.builtin.func(function(a){a.v.endDraw()})},shapeClass=function(a,b){b.__init__=new Sk.builtin.func(function(a,b,c,d){a.v=\"undefined\"==typeof b?null:\"undefined\"==typeof c?new j.processing.PShapeSVG(b.v):\"undefined\"==typeof d?new j.processing.PShapeSVG(b.v,c.v):new j.processing.PShapeSVG(b.v,c.v,d.v)}),b.__getattr__=new Sk.builtin.func(function(a,b){return(b=Sk.ffi.remapToJs(b),\"width\"===b)?Sk.builtin.assk$(a.v.width):\"height\"===b?Sk.builtin.assk$(a.v.height):void 0}),b.isVisible=new Sk.builtin.func(function(a){return new Sk.builtin.bool(a.v.isVisible())}),b.setVisible=new Sk.builtin.func(function(a,b){a.v.setVisible(b.v)}),b.disableStyle=new Sk.builtin.func(function(a){a.v.disableStyle()}),b.enableStyle=new Sk.builtin.func(function(a){a.v.enableStyle()}),b.getChild=new Sk.builtin.func(function(a,b){var c=a.v.getChild(b.v);if(null!=c){var d=Sk.misceval.callsimArray(j.PShapeSVG);return d.v=c,d}return null}),b.translate=new Sk.builtin.func(function(a,b,c,d){\"undefined\"==typeof d?a.v.translate(b.v,c.v):a.v.translate(b.v,c.v,d.v)}),b.rotate=new Sk.builtin.func(function(a,b){a.v.rotate(b.v)}),b.rotateX=new Sk.builtin.func(function(a,b){a.v.rotateX(b.v)}),b.rotateY=new Sk.builtin.func(function(a){a.v.rotateY(angle.v)}),b.rotateZ=new Sk.builtin.func(function(a){a.v.rotateZ(angle.v)}),b.scale=new Sk.builtin.func(function(a,b,c,d){\"undefined\"==typeof c?a.v.scale(b.v):\"undefined\"==typeof d?a.v.scale(b.v,c.v):a.v.scale(b.v,c.v,d.v)})},j.PFont=Sk.misceval.buildClass(j,fontClass,\"PFont\",[]),j.PGraphics=Sk.misceval.buildClass(j,graphicsClass,\"PGraphics\",[]),j.PShapeSVG=Sk.misceval.buildClass(j,shapeClass,\"PShapeSVG\",[]),j.PVector=Sk.misceval.buildClass(j,h,\"PVector\",[]),j.PImage=Sk.misceval.buildClass(j,b,\"PImage\",[]),j};","src/lib/profile.py":"raise NotImplementedError(\"profile is not yet implemented in Skulpt\")\n","src/lib/pstats.py":"raise NotImplementedError(\"pstats is not yet implemented in Skulpt\")\n","src/lib/pty.py":"raise NotImplementedError(\"pty is not yet implemented in Skulpt\")\n","src/lib/py_compile.py":"raise NotImplementedError(\"py_compile is not yet implemented in Skulpt\")\n","src/lib/pyclbr.py":"raise NotImplementedError(\"pyclbr is not yet implemented in Skulpt\")\n","src/lib/pydoc.py":"raise NotImplementedError(\"pydoc 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/pythonds/__init__.py":"","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/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\n\n\nclass Deque:\n def __init__(self):\n self.items = []\n\n def isEmpty(self):\n return self.items == []\n\n def addFront(self, item):\n self.items.append(item)\n\n def addRear(self, item):\n self.items.insert(0,item)\n\n def removeFront(self):\n return self.items.pop()\n\n def removeRear(self):\n return self.items.pop(0)\n\n def size(self):\n return len(self.items)\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\n\nclass Queue:\n def __init__(self):\n self.items = []\n\n def isEmpty(self):\n return self.items == []\n\n def enqueue(self, item):\n self.items.insert(0,item)\n\n def dequeue(self):\n return self.items.pop()\n\n def size(self):\n return len(self.items)\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\n\nclass Stack:\n def __init__(self):\n self.items = []\n\n def isEmpty(self):\n return self.items == []\n\n def push(self, item):\n self.items.append(item)\n\n def pop(self):\n return self.items.pop()\n\n def peek(self):\n return self.items[len(self.items)-1]\n\n def size(self):\n return len(self.items)\n\n","src/lib/pythonds/graphs/__init__.py":"\n\nfrom .adjGraph import Graph\nfrom .adjGraph import Vertex\nfrom .priorityQueue import PriorityQueue\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/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/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/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/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/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/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/quopri.py":"raise NotImplementedError(\"quopri is not yet implemented in Skulpt\")\n","src/lib/random.js":"var MersenneTwister=function(a){a==null&&(a=new Date().getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=Array(this.N),this.mti=this.N+1,this.init_genrand(a)};MersenneTwister.prototype.init_genrand=function(a){for(this.mt[0]=a>>>0,this.mti=1;this.mti<this.N;this.mti++){var a=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&a)>>>16)<<16)+1812433253*(65535&a)+this.mti,this.mt[this.mti]>>>=0}},MersenneTwister.prototype.init_by_array=function(a,b){var d,e,f;for(this.init_genrand(19650218),d=1,e=0,f=this.N>b?this.N:b;f;f--){var g=this.mt[d-1]^this.mt[d-1]>>>30;this.mt[d]=(this.mt[d]^(1664525*((4294901760&g)>>>16)<<16)+1664525*(65535&g))+a[e]+e,this.mt[d]>>>=0,d++,e++,d>=this.N&&(this.mt[0]=this.mt[this.N-1],d=1),e>=b&&(e=0)}for(f=this.N-1;f;f--){var g=this.mt[d-1]^this.mt[d-1]>>>30;this.mt[d]=(this.mt[d]^(1566083941*((4294901760&g)>>>16)<<16)+1566083941*(65535&g))-d,this.mt[d]>>>=0,d++,d>=this.N&&(this.mt[0]=this.mt[this.N-1],d=1)}this.mt[0]=2147483648},MersenneTwister.prototype.genrand_int32=function(){var a,b=[0,this.MATRIX_A];if(this.mti>=this.N){var d;for(this.mti==this.N+1&&this.init_genrand(5489),d=0;d<this.N-this.M;d++)a=this.mt[d]&this.UPPER_MASK|this.mt[d+1]&this.LOWER_MASK,this.mt[d]=this.mt[d+this.M]^a>>>1^b[1&a];for(;d<this.N-1;d++)a=this.mt[d]&this.UPPER_MASK|this.mt[d+1]&this.LOWER_MASK,this.mt[d]=this.mt[d+(this.M-this.N)]^a>>>1^b[1&a];a=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^a>>>1^b[1&a],this.mti=0}return a=this.mt[this.mti++],a^=a>>>11,a^=2636928640&a<<7,a^=4022730752&a<<15,a^=a>>>18,a>>>0},MersenneTwister.prototype.genrand_int31=function(){return this.genrand_int32()>>>1},MersenneTwister.prototype.genrand_real1=function(){return this.genrand_int32()*(1/4294967295)},MersenneTwister.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},MersenneTwister.prototype.genrand_real3=function(){return(this.genrand_int32()+.5)*(1/4294967296)},MersenneTwister.prototype.genrand_res53=function(){var d=this.genrand_int32()>>>5,a=this.genrand_int32()>>>6;return(67108864*d+a)*(1/9007199254740992)};var $builtinmodule=function(){var a=Math.log,b=Math.sqrt,d={},e=new MersenneTwister,f=void 0;d.seed=new Sk.builtin.func(function(a){return Sk.builtin.pyCheckArgsLen(\"seed\",arguments.length,0,1),a=Sk.builtin.asnum$(a),e=0<arguments.length?new MersenneTwister(a):new MersenneTwister,Sk.builtin.none.none$}),d.random=new Sk.builtin.func(function(){return Sk.builtin.pyCheckArgsLen(\"random\",arguments.length,0,0),new Sk.builtin.float_(e.genrand_res53())});var g=function(a){return 0|a},h=function(a,b,d){var f,h,i;if(!Sk.builtin.checkInt(a))throw new Sk.builtin.ValueError(\"non-integer first argument for randrange()\");if(void 0===b)return i=g(e.genrand_res53()*a),new Sk.builtin.int_(i);if(!Sk.builtin.checkInt(b))throw new Sk.builtin.ValueError(\"non-integer stop for randrange()\");if(void 0===d&&(d=1),f=b-a,1==d&&0<f)return i=a+g(e.genrand_res53()*f),new Sk.builtin.int_(i);if(1==d)throw new Sk.builtin.ValueError(\"empty range for randrange() (\"+a+\", \"+b+\", \"+f+\")\");if(!Sk.builtin.checkInt(d))throw new Sk.builtin.ValueError(\"non-integer step for randrange()\");if(0<d)h=g((f+d-1)/d);else if(0>d)h=g((f+d+1)/d);else throw new Sk.builtin.ValueError(\"zero step for randrange()\");if(0>=h)throw new Sk.builtin.ValueError(\"empty range for randrange()\");return i=a+d*g(e.genrand_res53()*h),new Sk.builtin.int_(i)};d.randint=new Sk.builtin.func(function(d,e){return Sk.builtin.pyCheckArgsLen(\"randint\",arguments.length,2,2),d=Sk.builtin.asnum$(d),e=Sk.builtin.asnum$(e),h(d,e+1)}),d.randrange=new Sk.builtin.func(function(a,b,d){return Sk.builtin.pyCheckArgsLen(\"randrange\",arguments.length,1,3),a=Sk.builtin.asnum$(a),b=Sk.builtin.asnum$(b),d=Sk.builtin.asnum$(d),h(a,b,d)}),d.uniform=new Sk.builtin.func(function(d,f){Sk.builtin.pyCheckArgsLen(\"uniform\",arguments.length,2,2),d=Sk.builtin.asnum$(d),f=Sk.builtin.asnum$(f);var g=e.genrand_res53();return c=d+g*(f-d),new Sk.builtin.float_(c)}),d.triangular=new Sk.builtin.func(function(a,d,f){Sk.builtin.pyCheckArgsLen(\"triangular\",arguments.length,2,3),Sk.builtin.pyCheckType(\"low\",\"number\",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType(\"high\",\"number\",Sk.builtin.checkNumber(d));var g,h,i;return a=Sk.builtin.asnum$(a),d=Sk.builtin.asnum$(d),a>d&&(i=a,a=d,d=i),void 0===f||f===Sk.builtin.none.none$?f=(d-a)/2:(Sk.builtin.pyCheckType(\"mode\",\"number\",Sk.builtin.checkNumber(f)),f=Sk.builtin.asnum$(f)),g=e.genrand_res53(),h=g<(f-a)/(d-a)?a+b(g*(d-a)*(f-a)):d-b((1-g)*(d-a)*(d-f)),new Sk.builtin.float_(h)});var i=function(d,g){var k,l,m,n,o,h=Math.sin,i=Math.cos,j=Math.PI;return void 0===f?(k=e.genrand_res53(),l=e.genrand_res53(),m=b(-2*a(k)),n=2*j*l,o=m*i(n),f=m*h(n)):(o=f,f=void 0),d+g*o};return d.gauss=new Sk.builtin.func(function(a,b){return Sk.builtin.pyCheckArgsLen(\"gauss\",arguments.length,2,2),Sk.builtin.pyCheckType(\"mu\",\"number\",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType(\"sigma\",\"number\",Sk.builtin.checkNumber(b)),a=Sk.builtin.asnum$(a),b=Sk.builtin.asnum$(b),new Sk.builtin.float_(i(a,b))}),d.normalvariate=d.gauss,d.lognormvariate=new Sk.builtin.func(function(a,b){var d=Math.exp;return Sk.builtin.pyCheckArgsLen(\"lognormvariate\",arguments.length,2,2),Sk.builtin.pyCheckType(\"mu\",\"number\",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType(\"sigma\",\"number\",Sk.builtin.checkNumber(b)),a=Sk.builtin.asnum$(a),b=Sk.builtin.asnum$(b),new Sk.builtin.float_(d(i(a,b)))}),d.expovariate=new Sk.builtin.func(function(b){Sk.builtin.pyCheckArgsLen(\"expovariate\",arguments.length,1,1),Sk.builtin.pyCheckType(\"lambd\",\"number\",Sk.builtin.checkNumber(b)),b=Sk.builtin.asnum$(b);var d=e.genrand_res53();return new Sk.builtin.float_(-a(d)/b)}),d.choice=new Sk.builtin.func(function(a){if(Sk.builtin.pyCheckArgsLen(\"choice\",arguments.length,1,1),Sk.builtin.pyCheckType(\"seq\",\"sequence\",Sk.builtin.checkSequence(a)),void 0!==a.sq$length){var b=new Sk.builtin.int_(g(e.genrand_res53()*a.sq$length()));return a.mp$subscript(b)}throw new Sk.builtin.TypeError(\"object has no length\")}),d.shuffle=new Sk.builtin.func(function(a){if(Sk.builtin.pyCheckArgsLen(\"shuffle\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"sequence\",Sk.builtin.checkSequence(a)),a.constructor===Sk.builtin.list){const h=a.v;for(var b=h.length-1;0<b;b-=1){var d=g(e.genrand_res53()*(b+1)),f=h[d];h[d]=h[b],h[b]=f}}else if(void 0===a.sq$length)throw new Sk.builtin.TypeError(\"object has no length\");else if(void 0!==a.mp$ass_subscript)for(var d,b=a.sq$length()-1;0<b;b-=1){d=new Sk.builtin.int_(g(e.genrand_res53()*(b+1))),b=new Sk.builtin.int_(b);var f=a.mp$subscript(d);a.mp$ass_subscript(d,a.mp$subscript(b)),a.mp$ass_subscript(b,f)}else throw new Sk.builtin.TypeError(\"object is immutable\");return Sk.builtin.none.none$}),d.sample=new Sk.builtin.func(function(a,b){var f,g,h,l,m,d=Math.floor;for(Sk.builtin.pyCheckArgsLen(\"sample\",arguments.length,2,2),Sk.builtin.pyCheckType(\"population\",\"iterable\",Sk.builtin.checkIterable(a)),Sk.builtin.pyCheckType(\"k\",\"integer\",Sk.builtin.checkInt(b)),b=Sk.builtin.asnum$(b),m=[],h=Sk.abstr.iter(a),(f=0,l=h.tp$iternext());void 0!==l;f++,l=h.tp$iternext())g=d(e.genrand_res53()*(f+1)),f<b?(g<f&&(m[f]=m[g]),m[g]=l):g<b&&(m[g]=l);if(f<b)throw new Sk.builtin.ValueError(\"sample larger than population\");return new Sk.builtin.list(m)}),d};","src/lib/re.js":"var $builtinmodule=function(name){var validGroups,convert,getFlags,_split,_findall,matchobj,_search,_match,regexobj,mod={__name__:new Sk.builtin.str(\"re\")};return mod.I=2,mod.IGNORECASE=2,mod.M=8,mod.MULTILINE=8,validGroups=[\"(?:\",\"(?=\",\"(?!\"],convert=function(a){var b,c,d;if(c=a.match(/\\(\\?./g),c)for(d=0;d<c.length;d++)if(-1==validGroups.indexOf(c[d]))throw new Sk.builtin.ValueError(\"Disallowed group in pattern: '\"+c[d]+\"'\");return b=a.replace(\"/\\\\/g\",\"\\\\\\\\\"),b=a.replace(/([^\\\\]){,(?![^\\[]*\\])/g,\"$1{0,\"),b},getFlags=function(a){var b=\"g\";return(a&mod.IGNORECASE)==mod.IGNORECASE&&(b+=\"i\"),(a&mod.MULTILINE)==mod.MULTILINE&&(b+=\"m\"),b},_split=function(a,b,c,d){var e,f,g,h,i,j,k,l,m;if(Sk.builtin.pyCheckArgsLen(\"split\",arguments.length,2,4),!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError(\"pattern must be a string\");if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError(\"string must be a string\");if(void 0===c&&(c=0),!Sk.builtin.checkNumber(c))throw new Sk.builtin.TypeError(\"maxsplit must be a number\");if(void 0===d&&(d=0),!Sk.builtin.checkNumber(d))throw new Sk.builtin.TypeError(\"flags must be a number\");for(c=Sk.builtin.asnum$(c),e=Sk.ffi.unwrapo(a),f=Sk.ffi.unwrapo(b),e=convert(e),g=null!==e.match(/^\\(.*\\)$/),h=getFlags(d),i=new RegExp(e,h),j=[],k,l=0,m=0;null!=(k=i.exec(f))&&k.index!==i.lastIndex&&(j.push(new Sk.builtin.str(f.substring(l,k.index))),g&&j.push(new Sk.builtin.str(k[0])),l=i.lastIndex,m+=1,!(c&&m>=c)););return j.push(new Sk.builtin.str(f.substring(l))),new Sk.builtin.list(j)},_split.co_varnames=[\"pattern\",\"string\",\"maxsplit\",\"flags\"],_split.$defaults=[new Sk.builtin.int_(0),new Sk.builtin.int_(0)],mod.split=new Sk.builtin.func(_split),_findall=function(a,b,c){var d,e,f,g,h,j;if(Sk.builtin.pyCheckArgsLen(\"findall\",arguments.length,2,3),!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError(\"pattern must be a string\");if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError(\"string must be a string\");if(void 0===c&&(c=0),!Sk.builtin.checkNumber(c))throw new Sk.builtin.TypeError(\"flags must be a number\");if(d=Sk.ffi.unwrapo(a),e=Sk.ffi.unwrapo(b),d=convert(d),f=getFlags(c),g=new RegExp(d,f),d.match(/\\$/)){var k=new RegExp(/\\n$/);e.match(k)&&(e=e.slice(0,-1))}for(h=[],j;null!=(j=g.exec(e));){if(2>j.length)h.push(new Sk.builtin.str(j[0]));else if(2==j.length)h.push(new Sk.builtin.str(j[1]));else{for(var l=[],m=1;m<j.length;m++)l.push(new Sk.builtin.str(j[m]));h.push(new Sk.builtin.tuple(l))}j.index===g.lastIndex&&(g.lastIndex+=1)}return new Sk.builtin.list(h)},_findall.co_varnames=[\"pattern\",\"string\",\"flags\"],_findall.$defaults=[new Sk.builtin.int_(0)],mod.findall=new Sk.builtin.func(_findall),matchobj=function(a,b){b.__init__=new Sk.builtin.func(function(a,b,c,d){return a.thematch=b,a.re=c,a.string=d,Sk.builtin.none.none$}),b.groups=new Sk.builtin.func(function(a){var b=a.thematch.v.slice(1);return new Sk.builtin.tuple(b)}),b.group=new Sk.builtin.func(function(a,b){if(b=void 0===b?0:Sk.builtin.asnum$(b),b>=a.thematch.v.length)throw new Sk.builtin.IndexError(\"Index out of range: \"+b);return a.thematch.v[b]})},mod.MatchObject=Sk.misceval.buildClass(mod,matchobj,\"MatchObject\",[]),mod._findre=function(res,string){res=res.replace(/([^\\\\]){,(?![^\\[]*\\])/g,\"$1{0,\");var matches,sitem,retval,re=eval(res),patt=/\\n$/,str=Sk.ffi.remapToJs(string);if(matches=str.match(patt)?str.slice(0,-1).match(re):str.match(re),retval=new Sk.builtin.list,null==matches)return retval;for(var i=0;i<matches.length;++i)sitem=new Sk.builtin.str(matches[i]),retval.v.push(sitem);return retval},_search=function(a,b,c){var d,e;if(Sk.builtin.pyCheckArgsLen(\"search\",arguments.length,2,3),!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError(\"pattern must be a string\");if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError(\"string must be a string\");if(void 0===c&&(c=0),!Sk.builtin.checkNumber(c))throw new Sk.builtin.TypeError(\"flags must be a number\");return(e=\"/\"+a.v.replace(/\\//g,\"\\\\/\")+\"/\",lst=mod._findre(e,b),1>lst.v.length)?Sk.builtin.none.none$:(d=Sk.misceval.callsimArray(mod.MatchObject,[lst,a,b]),d)},_search.co_varnames=[\"pattern\",\"string\",\"flags\"],_search.$defaults=[new Sk.builtin.int_(0)],mod.search=new Sk.builtin.func(_search),_match=function(a,b,c){var d,e;if(Sk.builtin.pyCheckArgsLen(\"match\",arguments.length,2,3),!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError(\"pattern must be a string\");if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError(\"string must be a string\");if(void 0===c&&(c=0),!Sk.builtin.checkNumber(c))throw new Sk.builtin.TypeError(\"flags must be a number\");return(pat=Sk.ffi.remapToJs(a),e=\"/^\"+pat.replace(/\\//g,\"\\\\/\")+\"/\",lst=mod._findre(e,b),1>Sk.ffi.remapToJs(lst).length)?Sk.builtin.none.none$:(d=Sk.misceval.callsimArray(mod.MatchObject,[lst,a,b]),d)},_match.co_varnames=[\"pattern\",\"string\",\"flags\"],_match.$defaults=[new Sk.builtin.int_(0)],mod.match=new Sk.builtin.func(_match),regexobj=function(a,b){var c,d,e,f,g,h;b.__init__=new Sk.builtin.func(function(a,b,c){return a.re=b,a.flags=void 0===c?0:c,Sk.builtin.none.none$}),h=new Sk.builtin.func(function(a){var b=\"re.compile('\"+Sk.ffi.remapToPy(a.re)+\"')\";return Sk.ffi.remapToPy(b.substring(0,212))}),b.__str__=h,b.__repr__=h,c=function(a,b,c){var d=Sk.ffi.remapToJs(a),e=null==b?0:Sk.ffi.remapToJs(b),f=null==c?d.length:Sk.ffi.remapToJs(c);return\"^\"==e&&(e=d.indexOf(\"\\n\")+1),null===f&&(f=d.length),Sk.ffi.remapToPy(d.substring(e,f))},d=function(a,b,d,e){Sk.builtin.pyCheckArgsLen(\"search\",arguments.length,2,4);var f=c(b,d,e);return _search(a.re,f,a.flags)},d.co_varnames=[\"self\",\"string\",\"pos\",\"endpos\"],d.$defaults=[new Sk.builtin.int_(0),Sk.builtin.none.none$],b.search=new Sk.builtin.func(d),e=function(a,b,d,e){Sk.builtin.pyCheckArgsLen(\"match\",arguments.length,2,4);var f=c(b,d,e);return _match(a.re,f,a.flags)},e.co_varnames=[\"self\",\"string\",\"pos\",\"endpos\"],e.$defaults=[new Sk.builtin.int_(0),Sk.builtin.none.none$],b.match=new Sk.builtin.func(e),f=function(a,b,c){if(Sk.builtin.pyCheckArgsLen(\"split\",arguments.length,2,3),void 0===c&&(c=0),!Sk.builtin.checkInt(c))throw new Sk.builtin.TypeError(\"maxsplit must be an integer\");return _split(a.re,b,c,a.flags)},f.co_varnames=[\"self\",\"string\",\"maxsplit\"],f.$defaults=[new Sk.builtin.int_(0)],b.split=new Sk.builtin.func(f),g=function(a,b,d,e){Sk.builtin.pyCheckArgsLen(\"findall\",arguments.length,2,4);var f=c(b,d,e);return _findall(a.re,f,a.flags)},g.co_varnames=[\"self\",\"string\",\"pos\",\"endpos\"],g.$defaults=[new Sk.builtin.int_(0),Sk.builtin.none.none$],b.findall=new Sk.builtin.func(g)},mod.RegexObject=Sk.misceval.buildClass(mod,regexobj,\"RegexObject\",[]),mod.compile=new Sk.builtin.func(function(a,b){var c;if(Sk.builtin.pyCheckArgsLen(\"compile\",arguments.length,1,2),!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError(\"pattern must be a string\");if(void 0===b&&(b=0),!Sk.builtin.checkNumber(b))throw new Sk.builtin.TypeError(\"flags must be a number\");return c=Sk.misceval.callsimArray(mod.RegexObject,[a,b]),c}),mod.purge=new Sk.builtin.func(function(){}),mod};","src/lib/repr.py":"raise NotImplementedError(\"repr is not yet implemented in Skulpt\")\n","src/lib/rexec.py":"raise NotImplementedError(\"rexec is not yet implemented in Skulpt\")\n","src/lib/rfc822.py":"raise NotImplementedError(\"rfc822 is not yet implemented in Skulpt\")\n","src/lib/rlcompleter.py":"raise NotImplementedError(\"rlcompleter is not yet implemented in Skulpt\")\n","src/lib/robotparser.py":"raise NotImplementedError(\"robotparser is not yet implemented in Skulpt\")\n","src/lib/runpy.py":"raise NotImplementedError(\"runpy is not yet implemented in Skulpt\")\n","src/lib/sched.py":"raise NotImplementedError(\"sched is not yet implemented in Skulpt\")\n","src/lib/sets.py":"raise NotImplementedError(\"sets is not yet implemented in Skulpt\")\n","src/lib/sgmllib.py":"raise NotImplementedError(\"sgmllib is not yet implemented in Skulpt\")\n","src/lib/sha.py":"raise NotImplementedError(\"sha is not yet implemented in Skulpt\")\n","src/lib/shelve.py":"raise NotImplementedError(\"shelve is not yet implemented in Skulpt\")\n","src/lib/shlex.py":"raise NotImplementedError(\"shlex is not yet implemented in Skulpt\")\n","src/lib/shutil.py":"raise NotImplementedError(\"shutil is not yet implemented in Skulpt\")\n","src/lib/signal.js":"var $builtinmodule=function(){var a={SIG_DFL:new Sk.builtin.int_(0),SIG_IGN:new Sk.builtin.int_(1),CTRL_C_EVENT:new Sk.builtin.int_(0),CTRL_BREAK_EVENT:new Sk.builtin.int_(0),NSIG:new Sk.builtin.int_(23),SIGHUP:new Sk.builtin.int_(1),SIGNINT:new Sk.builtin.int_(2),SIGILL:new Sk.builtin.int_(4),SIGFPE:new Sk.builtin.int_(8),SIGKILL:new Sk.builtin.int_(9),SIGSEGV:new Sk.builtin.int_(11),SIGTERM:new Sk.builtin.int_(15),SIGBREAK:new Sk.builtin.int_(21),SIGABRT:new Sk.builtin.int_(22),pause:new Sk.builtin.func(function(){Sk.builtin.pyCheckArgsLen(\"pause\",arguments.length,0,0);var a=new Sk.misceval.Suspension;return a.resume=function(){return Sk.builtin.none.none$},a.data={type:\"Sk.promise\",promise:new Promise(function(a){if(null!=Sk.signals&&Sk.signals.addEventListener){function handleSignal(){Sk.signals.removeEventListener(handleSignal),a()}Sk.signals.addEventListener(handleSignal)}else console.warn(\"signal.pause() not supported\"),Sk.misceval.print_(\"signal.pause() not supported\"),a()})},a}),signal:new Sk.builtin.func(function(){throw new Sk.builtin.NotImplementedError(\"signal.signal is not supported.\")})};return a};","src/lib/site.py":"raise NotImplementedError(\"site is not yet implemented in Skulpt\")\n","src/lib/smtpd.py":"raise NotImplementedError(\"smtpd is not yet implemented in Skulpt\")\n","src/lib/smtplib.py":"raise NotImplementedError(\"smtplib is not yet implemented in Skulpt\")\n","src/lib/sndhdr.py":"raise NotImplementedError(\"sndhdr is not yet implemented in Skulpt\")\n","src/lib/socket.py":"raise NotImplementedError(\"socket is not yet implemented in Skulpt\")\n","src/lib/sqlite3/__init__.py":"raise NotImplementedError(\"sqlite3 is not yet implemented in Skulpt\")\n","src/lib/sre.py":"raise NotImplementedError(\"sre 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/sre_constants.py":"raise NotImplementedError(\"sre_constants 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/ssl.py":"raise NotImplementedError(\"ssl is not yet implemented in Skulpt\")\n","src/lib/stat.py":"raise NotImplementedError(\"stat is not yet implemented in Skulpt\")\n","src/lib/statvfs.py":"raise NotImplementedError(\"statvfs is not yet implemented in Skulpt\")\n","src/lib/string.js":"var $builtinmodule=function(){var a={};return a.ascii_lowercase=new Sk.builtin.str(\"abcdefghijklmnopqrstuvwxyz\"),a.ascii_uppercase=new Sk.builtin.str(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"),a.ascii_letters=new Sk.builtin.str(a.ascii_lowercase.v+a.ascii_uppercase.v),a.lowercase=new Sk.builtin.str(\"abcdefghijklmnopqrstuvwxyz\"),a.uppercase=new Sk.builtin.str(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"),a.letters=new Sk.builtin.str(a.lowercase.v+a.uppercase.v),a.digits=new Sk.builtin.str(\"0123456789\"),a.hexdigits=new Sk.builtin.str(\"0123456789abcdefABCDEF\"),a.octdigits=new Sk.builtin.str(\"01234567\"),a.punctuation=new Sk.builtin.str(\"!\\\"#$%&'()*+,-./:;<=>?@[\\\\]^_`{|}~\"),a.whitespace=new Sk.builtin.str(\"\\t\\n\\x0B\\f\\r \"),a.printable=new Sk.builtin.str(a.digits.v+a.letters.v+a.punctuation.v+\" \\t\\n\\r\\x0B\\f\"),a.split=new Sk.builtin.func(function(a,b,c){return Sk.misceval.callsimArray(Sk.builtin.str.prototype.split,[a,b,c])}),a.capitalize=new Sk.builtin.func(function(a){return Sk.misceval.callsimArray(Sk.builtin.str.prototype.capitalize,[a])}),a.join=new Sk.builtin.func(function(a,b){return void 0===b&&(b=new Sk.builtin.str(\" \")),Sk.misceval.callsimArray(Sk.builtin.str.prototype.join,[b,a])}),a.capwords=new Sk.builtin.func(function(b,c){if(Sk.builtin.pyCheckArgsLen(\"capwords\",arguments.length,1,2),!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError(\"s must be a string\");if(void 0===c&&(c=new Sk.builtin.str(\" \")),!Sk.builtin.checkString(c))throw new Sk.builtin.TypeError(\"sep must be a string\");for(var d=Sk.misceval.callsimArray(a.split,[b,c]).v,e=[],f=0;f<d.length;f++){var g=d[f],h=Sk.misceval.callsimArray(a.capitalize,[g]);e.push(h)}return Sk.misceval.callsimArray(a.join,[new Sk.builtin.list(e),c])}),a};","src/lib/string.py":"raise NotImplementedError(\"string is not yet implemented in Skulpt\")\n","src/lib/stringold.py":"raise NotImplementedError(\"stringold is not yet implemented in Skulpt\")\n","src/lib/stringprep.py":"raise NotImplementedError(\"stringprep is not yet implemented in Skulpt\")\n","src/lib/struct.py":"raise NotImplementedError(\"struct is not yet implemented in Skulpt\")\n","src/lib/subprocess.py":"raise NotImplementedError(\"subprocess is not yet implemented in Skulpt\")\n","src/lib/sunau.py":"raise NotImplementedError(\"sunau is not yet implemented in Skulpt\")\n","src/lib/sunaudio.py":"raise NotImplementedError(\"sunaudio is not yet implemented in Skulpt\")\n","src/lib/symbol.py":"raise NotImplementedError(\"symbol is not yet implemented in Skulpt\")\n","src/lib/symtable.py":"raise NotImplementedError(\"symtable is not yet implemented in Skulpt\")\n","src/lib/tabnanny.py":"raise NotImplementedError(\"tabnanny is not yet implemented in Skulpt\")\n","src/lib/tarfile.py":"raise NotImplementedError(\"tarfile is not yet implemented in Skulpt\")\n","src/lib/telnetlib.py":"raise NotImplementedError(\"telnetlib is not yet implemented in Skulpt\")\n","src/lib/tempfile.py":"raise NotImplementedError(\"tempfile 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/test/decimaltestdata/__init__.py":"raise NotImplementedError(\"decimaltestdata 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/textwrap.py":"\"\"\"Text wrapping and filling.\n\"\"\"\n\n# Copyright (C) 1999-2001 Gregory P. Ward.\n# Copyright (C) 2002, 2003 Python Software Foundation.\n# Written by Greg Ward <gward@python.net>\n\nimport re, string\n\n__all__ = ['TextWrapper', 'wrap', 'fill', 'dedent', 'indent', 'shorten']\n\n# Hardcode the recognized whitespace characters to the US-ASCII\n# whitespace characters. The main reason for doing this is that\n# some Unicode spaces (like \\u00a0) are non-breaking whitespaces.\n_whitespace = '\\t\\n\\x0b\\x0c\\r '\n\nclass TextWrapper:\n \"\"\"\n Object for wrapping/filling text. The public interface consists of\n the wrap() and fill() methods; the other methods are just there for\n subclasses to override in order to tweak the default behaviour.\n If you want to completely replace the main wrapping algorithm,\n you'll probably have to override _wrap_chunks().\n Several instance attributes control various aspects of wrapping:\n width (default: 70)\n the maximum width of wrapped lines (unless break_long_words\n is false)\n initial_indent (default: \"\")\n string that will be prepended to the first line of wrapped\n output. Counts towards the line's width.\n subsequent_indent (default: \"\")\n string that will be prepended to all lines save the first\n of wrapped output; also counts towards each line's width.\n expand_tabs (default: true)\n Expand tabs in input text to spaces before further processing.\n Each tab will become 0 .. 'tabsize' spaces, depending on its position\n in its line. If false, each tab is treated as a single character.\n tabsize (default: 8)\n Expand tabs in input text to 0 .. 'tabsize' spaces, unless\n 'expand_tabs' is false.\n replace_whitespace (default: true)\n Replace all whitespace characters in the input text by spaces\n after tab expansion. Note that if expand_tabs is false and\n replace_whitespace is true, every tab will be converted to a\n single space!\n fix_sentence_endings (default: false)\n Ensure that sentence-ending punctuation is always followed\n by two spaces. Off by default because the algorithm is\n (unavoidably) imperfect.\n break_long_words (default: true)\n Break words longer than 'width'. If false, those words will not\n be broken, and some lines might be longer than 'width'.\n break_on_hyphens (default: true)\n Allow breaking hyphenated words. If true, wrapping will occur\n preferably on whitespaces and right after hyphens part of\n compound words.\n drop_whitespace (default: true)\n Drop leading and trailing whitespace from lines.\n max_lines (default: None)\n Truncate wrapped lines.\n placeholder (default: ' [...]')\n Append to the last line of truncated text.\n \"\"\"\n\n unicode_whitespace_trans = {}\n # uspace = ord(' ')\n uspace = ' '\n for x in _whitespace:\n # unicode_whitespace_trans[ord(x)] = uspace\n unicode_whitespace_trans[x] = uspace\n\n # This funky little regex is just the trick for splitting\n # text up into word-wrappable chunks. E.g.\n # \"Hello there -- you goof-ball, use the -b option!\"\n # splits into\n # Hello/ /there/ /--/ /you/ /goof-/ball,/ /use/ /the/ /-b/ /option!\n # (after stripping out empty strings).\n wordsep_re = re.compile(\n r'(\\s+|' # any whitespace\n r'[^\\s\\w]*\\w+[^0-9\\W]-(?=\\w+[^0-9\\W]))') # hyphenated words\n em_dash = re.compile(r'(\\s+|' # any whitespace\n r'[^\\s\\w]*\\w+[^0-9\\W]-(?=\\w+[^0-9\\W])|' # hyphenated words\n r'(?!^)-{2,}(?=\\w))') # em-dash\n\n \n # This less funky little regex just split on recognized spaces. E.g.\n # \"Hello there -- you goof-ball, use the -b option!\"\n # splits into\n # Hello/ /there/ /--/ /you/ /goof-ball,/ /use/ /the/ /-b/ /option!/\n wordsep_simple_re = re.compile(r'(\\s+)')\n\n\n # XXX this is not locale- or charset-aware -- string.lowercase\n # is US-ASCII only (and therefore English-only)\n sentence_end_re = re.compile(r'[a-z]' # lowercase letter\n r'[\\.\\!\\?]' # sentence-ending punct.\n r'[\\\"\\']?' # optional end-of-quote\n r'\\Z') # end of chunk\n sentence_end_re = r'[a-z][\\.\\!\\?][\\\"\\']?'\n\n def __init__(self,\n width=70,\n initial_indent=\"\",\n subsequent_indent=\"\",\n expand_tabs=True,\n replace_whitespace=True,\n fix_sentence_endings=False,\n break_long_words=True,\n drop_whitespace=True,\n break_on_hyphens=True,\n tabsize=8,\n max_lines=None,\n placeholder=' [...]'):\n self.width = width\n self.initial_indent = initial_indent\n self.subsequent_indent = subsequent_indent\n self.expand_tabs = expand_tabs\n self.replace_whitespace = replace_whitespace\n self.fix_sentence_endings = fix_sentence_endings\n self.break_long_words = break_long_words\n self.drop_whitespace = drop_whitespace\n self.break_on_hyphens = break_on_hyphens\n self.tabsize = tabsize\n self.max_lines = max_lines\n self.placeholder = placeholder\n\n\n # -- Private methods -----------------------------------------------\n # (possibly useful for subclasses to override)\n\n def _munge_whitespace(self, text):\n \"\"\"_munge_whitespace(text : string) -> string\n Munge whitespace in text: expand tabs and convert all other\n whitespace characters to spaces. Eg. \" foo\\\\tbar\\\\n\\\\nbaz\"\n becomes \" foo bar baz\".\n \"\"\"\n if self.expand_tabs:\n text = text.expandtabs(self.tabsize)\n if self.replace_whitespace:\n for key, val in self.unicode_whitespace_trans.items():\n text = text.replace(key, val)\n return text\n\n\n def _split(self, text):\n \"\"\"_split(text : string) -> [string]\n Split the text to wrap into indivisible chunks. Chunks are\n not quite the same as words; see _wrap_chunks() for full\n details. As an example, the text\n Look, goof-ball -- use the -b option!\n breaks into the following chunks:\n 'Look,', ' ', 'goof-', 'ball', ' ', '--', ' ',\n 'use', ' ', 'the', ' ', '-b', ' ', 'option!'\n if break_on_hyphens is True, or in:\n 'Look,', ' ', 'goof-ball', ' ', '--', ' ',\n 'use', ' ', 'the', ' ', '-b', ' ', option!'\n otherwise.\n \"\"\"\n if self.break_on_hyphens is True:\n chunks = self.wordsep_re.split(text)\n if \"--\" in text:\n chunks = [item \n for sublist in [self.em_dash.split(chunk) for chunk in chunks] \n for item in sublist]\n else:\n chunks = self.wordsep_simple_re.split(text)\n chunks = [c for c in chunks if c]\n return chunks\n\n def _fix_sentence_endings(self, chunks):\n \"\"\"_fix_sentence_endings(chunks : [string])\n Correct for sentence endings buried in 'chunks'. Eg. when the\n original text contains \"... foo.\\\\nBar ...\", munge_whitespace()\n and split() will convert that to [..., \"foo.\", \" \", \"Bar\", ...]\n which has one too few spaces; this method simply changes the one\n space to two.\n \"\"\"\n i = 0\n # patsearch = self.sentence_end_re.search\n while i < len(chunks)-1:\n if chunks[i+1] == \" \" and re.search(self.sentence_end_re, chunks[i]) and chunks[i][-1] in \".!?\\\"\\'\":\n chunks[i+1] = \" \"\n i += 2\n else:\n i += 1\n\n def _handle_long_word(self, reversed_chunks, cur_line, cur_len, width):\n \"\"\"_handle_long_word(chunks : [string],\n cur_line : [string],\n cur_len : int, width : int)\n Handle a chunk of text (most likely a word, not whitespace) that\n is too long to fit in any line.\n \"\"\"\n # Figure out when indent is larger than the specified width, and make\n # sure at least one character is stripped off on every pass\n if width < 1:\n space_left = 1\n else:\n space_left = width - cur_len\n\n # If we're allowed to break long words, then do so: put as much\n # of the next chunk onto the current line as will fit.\n if self.break_long_words:\n cur_line.append(reversed_chunks[-1][:space_left])\n reversed_chunks[-1] = reversed_chunks[-1][space_left:]\n\n # Otherwise, we have to preserve the long word intact. Only add\n # it to the current line if there's nothing already there --\n # that minimizes how much we violate the width constraint.\n elif not cur_line:\n cur_line.append(reversed_chunks.pop())\n\n # If we're not allowed to break long words, and there's already\n # text on the current line, do nothing. Next time through the\n # main loop of _wrap_chunks(), we'll wind up here again, but\n # cur_len will be zero, so the next line will be entirely\n # devoted to the long word that we can't handle right now.\n\n def _wrap_chunks(self, chunks):\n \"\"\"_wrap_chunks(chunks : [string]) -> [string]\n Wrap a sequence of text chunks and return a list of lines of\n length 'self.width' or less. (If 'break_long_words' is false,\n some lines may be longer than this.) Chunks correspond roughly\n to words and the whitespace between them: each chunk is\n indivisible (modulo 'break_long_words'), but a line break can\n come between any two chunks. Chunks should not have internal\n whitespace; ie. a chunk is either all whitespace or a \"word\".\n Whitespace chunks will be removed from the beginning and end of\n lines, but apart from that whitespace is preserved.\n \"\"\"\n lines = []\n if self.width <= 0:\n raise ValueError(\"invalid width %r (must be > 0)\" % self.width)\n if self.max_lines is not None:\n if self.max_lines > 1:\n indent = self.subsequent_indent\n else:\n indent = self.initial_indent\n if len(indent) + len(self.placeholder.lstrip()) > self.width:\n raise ValueError(\"placeholder too large for max width\")\n\n # Arrange in reverse order so items can be efficiently popped\n # from a stack of chucks.\n chunks.reverse()\n\n while chunks:\n\n # Start the list of chunks that will make up the current line.\n # cur_len is just the length of all the chunks in cur_line.\n cur_line = []\n cur_len = 0\n\n # Figure out which static string will prefix this line.\n if lines:\n indent = self.subsequent_indent\n else:\n indent = self.initial_indent\n\n # Maximum width for this line.\n width = self.width - len(indent)\n\n # First chunk on line is whitespace -- drop it, unless this\n # is the very beginning of the text (ie. no lines started yet).\n if self.drop_whitespace and chunks[-1].strip() == '' and lines:\n del chunks[-1]\n\n while chunks:\n l = len(chunks[-1])\n\n # Can at least squeeze this chunk onto the current line.\n if cur_len + l <= width:\n cur_line.append(chunks.pop())\n cur_len += l\n\n # Nope, this line is full.\n else:\n break\n\n # The current line is full, and the next chunk is too big to\n # fit on *any* line (not just this one).\n if chunks and len(chunks[-1]) > width:\n self._handle_long_word(chunks, cur_line, cur_len, width)\n cur_len = sum(map(len, cur_line))\n\n # If the last chunk on this line is all whitespace, drop it.\n if self.drop_whitespace and cur_line and cur_line[-1].strip() == '':\n cur_len -= len(cur_line[-1])\n del cur_line[-1]\n\n if cur_line:\n if (self.max_lines is None or\n len(lines) + 1 < self.max_lines or\n (not chunks or\n self.drop_whitespace and\n len(chunks) == 1 and\n not chunks[0].strip()) and cur_len <= width):\n # Convert current line back to a string and store it in\n # list of all lines (return value).\n lines.append(indent + ''.join(cur_line))\n else:\n while cur_line:\n if (cur_line[-1].strip() and\n cur_len + len(self.placeholder) <= width):\n cur_line.append(self.placeholder)\n lines.append(indent + ''.join(cur_line))\n break\n cur_len -= len(cur_line[-1])\n del cur_line[-1]\n else:\n if lines:\n prev_line = lines[-1].rstrip()\n if (len(prev_line) + len(self.placeholder) <=\n self.width):\n lines[-1] = prev_line + self.placeholder\n break\n lines.append(indent + self.placeholder.lstrip())\n break\n\n return lines\n\n def _split_chunks(self, text):\n text = self._munge_whitespace(text)\n return self._split(text)\n\n # -- Public interface ----------------------------------------------\n\n def wrap(self, text):\n \"\"\"wrap(text : string) -> [string]\n Reformat the single paragraph in 'text' so it fits in lines of\n no more than 'self.width' columns, and return a list of wrapped\n lines. Tabs in 'text' are expanded with string.expandtabs(),\n and all other whitespace characters (including newline) are\n converted to space.\n \"\"\"\n chunks = self._split_chunks(text)\n if self.fix_sentence_endings:\n self._fix_sentence_endings(chunks)\n return self._wrap_chunks(chunks)\n\n def fill(self, text):\n \"\"\"fill(text : string) -> string\n Reformat the single paragraph in 'text' to fit in lines of no\n more than 'self.width' columns, and return a new string\n containing the entire wrapped paragraph.\n \"\"\"\n return \"\\n\".join(self.wrap(text))\n\n\n# -- Convenience interface ---------------------------------------------\n\ndef wrap(text, width=70, **kwargs):\n \"\"\"Wrap a single paragraph of text, returning a list of wrapped lines.\n Reformat the single paragraph in 'text' so it fits in lines of no\n more than 'width' columns, and return a list of wrapped lines. By\n default, tabs in 'text' are expanded with string.expandtabs(), and\n all other whitespace characters (including newline) are converted to\n space. See TextWrapper class for available keyword args to customize\n wrapping behaviour.\n \"\"\"\n w = TextWrapper(width=width, **kwargs)\n return w.wrap(text)\n\ndef fill(text, width=70, **kwargs):\n \"\"\"Fill a single paragraph of text, returning a new string.\n Reformat the single paragraph in 'text' to fit in lines of no more\n than 'width' columns, and return a new string containing the entire\n wrapped paragraph. As with wrap(), tabs are expanded and other\n whitespace characters converted to space. See TextWrapper class for\n available keyword args to customize wrapping behaviour.\n \"\"\"\n w = TextWrapper(width=width, **kwargs)\n return w.fill(text)\n\ndef shorten(text, width, **kwargs):\n \"\"\"Collapse and truncate the given text to fit in the given width.\n The text first has its whitespace collapsed. If it then fits in\n the *width*, it is returned as is. Otherwise, as many words\n as possible are joined and then the placeholder is appended::\n >>> textwrap.shorten(\"Hello world!\", width=12)\n 'Hello world!'\n >>> textwrap.shorten(\"Hello world!\", width=11)\n 'Hello [...]'\n \"\"\"\n w = TextWrapper(width=width, max_lines=1, **kwargs)\n return w.fill(' '.join(text.strip().split()))\n\n\n# -- Loosely related functionality -------------------------------------\n\n# _whitespace_only_re = re.compile('^[ \\t]+$', re.MULTILINE)\n# _leading_whitespace_re = re.compile('(^[ \\t]*)(?:[^ \\t\\n])', re.MULTILINE)\n\ndef dedent(text):\n \"\"\"Remove any common leading whitespace from every line in `text`.\n This can be used to make triple-quoted strings line up with the left\n edge of the display, while still presenting them in the source code\n in indented form.\n Note that tabs and spaces are both treated as whitespace, but they\n are not equal: the lines \" hello\" and \"\\\\thello\" are\n considered to have no common leading whitespace.\n Entirely blank lines are normalized to a newline character.\n \"\"\"\n # Look for the longest leading string of spaces and tabs common to\n # all lines.\n margin = None\n\n indents = re.findall(r'(^[ \\t]*)(?:[^ \\t\\n])',text, re.MULTILINE)\n for indent in indents:\n if margin is None:\n margin = indent\n\n # Current line more deeply indented than previous winner:\n # no change (previous winner is still on top).\n elif indent.startswith(margin):\n pass\n\n # Current line consistent with and no deeper than previous winner:\n # it's the new winner.\n elif margin.startswith(indent):\n margin = indent\n\n # Find the largest common whitespace between current line and previous\n # winner.\n else:\n for i, (x, y) in enumerate(zip(margin, indent)):\n if x != y:\n margin = margin[:i]\n break\n # sanity check (testing/debugging only)\n if 0 and margin:\n for line in text.split(\"\\n\"):\n assert not line or line.startswith(margin), \\\n \"line = %r, margin = %r\" % (line, margin)\n\n if margin:\n lines = [line[len(margin):] \n if line.strip()\n else line.strip() \n for line in text.split(\"\\n\")]\n text = \"\\n\".join(lines)\n return text\n\n\ndef indent(text, prefix, predicate=None):\n \"\"\"Adds 'prefix' to the beginning of selected lines in 'text'.\n If 'predicate' is provided, 'prefix' will only be added to the lines\n where 'predicate(line)' is True. If 'predicate' is not provided,\n it will default to adding 'prefix' to all non-empty lines that do not\n consist solely of whitespace characters.\n \"\"\"\n if predicate is None:\n def predicate(line):\n return line.strip()\n\n def prefixed_lines():\n for line in text.splitlines(True):\n yield (prefix + line if predicate(line) else line)\n return ''.join(prefixed_lines())\n\n\nif __name__ == \"__main__\":\n #print dedent(\"\\tfoo\\n\\tbar\")\n #print dedent(\" \\thello there\\n \\t how are you?\")\n print(dedent(\"Hello there.\\n This is indented.\"))","src/lib/this.py":"raise NotImplementedError(\"this is not yet implemented in Skulpt\")\n","src/lib/threading.py":"raise NotImplementedError(\"threading is not yet implemented in Skulpt\")\n","src/lib/time.js":"var $builtinmodule=function(){function check_struct_time(a){if(!(a instanceof b))throw new Sk.builtin.TypeError(\"Required argument 'struct_time' must be of type: 'struct_time'\");var c,d=a.v.length,e=a.v;for(c=0;c<d;++c)if(!Sk.builtin.checkInt(e[c]))throw new Sk.builtin.TypeError(\"struct_time may only contain integers\");return!0}function padLeft(a,b,d){var c=a.toString();return Array(b-c.length+1).join(d||\" \")+c}function isLeapYear(a){return 0==(3&a)&&(0!=a%100||0==a%400)}function getDayOfYear(a,b){b=b||!1;var c=b?a.getUTCMonth():a.getMonth(),d=b?a.getUTCDate():a.getDate(),e=[0,31,59,90,120,151,181,212,243,273,304,334][c]+d;return 1<c&&isLeapYear(b?a.getUTCFullYear():a.getFullYear())&&e++,e}function stdTimezoneOffset(){var a=Math.max,b=new Date(2002,0,1),c=new Date(2002,6,1);return a(b.getTimezoneOffset(),c.getTimezoneOffset())}function dst(a){return a.getTimezoneOffset()<stdTimezoneOffset()}function timeZoneName(a){var b,c=/\\((.*)\\)/.exec(a.toString());if(null!=this.navigator&&(b=this.navigator.userLanguage||this.navigator.language),c&&1<c.length)return c[1];if(void 0===b)return null;try{var d=a.toLocaleString(b,{timeZoneName:\"short\"});return c=d.split(\" \"),c[c.length-1]}catch(a){return null}}function date_to_struct_time(a,c){return c=c||!1,new b([Sk.builtin.assk$(c?a.getUTCFullYear():a.getFullYear()),Sk.builtin.assk$((c?a.getUTCMonth():a.getMonth())+1),Sk.builtin.assk$(c?a.getUTCDate():a.getDate()),Sk.builtin.assk$(c?a.getUTCHours():a.getHours()),Sk.builtin.assk$(c?a.getUTCMinutes():a.getMinutes()),Sk.builtin.assk$(c?a.getUTCSeconds():a.getSeconds()),Sk.builtin.assk$(((c?a.getUTCDay():a.getDay())+6)%7),Sk.builtin.assk$(getDayOfYear(a,c)),Sk.builtin.assk$(c?0:dst(a)?1:0)])}function localtime_f(a){Sk.builtin.pyCheckArgsLen(\"localtime\",arguments.length,0,1);var b=new Date;if(a){Sk.builtin.pyCheckType(\"secs\",\"number\",Sk.builtin.checkNumber(a));var c=Sk.builtin.asnum$(a);b.setTime(1e3*c)}return date_to_struct_time(b)}function asctime_f(a){if(!a||Sk.builtin.checkNone(a)?a=localtime_f():!(a instanceof b)&&(a=new b(a)),a instanceof Sk.builtin.tuple&&9==a.v.length){var e=[d[Sk.builtin.asnum$(a.v[6])],c[Sk.builtin.asnum$(a.v[1])-1],padLeft(Sk.builtin.asnum$(a.v[2]).toString(),2,\"0\"),padLeft(Sk.builtin.asnum$(a.v[3]).toString(),2,\"0\")+\":\"+padLeft(Sk.builtin.asnum$(a.v[4]).toString(),2,\"0\")+\":\"+padLeft(Sk.builtin.asnum$(a.v[5]).toString(),2,\"0\"),padLeft(Sk.builtin.asnum$(a.v[0]).toString(),4,\"0\")];return new Sk.builtin.str(e.join(\" \"))}}function mktime_f(a){if(a instanceof Sk.builtin.tuple&&9==a.v.length){var b=new Date(Sk.builtin.asnum$(a.v[0]),Sk.builtin.asnum$(a.v[1])-1,Sk.builtin.asnum$(a.v[2]),Sk.builtin.asnum$(a.v[3]),Sk.builtin.asnum$(a.v[4]),Sk.builtin.asnum$(a.v[5]));return Sk.builtin.assk$(b.getTime()/1e3,void 0)}throw new Sk.builtin.TypeError(\"mktime() requires a struct_time or 9-tuple\")}var a={__file__:\"/src/lib/time/__init__.js\",__package__:new Sk.builtin.str(\"\")},b=Sk.builtin.make_structseq(\"time\",\"struct_time\",{tm_year:\"year, for example, 1993\",tm_mon:\"month of year, range [1, 12]\",tm_mday:\"day of month, range [1, 31]\",tm_hour:\"hours, range [0, 23]\",tm_min:\"minutes, range [0, 59]\",tm_sec:\"seconds, range [0, 61]\",tm_wday:\"day of week, range [0, 6], Monday is 0\",tm_yday:\"day of year, range [1, 366]\",tm_isdst:\"1 if summer time is in effect, 0 if not, and -1 if unknown\"});a.struct_time=b,a.time=new Sk.builtin.func(function(){Sk.builtin.pyCheckArgsLen(\"time\",arguments.length,0,0);var a=Date.now();return this.performance&&this.performance.now&&(a+=performance.now()%1),Sk.builtin.assk$(a/1e3,void 0)}),a.sleep=new Sk.builtin.func(function(a){return Sk.builtin.pyCheckArgsLen(\"sleep\",arguments.length,1,1),Sk.builtin.pyCheckType(\"delay\",\"float\",Sk.builtin.checkNumber(a)),new Sk.misceval.promiseToSuspension(new Promise(function(b){Sk.setTimeout(function(){b(Sk.builtin.none.none$)},1e3*Sk.ffi.remapToJs(a))}))}),a.localtime=new Sk.builtin.func(localtime_f),a.gmtime=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen(\"localtime\",arguments.length,0,1);var b=new Date;if(a){Sk.builtin.pyCheckType(\"secs\",\"number\",Sk.builtin.checkNumber(a));var c=Sk.builtin.asnum$(a);b.setTime(1e3*c)}return date_to_struct_time(b,!0)});var c=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],d=[\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\",\"Sun\"];return a.asctime=new Sk.builtin.func(asctime_f),a.ctime=new Sk.builtin.func(function(a){return asctime_f(localtime_f(a))}),a.mktime=new Sk.builtin.func(mktime_f),a.timezone=new Sk.builtin.int_(60*stdTimezoneOffset()),a.altzone=new Sk.builtin.int_(60*function altTimezoneOffset(){var a=Math.min,b=new Date(2002,0,1),c=new Date(2002,6,1);return a(b.getTimezoneOffset(),c.getTimezoneOffset())}()),a.daylight=new Sk.builtin.int_(dst(new Date)?1:0),a.tzname=new Sk.builtin.tuple(function timeZoneNames(){var a=new Date(2002,0,1),b=new Date(2002,6,1);return dst(a)?[new Sk.builtin.str(timeZoneName(b)),new Sk.builtin.str(timeZoneName(a))]:[new Sk.builtin.str(timeZoneName(a)),new Sk.builtin.str(timeZoneName(b))]}()),a.accept2dyear=Sk.builtin.assk$(1),a.clock=new Sk.builtin.func(function(){var a=0;return a=this.performance&&this.performance.now?performance.now()/1e3:new Date().getTime()/1e3,new Sk.builtin.float_(a)}),a.strftime=new Sk.builtin.func(function strftime_f(a,c){var d;if(Sk.builtin.pyCheckArgsLen(\"strftime\",arguments.length,1,2),!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError(\"format must be a string\");return c?!(c instanceof b)&&(c=new b(c)):c=localtime_f(),check_struct_time(c),d=Sk.ffi.remapToJs(a),Sk.ffi.remapToPy(strftime(d,new Date(1e3*mktime_f(c).v)))}),a.tzset=new Sk.builtin.func(function tzset_f(){throw new Sk.builtin.NotImplementedError(\"time.tzset() is not yet implemented\")}),a.strptime=new Sk.builtin.func(function strptime_f(a,b){Sk.builtin.pyCheckArgsLen(\"strptime\",arguments.length,1,2),Sk.builtin.pyCheckType(\"string\",\"string\",Sk.builtin.checkString(a)),void 0===b?b=new Sk.builtin.str(\"%a %b %d %H:%M:%S %Y\"):Sk.builtin.pyCheckType(\"format\",\"string\",Sk.builtin.checkString(b));let c=date_to_struct_time(strptime(Sk.ffi.remapToJs(a),Sk.ffi.remapToJs(b),!0));return c.v[8]=new Sk.builtin.int_(-1),c}),a};","src/lib/timeit.py":"raise NotImplementedError(\"timeit is not yet implemented in Skulpt\")\n","src/lib/toaiff.py":"raise NotImplementedError(\"toaiff is not yet implemented in Skulpt\")\n","src/lib/token.js":"var $builtinmodule=function(){var a={__file__:\"/src/lib/token.py\"};const b=[];for(token in Sk.token.tok_name){const c=Sk.token.tok_name[token].slice(2),d=parseInt(token,10);b.push(Sk.ffi.remapToPy(d)),b.push(Sk.ffi.remapToPy(c)),a[c]=Sk.ffi.remapToPy(d)}return a.tok_name=new Sk.builtin.dict(b),a.ISTERMINAL=new Sk.builtin.func(function(a){return Sk.builtin.pyCheckArgsLen(\"ISTERMINAL\",arguments.length,1,1),Sk.token.ISTERMINAL(Sk.ffi.remapToJs(a))}),a.ISNONTERMINAL=new Sk.builtin.func(function(a){return Sk.builtin.pyCheckArgsLen(\"ISNONTERMINAL\",arguments.length,1,1),Sk.token.ISNONTERMINAL(Sk.ffi.remapToJs(a))}),a.ISEOF=new Sk.builtin.func(function(a){return Sk.builtin.pyCheckArgsLen(\"ISEOF\",arguments.length,1,1),Sk.token.ISEOF(Sk.ffi.remapToJs(a))}),a};","src/lib/tokenize.js":"var $builtinmodule=function(){var a={tokenize:new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen(\"tokenize\",1,1),Sk.builtin.checkFunction(a);const b=[];return Sk._tokenize(\"<stdin>\",function jsReadline(){const b=Sk.misceval.callsimArray(a);return Sk.ffi.remapToJs(b)},\"UTF-8\",function receiveToken(a){b.push(new Sk.builtin.tuple([Sk.ffi.remapToPy(a.type),Sk.ffi.remapToPy(a.string),new Sk.builtin.tuple([Sk.ffi.remapToPy(a.start[0]),Sk.ffi.remapToPy(a.start[1])]),new Sk.builtin.tuple([Sk.ffi.remapToPy(a.end[0]),Sk.ffi.remapToPy(a.end[1])]),Sk.ffi.remapToPy(a.line)]))}),new Sk.builtin.list(b)})};return a};","src/lib/trace.py":"raise NotImplementedError(\"trace is not yet implemented in Skulpt\")\n","src/lib/traceback.py":"raise NotImplementedError(\"traceback is not yet implemented in Skulpt\")\n","src/lib/tty.py":"raise NotImplementedError(\"tty is not yet implemented in Skulpt\")\n","src/lib/turtle.js":"var $builtinmodule=function(){\"use strict\";var e=function getConfiguredTarget(){var e,t;for(e=Sk.TurtleGraphics&&Sk.TurtleGraphics.target||\"turtle\",t=\"string\"==typeof e?document.getElementById(e):e;t.firstChild;)t.removeChild(t.firstChild);return t}();return e.turtleInstance?e.turtleInstance.reset():e.turtleInstance=function generateTurtleModule(e){var t=Math.round,r=Math.max,n=Math.sqrt,a=Math.min,s=Math.abs,o=Math.PI,d=Math.atan2,_=Math.sin,c=Math.cos;function getAsset(e){var t=g.assets,r=\"function\"==typeof t?t(e):t[e];return\"string\"==typeof r?new Promise(function(t,n){var a=new Image;a.onload=function(){g.assets[e]=this,t(a)},a.onerror=function(){n(new Error(\"Missing asset: \"+r))},a.src=r}):new InstantPromise(void 0,r)}function InstantPromise(e,t){this.lastResult=t,this.lastError=e}function FrameManager(){this.reset()}function getFrameManager(){return A||(A=new FrameManager),A}function MouseHandler(){var t=this;for(var r in this._target=getTarget(),this._managers={},this._handlers={mousedown:function(r){t.onEvent(\"mousedown\",r)},mouseup:function(r){t.onEvent(\"mouseup\",r)},mousemove:function(r){t.onEvent(\"mousemove\",r)}},this._handlers)this._target.addEventListener(r,this._handlers[r])}function EventManager(e,t){this._type=e,this._target=t,this._handlers=void 0,getMouseHandler().addManager(e,this)}function Turtle(e){if(getFrameManager().addTurtle(this),this._screen=getScreen(),this._managers={},this._shape=e.v,!v.hasOwnProperty(this._shape))throw new Sk.builtin.ValueError(\"Shape:'\"+this._shape+\"' not in default shape, please check shape again!\");this.reset()}function Screen(){var e,t;this._frames=1,this._delay=void 0,this._bgcolor=\"none\",this._mode=\"standard\",this._managers={},this._keyLogger={},e=(g.worldWidth||g.width||getWidth())/2,t=(g.worldHeight||g.height||getHeight())/2,this.setUpWorld(-e,-t,e,t)}function ensureAnonymous(){return f||(f=Sk.misceval.callsimArray(y.Turtle)),f.instance}function getTarget(){return e}function getScreen(){return p||(p=new Screen),p}function getMouseHandler(){return h||(h=new MouseHandler),h}function getWidth(){return 0|(p&&p._width||g.width||getTarget().clientWidth||T.width)}function getHeight(){return 0|(p&&p._height||g.height||getTarget().clientHeight||T.height)}function createLayer(e,t){var r,n=document.createElement(\"canvas\"),a=getWidth(),s=getHeight(),l=getTarget().firstChild?-s+\"px\":\"0\";return n.width=a,n.height=s,n.style.position=\"relative\",n.style.display=\"block\",n.style.setProperty(\"margin-top\",l),n.style.setProperty(\"z-index\",e),t&&(n.style.display=\"none\"),getTarget().appendChild(n),r=n.getContext(\"2d\"),r.lineCap=\"round\",r.lineJoin=\"round\",applyWorld(getScreen(),r),r}function cancelAnimationFrame(){u&&((window.cancelAnimationFrame||window.mozCancelAnimationFrame)(u),u=void 0),m&&(window.clearTimeout(m),m=void 0)}function applyWorld(e,t){var r=e.llx,n=e.lly,a=e.urx,s=e.ury,l=e.xScale,i=e.yScale;t&&(clearLayer(t),t.restore(),t.save(),t.scale(1/l,1/i),0===n?t.translate(-r,n-(s-n)):0<n?t.translate(-r,2*-n):t.translate(-r,-s))}function pushUndo(e){var t,r,n;if(g.allowUndo&&e._bufferSize){for(e._undoBuffer||(e._undoBuffer=[]);e._undoBuffer.length>e._bufferSize;)e._undoBuffer.shift();for(r={},t=[\"x\",\"y\",\"angle\",\"radians\",\"color\",\"fill\",\"down\",\"filling\",\"shown\",\"shape\",\"size\"],n=0;n<t.length;n++)r[t[n]]=e[\"_\"+t[n]];return e._undoBuffer.push(r),e.addUpdate(function(){r.fillBuffer=this.fillBuffer?this.fillBuffer.slice():void 0,e._paper&&e._paper.canvas&&(r.image=e._paper.canvas.toDataURL())},!1)}}function popUndo(e){var t;if(e._bufferSize&&e._undoBuffer&&(t=e._undoBuffer.pop(),!!t)){for(var r in t)\"image\"!=r&&\"fillBuffer\"!==r&&(e[\"_\"+r]=t[r]);return e.addUpdate(function(){var e;t.image&&(L.src=t.image,e=L),clearLayer(this.context(),!1,L),delete t.image},!0,t)}}function removeLayer(e){e&&e.canvas&&e.canvas.parentNode&&e.canvas.parentNode.removeChild(e.canvas)}function clearLayer(e,t,r){e&&(e.save(),e.setTransform(1,0,0,1,0,0),t?(e.fillStyle=t,e.fillRect(0,0,e.canvas.width,e.canvas.height)):e.clearRect(0,0,e.canvas.width,e.canvas.height),r&&e.drawImage(r,0,0),e.restore())}function drawTurtle(e,t){var r,n,a,s=v[e.shape],l=getScreen(),u=getWidth(),m=getHeight(),p=l.xScale,g=l.yScale;if(t){if(r=c(e.radians)/p,n=_(e.radians)/g,a=d(n,r)-o/2,t.save(),t.translate(e.x,e.y),t.scale(p,g),s.nodeName){var f=s.naturalWidth,h=s.naturalHeight;t.drawImage(s,0,0,f,h,-f/2,-h/2,f,h)}else{t.rotate(a),t.beginPath(),t.lineWidth=1,t.strokeStyle=e.color,t.fillStyle=e.fill,t.moveTo(-s[0][0],s[0][1]);for(var $=1;$<s.length;$++)t.lineTo(-s[$][0],s[$][1]);t.closePath(),t.fill(),t.stroke()}t.restore()}}function drawDot(e,t){var r=this.context(),n=getScreen(),l=n.xScale,i=n.yScale;r&&(r.beginPath(),r.moveTo(this.x,this.y),e*=a(s(l),s(i)),r.arc(this.x,this.y,e/2,0,Turtle.RADIANS),r.closePath(),r.fillStyle=t||this.color,r.fill())}function measureText(e,t){return t&&(S.font=t),S.measureText(e).width}function drawText(e,t,r){var n=this.context();n&&(n.save(),r&&(n.font=r),t&&t.match(/^(left|right|center)$/)&&(n.textAlign=t),n.scale(1,-1),n.fillStyle=this.fill,n.fillText(e,this.x,-this.y),n.restore())}function drawLine(e,t){var r=this.context();r&&(t&&(r.beginPath(),r.moveTo(this.x,this.y)),r.lineWidth=this.size*getScreen().lineScale,r.strokeStyle=this.color,r.lineTo(e.x,e.y),r.stroke())}function drawFill(){var e,t=this.context(),r=this.fillBuffer;if(t&&r&&r.length){for(t.save(),t.beginPath(),t.moveTo(r[0].x,r[0].y),e=1;e<r.length;e++)t.lineTo(r[e].x,r[e].y);for(t.closePath(),t.fillStyle=this.fill,t.fill(),e=1;e<r.length;e++)r[e].stroke&&(t.beginPath(),t.moveTo(r[e-1].x,r[e-1].y),t.lineWidth=r[e].size*getScreen().lineScale,t.strokeStyle=r[e].color,t.lineTo(r[e].x,r[e].y),t.stroke());t.restore()}}function partialTranslate(e,t,r,n,a){return function(){return e.addUpdate(function(e){this.down&&drawLine.call(this,e,n)},a,{x:t,y:r},n)}}function translate(e,a,l,o,d,_,c){var u,m=e._computed_speed,p=getScreen(),g=s(p.xScale),f=s(p.yScale),h=a,$=l,w=n(o*o*g+d*d*f),b=m?t(r(1,w/m)):1,v=getFrameManager().willRenderNext()?Promise.resolve():new InstantPromise;for(e.addUpdate(function(){this.filling&&this.fillBuffer.push({x:this.x,y:this.y,stroke:this.down,color:this.color,size:this.size})},!1),u=0;u<b;u++)h=a+o/b*(u+1),$=l+d/b*(u+1),v=v.then(partialTranslate(e,h,$,_,m||!c)),_=!1;return v.then(function(){return[a+o,l+d]})}function partialRotate(e,t,r,n){return function(){return e.addUpdate(void 0,n,{angle:t,radians:r})}}function rotate(e,n,a,l){var o,d=e._computed_speed,_=360*(a/e._fullCircle),c=d?t(r(1,s(_)/d)):1,u={},m=getFrameManager().willRenderNext()?Promise.resolve():new InstantPromise;for(o=0;o<c;o++)calculateHeading(e,n+a/c*(o+1),u),m=m.then(partialRotate(e,u.angle,u.radians,d||!l));return m.then(function(){return calculateHeading(e,n+a)})}function getCoordinates(e,t){return void 0===t&&(t=e&&(e.y||e._y||e[1])||0,e=e&&(e.x||e._x||e[0])||0),{x:e,y:t}}function hexToRGB(e){var t,r,n;return(t=/^rgba?\\((\\d+),(\\d+),(\\d+)(?:,([.\\d]+))?\\)$/.exec(e))?(n=[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])],t[4]&&n.push(parseFloat(t[4]))):/^#?[a-f\\d]{3}|[a-f\\d]{6}$/i.exec(e)?(4===e.length&&(e=e.replace(/^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i,function(e,t,r,n){return t+t+r+r+n+n})),r=/^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(e),n=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)]):n=e,n}function createColor(e,t,n,s,l){var o;if(void 0!==n&&(t=[t,n,s,l]),t.constructor===Array&&t.length){if(255===e){for(o=0;3>o;o++)if(\"number\"==typeof t[o])t[o]=r(0,a(255,parseInt(t[o])));else throw new Sk.builtin.ValueError(\"bad color sequence\");}else for(o=0;3>o;o++)if(\"number\"!=typeof t[o])throw new Sk.builtin.ValueError(\"bad color sequence\");else if(1>=t[o])t[o]=r(0,a(255,parseInt(255*t[o])));else throw new Sk.builtin.ValueError(\"bad color sequence\");\"number\"==typeof t[o]?(t[3]=r(0,a(1,t[o])),t=\"rgba(\"+t.join(\",\")+\")\"):t=\"rgb(\"+t.slice(0,3).join(\",\")+\")\"}else if(\"string\"==typeof t&&!t.match(/\\s*url\\s*\\(/i))t=t.replace(/\\s+/g,\"\");else return\"black\";return t}function calculateHeading(e,t,r){var n=e._angle||0,a=e._radians||0;return r||(r={}),\"number\"==typeof t&&(e._isRadians?n=a=t%Turtle.RADIANS:e._fullCircle?(n=t%e._fullCircle,a=n/e._fullCircle*Turtle.RADIANS):n=a=0,0>n&&(n+=e._fullCircle,a+=Turtle.RADIANS)),r.angle=n,r.radians=a,r}function pythonToJavascriptFunction(e,t){return function(){var r=Array.prototype.slice.call(arguments),n=r.map(function(e){return Sk.ffi.remapToPy(e)});return\"undefined\"!=typeof t&&n.unshift(t),Sk.misceval.applyAsync(void 0,e,void 0,void 0,void 0,n).catch(Sk.uncaughtException)}}function addModuleMethod(e,t,r,n){var a,s=r.replace(/^\\$/,\"\"),l=s.replace(/_\\$[a-z]+\\$$/i,\"\"),o=e.prototype[r].length,d=e.prototype[r].minArgs,_=e.prototype[r].co_varnames||[],c=e.prototype[r].returnType,u=e.prototype[r].isSk;void 0===d&&(d=o),a=function(){var e,t,a,s,_,m=Array.prototype.slice.call(arguments,0),p=n?n():m.shift().instance;if(m.length<d||m.length>o)throw _=d===o?\"exactly \"+o:\"between \"+d+\" and \"+o,new Sk.builtin.TypeError(l+\"() takes \"+_+\" positional argument(s) (\"+m.length+\" given)\");for(e=m.length;0<=--e;)void 0!==m[e]&&(m[e]=m[e]instanceof Sk.builtin.func?pythonToJavascriptFunction(m[e]):m[e]instanceof Sk.builtin.method?pythonToJavascriptFunction(m[e].im_func,m[e].im_self):m[e]&&m[e].$d instanceof Sk.builtin.dict&&m[e].instance?m[e].instance:Sk.ffi.remapToJs(m[e]));var g=m.slice(0);for(m=[],e=g.length;0<=e;--e)null!==g[e]&&(m[e]=g[e]);try{t=p[r].apply(p,m)}catch(t){throw window&&window.console&&(window.console.log(\"wrapped method failed\"),window.console.log(t.stack)),t}return t instanceof InstantPromise&&(t=t.lastResult),t instanceof Promise?(t=t.catch(function(t){throw window&&window.console&&(window.console.log(\"promise failed\"),window.console.log(t.stack)),t}),a=new Sk.misceval.Suspension,a.resume=function(){return void 0===s?Sk.builtin.none.none$:Sk.ffi.remapToPy(s)},a.data={type:\"Sk.promise\",promise:t.then(function(e){return s=e,e})},a):void 0===t?Sk.builtin.none.none$:u?t:\"function\"==typeof c?c(t):Sk.ffi.remapToPy(t)},a.co_name=new Sk.builtin.str(l),a.co_varnames=_.slice(),a.$defaults=[];for(var m=d;m<_.length;m++)a.$defaults.push(Sk.builtin.none.none$);n||a.co_varnames.unshift(\"self\"),t[s]=new Sk.builtin.func(a)}function initTurtle(e,t){Sk.builtin.pyCheckArgs(\"__init__\",arguments,2,3,!1,!1),e.instance=new Turtle(t),e.instance.skInstance=e}function focusTurtle(e){return void 0!==e&&(w=!!e,w?getTarget().focus():getTarget().blur()),w}function resetTurtle(){for(cancelAnimationFrame(),getScreen().reset(),getFrameManager().reset();e.firstChild;)e.removeChild(e.firstChild);h&&h.reset(),$=0,p=void 0,f=void 0,h=void 0,k=0}function stopTurtle(){cancelAnimationFrame(),h&&h.reset(),$=0,p=void 0,f=void 0,h=void 0,k=0}var u,m,p,g,f,h,y={__name__:new Sk.builtin.str(\"turtle\")},$=0,w=!0,b=1e3/30,v={},k=0,x={},T={target:\"turtle\",width:400,height:400,worldWidth:0,worldHeight:0,animate:!0,bufferSize:0,allowUndo:!0,assets:{}};e.hasAttribute(\"tabindex\")||e.setAttribute(\"tabindex\",0),x.FLOAT=function(e){return new Sk.builtin.float_(e)},x.COLOR=function(e){if(\"string\"==typeof e)return new Sk.builtin.str(e);for(var t=0;3>t;t++)e[t]=Sk.builtin.assk$(e[t]);return 4===e.length&&(e[3]=new Sk.builtin.float_(e[3])),new Sk.builtin.tuple(e)},x.TURTLE_LIST=function(e){for(var t=[],r=0;r<e.length;r++)t.push(e[r].skInstance);return new Sk.builtin.tuple(t)},v.arrow=[[-10,0],[10,0],[0,10]],v.square=[[10,-10],[10,10],[-10,10],[-10,-10]],v.triangle=[[10,-5.77],[0,11.55],[-10,-5.77]],v.classic=[[0,0],[-5,-9],[0,-7],[5,-9]],v.turtle=[[0,16],[-2,14],[-1,10],[-4,7],[-7,9],[-9,8],[-6,5],[-7,1],[-5,-3],[-8,-6],[-6,-8],[-4,-5],[0,-7],[4,-5],[6,-8],[8,-6],[5,-3],[7,1],[6,5],[9,8],[7,9],[4,7],[1,10],[2,14]],v.circle=[[10,0],[9.51,3.09],[8.09,5.88],[5.88,8.09],[3.09,9.51],[0,10],[-3.09,9.51],[-5.88,8.09],[-8.09,5.88],[-9.51,3.09],[-10,0],[-9.51,-3.09],[-8.09,-5.88],[-5.88,-8.09],[-3.09,-9.51],[-0,-10],[3.09,-9.51],[5.88,-8.09],[8.09,-5.88],[9.51,-3.09]],g=function(){for(var e in Sk.TurtleGraphics||(Sk.TurtleGraphics={}),T)Sk.TurtleGraphics.hasOwnProperty(e)||(Sk.TurtleGraphics[e]=T[e]);return Sk.TurtleGraphics}(),InstantPromise.prototype.then=function(e){if(this.lastError)return this;try{this.lastResult=e(this.lastResult)}catch(t){this.lastResult=void 0,this.lastError=t}return this.lastResult instanceof Promise?this.lastResult:this},InstantPromise.prototype.catch=function(e){if(this.lastError)try{this.lastResult=e(this.lastError),this.lastError=void 0}catch(t){this.lastResult=void 0,this.lastError=t}return this.lastResult instanceof Promise?this.lastResult:this};var A;(function(e){function animationFrame(e){return g.animate?!e&&t?t:function(t){return m=window.setTimeout(t,e||b),m}:function(e){e()}}var t;(function(e){e&&(t=function(t){return u=e(t)})})(window.requestAnimationFrame||window.mozRequestAnimationFrame),e.willRenderNext=function(){return!!(this._buffer&&this._frameCount+1===this.frameBuffer())},e.turtles=function(){return this._turtles},e.addTurtle=function(e){this._turtles.push(e)},e.reset=function(){if(this._turtles)for(var e=this._turtles.length;0<=--e;)this._turtles[e].reset();this._turtles=[],this._frames=[],this._frameCount=0,this._buffer=1,this._rate=0,this._animationFrame=animationFrame()},e.addFrame=function(e,t){var r=!1;return t&&(this._frameCount+=1),this.frames().push(e),r=!g.animate||this._buffer&&this._frameCount===this.frameBuffer(),r?this.update():new InstantPromise},e.frames=function(){return this._frames},e.frameBuffer=function(e){return\"number\"==typeof e&&(this._buffer=0|e,e&&e<=this._frameCount)?this.update():this._buffer},e.refreshInterval=function(e){return\"number\"==typeof e&&(this._rate=0|e,this._animationFrame=animationFrame(e)),this._rate},e.update=function(){return this._frames&&this._frames.length?this.requestAnimationFrame():new InstantPromise},e.requestAnimationFrame=function(){var e,t,r=this._frames,n=this._animationFrame,a=this._turtles,s=getScreen().spriteLayer();return this._frames=[],this._frameCount=0,new Promise(function(l){n(function paint(){for(t=0;t<r.length;t++)r[t]&&r[t]();for(clearLayer(s),t=0;t<a.length;t++)e=a[t],e.getState().shown&&drawTurtle(e.getState(),s);l()})})}})(FrameManager.prototype),function(e){e.onEvent=function(t,r){function computeCoordinates(){if(!_){var t=getScreen(),l=t.spriteLayer().canvas.getBoundingClientRect();e=0|r.clientX-l.left,n=0|r.clientY-l.top,a=e*t.xScale+t.llx,s=n*t.yScale+t.ury,_=!0}}var e,n,a,s,l,o=this._managers[t],d=this._managers.mousemove,_=!1;if((\"mousedown\"===t||\"mouseup\"===t)&&d&&d.length)for(computeCoordinates(),l=d.length;0<=--l;)d[l].test(e,n,a,s)&&d[l].canMove(\"mousedown\"===t);if(o&&o.length)for(computeCoordinates(),l=o.length;0<=--l;)\"mousemove\"===t&&o[l].canMove()&&o[l].test(e,n,a,s)?o[l].trigger([a,s]):\"mousedown\"===t&&o[l].test(e,n,a,s)&&o[l].trigger([a,s])},e.reset=function(){this._managers={}},e.addManager=function(e,t){this._managers[e]||(this._managers[e]=[]),this._managers[e].push(t)}}(MouseHandler.prototype),function(e){e.reset=function(){this._handlers=void 0},e.canMove=function(e){return!!(this._target&&this._target.hitTest)&&(void 0!==e&&(this._target.hitTest.hit=e),this._target.hitTest.hit)},e.test=function(e,t,r,n){return this._target&&this._target.hitTest?this._target.hitTest(e,t,r,n):!!this._target},e.trigger=function(e){var t,r=this._handlers;if(r&&r.length)for(t=0;t<r.length;t++)r[t].apply({},e)},e.addHandler=function(e,t){var r=this._handlers;if(!t&&r&&r.length)for(;r.shift(););return\"function\"==typeof e?void(!r&&(r=this._handlers=[]),r.push(e)):void(r&&!r.length&&this.reset())}}(EventManager.prototype),Turtle.RADIANS=2*o,function(e){function circleRotate(e,t,r){return function(){return e.addUpdate(void 0,!1,{angle:t,radians:r})}}function circleSegment(e,t,r,n,a,s){return function(){return e.translate(t,r,n,a,s,!0)}}e.hitTest=function(e,t){var r=getScreen().hitTestLayer();clearLayer(r),drawTurtle(this.getState(),r);var n=r.getImageData(e,t,1,1).data;return n[3]||n[0]||n[1]||n[2]},e.addUpdate=function(e,t,r){var n=this,a=this.getState(),s=Array.prototype.slice.call(arguments,r?2:3);return getFrameManager().addFrame(function(){if(e&&e.apply(a,s),r)for(var t in r)a[t]=r[t]},t)},e.getState=function(){var e=this;return this._state||(this._state={x:this._x,y:this._y,angle:this._angle,radians:this._radians,shape:this._shape,color:this._color,fill:this._fill,filling:this._filling,size:this._size,speed:this._computed_speed,down:this._down,shown:this._shown,colorMode:this._colorMode,context:function(){return e.getPaper()}}),this._state},e.translate=function(e,t,r,n,a,s){var l=this;return translate(this,e,t,r,n,a,s).then(function(e){l._x=e[0],l._y=e[1]})},e.rotate=function(e,t,r){var n=this;return rotate(this,e,t,r).then(function(e){n._angle=e.angle,n._radians=e.radians})},e.queueMoveBy=function(e,t,r,n){var a=c(r)*n,s=_(r)*n;return this.translate(e,t,a,s,!0)},e.queueTurnTo=function(e,t){return t%=this._fullCircle,0>t&&(t+=this._fullCircle),this.rotate(e,t-e)},e.getManager=function(e){return this._managers[e]||(this._managers[e]=new EventManager(e,this)),this._managers[e]},e.getPaper=function(){return this._paper||(this._paper=createLayer(2))},e.reset=function(){for(var e in this._x=0,this._y=0,this._radians=0,this._angle=0,this._shown=!0,this._down=!0,this._color=\"black\",this._fill=\"black\",this._size=1,this._filling=!1,this._undoBuffer=[],this._speed=3,this._computed_speed=5,this._colorMode=1,this._state=void 0,this._managers)this._managers[e].reset();this._isRadians=!1,this._fullCircle=360,this._bufferSize=\"number\"==typeof g.bufferSize?g.bufferSize:0,removeLayer(this._paper),this._paper=void 0},e.$degrees=function(e){return e=\"number\"==typeof e?s(e):360,this._isRadians=!1,this._angle=e&&this._fullCircle?this._angle/this._fullCircle*e:this._radians=0,this._fullCircle=e,this.addUpdate(void 0,!1,{angle:this._angle,radians:this._radians})},e.$degrees.minArgs=0,e.$degrees.co_varnames=[\"fullcircle\"],e.$degrees.returnType=x.FLOAT,e.$radians=function(){return this._isRadians||(this._isRadians=!0,this._angle=this._radians,this._fullCircle=Turtle.RADIANS),this._angle},e.$radians.returnType=x.FLOAT,e.$position=e.$pos=function(){return[this.$xcor(),this.$ycor()]},e.$position.returnType=function(e){return new Sk.builtin.tuple([new Sk.builtin.float_(e[0]),new Sk.builtin.float_(e[1])])},e.$towards=function(e,t){var r=getCoordinates(e,t),n=o+d(this._y-r.y,this._x-r.x),a=n*(this._fullCircle/Turtle.RADIANS);return a},e.$towards.co_varnames=[\"x\",\"y\"],e.$towards.minArgs=1,e.$towards.returnType=x.FLOAT,e.$distance=function(e,t){var r=getCoordinates(e,t),a=r.x-this._x,s=r.y-this._y;return n(a*a+s*s)},e.$distance.co_varnames=[\"x\",\"y\"],e.$distance.minArgs=1,e.$distance.returnType=x.FLOAT,e.$heading=function(){return 1e-13>s(this._angle)?0:this._angle},e.$heading.returnType=x.FLOAT,e.$xcor=function(){return 1e-13>s(this._x)?0:this._x},e.$xcor.returnType=x.FLOAT,e.$ycor=function(){return 1e-13>s(this._y)?0:this._y},e.$ycor.returnType=x.FLOAT,e.$forward=e.$fd=function(e){return pushUndo(this),this.queueMoveBy(this._x,this._y,this._radians,e)},e.$forward.co_varnames=e.$fd.co_varnames=[\"distance\"],e.$undo=function(){popUndo(this)},e.$undobufferentries=function(){return this._undoBuffer.length},e.$setundobuffer=function(e){this._bufferSize=\"number\"==typeof e?a(s(e),1e3):0},e.$setundobuffer.co_varnames=[\"size\"],e.$backward=e.$back=e.$bk=function(e){return pushUndo(this),this.queueMoveBy(this._x,this._y,this._radians,-e)},e.$backward.co_varnames=e.$back.co_varnames=e.$bk.co_varnames=[\"distance\"],e.$goto_$rw$=e.$setpos=e.$setposition=function(e,t){var r=getCoordinates(e,t);return pushUndo(this),this.translate(this._x,this._y,r.x-this._x,r.y-this._y,!0)},e.$goto_$rw$.co_varnames=e.$setpos.co_varnames=e.$setposition.co_varnames=[\"x\",\"y\"],e.$goto_$rw$.minArgs=e.$setpos.minArgs=e.$setposition.minArgs=1,e.$setx=function(e){return this.translate(this._x,this._y,e-this._x,0,!0)},e.$setx.co_varnames=[\"x\"],e.$sety=function(e){return this.translate(this._x,this._y,0,e-this._y,!0)},e.$sety.co_varnames=[\"y\"],e.$home=function(){var e=this,t=this._angle;return pushUndo(this),e.translate(this._x,this._y,-this._x,-this._y,!0).then(function(){return e.queueTurnTo(t,0)}).then(function(){})},e.$right=e.$rt=function(e){return pushUndo(this),this.rotate(this._angle,-e)},e.$right.co_varnames=e.$rt.co_varnames=[\"angle\"],e.$left=e.$lt=function(e){return pushUndo(this),this.rotate(this._angle,e)},e.$left.co_varnames=e.$lt.co_varnames=[\"angle\"],e.$setheading=e.$seth=function(e){return pushUndo(this),this.queueTurnTo(this._angle,e)},e.$setheading.co_varnames=e.$seth.co_varnames=[\"angle\"],e.$circle=function(e,t,r){var n,d,u,m,p,g,f,h,$,b=this,v=this._x,k=this._y,T=this._angle,A={},L=1/getScreen().lineScale,S=!0;for(pushUndo(this),void 0===t&&(t=b._fullCircle),void 0===r&&(d=s(t)/b._fullCircle,r=1+(0|a(11+s(e*L)/6,59)*d)),u=t/r,m=.5*u,p=2*e*_(u*o/b._fullCircle),0>e?(p=-p,u=-u,m=-m,n=T-t):n=T+t,$=getFrameManager().willRenderNext()?Promise.resolve():new InstantPromise,T+=m,g=0;g<r;g++)calculateHeading(b,T+u*g,A),f=c(A.radians)*p,h=_(A.radians)*p,$=$.then(circleRotate(b,A.angle,A.radians)).then(circleSegment(b,v,k,f,h,S)),v+=f,k+=h,S=!1;return $=$.then(function(){return calculateHeading(b,n,A),b._angle=A.angle,b._radians=A.radians,b.addUpdate(void 0,!0,A)}),$},e.$circle.co_varnames=[\"radius\",\"extent\",\"steps\"],e.$circle.minArgs=1,e.$penup=e.$up=e.$pu=function(){return this._down=!1,this.addUpdate(void 0,!1,{down:!1})},e.$pendown=e.$down=e.$pd=function(){return this._down=!0,this.addUpdate(void 0,!1,{down:!0})},e.$isdown=function(){return this._down},e.$speed=function(e){return void 0===e?this._speed:(this._speed=r(0,a(1e3,e)),this._computed_speed=r(0,2*e-1),this.addUpdate(void 0,!1,{speed:this._computed_speed}))},e.$speed.minArgs=0,e.$speed.co_varnames=[\"speed\"],e.$pencolor=function(e,t,r,n){return void 0===e?hexToRGB(this._color):(this._color=createColor(this._colorMode,e,t,r,n),this.addUpdate(void 0,this._shown,{color:this._color}))},e.$pencolor.co_varnames=[\"r\",\"g\",\"b\",\"a\"],e.$pencolor.minArgs=0,e.$pencolor.returnType=x.COLOR,e.$fillcolor=function(e,t,r,n){return void 0===e?hexToRGB(this._fill):(this._fill=createColor(this._colorMode,e,t,r,n),this.addUpdate(void 0,this._shown,{fill:this._fill}))},e.$fillcolor.co_varnames=[\"r\",\"g\",\"b\",\"a\"],e.$fillcolor.minArgs=0,e.$fillcolor.returnType=x.COLOR,e.$color=function(e,t,r,n){return void 0===e?[this.$pencolor(),this.$fillcolor()]:(void 0===t||void 0!==r?(this._color=createColor(this._colorMode,e,t,r,n),this._fill=this._color):(this._color=createColor(this._colorMode,e),this._fill=createColor(this._colorMode,t)),this.addUpdate(void 0,this._shown,{color:this._color,fill:this._fill}))},e.$color.minArgs=0,e.$color.co_varnames=[\"color\",\"fill\",\"b\",\"a\"],e.$color.returnType=function(e){return new Sk.builtin.tuple([x.COLOR(e[0]),x.COLOR(e[1])])},e.$fill=function(e){this;return void 0===e?this._filling:(e=!!e,e===this._filling)?void 0:(this._filling=e,e?(pushUndo(this),this.addUpdate(void 0,!1,{filling:!0,fillBuffer:[{x:this._x,y:this._y}]})):(pushUndo(this),this.addUpdate(function(){this.fillBuffer.push(this),drawFill.call(this)},!0,{filling:!1,fillBuffer:void 0})))},e.$fill.co_varnames=[\"flag\"],e.$fill.minArgs=0,e.$begin_fill=function(){return this.$fill(!0)},e.$end_fill=function(){return this.$fill(!1)},e.$stamp=function(){return pushUndo(this),this.addUpdate(function(){drawTurtle(this,this.context())},!0)},e.$dot=function(e,t,n,l,i){return pushUndo(this),e=Sk.builtin.asnum$(e),e=\"number\"==typeof e?r(1,0|s(e)):r(this._size+4,2*this._size),t=void 0===t?this._color:createColor(this._colorMode,t,n,l,i),this.addUpdate(drawDot,!0,void 0,e,t)},e.$dot.co_varnames=[\"size\",\"color\",\"g\",\"b\",\"a\"],e.$write=function(e,t,r,n){var a,s,l,i,o,d=this;return pushUndo(this),e+=\"\",n&&n.constructor===Array&&(s=\"string\"==typeof n[0]?n[0]:\"Arial\",l=(n[1]||\"12pt\")+\"\",i=\"string\"==typeof n[2]?n[2]:\"normal\",/^\\d+$/.test(l)&&(l+=\"pt\"),n=[i,l,s].join(\" \")),r||(r=\"left\"),a=this.addUpdate(drawText,!0,void 0,e,r,n),t&&(\"left\"===r||\"center\"===r)&&(o=measureText(e,n),\"center\"===r&&(o/=2),a=a.then(function(){var e=d.getState();return d.translate(e.x,e.y,o,0,!0)})),a},e.$write.co_varnames=[\"message\",\"move\",\"align\",\"font\"],e.$write.minArgs=1,e.$pensize=e.$width=function(e){return void 0===e?this._size:(this._size=e,this.addUpdate(void 0,this._shown,{size:e}))},e.$pensize.minArgs=e.$width.minArgs=0,e.$pensize.co_varnames=e.$width.co_varnames=[\"width\"],e.$showturtle=e.$st=function(){return this._shown=!0,this.addUpdate(void 0,!0,{shown:!0})},e.$hideturtle=e.$ht=function(){return this._shown=!1,this.addUpdate(void 0,!0,{shown:!1})},e.$isvisible=function(){return this._shown},e.$shape=function(e){return e&&v[e]?(this._shape=e,this.addUpdate(void 0,this._shown,{shape:e})):this._shape},e.$shape.minArgs=0,e.$shape.co_varnames=[\"name\"],e.$colormode=function(e){return void 0===e?this._colorMode:(this._colorMode=255===e?255:1,this.addUpdate(void 0,this._shown,{colorMode:this._colorMode}))},e.$colormode.minArgs=0,e.$colormode.co_varnames=[\"cmode\"],e.$colormode.returnType=function(e){return 255===e?new Sk.builtin.int_(255):new Sk.builtin.float_(1)},e.$window_width=function(){return this._screen.$window_width()},e.$window_height=function(){return this._screen.$window_height()},e.$tracer=function(e,t){return this._screen.$tracer(e,t)},e.$tracer.minArgs=0,e.$tracer.co_varnames=[\"n\",\"delay\"],e.$update=function(){return this._screen.$update()},e.$delay=function(e){return this._screen.$delay(e)},e.$delay.minArgs=0,e.$delay.co_varnames=[\"delay\"],e.$reset=function(){return this.reset(),this.$clear()},e.$mainloop=e.$done=function(){return this._screen.$mainloop()},e.$clear=function(){return this.addUpdate(function(){clearLayer(this.context())},!0)},e.$dot.minArgs=0,e.$onclick=function(e,t,r){this.getManager(\"mousedown\").addHandler(e,r)},e.$onclick.minArgs=1,e.$onclick.co_varnames=[\"method\",\"btn\",\"add\"],e.$onrelease=function(e,t,r){this.getManager(\"mouseup\").addHandler(e,r)},e.$onrelease.minArgs=1,e.$onrelease.co_varnames=[\"method\",\"btn\",\"add\"],e.$ondrag=function(e,t,r){this.getManager(\"mousemove\").addHandler(e,r)},e.$ondrag.minArgs=1,e.$ondrag.co_varnames=[\"method\",\"btn\",\"add\"],e.$getscreen=function(){return Sk.misceval.callsimArray(y.Screen)},e.$getscreen.isSk=!0,e.$clone=function(){var e=Sk.misceval.callsimOrSuspendArray(y.Turtle);return e.instance._x=this._x,e.instance._y=this._y,e.instance._angle=this._angle,e.instance._radians=this._radians,e.instance._shape=this._shape,e.instance._color=this._color,e.instance._fill=this._fill,e.instance._filling=this._filling,e.instance._size=this._size,e.instance._computed_speed=this._computed_speed,e.instance._down=this._down,e.instance._shown=this._shown,e.instance._colorMode=this._colorMode,e.instance._isRadians=this._isRadians,e.instance._fullCircle=this._fullCircle,e.instance._bufferSize=this._bufferSize,e.instance._undoBuffer=this._undoBuffer,e._clonedFrom=this,e},e.$clone.returnType=function(e){return e},e.$getturtle=e.$getpen=function(){return this.skInstance},e.$getturtle.isSk=!0}(Turtle.prototype),function(e){e.spriteLayer=function(){return this._sprites||(this._sprites=createLayer(3))},e.bgLayer=function(){return this._background||(this._background=createLayer(1))},e.hitTestLayer=function(){return this._hitTest||(this._hitTest=createLayer(0,!0))},e.getManager=function(e){return this._managers[e]||(this._managers[e]=new EventManager(e,this)),this._managers[e]},e.reset=function(){for(var e in this._keyListeners=void 0,this._keyLogger)window.clearInterval(this._keyLogger[e]),window.clearTimeout(this._keyLogger[e]),delete this._keyLogger[e];for(e in this._keyDownListener&&(getTarget().removeEventListener(\"keydown\",this._keyDownListener),this._keyDownListener=void 0),this._keyUpListener&&(getTarget().removeEventListener(\"keyup\",this._keyUpListener),this._keyUpListener=void 0),this._timer&&(window.clearTimeout(this._timer),this._timer=void 0),this._managers)this._managers[e].reset();this._mode=\"standard\",removeLayer(this._sprites),this._sprites=void 0,removeLayer(this._background),this._background=void 0},e.setUpWorld=function(e,t,r,n){var l=this;l.llx=e,l.lly=t,l.urx=r,l.ury=n,l.xScale=(r-e)/getWidth(),l.yScale=-1*(n-t)/getHeight(),l.lineScale=a(s(l.xScale),s(l.yScale))},e.$setup=function(e,t,r,n){return isNaN(parseFloat(e))&&(e=getWidth()),isNaN(parseFloat(t))&&(t=getHeight()),1>=e&&(e=getWidth()*e),1>=t&&(t=getHeight()*t),this._width=e,this._height=t,this._xOffset=void 0===r||isNaN(parseInt(r))?0:parseInt(r),this._yOffset=void 0===n||isNaN(parseInt(n))?0:parseInt(n),\"world\"===this._mode?this._setworldcoordinates(this.llx,this.lly,this.urx,this.ury):this._setworldcoordinates(-e/2,-t/2,e/2,t/2)},e.$setup.minArgs=0,e.$setup.co_varnames=[\"width\",\"height\",\"startx\",\"starty\"],e.$register_shape=e.$addshape=function(e,t){return t?void(v[e]=t):getAsset(e).then(function(t){v[e]=t})},e.$register_shape.minArgs=1,e.$getshapes=function(){return Object.keys(v)},e.$tracer=function(e,t){return void 0!==e||void 0!==t?(\"number\"==typeof t&&(this._delay=t,getFrameManager().refreshInterval(t)),\"number\"==typeof e?(this._frames=e,getFrameManager().frameBuffer(e)):void 0):this._frames},e.$tracer.co_varnames=[\"frames\",\"delay\"],e.$tracer.minArgs=0,e.$delay=function(e){return void 0===e?void 0===this._delay?b:this._delay:this.$tracer(void 0,e)},e.$delay.co_varnames=[\"delay\"],e._setworldcoordinates=function(e,t,r,n){var a=this,s=getFrameManager().turtles();return this.setUpWorld(e,t,r,n),this._sprites&&applyWorld(this,this._sprites),this._background&&applyWorld(this,this._background),this.$clear()},e.$setworldcoordinates=function(e,t,r,n){return this._mode=\"world\",this._setworldcoordinates(e,t,r,n)},e.$setworldcoordinates.co_varnames=[\"llx\",\"lly\",\"urx\",\"ury\"],e.minArgs=4,e.$clear=e.$clearscreen=function(){return this.reset(),this.$reset()},e.$update=function(){return getFrameManager().update()},e.$reset=e.$resetscreen=function(){var e=this,t=getFrameManager().turtles();return getFrameManager().addFrame(function(){applyWorld(e,e._sprites),applyWorld(e,e._background);for(var r=0;r<t.length;r++)t[r].reset(),applyWorld(e,t[r]._paper)},!0)},e.$window_width=function(){return getWidth()},e.$window_height=function(){return getHeight()},e.$delay.minArgs=0,e.$turtles=function(){return getFrameManager().turtles()},e.$turtles.returnType=x.TURTLE_LIST,e.$bgpic=function(e){var t;return e?(t=this,getAsset(e).then(function(e){clearLayer(t.bgLayer(),void 0,e)})):this._bgpic},e.$bgpic.minArgs=0,e.$bgpic.co_varnames=[\"name\"],e.$bgcolor=function(e,t,r,n){return void 0===e?hexToRGB(this._bgcolor):(this._bgcolor=createColor(this._colorMode,e,t,r,n),void clearLayer(this.bgLayer(),this._bgcolor))},e.$bgcolor.minArgs=0,e.$bgcolor.co_varnames=[\"color\",\"g\",\"b\",\"a\"],e.$bgcolor.returnType=x.COLOR,e.$mainloop=e.$done=function(){},e.$bye=function(){return Sk.TurtleGraphics.reset()},e.$exitonclick=function(){return this._exitOnClick=!0,this.getManager(\"mousedown\").addHandler(function(){resetTurtle()},!1)},e.$onclick=function(e,t,r){this._exitOnClick||this.getManager(\"mousedown\").addHandler(e,r)},e.$onclick.minArgs=1,e.$onclick.co_varnames=[\"method\",\"btn\",\"add\"];var t={8:/^back(space)?$/i,9:/^tab$/i,13:/^(enter|return)$/i,16:/^shift$/i,17:/^(ctrl|control)$/i,18:/^alt$/i,27:/^esc(ape)?$/i,32:/^space$/i,33:/^page[\\s\\-]?up$/i,34:/^page[\\s\\-]?down$/i,35:/^end$/i,36:/^home$/i,37:/^left([\\s\\-]?arrow)?$/i,38:/^up([\\s\\-]?arrow)?$/i,39:/^right([\\s\\-]?arrow)?$/i,40:/^down([\\s\\-]?arrow)?$/i,45:/^insert$/i,46:/^del(ete)?$/i};e._createKeyRepeater=function(e,t){var r=this;r._keyLogger[t]=window.setTimeout(function(){r._keyListeners[e](),r._keyLogger[t]=window.setInterval(function(){r._keyListeners[e]()},50)},333)},e._createKeyDownListener=function(){var r=this;this._keyDownListener||(this._keyDownListener=function(n){var e=String.fromCharCode;if(focusTurtle()){var a,s,l=n.charCode||n.keyCode,i=e(l).toLowerCase();if(!r._keyLogger[l])for(a in r._keyListeners)if(s=1<a.length&&t[l]&&t[l].test(a),a===i||s){r._keyListeners[a](),r._createKeyRepeater(a,l),n.preventDefault();break}}},getTarget().addEventListener(\"keydown\",this._keyDownListener))},e._createKeyUpListener=function(){var t=this;this._keyUpListener||(this._keyUpListener=function(r){var e=t._keyLogger[r.charCode||r.keyCode];void 0!==e&&(r.preventDefault(),window.clearInterval(e),window.clearTimeout(e),delete t._keyLogger[r.charCode||r.keyCode])},getTarget().addEventListener(\"keyup\",this._keyUpListener))},e.$listen=function(){this._createKeyUpListener(),this._createKeyDownListener()},e.$onkey=function(e,t){if(\"function\"==typeof t){var r=e;e=t,t=r}t=(t+\"\").toLowerCase(),e&&\"function\"==typeof e?(!this._keyListeners&&(this._keyListeners={}),this._keyListeners[t]=e):delete this._keyListeners[t]},e.$onkey.minArgs=2,e.$onkey.co_varnames=[\"method\",\"keyValue\"],e.$onscreenclick=function(e,t,r){this.getManager(\"mousedown\").addHandler(e,r)},e.$onscreenclick.minArgs=1,e.$onscreenclick.co_varnames=[\"method\",\"btn\",\"add\"],e.$ontimer=function(e,t){this._timer&&(window.clearTimeout(this._timer),this._timer=void 0),e&&\"number\"==typeof t&&(this._timer=window.setTimeout(e,r(0,0|t)))},e.$ontimer.minArgs=0,e.$ontimer.co_varnames=[\"method\",\"interval\"]}(Screen.prototype);var L=new Image,S=document.createElement(\"canvas\").getContext(\"2d\");for(var C in initTurtle.co_varnames=[\"self\",\"shape\"],initTurtle.co_name=new Sk.builtin.str(\"Turtle\"),initTurtle.co_argcount=2,initTurtle.$defaults=[Sk.builtin.none.none$,new Sk.builtin.str(\"classic\")],Turtle.prototype)/^\\$[a-z_]+/.test(C)&&addModuleMethod(Turtle,y,C,ensureAnonymous);return addModuleMethod(Screen,y,\"$mainloop\",getScreen),addModuleMethod(Screen,y,\"$done\",getScreen),addModuleMethod(Screen,y,\"$bye\",getScreen),addModuleMethod(Screen,y,\"$tracer\",getScreen),addModuleMethod(Screen,y,\"$update\",getScreen),addModuleMethod(Screen,y,\"$delay\",getScreen),addModuleMethod(Screen,y,\"$window_width\",getScreen),addModuleMethod(Screen,y,\"$window_height\",getScreen),y.Turtle=Sk.misceval.buildClass(y,function TurtleWrapper(e,t){for(var r in t.__init__=new Sk.builtin.func(initTurtle),Turtle.prototype)/^\\$[a-z_]+/.test(r)&&addModuleMethod(Turtle,t,r)},\"Turtle\",[]),y.Screen=Sk.misceval.buildClass(y,function ScreenWrapper(e,t){for(var r in t.__init__=new Sk.builtin.func(function(e){e.instance=getScreen()}),Screen.prototype)/^\\$[a-z_]+/.test(r)&&addModuleMethod(Screen,t,r)},\"Screen\",[]),{skModule:y,reset:resetTurtle,stop:stopTurtle,focus:focusTurtle,Turtle:Turtle,Screen:Screen}}(e),Sk.TurtleGraphics.module=e.turtleInstance.skModule,Sk.TurtleGraphics.reset=e.turtleInstance.reset,Sk.TurtleGraphics.stop=e.turtleInstance.stop,Sk.TurtleGraphics.focus=e.turtleInstance.focus,Sk.TurtleGraphics.raw={Turtle:e.turtleInstance.Turtle,Screen:e.turtleInstance.Screen},e.turtleInstance.skModule};","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\n#CodeType = 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\ntry:\n XRangeType = xrange\nexcept NameError:\n pass\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/unittest/__init__.py":"__author__ = 'bmiller'\n'''\nThis is the start of something that behaves like\nthe unittest module from cpython.\n\n'''\n\n\nclass _AssertRaisesContext:\n \"\"\"A context manager used to implement TestCase.assertRaises* methods.\"\"\"\n def __init__(self, expected, test_case):\n self.test_case = test_case\n self.expected = expected\n self.exception = None\n\n def _is_subtype(self, expected, basetype):\n if isinstance(expected, tuple):\n return all(self._is_subtype(e, basetype) for e in expected)\n return isinstance(expected, type) and issubclass(expected, basetype)\n\n def handle(self, args, kwargs):\n \"\"\"\n If args is empty, assertRaises is being used as a\n context manager, so return self.\n If args is not empty, call a callable passing positional and keyword\n arguments.\n \"\"\"\n try:\n if not self._is_subtype(self.expected, BaseException):\n raise TypeError('assertRaises() arg 1 must be an exception type or tuple of exception types')\n if not args:\n return self\n\n callable_obj = args[0]\n args = args[1:]\n with self:\n callable_obj(*args, **kwargs) \n\n finally:\n # bpo-23890: manually break a reference cycle\n self = None\n\n def __enter__(self):\n return self\n\n def __exit__(self, exc_type, exc_value, tb):\n res = True\n feedback = \"\"\n self.exception = exc_value\n try:\n act_exc = exc_type.__name__\n except AttributeError:\n act_exc = str(exc_type)\n try:\n exp_exc = self.expected.__name__\n except AttributeError:\n exp_exc = str(self.expected)\n\n if exc_type is None:\n res = False\n feedback = \"{} not raised\".format(exp_exc)\n elif not issubclass(exc_type, self.expected):\n res = False\n feedback = \"Expected {} but got {}\".format(exp_exc, act_exc)\n\n self.test_case.appendResult(res, act_exc, exp_exc, feedback)\n return True\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\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 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, expected_exception, *args, **kwargs):\n context = _AssertRaisesContext(expected_exception, self)\n try:\n return context.handle(args, kwargs)\n finally:\n # bpo-23890: manually break a reference cycle\n context = None\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 type(glob[name]) == type and 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/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/urllib/__init__.js":"var $builtinmodule=function(){return{}};","src/lib/urllib/request/__init__.js":"var $builtinmodule=function(){var a={};return a.Response=Sk.misceval.buildClass(a,function(a,b){b.__init__=new Sk.builtin.func(function(a,b){a.data$=b.responseText,a.lineList=a.data$.split(\"\\n\"),a.lineList=a.lineList.slice(0,-1);for(var c=0;c<a.lineList.length;c++)a.lineList[c]+=\"\\n\";a.currentLine=0,a.pos$=0}),b.__str__=new Sk.builtin.func(function(){return Sk.ffi.remapToPy(\"<Response>\")}),b.__iter__=new Sk.builtin.func(function(a){var b=a.lineList;return Sk.builtin.makeGenerator(function(){return this.$index>=this.$lines.length?void 0:new Sk.builtin.str(this.$lines[this.$index++])},{$obj:a,$index:0,$lines:b})}),b.read=new Sk.builtin.func(function(a,b){if(a.closed)throw new Sk.builtin.ValueError(\"I/O operation on closed file\");var c=a.data$.length;void 0===b&&(b=c);var d=new Sk.builtin.str(a.data$.substr(a.pos$,b));return a.pos$+=b,a.pos$>=c&&(a.pos$=c),d}),b.readline=new Sk.builtin.func(function(a){var b=\"\";return a.currentLine<a.lineList.length&&(b=a.lineList[a.currentLine],a.currentLine++),new Sk.builtin.str(b)}),b.readlines=new Sk.builtin.func(function(a){for(var b=[],c=a.currentLine;c<a.lineList.length;c++)b.push(new Sk.builtin.str(a.lineList[c]));return new Sk.builtin.list(b)})},\"Response\",[]),a.urlopen=new Sk.builtin.func(function(b,c){var d=new Promise(function(d){var e=new XMLHttpRequest;e.addEventListener(\"loadend\",function(){d(Sk.misceval.callsimArray(a.Response,[e]))}),c?(e.open(\"POST\",b.v),e.setRequestHeader(\"Content-type\",\"application/x-www-form-urlencoded\"),e.setRequestHeader(\"Content-length\",c.v.length),e.send(c.v)):(e.open(\"GET\",b.v),e.send(null))}),e=new Sk.misceval.Suspension;return e.resume=function(){return resolution},e.data={type:\"Sk.promise\",promise:d.then(function(a){return resolution=a,a},function(a){return resolution=\"\",a})},e}),a};","src/lib/urllib2.py":"raise NotImplementedError(\"urllib2 is not yet implemented in Skulpt\")\n","src/lib/urlparse.py":"raise NotImplementedError(\"urlparse is not yet implemented in Skulpt\")\n","src/lib/user.py":"raise NotImplementedError(\"user is not yet implemented in Skulpt\")\n","src/lib/uu.py":"raise NotImplementedError(\"uu is not yet implemented in Skulpt\")\n","src/lib/uuid.py":"raise NotImplementedError(\"uuid is not yet implemented in Skulpt\")\n","src/lib/warnings.py":"raise NotImplementedError(\"warnings is not yet implemented in Skulpt\")\n","src/lib/wave.py":"raise NotImplementedError(\"wave is not yet implemented in Skulpt\")\n","src/lib/weakref.py":"raise NotImplementedError(\"weakref is not yet implemented in Skulpt\")\n","src/lib/webbrowser.js":"var $builtinmodule=function(){function open_tab(a){return(Sk.builtin.pyCheckType(\"url\",\"string\",Sk.builtin.checkString(a)),!b)?Sk.builtin.bool.false$:(a=a.$jsstr(),window.open(a,\"_blank\"),Sk.builtin.bool.true$)}var a={},b=\"undefined\"!=typeof window&&\"undefined\"!=typeof window.navigator;return a.__name__=new Sk.builtin.str(\"webbrowser\"),a.open=new Sk.builtin.func(function open(a){return Sk.builtin.pyCheckArgsLen(\"open\",arguments.length+1,1,3),open_tab(a)}),a.open_new=new Sk.builtin.func(function open_new(a){return Sk.builtin.pyCheckArgsLen(\"open_new\",arguments.length,1,1),open_tab(a)}),a.open_new_tab=new Sk.builtin.func(function open_new_tab(a){return Sk.builtin.pyCheckArgsLen(\"open_new_tab\",arguments.length,1,1),open_tab(a)}),a.DefaultBrowser=Sk.misceval.buildClass(a,function dflbrowser(a,b){b.__init__=new Sk.builtin.func(function __init__(){return Sk.builtin.none.none$}),b.open=new Sk.builtin.func(function open(a,b){return Sk.builtin.pyCheckArgsLen(\"open\",arguments.length,2,4),open_tab(b)}),b.open_new=new Sk.builtin.func(function open_new(a,b){return Sk.builtin.pyCheckArgsLen(\"open_new\",arguments.length,2,2),open_tab(b)}),b.open_new_tab=new Sk.builtin.func(function open_new_tab(a,b){return Sk.builtin.pyCheckArgsLen(\"open_new_tab\",arguments.length,2,2),open_tab(b)})},\"DefaultBrowser\",[]),a.get=new Sk.builtin.func(function get(){return Sk.builtin.pyCheckArgsLen(\"get\",arguments.length,0,1),Sk.misceval.callsimArray(a.DefaultBrowser,[])}),a};","src/lib/webbrowser.py":"raise NotImplementedError(\"webbrowser is not yet implemented in Skulpt\")\n","src/lib/webgl/__init__.js":"var $builtinmodule=function(){var a={__name__:new Sk.builtin.str(\"webgl\")},c=function(a){return\"<table style=\\\"background-color: #8CE; width: 100%; height: 100%;\\\"><tr><td align=\\\"center\\\"><div style=\\\"display: table-cell; vertical-align: middle;\\\"><div style=\\\"\\\">\"+a+\"</div></div></td></tr></table>\"},d=\"This page requires a browser that supports WebGL.<br/><a href=\\\"http://get.webgl.org\\\">Click here to upgrade your browser.</a>\",e=function(a){for(var b=[\"webgl\",\"experimental-webgl\",\"webkit-3d\",\"moz-webgl\"],c=null,d=0;d<b.length;++d){try{c=a.getContext(b[d])}catch(a){}if(c)break}if(c){function returnFalse(){return!1}a.onselectstart=returnFalse,a.onmousedown=returnFalse}return c},f=function(a,f){var g=document.getElementById(a);if(f||(f=g.getElementsByTagName(\"canvas\")[0]),!f)return void(g.innerHTML=c(d));var h=e(f);if(!h){var i=navigator.userAgent.match(/(\\w+\\/.*? )/g),j={};try{for(var k=0;k<i.length;++k){for(var l=i[k].match(/(\\w+)/g),m=[],n=1;n<l.length;++n)m.push(parseInt(l[n]));j[l[0]]=m}}catch(a){}g.innerHTML=j.Chrome&&(7<j.Chrome[0]||7==j.Chrome[0]&&0<j.Chrome[1]||7==j.Chrome[0]&&0==j.Chrome[1]&&521<=j.Chrome[2])?c(\"It doesn't appear your computer can support WebGL.<br/><a href=\\\"http://get.webgl.org\\\">Click here for more information.</a>\"):c(d)}return h};return a.Context=Sk.misceval.buildClass(a,function(a,b){b.__init__=new Sk.builtin.func(function(a,b){var c=document.getElementById(b.v),d=f(b.v,c);if(!d)throw new Error(\"Your browser does not appear to support WebGL.\");for(var e in a.gl=d,d.__proto__)if(\"number\"==typeof d.__proto__[e])Sk.abstr.objectSetItem(a.$d,new Sk.builtin.str(e),d.__proto__[e]);else if(\"function\"==typeof d.__proto__[e])switch(e){case\"bufferData\":break;case\"clearColor\":break;case\"drawArrays\":break;case\"getAttribLocation\":break;case\"getUniformLocation\":break;case\"shaderSource\":break;case\"uniformMatrix4fv\":break;case\"vertexAttribPointer\":break;case\"viewport\":break;default:(function(b){Sk.abstr.objectSetItem(a.$d,new Sk.builtin.str(e),new Sk.builtin.func(function(){var a=d.__proto__[b];return a.apply(d,arguments)}))})(e);}d.clearColor(100/255,149/255,237/255,1),d.clear(d.COLOR_BUFFER_BIT)}),b.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr,b.bufferData=new Sk.builtin.func(function(a,b,c,d){a.gl.bufferData(b,c.v,d)}),b.clearColor=new Sk.builtin.func(function(a,b,c,d,e){a.gl.clearColor(Sk.builtin.asnum$(b),Sk.builtin.asnum$(c),Sk.builtin.asnum$(d),Sk.builtin.asnum$(e))}),b.getAttribLocation=new Sk.builtin.func(function(a,b,c){return a.gl.getAttribLocation(b,c.v)}),b.getUniformLocation=new Sk.builtin.func(function(a,b,c){return a.gl.getUniformLocation(b,c.v)}),b.shaderSource=new Sk.builtin.func(function(a,b,c){a.gl.shaderSource(b,c.v)}),b.drawArrays=new Sk.builtin.func(function(a,b,c,d){a.gl.drawArrays(Sk.builtin.asnum$(b),Sk.builtin.asnum$(c),Sk.builtin.asnum$(d))}),b.vertexAttribPointer=new Sk.builtin.func(function(a,b,c,d,e,f,g){a.gl.vertexAttribPointer(b,Sk.builtin.asnum$(c),Sk.builtin.asnum$(d),e,Sk.builtin.asnum$(f),Sk.builtin.asnum$(g))}),b.viewport=new Sk.builtin.func(function(a,b,c,d,e){a.gl.viewport(Sk.builtin.asnum$(b),Sk.builtin.asnum$(c),Sk.builtin.asnum$(d),Sk.builtin.asnum$(e))}),b.uniformMatrix4fv=new Sk.builtin.func(function(a,b,c,d){a.gl.uniformMatrix4fv(Sk.builtin.asnum$(b),c,d.v)}),b.setDrawFunc=new Sk.builtin.func(function(a,b){var c=new Date().getTime(),d=setInterval(function(){Sk.misceval.callsimArray(b,[a,new Date().getTime()-c])},1e3/60)})},\"Context\",[]),a.Float32Array=Sk.misceval.buildClass(a,function(a,b){b.__init__=new Sk.builtin.func(function(a,b){a.v=\"number\"==typeof b?new Float32Array(b):new Float32Array(Sk.ffi.remapToJs(b))}),b.__repr__=new Sk.builtin.func(function(a){for(var b=[],c=0;c<a.v.length;++c)b.push(a.v[c]);return new Sk.builtin.str(\"[\"+b.join(\", \")+\"]\")})},\"Float32Array\",[]),a.Matrix4x4=Sk.misceval.buildClass(a,function(a,b){b.__init__=new Sk.builtin.func(function(a,b){a.v=new Float32Array(Sk.ffi.remapToJs(b))}),b.identity=new Sk.builtin.func(function(a){var b=a.v;b[0]=1,b[1]=0,b[2]=0,b[3]=0,b[4]=0,b[5]=1,b[6]=0,b[7]=0,b[8]=0,b[9]=0,b[10]=1,b[11]=0,b[12]=0,b[13]=0,b[14]=0,b[15]=1}),b.perspective=new Sk.builtin.func(function(b,c,d,e,g){var h=Math.tan,i=Math.PI,j=h(.5*i-.5*(Sk.builtin.asnum$(c)*i/180)),l=Sk.builtin.asnum$(d),a=Sk.builtin.asnum$(e),n=Sk.builtin.asnum$(g),f=1/(a-n),k=b.v;k[0]=j/l,k[1]=0,k[2]=0,k[3]=0,k[4]=0,k[5]=j,k[6]=0,k[7]=0,k[8]=0,k[9]=0,k[10]=(a+n)*f,k[11]=-1,k[12]=0,k[13]=0,k[14]=2*(a*n*f),k[15]=0}),b.translate=new Sk.builtin.func(function(a,b){var c=a.v,d=Sk.ffi.remapToJs(b);c[0]=1,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=1,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=1,c[11]=0,c[12]=d[0],c[13]=d[1],c[14]=d[2],c[15]=1}),b.__repr__=new Sk.builtin.func(function(a){for(var b=[],c=0;c<a.v.length;++c)b.push(a.v[c]);return new Sk.builtin.str(\"[\"+b.join(\", \")+\"]\")})},\"Matrix4x4\",[]),a};","src/lib/webgl/math.js":"var $builtinmodule=function(){var a={};return a.Mat44=Sk.misceval.buildClass(a,function(b,c){var d=Math.sqrt;c.__init__=new Sk.builtin.func(function(a){Sk.misceval.callsimArray(c.loadIdentity,[a]),a.stack=[]}),c.push=new Sk.builtin.func(function(a){a.stack.push(a.elements.slice(0))}),c.pop=new Sk.builtin.func(function(a){a.elements=a.stack.pop()}),c.loadIdentity=new Sk.builtin.func(function(a){a.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}),c.transform3=new Sk.builtin.func(function(b,c){var d=b.elements;return Sk.misceval.callsimArray(a.Vec3,[d[0]*c.x+d[4]*c.y+d[8]*c.z,d[1]*c.x+d[5]*c.y+d[9]*c.z,d[2]*c.x+d[6]*c.y+d[10]*c.z])}),c.scale=new Sk.builtin.func(function(a,b,c,d){return a.elements[0]*=b,a.elements[1]*=b,a.elements[2]*=b,a.elements[3]*=b,a.elements[4]*=c,a.elements[5]*=c,a.elements[6]*=c,a.elements[7]*=c,a.elements[8]*=d,a.elements[9]*=d,a.elements[10]*=d,a.elements[11]*=d,a}),c.translate=new Sk.builtin.func(function(a,b,c,d){return a.elements[12]+=a.elements[0]*b+a.elements[4]*c+a.elements[8]*d,a.elements[13]+=a.elements[1]*b+a.elements[5]*c+a.elements[9]*d,a.elements[14]+=a.elements[2]*b+a.elements[6]*c+a.elements[10]*d,a.elements[15]+=a.elements[3]*b+a.elements[7]*c+a.elements[11]*d,a}),c.rotate=new Sk.builtin.func(function(b,c,e,f,g){var h=Math.cos,i=Math.sin,j=Math.PI,k=d(e*e+f*f+g*g),l=i(c*j/180),m=h(c*j/180);if(0<k){var n,o,p,q,r,s,t,u,v,w,A;e/=k,f/=k,g/=k,n=e*e,o=f*f,p=g*g,q=e*f,r=f*g,s=g*e,t=e*l,u=f*l,v=g*l,w=1-m,A=Sk.misceval.callsimArray(a.Mat44),A.elements[0]=w*n+m,A.elements[1]=w*q-v,A.elements[2]=w*s+u,A.elements[3]=0,A.elements[4]=w*q+v,A.elements[5]=w*o+m,A.elements[6]=w*r-t,A.elements[7]=0,A.elements[8]=w*s-u,A.elements[9]=w*r+t,A.elements[10]=w*p+m,A.elements[11]=0,A.elements[12]=0,A.elements[13]=0,A.elements[14]=0,A.elements[15]=1,A=A.multiply(b),b.elements=A.elements}return b}),c.multiply=new Sk.builtin.func(function(b,c){for(var d=Sk.misceval.callsimArray(a.Mat44),e=0;4>e;e++)d.elements[4*e+0]=b.elements[4*e+0]*c.elements[0]+b.elements[4*e+1]*c.elements[4]+b.elements[4*e+2]*c.elements[8]+b.elements[4*e+3]*c.elements[12],d.elements[4*e+1]=b.elements[4*e+0]*c.elements[1]+b.elements[4*e+1]*c.elements[5]+b.elements[4*e+2]*c.elements[9]+b.elements[4*e+3]*c.elements[13],d.elements[4*e+2]=b.elements[4*e+0]*c.elements[2]+b.elements[4*e+1]*c.elements[6]+b.elements[4*e+2]*c.elements[10]+b.elements[4*e+3]*c.elements[14],d.elements[4*e+3]=b.elements[4*e+0]*c.elements[3]+b.elements[4*e+1]*c.elements[7]+b.elements[4*e+2]*c.elements[11]+b.elements[4*e+3]*c.elements[15];return b.elements=d.elements,b}),c.lookAt=new Sk.builtin.func(function(b,c,e,f,g,h,i,j,k,l){var m=[c-g,e-h,f-i],n=d(m[0]*m[0]+m[1]*m[1]+m[2]*m[2]);n&&(m[0]/=n,m[1]/=n,m[2]/=n);var o=[j,k,l],p=[];p[0]=o[1]*m[2]-o[2]*m[1],p[1]=-o[0]*m[2]+o[2]*m[0],p[2]=o[0]*m[1]-o[1]*m[0],o[0]=m[1]*p[2]-m[2]*p[1],o[1]=-m[0]*p[2]+m[2]*p[0],o[2]=m[0]*p[1]-m[1]*p[0],n=d(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]),n&&(p[0]/=n,p[1]/=n,p[2]/=n),n=d(o[0]*o[0]+o[1]*o[1]+o[2]*o[2]),n&&(o[0]/=n,o[1]/=n,o[2]/=n);var q=Sk.misceval.callsimArray(a.Mat44);return q.elements[0]=p[0],q.elements[4]=p[1],q.elements[8]=p[2],q.elements[12]=0,q.elements[1]=o[0],q.elements[5]=o[1],q.elements[9]=o[2],q.elements[13]=0,q.elements[2]=m[0],q.elements[6]=m[1],q.elements[10]=m[2],q.elements[14]=0,q.elements[3]=0,q.elements[7]=0,q.elements[11]=0,q.elements[15]=1,q=q.multiply(b),b.elements=q.elements,b.translate(-c,-e,-f),b})},\"Mat44\",[]),a.Mat33=Sk.misceval.buildClass(a,function(a,b){b.__init__=new Sk.builtin.func(function(a){Sk.misceval.callsimArray(b.loadIdentity,[a])}),b.loadIdentity=new Sk.builtin.func(function(a){a.elements=[1,0,0,0,1,0,0,0,1]})},\"Mat33\",[]),a.Vec3=Sk.misceval.buildClass(a,function(b,c){c.__init__=new Sk.builtin.func(function(a,b,c,d){a.x=b,a.y=c,a.z=d}),c.__sub__=new Sk.builtin.func(function(b,c){return Sk.misceval.callsimArray(a.Vec3,[b.x-c.x,b.y-c.y,b.z-c.z])})},\"Vec3\",[]),a.cross=new Sk.builtin.func(function(b,c){return Sk.asserts.assert(b instanceof a.Vec3&&c instanceof a.Vec3),Sk.misceval.callsimArray(a.Vec3,[b.y*c.z-b.z*c.y,b.z*c.x-b.x*c.z,b.x*c.y-b.y*c.x])}),a};","src/lib/webgl/matrix4.js":"var $builtinmodule=function(){var a=Math.PI,b={},c=new Float32Array(3),d=new Float32Array(3),e=new Float32Array(3),f=new Float32Array(4),g=new Float32Array(4),h=new Float32Array(4),i=new Float32Array(16),j=new Float32Array(16),k=new Float32Array(16),l=function(b,c){for(var a=Math.sqrt,d=0,e=c.length,f=0;f<e;++f)d+=c[f]*c[f];if(d=a(d),1e-5<d)for(var f=0;f<e;++f)b[f]=c[f]/d;else for(var f=0;f<e;++f)b[f]=0;return b},m=function(c,d,a){return c[0]=d[1]*a[2]-d[2]*a[1],c[1]=d[2]*a[0]-d[0]*a[2],c[2]=d[0]*a[1]-d[1]*a[0],c},n=function(c,d,a){for(var b=d.length,e=0;e<b;++e)c[e]=d[e]-a[e];return c},o=function(c,a){return c[0]*a[0]+c[1]*a[1]+c[2]*a[2]};return b.lookAt=new Sk.builtin.func(function(a,b,f,g){var h=c,i=d,j=l(h,n(h,b.v,f.v)),k=l(i,m(i,g.v,j)),p=m(e,j,k),q=a.v;return q[0]=k[0],q[1]=p[0],q[2]=j[0],q[3]=0,q[4]=k[1],q[5]=p[1],q[6]=j[1],q[7]=0,q[8]=k[2],q[9]=p[2],q[10]=j[2],q[11]=0,q[12]=-o(k,b.v),q[13]=-o(p,b.v),q[14]=-o(j,b.v),q[15]=1,a}),b.perspective=new Sk.builtin.func(function(b,c,d,e,g){var h=Math.tan,i=h(.5*a-.5*(c*a/180)),f=1/(e-g),j=b.v;return j[0]=i/d,j[1]=0,j[2]=0,j[3]=0,j[4]=0,j[5]=i,j[6]=0,j[7]=0,j[8]=0,j[9]=0,j[10]=(e+g)*f,j[11]=-1,j[12]=0,j[13]=0,j[14]=2*(e*g*f),j[15]=0,b}),b.rotationY=new Sk.builtin.func(function(b,d){var e=Math.sin,f=Math.cos,g=b.v,h=f(d*a/180),c=e(d*a/180);return g[0]=h,g[1]=0,g[2]=-c,g[3]=0,g[4]=0,g[5]=1,g[6]=0,g[7]=0,g[8]=c,g[9]=0,g[10]=h,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,b}),b.identity=new Sk.builtin.func(function(a){var b=a.v;return b[0]=1,b[1]=0,b[2]=0,b[3]=0,b[4]=0,b[5]=1,b[6]=0,b[7]=0,b[8]=0,b[9]=0,b[10]=1,b[11]=0,b[12]=0,b[13]=0,b[14]=0,b[15]=1,a}),b.mul=new Sk.builtin.func(function(c,d,e){var f=c.v,g=d.v,a=e.v,b=g[0],h=g[1],i=g[2],j=g[3],k=g[4],l=g[5],m=g[6],n=g[7],o=g[8],p=g[9],q=g[10],r=g[11],s=g[12],t=g[13],u=g[14],v=g[15],w=a[0],x=a[1],y=a[2],z=a[3],A=a[4],B=a[5],C=a[6],D=a[7],E=a[8],F=a[9],G=a[10],H=a[11],I=a[12],J=a[13],K=a[14],L=a[15];return f[0]=b*w+h*A+i*E+j*I,f[1]=b*x+h*B+i*F+j*J,f[2]=b*y+h*C+i*G+j*K,f[3]=b*z+h*D+i*H+j*L,f[4]=k*w+l*A+m*E+n*I,f[5]=k*x+l*B+m*F+n*J,f[6]=k*y+l*C+m*G+n*K,f[7]=k*z+l*D+m*H+n*L,f[8]=o*w+p*A+q*E+r*I,f[9]=o*x+p*B+q*F+r*J,f[10]=o*y+p*C+q*G+r*K,f[11]=o*z+p*D+q*H+r*L,f[12]=s*w+t*A+u*E+v*I,f[13]=s*x+t*B+u*F+v*J,f[14]=s*y+t*C+u*G+v*K,f[15]=s*z+t*D+u*H+v*L,c}),b.invert=new Sk.builtin.func(function(a,b){var c=a.v,e=b.v,f=e[0],g=e[1],h=e[2],i=e[3],j=e[4],k=e[5],l=e[6],m=e[7],n=e[8],o=e[9],p=e[10],q=e[11],r=e[12],s=e[13],t=e[14],u=e[15],v=p*u,w=t*q,x=l*u,y=t*m,z=l*q,A=p*m,B=h*u,C=t*i,D=h*q,E=p*i,F=h*m,G=l*i,H=n*s,I=r*o,J=j*s,K=r*k,L=j*o,M=n*k,N=f*s,O=r*g,P=f*o,Q=n*g,R=f*k,S=j*g,T=v*k+y*o+z*s-(w*k+x*o+A*s),U=w*g+B*o+E*s-(v*g+C*o+D*s),V=x*g+C*k+F*s-(y*g+B*k+G*s),W=A*g+D*k+G*o-(z*g+E*k+F*o),X=1/(f*T+j*U+n*V+r*W);return c[0]=X*T,c[1]=X*U,c[2]=X*V,c[3]=X*W,c[4]=X*(w*j+x*n+A*r-(v*j+y*n+z*r)),c[5]=X*(v*f+C*n+D*r-(w*f+B*n+E*r)),c[6]=X*(y*f+B*j+G*r-(x*f+C*j+F*r)),c[7]=X*(z*f+E*j+F*n-(A*f+D*j+G*n)),c[8]=X*(H*m+K*q+L*u-(I*m+J*q+M*u)),c[9]=X*(I*i+N*q+Q*u-(H*i+O*q+P*u)),c[10]=X*(J*i+O*m+R*u-(K*i+N*m+S*u)),c[11]=X*(M*i+P*m+S*q-(L*i+Q*m+R*q)),c[12]=X*(J*p+M*t+I*l-(L*t+H*l+K*p)),c[13]=X*(P*t+H*h+O*p-(N*p+Q*t+I*h)),c[14]=X*(N*l+S*t+K*h-(R*t+J*h+O*l)),c[15]=X*(R*p+L*h+Q*l-(P*l+S*p+M*h)),a}),b.transpose=new Sk.builtin.func(function(a,b){for(var c=a.v,d=b.v,e=0;4>e;++e)for(var f=0;4>f;++f)c[4*e+f]=d[4*f+e];return c}),b};","src/lib/webgl/models.js":"var $builtinmodule=function(a){var c={},d=function(a,c){var d=c||gl.ARRAY_BUFFER,e=gl.createBuffer();if(this.target=d,this.buf=e,this.set(a),this.numComponents_=a.numComponents,this.numElements_=a.numElements,this.totalComponents_=this.numComponents_*this.numElements_,a.buffer instanceof Float32Array)this.type_=gl.FLOAT;else if(a.buffer instanceof Uint8Array)this.type_=gl.UNSIGNED_BYTE;else if(a.buffer instanceof Int8Array)this.type_=gl._BYTE;else if(a.buffer instanceof Uint16Array)this.type_=gl.UNSIGNED_SHORT;else if(a.buffer instanceof Int16Array)this.type_=gl.SHORT;else throw\"unhandled type:\"+typeof a.buffer};return d.prototype.set=function(a){gl.bindBuffer(this.target,this.buf),gl.bufferData(this.target,a.buffer,gl.STATIC_DRAW)},d.prototype.type=function(){return this.type_},d.prototype.numComponents=function(){return this.numComponents_},d.prototype.numElements=function(){return this.numElements_},d.prototype.totalComponents=function(){return this.totalComponents_},d.prototype.buffer=function(){return this.buf},d.prototype.stride=function(){return 0},d.prototype.offset=function(){return 0},c.Model=Sk.misceval.buildClass(c,function(c,e){e.__init__=new Sk.builtin.func(function(c,e,f,g){c.buffers={};var h=function(a,e){var f=\"indices\"==a?gl.ELEMENT_ARRAY_BUFFER:gl.ARRAY_BUFFER;b=c.buffers[a],b?b.set(e):b=new d(e,f),c.buffers[a]=b};for(a in f)h(a,f[a]);var i={},j=0;for(var k in g)i[k]=j++;c.mode=gl.TRIANGLES,c.textures=g.v,c.textureUnits=i,c.shader=e}),e.drawPrep=new Sk.builtin.func(function(a,c){var d=a.shader,e=a.buffers,f=a.textures;for(var g in c=Sk.ffi.remapToJs(c),Sk.misceval.callsimArray(d.use,[d]),e){var h=e[g];if(\"indices\"==g)gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,h.buffer());else{var i=d.attrib[g];i&&i(h)}}for(var j in f){var k=a.textureUnits[j];d.setUniform$impl(d,textuer,k),f[j].bindToUnit(k)}for(var l in c)d.setUniform$impl(d,l,c[l])}),e.draw=new Sk.builtin.func(function(a,c,d){var e=a.shader;for(uniform in c=Sk.ffi.remapToJs(c),c)e.setUniform$impl(e,uniform,c[uniform]);if(d)for(var f in d){var g=a.textureUnits[f];e.setUniform$impl(e,f,g),d[f].bindToUnit(g)}var h=a.buffers;gl.drawElements(a.mode,h.indices.totalComponents(),gl.UNSIGNED_SHORT,0)})},\"Model\",[]),c};","src/lib/webgl/primitives.js":"var $builtinmodule=function(){var a={},b=function(a,b,c){c=c||\"Float32Array\";var d=window[c];b.length?(this.buffer=new d(b),b=this.buffer.length/a,this.cursor=b):(this.buffer=new d(a*b),this.cursor=0),this.numComponents=a,this.numElements=b,this.type=c};return b.prototype.stride=function(){return 0},b.prototype.offset=function(){return 0},b.prototype.getElement=function(a){for(var b=a*this.numComponents,c=[],d=0;d<this.numComponents;++d)c.push(this.buffer[b+d]);return c},b.prototype.setElement=function(a,b){for(var c=a*this.numComponents,d=0;d<this.numComponents;++d)this.buffer[c+d]=b[d]},b.prototype.clone=function(){var a=new b(this.numComponents,this.numElements,this.type);return a.pushArray(this),a},b.prototype.push=function(a){this.setElement(this.cursor++,a)},b.prototype.pushArray=function(a){for(var b=0;b<a.numElements;++b)this.push(a.getElement(b))},b.prototype.pushArrayWithOffset=function(a,b){for(var c,d=0;d<a.numElements;++d){c=a.getElement(d);for(var e=0;e<b.length;++e)c[e]+=b[e];this.push(c)}},b.prototype.computeExtents=function(){for(var a=Math.max,b=Math.min,c,d=this.numElements,e=this.numComponents,f=this.getElement(0),g=this.getElement(0),h=1;h<d;++h){c=this.getElement(h);for(var i=0;i<e;++i)f[i]=b(f[i],c[i]),g[i]=a(g[i],c[i])}return{min:f,max:g}},a.createCube=new Sk.builtin.func(function(a){for(var c,d=[[3,7,5,1],[0,4,6,2],[6,7,3,2],[0,1,5,4],[5,7,6,4],[2,3,1,0]],e=a/2,g=[[-e,-e,-e],[+e,-e,-e],[-e,+e,-e],[+e,+e,-e],[-e,-e,+e],[+e,-e,+e],[-e,+e,+e],[+e,+e,+e]],h=[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],i=[[0,0],[1,0],[1,1],[0,1]],j=24,k=new b(3,j),l=new b(3,j),m=new b(2,j),n=new b(3,12,\"Uint16Array\"),o=0;6>o;++o){c=d[o];for(var p=0;4>p;++p){var q=g[c[p]],r=h[o],s=i[p];k.push(q),l.push(r),m.push(s)}var t=4*o;n.push([t+0,t+1,t+2]),n.push([t+0,t+2,t+3])}return{position:k,normal:l,texCoord:m,indices:n}}),a};","src/lib/whichdb.py":"raise NotImplementedError(\"whichdb is not yet implemented in Skulpt\")\n","src/lib/wsgiref/__init__.py":"raise NotImplementedError(\"wsgiref is not yet implemented in Skulpt\")\n","src/lib/xdrlib.py":"raise NotImplementedError(\"xdrlib is not yet implemented in Skulpt\")\n","src/lib/xml/__init__.py":"raise NotImplementedError(\"xml 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/xml/etree/__init__.py":"raise NotImplementedError(\"etree 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/xml/sax/__init__.py":"raise NotImplementedError(\"sax is not yet implemented in Skulpt\")\n","src/lib/xmllib.py":"raise NotImplementedError(\"xmllib is not yet implemented in Skulpt\")\n","src/lib/xmlrpclib.py":"raise NotImplementedError(\"xmlrpclib is not yet implemented in Skulpt\")\n","src/lib/zipfile.py":"raise NotImplementedError(\"zipfile is not yet implemented in Skulpt\")\n"}} \ No newline at end of file diff --git a/preview/skulpt.min.js b/preview/skulpt.min.js new file mode 100644 index 0000000..a2566df --- /dev/null +++ b/preview/skulpt.min.js @@ -0,0 +1,1112 @@ +(function(){/* + https://mths.be/fromcodepoint v0.2.1 by @mathias */ +'use strict';var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(m,p,a){m!=Array.prototype&&m!=Object.prototype&&(m[p]=a.value)};$jscomp.getGlobal=function(m){return"undefined"!=typeof window&&window===m?m:"undefined"!=typeof global&&null!=global?global:m};$jscomp.global=$jscomp.getGlobal(this); +$jscomp.polyfill=function(m,p,a,b){if(p){a=$jscomp.global;m=m.split(".");for(b=0;b<m.length-1;b++){var c=m[b];c in a||(a[c]={});a=a[c]}m=m[m.length-1];b=a[m];p=p(b);p!=b&&null!=p&&$jscomp.defineProperty(a,m,{configurable:!0,writable:!0,value:p})}};$jscomp.polyfill("Array.prototype.includes",function(m){return m?m:function(m,a){var b=this;b instanceof String&&(b=String(b));var c=b.length;a=a||0;for(0>a&&(a=Math.max(a+c,0));a<c;a++){var d=b[a];if(d===m||Object.is(d,m))return!0}return!1}},"es7","es3"); +$jscomp.owns=function(m,p){return Object.prototype.hasOwnProperty.call(m,p)};$jscomp.polyfill("Object.values",function(m){return m?m:function(m){var a=[],b;for(b in m)$jscomp.owns(m,b)&&a.push(m[b]);return a}},"es8","es3");$jscomp.arrayIteratorImpl=function(m){var p=0;return function(){return p<m.length?{done:!1,value:m[p++]}:{done:!0}}};$jscomp.arrayIterator=function(m){return{next:$jscomp.arrayIteratorImpl(m)}};$jscomp.SYMBOL_PREFIX="jscomp_symbol_"; +$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.SymbolClass=function(m,p){this.$jscomp$symbol$id_=m;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:p})};$jscomp.SymbolClass.prototype.toString=function(){return this.$jscomp$symbol$id_}; +$jscomp.Symbol=function(){function m(a){if(this instanceof m)throw new TypeError("Symbol is not a constructor");return new $jscomp.SymbolClass($jscomp.SYMBOL_PREFIX+(a||"")+"_"+p++,a)}var p=0;return m}(); +$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var m=$jscomp.global.Symbol.iterator;m||(m=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("Symbol.iterator"));"function"!=typeof Array.prototype[m]&&$jscomp.defineProperty(Array.prototype,m,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}});$jscomp.initSymbolIterator=function(){}}; +$jscomp.initSymbolAsyncIterator=function(){$jscomp.initSymbol();var m=$jscomp.global.Symbol.asyncIterator;m||(m=$jscomp.global.Symbol.asyncIterator=$jscomp.global.Symbol("Symbol.asyncIterator"));$jscomp.initSymbolAsyncIterator=function(){}};$jscomp.iteratorPrototype=function(m){$jscomp.initSymbolIterator();m={next:m};m[$jscomp.global.Symbol.iterator]=function(){return this};return m}; +$jscomp.iteratorFromArray=function(m,p){$jscomp.initSymbolIterator();m instanceof String&&(m+="");var a=0,b={next:function(){if(a<m.length){var c=a++;return{value:p(c,m[c]),done:!1}}b.next=function(){return{done:!0,value:void 0}};return b.next()}};b[Symbol.iterator]=function(){return b};return b};$jscomp.polyfill("Array.prototype.values",function(m){return m?m:function(){return $jscomp.iteratorFromArray(this,function(m,a){return a})}},"es8","es3"); +(function(m){function p(b){if(a[b])return a[b].exports;var c=a[b]={i:b,l:!1,exports:{}};m[b].call(c.exports,c,c.exports,p);c.l=!0;return c.exports}var a={};p.m=m;p.c=a;p.d=function(a,c,d){p.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:d})};p.r=function(a){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"});Object.defineProperty(a,"__esModule",{value:!0})};p.t=function(a,c){c&1&&(a=p(a));if(c&8)return a;if(c&4&&"object"===typeof a&& +a&&a.__esModule)return a;var b=Object.create(null);p.r(b);Object.defineProperty(b,"default",{enumerable:!0,value:a});if(c&2&&"string"!=typeof a)for(var e in a)p.d(b,e,function(c){return a[c]}.bind(null,e));return b};p.n=function(a){var c=a&&a.__esModule?function(){return a["default"]}:function(){return a};p.d(c,"a",c);return c};p.o=function(a,c){return Object.prototype.hasOwnProperty.call(a,c)};p.p="";return p(p.s=1)})([function(m,p){p=function(){return this}();try{p=p||(new Function("return this"))()}catch(a){"object"=== +typeof window&&(p=window)}m.exports=p},function(m,p,a){a(2);Sk.global.strftime=a(3);Sk.global.strptime=a(4);a(5);a(7);a(8);a(9);a(10);a(11);a(12);a(13);a(14);a(15);a(16);a(17);a(18);a(19);a(20);a(21);a(23);a(24);a(25);a(26);a(27);a(28);a(29);a(30);a(31);a(32);a(33);a(34);a(35);a(36);a(37);a(38);a(39);a(40);a(41);a(42);a(43);a(44);a(45);a(46);a(47);a(48);a(49);a(50);a(51);a(52);a(53);a(54);a(55);a(56);a(57);a(58);a(59);a(60);a(61);a(62);a(63)},function(m,p,a){(function(a){var c={build:{githash:"4b86a6f1f3cf684f7e5ca17042fc5d6bd302df60", +date:"2020-09-22T14:43:51.634Z"}};c.global="undefined"!==typeof a?a:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{};c.exportSymbol=function(a,b){a=a.split(".");var d=c.global,e;for(e=0;e<a.length-1;e++){var f=a[e];d=d.hasOwnProperty(f)?d[f]:d[f]={}}"undefined"!==typeof b&&(f=a[e],d[f]=b)};c.isArrayLike=function(a){return a instanceof Array||a&&a.length&&"number"==typeof a.length?!0:!1};c.js_beautify=function(a){return a};c.exportSymbol("Sk",c);c.exportSymbol("Sk.global",c.global); +c.exportSymbol("Sk.build",c.build);c.exportSymbol("Sk.exportSymbol",c.exportSymbol);c.exportSymbol("Sk.isArrayLike",c.isArrayLike);c.exportSymbol("Sk.js_beautify",c.js_beautify)}).call(this,a(0))},function(m,p){(function(){function a(n,l,z){function u(a,f,k,n){for(var l="",z=null,y=!1,t=a.length,H=!1,m=0;m<t;m++){var C=a.charCodeAt(m);if(!0===y)if(45===C)z="";else if(95===C)z=" ";else if(48===C)z="0";else if(58===C)H&&g("[WARNING] detected use of unsupported %:: or %::: modifiers to strftime"),H= +!0;else{switch(C){case 37:l+="%";break;case 65:l+=k.days[f.getDay()];break;case 66:l+=k.months[f.getMonth()];break;case 67:l+=b(Math.floor(f.getFullYear()/100),z);break;case 68:l+=u(k.formats.D,f,k,n);break;case 70:l+=u(k.formats.F,f,k,n);break;case 72:l+=b(f.getHours(),z);break;case 73:l+=b(d(f.getHours()),z);break;case 76:l+=c(Math.floor(n%1E3));break;case 77:l+=b(f.getMinutes(),z);break;case 80:l+=12>f.getHours()?k.am:k.pm;break;case 82:l+=u(k.formats.R,f,k,n);break;case 83:l+=b(f.getSeconds(), +z);break;case 84:l+=u(k.formats.T,f,k,n);break;case 85:l+=b(e(f,"sunday"),z);break;case 87:l+=b(e(f,"monday"),z);break;case 88:l+=u(k.formats.X,f,k,n);break;case 89:l+=f.getFullYear();break;case 90:K&&0===q?l+="GMT":(z=f.toString().match(/\(([\w\s]+)\)/),l+=z&&z[1]||"");break;case 97:l+=k.shortDays[f.getDay()];break;case 98:l+=k.shortMonths[f.getMonth()];break;case 99:l+=u(k.formats.c,f,k,n);break;case 100:l+=b(f.getDate(),z);break;case 101:l+=b(f.getDate(),null==z?" ":z);break;case 104:l+=k.shortMonths[f.getMonth()]; +break;case 106:z=new Date(f.getFullYear(),0,1);z=Math.ceil((f.getTime()-z.getTime())/864E5);l+=c(z);break;case 107:l+=b(f.getHours(),null==z?" ":z);break;case 108:l+=b(d(f.getHours()),null==z?" ":z);break;case 109:l+=b(f.getMonth()+1,z);break;case 110:l+="\n";break;case 111:z=f.getDate();l=k.ordinalSuffixes?l+(String(z)+(k.ordinalSuffixes[z-1]||h(z))):l+(String(z)+h(z));break;case 112:l+=12>f.getHours()?k.AM:k.PM;break;case 114:l+=u(k.formats.r,f,k,n);break;case 115:l+=Math.floor(n/1E3);break;case 116:l+= +"\t";break;case 117:z=f.getDay();l+=0===z?7:z;break;case 118:l+=u(k.formats.v,f,k,n);break;case 119:l+=f.getDay();break;case 120:l+=u(k.formats.x,f,k,n);break;case 121:l+=(""+f.getFullYear()).slice(2);break;case 122:K&&0===q?l+=H?"+00:00":"+0000":(z=0!==q?q/6E4:-f.getTimezoneOffset(),y=H?":":"",C=Math.abs(z%60),l+=(0>z?"-":"+")+b(Math.floor(Math.abs(z/60)))+y+b(C));break;default:y&&(l+="%"),l+=a[m]}z=null;y=!1}else 37===C?y=!0:l+=a[m]}return l}var t=n||k,q=l||0,K=z||!1,m=0,F,L=function(a,c){if(c){var b= +c.getTime();if(K){var d=6E4*(c.getTimezoneOffset()||0);c=new Date(b+d+q);6E4*(c.getTimezoneOffset()||0)!==d&&(c=6E4*(c.getTimezoneOffset()||0),c=new Date(b+c+q))}}else b=Date.now(),b>m?(m=b,F=new Date(m),b=m,K&&(F=new Date(m+6E4*(F.getTimezoneOffset()||0)+q))):b=m,c=F;return u(a,c,t,b)};L.localize=function(c){return new a(c||t,q,K)};L.localizeByIdentifier=function(a){var c=f[a];return c?L.localize(c):(g('[WARNING] No locale found with identifier "'+a+'".'),L)};L.timezone=function(c){var b=q,d=K,f= +typeof c;if("number"===f||"string"===f)d=!0,"string"===f?(b="-"===c[0]?-1:1,f=parseInt(c.slice(1,3),10),c=parseInt(c.slice(3,5),10),b=b*(60*f+c)*6E4):"number"===f&&(b=6E4*c);return new a(t,b,d)};L.utc=function(){return new a(t,q,!0)};return L}function b(a,c){if(""===c||9<a)return a;null==c&&(c="0");return c+a}function c(a){return 99<a?a:9<a?"0"+a:"00"+a}function d(a){return 0===a?12:12<a?a-12:a}function e(a,c){c=c||"sunday";var b=a.getDay();"monday"===c&&(0===b?b=6:b--);c=Date.UTC(a.getFullYear(), +0,1);a=Date.UTC(a.getFullYear(),a.getMonth(),a.getDate());return Math.floor((Math.floor((a-c)/864E5)+7-b)/7)}function h(a){var c=a%10;a%=100;if(11<=a&&13>=a||0===c||4<=c)return"th";switch(c){case 1:return"st";case 2:return"nd";case 3:return"rd"}}function g(a){"undefined"!==typeof console&&"function"==typeof console.warn&&console.warn(a)}var f={de_DE:{days:"Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag".split(" "),shortDays:"So Mo Di Mi Do Fr Sa".split(" "),months:"Januar Februar M\u00e4rz April Mai Juni Juli August September Oktober November Dezember".split(" "), +shortMonths:"Jan Feb M\u00e4r Apr Mai Jun Jul Aug Sep Okt Nov Dez".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d.%m.%Y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},en_CA:{days:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),shortDays:"Sun Mon Tue Wed Thu Fri Sat".split(" "),months:"January February March April May June July August September October November December".split(" "),shortMonths:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "), +ordinalSuffixes:"st nd rd th th th th th th th th th th th th th th th th th st nd rd th th th th th th th st".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d/%m/%y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%r",x:"%D"}},en_US:{days:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),shortDays:"Sun Mon Tue Wed Thu Fri Sat".split(" "),months:"January February March April May June July August September October November December".split(" "), +shortMonths:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),ordinalSuffixes:"st nd rd th th th th th th th th th th th th th th th th th st nd rd th th th th th th th st".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%m/%d/%y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%r",x:"%D"}},es_MX:{days:"domingo lunes martes mi\u00e9rcoles jueves viernes s\u00e1bado".split(" "),shortDays:"dom lun mar mi\u00e9 jue vie s\u00e1b".split(" "), +months:"enero;febrero;marzo;abril;mayo;junio;julio;agosto;septiembre;octubre;noviembre; diciembre".split(";"),shortMonths:"ene feb mar abr may jun jul ago sep oct nov dic".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d/%m/%Y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},fr_FR:{days:"dimanche lundi mardi mercredi jeudi vendredi samedi".split(" "),shortDays:"dim. lun. mar. mer. jeu. ven. sam.".split(" "),months:"janvier f\u00e9vrier mars avril mai juin juillet ao\u00fbt septembre octobre novembre d\u00e9cembre".split(" "), +shortMonths:"janv. f\u00e9vr. mars avril mai juin juil. ao\u00fbt sept. oct. nov. d\u00e9c.".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d/%m/%Y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},it_IT:{days:"domenica luned\u00ec marted\u00ec mercoled\u00ec gioved\u00ec venerd\u00ec sabato".split(" "),shortDays:"dom lun mar mer gio ven sab".split(" "),months:"gennaio febbraio marzo aprile maggio giugno luglio agosto settembre ottobre novembre dicembre".split(" "), +shortMonths:"pr mag giu lug ago set ott nov dic".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d/%m/%Y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},nl_NL:{days:"zondag maandag dinsdag woensdag donderdag vrijdag zaterdag".split(" "),shortDays:"zo ma di wo do vr za".split(" "),months:"januari februari maart april mei juni juli augustus september oktober november december".split(" "),shortMonths:"jan feb mrt apr mei jun jul aug sep okt nov dec".split(" "), +AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d-%m-%y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},pt_BR:{days:"domingo segunda ter\u00e7a quarta quinta sexta s\u00e1bado".split(" "),shortDays:"Dom Seg Ter Qua Qui Sex S\u00e1b".split(" "),months:"janeiro fevereiro mar\u00e7o abril maio junho julho agosto setembro outubro novembro dezembro".split(" "),shortMonths:"Jan Fev Mar Abr Mai Jun Jul Ago Set Out Nov Dez".split(" "),AM:"AM",PM:"PM",am:"am", +pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d-%m-%Y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},ru_RU:{days:"\u0412\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435 \u041f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a \u0412\u0442\u043e\u0440\u043d\u0438\u043a \u0421\u0440\u0435\u0434\u0430 \u0427\u0435\u0442\u0432\u0435\u0440\u0433 \u041f\u044f\u0442\u043d\u0438\u0446\u0430 \u0421\u0443\u0431\u0431\u043e\u0442\u0430".split(" "),shortDays:"\u0412\u0441 \u041f\u043d \u0412\u0442 \u0421\u0440 \u0427\u0442 \u041f\u0442 \u0421\u0431".split(" "), +months:"\u042f\u043d\u0432\u0430\u0440\u044c \u0424\u0435\u0432\u0440\u0430\u043b\u044c \u041c\u0430\u0440\u0442 \u0410\u043f\u0440\u0435\u043b\u044c \u041c\u0430\u0439 \u0418\u044e\u043d\u044c \u0418\u044e\u043b\u044c \u0410\u0432\u0433\u0443\u0441\u0442 \u0421\u0435\u043d\u0442\u044f\u0431\u0440\u044c \u041e\u043a\u0442\u044f\u0431\u0440\u044c \u041d\u043e\u044f\u0431\u0440\u044c \u0414\u0435\u043a\u0430\u0431\u0440\u044c".split(" "),shortMonths:"\u044f\u043d\u0432 \u0444\u0435\u0432 \u043c\u0430\u0440 \u0430\u043f\u0440 \u043c\u0430\u0439 \u0438\u044e\u043d \u0438\u044e\u043b \u0430\u0432\u0433 \u0441\u0435\u043d \u043e\u043a\u0442 \u043d\u043e\u044f \u0434\u0435\u043a".split(" "), +AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X",D:"%d.%m.%y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},tr_TR:{days:"Pazar Pazartesi Sal\u0131 \u00c7ar\u015famba Per\u015fembe Cuma Cumartesi".split(" "),shortDays:"Paz Pzt Sal \u00c7r\u015f Pr\u015f Cum Cts".split(" "),months:"Ocak \u015eubat Mart Nisan May\u0131s Haziran Temmuz A\u011fustos Eyl\u00fcl Ekim Kas\u0131m Aral\u0131k".split(" "),shortMonths:"Oca \u015eub Mar Nis May Haz Tem A\u011fu Eyl Eki Kas Ara".split(" "), +AM:"\u00d6\u00d6",PM:"\u00d6S",am:"\u00d6\u00d6",pm:"\u00d6S",formats:{c:"%a %d %b %Y %X %Z",D:"%d-%m-%Y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},zh_CN:{days:"\u661f\u671f\u65e5 \u661f\u671f\u4e00 \u661f\u671f\u4e8c \u661f\u671f\u4e09 \u661f\u671f\u56db \u661f\u671f\u4e94 \u661f\u671f\u516d".split(" "),shortDays:"\u65e5\u4e00\u4e8c\u4e09\u56db\u4e94\u516d".split(""),months:"\u4e00\u6708\u4efd \u4e8c\u6708\u4efd \u4e09\u6708\u4efd \u56db\u6708\u4efd \u4e94\u6708\u4efd \u516d\u6708\u4efd \u4e03\u6708\u4efd \u516b\u6708\u4efd \u4e5d\u6708\u4efd \u5341\u6708\u4efd \u5341\u4e00\u6708\u4efd \u5341\u4e8c\u6708\u4efd".split(" "), +shortMonths:"\u4e00\u6708 \u4e8c\u6708 \u4e09\u6708 \u56db\u6708 \u4e94\u6708 \u516d\u6708 \u4e03\u6708 \u516b\u6708 \u4e5d\u6708 \u5341\u6708 \u5341\u4e00\u6708 \u5341\u4e8c\u6708".split(" "),AM:"\u4e0a\u5348",PM:"\u4e0b\u5348",am:"\u4e0a\u5348",pm:"\u4e0b\u5348",formats:{c:"%a %d %b %Y %X %Z",D:"%d/%m/%y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%r",x:"%D"}}},k=f.en_US,n=new a(k,0,!1);if("undefined"!==typeof m)var l=m.exports=n;else l=function(){return this||(0,eval)("this")}(), +l.strftime=n;"function"!==typeof Date.now&&(Date.now=function(){return+new Date})})()},function(m,p,a){(function(){var a=function(c,b,e){return a.parse(c,b,e)};a.version="0.0.1";(m.exports=a).strptime=a;a.locale={a:"Sun Mon Tue Wed Thu Fri Sat".split(" "),A:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),b:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),B:"January February March April May June July August September October November December".split(" "),f:"Jan. Feb. Mar. Apr. May Jun. Jul. Aug. Sep. Oct. Nov. Dec.".split(" "), +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".split(" "),Bg:"January February March April May June July August September October November December".split(" "),fg:"Jan. Feb. Mar. Apr. May Jun. Jul. Aug. Sep. Oct. Nov. Dec.".split(" "),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"};(function(a){function c(a,b,d,e,g,h){b=String(b);d=String(d);b=b.replace(/^[#_0\^\-!~]+/,"");e=f[b];if(!e)return a;var k=!1;-1===d.indexOf("!")&&1===b.length&&(-1<d.indexOf("~")||-1<"bBf".indexOf(b)&&/%[0\-_]?d[\s]+$/.test(h.substr(0,g)))&&(k=!0);if(("I"===b||"l"===b)&&!/%[pP]/.test(h))throw Error("Undefined AM/PM");switch(typeof e){case "function":return e();case "string":return e;case "object":return c.make.push([e.make, +d,k]),"("+e.reg+")";default:return a}}function b(a,c){a=String(a);c=String(c);return-1!==c.indexOf("#")?a.substr(0,1).toUpperCase()+a.substr(1):-1!==c.indexOf("^")?a.substr(0,1)+a.substr(1).toLowerCase():a}var h=Array.prototype.indexOf||function(a){for(var c=this.length,b=0;b<c;){if(a==this[b])return b;b++}return-1},g=a.locale,f={"%":"\\%",a:"\\S+",A:"\\S+",b:{reg:"\\S+",make:function(a,c,d,f){c=h.call(f?g.bg:g.b,b(c,d));if(-1===c)return!1;a.setUTCMonth(c);return!0}},h:{reg:"\\S+",make:function(a, +c,d,f){c=h.call(f?g.bg:g.b,b(c,d));if(-1===c)return!1;a.setUTCMonth(c);return!0}},B:{reg:"\\S+",make:function(a,c,d,f){c=h.call(f?g.Bg:g.B,b(c,d));if(-1===c)return!1;a.setUTCMonth(c);return!0}},f:{reg:"\\S+",make:function(a,c,d,f){c=h.call(f?g.fg:g.f,b(c,d));if(-1===c)return!1;a.setUTCMonth(c);return!0}},g:{reg:"[\\d\\s]?\\d",make:function(a,c){c=parseInt(c,10);if(0>c||99<c)return!1;c+=100*parseInt((new Date).getUTCFullYear()/100,10);a.setUTCFullYear(c);return!0}},G:{reg:"\\d{4}",make:function(a, +c){c=parseInt(c,10);a.setUTCFullYear(c);return!0}},d:{reg:"[\\d\\s]?\\d",make:function(a,c){c=parseInt(c,10);if(1>c||31<c)return!1;a.setUTCDate(c);return!0}},e:{reg:"[\\d\\s]?\\d",make:function(a,c){c=parseInt(c,10);if(1>c||31<c)return!1;a.setUTCDate(c);return!0}},H:{reg:"[\\d\\s]?\\d",make:function(a,c){c=parseInt(c,10);if(0>c||23<c)return!1;a.setUTCHours(c);return!0}},I:{reg:"[\\d\\s]?\\d",make:function(a,c){c=parseInt(c,10);if(1>c||12<c)return!1;a.setUTCHours(a.getUTCHours()+c);return!0}},m:{reg:"[\\d\\s]?\\d", +make:function(a,c){c=parseInt(c,10);if(1>c||12<c)return!1;a.setUTCMonth(c-1);return!0}},M:{reg:"[\\d\\s]?\\d",make:function(a,c){c=parseInt(c,10);if(0>c||59<c)return!1;a.setUTCMinutes(c);return!0}},n:"\\n",p:{reg:"\\S+",make:function(a,c){c=h.call(g.P,c.toLowerCase());if(-1===c)return!1;1===c&&a.setUTCHours(a.getUTCHours()+12);return!0}},P:{reg:"\\S+",make:function(a,c){c=h.call(g.P,c.toLowerCase());if(-1===c)return!1;1===c&&a.setUTCHours(a.getUTCHours()+12);return!0}},S:{reg:"[\\d\\s]?\\d",make:function(a, +c){c=parseInt(c,10);if(0>c||60<c)return!1;a.setUTCSeconds(c);return!0}},t:"\\t",u:"\\d",U:"[\\d\\s]?\\d",w:"\\d",W:"[\\d\\s]?\\d",y:{reg:"[\\d\\s]?\\d",make:function(a,c){c=parseInt(c,10);if(0>c||99<c)return!1;c+=100*parseInt((new Date).getUTCFullYear()/100,10);a.setUTCFullYear(c);return!0}},Y:{reg:"\\d{4}",make:function(a,c){c=parseInt(c,10);a.setUTCFullYear(c);return!0}},z:{reg:"[+\\-]\\d{4}",make:function(a,c){c=c.match(/^([+\-])(\d{2})(\d{2})$/);if(!c)return!1;var b=6E4*(60*parseInt(c[2],10)+ +parseInt(c[3],10));"+"===c[1]&&(b=-b);a.setTime(a.getTime()+b);return!0}},l:{reg:"[\\d\\s]?\\d",make:function(a,c){c=parseInt(c,10);if(1>c||12<c)return!1;a.setUTCHours(a.getUTCHours()+c);return!0}},s:{reg:"\\d+",make:function(a,c){c=parseInt(c,10);a.setTime(1E3*c);return!0}},c:g.c,r:g.r,R:"%H:%M",T:"%H:%M:%S",x:g.x,X:g.X,D:"%m/%d/%y",F:"%Y-%m-%d",Date_iso:"%Y-%m-%dT%H:%M:%S",Date_dBY_year_in_HM:g.Date_dBY_year_in_HM,Date_dBY_year:g.Date_dBY_year,Date_dBY:g.Date_dBY,Date_dBA:g.Date_dBA,Date_AdBY:g.Date_AdBY, +Date_df_in_HM:g.Date_df_in_HM,Date_dfY:g.Date_dfY,Date_dB_in_HM:g.Date_dB_in_HM,Date_dmY__dot:"%d.%m.%Y",Date_df:g.Date_df,Date_FT:"%F %T",Date_dmY__minus:"%d-%m-%Y"};a.parse=function(a,b,d){a=String(a);b=String(b);for(var f=5;/%(Date_[a-zA-Z0-9_]+|[cDFrRTxX])/g.test(b)&&f;)b=b.replace(/%(Date_[a-zA-Z0-9_]+|[cDFrRTxX])/,c),f--;c.make=[];b=b.replace(/%(([#\^!~]{0,2})[aAbBfh]|([0\-_]?)[degHImMSVWyl]|[GnpPtuUwYzZs%])/g,c);a=a.match(new RegExp(b));if(!a||!c.make.length)return null;b=new Date(Date.UTC(0, +0));f=0;for(var e=c.make.length;f<e;f++){var g=c.make[f];if(!g[0](b,a[f+1],g[1],g[2]))return null}d&&b.setTime(b.getTime()+6E4*b.getTimezoneOffset());return b}})(a)})()},function(m,p,a){(function(a,c){(function(a,b){function d(a){delete y[a]}function e(a){if(t)setTimeout(e,0,a);else{var c=y[a];if(c){t=!0;try{var f=c.callback,g=c.args;switch(g.length){case 0:f();break;case 1:f(g[0]);break;case 2:f(g[0],g[1]);break;case 3:f(g[0],g[1],g[2]);break;default:f.apply(b,g)}}finally{d(a),t=!1}}}}function f(){m= +function(a){c.nextTick(function(){e(a)})}}function k(){if(a.postMessage&&!a.importScripts){var c=!0,b=a.onmessage;a.onmessage=function(){c=!1};a.postMessage("","*");a.onmessage=b;return c}}function n(){var c="setImmediate$"+Math.random()+"$",b=function(b){b.source===a&&"string"===typeof b.data&&0===b.data.indexOf(c)&&e(+b.data.slice(c.length))};a.addEventListener?a.addEventListener("message",b,!1):a.attachEvent("onmessage",b);m=function(b){a.postMessage(c+b,"*")}}function l(){var a=new MessageChannel; +a.port1.onmessage=function(a){e(a.data)};m=function(c){a.port2.postMessage(c)}}function q(){var a=H.documentElement;m=function(c){var b=H.createElement("script");b.onreadystatechange=function(){e(c);b.onreadystatechange=null;a.removeChild(b);b=null};a.appendChild(b)}}function u(){m=function(a){setTimeout(e,0,a)}}if(!a.setImmediate){var z=1,y={},t=!1,H=a.document,m,C=Object.getPrototypeOf&&Object.getPrototypeOf(a);C=C&&C.setTimeout?C:a;"[object process]"==={}.toString.call(a.process)?f():k()?n():a.MessageChannel? +l():H&&"onreadystatechange"in H.createElement("script")?q():u();C.setImmediate=function(a){"function"!==typeof a&&(a=new Function(""+a));for(var c=Array(arguments.length-1),b=0;b<c.length;b++)c[b]=arguments[b+1];y[z]={callback:a,args:c};m(z);return z++};C.clearImmediate=d}})("undefined"===typeof self?"undefined"===typeof a?this:a:self)}).call(this,a(0),a(6))},function(m,p){function a(){throw Error("setTimeout has not been defined");}function b(){throw Error("clearTimeout has not been defined");}function c(c){if(k=== +setTimeout)return setTimeout(c,0);if((k===a||!k)&&setTimeout)return k=setTimeout,setTimeout(c,0);try{return k(c,0)}catch(t){try{return k.call(null,c,0)}catch(H){return k.call(this,c,0)}}}function d(a){if(n===clearTimeout)return clearTimeout(a);if((n===b||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(a);try{return n(a)}catch(t){try{return n.call(null,a)}catch(H){return n.call(this,a)}}}function e(){q&&u&&(q=!1,u.length?l=u.concat(l):z=-1,l.length&&h())}function h(){if(!q){var a=c(e);q=!0;for(var b= +l.length;b;){u=l;for(l=[];++z<b;)u&&u[z].run();z=-1;b=l.length}u=null;q=!1;d(a)}}function g(a,c){this.fun=a;this.array=c}function f(){}m=m.exports={};try{var k="function"===typeof setTimeout?setTimeout:a}catch(y){k=a}try{var n="function"===typeof clearTimeout?clearTimeout:b}catch(y){n=b}var l=[],q=!1,u,z=-1;m.nextTick=function(a){var b=Array(arguments.length-1);if(1<arguments.length)for(var d=1;d<arguments.length;d++)b[d-1]=arguments[d];l.push(new g(a,b));1!==l.length||q||c(h)};g.prototype.run=function(){this.fun.apply(null, +this.array)};m.title="browser";m.browser=!0;m.env={};m.argv=[];m.version="";m.versions={};m.on=f;m.addListener=f;m.once=f;m.off=f;m.removeListener=f;m.removeAllListeners=f;m.emit=f;m.prependListener=f;m.prependOnceListener=f;m.listeners=function(a){return[]};m.binding=function(a){throw Error("process.binding is not supported");};m.cwd=function(){return"/"};m.chdir=function(a){throw Error("process.chdir is not supported");};m.umask=function(){return 0}},function(m,p){Sk.asserts={};Sk.asserts.assert= +function(a,b){return a};Sk.exportSymbol("Sk.asserts.assert",Sk.asserts.assert);Sk.asserts.fail=function(a){};Sk.exportSymbol("Sk.asserts.fail",Sk.asserts.fail)},function(m,p){Sk.bool_check=function(a,b){if(void 0===a||null===a||"boolean"!==typeof a)throw Error("must specify "+b+" and it must be a boolean");};Sk.python2={print_function:!1,division:!1,absolute_import:null,unicode_literals:!1,python3:!1,class_repr:!1,inherit_from_object:!1,super_args:!1,octal_number_literal:!1,bankers_rounding:!1,python_version:!1, +dunder_round:!1,exceptions:!1,no_long_type:!1,ceil_floor_int:!1,silent_octal_literal:!0};Sk.python3={print_function:!0,division:!0,absolute_import:null,unicode_literals:!0,python3:!0,class_repr:!0,inherit_from_object:!0,super_args:!0,octal_number_literal:!0,bankers_rounding:!0,python_version:!0,dunder_round:!0,exceptions:!0,no_long_type:!0,ceil_floor_int:!0,silent_octal_literal:!1};Sk.configure=function(a){Sk.output=a.output||Sk.output;Sk.asserts.assert("function"===typeof Sk.output);Sk.debugout= +a.debugout||Sk.debugout;Sk.asserts.assert("function"===typeof Sk.debugout);Sk.uncaughtException=a.uncaughtException||Sk.uncaughtException;Sk.asserts.assert("function"===typeof Sk.uncaughtException);Sk.read=a.read||Sk.read;Sk.asserts.assert("function"===typeof Sk.read);Sk.nonreadopen=a.nonreadopen||!1;Sk.asserts.assert("boolean"===typeof Sk.nonreadopen);Sk.fileopen=a.fileopen||void 0;Sk.asserts.assert("function"===typeof Sk.fileopen||"undefined"===typeof Sk.fileopen);Sk.filewrite=a.filewrite||void 0; +Sk.asserts.assert("function"===typeof Sk.filewrite||"undefined"===typeof Sk.filewrite);Sk.timeoutMsg=a.timeoutMsg||Sk.timeoutMsg;Sk.asserts.assert("function"===typeof Sk.timeoutMsg);Sk.exportSymbol("Sk.timeoutMsg",Sk.timeoutMsg);Sk.sysargv=a.sysargv||Sk.sysargv;Sk.asserts.assert(Sk.isArrayLike(Sk.sysargv));Sk.__future__=a.__future__||Sk.python2;Sk.bool_check(Sk.__future__.print_function,"Sk.__future__.print_function");Sk.bool_check(Sk.__future__.division,"Sk.__future__.division");Sk.bool_check(Sk.__future__.unicode_literals, +"Sk.__future__.unicode_literals");Sk.bool_check(Sk.__future__.class_repr,"Sk.__future__.class_repr");Sk.bool_check(Sk.__future__.inherit_from_object,"Sk.__future__.inherit_from_object");Sk.bool_check(Sk.__future__.super_args,"Sk.__future__.super_args");Sk.bool_check(Sk.__future__.octal_number_literal,"Sk.__future__.octal_number_literal");Sk.bool_check(Sk.__future__.bankers_rounding,"Sk.__future__.bankers_rounding");Sk.bool_check(Sk.__future__.python_version,"Sk.__future__.python_version");Sk.bool_check(Sk.__future__.dunder_round, +"Sk.__future__.dunder_round");Sk.bool_check(Sk.__future__.exceptions,"Sk.__future__.exceptions");Sk.bool_check(Sk.__future__.no_long_type,"Sk.__future__.no_long_type");Sk.bool_check(Sk.__future__.ceil_floor_int,"Sk.__future__.ceil_floor_int");Sk.bool_check(Sk.__future__.silent_octal_literal,"Sk.__future__.silent_octal_literal");Sk.imageProxy=a.imageProxy||"http://localhost:8080/320x";Sk.asserts.assert("string"===typeof Sk.imageProxy||"function"===typeof Sk.imageProxy);Sk.inputfun=a.inputfun||Sk.inputfun; +Sk.asserts.assert("function"===typeof Sk.inputfun);Sk.inputfunTakesPrompt=a.inputfunTakesPrompt||!1;Sk.asserts.assert("boolean"===typeof Sk.inputfunTakesPrompt);Sk.retainGlobals=a.retainglobals||a.retainGlobals||!1;Sk.asserts.assert("boolean"===typeof Sk.retainGlobals);Sk.debugging=a.debugging||!1;Sk.asserts.assert("boolean"===typeof Sk.debugging);Sk.killableWhile=a.killableWhile||!1;Sk.asserts.assert("boolean"===typeof Sk.killableWhile);Sk.killableFor=a.killableFor||!1;Sk.asserts.assert("boolean"=== +typeof Sk.killableFor);Sk.signals=a.signals;Sk.signals=!0===Sk.signals?{listeners:[],addEventListener:function(a){Sk.signals.listeners.push(a)},removeEventListener:function(a){a=Sk.signals.listeners.indexOf(a);0<=a&&Sk.signals.listeners.splice(a,1)},signal:function(a,c){for(var b=0;b<Sk.signals.listeners.length;b++)Sk.signals.listeners[b].call(null,a,c)}}:null;Sk.asserts.assert("object"===typeof Sk.signals);Sk.breakpoints=a.breakpoints||function(){return!0};Sk.asserts.assert("function"===typeof Sk.breakpoints); +Sk.setTimeout=a.setTimeout;void 0===Sk.setTimeout&&(Sk.setTimeout="function"===typeof setTimeout?function(a,c){setTimeout(a,c)}:function(a,c){a()});Sk.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,Sk.asserts.assert(Sk.isArrayLike(Sk.syspath)),Sk.realsyspath=void 0,Sk.sysmodules=new Sk.builtin.dict([]));Sk.misceval.softspace_=!1;Sk.switch_version("round$",Sk.__future__.dunder_round); +Sk.switch_version("next$",Sk.__future__.python3);Sk.switch_version("haskey$",Sk.__future__.python3);Sk.switch_version("clear$",Sk.__future__.python3);Sk.switch_version("copy$",Sk.__future__.python3);Sk.builtin.lng.prototype.tp$name=Sk.__future__.no_long_type?"int":"long";Sk.builtin.lng.prototype.ob$type=Sk.__future__.no_long_type?Sk.builtin.int_:Sk.builtin.lng;Sk.builtin.str.$next=Sk.__future__.python3?new Sk.builtin.str("__next__"):new Sk.builtin.str("next");Sk.setupOperators(Sk.__future__.python3); +Sk.setupDunderMethods(Sk.__future__.python3);Sk.__future__.python3?(Sk.builtin.dict.prototype.keys=new Sk.builtin.func(Sk.builtin.dict.prototype.py3$keys),Sk.builtin.dict.prototype.values=new Sk.builtin.func(Sk.builtin.dict.prototype.py3$values),Sk.builtin.dict.prototype.items=new Sk.builtin.func(Sk.builtin.dict.prototype.py3$items)):(Sk.builtin.dict.prototype.keys=new Sk.builtin.func(Sk.builtin.dict.prototype.py2$keys),Sk.builtin.dict.prototype.values=new Sk.builtin.func(Sk.builtin.dict.prototype.py2$values), +Sk.builtin.dict.prototype.items=new Sk.builtin.func(Sk.builtin.dict.prototype.py2$items));Sk.setupObjects(Sk.__future__.python3)};Sk.exportSymbol("Sk.configure",Sk.configure);Sk.uncaughtException=function(a){throw a;};Sk.uncaughtException=function(a){throw a;};Sk.exportSymbol("Sk.uncaughtException",Sk.uncaughtException);Sk.timeoutMsg=function(){return"Program exceeded run time limit."};Sk.exportSymbol("Sk.timeoutMsg",Sk.timeoutMsg);Sk.execLimit=Number.POSITIVE_INFINITY;Sk.yieldLimit=Number.POSITIVE_INFINITY; +Sk.output=function(a){};Sk.read=function(a){if(void 0===Sk.builtinFiles)throw"skulpt-stdlib.js has not been loaded";if(void 0===Sk.builtinFiles.files[a])throw"File not found: '"+a+"'";return Sk.builtinFiles.files[a]};Sk.sysargv=[];Sk.getSysArgv=function(){return Sk.sysargv};Sk.exportSymbol("Sk.getSysArgv",Sk.getSysArgv);Sk.syspath=[];Sk.inBrowser=void 0!==Sk.global.document;Sk.debugout=function(a){};(function(){void 0!==Sk.global.write?Sk.output=Sk.global.write:void 0!==Sk.global.console&&void 0!== +Sk.global.console.log?Sk.output=function(a){Sk.global.console.log(a)}:void 0!==Sk.global.print&&(Sk.output=Sk.global.print);void 0!==Sk.global.console&&void 0!==Sk.global.console.log?Sk.debugout=function(a){Sk.global.console.log(a)}:void 0!==Sk.global.print&&(Sk.debugout=Sk.global.print)})();Sk.inputfun=function(a){return window.prompt(a)};Sk.setup_method_mappings=function(){return{round$:{classes:[Sk.builtin.float_,Sk.builtin.int_,Sk.builtin.nmber],2:null,3:"__round__"},clear$:{classes:[Sk.builtin.list], +2:null,3:"clear"},copy$:{classes:[Sk.builtin.list],2:null,3:"copy"},next$:{classes:[Sk.builtin.dict_iter_,Sk.builtin.list_iter_,Sk.builtin.set_iter_,Sk.builtin.str_iter_,Sk.builtin.tuple_iter_,Sk.builtin.generator,Sk.builtin.enumerate,Sk.builtin.filter_,Sk.builtin.zip_,Sk.builtin.map_,Sk.builtin.iterator],2:"next",3:"__next__"},haskey$:{classes:[Sk.builtin.dict],2:"has_key",3:null}}};Sk.switch_version=function(a,b){var c;var d=Sk.setup_method_mappings()[a];if(b){b=d[3];var e=d[2]}else b=d[2],e=d[3]; +var h=d.classes;var g=h.length;for(c=0;c<g;c++)d=h[c],e&&d.prototype.hasOwnProperty(e)&&delete d.prototype[e],b&&(d.prototype[b]=new Sk.builtin.func(d.prototype[a]))};Sk.exportSymbol("Sk.__future__",Sk.__future__);Sk.exportSymbol("Sk.inputfun",Sk.inputfun)},function(m,p){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",__invert__:"nb$invert",__mod__:"nb$remainder",__rmod__:"nb$reflected_remainder",__divmod__:"nb$divmod",__rdivmod__:"nb$reflected_divmod",__pow__:"nb$power",__rpow__:"nb$reflected_power", +__contains__:"sq$contains",__iter__:"tp$iter",__bool__:["nb$bool",1],__nonzero__:["nb$nonzero",1],__len__:["sq$length",1],__get__:["tp$descr_get",3],__set__:["tp$descr_set",3]};Sk.setupDunderMethods=function(a){a?(Sk.dunderToSkulpt.__matmul__="tp$matmul",Sk.dunderToSkulpt.__rmatmul__="tp$reflected_matmul"):(Sk.dunderToSkulpt.__matmul__&&delete Sk.dunderToSkulpt.__matmul__,Sk.dunderToSkulpt.__rmatmul__&&delete Sk.dunderToSkulpt.__rmatmul__)};Sk.exportSymbol("Sk.setupDunderMethods",Sk.setupDunderMethods); +Sk.builtin.type=function(a,b,c){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));var d=function(a,c){void 0!==d.prototype.tp$base&&(d.prototype.tp$base.sk$klass? +d.prototype.tp$base.call(this,a,c):(a=a.slice(),a.unshift(d,this),Sk.abstr.superConstructor.apply(void 0,a)));this.$d=new Sk.builtin.dict([])};var e=Sk.ffi.remapToJs(a);var h=!1;d.tp$call=function(a,c){var b=Sk.builtin.type.typeLookup(d,Sk.builtin.str.$new);a=a||[];c=c||[];if(void 0===b||b===Sk.builtin.object.prototype.__new__){var f=new d(a,c);b=void 0}else{var e=a.slice();e.unshift(d);f=Sk.misceval.applyOrSuspend(b,void 0,void 0,c,e)}return Sk.misceval.chain(f,function(d){var e=Sk.builtin.type.typeLookup(d.ob$type, +Sk.builtin.str.$init);f=d;if(void 0!==e)return a.unshift(f),Sk.misceval.applyOrSuspend(e,void 0,void 0,c,a);if(void 0===b&&(0!==a.length||0!==c.length)&&!h)throw new Sk.builtin.TypeError("__init__() got unexpected argument(s)");},function(a){if(a!==Sk.builtin.none.none$&&void 0!==a)throw new Sk.builtin.TypeError("__init__() should return None, not "+Sk.abstr.typeName(a));return f})};0===b.v.length&&Sk.__future__.inherit_from_object&&(b.v.push(Sk.builtin.object),Sk.abstr.setUpInheritance(e,d,Sk.builtin.object)); +var g,f,k=[];var n=b.tp$iter();for(g=n.tp$iternext();void 0!==g;g=n.tp$iternext()){for(void 0===f&&(f=g);g.sk$klass&&g.prototype.tp$base;)g=g.prototype.tp$base;!g.sk$klass&&0>k.indexOf(g)&&(k.push(g),h=!0)}if(1<k.length)throw new Sk.builtin.TypeError("Multiple inheritance with more than one builtin type is unsupported");void 0!==f&&(Sk.abstr.inherits(d,f),f.prototype instanceof Sk.builtin.object||f===Sk.builtin.object)&&(d.prototype.tp$base=f);d.prototype.tp$name=e;d.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj(e, +d);void 0===c.mp$lookup(Sk.builtin.str.$module)&&c.mp$ass_subscript(Sk.builtin.str.$module,Sk.globals.__name__);n=c.tp$iter();for(g=n.tp$iternext();void 0!==g;g=n.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.hp$type=!0;d.prototype.$r=function(){const a=Sk.abstr.lookupSpecial(this,Sk.builtin.str.$repr);return void 0!==a&&a!==Sk.builtin.object.prototype.__repr__?Sk.misceval.callsimArray(a,[this]):void 0!==d.prototype.tp$base&& +void 0!==d.prototype.tp$base.prototype.$r?d.prototype.tp$base.prototype.$r.call(this):Sk.builtin.object.prototype.$r.call(this)};d.prototype.tp$setattr=function(a,c,b){var d=Sk.builtin.object.prototype.GenericGetAttr.call(this,Sk.builtin.str.$setattr);return void 0!==d?(a=Sk.misceval.callsimOrSuspendArray(d,[a,c]),b?a:Sk.misceval.retryOptionalSuspensionOrThrow(a)):Sk.builtin.object.prototype.GenericSetAttr.call(this,a,c,b)};d.prototype.tp$str=function(){const a=Sk.abstr.lookupSpecial(this,Sk.builtin.str.$str); +return void 0!==a&&a!==Sk.builtin.object.prototype.__str__?Sk.misceval.callsimArray(a,[this]):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(a){var c=Sk.misceval.chain(Sk.abstr.gattr(this,Sk.builtin.str.$len,a),function(a){return Sk.misceval.applyOrSuspend(a,void 0,void 0,void 0,[])});return a?c:Sk.misceval.retryOptionalSuspensionOrThrow(c)}; +d.prototype.tp$call=function(a,c){return Sk.misceval.chain(this.tp$getattr(Sk.builtin.str.$call,!0),function(b){if(void 0===b)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(this)+"' object is not callable");return Sk.misceval.applyOrSuspend(b,void 0,void 0,c,a)})};const q=c.mp$lookup(Sk.builtin.str.$next);void 0!==q&&(d.prototype.tp$iternext=function(a){const c=this,b=Sk.misceval.tryCatch(()=>Sk.misceval.callsimOrSuspendArray(q,[c]),a=>{if(!(a instanceof Sk.builtin.StopIteration))throw a;}); +return a?b:Sk.misceval.retryOptionalSuspensionOrThrow(b)});d.prototype.tp$getitem=function(a,c){var b=this.tp$getattr(Sk.builtin.str.$getitem,c);if(void 0!==b)return a=Sk.misceval.applyOrSuspend(b,void 0,void 0,void 0,[a]),c?a:Sk.misceval.retryOptionalSuspensionOrThrow(a);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(this)+"' object does not support indexing");};d.prototype.tp$setitem=function(a,c,b){var d=this.tp$getattr(Sk.builtin.str.$setitem,b);if(void 0!==d)return a=Sk.misceval.applyOrSuspend(d, +void 0,void 0,void 0,[a,c]),b?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;for(var l in Sk.dunderToSkulpt)d.hasOwnProperty(l)&&Sk.builtin.type.$allocateSlot(d,l);let u= +Sk.builtin.type.typeLookup(d,Sk.builtin.str.$getattribute);void 0!==u&&u!==Sk.builtin.object.prototype.__getattribute__?d.prototype.tp$getattr=function(a,c){let b=Sk.misceval.tryCatch(()=>Sk.misceval.callsimOrSuspendArray(u,[this,a]),function(a){if(!(a instanceof Sk.builtin.AttributeError))throw a;});return c?b:Sk.misceval.retryOptionalSuspensionOrThrow(b)}:d.prototype.tp$getattr||(d.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr);return d}};Object.defineProperties(Sk.builtin.type.prototype, +{call:{value:Function.prototype.call},apply:{value:Function.prototype.apply},ob$type:{value:Sk.builtin.type,writable:!0},tp$name:{value:"type",writable:!0},tp$base:{value:Sk.builtin.object,writable:!0},sk$type:{value:!0}});Sk.builtin.type.makeTypeObj=function(a,b){Sk.builtin.type.makeIntoTypeObj(a,b);return b};Sk.builtin.type.makeIntoTypeObj=function(a,b){Sk.asserts.assert(void 0!==a);Sk.asserts.assert(void 0!==b);Object.setPrototypeOf(b,Sk.builtin.type.prototype);return b};Sk.builtin.type.prototype.$r= +function(){let a=this.prototype.__module__,b="",c="class";a&&Sk.builtin.checkString(a)?b=a.v+".":a=null;a||this.sk$klass||Sk.__future__.class_repr||(c="type");return new Sk.builtin.str("<"+c+" '"+b+this.prototype.tp$name+"'>")};Sk.builtin.type.prototype.tp$getattr=function(a,b){if(this.$d){var c=this.$d.mp$lookup(a);if(void 0!==c)return c}a=Sk.builtin.type.typeLookup(this,a);if(void 0!==a&&null!==a&&void 0!==a.ob$type)var d=a.tp$descr_get;if(d)return d.call(a,Sk.builtin.none.none$,this,b);if(void 0!== +a)return a};Sk.builtin.type.prototype.tp$setattr=function(a,b){if(void 0===this.sk$klass)throw new Sk.builtin.TypeError("can't set attributes of built-in/extension type '"+this.prototype.tp$name+"'");a=Sk.fixReserved(a.$jsstr());this[a]=b;this.prototype[a]=b;a in Sk.dunderToSkulpt&&Sk.builtin.type.$allocateSlot(this,a)};Sk.builtin.type.typeLookup=function(a,b){var c=a.tp$mro,d,e=b.$mangled;if(c)for(d=0;d<c.v.length;++d){a=c.v[d];if(a.hasOwnProperty(e))return a[e];var h=a.$d.mp$lookup(b);if(void 0!== +h)return h;if(a.prototype&&void 0!==a.prototype[e])return a.prototype[e]}else if(a.prototype)return a.prototype[e]};Sk.builtin.type.mroMerge_=function(a){for(var b,c,d,e,h,g,f=[];;){for(c=0;c<a.length&&(b=a[c],0===b.length);++c);if(c===a.length)return f;d=[];for(c=0;c<a.length;++c)if(b=a[c],0!==b.length){g=b[0];h=0;a:for(;h<a.length;++h)for(e=a[h],b=1;b<e.length;++b)if(e[b]===g)break a;h===a.length&&d.push(g)}if(0===d.length)throw new Sk.builtin.TypeError("Inconsistent precedences in type hierarchy"); +d=d[0];f.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=[[a]],c=a.$d.mp$subscript(Sk.builtin.type.basesStr_);for(a=0;a<c.v.length;++a)b.push(Sk.builtin.type.buildMRO_(c.v[a]));var d=[];for(a=0;a<c.v.length;++a)d.push(c.v[a]);b.push(d);return Sk.builtin.type.mroMerge_(b)};Sk.builtin.type.buildMRO=function(a){return new Sk.builtin.tuple(Sk.builtin.type.buildMRO_(a))};Sk.builtin.type.prototype.__format__=function(a,b){Sk.builtin.pyCheckArgsLen("__format__", +arguments.length,1,2);return new Sk.builtin.str(a)};Sk.builtin.type.pythonFunctions=["__format__"];Sk.builtin.type.$allocateSlot=function(a,b){const c=a[b];b=Sk.dunderToSkulpt[b];if("string"===typeof b)a.prototype[b]=function(){let a,b,h;a=arguments.length;b=Array(a+1);b[0]=this;for(h=0;h<a;h++)b[h+1]=arguments[h];return Sk.misceval.callsimArray(c,b)};else{let d=b[1];b=b[0];a.prototype[b]=function(){let a,b,g,f,k=!1;a=arguments.length;b=d<=a?Array(a):Array(a+1);b[0]=this;f=1;for(g=0;g<a;g++)g===d- +1?k=arguments[g]:(b[f]=arguments[g],f+=1);return k?Sk.misceval.callsimOrSuspendArray(c,b):Sk.misceval.callsimArray(c,b)}}}},function(m,p){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){a=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("bad operand type for unary "+ +{UAdd:"+",USub:"-",Invert:"~"}[b]+": '"+a+"'");};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 "MatMult":if(Sk.__future__.python3)return a.tp$matmul?a.tp$matmul:a.__matmul__;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 "MatMult":if(Sk.__future__.python3)return a.tp$reflected_matmul?a.tp$reflected_matmul:a.__rmatmul__;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 "MatMult":if(Sk.__future__.python3)return a.tp$inplace_matmul?a.tp$inplace_matmul:a.__imatmul__;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=a.constructor;d=b.constructor!==d&&b instanceof d;if(d){var e=Sk.abstr.boNameToSlotFuncRhs_(b,c);if(void 0!==e&&(e=e.call?e.call(b,a):Sk.misceval.callsimArray(e,[b,a]),void 0!==e&&e!==Sk.builtin.NotImplemented.NotImplemented$))return e}e=Sk.abstr.boNameToSlotFuncLhs_(a,c);if(void 0!==e&&(e=e.call?e.call(a,b):Sk.misceval.callsimArray(e,[a,b]), +void 0!==e&&e!==Sk.builtin.NotImplemented.NotImplemented$)||!d&&(e=Sk.abstr.boNameToSlotFuncRhs_(b,c),void 0!==e&&(e=e.call?e.call(b,a):Sk.misceval.callsimArray(e,[b,a]),void 0!==e&&e!==Sk.builtin.NotImplemented.NotImplemented$)))return e;Sk.abstr.binop_type_error(a,b,c)};Sk.abstr.binary_iop_=function(a,b,c){var d=Sk.abstr.iboNameToSlotFunc_(a,c);return void 0!==d&&(d=d.call?d.call(a,b):Sk.misceval.callsimArray(d,[a,b]),void 0!==d&&d!==Sk.builtin.NotImplemented.NotImplemented$)?d:Sk.abstr.binary_op_(a, +b,c)};Sk.abstr.unary_op_=function(a,b){var c=Sk.abstr.uoNameToSlotFunc_(a,b);if(void 0!==c&&(c=c.call?c.call(a):Sk.misceval.callsimArray(c,[a]),void 0!==c))return c;Sk.abstr.unop_type_error(a,b)};Sk.abstr.numberBinOp=function(a,b,c){return Sk.abstr.binary_op_(a,b,c)};Sk.exportSymbol("Sk.abstr.numberBinOp",Sk.abstr.numberBinOp);Sk.abstr.numberInplaceBinOp=function(a,b,c){return Sk.abstr.binary_iop_(a,b,c)};Sk.exportSymbol("Sk.abstr.numberInplaceBinOp",Sk.abstr.numberInplaceBinOp);Sk.abstr.numberUnaryOp= +function(a,b){return"Not"===b?Sk.misceval.isTrue(a)?Sk.builtin.bool.false$:Sk.builtin.bool.true$:Sk.abstr.unary_op_(a,b)};Sk.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){if(a.sq$contains)return a.sq$contains(b);var d=Sk.abstr.lookupSpecial(a,Sk.builtin.str.$contains);if(null!=d)return Sk.misceval.isTrue(Sk.misceval.callsimArray(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){if(a.sq$concat)return a.sq$concat(b);a=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("'"+a+"' object can't be concatenated");};Sk.abstr.sequenceGetIndexOf= +function(a,b){if(a.index)return Sk.misceval.callsimArray(a.index,[a,b]);if(Sk.builtin.checkIterable(a)){var c=0;var d=Sk.abstr.iter(a);for(a=d.tp$iternext();void 0!==a;a=d.tp$iternext()){if(Sk.misceval.richCompareBool(b,a,"Eq"))return new Sk.builtin.int_(c);c+=1}throw new Sk.builtin.ValueError("sequence.index(x): x not in sequence");}b=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("argument of type '"+b+"' is not iterable");};Sk.abstr.sequenceGetCountOf=function(a,b){if(a.count)return Sk.misceval.callsimArray(a.count, +[a,b]);if(Sk.builtin.checkIterable(a)){var c=0;var d=Sk.abstr.iter(a);for(a=d.tp$iternext();void 0!==a;a=d.tp$iternext())Sk.misceval.richCompareBool(b,a,"Eq")&&(c+=1);return new Sk.builtin.int_(c)}b=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("argument of type '"+b+"' 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){if(a.sq$del_item)b=Sk.abstr.fixSeqIndex_(a,b),a.sq$del_item(b);else throw a=Sk.abstr.typeName(a),new Sk.builtin.TypeError("'"+a+"' 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,c,d){if(!Sk.builtin.checkIterable(a))throw new Sk.builtin.TypeError("cannot unpack non-iterable "+ +Sk.abstr.typeName(a)+" object");const e=Sk.abstr.iter(a),h=[];let g=0,f;0<b&&(f=Sk.misceval.iterFor(e,a=>{h.push(a);if(++g===b)return new Sk.misceval.Break}));return Sk.misceval.chain(f,()=>{if(h.length<b)throw new Sk.builtin.ValueError("not enough values to unpack (expected at least "+c+", got "+h.length+")");if(!d)return Sk.misceval.chain(e.tp$iternext(!0),a=>{if(void 0!==a)throw new Sk.builtin.ValueError("too many values to unpack (expected "+b+")");return h});const a=[];return Sk.misceval.chain(Sk.misceval.iterFor(e, +c=>{a.push(c)}),()=>{const d=a.length+b-c;if(0>d)throw new Sk.builtin.ValueError("not enough values to unpack (expected at least "+c+", got "+(c+d)+")");h.push(new Sk.builtin.list(a.slice(0,d)));h.push(...a.slice(d));return h})})};Sk.abstr.mappingUnpackIntoKeywordArray=function(a,b,c){return Sk.misceval.chain(b.tp$getattr(new Sk.builtin.str("items")),function(a){if(!a)throw new Sk.builtin.TypeError("Object is not a mapping");return Sk.misceval.callsimOrSuspend(a)},function(b){return Sk.misceval.iterFor(Sk.abstr.iter(b), +function(b){if(!b||!b.v)throw new Sk.builtin.TypeError("Object is not a mapping; items() does not return tuples");if(!(b.v[0]instanceof Sk.builtin.str))throw new Sk.builtin.TypeError((c.tp$name?c.tp$name+":":"")+"keywords must be strings");a.push(b.v[0].v,b.v[1])})})};Sk.abstr.objectFormat=function(a,b){var c=Sk.abstr.lookupSpecial(a,Sk.builtin.str.$format);if(null==c)return Sk.misceval.callsimArray(Sk.builtin.object.prototype.__format__,[a,b]);a=Sk.misceval.callsimArray(c,[a,b]);if(!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError("__format__ must return a str, not "+ +Sk.abstr.typeName(a));return a};Sk.abstr.objectAdd=function(a,b){if(a.nb$add)return a.nb$add(b);a=Sk.abstr.typeName(a);b=Sk.abstr.typeName(b);throw new Sk.builtin.TypeError("unsupported operand type(s) for +: '"+a+"' and '"+b+"'");};Sk.abstr.objectNegative=function(a){if(a.nb$negative)return a.nb$negative();throw new Sk.builtin.TypeError("bad operand type for unary -: '"+Sk.abstr.typeName(a)+"'");};Sk.abstr.objectPositive=function(a){if(a.nb$positive)return a.nb$positive();throw new Sk.builtin.TypeError("bad operand type for unary +: '"+ +Sk.abstr.typeName(a)+"'");};Sk.abstr.objectDelItem=function(a,b){if(null!==a){if(a.mp$del_subscript){a.mp$del_subscript(b);return}if(a.sq$ass_item){var c=Sk.misceval.asIndex(b);if(void 0===c)throw a=Sk.abstr.typeName(b),new Sk.builtin.TypeError("sequence index must be integer, not '"+a+"'");Sk.abstr.sequenceDelItem(a,c);return}}a=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("'"+a+"' object does not support item deletion");};Sk.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");};Sk.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");};Sk.exportSymbol("Sk.abstr.objectSetItem",Sk.abstr.objectSetItem);Sk.abstr.gattr=function(a,b,c){if(null===a||!a.tp$getattr)throw c=Sk.abstr.typeName(a),new Sk.builtin.AttributeError("'"+c+"' object has no attribute '"+b.$jsstr()+"'");c=a.tp$getattr(b,c);let d;if(void 0===c)throw d=a.sk$type?"type object '"+ +a.prototype.tp$name+"'":"'"+Sk.abstr.typeName(a)+"' object",new Sk.builtin.AttributeError(d+" has no attribute '"+b.$jsstr()+"'");return c.$isSuspension?Sk.misceval.chain(c,function(c){if(void 0===c)throw d=a.sk$type?"type object '"+a.prototype.tp$name+"'":"'"+Sk.abstr.typeName(a)+"' object",new Sk.builtin.AttributeError(d+" has no attribute '"+b.$jsstr()+"'");return c}):c};Sk.exportSymbol("Sk.abstr.gattr",Sk.abstr.gattr);Sk.abstr.sattr=function(a,b,c,d){var e=Sk.abstr.typeName(a);if(null===a)throw new Sk.builtin.AttributeError("'"+ +e+"' object has no attribute '"+b.$jsstr()+"'");if(void 0!==a.tp$setattr)return a.tp$setattr(b,c,d);throw new Sk.builtin.AttributeError("'"+e+"' object has no attribute '"+b.$jsstr()+"'");};Sk.exportSymbol("Sk.abstr.sattr",Sk.abstr.sattr);Sk.abstr.iternext=function(a,b){return a.tp$iternext(b)};Sk.exportSymbol("Sk.abstr.iternext",Sk.abstr.iternext);Sk.abstr.iter=function(a){var b=function(a){this.idx=0;this.myobj=a;this.getitem=Sk.abstr.lookupSpecial(a,Sk.builtin.str.$getitem);this.tp$iternext=function(){try{var a= +Sk.misceval.callsimArray(this.getitem,[this.myobj,Sk.ffi.remapToPy(this.idx)])}catch(e){if(e instanceof Sk.builtin.IndexError||e instanceof Sk.builtin.StopIteration)return;throw e;}this.idx++;return a}};if(a.tp$iter){if(b=a.tp$iter(),b.tp$iternext)return b}else if(Sk.abstr.lookupSpecial(a,Sk.builtin.str.$getitem))return new b(a);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not iterable");};Sk.exportSymbol("Sk.abstr.iter",Sk.abstr.iter);Sk.abstr.lookupSpecial=function(a,b){if(a.ob$type)a= +a.ob$type;else return null;return Sk.builtin.type.typeLookup(a,b)};Sk.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.inherits=function(a,b){function c(){}c.prototype=b.prototype;a.superClass_=b.prototype;a.prototype=new c;a.prototype.constructor=a};Sk.abstr.setUpInheritance=function(a,b,c){Sk.abstr.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)}},function(m,p){Sk.builtin.object=function(){return this instanceof Sk.builtin.object?this:new Sk.builtin.object};Object.defineProperties(Sk.builtin.object.prototype,{ob$type:{value:Sk.builtin.object,writable:!0},tp$name:{value:"object",writable:!0},tp$base:{value:void 0,writable:!0},sk$object:{value:!0}});Object.setPrototypeOf(Sk.builtin.type.prototype, +Sk.builtin.object.prototype);Object.setPrototypeOf(Sk.builtin.type,Sk.builtin.type.prototype);Object.setPrototypeOf(Sk.builtin.object,Sk.builtin.type.prototype);Sk.builtin.type.prototype.tp$base=Sk.builtin.object;Sk.builtin.object.prototype.__init__=function(){return Sk.builtin.none.none$};Sk.builtin.object.prototype.__init__.co_kwargs=1;Sk.builtin._tryGetSubscript=function(a,b){try{return a.mp$subscript(b)}catch(c){}};Sk.exportSymbol("Sk.builtin._tryGetSubscript",Sk.builtin._tryGetSubscript);Sk.builtin.object.prototype.GenericGetAttr= +function(a,b){var c,d;var e=this.ob$type;Sk.asserts.assert(void 0!==e,"object has no ob$type!");if(d=this.$d||this.constructor.$d){d.mp$lookup?c=d.mp$lookup(a):d.mp$subscript?c=Sk.builtin._tryGetSubscript(d,a):"object"===typeof d&&(c=d[a.$mangled]);if(void 0!==c)return c;if("__dict__"==a.$jsstr()&&d instanceof Sk.builtin.dict)return d}d=Sk.builtin.type.typeLookup(e,a);if(void 0!==d&&null!==d&&(c=d.tp$descr_get))return c.call(d,this,this.ob$type,b);if(void 0!==d)return d;d=Sk.builtin.type.typeLookup(e, +Sk.builtin.str.$getattr);if(void 0!==d&&null!==d){var h=(c=d.tp$descr_get)?c.call(d,this,this.ob$type):d;c=Sk.misceval.tryCatch(function(){return Sk.misceval.callsimOrSuspendArray(h,[a])},function(a){if(!(a instanceof Sk.builtin.AttributeError))throw a;});return b?c:Sk.misceval.retryOptionalSuspensionOrThrow(c)}};Sk.exportSymbol("Sk.builtin.object.prototype.GenericGetAttr",Sk.builtin.object.prototype.GenericGetAttr);Sk.builtin.object.prototype.GenericPythonGetAttr=function(a,b){a=Sk.builtin.object.prototype.GenericGetAttr.call(a, +b,!0);if(void 0===a)throw new Sk.builtin.AttributeError(b);return a};Sk.exportSymbol("Sk.builtin.object.prototype.GenericPythonGetAttr",Sk.builtin.object.prototype.GenericPythonGetAttr);Sk.builtin.object.prototype.GenericSetAttr=function(a,b,c){var d=Sk.abstr.typeName(this),e=a.$jsstr(),h=this.ob$type;Sk.asserts.assert(void 0!==h,"object has no ob$type!");var g=this.$d||this.constructor.$d;if("__class__"==e){if(void 0===b.tp$mro||void 0===b.sk$klass)throw new Sk.builtin.TypeError("attempted to assign non-class to __class__"); +this.ob$type=b}else{e=Sk.builtin.type.typeLookup(h,a);if(void 0!==e&&null!==e&&(h=e.tp$descr_set))return h.call(e,this,b,c);if(g.mp$ass_subscript){if(this instanceof Sk.builtin.object&&!this.ob$type.sk$klass&&void 0===g.mp$lookup(a))throw new Sk.builtin.AttributeError("'"+d+"' object has no attribute '"+a.$jsstr()+"'");g.mp$ass_subscript(a,b)}else"object"===typeof g&&(g[a.$mangled]=b)}};Sk.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,c,!0)};Sk.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.__getattribute__=Sk.builtin.object.prototype.GenericPythonGetAttr;Sk.builtin.object.prototype.__setattr__=Sk.builtin.object.prototype.GenericPythonSetAttr;Sk.builtin.object.prototype.tp$descr_set=void 0;Sk.builtin.object.prototype.__new__=function(a){Sk.builtin.pyCheckArgsLen("__new__",arguments.length,1,1,!1,!1);return new a([],[])};Sk.builtin.object.prototype.__repr__=function(a){Sk.builtin.pyCheckArgsLen("__repr__",arguments.length,0,0,!1,!0);return a.$r()};Sk.builtin.object.prototype.__format__= +function(a,b){Sk.builtin.pyCheckArgsLen("__format__",arguments.length,2,2);if(Sk.builtin.checkString(b)){var c=Sk.ffi.remapToJs(b);if(""!==c)throw new Sk.builtin.NotImplementedError("format spec is not yet implemented");}else{if(Sk.__future__.exceptions)throw new Sk.builtin.TypeError("format() argument 2 must be str, not "+Sk.abstr.typeName(b));throw new Sk.builtin.TypeError("format expects arg 2 to be string or unicode, not "+Sk.abstr.typeName(b));}return new Sk.builtin.str(a)};Sk.builtin.object.prototype.__str__= +function(a){Sk.builtin.pyCheckArgsLen("__str__",arguments.length,0,0,!1,!0);return a.$r()};Sk.builtin.object.prototype.__hash__=function(a){Sk.builtin.pyCheckArgsLen("__hash__",arguments.length,0,0,!1,!0);return a.tp$hash()};Sk.builtin.object.prototype.__eq__=function(a,b){Sk.builtin.pyCheckArgsLen("__eq__",arguments.length,1,1,!1,!0);return a.ob$eq(b)};Sk.builtin.object.prototype.__ne__=function(a,b){Sk.builtin.pyCheckArgsLen("__ne__",arguments.length,1,1,!1,!0);return a.ob$ne(b)};Sk.builtin.object.prototype.__lt__= +function(a,b){Sk.builtin.pyCheckArgsLen("__lt__",arguments.length,1,1,!1,!0);return a.ob$lt(b)};Sk.builtin.object.prototype.__le__=function(a,b){Sk.builtin.pyCheckArgsLen("__le__",arguments.length,1,1,!1,!0);return a.ob$le(b)};Sk.builtin.object.prototype.__gt__=function(a,b){Sk.builtin.pyCheckArgsLen("__gt__",arguments.length,1,1,!1,!0);return a.ob$gt(b)};Sk.builtin.object.prototype.__ge__=function(a,b){Sk.builtin.pyCheckArgsLen("__ge__",arguments.length,1,1,!1,!0);return a.ob$ge(b)};Sk.builtin.object.prototype.$r= +function(){const a=Sk.abstr.lookupSpecial(this,Sk.builtin.str.$module);let b="";a&&Sk.builtin.checkString(a)&&(b=a.v+".");return new Sk.builtin.str("<"+b+Sk.abstr.typeName(this)+" object>")};Sk.builtin.object.prototype.tp$str=function(){return this.$r()};Sk.builtin.hashCount=1;Sk.builtin.idCount=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__ __getattribute__ __setattr__ __format__".split(" ");Sk.builtin.none=function(){return Sk.builtin.none.none$};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$= +Object.create(Sk.builtin.none.prototype,{v:{value:null,enumerable:!0}});Sk.builtin.NotImplemented=function(){return Sk.builtin.NotImplemented.NotImplemented$};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$=Object.create(Sk.builtin.NotImplemented.prototype,{v:{value:null,enumerable:!0}});Sk.exportSymbol("Sk.builtin.none", +Sk.builtin.none);Sk.exportSymbol("Sk.builtin.NotImplemented",Sk.builtin.NotImplemented)},function(m,p){Sk.builtin.pyCheckArgs=function(a,b,c,d,e,h){b=b.length;void 0===d&&(d=Infinity);e&&--b;h&&--b;if(b<c||b>d)throw new Sk.builtin.TypeError((c===d?a+"() takes exactly "+c+" arguments":b<c?a+"() takes at least "+c+" arguments":a+"() takes at most "+d+" arguments")+(" ("+b+" given)"));};Sk.exportSymbol("Sk.builtin.pyCheckArgs",Sk.builtin.pyCheckArgs);Sk.builtin.pyCheckArgsLen=function(a,b,c,d,e,h){void 0=== +d&&(d=Infinity);e&&--b;h&&--b;if(b<c||b>d)throw new Sk.builtin.TypeError((c===d?a+"() takes exactly "+c+" arguments":b<c?a+"() takes at least "+c+" arguments":a+"() takes at most "+d+" arguments")+(" ("+b+" given)"));};Sk.builtin.pyCheckType=function(a,b,c){if(!c)throw new Sk.builtin.TypeError(a+" must be a "+b);};Sk.exportSymbol("Sk.builtin.pyCheckType",Sk.builtin.pyCheckType);Sk.builtin.checkSequence=function(a){return null!==a&&void 0!==a.mp$subscript};Sk.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};Sk.exportSymbol("Sk.builtin.checkIterable",Sk.builtin.checkIterable);Sk.builtin.checkCallable=function(a){return"function"===typeof a||a instanceof Sk.builtin.func||a instanceof Sk.builtin.method||void 0!==Sk.abstr.lookupSpecial(a,Sk.builtin.str.$call)?!0:!1};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)};Sk.exportSymbol("Sk.builtin.checkNumber",Sk.builtin.checkNumber);Sk.builtin.checkComplex=function(a){return Sk.builtin.complex._complex_check(a)};Sk.exportSymbol("Sk.builtin.checkComplex",Sk.builtin.checkComplex);Sk.builtin.checkInt=function(a){return a instanceof Sk.builtin.int_||a instanceof Sk.builtin.lng||"number"===typeof a&&Number.isInteger(a)};Sk.exportSymbol("Sk.builtin.checkInt", +Sk.builtin.checkInt);Sk.builtin.checkFloat=function(a){return null!==a&&a instanceof Sk.builtin.float_};Sk.exportSymbol("Sk.builtin.checkFloat",Sk.builtin.checkFloat);Sk.builtin.checkString=function(a){return null!==a&&a.__class__==Sk.builtin.str};Sk.exportSymbol("Sk.builtin.checkString",Sk.builtin.checkString);Sk.builtin.checkBytes=function(a){return a instanceof Sk.builtin.bytes};Sk.builtin.checkClass=function(a){return null!==a&&a.sk$type};Sk.exportSymbol("Sk.builtin.checkClass",Sk.builtin.checkClass); +Sk.builtin.checkBool=function(a){return a instanceof Sk.builtin.bool};Sk.exportSymbol("Sk.builtin.checkBool",Sk.builtin.checkBool);Sk.builtin.checkNone=function(a){return a===Sk.builtin.none.none$};Sk.exportSymbol("Sk.builtin.checkNone",Sk.builtin.checkNone);Sk.builtin.checkFunction=function(a){return null!==a&&void 0!==a.tp$call};Sk.exportSymbol("Sk.builtin.checkFunction",Sk.builtin.checkFunction);Sk.builtin.func=function(a,b,c,d){if(!(this instanceof Sk.builtin.func))throw Error("builtin func should be called as a class with `new`"); +var e;this.func_code=a;this.func_globals=b||null;if(void 0!==d)for(e in d)c[e]=d[e];this.$d={__name__:a.co_name,__class__:Sk.builtin.func};this.func_closure=c;this.tp$name=this.func_code&&this.func_code.co_name&&this.func_code.co_name.v||this.func_code.name||"<native JS>";this.$memoiseFlags();if(this.memoised=a.co_fastcall)this.tp$call=a;return this};Sk.abstr.setUpInheritance("function",Sk.builtin.func,Sk.builtin.object);Sk.exportSymbol("Sk.builtin.func",Sk.builtin.func);Sk.builtin.func.prototype.tp$name= +"function";Sk.builtin.func.prototype.$memoiseFlags=function(){this.co_varnames=this.func_code.co_varnames;this.co_argcount=this.func_code.co_argcount;void 0===this.co_argcount&&this.co_varnames&&(this.co_argcount=this.co_varnames.length);this.co_kwonlyargcount=this.func_code.co_kwonlyargcount||0;this.co_varargs=this.func_code.co_varargs;this.co_kwargs=this.func_code.co_kwargs;this.$defaults=this.func_code.$defaults||[];this.$kwdefs=this.func_code.$kwdefs||[]};Sk.builtin.func.prototype.tp$descr_get= +function(a,b){Sk.asserts.assert(!(void 0===a&&void 0===b));return b&&b.prototype&&b.prototype.tp$name in Sk.builtin&&Sk.builtin[b.prototype.tp$name]===b?new Sk.builtin.method(this,a,b,!0):new Sk.builtin.method(this,a,b)};Sk.builtin.func.pythonFunctions=["__get__"];Sk.builtin.func.prototype.__get__=function(a,b,c){Sk.builtin.pyCheckArgsLen("__get__",arguments.length,1,2,!1,!0);if(b===Sk.builtin.none.none$&&c===Sk.builtin.none.none$)throw new Sk.builtin.TypeError("__get__(None, None) is invalid");return a.tp$descr_get(b, +c)};Sk.builtin.func.prototype.tp$getname=function(){return this.func_code&&this.func_code.co_name&&this.func_code.co_name.v||this.func_code.name||"<native JS>"};Sk.builtin.func.prototype.$resolveArgs=function(a,b){var c=this.co_argcount;void 0===c&&(c=this.co_varnames?this.co_varnames.length:a.length);var d=this.co_varnames||[],e=this.co_kwonlyargcount||0;let h=c+e;if(!(0!==e||this.co_kwargs||b&&0!==b.length||this.co_varargs)){if(a.length==c)return a;if(0===a.length&&this.$defaults&&this.$defaults.length=== +c){for(d=0;d!=this.$defaults.length;d++)a[d]=this.$defaults[d];return a}}let g;this.co_kwargs&&(g=[]);var f=a.length;let k=a.length<=c?a:a.slice(0,c);if(this.co_varargs)a=a.length>k.length?a.slice(k.length):[],k[h]=new Sk.builtin.tuple(a);else if(f>c)throw new Sk.builtin.TypeError(this.tp$getname()+"() takes "+c+" positional argument"+(1==c?"":"s")+" but "+f+(1==f?" was ":" were ")+" given");if(b){if(this.func_code.no_kw)throw new Sk.builtin.TypeError(this.tp$getname()+"() takes no keyword arguments"); +for(a=0;a<b.length;a+=2){f=b[a];var n=b[a+1],l=d.indexOf(f);if(0<=l){if(void 0!==k[l])throw new Sk.builtin.TypeError(this.tp$getname()+"() got multiple values for argument '"+f+"'");k[l]=n}else if(g)g.push(new Sk.builtin.str(f),n);else throw new Sk.builtin.TypeError(this.tp$getname()+"() got an unexpected keyword argument '"+f+"'");}}b=this.$defaults||[];a=0;f=[];n=!1;for(l=c-b.length;a<l;a++)void 0===k[a]&&(f.push(d[a]),void 0===d[a]&&(n=!0));if(0!=f.length&&(this.co_argcount||this.co_varnames))throw new Sk.builtin.TypeError(this.tp$getname()+ +"() missing "+f.length+" required argument"+(1==f.length?"":"s")+(n?"":": "+f.join(", ")));for(;a<c;a++)void 0===k[a]&&(k[a]=b[a-l]);if(0<e){e=[];b=this.$kwdefs;for(a=c;a<h;a++)void 0===k[a]&&(void 0!==b[a-c]?k[a]=b[a-c]:e.push(d[a]));if(0!==e.length)throw new Sk.builtin.TypeError(this.tp$getname()+"() missing "+e.length+" required keyword argument"+(1==e.length?"":"s")+": "+e.join(", "));}if(this.func_closure&&d)for(c=k.length;c<d.length;c++)k.push(void 0);g&&k.unshift(g);return k};Sk.builtin.func.prototype.tp$call= +function(a,b){this.memoised||(this.$memoiseFlags(),this.memoised=!0);if(void 0===this.co_argcount&&void 0===this.co_varnames&&!this.co_kwargs&&!this.func_closure){if(b&&0!==b.length)throw new Sk.builtin.TypeError(this.tp$getname()+"() takes no keyword arguments");return this.func_code.apply(this.func_globals,a)}a=this.$resolveArgs(a,b);this.func_closure&&a.push(this.func_closure);return this.func_code.apply(this.func_globals,a)};Sk.builtin.func.prototype.$r=function(){var a=this.tp$getname();return a in +Sk.builtins&&this===Sk.builtins[a]?new Sk.builtin.str("<built-in function "+a+">"):new Sk.builtin.str("<function "+a+">")}},function(m,p){Sk.builtin.range=function(a,b,c){var d=[],e;Sk.builtin.pyCheckArgsLen("range",arguments.length,1,3);Sk.builtin.pyCheckType("start","integer",Sk.misceval.isIndex(a));a=Sk.misceval.asIndex(a);void 0!==b&&(Sk.builtin.pyCheckType("stop","integer",Sk.misceval.isIndex(b)),b=Sk.misceval.asIndex(b));void 0!==c&&(Sk.builtin.pyCheckType("step","integer",Sk.misceval.isIndex(c)), +c=Sk.misceval.asIndex(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("number"===typeof a&&"number"===typeof b&&"number"===typeof c)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));else{e=new Sk.builtin.lng(a);var h=new Sk.builtin.lng(b),g=new Sk.builtin.lng(c);if(g.nb$ispositive())for(;Sk.misceval.isTrue(e.ob$lt(h));)d.push(e),e=e.nb$add(g);else for(;Sk.misceval.isTrue(e.ob$gt(h));)d.push(e), +e=e.nb$add(g)}d=new Sk.builtin.list(d);return Sk.__future__.python3?new Sk.builtin.range_(a,b,c,d):d};Sk.builtin.asnum$=function(a){return void 0===a||null===a?a:a===Sk.builtin.none.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};Sk.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)};Sk.exportSymbol("Sk.builtin.assk$",Sk.builtin.assk$);Sk.builtin.asnum$nofloat=function(a){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;var b=0;if(0<=a.indexOf("e")){var c=a.substr(0,a.indexOf("e"));b=a.substr(a.indexOf("e")+1)}else 0<=a.indexOf("E")?(c=a.substr(0,a.indexOf("e")),b=a.substr(a.indexOf("E")+1)):c=a;b=parseInt(b,10);a=c.indexOf(".");if(0>a){if(0<= +b){for(;0<b--;)c+="0";return c}return c.length>-b?c.substr(0,c.length+b):0}c=0===a?c.substr(1):a<c.length?c.substr(0,a)+c.substr(a+1):c.substr(0,a);for(a+=b;a>c.length;)c+="0";return c=0>=a?0:c.substr(0,a)};Sk.exportSymbol("Sk.builtin.asnum$nofloat",Sk.builtin.asnum$nofloat);Sk.builtin.round=function(a,b){Sk.builtin.pyCheckArgsLen("round",arguments.length,1,2);if(!Sk.builtin.checkNumber(a)){if(!Sk.builtin.checkFunction(a))throw new Sk.builtin.TypeError("a float is required");if(!Sk.__future__.exceptions)throw new Sk.builtin.AttributeError(Sk.abstr.typeName(a)+ +" instance has no attribute '__float__'");}if(void 0!==b&&!Sk.misceval.isIndex(b))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object cannot be interpreted as an index");if(!Sk.__future__.dunder_round&&a.round$)return a.round$(a,b);var c=Sk.abstr.lookupSpecial(a,Sk.builtin.str.$round);if(null!=c)return Sk.builtin.checkFunction(a)?Sk.misceval.callsimArray(c,[a]):Sk.misceval.callsimArray(c,[a,b]);throw new Sk.builtin.TypeError("a float is required");};Sk.builtin.len=function(a){Sk.builtin.pyCheckArgsLen("len", +arguments.length,1,1);var b=function(a){return new Sk.builtin.int_(a)};var c=function(a){if(Sk.builtin.checkInt(a))return b(a);if(Sk.__future__.exceptions)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object cannot be interpreted as an integer");throw new Sk.builtin.TypeError("__len__() should return an int");};if(a.sq$length)return Sk.misceval.chain(a.sq$length(!0),c);if(a.mp$length)return Sk.misceval.chain(a.mp$length(),b);if(a.tp$length)if(Sk.builtin.checkFunction(a)){c=Sk.abstr.lookupSpecial(a, +Sk.builtin.str.$len);if(null!=c)return Sk.misceval.callsimArray(c,[a]);if(!Sk.__future__.exceptions)throw new Sk.builtin.AttributeError(Sk.abstr.typeName(a)+" instance has no attribute '__len__'");}else return Sk.misceval.chain(a.tp$length(!0),c);throw new Sk.builtin.TypeError("object of type '"+Sk.abstr.typeName(a)+"' has no len()");};Sk.builtin.min=function(a,b,c){const d=c.sq$length();if(!d)throw new Sk.builtin.TypeError("min expected 1 argument, got 0");if(1<d&&null!==a)throw new Sk.builtin.TypeError("Cannot specify a default for min() with multiple positional arguments"); +if(1==d&&(c=c.v[0],!Sk.builtin.checkIterable(c)))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(c)+"' object is not iterable");let e=Sk.abstr.iter(c);if(!Sk.builtin.checkNone(b)&&!Sk.builtin.checkCallable(b))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object is not callable");let h;return Sk.misceval.chain(e.tp$iternext(!0),a=>{h=a;if(void 0!==h)return Sk.builtin.checkNone(b)?Sk.misceval.iterFor(e,a=>{Sk.misceval.richCompareBool(a,h,"Lt")&&(h=a)}):Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(b, +[h]),a=>Sk.misceval.iterFor(e,c=>Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(b,[c]),b=>{Sk.misceval.richCompareBool(b,a,"Lt")&&(h=c,a=b)})))},()=>{if(void 0===h){if(null===a)throw new Sk.builtin.ValueError("min() arg is an empty sequence");h=a}return h})};Sk.builtin.min.co_argcount=0;Sk.builtin.min.co_kwonlyargcount=2;Sk.builtin.min.$kwdefs=[null,Sk.builtin.none.none$];Sk.builtin.min.co_varnames=["default","key"];Sk.builtin.min.co_varargs=1;Sk.builtin.max=function(a,b,c){const d=c.sq$length(); +if(!d)throw new Sk.builtin.TypeError("max expected 1 argument, got 0");if(1<d&&null!==a)throw new Sk.builtin.TypeError("Cannot specify a default for max() with multiple positional arguments");if(1==d&&(c=c.v[0],!Sk.builtin.checkIterable(c)))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(c)+"' object is not iterable");let e=Sk.abstr.iter(c);if(!Sk.builtin.checkNone(b)&&!Sk.builtin.checkCallable(b))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object is not callable");let h;return Sk.misceval.chain(e.tp$iternext(!0), +a=>{h=a;if(void 0!==h)return Sk.builtin.checkNone(b)?Sk.misceval.iterFor(e,a=>{Sk.misceval.richCompareBool(a,h,"Gt")&&(h=a)}):Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(b,[h]),a=>Sk.misceval.iterFor(e,c=>Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(b,[c]),b=>{Sk.misceval.richCompareBool(b,a,"Gt")&&(h=c,a=b)})))},()=>{if(void 0===h){if(null===a)throw new Sk.builtin.ValueError("min() arg is an empty sequence");h=a}return h})};Sk.builtin.max.co_argcount=0;Sk.builtin.max.co_kwonlyargcount= +2;Sk.builtin.max.$kwdefs=[null,Sk.builtin.none.none$];Sk.builtin.max.co_varnames=["default","key"];Sk.builtin.max.co_varargs=1;Sk.builtin.any=function(a){Sk.builtin.pyCheckArgsLen("any",arguments.length,1,1);return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(a),function(a){if(Sk.misceval.isTrue(a))return new Sk.misceval.Break(Sk.builtin.bool.true$)}),a=>a||Sk.builtin.bool.false$)};Sk.builtin.all=function(a){Sk.builtin.pyCheckArgsLen("all",arguments.length,1,1);return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(a), +function(a){if(!Sk.misceval.isTrue(a))return new Sk.misceval.Break(Sk.builtin.bool.false$)}),a=>a||Sk.builtin.bool.true$)};Sk.builtin.sum=function(a,b){function c(){return Sk.misceval.iterFor(h,a=>{if(a.constructor===Sk.builtin.int_)g=g.nb$add(a);else{if(a.constructor===Sk.builtin.float_)return g=(new Sk.builtin.float_(g)).nb$add(a),new Sk.misceval.Break("float");g=Sk.abstr.numberBinOp(g,a,"Add");return new Sk.misceval.Break("slow")}})}function d(){return Sk.misceval.iterFor(h,a=>{if(a.constructor=== +Sk.builtin.float_||a.constructor===Sk.builtin.int_)g=g.nb$add(a);else return g=Sk.abstr.numberBinOp(g,a,"Add"),new Sk.misceval.Break("slow")})}function e(){return Sk.misceval.iterFor(h,a=>{g=Sk.abstr.numberBinOp(g,a,"Add")})}Sk.builtin.pyCheckArgsLen("sum",arguments.length,1,2);const h=Sk.abstr.iter(a);if(void 0===b)var g=new Sk.builtin.int_(0);else{if(Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("sum() can't sum strings [use ''.join(seq) instead]");g=b}let f;f=void 0===b||b.constructor=== +Sk.builtin.int_?c():b.constructor===Sk.builtin.float_?"float":"slow";return Sk.misceval.chain(f,a=>"float"===a?d():a,a=>{if("slow"===a)return e()},()=>g)};Sk.builtin.zip=function(){var a,b;if(0===arguments.length)return new Sk.builtin.list([]);var c=[];for(b=0;b<arguments.length;b++)if(Sk.builtin.checkIterable(arguments[b]))c.push(Sk.abstr.iter(arguments[b]));else throw new Sk.builtin.TypeError("argument "+b+" must support iteration");var d=[];for(a=!1;!a;){var e=[];for(b=0;b<arguments.length;b++){var h= +c[b].tp$iternext();if(void 0===h){a=!0;break}e.push(h)}a||d.push(new Sk.builtin.tuple(e))}return new Sk.builtin.list(d)};Sk.builtin.abs=function(a){Sk.builtin.pyCheckArgsLen("abs",arguments.length,1,1);if(a.nb$abs)return a.nb$abs();throw new TypeError("bad operand type for abs(): '"+Sk.abstr.typeName(a)+"'");};Sk.builtin.fabs=function(a){return Sk.builtin.abs(a)};Sk.builtin.ord=function(a){Sk.builtin.pyCheckArgsLen("ord",arguments.length,1,1);if(Sk.builtin.checkString(a)){if(1!==a.v.length&&1!==a.sq$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.codePointAt(0))}if(Sk.builtin.checkBytes(a)){if(1!==a.sq$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[0])}throw new Sk.builtin.TypeError("ord() expected a string of length 1, but "+Sk.abstr.typeName(a)+" found");};Sk.builtin.chr=function(a){Sk.builtin.pyCheckArgsLen("chr",arguments.length,1,1);if(!Sk.builtin.checkInt(a))throw new Sk.builtin.TypeError("an integer is required"); +a=Sk.builtin.asnum$(a);if(Sk.__future__.python3){if(0>a||1114112<=a)throw new Sk.builtin.ValueError("chr() arg not in range(0x110000)");}else if(0>a||256<=a)throw new Sk.builtin.ValueError("chr() arg not in range(256)");return new Sk.builtin.str(String.fromCodePoint(a))};Sk.builtin.unichr=function(a){Sk.builtin.pyCheckArgsLen("chr",arguments.length,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){if(a instanceof Sk.builtin.lng){var d="";2===b||Sk.__future__.python3||(d="L");b=a.str$(b,!1);return a.nb$isnegative()?new Sk.builtin.str("-"+c+b+d):new Sk.builtin.str(c+b+d)}a=Sk.misceval.asIndex(a);b=a.toString(b);return 0>a?new Sk.builtin.str("-"+c+b.slice(1)):new Sk.builtin.str(c+b)};Sk.builtin.hex=function(a){Sk.builtin.pyCheckArgsLen("hex",arguments.length,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.pyCheckArgsLen("oct",arguments.length,1,1);if(!Sk.misceval.isIndex(a))throw new Sk.builtin.TypeError("oct() argument can't be converted to hex");return Sk.__future__.octal_number_literal?Sk.builtin.int2str_(a,8,"0o"):Sk.builtin.int2str_(a,8,"0")};Sk.builtin.bin=function(a){Sk.builtin.pyCheckArgsLen("bin",arguments.length,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;Sk.builtin.pyCheckArgsLen("dir",arguments.length,1,1);var d=function(a){var c=null;if(-1!=="__bases__ __mro__ __class__ __name__ GenericGetAttr GenericSetAttr GenericPythonGetAttr GenericPythonSetAttr pythonFunctions HashNotImplemented constructor __dict__".split(" ").indexOf(a))return null;a=Sk.unfixReserved(a);-1!==a.indexOf("$")?c=Sk.builtin.dir.slotNameToRichName(a):"_"!==a.charAt(a.length-1)?c=a:"_"===a.charAt(0)&&(c=a); +return c};var e=[];var h=Sk.abstr.lookupSpecial(a,Sk.builtin.str.$dir);if(null!=h){var g=Sk.misceval.callsimArray(h,[a]);if(!Sk.builtin.checkSequence(g))throw new Sk.builtin.TypeError("__dir__ must return sequence.");g=Sk.ffi.remapToJs(g);for(b=0;b<g.length;++b)e.push(new Sk.builtin.str(g[b]))}else{for(b in a.constructor.prototype)(c=d(b))&&e.push(new Sk.builtin.str(c));if(a.$d)if(a.$d.tp$iter)for(h=a.$d.tp$iter(),b=h.tp$iternext();void 0!==b;b=h.tp$iternext())c=new Sk.builtin.str(b),(c=d(c.v))&& +e.push(new Sk.builtin.str(c));else for(c in a.$d)e.push(new Sk.builtin.str(c));var f=a.tp$mro;!f&&a.ob$type&&(f=a.ob$type.tp$mro);if(f)for(b=0;b<f.v.length;++b)for(g in h=f.v[b],h)h.hasOwnProperty(g)&&(c=d(g))&&e.push(new Sk.builtin.str(c))}e.sort(function(a,c){return(a.v>c.v)-(a.v<c.v)});return new Sk.builtin.list(e.filter(function(a,c,b){return a!==b[c+1]}))};Sk.builtin.dir.slotNameToRichName=function(a){};Sk.builtin.repr=function(a){Sk.builtin.pyCheckArgsLen("repr",arguments.length,1,1);return Sk.misceval.objectRepr(a)}; +Sk.builtin.ascii=function(a){return Sk.misceval.chain(Sk.misceval.objectRepr(a),a=>{if(!(a instanceof Sk.builtin.str))throw new Sk.builtin.TypeError("__repr__ returned non-string (type "+Sk.abstr.typeName(a)+")");let c,b;for(b=0;b<a.v.length;b++)if(127<=a.v.charCodeAt(b)){c=a.v.substr(0,b);break}if(!c)return a;for(;b<a.v.length;b++){var e=a.v.charAt(b),h=a.v.charCodeAt(b);127<h&&255>=h?(e=h.toString(16),2>e.length&&(e="0"+e),c+="\\x"+e):127<h&&55296>h||57344<=h?c+="\\u"+("000"+h.toString(16)).slice(-4): +55296<=h?(e=a.v.codePointAt(b),b++,e=e.toString(16),h="0000000"+e.toString(16),c=4<e.length?c+("\\U"+h.slice(-8)):c+("\\u"+h.slice(-4))):c+=e}return new Sk.builtin.str(c)})};Sk.builtin.open=function(a,b,c){Sk.builtin.pyCheckArgsLen("open",arguments.length,1,3);void 0===b&&(b=new Sk.builtin.str("r"));if(/\+/.test(b.v))throw"todo; haven't implemented read/write mode";if(("w"===b.v||"wb"===b.v||"a"===b.v||"ab"===b.v)&&!Sk.nonreadopen)throw"todo; haven't implemented non-read opens";return new Sk.builtin.file(a, +b,c)};Sk.builtin.isinstance=function(a,b){var c;Sk.builtin.pyCheckArgsLen("isinstance",arguments.length,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===Sk.builtin.none.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(c=0;c<b.v.length;++c)if(Sk.misceval.isTrue(Sk.builtin.isinstance(a, +b.v[c])))return Sk.builtin.bool.true$;return Sk.builtin.bool.false$}if(a instanceof b)return Sk.builtin.bool.true$;var d=function(a,c){if(a===c)return Sk.builtin.bool.true$;if(void 0===a.$d)return Sk.builtin.bool.false$;var b=a.$d.mp$subscript(Sk.builtin.type.basesStr_);for(a=0;a<b.v.length;++a)if(Sk.misceval.isTrue(d(b.v[a],c)))return Sk.builtin.bool.true$;return Sk.builtin.bool.false$};return d(a.ob$type,b)};Sk.builtin.hash=function(a){Sk.builtin.pyCheckArgsLen("hash",arguments.length,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.__hash&&(Sk.builtin.hashCount+=1,a.__hash=Sk.builtin.hashCount);return new Sk.builtin.int_(a.__hash)}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){Sk.builtin.pyCheckArgsLen("getattr",arguments.length,2,3);if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("attribute name must be string");var d=a.tp$getattr(b);if(void 0===d){if(void 0!==c)return c;throw new Sk.builtin.AttributeError("'"+Sk.abstr.typeName(a)+"' object has no attribute '"+b.$jsstr()+"'");}return d};Sk.builtin.setattr=function(a,b,c){Sk.builtin.pyCheckArgsLen("setattr",arguments.length,3,3);if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("attribute name must be string"); +if(a.tp$setattr)a.tp$setattr(b,c);else throw new Sk.builtin.AttributeError("object has no attribute "+b.$jsstr());return Sk.builtin.none.none$};Sk.builtin.raw_input=function(a){var b=a?a:"";return Sk.misceval.chain(Sk.importModule("sys",!1,!0),function(a){return Sk.inputfunTakesPrompt?Sk.misceval.callsimOrSuspendArray(Sk.builtin.file.$readline,[a.$d.stdin,null,b]):Sk.misceval.chain(void 0,function(){return Sk.misceval.callsimOrSuspendArray(a.$d.stdout.write,[a.$d.stdout,new Sk.builtin.str(b)])},function(){return Sk.misceval.callsimOrSuspendArray(a.$d.stdin.readline, +[a.$d.stdin])})})};Sk.builtin.input=Sk.builtin.raw_input;Sk.builtin.jseval=function(a){a=Sk.global.eval(Sk.ffi.remapToJs(a));return Sk.ffi.remapToPy(a)};Sk.builtin.jsmillis=function(){return(new Date).valueOf()};Sk.builtin.eval_=function(){throw new Sk.builtin.NotImplementedError("eval is not yet implemented");};Sk.builtin.map=function(a,b){var c=[],d,e;Sk.builtin.pyCheckArgsLen("map",arguments.length,2);if(2<arguments.length){var h=[];var g=Array.prototype.slice.apply(arguments).slice(1);for(e=0;e< +g.length;e++){if(!Sk.builtin.checkIterable(g[e])){var f=parseInt(e,10)+2;throw new Sk.builtin.TypeError("argument "+f+" to map() must support iteration");}g[e]=Sk.abstr.iter(g[e])}for(;;){var k=[];for(e=d=0;e<g.length;e++)f=g[e].tp$iternext(),void 0===f?(k.push(Sk.builtin.none.none$),d++):k.push(f);if(d!==g.length)h.push(k);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");return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(b), +function(b){if(a===Sk.builtin.none.none$)b instanceof Array&&(b=new Sk.builtin.tuple(b)),c.push(b);else return b instanceof Array||(b=[b]),Sk.misceval.chain(Sk.misceval.applyOrSuspend(a,void 0,void 0,void 0,b),function(a){c.push(a)})}),function(){return new Sk.builtin.list(c)})};Sk.builtin.reduce=function(a,b,c){var d;Sk.builtin.pyCheckArgsLen("reduce",arguments.length,2,3);if(!Sk.builtin.checkIterable(b))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object is not iterable");var e=Sk.abstr.iter(b); +if(void 0===c&&(c=e.tp$iternext(),void 0===c))throw new Sk.builtin.TypeError("reduce() of empty sequence with no initial value");var h=c;for(d=e.tp$iternext();void 0!==d;d=e.tp$iternext())h=Sk.misceval.callsimArray(a,[h,d]);return h};Sk.builtin.filter=function(a,b){var c;Sk.builtin.pyCheckArgsLen("filter",arguments.length,2,2);if(!Sk.builtin.checkIterable(b))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object is not iterable");var d=function(){return[]};var e=function(a,c){a.push(c); +return a};var h=function(a){return new Sk.builtin.list(a)};b.__class__===Sk.builtin.str?(d=function(){return new Sk.builtin.str("")},e=function(a,c){return a.sq$concat(c)},h=function(a){return a}):b.__class__===Sk.builtin.tuple&&(h=function(a){return new Sk.builtin.tuple(a)});var g=d();var f=Sk.abstr.iter(b);for(c=f.tp$iternext();void 0!==c;c=f.tp$iternext())d=a===Sk.builtin.none.none$?new Sk.builtin.bool(c):Sk.misceval.callsimArray(a,[c]),Sk.misceval.isTrue(d)&&(g=e(g,c));return h(g)};Sk.builtin.hasattr= +function(a,b){Sk.builtin.pyCheckArgsLen("hasattr",arguments.length,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)?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){Sk.builtin.pyCheckArgsLen("pow",arguments.length,2,3);c===Sk.builtin.none.none$&&(c=void 0);if(Sk.builtin.checkComplex(a))return a.nb$power(b, +c);var d=Sk.builtin.asnum$(a);var e=Sk.builtin.asnum$(b);var h=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));h=new Sk.builtin.int_(d);e=new Sk.builtin.int_(e);e=h.nb$power(e);return a instanceof Sk.builtin.lng||b instanceof Sk.builtin.lng?new Sk.builtin.lng(e):e}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){if(Sk.__future__.exceptions)throw new Sk.builtin.ValueError("pow() 2nd argument cannot be negative when 3rd argument specified"); +throw new Sk.builtin.TypeError("pow() 2nd argument cannot be negative when 3rd argument specified");}if(0===h)throw new Sk.builtin.ValueError("pow() 3rd argument cannot be 0");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;Sk.builtin.pyCheckArgsLen("issubclass",arguments.length,2,2);if(!Sk.builtin.checkClass(a))throw new Sk.builtin.TypeError("issubclass() arg 1 must be a class");if(!(Sk.builtin.checkClass(b)||b instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError("issubclass() arg 2 must be a class or tuple of classes");var d=function(a,c){if(a===c)return!0;if(void 0!==a.$d&&a.$d.mp$subscript)if(a.$d.sq$contains(Sk.builtin.type.basesStr_))var b=a.$d.mp$subscript(Sk.builtin.type.basesStr_); +else return!1;else return!1;for(a=0;a<b.v.length;++a)if(d(b.v[a],c))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){var c=Sk.unfixReserved(a);b.mp$ass_subscript(new Sk.builtin.str(c),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.pyCheckArgsLen("format",arguments.length,1,2);void 0===b&&(b=Sk.builtin.str.$emptystr);return Sk.abstr.objectFormat(a,b)};Sk.builtin.reversed=function(a){Sk.builtin.pyCheckArgsLen("reversed",arguments.length,1,1);var b=Sk.abstr.lookupSpecial(a,Sk.builtin.str.$reversed);if(null!=b)return Sk.misceval.callsimArray(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,Sk.builtin.str.$getitem);this.tp$iter=function(){return this};this.tp$iternext=function(){if(!(0>this.idx)){try{var a=Sk.misceval.callsimArray(this.getitem,[this.myobj,Sk.ffi.remapToPy(this.idx)])}catch(e){if(e instanceof Sk.builtin.IndexError)return;throw e;}this.idx--;return a}}}(a)};Sk.builtin.id=function(a){Sk.builtin.pyCheckArgsLen("id",arguments.length,1,1);void 0===a.__id&&(Sk.builtin.idCount+=1,a.__id=Sk.builtin.idCount);return new Sk.builtin.int_(a.__id)}; +Sk.builtin.bytearray=function(){throw new Sk.builtin.NotImplementedError("bytearray is not yet implemented");};Sk.builtin.callable=function(a){Sk.builtin.pyCheckArgsLen("callable",arguments.length,1,1);return Sk.builtin.checkCallable(a)?Sk.builtin.bool.true$:Sk.builtin.bool.false$};Sk.builtin.delattr=function(a,b){Sk.builtin.pyCheckArgsLen("delattr",arguments.length,2,2);if(void 0!==a.$d[b.v])return Sk.misceval.tryCatch(function(){return Sk.builtin.setattr(a,b,void 0)},function(c){Sk.misceval.tryCatch(function(){return Sk.builtin.setattr(a.$d, +b,void 0)},function(c){if(c instanceof Sk.builtin.AttributeError)throw new Sk.builtin.AttributeError(Sk.abstr.typeName(a)+" instance has no attribute '"+b.v+"'");throw c;})});if("type"!==a.$r().v.slice(1,5)){if(a.ob$type===Sk.builtin.type&&void 0!==a[b.v])return a[b.v]=void 0,Sk.builtin.none.none$;throw new Sk.builtin.AttributeError(Sk.abstr.typeName(a)+" instance has no attribute '"+b.v+"'");}throw new Sk.builtin.TypeError("can't set attributes of built-in/extension type '"+a.prototype.tp$name+"'"); +};Sk.builtin.execfile=function(){throw new Sk.builtin.NotImplementedError("execfile is not yet implemented");};Sk.builtin.help=function(){throw new Sk.builtin.NotImplementedError("help is not yet implemented");};Sk.builtin.iter=function(a,b){Sk.builtin.pyCheckArgsLen("iter",arguments.length,1,2);if(1===arguments.length){if(Sk.builtin.checkIterable(a))return new Sk.builtin.iterator(a);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not iterable");}if(Sk.builtin.checkCallable(a))return new Sk.builtin.iterator(a, +b);throw new TypeError("iter(v, w): v must be callable");};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(a,b){Sk.builtin.pyCheckArgsLen("next",arguments.length,1,2);if(!a.tp$iternext)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not an iterator");var c=a.tp$iternext();if(void 0=== +c){if(b)return b;throw new Sk.builtin.StopIteration;}return c};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");}},function(m,p){String.fromCodePoint||function(){var a=function(){try{var a={},c=Object.defineProperty;var b=c(a,"foo",a)&&c}catch(f){}return b}(),b=String.fromCharCode,c=Math.floor,d=function(a){var d=[],e=-1,f=arguments.length;if(!f)return"";for(var k="";++e<f;){var n=Number(arguments[e]); +if(!isFinite(n)||0>n||1114111<n||c(n)!=n)throw RangeError("Invalid code point: "+n);if(65535>=n)d.push(n);else{n-=65536;var l=(n>>10)+55296;n=n%1024+56320;d.push(l,n)}if(e+1==f||16384<d.length)k+=b.apply(null,d),d.length=0}return k};a?a(String,"fromCodePoint",{value:d,configurable:!0,writable:!0}):String.fromCodePoint=d}()},function(m,p){Sk.builtin.BaseException=function(...a){if(!(this instanceof Sk.builtin.BaseException)){var b=Object.create(Sk.builtin.BaseException.prototype);b.constructor.apply(b, +arguments);return b}this.traceback=[];"string"===typeof a[0]?(this.args=new Sk.builtin.tuple([new Sk.builtin.str(a[0])]),3<=a.length&&this.traceback.push({lineno:a[2],filename:a[1]||"<unknown>"})):this.args=new Sk.builtin.tuple(a)};Sk.abstr.setUpInheritance("BaseException",Sk.builtin.BaseException,Sk.builtin.object);Sk.builtin.BaseException.prototype.$r=function(){let a=this.tp$name;a+="("+this.args.v.map(a=>Sk.misceval.objectRepr(a).v).join(", ")+")";return new Sk.builtin.str(a)};Sk.builtin.BaseException.prototype.tp$str= +function(){return 1>=this.args.v.length?new Sk.builtin.str(this.args.v[0]):this.args.$r()};Sk.builtin.BaseException.prototype.toString=function(){let a=this.tp$name;a+=": "+this.tp$str().v;return a=0!==this.traceback.length?a+(" on line "+this.traceback[0].lineno):a+" at <unknown>"};Sk.builtin.BaseException.prototype.args={tp$descr_get:function(a,b){return a.args}};Sk.exportSymbol("Sk.builtin.BaseException",Sk.builtin.BaseException);Sk.builtin.Exception=function(a){if(!(this instanceof Sk.builtin.Exception)){var b= +Object.create(Sk.builtin.Exception.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.BaseException.apply(this,arguments)};Sk.abstr.setUpInheritance("Exception",Sk.builtin.Exception,Sk.builtin.BaseException);Sk.exportSymbol("Sk.builtin.Exception",Sk.builtin.Exception);Sk.builtin.AssertionError=function(a){if(!(this instanceof Sk.builtin.AssertionError)){var b=Object.create(Sk.builtin.AssertionError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)}; +Sk.abstr.setUpInheritance("AssertionError",Sk.builtin.AssertionError,Sk.builtin.Exception);Sk.exportSymbol("Sk.builtin.AssertionError",Sk.builtin.AssertionError);Sk.builtin.AttributeError=function(a){if(!(this instanceof Sk.builtin.AttributeError)){var b=Object.create(Sk.builtin.AttributeError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("AttributeError",Sk.builtin.AttributeError,Sk.builtin.Exception);Sk.builtin.ImportError= +function(a){if(!(this instanceof Sk.builtin.ImportError)){var b=Object.create(Sk.builtin.ImportError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("ImportError",Sk.builtin.ImportError,Sk.builtin.Exception);Sk.builtin.IndentationError=function(a){if(!(this instanceof Sk.builtin.IndentationError)){var b=Object.create(Sk.builtin.IndentationError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this, +arguments)};Sk.abstr.setUpInheritance("IndentationError",Sk.builtin.IndentationError,Sk.builtin.Exception);Sk.builtin.IndexError=function(a){if(!(this instanceof Sk.builtin.IndexError)){var b=Object.create(Sk.builtin.IndexError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("IndexError",Sk.builtin.IndexError,Sk.builtin.Exception);Sk.builtin.LookupError=function(a){if(!(this instanceof Sk.builtin.LookupError)){var b=Object.create(Sk.builtin.LookupError.prototype); +b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("LookupError",Sk.builtin.LookupError,Sk.builtin.Exception);Sk.exportSymbol("Sk.builtin.LookupError",Sk.builtin.LookupError);Sk.builtin.KeyError=function(a){if(!(this instanceof Sk.builtin.KeyError)){var b=Object.create(Sk.builtin.KeyError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.LookupError.apply(this,arguments)};Sk.abstr.setUpInheritance("KeyError",Sk.builtin.KeyError, +Sk.builtin.LookupError);Sk.builtin.NameError=function(a){if(!(this instanceof Sk.builtin.NameError)){var b=Object.create(Sk.builtin.NameError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("NameError",Sk.builtin.NameError,Sk.builtin.Exception);Sk.builtin.UnboundLocalError=function(a){if(!(this instanceof Sk.builtin.UnboundLocalError)){var b=Object.create(Sk.builtin.UnboundLocalError.prototype);b.constructor.apply(b,arguments); +return b}Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("UnboundLocalError",Sk.builtin.UnboundLocalError,Sk.builtin.Exception);Sk.builtin.OverflowError=function(a){if(!(this instanceof Sk.builtin.OverflowError)){var b=Object.create(Sk.builtin.OverflowError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("OverflowError",Sk.builtin.OverflowError,Sk.builtin.Exception);Sk.builtin.SyntaxError=function(a){if(!(this instanceof +Sk.builtin.SyntaxError)){var b=Object.create(Sk.builtin.SyntaxError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("SyntaxError",Sk.builtin.SyntaxError,Sk.builtin.Exception);Sk.builtin.RuntimeError=function(a){if(!(this instanceof Sk.builtin.RuntimeError)){var b=Object.create(Sk.builtin.RuntimeError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("RuntimeError", +Sk.builtin.RuntimeError,Sk.builtin.Exception);Sk.exportSymbol("Sk.builtin.RuntimeError",Sk.builtin.RuntimeError);Sk.builtin.SuspensionError=function(a){if(!(this instanceof Sk.builtin.SuspensionError)){var b=Object.create(Sk.builtin.SuspensionError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("SuspensionError",Sk.builtin.SuspensionError,Sk.builtin.Exception);Sk.exportSymbol("Sk.builtin.SuspensionError",Sk.builtin.SuspensionError); +Sk.builtin.SystemExit=function(a){if(!(this instanceof Sk.builtin.SystemExit)){var b=Object.create(Sk.builtin.SystemExit.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.BaseException.apply(this,arguments)};Sk.abstr.setUpInheritance("SystemExit",Sk.builtin.SystemExit,Sk.builtin.BaseException);Sk.exportSymbol("Sk.builtin.SystemExit",Sk.builtin.SystemExit);Sk.builtin.TypeError=function(a){if(!(this instanceof Sk.builtin.TypeError)){var b=Object.create(Sk.builtin.TypeError.prototype); +b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("TypeError",Sk.builtin.TypeError,Sk.builtin.Exception);Sk.exportSymbol("Sk.builtin.TypeError",Sk.builtin.TypeError);Sk.builtin.ValueError=function(a){if(!(this instanceof Sk.builtin.ValueError)){var b=Object.create(Sk.builtin.ValueError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("ValueError",Sk.builtin.ValueError, +Sk.builtin.Exception);Sk.exportSymbol("Sk.builtin.ValueError",Sk.builtin.ValueError);Sk.builtin.ZeroDivisionError=function(a){if(!(this instanceof Sk.builtin.ZeroDivisionError)){var b=Object.create(Sk.builtin.ZeroDivisionError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("ZeroDivisionError",Sk.builtin.ZeroDivisionError,Sk.builtin.Exception);Sk.builtin.TimeLimitError=function(a){if(!(this instanceof Sk.builtin.TimeLimitError)){var b= +Object.create(Sk.builtin.TimeLimitError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("TimeLimitError",Sk.builtin.TimeLimitError,Sk.builtin.Exception);Sk.exportSymbol("Sk.builtin.TimeLimitError",Sk.builtin.TimeLimitError);Sk.builtin.IOError=function(a){if(!(this instanceof Sk.builtin.IOError)){var b=Object.create(Sk.builtin.IOError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)}; +Sk.abstr.setUpInheritance("IOError",Sk.builtin.IOError,Sk.builtin.Exception);Sk.exportSymbol("Sk.builtin.IOError",Sk.builtin.IOError);Sk.builtin.NotImplementedError=function(a){if(!(this instanceof Sk.builtin.NotImplementedError)){var b=Object.create(Sk.builtin.NotImplementedError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("NotImplementedError",Sk.builtin.NotImplementedError,Sk.builtin.Exception);Sk.exportSymbol("Sk.builtin.NotImplementedError", +Sk.builtin.NotImplementedError);Sk.builtin.NegativePowerError=function(a){if(!(this instanceof Sk.builtin.NegativePowerError)){var b=Object.create(Sk.builtin.NegativePowerError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("NegativePowerError",Sk.builtin.NegativePowerError,Sk.builtin.Exception);Sk.exportSymbol("Sk.builtin.NegativePowerError",Sk.builtin.NegativePowerError);Sk.builtin.ExternalError=function(a,b){if(!(this instanceof +Sk.builtin.ExternalError)){var c=Object.create(Sk.builtin.ExternalError.prototype);c.constructor.apply(c,arguments);return c}b=Array.prototype.slice.call(arguments);this.nativeError=b[0];b[0]instanceof Sk.builtin.str||(b[0]=""+b[0]);Sk.builtin.Exception.apply(this,b)};Sk.abstr.setUpInheritance("ExternalError",Sk.builtin.ExternalError,Sk.builtin.Exception);Sk.exportSymbol("Sk.builtin.ExternalError",Sk.builtin.ExternalError);Sk.builtin.OperationError=function(a){if(!(this instanceof Sk.builtin.OperationError)){var b= +Object.create(Sk.builtin.OperationError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("OperationError",Sk.builtin.OperationError,Sk.builtin.Exception);Sk.exportSymbol("Sk.builtin.OperationError",Sk.builtin.OperationError);Sk.builtin.SystemError=function(a){if(!(this instanceof Sk.builtin.SystemError)){var b=Object.create(Sk.builtin.SystemError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this, +arguments)};Sk.abstr.setUpInheritance("SystemError",Sk.builtin.SystemError,Sk.builtin.Exception);Sk.exportSymbol("Sk.builtin.SystemError",Sk.builtin.SystemError);Sk.builtin.UnicodeDecodeError=function(a){if(!(this instanceof Sk.builtin.UnicodeDecodeError)){var b=Object.create(Sk.builtin.UnicodeDecodeError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("UnicodeDecodeError",Sk.builtin.UnicodeDecodeError,Sk.builtin.Exception); +Sk.exportSymbol("Sk.builtin.UnicodeDecodeError",Sk.builtin.UnicodeDecodeError);Sk.builtin.UnicodeEncodeError=function(a){if(!(this instanceof Sk.builtin.UnicodeEncodeError)){var b=Object.create(Sk.builtin.UnicodeEncodeError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("UnicodeEncodeError",Sk.builtin.UnicodeEncodeError,Sk.builtin.Exception);Sk.exportSymbol("Sk.builtin.UnicodeEncodeError",Sk.builtin.UnicodeEncodeError);Sk.builtin.StopIteration= +function(a){if(!(this instanceof Sk.builtin.StopIteration)){var b=Object.create(Sk.builtin.StopIteration.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};Sk.abstr.setUpInheritance("StopIteration",Sk.builtin.StopIteration,Sk.builtin.Exception);Sk.exportSymbol("Sk.builtin.StopIteration",Sk.builtin.StopIteration);Sk.builtin.getExcInfo=function(a){return new Sk.builtin.tuple([a.ob$type||Sk.builtin.none.none$,a,Sk.builtin.none.none$])}},function(m,p){Sk.builtin.method= +function(a,b,c,d){if(!(this instanceof Sk.builtin.method)){Sk.builtin.pyCheckArgsLen("method",arguments.length,3,3);if(!Sk.builtin.checkCallable(a))throw new Sk.builtin.TypeError("First argument must be callable");if(void 0===b.ob$type)throw new Sk.builtin.TypeError("Second argument must be object of known type");return new Sk.builtin.method(a,b,c)}this.tp$name=a.tp$name;this.im_func=a;this.im_self=b||Sk.builtin.none.none$;this.im_class=c||Sk.builtin.none.none$;this.im_builtin=d;this.$d={im_func:a, +im_self:b,im_class:c}};Sk.exportSymbol("Sk.builtin.method",Sk.builtin.method);Sk.abstr.setUpInheritance("instancemethod",Sk.builtin.method,Sk.builtin.object);Sk.builtin.method.prototype.tp$name="method";Sk.builtin.method.prototype.ob$eq=function(a){if(this.im_self==Sk.builtin.none.none$&&a.im_self!=Sk.builtin.none.none$||a.im_self==Sk.builtin.none.none$&&this.im_self!=Sk.builtin.none.none$)return!1;try{return Sk.misceval.richCompareBool(this.im_self,a.im_self,"Eq",!1)&&this.im_func==a.im_func}catch(b){return!1}}; +Sk.builtin.method.prototype.ob$ne=function(a){return!this.ob$eq(a)};Sk.builtin.method.prototype.tp$hash=function(){var a=this.im_self==Sk.builtin.none.none$?0:Sk.builtin.asnum$(Sk.builtin.hash(this.im_self));var b=Sk.builtin.asnum$(Sk.builtin.hash(this.im_func));return new Sk.builtin.int_(a+b)};Sk.builtin.method.prototype.tp$call=function(a,b){this.im_self!==Sk.builtin.none.none$&&a.unshift(this.im_self);if(this.im_self===Sk.builtin.none.none$){var c=function(a){return"unbound method "+this.tp$name+ +"() must be called with "+Sk.abstr.typeName(this.im_class)+" instance as first argument (got "+a+" instead)"}.bind(this);if(0<a.length){if(this.im_class!=Sk.builtin.none.none$&&!Sk.builtin.issubclass(a[0].ob$type,this.im_class)&&!this.im_builtin)throw new Sk.builtin.TypeError(c(Sk.abstr.typeName(a[0].ob$type)+" instance"));}else throw new Sk.builtin.TypeError(c("nothing"));}return this.im_func.tp$call(a,b)};Sk.builtin.method.prototype.tp$descr_get=function(a,b){Sk.asserts.assert(void 0!==a&&void 0!== +b);return new Sk.builtin.method(this,a,b,this.im_builtin)};Sk.builtin.method.pythonFunctions=["__get__"];Sk.builtin.method.prototype.__get__=function(a,b,c){Sk.builtin.pyCheckArgsLen("__get__",arguments.length,1,2,!1,!0);if(b===Sk.builtin.none.none$&&c===Sk.builtin.none.none$)throw new Sk.builtin.TypeError("__get__(None, None) is invalid");return c&&c!==Sk.builtin.none.none$?Sk.builtin.issubclass(c,a.im_class)?a.tp$descr_get(b,c):a:a.tp$descr_get(b,Sk.builtin.none.none$)};Sk.builtin.method.prototype.$r= +function(){return this.im_builtin?new Sk.builtin.str("<built-in method "+this.tp$name+" of type object>"):this.im_self===Sk.builtin.none.none$?new Sk.builtin.str("<unbound method "+this.im_class.prototype.tp$name+"."+this.tp$name+">"):new Sk.builtin.str("<bound method "+(this.im_class!==Sk.builtin.none.none$?this.im_class.prototype.tp$name:"?")+"."+this.tp$name+" of "+Sk.ffi.remapToJs(Sk.misceval.objectRepr(this.im_self))+">")}},function(m,p){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};Sk.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};Sk.exportSymbol("Sk.misceval.retryOptionalSuspensionOrThrow", +Sk.misceval.retryOptionalSuspensionOrThrow);Sk.misceval.isIndex=function(a){return Sk.builtin.checkInt(a)||Sk.abstr.lookupSpecial(a,Sk.builtin.str.$index)?!0:!1};Sk.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.cantBeInt()?a.str$(10,!0):a.toInt$();if(a.constructor=== +Sk.builtin.bool)return Sk.builtin.asnum$(a);if(b=Sk.abstr.lookupSpecial(a,Sk.builtin.str.$index)){a=Sk.misceval.callsimArray(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)}Sk.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)};Sk.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)};Sk.exportSymbol("Sk.misceval.assignSlice",Sk.misceval.assignSlice);Sk.misceval.arrayFromArguments=function(a){var b;if(1!=a.length)return a;var c=a[0];c instanceof Sk.builtin.set?c=c.tp$iter().$obj:c instanceof Sk.builtin.dict&&(c=Sk.builtin.dict.prototype.keys.func_code(c));if(c instanceof Sk.builtin.list||c instanceof Sk.builtin.tuple)return c.v;if(Sk.builtin.checkIterable(c)){a=[];c=Sk.abstr.iter(c);for(b=c.tp$iternext();void 0!==b;b=c.tp$iternext())a.push(b);return a}throw new Sk.builtin.TypeError("'"+ +Sk.abstr.typeName(c)+"' object is not iterable");};Sk.exportSymbol("Sk.misceval.arrayFromArguments",Sk.misceval.arrayFromArguments);Sk.misceval.swappedOp_={Eq:"Eq",NotEq:"NotEq",Lt:"Gt",LtE:"GtE",Gt:"Lt",GtE:"LtE"};Sk.misceval.opSymbols={Eq:"==",NotEq:"!=",Lt:"<",LtE:"<=",Gt:">",GtE:">=",Is:"is",IsNot:"is not",In_:"in",NotIn:"not in"};Sk.misceval.richCompareBool=function(a,b,c,d){var e;Sk.asserts.assert(null!==a&&void 0!==a,"passed null or undefined parameter to Sk.misceval.richCompareBool");Sk.asserts.assert(null!== +b&&void 0!==b,"passed null or undefined parameter to Sk.misceval.richCompareBool");var h=a.ob$type;var g=b.ob$type;if(!Sk.__future__.python3&&h!==g&&("GtE"===c||"Gt"===c||"LtE"===c||"Lt"===c)){var f=[Sk.builtin.float_,Sk.builtin.int_,Sk.builtin.lng,Sk.builtin.bool],k=[Sk.builtin.dict,Sk.builtin.enumerate,Sk.builtin.filter_,Sk.builtin.list,Sk.builtin.map_,Sk.builtin.str,Sk.builtin.tuple,Sk.builtin.zip_];const d=f.indexOf(h),e=k.indexOf(h);f=f.indexOf(g);k=k.indexOf(g);if(a===Sk.builtin.none.none$)switch(c){case "Lt":return!0; +case "LtE":return!0;case "Gt":return!1;case "GtE":return!1}if(b===Sk.builtin.none.none$)switch(c){case "Lt":return!1;case "LtE":return!1;case "Gt":return!0;case "GtE":return!0}if(-1!==d&&-1!==k)switch(c){case "Lt":return!0;case "LtE":return!0;case "Gt":return!1;case "GtE":return!1}if(-1!==e&&-1!==f)switch(c){case "Lt":return!1;case "LtE":return!1;case "Gt":return!0;case "GtE":return!0}if(-1!==e&&-1!==k)switch(c){case "Lt":return e<k;case "LtE":return e<=k;case "Gt":return e>k;case "GtE":return e>= +k}}if("Is"===c){if(h===g){if(a===b)return!0;if(h===Sk.builtin.float_||h===Sk.builtin.int_)return a.v===b.v;if(h===Sk.builtin.lng)return 0===a.longCompare(b)}return!1}if("IsNot"===c)return h!==g?!0:h===Sk.builtin.float_||h===Sk.builtin.int_?a.v!==b.v:h===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)}); +g={Eq:"ob$eq",NotEq:"ob$ne",Gt:"ob$gt",GtE:"ob$ge",Lt:"ob$lt",LtE:"ob$le"};h=g[c];if((d=a.constructor.prototype.hasOwnProperty(h))&&(e=a[h](b))!==Sk.builtin.NotImplemented.NotImplemented$)return Sk.misceval.isTrue(e);g=g[Sk.misceval.swappedOp_[c]];if((h=b.constructor.prototype.hasOwnProperty(g))&&(e=b[g](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);if((g=Sk.abstr.lookupSpecial(a,Sk.misceval.op2method_[c]))&&!d&&(e=Sk.misceval.callsimArray(g,[a,b]),e!=Sk.builtin.NotImplemented.NotImplemented$)||(d=Sk.abstr.lookupSpecial(b,Sk.misceval.op2method_[Sk.misceval.swappedOp_[c]]))&&!h&&(e=Sk.misceval.callsimArray(d,[b,a]),e!=Sk.builtin.NotImplemented.NotImplemented$))return Sk.misceval.isTrue(e);if(!Sk.__future__.python3){if(d= +Sk.abstr.lookupSpecial(a,Sk.builtin.str.$cmp))try{e=Sk.misceval.callsimArray(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(n){throw new Sk.builtin.TypeError("comparison did not return an int");}if(d=Sk.abstr.lookupSpecial(b, +Sk.builtin.str.$cmp))try{e=Sk.misceval.callsimArray(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===Sk.builtin.none.none$&&b===Sk.builtin.none.none$){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===b;if("NotEq"===c)return a!==b;a=Sk.abstr.typeName(a);b=Sk.abstr.typeName(b);throw new Sk.builtin.TypeError("'"+Sk.misceval.opSymbols[c]+"' not supported between instances of '"+a+"' and '"+b+"'");};Sk.exportSymbol("Sk.misceval.richCompareBool",Sk.misceval.richCompareBool);Sk.misceval.objectRepr=function(a){Sk.asserts.assert(void 0!== +a,"trying to repr undefined");return null===a||a===Sk.builtin.none.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):"string"===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>")};Sk.exportSymbol("Sk.misceval.objectRepr", +Sk.misceval.objectRepr);Sk.misceval.opAllowsEquality=function(a){switch(a){case "LtE":case "Eq":case "GtE":return!0}return!1};Sk.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(Sk.__future__.python3){if(a.nb$bool){a=a.nb$bool();if(!(a instanceof Sk.builtin.bool))throw new Sk.builtin.TypeError("__bool__ should return bool, returned "+Sk.abstr.typeName(a));return a.v}}else if(a.nb$nonzero){a=a.nb$nonzero();if(!Sk.builtin.checkInt(a))throw new Sk.builtin.TypeError("__nonzero__ should return an int");return 0!==Sk.builtin.asnum$(a)}if(a.sq$length){a=a.sq$length();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};Sk.exportSymbol("Sk.misceval.isTrue",Sk.misceval.isTrue);Sk.misceval.softspace_=!1;Sk.misceval.print_=function(a){Sk.misceval.softspace_&&("\n"!==a&&Sk.output(" "),Sk.misceval.softspace_=!1);var b=new Sk.builtin.str(a);return Sk.misceval.chain(Sk.importModule("sys",!1,!0),function(a){return Sk.misceval.apply(a.$d.stdout.write,void 0,void 0,void 0,[a.$d.stdout, +b])},function(){var a;(a=0===b.v.length)||(a=b.v[b.v.length-1],a=!("\n"===a||"\t"===a||"\r"===a));if(a||" "===b.v[b.v.length-1])Sk.misceval.softspace_=!0})};Sk.exportSymbol("Sk.misceval.print_",Sk.misceval.print_);Sk.misceval.loadname=function(a,b){b=b[a];if(void 0!==b)return"function"===typeof b&&void 0===b.$d&&void 0===b.tp$name?b():b;b=Sk.builtins[a];if(void 0!==b)return b;throw new Sk.builtin.NameError("name '"+Sk.unfixReserved(a)+"' is not defined");};Sk.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)};Sk.exportSymbol("Sk.misceval.call",Sk.misceval.call);Sk.misceval.callAsync=function(a,b,c,d,e,h){h=Array.prototype.slice.call(arguments,5);return Sk.misceval.applyAsync(a,b,c,d,e,h)};Sk.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)};Sk.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)};Sk.exportSymbol("Sk.misceval.callsim",Sk.misceval.callsim);Sk.misceval.callsimArray=function(a,b,c){return Sk.misceval.apply(a,void 0,void 0,c,b?b:[])};Sk.exportSymbol("Sk.misceval.callsimArray",Sk.misceval.callsimArray);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)};Sk.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)};Sk.exportSymbol("Sk.misceval.callsimOrSuspend",Sk.misceval.callsimOrSuspend);Sk.misceval.callsimOrSuspendArray=function(a,b,c){b||(b=[]);return a.tp$call?a.tp$call(b,c):Sk.misceval.applyOrSuspend(a,void 0,void 0,c,b)};Sk.exportSymbol("Sk.misceval.callsimOrSuspendArray",Sk.misceval.callsimOrSuspendArray); +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};Sk.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 f=function(){try{g(a.resume())}catch(u){d(u)}},h=function(c){try{a.data.result=c,f()}catch(z){d(z)}},n=function(c){try{a.data.error=c,f()}catch(z){d(z)}};a instanceof Sk.misceval.Suspension;){var l= +b&&(b[a.data.type]||b["*"]);if(l){var q=l(a);if(q){q.then(g,d);return}}if("Sk.promise"==a.data.type){a.data.promise.then(h,n);return}if("Sk.yield"==a.data.type){Sk.global.setImmediate(f);return}if("Sk.delay"==a.data.type){Sk.global.setImmediate(f);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(u){d(u)}})(a())}catch(e){d(e)}})};Sk.exportSymbol("Sk.misceval.asyncToPromise",Sk.misceval.asyncToPromise); +Sk.misceval.applyAsync=function(a,b,c,d,e,h){return Sk.misceval.asyncToPromise(function(){return Sk.misceval.applyOrSuspend(b,c,d,e,h)},a)};Sk.exportSymbol("Sk.misceval.applyAsync",Sk.misceval.applyAsync);Sk.misceval.chain=function(a,b){for(var c=1,d=a,e,h;;){if(c==arguments.length)return d;if(d&&d.$isSuspension)break;d=arguments[c](d);c++}h=Array(arguments.length-c);for(e=0;e<arguments.length-c;e++)h[e]=arguments[c+e];e=0;return function k(a){for(;e<h.length;){if(a instanceof Sk.misceval.Suspension)return new Sk.misceval.Suspension(k, +a);a=h[e](a);e++}return a}(d)};Sk.exportSymbol("Sk.misceval.chain",Sk.misceval.chain);Sk.misceval.tryCatch=function(a,b){try{var c=a()}catch(d){return b(d)}return c instanceof Sk.misceval.Suspension?(a=new Sk.misceval.Suspension(void 0,c),a.resume=function(){return Sk.misceval.tryCatch(c.resume,b)},a):c};Sk.exportSymbol("Sk.misceval.tryCatch",Sk.misceval.tryCatch);Sk.misceval.iterFor=function(a,b,c){var d=c,e=function(c){d=c;return c instanceof Sk.misceval.Break?c:a.tp$iternext(!0)};return function f(a){for(;void 0!== +a;){if(a instanceof Sk.misceval.Suspension)return new Sk.misceval.Suspension(f,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))};Sk.exportSymbol("Sk.misceval.iterFor",Sk.misceval.iterFor);Sk.misceval.arrayFromIterable=function(a,b){if(void 0===a)return[];if(void 0===(a.hp$type||void 0)&&void 0!==a.sk$asarray)return a.sk$asarray();const c=[];a=Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(a),a=>{c.push(a)}), +()=>c);return b?a:Sk.misceval.retryOptionalSuspensionOrThrow(a)};Sk.misceval.Break=function(a){if(!(this instanceof Sk.misceval.Break))return new Sk.misceval.Break(a);this.brValue=a};Sk.exportSymbol("Sk.misceval.Break",Sk.misceval.Break);Sk.misceval.applyOrSuspend=function(a,b,c,d,e){var h;if(null===a||a===Sk.builtin.none.none$)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not callable");"function"===typeof a&&void 0===a.tp$call&&(a=new Sk.builtin.func(a));var g=a.tp$call;if(void 0!== +g){if(c)for(c=c.tp$iter(),h=c.tp$iternext();void 0!==h;h=c.tp$iternext())e.push(h);if(b)for(c=Sk.abstr.iter(b),h=c.tp$iternext();void 0!==h;h=c.tp$iternext()){if(!Sk.builtin.checkString(h))throw new Sk.builtin.TypeError("Function keywords must be strings");d.push(h.v);d.push(Sk.abstr.objectGetItem(b,h,!1))}return g.call(a,e,d,b)}g=a.__call__;if(void 0!==g)return e.unshift(a),Sk.misceval.apply(g,b,c,d,e);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not callable");};Sk.exportSymbol("Sk.misceval.applyOrSuspend", +Sk.misceval.applyOrSuspend);Sk.misceval.promiseToSuspension=function(a){var b=new Sk.misceval.Suspension;b.resume=function(){if(b.data.error)throw b.data.error;return b.data.result};b.data={type:"Sk.promise",promise:a};return b};Sk.exportSymbol("Sk.misceval.promiseToSuspension",Sk.misceval.promiseToSuspension);Sk.misceval.buildClass=function(a,b,c,d,e){var h=Sk.builtin.type,g={};b(a,g,void 0===e?{}:e);a.__name__&&(g.__module__=a.__name__);a=new Sk.builtin.str(c);d=new Sk.builtin.tuple(d);b=[];for(var f in g)g.hasOwnProperty(f)&& +(b.push(new Sk.builtin.str(f)),b.push(g[f]));b=new Sk.builtin.dict(b);return Sk.misceval.callsimArray(h,[a,d,b])};Sk.exportSymbol("Sk.misceval.buildClass",Sk.misceval.buildClass)},function(m,p){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.pyCheckArgsLen("__len__", +arguments.length,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.pyCheckArgsLen("__iter__",arguments.length,0,0,!1,!0);return a.tp$iter()});Sk.builtin.seqtype.prototype.__contains__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgsLen("__contains__",arguments.length,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.pyCheckArgsLen("__getitem__",arguments.length,1,1,!1,!0);return a.mp$subscript(b)});Sk.builtin.seqtype.prototype.__add__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgsLen("__add__",arguments.length,1,1,!1,!0);return a.sq$concat(b)});Sk.builtin.seqtype.prototype.__mul__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgsLen("__mul__",arguments.length,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.pyCheckArgsLen("__rmul__",arguments.length,1,1,!1,!0);return a.sq$repeat(b)})},function(m,p){Sk.builtin.list=function(a,b){if(!(this instanceof Sk.builtin.list))return Sk.builtin.pyCheckArgsLen("list",arguments.length,0,1),new Sk.builtin.list(a,!0);if(void 0===a)this.v=[];else if(Array.isArray(a))this.v=a;else return Sk.misceval.chain(Sk.misceval.arrayFromIterable(a,b),a=>{this.v=a;return this})}; +Sk.abstr.setUpInheritance("list",Sk.builtin.list,Sk.builtin.seqtype);Sk.abstr.markUnhashable(Sk.builtin.list);Sk.builtin.list.prototype.__class__=Sk.builtin.list;Sk.builtin.list.prototype.sk$asarray=function(){return this.v.slice(0)};Sk.builtin.list.prototype.list_concat_=function(a){if(!a.__class__||a.__class__!=Sk.builtin.list)throw new Sk.builtin.TypeError("can only concatenate list to list");return new Sk.builtin.list(this.v.concat(a.v),!1)};Sk.builtin.list.prototype.list_extend_=function(a){var b; +if(a.sk$asarray)return this.v.push.apply(this.v,a.sk$asarray()),this;if(!Sk.builtin.checkIterable(a))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not iterable");a=Sk.abstr.iter(a);for(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){a=Sk.builtin.asnum$(a);b=Sk.builtin.asnum$(b);var 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=[];var c=Sk.abstr.iter(this);for(a=c.tp$iternext();void 0!==a;a=c.tp$iternext())a===this?b.push("[...]"):b.push(Sk.misceval.objectRepr(a).v);return new Sk.builtin.str("["+b.join(", ")+"]")};Sk.builtin.list.prototype.tp$richcompare=function(a,b){var c;if(this===a&&Sk.misceval.opAllowsEquality(b))return!0;if(!a.__class__||a.__class__!=Sk.builtin.list)return"Eq"===b?!1:"NotEq"===b?!0:Sk.__future__.python3? +Sk.builtin.NotImplemented.NotImplemented$:!1;var d=this.v;a=a.v;var e=d.length;var h=a.length;for(c=0;c<e&&c<h;++c){var g=Sk.misceval.richCompareBool(d[c],a[c],"Eq");if(!g)break}if(c>=e||c>=h)switch(b){case "Lt":return e<h;case "LtE":return e<=h;case "Eq":return e===h;case "NotEq":return e!==h;case "Gt":return e>h;case "GtE":return e>=h;default:Sk.asserts.fail()}return"Eq"===b?!1:"NotEq"===b?!0:Sk.misceval.richCompareBool(d[c],a[c],b)};Sk.builtin.list.prototype.__iter__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("__iter__", +arguments.length,0,0,!0,!1);return new Sk.builtin.list_iter_(a)});Sk.builtin.list.prototype.tp$iter=function(){return new Sk.builtin.list_iter_(this)};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){if(!Sk.misceval.isIndex(a))throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '"+ +Sk.abstr.typeName(a)+"'");var b=Sk.misceval.asIndex(a);if("number"!==typeof b)throw new Sk.builtin.OverflowError("cannot fit '"+Sk.abstr.typeName(a)+"' into an index-sized integer");var c=[];for(a=0;a<b;++a)c.push.apply(c,this.v);return new Sk.builtin.list(c,!1)};Sk.builtin.list.prototype.nb$multiply=Sk.builtin.list.prototype.sq$repeat;Sk.builtin.list.prototype.nb$inplace_multiply=function(a){if(!Sk.misceval.isIndex(a))throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '"+ +Sk.abstr.typeName(a)+"'");var b=Sk.misceval.asIndex(a);if("number"!==typeof b)throw new Sk.builtin.OverflowError("cannot fit '"+Sk.abstr.typeName(a)+"' into an index-sized integer");for(a=1;a<b;++a)this.v.push.apply(this.v,this.v);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=this.v;for(b=0;b<c.length;b++)if(Sk.misceval.richCompareBool(c[b],a,"Eq"))return!0;return!1};Sk.builtin.list.prototype.__contains__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgsLen("__contains__",arguments.length,2,2);return new Sk.builtin.bool(a.sq$contains(b))});Sk.builtin.list.prototype.list_subscript_=function(a){if(Sk.misceval.isIndex(a)){let b=Sk.misceval.asIndex(a);if("number"!==typeof b)throw new Sk.builtin.IndexError("cannot fit '"+ +Sk.abstr.typeName(a)+"' into an index-sized integer");if(void 0!==b){0>b&&(b=this.v.length+b);if(0>b||b>=this.v.length)throw new Sk.builtin.IndexError("list index out of range");return this.v[b]}}else if(a instanceof Sk.builtin.slice){const b=[];a.sssiter$(this.v.length,a=>{b.push(this.v[a])});return 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){if(Sk.misceval.isIndex(a)){var c= +Sk.misceval.asIndex(a);if("number"!==typeof c)throw new Sk.builtin.IndexError("cannot fit '"+Sk.abstr.typeName(a)+"' into an index-sized integer");if(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{const d=[];a.sssiter$(this.v.length,a=>{d.push(a)});a=0;if(d.length!==b.v.length)throw new Sk.builtin.ValueError("attempt to assign sequence of size "+b.v.length+ +" to extended slice of size "+d.length);for(c=0;c<d.length;++c)this.v.splice(d[c],1,b.v[a]),a+=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){if(Sk.misceval.isIndex(a)){var b=Sk.misceval.asIndex(a);if(void 0!==b){0>b&&(b=this.v.length+b);this.list_del_item_(b);return}}else if(a instanceof Sk.builtin.slice){b=a.slice_indices_(this.v.length);if(1===b[2])this.list_del_slice_(b[0],b[1]);else{const c= +this.v;let d=0;const e=0<b[2]?1:0;a.sssiter$(c.length,a=>{c.splice(a-d,1);d+=e})}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.__setitem__=new Sk.builtin.func(function(a,b,c){return Sk.builtin.list.prototype.list_ass_subscript_.call(a,b,c)});Sk.builtin.list.prototype.__delitem__=new Sk.builtin.func(function(a,b){return Sk.builtin.list.prototype.list_del_subscript_.call(a,b)});Sk.builtin.list.prototype.list_sort_=function(a,b,c,d){var e,h=void 0!==c&&null!==c&&c!==Sk.builtin.none.none$;var g=void 0!==b&&null!==b&&b!==Sk.builtin.none.none$;if(void 0===d)var f=!1;else{if(d===Sk.builtin.none.none$)throw new Sk.builtin.TypeError("an integer is required"); +f=Sk.misceval.isTrue(d)}d=new Sk.builtin.timSort(a);a.v=[];var k=new Sk.builtin.int_(0);if(h)for(d.lt=g?function(a,c){a=Sk.misceval.callsimArray(b,[a[0],c[0]]);return Sk.misceval.richCompareBool(a,k,"Lt")}:function(a,c){return Sk.misceval.richCompareBool(a[0],c[0],"Lt")},e=0;e<d.listlength;e++){g=d.list.v[e];var n=Sk.misceval.callsimArray(c,[g]);d.list.v[e]=[n,g]}else g&&(d.lt=function(a,c){a=Sk.misceval.callsimArray(b,[a,c]);return Sk.misceval.richCompareBool(a,k,"Lt")});f&&d.list.list_reverse_(d.list); +d.sort();f&&d.list.list_reverse_(d.list);if(h)for(c=0;c<d.listlength;c++)g=d.list.v[c][1],d.list.v[c]=g;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_sort_.co_varnames=["__self__","cmp","key","reverse"];Sk.builtin.list.prototype.list_sort_.$defaults=[Sk.builtin.none.none$,Sk.builtin.none.none$,!1];Sk.builtin.list.prototype.list_reverse_=function(a){Sk.builtin.pyCheckArgsLen("reverse", +arguments.length,1,1);var b=a.v.length;var c=a.v;var d=[];for(--b;-1<b;--b)d.push(c[b]);a.v=d;return Sk.builtin.none.none$};Sk.builtin.list.prototype.append=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgsLen("append",arguments.length,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.pyCheckArgsLen("insert",arguments.length,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.pyCheckArgsLen("extend",arguments.length,2,2);a.list_extend_(b);return Sk.builtin.none.none$});Sk.builtin.list.prototype.pop=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgsLen("pop",arguments.length,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");var c=a.v[b];a.v.splice(b,1);return c});Sk.builtin.list.prototype.remove=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgsLen("remove",arguments.length,2,2);var 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.clear$=function(a){Sk.builtin.pyCheckArgsLen("clear",arguments.length, +1,1);a.v=[];return Sk.builtin.none.none$};Sk.builtin.list.prototype.copy$=function(a){Sk.builtin.pyCheckArgsLen("copy",arguments.length,1,1);return new Sk.builtin.list(a)};Sk.builtin.list.prototype.index=new Sk.builtin.func(function(a,b,c,d){Sk.builtin.pyCheckArgsLen("index",arguments.length,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"); +var e=a.v.length;var h=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(h[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;Sk.builtin.pyCheckArgsLen("count",arguments.length,2,2);var e=a.v.length;var h=a.v;for(c=d=0;c<e;++c)Sk.misceval.richCompareBool(h[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.exportSymbol("Sk.builtin.list",Sk.builtin.list);Sk.builtin.list_iter_=function(a){if(!(this instanceof Sk.builtin.list_iter_))return new Sk.builtin.list_iter_(a);this.$index=0;this.lst=a.v;this.$done=!1;this.tp$iter=()=>this;this.tp$iternext=function(){if(this.$done||this.$index>=this.lst.length)this.$done=!0;else return this.lst[this.$index++]}; +this.$r=function(){return new Sk.builtin.str("<listiterator>")};return this};Sk.abstr.setUpInheritance("listiterator",Sk.builtin.list_iter_,Sk.builtin.object);Sk.builtin.list_iter_.prototype.__class__=Sk.builtin.list_iter_;Sk.builtin.list_iter_.prototype.__iter__=new Sk.builtin.func(function(a){return a});Sk.builtin.list_iter_.prototype.next$=function(a){a=a.tp$iternext();if(void 0===a)throw new Sk.builtin.StopIteration;return a}},function(m,p){function a(a,c){return new Sk.builtin.func(function(b, +d,e){Sk.builtin.pyCheckArgsLen(c?"center":a?"rjust":"ljust",arguments.length,2,3);if(!Sk.builtin.checkInt(d))throw new Sk.builtin.TypeError("integer argument expected, got "+Sk.abstr.typeName(d));if(void 0!==e&&(!Sk.builtin.checkString(e)||1!==e.v.length&&1!==e.sq$length()))throw new Sk.builtin.TypeError("must be char, not "+Sk.abstr.typeName(e));e=void 0===e?" ":e.v;d=Sk.builtin.asnum$(d);let f=b.sq$length();if(f>=d)return b;if(c){var g=e.repeat(Math.floor((d-f)/2));g=g+b.v+g;(d-f)%2&&(g+=e);return new Sk.builtin.str(g)}g= +e.repeat(d-f);return new Sk.builtin.str(a?g+b.v:b.v+g)})}function b(a,c,b){const d=a.sq$length();if(void 0===c||Sk.builtin.checkNone(c))c=0;else if(Sk.misceval.isIndex(c))c=Sk.misceval.asIndex(c),c=0<=c?c:d+c,0>c&&(c=0);else throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method");if(void 0===b||Sk.builtin.checkNone(b))b=d;else if(Sk.misceval.isIndex(b))b=Sk.misceval.asIndex(b),b=0<=b?b:d+b,0>b?b=0:b>d&&(b=d);else throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method"); +a.$hasAstralCodePoints()&&(c=a.codepoints[c],b=a.codepoints[b],c=void 0===c?a.v.length:c,b=void 0===b?a.v.length:b);return{start:c,end:b}}function c(a){return new Sk.builtin.func(function(c,d,f,e){Sk.builtin.pyCheckArgsLen("find",arguments.length,2,4);if(!Sk.builtin.checkString(d))throw new Sk.builtin.TypeError("expected a character buffer object");({start:f,end:e}=b(c,f,e));const g=c.sq$length();if(e<f)return new Sk.builtin.int_(-1);e-=d.v.length;let h=a?c.v.lastIndexOf(d.v,e):c.v.indexOf(d.v,f); +h=h>=f&&h<=e?h:-1;if(c.$hasAstralCodePoints()){var k=-1;for(let a=0;a<g;a++)h==c.codepoints[a]&&(k=a)}else k=h;return new Sk.builtin.int_(k)})}Sk.builtin.interned=Object.create(null);Sk.builtin.str=function(a,c,b){void 0===a&&(a="");if(c){Sk.builtin.pyCheckArgsLen("str",arguments.length,0,Sk.__future__.python3?3:1);if(!Sk.builtin.checkBytes(a))throw new TypeError("decoding "+Sk.abstr.typeName(a)+" is not supported");return Sk.builtin.bytes.$decode(a,c,b)}if(a instanceof Sk.builtin.str)return a;if(!(this instanceof +Sk.builtin.str))return new Sk.builtin.str(a);if(!0===a)var f="True";else if(!1===a)f="False";else if(null===a||a===Sk.builtin.none.none$)f="None";else if(a instanceof Sk.builtin.bool)f=a.v?"True":"False";else if("number"===typeof a)f=a.toString(),"Infinity"===f?f="inf":"-Infinity"===f&&(f="-inf");else if("string"===typeof a)f=a;else{if(void 0!==a.tp$str){f=a.tp$str();if(!(f instanceof Sk.builtin.str))throw new Sk.builtin.ValueError("__str__ didn't return a str");return f}return Sk.misceval.objectRepr(a)}const e= +Sk.builtin.interned[f];if(void 0!==e)return e;this.__class__=Sk.builtin.str;this.v=f;Sk.builtin.interned[f]=this;f=void 0===d[f]?f:f+"_$rw$";this.$mangled=f;this.$savedKeyHash_=void 0;return this};Sk.exportSymbol("Sk.builtin.str",Sk.builtin.str);Sk.abstr.setUpInheritance("str",Sk.builtin.str,Sk.builtin.seqtype);Sk.builtin.str.prototype.sk$builtinBase=Sk.builtin.str;Sk.builtin.str.prototype.$hasAstralCodePoints=function(){if(null===this.codepoints)return!1;if(void 0!==this.codepoints)return!0;for(var a= +0;a<this.v.length;a++){let c=this.v.charCodeAt(a);if(55296<=c&&57344>c){this.codepoints=[];for(a=0;a<this.v.length;a++)this.codepoints.push(a),c=this.v.charCodeAt(a),55296<=c&&56320>c&&a++;return!0}}this.codepoints=null;return!1};Sk.builtin.str.prototype.$jsstr=function(){return this.v};Sk.builtin.str.prototype.mp$subscript=function(a){let c;if(Sk.misceval.isIndex(a)){a=Sk.misceval.asIndex(a);c=this.sq$length();0>a&&(a=c+a);if(0>a||a>=c)throw new Sk.builtin.IndexError("string index out of range"); +return this.codepoints?new Sk.builtin.str(this.v.substring(this.codepoints[a],this.codepoints[a+1])):new Sk.builtin.str(this.v.charAt(a))}if(a instanceof Sk.builtin.slice){let b="";c=this.sq$length();this.codepoints?a.sssiter$(c,a=>{b+=this.v.substring(this.codepoints[a],this.codepoints[a+1])}):a.sssiter$(c,a=>{b+=this.v.charAt(a)});return 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.$hasAstralCodePoints()? +this.codepoints.length: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 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);var b="";for(c=0;c<a;++c)b+=this.v;return new Sk.builtin.str(b)};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(){Sk.asserts.fail()};Sk.builtin.str.prototype.sq$slice=function(a,c){a=Sk.builtin.asnum$(a);c=Sk.builtin.asnum$(c);0>a&&(a=0);return this.$hasAstralCodePoints()?a>=this.codepoints.length?Sk.builtin.str.$emptystr: +new Sk.builtin.str(this.v.substring(this.codepoints[a],this.codepoints[c])):new Sk.builtin.str(this.v.substring(a,c))};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.__contains__=new Sk.builtin.func(function(a,c){Sk.builtin.pyCheckArgsLen("__contains__",arguments.length-1,1,1);return new Sk.builtin.bool(-1!=a.v.indexOf(c.v))}); +Sk.builtin.str.prototype.__iter__=new Sk.builtin.func(function(a){return new Sk.builtin.str_iter_(a)});Sk.builtin.str.prototype.tp$iter=function(){return new Sk.builtin.str_iter_(this)};Sk.builtin.str.prototype.tp$richcompare=function(a,c){if(!(a instanceof Sk.builtin.str))return Sk.builtin.NotImplemented.NotImplemented$;switch(c){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:Sk.asserts.fail()}};Sk.builtin.str.prototype.$r=function(){var a,c="'";-1!==this.v.indexOf("'")&&-1===this.v.indexOf('"')&&(c='"');var b=this.v.length;var d=c;for(a=0;a<b;++a){var k=this.v.charAt(a);var n=this.v.charCodeAt(a);k===c||"\\"===k?d+="\\"+k:"\t"===k?d+="\\t":"\n"===k?d+="\\n":"\r"===k?d+="\\r":(255<n&&55296>n||57344<=n)&&!Sk.__future__.python3?d+="\\u"+("000"+n.toString(16)).slice(-4):55296<=n&&!Sk.__future__.python3?(k=this.v.codePointAt(a),a++,k=k.toString(16),n="0000000"+ +k.toString(16),d=4<k.length?d+("\\U"+n.slice(-8)):d+("\\u"+n.slice(-4))):255<n&&!Sk.__future__.python3?d+="\\ufffd":" ">k||127<=n&&!Sk.__future__.python3?(k=k.charCodeAt(0).toString(16),2>k.length&&(k="0"+k),d+="\\x"+k):d+=k}return new Sk.builtin.str(d+c)};Sk.builtin.str.re_escape_=function(a){var c,b=[],d=/^[A-Za-z0-9]+$/;for(c=0;c<a.length;++c){var e=a.charAt(c);d.test(e)?b.push(e):"\\000"===e?b.push("\\000"):b.push("\\"+e)}return b.join("")};Sk.builtin.str.prototype.lower=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("lower", +arguments.length,1,1);return new Sk.builtin.str(a.v.toLowerCase())});Sk.builtin.str.prototype.upper=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("upper",arguments.length,1,1);return new Sk.builtin.str(a.v.toUpperCase())});Sk.builtin.str.prototype.capitalize=new Sk.builtin.func(function(a){var c;Sk.builtin.pyCheckArgsLen("capitalize",arguments.length,1,1);var b=a.v;if(0===b.length)return new Sk.builtin.str("");var d=b.charAt(0).toUpperCase();for(c=1;c<b.length;c++)d+=b.charAt(c).toLowerCase(); +return new Sk.builtin.str(d)});Sk.builtin.str.prototype.join=new Sk.builtin.func(function(a,c){var b;Sk.builtin.pyCheckArgsLen("join",arguments.length,2,2);Sk.builtin.pyCheckType("seq","iterable",Sk.builtin.checkIterable(c));var d=[];var e=c.tp$iter();for(b=e.tp$iternext();void 0!==b;b=e.tp$iternext()){if(b.constructor!==Sk.builtin.str)throw new Sk.builtin.TypeError("TypeError: sequence item "+d.length+": expected string, "+Sk.abstr.typeName(b)+" found");d.push(b.v)}return new Sk.builtin.str(d.join(a.v))}); +Sk.builtin.str.prototype.split=new Sk.builtin.func(function(a,c,b){var d,e;Sk.builtin.pyCheckArgsLen("split",arguments.length,1,3);if(void 0===c||c===Sk.builtin.none.none$)c=null;if(null!==c&&!Sk.builtin.checkString(c))throw new Sk.builtin.TypeError("expected a string");if(null!==c&&""===c.v)throw new Sk.builtin.ValueError("empty separator");if(void 0!==b&&!Sk.builtin.checkInt(b))throw new Sk.builtin.TypeError("an integer is required");b=Sk.builtin.asnum$(b);var g=/[\s\xa0]+/g;var h=a.v;if(null=== +c)h=h.replace(/^[\s\xa0]+/,"");else{var q=c.v.replace(/([.*+?=|\\\/()\[\]\{\}^$])/g,"\\$1");g=new RegExp(q,"g")}var u=[];for(q=d=0;null!=(e=g.exec(h))&&e.index!==g.lastIndex&&!(u.push(new Sk.builtin.str(h.substring(d,e.index))),d=g.lastIndex,q+=1,b&&q>=b););h=h.substring(d);(null!==c||0<h.length)&&u.push(new Sk.builtin.str(h));return new Sk.builtin.list(u)});Sk.builtin.str.prototype.strip=new Sk.builtin.func(function(a,c){Sk.builtin.pyCheckArgsLen("strip",arguments.length,1,2);if(void 0!==c&&!Sk.builtin.checkString(c))throw new Sk.builtin.TypeError("strip arg must be None or str"); +if(void 0===c)var b=/^\s+|\s+$/g;else b=Sk.builtin.str.re_escape_(c.v),b=new RegExp("^["+b+"]+|["+b+"]+$","g");return new Sk.builtin.str(a.v.replace(b,""))});Sk.builtin.str.prototype.lstrip=new Sk.builtin.func(function(a,c){Sk.builtin.pyCheckArgsLen("lstrip",arguments.length,1,2);if(void 0!==c&&!Sk.builtin.checkString(c))throw new Sk.builtin.TypeError("lstrip arg must be None or str");if(void 0===c)var b=/^\s+/g;else b=Sk.builtin.str.re_escape_(c.v),b=new RegExp("^["+b+"]+","g");return new Sk.builtin.str(a.v.replace(b, +""))});Sk.builtin.str.prototype.rstrip=new Sk.builtin.func(function(a,c){Sk.builtin.pyCheckArgsLen("rstrip",arguments.length,1,2);if(void 0!==c&&!Sk.builtin.checkString(c))throw new Sk.builtin.TypeError("rstrip arg must be None or str");if(void 0===c)var b=/\s+$/g;else b=Sk.builtin.str.re_escape_(c.v),b=new RegExp("["+b+"]+$","g");return new Sk.builtin.str(a.v.replace(b,""))});Sk.builtin.str.prototype.__format__=new Sk.builtin.func(function(a,c){Sk.builtin.pyCheckArgsLen("__format__",arguments.length, +2,2);if(Sk.builtin.checkString(c)){var b=Sk.ffi.remapToJs(c);if(""!==b&&"s"!==b)throw new Sk.builtin.NotImplementedError("format spec is not yet implemented");}else{if(Sk.__future__.exceptions)throw new Sk.builtin.TypeError("format() argument 2 must be str, not "+Sk.abstr.typeName(c));throw new Sk.builtin.TypeError("format expects arg 2 to be string or unicode, not "+Sk.abstr.typeName(c));}return new Sk.builtin.str(a)});Sk.builtin.str.prototype.partition=new Sk.builtin.func(function(a,c){Sk.builtin.pyCheckArgsLen("partition", +arguments.length,2,2);Sk.builtin.pyCheckType("sep","string",Sk.builtin.checkString(c));var b=new Sk.builtin.str(c);var d=a.v.indexOf(b.v);return 0>d?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,d)),b,new Sk.builtin.str(a.v.substring(d+b.v.length))])});Sk.builtin.str.prototype.rpartition=new Sk.builtin.func(function(a,c){Sk.builtin.pyCheckArgsLen("rpartition",arguments.length,2,2);Sk.builtin.pyCheckType("sep","string", +Sk.builtin.checkString(c));var b=new Sk.builtin.str(c);var d=a.v.lastIndexOf(b.v);return 0>d?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,d)),b,new Sk.builtin.str(a.v.substring(d+b.v.length))])});Sk.builtin.str.prototype.count=new Sk.builtin.func(function(a,c,b,d){Sk.builtin.pyCheckArgsLen("count",arguments.length,2,4);if(!Sk.builtin.checkString(c))throw new Sk.builtin.TypeError("expected a character buffer object"); +if(void 0!==b&&!Sk.builtin.checkInt(b)&&!Sk.builtin.checkNone(b))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)&&!Sk.builtin.checkNone(d))throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method");var f=a.sq$length();if(void 0===b||b===Sk.builtin.none.none$)b=0;else if(b=Sk.builtin.asnum$(b),b=0<=b?b:f+b,b>f)return new Sk.builtin.int_(0);void 0===d||d===Sk.builtin.none.none$? +d=f:(d=Sk.builtin.asnum$(d),d=0<=d?d:f+d);f=c.v.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");f=new RegExp(f,"g");return(f=a.v.slice(a.codepoints?a.codepoints[b]:b,a.codepoints?a.codepoints[d]:d).match(f))?new Sk.builtin.int_(f.length):new Sk.builtin.int_(0)});Sk.builtin.str.prototype.ljust=a(!1);Sk.builtin.str.prototype.rjust=a(!0);Sk.builtin.str.prototype.center=a(!1,!0);Sk.builtin.str.prototype.find=c(!1);Sk.builtin.str.prototype.index=new Sk.builtin.func(function(a,c,b,d){Sk.builtin.pyCheckArgsLen("index", +arguments.length,2,4);var f=Sk.misceval.callsimArray(a.find,[a,c,b,d]);if(-1===Sk.builtin.asnum$(f))throw new Sk.builtin.ValueError("substring not found");return f});Sk.builtin.str.prototype.rfind=c(!0);Sk.builtin.str.prototype.rindex=new Sk.builtin.func(function(a,c,b,d){Sk.builtin.pyCheckArgsLen("rindex",arguments.length,2,4);var f=Sk.misceval.callsimArray(a.rfind,[a,c,b,d]);if(-1===Sk.builtin.asnum$(f))throw new Sk.builtin.ValueError("substring not found");return f});Sk.builtin.str.prototype.startswith= +new Sk.builtin.func(function(a,c,d,f){Sk.builtin.pyCheckArgsLen("startswith",arguments.length-1,1,3);if(!(c instanceof Sk.builtin.str||c instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError("startswith first arg must be str or a tuple of str, not "+Sk.abstr.typeName(c));({start:d,end:f}=b(a,d,f));if(d>f)return Sk.builtin.bool.false$;let e=a.v.slice(d,f);if(c instanceof Sk.builtin.tuple){for(let a=Sk.abstr.iter(c),b=a.tp$iternext();void 0!==b;b=a.tp$iternext()){if(!(b instanceof Sk.builtin.str))throw new Sk.builtin.TypeError("tuple for startswith must only contain str, not "+ +Sk.abstr.typeName(b));if(0===e.indexOf(b.v))return Sk.builtin.bool.true$}return Sk.builtin.bool.false$}return new Sk.builtin.bool(0===e.indexOf(c.v))});Sk.builtin.str.prototype.endswith=new Sk.builtin.func(function(a,c,d,f){Sk.builtin.pyCheckArgsLen("endswith",arguments.length-1,1,3);if(!(c instanceof Sk.builtin.str||c instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError("endswith first arg must be str or a tuple of str, not "+Sk.abstr.typeName(c));({start:d,end:f}=b(a,d,f));if(d>f)return Sk.builtin.bool.false$; +let e=a.v.slice(d,f);if(c instanceof Sk.builtin.tuple){for(let a=Sk.abstr.iter(c),b=a.tp$iternext();void 0!==b;b=a.tp$iternext()){if(!(b instanceof Sk.builtin.str))throw new Sk.builtin.TypeError("tuple for endswith must only contain str, not "+Sk.abstr.typeName(b));if(-1!==e.indexOf(b.v,e.length-b.v.length))return Sk.builtin.bool.true$}return Sk.builtin.bool.false$}return new Sk.builtin.bool(-1!==e.indexOf(c.v,e.length-c.v.length))});Sk.builtin.str.prototype.replace=new Sk.builtin.func(function(a, +c,b,d){Sk.builtin.pyCheckArgsLen("replace",arguments.length,3,4);Sk.builtin.pyCheckType("oldS","string",Sk.builtin.checkString(c));Sk.builtin.pyCheckType("newS","string",Sk.builtin.checkString(b));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);var f=new RegExp(Sk.builtin.str.re_escape_(c.v),"g");if(void 0===d||0>d)return new Sk.builtin.str(a.v.replace(f,b.v));var e=0;return new Sk.builtin.str(a.v.replace(f, +function(a){e++;return e<=d?b.v:a}))});Sk.builtin.str.prototype.zfill=new Sk.builtin.func(function(a,c){var b=a.v,d="";Sk.builtin.pyCheckArgsLen("zfill",arguments.length,2,2);if(!Sk.builtin.checkInt(c))throw new Sk.builtin.TypeError("integer argument expected, got "+Sk.abstr.typeName(c));var e=c.v-b.length;var h="+"===b[0]||"-"===b[0]?1:0;for(var l=0;l<e;l++)d+="0";b=b.substr(0,h)+d+b.substr(h);return new Sk.builtin.str(b)});Sk.builtin.str.prototype.isdigit=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("isdigit", +arguments.length,1,1);return new Sk.builtin.bool(/^\d+$/.test(a.v))});Sk.builtin.str.prototype.isspace=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("isspace",arguments.length,1,1);return new Sk.builtin.bool(/^\s+$/.test(a.v))});Sk.builtin.str.prototype.expandtabs=new Sk.builtin.func(function(a,c){Sk.builtin.pyCheckArgsLen("expandtabs",arguments.length,1,2);if(void 0!==c&&!Sk.builtin.checkInt(c))throw new Sk.builtin.TypeError("integer argument expected, got "+Sk.abstr.typeName(c));c=void 0=== +c?8:Sk.builtin.asnum$(c);var b=Array(c+1).join(" ");var d=a.v.replace(/([^\r\n\t]*)\t/g,function(a,d){return d+b.slice(d.length%c)});return new Sk.builtin.str(d)});Sk.builtin.str.prototype.swapcase=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("swapcase",arguments.length,1,1);var c=a.v.replace(/[a-z]/gi,function(a){var c=a.toLowerCase();return c===a?a.toUpperCase():c});return new Sk.builtin.str(c)});Sk.builtin.str.prototype.splitlines=new Sk.builtin.func(function(a,c){var b=a.v,d,e=a.v.length, +h=[],l=0;Sk.builtin.pyCheckArgsLen("splitlines",arguments.length,1,2);if(void 0!==c&&!Sk.builtin.checkBool(c))throw new Sk.builtin.TypeError("boolean argument expected, got "+Sk.abstr.typeName(c));c=void 0===c?!1:c.v;for(d=0;d<e;d++){var q=b.charAt(d);if("\n"===b.charAt(d+1)&&"\r"===q)q=d+2,l=b.slice(l,q),c||(l=l.replace(/(\r|\n)/g,"")),h.push(new Sk.builtin.str(l)),l=q;else if("\n"===q&&"\r"!==b.charAt(d-1)||"\r"===q)q=d+1,l=b.slice(l,q),c||(l=l.replace(/(\r|\n)/g,"")),h.push(new Sk.builtin.str(l)), +l=q}l<e&&(l=b.slice(l,e),c||(l=l.replace(/(\r|\n)/g,"")),h.push(new Sk.builtin.str(l)));return new Sk.builtin.list(h)});Sk.builtin.str.prototype.title=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("title",arguments.length,1,1);var c=a.v.replace(/[a-z][a-z]*/gi,function(a){return a[0].toUpperCase()+a.substr(1).toLowerCase()});return new Sk.builtin.str(c)});Sk.builtin.str.prototype.isalpha=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("isalpha",arguments.length,1,1);return new Sk.builtin.bool(a.v.length&& +!/[^a-zA-Z]/.test(a.v))});Sk.builtin.str.prototype.isalnum=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("isalnum",arguments.length,1,1);return new Sk.builtin.bool(a.v.length&&!/[^a-zA-Z0-9]/.test(a.v))});Sk.builtin.str.prototype.isnumeric=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("isnumeric",arguments.length,1,1);return new Sk.builtin.bool(a.v.length&&!/[^0-9]/.test(a.v))});Sk.builtin.str.prototype.islower=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("islower", +arguments.length,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.pyCheckArgsLen("isupper",arguments.length,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 c=a.v,b=!1,d=!1,e;Sk.builtin.pyCheckArgsLen("istitle",arguments.length,1,1);for(e=0;e<c.length;e++){var n=c.charAt(e);if(!/[a-z]/.test(n)&& +/[A-Z]/.test(n)){if(d)return new Sk.builtin.bool(!1);b=d=!0}else if(/[a-z]/.test(n)&&!/[A-Z]/.test(n)){if(!d)return new Sk.builtin.bool(!1);b=!0}else d=!1}return new Sk.builtin.bool(b)});Sk.builtin.str.prototype.encode=new Sk.builtin.func(function(a,c,b){Sk.builtin.pyCheckArgsLen("encode",arguments.length,1,3);c=c||Sk.builtin.str.$utf8;Sk.builtin.pyCheckType("encoding","string",Sk.builtin.checkString(c));c=c.v;void 0!==b?(Sk.builtin.pyCheckType("errors","string",Sk.builtin.checkString(b)),b=b.v): +b="strict";const d=Sk.builtin.bytes.$strEncode(a,c,b);return Sk.__future__.python3?d:new Sk.builtin.str(d.$jsstr())});Sk.builtin.str.$py2decode=new Sk.builtin.func(function(a,c,b){Sk.builtin.pyCheckArgsLen("decode",arguments.length,1,3);const d=new Sk.builtin.bytes(a.$jsstr());return Sk.builtin.bytes.$decode(d,c,b)});Sk.builtin.str.prototype.nb$remainder=function(a){var c;const b=this.sk$builtinBase;a.constructor===Sk.builtin.tuple||void 0!==a.mp$subscript&&a.constructor!==b||(a=new Sk.builtin.tuple([a])); +var d=0;var e=this.$jsstr().replace(/%(\([a-zA-Z0-9]+\))?([#0 +\-]+)?(\*|[0-9]+)?(\.(\*|[0-9]+))?[hlL]?([diouxXeEfFgGcrsb%])/g,function(f,e,g,h,k,y,t){var u,l,z,n,q;h=Sk.builtin.asnum$(h);k=Sk.builtin.asnum$(k);void 0!==e&&""!==e||"%"==t||(u=d++);""===k&&(k=void 0);var m=l=z=n=q=!1;g&&(-1!==g.indexOf("-")?n=!0:-1!==g.indexOf("0")&&(q=!0),-1!==g.indexOf("+")?l=!0:-1!==g.indexOf(" ")&&(z=!0),m=-1!==g.indexOf("#"));k&&(k=parseInt(k.substr(1),10));g=function(a,c){var b;c=Sk.builtin.asnum$(c);var d=!1; +if("number"===typeof a){0>a&&(a=-a,d=!0);var f=a.toString(c)}else a instanceof Sk.builtin.float_?(f=a.str$(c,!1),2<f.length&&".0"===f.substr(-2)&&(f=f.substr(0,f.length-2)),d=a.nb$isnegative()):a instanceof Sk.builtin.int_?(f=a.str$(c,!1),d=a.nb$isnegative()):a instanceof Sk.builtin.lng&&(f=a.str$(c,!1),d=a.nb$isnegative());Sk.asserts.assert(void 0!==f,"unhandled number format");a=!1;if(k)for(b=f.length;b<k;++b)f="0"+f,a=!0;b="";d?b="-":l?b="+"+b:z&&(b=" "+b);m&&(16===c?b+="0x":8!==c||a||"0"===f|| +(b+="0"));return[b,f]};f=function(a){var c=a[0];a=a[1];if(h){h=parseInt(h,10);var b=a.length+c.length;if(q)for(;b<h;++b)a="0"+a;else if(n){for(;b<h;++b)a+=" ";Sk.__future__.python3&&(a+=c,c="")}else for(;b<h;++b)c=" "+c}return c+a};if(a.constructor===Sk.builtin.tuple)e=a.v[u];else if(void 0!==a.mp$subscript&&void 0!==e)e=e.substring(1,e.length-1),e=a.mp$subscript(new b(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"===t||"i"===t){var p=g(e,10);if(void 0===p[1])throw new Sk.builtin.TypeError("%"+t+" format: a number is required, not "+Sk.abstr.typeName(e));t=p[1];p[1]=-1!==t.indexOf(".")?parseInt(t,10).toString():t;return f(p)}if("o"===t)return f(g(e,8));if("x"===t)return f(g(e,16));if("X"===t)return f(g(e,16)).toUpperCase();if("f"===t||"F"===t||"e"===t||"E"===t||"g"===t||"G"===t){p=Sk.builtin.asnum$(e);"string"===typeof p&&(p=Number(p));if(Infinity===p)return"inf"; +if(-Infinity===p)return"-inf";if(isNaN(p))return"nan";u=["toExponential","toFixed","toPrecision"]["efg".indexOf(t.toLowerCase())];if(void 0===k||""===k)if("e"===t||"E"===t)k=6;else if("f"===t||"F"===t)k=Sk.__future__.python3?6:7;u=p[u](k);Sk.builtin.checkFloat(e)&&0===p&&-Infinity===1/p&&(u="-"+u);Sk.__future__.python3&&(7<=u.length&&"0.0000"==u.slice(0,6)&&(c=parseFloat(u),u=c.toExponential()),"-"==u.charAt(u.length-2)&&(u=u.slice(0,u.length-1)+"0"+u.charAt(u.length-1)));-1!=="EFG".indexOf(t)&&(u= +u.toUpperCase());return f(["",u])}if("c"===t){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"===t)return t=Sk.builtin.repr(e),k?t.v.substr(0,k):t.v;if("s"===t&&b===Sk.builtin.str){t= +new Sk.builtin.str(e);t=t.$jsstr();if(k)return t.substr(0,k);h&&(t=f([" ",t]));return t}if("b"===t||"s"===t){if(b===Sk.builtin.str)throw new Sk.builtin.ValueError("unsupported format character 'b'");if(!(e instanceof Sk.builtin.bytes)&&void 0===(p=Sk.abstr.lookupSpecial(e,Sk.builtin.str.$bytes)))throw new Sk.builtin.TypeError("%b requires a bytes-like object, or an object that implements __bytes__, not '"+Sk.abstr.typeName(e)+"'");void 0!==p&&(e=new Sk.builtin.bytes(e));t=e.$jsstr();if(k)return t.substr(0, +k);h&&(t=f([" ",t]));return t}if("%"===t)return"%"});return new b(e)};Sk.builtin.str_iter_=function(a){if(!(this instanceof Sk.builtin.str_iter_))return new Sk.builtin.str_iter_(a);this.$index=0;this.$obj=a.v.slice();this.tp$iter=()=>this;a.$hasAstralCodePoints()?(this.sq$length=a.codepoints.length,this.$codepoints=a.codepoints.slice(),this.tp$iternext=function(){if(!(this.$index>=this.sq$length)){var a=new Sk.builtin.str(this.$obj.substring(this.$codepoints[this.$index],this.$codepoints[this.$index+ +1]));this.$index++;return a}}):(this.sq$length=this.$obj.length,this.tp$iternext=function(){if(!(this.$index>=this.sq$length))return new Sk.builtin.str(this.$obj.substr(this.$index++,1))});this.$r=function(){return new Sk.builtin.str("iterator")};return this};Sk.abstr.setUpInheritance("iterator",Sk.builtin.str_iter_,Sk.builtin.object);Sk.builtin.str_iter_.prototype.__class__=Sk.builtin.str_iter_;Sk.builtin.str_iter_.prototype.__iter__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("__iter__", +arguments.length,0,0,!0,!1);return a});Sk.builtin.str_iter_.prototype.next$=function(a){a=a.tp$iternext();if(void 0===a)throw new Sk.builtin.StopIteration;return a};var d={"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,"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,__defineGetter__:!0,__defineSetter__:!0,apply:!0,arguments:!0,call:!0,caller:!0,eval:!0,hasOwnProperty:!0,isPrototypeOf:!0,__lookupGetter__:!0, +__lookupSetter__:!0,__noSuchMethod__:!0,propertyIsEnumerable:!0,prototype:!0,toSource:!0,toLocaleString:!0,toString:!0,unwatch:!0,valueOf:!0,watch:!0,length:!0,name:!0};Sk.builtin.str.reservedWords_=d},function(m,p,a){function b(a){var c=a.replace(/\s+/g,"").toLowerCase();c=n[c];return void 0===c?a:c}function c(a){if(Uint8Array.from)return Uint8Array.from(a);const c=new Uint8Array(a.length);for(let b=0;b<a.length;b++)c[b]=a[b];return c}function d(a,d,f){a=a.$jsstr();d=b(d);if("strict"!==f&&"ignore"!== +f&&"replace"!==f)throw new Sk.builtin.NotImplementedError("'"+f+"' error handling not implemented in Skulpt");if("ascii"===d){d=[];for(e in a){const c=a.charCodeAt(e);if(0>c||127<c){if("strict"===f)throw f=h(c),new Sk.builtin.UnicodeEncodeError("'ascii' codec can't encode character '"+f+"' in position "+e+": ordinal not in range(128)");"replace"===f&&d.push(63)}else d.push(c)}var e=c(d)}else if("utf-8"===d)e=l.encode(a);else throw new Sk.builtin.LookupError("unknown encoding: "+d);return new Sk.builtin.bytes(e)} +function e(a,c,b){Sk.builtin.pyCheckArgsLen("bytes",arguments.length,0,3);let f;var e;if(1<arguments.length){if(!Sk.builtin.checkString(c))throw new Sk.builtin.TypeError("bytes() argument 2 must be str not "+Sk.abstr.typeName(c));if(void 0!==b&&!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("bytes() argument 3 must be str not "+Sk.abstr.typeName(c));if(!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError((void 0!==c?"encoding":"errors")+" without a string argument");}if(void 0===a)return new Sk.builtin.bytes; +if(Sk.builtin.checkString(a)){if(void 0===c)throw new Sk.builtin.TypeError("string argument without an encoding");b=void 0===b?"strict":b.$jsstr();c=c.$jsstr();return d(a,c,b)}if(Sk.builtin.checkInt(a)){f=Sk.builtin.asnum$(a);if(0>f)throw new Sk.builtin.ValueError("negative count");if(f>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.OverflowError("cannot fit 'int' into an index-sized integer");return new Sk.builtin.bytes(f)}if(Sk.builtin.checkBytes(a))return new Sk.builtin.bytes(a.v);if(null!=(e=Sk.abstr.lookupSpecial(a, +Sk.builtin.str.$bytes)))return e=Sk.misceval.callsimOrSuspendArray(e,[a]),Sk.misceval.chain(e,a=>{if(!Sk.builtin.checkBytes(a))throw new Sk.builtin.TypeError("__bytes__ returned non-bytes (type "+Sk.abstr.typeName(a)+")");return a});if(Sk.builtin.checkIterable(a))return f=[],e=Sk.misceval.iterFor(Sk.abstr.iter(a),a=>{if(!Sk.misceval.isIndex(a))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object cannot be interpreted as an integer");a=Sk.misceval.asIndex(a);if(0>a||255<a)throw new Sk.builtin.ValueError("bytes must be in range(0, 256)"); +f.push(a)}),Sk.misceval.chain(e,()=>new Sk.builtin.bytes(f));e="";void 0===a.sk$object&&(e+=", if calling constructor with a javascript object use 'new'");throw new Sk.builtin.TypeError("cannot convert '"+Sk.abstr.typeName(a)+"' object into bytes"+e);}function h(a){var c=265>=a?"\\x":"\\u";a=a.toString(16);3===a.length&&(a=a.slice(1,3));return a=1===a.length?c+"0"+a:c+a}function g(a){return function(c){return c instanceof Sk.builtin.bytes?a(this.$jsstr(),c.$jsstr()):Sk.builtin.NotImplemented.NotImplemented$}} +function f(a,c,b){a=a.v.byteLength;if(void 0===c||c===Sk.builtin.none.none$)c=0;else if(Sk.misceval.isIndex(c))c=Sk.misceval.asIndex(c),c=0<=c?c:a+c,0>c&&(c=0);else throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method");if(void 0===b||Sk.builtin.checkNone(b))b=a;else if(Sk.misceval.isIndex(b))b=Sk.misceval.asIndex(b),b=0<=b?b:a+b,0>b?b=0:b>a&&(b=a);else throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method"); +return{start:c,end:b}}function k(a){return 9<=a&&13>=a||32===a}a(22);const n={utf:"utf-8",utf8:"utf-8","utf-8":"utf-8",ascii:"ascii"},l=new TextEncoder,q=new TextDecoder;Sk.builtin.bytes=function(a,b,d){if(!(this instanceof Sk.builtin.bytes))return e(...arguments);if(void 0===a)this.v=new Uint8Array;else if(a instanceof Uint8Array)this.v=a;else if(Array.isArray(a))Sk.asserts.assert(a.every(a=>0<=a&&256>a),"bad internal call to bytes with array"),this.v=c(a);else if("string"===typeof a){const b=[]; +for(let c in a){var f=a.charCodeAt(c);if(255<f)throw new Sk.builtin.UnicodeDecodeError("invalid string (possibly contains a unicode character)");b.push(f)}this.v=c(b)}else if("number"===typeof a)this.v=new Uint8Array(a);else return f=Sk.misceval.chain(e(...arguments),a=>{this.v=a.v;return this}),Sk.misceval.retryOptionalSuspensionOrThrow(f)};Sk.abstr.setUpInheritance("bytes",Sk.builtin.bytes,Sk.builtin.seqtype);Sk.builtin.bytes.prototype.__class__=Sk.builtin.bytes;Sk.builtin.bytes.prototype.sk$builtinBase= +Sk.builtin.bytes;Sk.builtin.bytes.$strEncode=d;Sk.builtin.bytes.prototype.$jsstr=function(){let a="";for(let c=0;c<this.v.byteLength;c++)a+=String.fromCharCode(this.v[c]);return a};Sk.builtin.bytes.prototype.tp$hash=function(){return Sk.builtin.hash(new Sk.builtin.str(this.$jsstr()))};Sk.builtin.bytes.prototype.$r=function(){let a,c="'";const b=-1!==this.v.indexOf(34);let d="";for(let f=0;f<this.v.byteLength;f++)if(a=this.v[f],9>a||10<a&&13>a||13<a&&32>a||126<a)d+=h(a);else if(9===a||10===a||13=== +a||39===a||92===a)switch(a){case 9:d+="\\t";break;case 10:d+="\\n";break;case 13:d+="\\r";break;case 39:b?d+="\\'":(d+="'",c='"');break;case 92:d+="\\\\"}else d+=String.fromCharCode(a);return new Sk.builtin.str("b"+c+d+c)};Sk.builtin.bytes.prototype.mp$subscript=function(a){if(Sk.misceval.isIndex(a)){var c=Sk.misceval.asIndex(a);if(void 0!==c){0>c&&(c=this.v.byteLength+c);if(0>c||c>=this.v.byteLength)throw new Sk.builtin.IndexError("index out of range");return new Sk.builtin.int_(this.v[c])}}else if(a instanceof +Sk.builtin.slice){var b=[];a.sssiter$(this.v.byteLength,a=>{b.push(this.v[a])});return new Sk.builtin.bytes(b)}throw new Sk.builtin.TypeError("byte indices must be integers, not "+Sk.abstr.typeName(a));};Sk.builtin.bytes.prototype.ob$eq=function(a){if(this===a)return Sk.builtin.bool.true$;if(!(a instanceof Sk.builtin.bytes))return Sk.builtin.NotImplemented.NotImplemented$;if(this.v.byteLength!=a.v.byteLength)return Sk.builtin.bool.false$;for(let c=0;c<this.v.byteLength;c++)if(this.v[c]!=a.v[c])return Sk.builtin.bool.false$; +return Sk.builtin.bool.true$};Sk.builtin.bytes.prototype.ob$ne=function(a){a=this.ob$eq(a);return a===Sk.builtin.NotImplemented.NotImplemented$?a:Sk.misceval.isTrue(a)?Sk.builtin.bool.false$:Sk.builtin.bool.true$};Sk.builtin.bytes.prototype.ob$lt=g((a,c)=>new Sk.builtin.bool(a<c));Sk.builtin.bytes.prototype.ob$le=g((a,c)=>new Sk.builtin.bool(a<=c));Sk.builtin.bytes.prototype.ob$gt=g((a,c)=>new Sk.builtin.bool(a>c));Sk.builtin.bytes.prototype.ob$ge=g((a,c)=>new Sk.builtin.bool(a>=c));Sk.builtin.bytes.prototype.sq$length= +function(){return this.v.byteLength};Sk.builtin.bytes.prototype.sq$concat=function(a){var c;if(!(a instanceof Sk.builtin.bytes))throw new Sk.builtin.TypeError("can't concat "+Sk.abstr.typeName(a)+" to bytes");var b=[];for(c=0;c<this.v.byteLength;c++)b.push(this.v[c]);for(c=0;c<a.v.byteLength;c++)b.push(a.v[c]);return new Sk.builtin.bytes(b)};Sk.builtin.bytes.prototype.nb$add=Sk.builtin.bytes.prototype.sq$concat;Sk.builtin.bytes.prototype.nb$inplace_add=Sk.builtin.bytes.prototype.sq$concat;Sk.builtin.bytes.prototype.sq$repeat= +function(a){var c,b;if(!(a instanceof Sk.builtin.int_))throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '"+Sk.abstr.typeName(a)+"'");var d=[];for(b=0;b<a.v;b++)for(c=0;c<this.v.byteLength;c++)d.push(this.v[c]);return new Sk.builtin.bytes(d)};Sk.builtin.bytes.prototype.nb$multiply=Sk.builtin.bytes.prototype.sq$repeat;Sk.builtin.bytes.prototype.nb$inplace_multiply=Sk.builtin.bytes.prototype.sq$repeat;Sk.builtin.bytes.prototype.sq$contains=function(a){if(Sk.builtin.checkInt(a)){a= +Sk.builtin.asnum$(a);if(0>a||255<a)throw new Sk.builtin.ValueError("byte must be in range(0, 256)");return-1!==this.v.indexOf(a)}if(!(a instanceof Sk.builtin.bytes))throw new Sk.builtin.TypeError("a bytes-like object is required, not "+Sk.abstr.typeName(a));if(0===a.v.byteLength)return!0;if(1===a.v.byteLength)return-1!==this.v.indexOf(a.v[0]);for(var c=0;c<this.v.byteLength;){c=this.v.indexOf(a.v[0],c);if(-1===c)break;let b=!0;for(let d=0;d<a.v.byteLength;d++)if(this.v[c+d]!==a.v[d]){b=!1;break}if(b)return!0; +c+=1}return!1};Sk.builtin.bytes.prototype.nb$remainder=Sk.builtin.str.prototype.nb$remainder;Sk.builtin.bytes.$decode=function(a,c,d){var f;Sk.builtin.pyCheckArgsLen("decode",arguments.length-1,0,2);if(void 0===c)c="utf-8";else if(c instanceof Sk.builtin.str)c=c.v;else throw new Sk.builtin.TypeError("decode() argument 1 must be str, not "+Sk.abstr.typeName(c));c=b(c);if(void 0===d)d="strict";else if(d instanceof Sk.builtin.str)d=d.v;else throw new Sk.builtin.TypeError("decode() argument 2 must be str, not "+ +Sk.abstr.typeName(d));if("strict"!==d&&"ignore"!==d&&"replace"!==d)throw new Sk.builtin.NotImplementedError("'"+d+"' error handling not implemented in Skulpt");if("ascii"!==c&&"utf-8"!==c)throw new Sk.builtin.LookupError("unknown encoding: "+c.v);if("ascii"===c){var e="";for(f=0;f<a.v.byteLength;f++){var g=a.v[f];if(127<g){if("strict"===d)throw g=g.toString(16),new Sk.builtin.UnicodeDecodeError("'ascii' codec can't decode byte 0x"+g+" in position "+f.toString()+": ordinal not in range(128)");"replace"=== +d&&(e+=String.fromCharCode(65533))}else e+=String.fromCharCode(g)}}else{g=q.decode(a.v);if("replace"===d)return new Sk.builtin.str(g);e="";for(f in g)if(65533===g[f].charCodeAt(0)){if("strict"===d)throw g=a.v[f],g=g.toString(16),new Sk.builtin.UnicodeDecodeError("'utf-8' codec can't decode byte 0x"+g+" in position "+f.toString()+": invalid start byte");}else e+=g[f]}return new Sk.builtin.str(e)};Sk.builtin.bytes.prototype.decode=new Sk.builtin.func(Sk.builtin.bytes.$decode);Sk.builtin.bytes.prototype.fromhex= +new Sk.builtin.func(function(a){var c;Sk.builtin.pyCheckArgsLen("fromhex",arguments.length,1,1);if(!(a instanceof Sk.builtin.str))throw new Sk.builtin.TypeError("fromhex() argument must be str, not "+Sk.abstr.typeName(a));var b=[];var d=function(a){return"0123456789abcdefABCDEF".includes(a)?!0:!1};var f=function(a){a=a.charCodeAt(0);return 9===a||10===a||11===a||12===a||13===a||32===a||133===a?!0:!1};for(c=0;c<a.v.length;){var e=a.v.charAt(c);if(d(e))if(c+1<a.v.length)if(d(a.v.charAt(c+1)))e=a.v.slice(c, +c+2),e=parseInt(e,16),b.push(e),c+=2;else throw new Sk.builtin.ValueError("non-hexadecimal number found in fromhex() arg at position "+(c+1).toString());else throw new Sk.builtin.ValueError("non-hexadecimal number found in fromhex() arg at position "+c.toString());else if(f(e))c++;else throw new Sk.builtin.ValueError("non-hexadecimal number found in fromhex() arg at position "+c.toString());}return new Sk.builtin.bytes(b)});Sk.builtin.bytes.prototype.hex=new Sk.builtin.func(function(a){var c;Sk.builtin.pyCheckArgsLen("hex", +arguments.length-1,0,0);var b="";for(c=0;c<a.v.byteLength;c++){var d=a.v[c];d=d.toString(16);1===d.length&&(d="0"+d);b+=d}return new Sk.builtin.str(b)});Sk.builtin.bytes.prototype.count=new Sk.builtin.func(function(a,c,b,d){var e;Sk.builtin.pyCheckArgsLen("count",arguments.length-1,1,3);({start:b,end:d}=f(a,b,d));var g=0;if(c instanceof Sk.builtin.int_)for(e=b;e<d;e++)a.v[e]===c.v&&g++;else if(c instanceof Sk.builtin.bytes)for(e=c.v.byteLength;b<d;){const f=a.find$left(c,b,d);if(-1===f)break;g++; +b=f+e}else throw new Sk.builtin.TypeError("argument should be integer or bytes-like object, not '"+Sk.abstr.typeName(c)+"'");return new Sk.builtin.int_(g)});Sk.builtin.bytes.prototype.endswith=new Sk.builtin.func(function(a,c,b,d){function e(c){const f=c.v.byteLength;if(d-b>=f){for(let b=d-f,e=0;b<d;b++,e++)if(a.v[b]!==c.v[e])return!1;return!0}return!1}Sk.builtin.pyCheckArgsLen("endswith",arguments.length-1,1,3);if(!(c instanceof Sk.builtin.bytes||c instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError("endswith first arg must be bytes or a tuple of bytes, not "+ +Sk.abstr.typeName(c));({start:b,end:d}=f(a,b,d));if(d<b)return Sk.builtin.bool.false$;if(c instanceof Sk.builtin.tuple){for(let a=Sk.abstr.iter(c),b=a.tp$iternext();void 0!==b;b=a.tp$iternext()){if(!(b instanceof Sk.builtin.bytes))throw new Sk.builtin.TypeError("a bytes-like object is required, not '"+Sk.abstr.typeName(b)+"'");if(e(b))return Sk.builtin.bool.true$}return Sk.builtin.bool.false$}return e(c)?Sk.builtin.bool.true$:Sk.builtin.bool.false$});Sk.builtin.bytes.prototype.find$left=function(a, +c,b){let d=-1;({start:c,end:b}=f(this,c,b));if(a instanceof Sk.builtin.int_)for(var e=c;e<b;e++){if(this.v[e]===a.v){d=e;break}}else if(a instanceof Sk.builtin.bytes)for(e=a.v.byteLength;c<b-e+1;c++){let b=!0;for(let d=c,f=0;f<e;d++,f++)if(this.v[d]!==a.v[f]){b=!1;break}if(b){d=c;break}}else throw new Sk.builtin.TypeError("argument should be integer or bytes-like object, not '"+Sk.abstr.typeName(a)+"'");return d};Sk.builtin.bytes.prototype.find$right=function(a,c,b){let d=-1;({start:c,end:b}=f(this, +c,b));if(a instanceof Sk.builtin.int_)for(var e=b-1;e>=c;e--){if(this.v[e]===a.v){d=e;break}}else if(a instanceof Sk.builtin.bytes)for(e=a.v.byteLength,b-=e;b>=c;b--){let c=!0;for(let d=b,f=0;f<e;d++,f++)if(this.v[d]!==a.v[f]){c=!1;break}if(c){d=b;break}}else throw new Sk.builtin.TypeError("argument should be integer or bytes-like object, not '"+Sk.abstr.typeName(a)+"'");return d};Sk.builtin.bytes.prototype.find=new Sk.builtin.func(function(a,c,b,d){Sk.builtin.pyCheckArgsLen("find",arguments.length- +1,1,3);return Sk.builtin.int_(a.find$left(c,b,d))});Sk.builtin.bytes.prototype.index=new Sk.builtin.func(function(a,c,b,d){Sk.builtin.pyCheckArgsLen("index",arguments.length-1,1,3);var f=a.find$left(c,b,d);if(-1===f)throw new Sk.builtin.ValueError("subsection not found");return Sk.builtin.int_(f)});Sk.builtin.bytes.prototype.join=new Sk.builtin.func(function(a,c){var b,d;Sk.builtin.pyCheckArgsLen("join",arguments.length-1,1,1);if(!Sk.builtin.checkIterable(c))throw Sk.builtin.TypeError("can only join an iterable"); +var f=[];var e=[];for(b=0;b<a.v.byteLength;b++)e.push(a.v[b]);b=0;var g=Sk.abstr.iter(c);for(d=g.tp$iternext();void 0!==d;d=g.tp$iternext()){if(!(d instanceof Sk.builtin.bytes))throw new Sk.builtin.TypeError("sequence item "+b.toString()+": expected a bytes-like object, "+Sk.abstr.typeName(d)+" found");0<f.length&&(f=f.concat(e));for(b=0;b<d.v.byteLength;b++)f.push(d.v[b]);b++}return new Sk.builtin.bytes(f)});Sk.builtin.bytes.prototype.maketrans=new Sk.builtin.func(function(){throw new Sk.builtin.NotImplementedError("maketrans() bytes method not implemented in Skulpt"); +});Sk.builtin.bytes.prototype.partition=new Sk.builtin.func(function(a,c){Sk.builtin.pyCheckArgsLen("partition",arguments.length-1,1,1);if(!(c instanceof Sk.builtin.bytes))throw new Sk.builtin.TypeError("a bytes-like object is required, not '"+Sk.abstr.typeName(c)+"'");var b=a.find$left(c);if(-1===b){var d=a;var f=new Sk.builtin.bytes(0);b=new Sk.builtin.bytes(0)}else d=new Sk.builtin.bytes(a.v.subarray(0,b)),f=new Sk.builtin.bytes(a.v.subarray(b,b+c.v.byteLength)),b=new Sk.builtin.bytes(a.v.subarray(b+ +c.v.byteLength,a.v.byteLength));return new Sk.builtin.tuple([d,f,b])});Sk.builtin.bytes.prototype.replace=new Sk.builtin.func(function(a,c,b,d){var f,e;Sk.builtin.pyCheckArgsLen("replace",arguments.length-1,2,3);if(!(c instanceof Sk.builtin.bytes))throw new Sk.builtin.TypeError("a bytes-like object is required, not '"+Sk.abstr.typeName(c)+"'");if(!(b instanceof Sk.builtin.bytes))throw new Sk.builtin.TypeError("a bytes-like object is required, not '"+Sk.abstr.typeName(b)+"'");if(void 0===d)d=-1;else if(d instanceof +Sk.builtin.int_)d=d.v;else throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(d)+"' object cannot be interpreted as an integer");var g=[];var h=[];for(f=0;f<b.v.byteLength;f++)h.push(b.v[f]);var k=c.v.byteLength;for(e=f=0;f<a.v.byteLength&&(-1===d||e<d);){const b=a.find$left(c,f,a.v.byteLength);if(-1===b)break;for(;f<b;f++)g.push(a.v[f]);g=g.concat(h);f=b+k;e++}for(k=f;k<a.v.byteLength;k++)g.push(a.v[k]);return new Sk.builtin.bytes(g)});Sk.builtin.bytes.prototype.rfind=new Sk.builtin.func(function(a, +c,b,d){Sk.builtin.pyCheckArgsLen("rfind",arguments.length-1,1,3);return Sk.builtin.int_(a.find$right(c,b,d))});Sk.builtin.bytes.prototype.rindex=new Sk.builtin.func(function(a,c,b,d){Sk.builtin.pyCheckArgsLen("rindex",arguments.length-1,1,3);var f=a.find$right(c,b,d);if(-1===f)throw new Sk.builtin.ValueError("subsection not found");return Sk.builtin.int_(f)});Sk.builtin.bytes.prototype.rpartition=new Sk.builtin.func(function(a,c){Sk.builtin.pyCheckArgsLen("rpartition",arguments.length-1,1,1);if(!(c instanceof +Sk.builtin.bytes))throw new Sk.builtin.TypeError("a bytes-like object is required, not '"+Sk.abstr.typeName(c)+"'");var b=a.find$right(c);if(-1===b){var d=new Sk.builtin.bytes(0);var f=new Sk.builtin.bytes(0);return new Sk.builtin.tuple([d,f,a])}d=new Sk.builtin.bytes(a.v.subarray(0,b));f=new Sk.builtin.bytes(a.v.subarray(b,b+c.v.byteLength));b=new Sk.builtin.bytes(a.v.subarray(b+c.v.byteLength,a.v.byteLength));return new Sk.builtin.tuple([d,f,b])});Sk.builtin.bytes.prototype.startswith=new Sk.builtin.func(function(a, +c,b,d){function e(c){const f=c.v.byteLength;if(b+f<=d){for(let d=b,e=0;e<f;d++,e++)if(a.v[d]!==c.v[e])return!1;return!0}return!1}Sk.builtin.pyCheckArgsLen("startswith",arguments.length-1,1,3);if(!(c instanceof Sk.builtin.bytes||c instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError("startswith first arg must be bytes or a tuple of bytes, not "+Sk.abstr.typeName(c));({start:b,end:d}=f(a,b,d));if(d<b)return Sk.builtin.bool.false$;if(c instanceof Sk.builtin.tuple){for(let a=Sk.abstr.iter(c),b= +a.tp$iternext();void 0!==b;b=a.tp$iternext()){if(!(b instanceof Sk.builtin.bytes))throw new Sk.builtin.TypeError("a bytes-like object is required, not '"+Sk.abstr.typeName(b)+"'");if(e(b))return Sk.builtin.bool.true$}return Sk.builtin.bool.false$}return e(c)?Sk.builtin.bool.true$:Sk.builtin.bool.false$});Sk.builtin.bytes.prototype.translate=new Sk.builtin.func(function(){throw new Sk.builtin.NotImplementedError("translate() bytes method not implemented in Skulpt");});Sk.builtin.bytes.prototype.center= +new Sk.builtin.func(function(a,c,b){Sk.builtin.pyCheckArgsLen("center",arguments.length-1,1,2);if(void 0===b)b=32;else if(b instanceof Sk.builtin.bytes&&1==b.v.byteLength)b=b.v[0];else throw new Sk.builtin.TypeError("center() argument 2 must be a byte string of length 1, not "+Sk.abstr.typeName(b));if(c instanceof Sk.builtin.int_)c=c.v;else throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(c)+"' object cannot be interpreted as an integer");if(c<=a.v.byteLength)return a;var d=[];var f=c-a.v.byteLength; +if(f%2){var e=f/2-.5;var g=f/2+.5}else g=e=f/2;for(f=0;f<e;f++)d.push(b);for(f=0;f<a.v.byteLength;f++)d.push(a.v[f]);for(f=0;f<g;f++)d.push(b);return new Sk.builtin.bytes(d)});Sk.builtin.bytes.prototype.ljust=new Sk.builtin.func(function(a,c,b){var d;Sk.builtin.pyCheckArgsLen("ljust",arguments.length-1,1,2);if(void 0===b)b=32;else if(b instanceof Sk.builtin.bytes&&1==b.v.byteLength)b=b.v[0];else throw new Sk.builtin.TypeError("ljust() argument 2 must be a byte string of length 1, not "+Sk.abstr.typeName(b)); +if(c instanceof Sk.builtin.int_)c=c.v;else throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(c)+"' object cannot be interpreted as an integer");if(c<=a.v.byteLength)return a;var f=[];for(d=0;d<a.v.byteLength;d++)f.push(a.v[d]);for(d=0;d<c-a.v.byteLength;d++)f.push(b);return new Sk.builtin.bytes(f)});Sk.builtin.bytes.prototype.left$strip=function(a){var c;if(void 0===a||a===Sk.builtin.none.none$)var b=[9,10,11,12,13,32,133];else if(a instanceof Sk.builtin.bytes)for(b=[],c=0;c<a.v.byteLength;c++)b.push(a.v[c]); +else throw new Sk.builtin.TypeError("a bytes-like object is required, not '"+Sk.abstr.typeName(a)+"'");a=[];for(c=0;c<this.v.byteLength;)if(b.includes(this.v[c]))c++;else break;for(b=c;b<this.v.byteLength;b++)a.push(this.v[b]);return new Sk.builtin.bytes(a)};Sk.builtin.bytes.prototype.lstrip=new Sk.builtin.func(function(a,c){Sk.builtin.pyCheckArgsLen("lstrip",arguments.length-1,0,1);return a.left$strip(c)});Sk.builtin.bytes.prototype.rjust=new Sk.builtin.func(function(a,c,b){var d;Sk.builtin.pyCheckArgsLen("rjust", +arguments.length-1,1,2);if(void 0===b)b=32;else if(b instanceof Sk.builtin.bytes&&1==b.v.byteLength)b=b.v[0];else throw new Sk.builtin.TypeError("rjust() argument 2 must be a byte string of length 1, not "+Sk.abstr.typeName(b));if(c instanceof Sk.builtin.int_)c=c.v;else throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(c)+"' object cannot be interpreted as an integer");if(c<=a.v.byteLength)return a;var f=[];for(d=0;d<c-a.v.byteLength;d++)f.push(b);for(d=0;d<a.v.byteLength;d++)f.push(a.v[d]);return new Sk.builtin.bytes(f)}); +Sk.builtin.bytes.prototype.rsplit=new Sk.builtin.func(function(a,c,b){Sk.builtin.pyCheckArgsLen("rsplit",arguments.length,1,3);if(void 0===c||c===Sk.builtin.none.none$)c=null;if(null!==c&&!(c instanceof Sk.builtin.bytes))throw new Sk.builtin.TypeError("expected bytes");if(null!==c&&0==c.v.byteLength)throw new Sk.builtin.ValueError("empty separator");if(void 0!==b&&!Sk.builtin.checkInt(b))throw new Sk.builtin.TypeError("an integer is required");b=void 0===b?-1:Sk.builtin.asnum$(b);let d=[],f=0;if(c){for(var e= +a.v.byteLength;0<=e;){var g=a.find$right(c,0,e);if(-1===g)break;d.push(new Sk.builtin.bytes(a.v.subarray(g+c.v.byteLength,e)));e=g;f++;if(-1<b&&f>=b)break}d.push(new Sk.builtin.bytes(a.v.subarray(0,e)))}else{for(e=a.v.byteLength-1;-1===b||f<b;){for(;0<=e&&k(a.v[e]);)e--;if(0>e)break;g=e+1;for(e--;0<=e&&!k(a.v[e]);)e--;d.push(new Sk.builtin.bytes(a.v.subarray(e+1,g)));f++}if(0<=e){for(;0<=e&&k(a.v[e]);)e--;0<=e&&d.push(new Sk.builtin.bytes(a.v.subarray(0,e+1)))}}return new Sk.builtin.list(d.reverse())}); +Sk.builtin.bytes.prototype.right$strip=function(a){var c;if(void 0===a||a===Sk.builtin.none.none$)var b=[9,10,11,12,13,32,133];else if(a instanceof Sk.builtin.bytes)for(b=[],c=0;c<a.v.byteLength;c++)b.push(a.v[c]);else throw new Sk.builtin.TypeError("a bytes-like object is required, not '"+Sk.abstr.typeName(a)+"'");a=[];for(c=this.v.byteLength-1;-1<c;)if(b.includes(this.v[c]))c--;else break;for(b=0;b<=c;b++)a.push(this.v[b]);return new Sk.builtin.bytes(a)};Sk.builtin.bytes.prototype.rstrip=new Sk.builtin.func(function(a, +c){Sk.builtin.pyCheckArgsLen("rstrip",arguments.length-1,0,1);return a.right$strip(c)});Sk.builtin.bytes.prototype.split=new Sk.builtin.func(function(a,c,b){Sk.builtin.pyCheckArgsLen("split",arguments.length,1,3);if(void 0===c||c===Sk.builtin.none.none$)c=null;if(null!==c&&!(c instanceof Sk.builtin.bytes))throw new Sk.builtin.TypeError("expected bytes");if(null!==c&&0==c.v.byteLength)throw new Sk.builtin.ValueError("empty separator");if(void 0!==b&&!Sk.builtin.checkInt(b))throw new Sk.builtin.TypeError("an integer is required"); +b=void 0===b?-1:Sk.builtin.asnum$(b);let d=[],f=0,e=0;if(c){for(;e<a.v.byteLength;){var g=a.find$left(c,e);if(-1===g)break;d.push(new Sk.builtin.bytes(a.v.subarray(e,g)));e=g+c.v.byteLength;f++;if(-1<b&&f>=b)break}d.push(new Sk.builtin.bytes(a.v.subarray(e,a.v.byteLength)))}else{g=0;let c=a.v.byteLength;for(;-1===b||f<b;){for(;g<c&&k(a.v[g]);)g++;if(g==c)break;e=g;for(g++;g<c&&!k(a.v[g]);)g++;d.push(new Sk.builtin.bytes(a.v.subarray(e,g)));f++}if(g<c){for(;g<c&&k(a.v[g]);)g++;g<c&&d.push(new Sk.builtin.bytes(a.v.subarray(g, +c)))}}return new Sk.builtin.list(d)});Sk.builtin.bytes.prototype.strip=new Sk.builtin.func(function(a,c){Sk.builtin.pyCheckArgsLen("strip",arguments.length-1,0,1);return a.left$strip(c).right$strip(c)});Sk.builtin.bytes.prototype.capitalize=new Sk.builtin.func(function(a){var c;Sk.builtin.pyCheckArgsLen("capitalize",arguments.length-1,0,0);if(0===a.v.byteLength)return new Sk.builtin.bytes(0);var b=[];var d=97<=a.v[0]&&122>=a.v[0]?a.v[0]-32:a.v[0];b.push(d);for(c=1;c<a.v.byteLength;c++)d=a.v[c],65<= +d&&90>=d&&(d+=32),b.push(d);return new Sk.builtin.bytes(b)});Sk.builtin.bytes.prototype.expandtabs=new Sk.builtin.func(function(a,c){Sk.builtin.pyCheckArgsLen("expandtabs",arguments.length,1,2);if(void 0!==c&&!Sk.builtin.checkInt(c))throw new Sk.builtin.TypeError("integer argument exepected, got "+Sk.abstr.typeName(c));c=void 0===c?8:Sk.builtin.asnum$(c);let b=[],d=0;for(let f=0;f<a.v.byteLength;f++)if(9===a.v[f]){let a=c-d%c;b=b.concat(Array(a).fill(32));d+=a}else 10===a.v[f]||13===a.v[f]?(b.push(a.v[f]), +d=0):(b.push(a.v[f]),d++);return new Sk.builtin.bytes(b)});Sk.builtin.bytes.prototype.isalnum=new Sk.builtin.func(function(a){var c;Sk.builtin.pyCheckArgsLen("isalnum",arguments.length-1,0,0);if(0===a.v.byteLength)return Sk.builtin.bool.false$;for(c=0;c<a.v.byteLength;c++){var b=a.v[c];if(!(48<=b&&57>=b||65<=b&&90>=b||97<=b&&122>=b))return Sk.builtin.bool.false$}return Sk.builtin.bool.true$});Sk.builtin.bytes.prototype.isalpha=new Sk.builtin.func(function(a){var c;Sk.builtin.pyCheckArgsLen("isalpha", +arguments.length-1,0,0);if(0===a.v.byteLength)return Sk.builtin.bool.false$;for(c=0;c<a.v.byteLength;c++){var b=a.v[c];if(!(65<=b&&90>=b||97<=b&&122>=b))return Sk.builtin.bool.false$}return Sk.builtin.bool.true$});Sk.builtin.bytes.prototype.isascii=new Sk.builtin.func(function(a){var c;Sk.builtin.pyCheckArgsLen("isascii",arguments.length-1,0,0);for(c=0;c<a.v.byteLength;c++){var b=a.v[c];if(!(0<=b&&128>b))return Sk.builtin.bool.false$}return Sk.builtin.bool.true$});Sk.builtin.bytes.prototype.isdigit= +new Sk.builtin.func(function(a){var c;Sk.builtin.pyCheckArgsLen("isdigit",arguments.length-1,0,0);if(0===a.v.byteLength)return Sk.builtin.bool.false$;for(c=0;c<a.v.byteLength;c++){var b=a.v[c];if(!(48<=b&&58>b))return Sk.builtin.bool.false$}return Sk.builtin.bool.true$});Sk.builtin.bytes.prototype.islower=new Sk.builtin.func(function(a){var c,b;Sk.builtin.pyCheckArgsLen("islower",arguments.length-1,0,0);for(c=0;c<a.v.byteLength;c++){var d=a.v[c];if(65<=d&&90>=d)return Sk.builtin.bool.false$;!b&&97<= +d&&122>=d&&(b=!0)}return b?Sk.builtin.bool.true$:Sk.builtin.bool.false$});Sk.builtin.bytes.prototype.isspace=new Sk.builtin.func(function(a){var c;Sk.builtin.pyCheckArgsLen("isspace",arguments.length-1,0,0);if(0===a.v.byteLength)return Sk.builtin.bool.false$;for(c=0;c<a.v.byteLength;c++){var b=a.v[c];if(32!==b&&9!==b&&10!==b&&13!==b&&11!==b&&12!==b)return Sk.builtin.bool.false$}return Sk.builtin.bool.true$});Sk.builtin.bytes.prototype.istitle=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("istitle", +arguments.length-1,0,0);if(0===a.v.byteLength)return Sk.builtin.bool.false$;let c=!1,b=!1;for(let d=0;d<a.v.byteLength;d++){const f=a.v[d];if(65<=f&&90>=f){if(c)return Sk.builtin.bool.false$;b=c=!0}else if(97<=f&&122>=f){if(!c)return Sk.builtin.bool.false$;b=!0}else c=!1}return b?Sk.builtin.bool.true$:Sk.builtin.bool.false$});Sk.builtin.bytes.prototype.isupper=new Sk.builtin.func(function(a){var c,b;Sk.builtin.pyCheckArgsLen("isupper",arguments.length-1,0,0);for(c=0;c<a.v.byteLength;c++){var d=a.v[c]; +!b&&65<=d&&90>=d&&(b=!0);if(97<=d&&122>=d)return Sk.builtin.bool.false$}return b?Sk.builtin.bool.true$:Sk.builtin.bool.false$});Sk.builtin.bytes.prototype.lower=new Sk.builtin.func(function(a){var c;Sk.builtin.pyCheckArgsLen("lower",arguments.length-1,0,0);var b=[];for(c=0;c<a.v.byteLength;c++){var d=a.v[c];65<=d&&90>=d&&(d+=32);b.push(d)}return new Sk.builtin.bytes(b)});Sk.builtin.bytes.prototype.splitlines=new Sk.builtin.func(function(a,c){Sk.builtin.pyCheckArgsLen("splitlines",arguments.length, +1,2);if(void 0!==c&&!Sk.builtin.checkBool(c))throw new Sk.builtin.TypeError("boolean argument expected, got "+Sk.abstr.typeName(c));c=void 0===c?!1:c.v;let b=[],d=0;let f=0;for(;f<a.v.byteLength;){var e=a.v[f];if(13===e){let g=!1;f<a.v.byteLength-1&&10===a.v[f+1]&&(g=!0);e=c?g?f+2:f+1:f;b.push(new Sk.builtin.bytes(a.v.subarray(d,e)));f=d=g?f+2:f+1}else 10===e?(e=c?f+1:f,b.push(new Sk.builtin.bytes(a.v.subarray(d,e))),f=d=f+1):f++}d<a.v.byteLength&&b.push(new Sk.builtin.bytes(a.v.subarray(d,a.v.byteLength))); +return new Sk.builtin.list(b)});Sk.builtin.bytes.prototype.swapcase=new Sk.builtin.func(function(a){var c;Sk.builtin.pyCheckArgsLen("swapcase",arguments.length-1,0,0);var b=[];for(c=0;c<a.v.byteLength;c++){var d=a.v[c];65<=d&&90>=d?d+=32:97<=d&&122>=d&&(d-=32);b.push(d)}return new Sk.builtin.bytes(b)});Sk.builtin.bytes.prototype.title=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("title",arguments.length-1,0,0);if(0===a.v.byteLength)return new Sk.builtin.bytes(0);let c=[],b=!1;for(let d= +0;d<a.v.byteLength;d++){const f=a.v[d];65<=f&&90>=f?b?c.push(f+32):(b=!0,c.push(f)):97<=f&&122>=f?b?c.push(f):(b=!0,c.push(f-32)):(b=!1,c.push(f))}return new Sk.builtin.bytes(c)});Sk.builtin.bytes.prototype.upper=new Sk.builtin.func(function(a){var c;Sk.builtin.pyCheckArgsLen("upper",arguments.length-1,0,0);var b=[];for(c=0;c<a.v.byteLength;c++){var d=a.v[c];97<=d&&122>=d&&(d-=32);b.push(d)}return new Sk.builtin.bytes(b)});Sk.builtin.bytes.prototype.zfill=new Sk.builtin.func(function(a,c){var b;Sk.builtin.pyCheckArgsLen("zfill", +arguments.length-1,1,1);if(!(c instanceof Sk.builtin.int_))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(c)+"' object cannot be interpreted as an integer");if(c.v<=a.v.byteLength)return a;var d=[];var f=c.v-a.v.byteLength;if(43===a.v[0]||45===a.v[0]){var e=a.v[0];d.push(e);for(b=0;b<f;b++)d.push(48);b=1}else{for(b=0;b<f;b++)d.push(48);b=0}for(;b<a.v.byteLength;b++)e=a.v[b],d.push(e);return new Sk.builtin.bytes(d)});Sk.builtin.bytes.prototype.__iter__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("__iter__", +arguments.length,0,0,!0,!1);return new Sk.builtin.bytes_iter_(a)});Sk.builtin.bytes.prototype.tp$iter=function(){return new Sk.builtin.bytes_iter_(this)};Sk.builtin.bytes_iter_=function(a){if(!(this instanceof Sk.builtin.bytes_iter_))return new Sk.builtin.bytes_iter_(a);this.$index=0;this.sq$length=a.v.byteLength;this.tp$iter=()=>this;this.tp$iternext=function(){if(!(this.$index>=this.sq$length))return new Sk.builtin.int_(a.v[this.$index++])};this.$r=function(){return new Sk.builtin.str("bytesiterator")}; +return this};Sk.abstr.setUpInheritance("bytesiterator",Sk.builtin.bytes_iter_,Sk.builtin.object);Sk.builtin.bytes_iter_.prototype.__class__=Sk.builtin.bytes_iter_;Sk.builtin.bytes_iter_.prototype.__iter__=new Sk.builtin.func(function(a){return a});Sk.builtin.bytes_iter_.prototype.next$=function(a){a=a.tp$iternext();if(void 0===a)throw new Sk.builtin.StopIteration;return a};Sk.exportSymbol("Sk.builtin.bytes",Sk.builtin.bytes)},function(m,p,a){(function(a){(function(a){function c(){}function b(){}var h= +String.fromCharCode,g={}.toString,f=g.call(a.SharedArrayBuffer),k=g(),n=a.Uint8Array,l=n||Array,q=n?ArrayBuffer:l,m=q.isView||function(a){return a&&"length"in a},z=g.call(q.prototype);q=b.prototype;var p=a.TextEncoder,t=new (n?Uint16Array:l)(32);c.prototype.decode=function(a){if(!m(a)){var c=g.call(a);if(c!==z&&c!==f&&c!==k)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");a=n?new l(a):a||[]}for(var b=c="",d=0,e=a.length| +0,q=e-32|0,u,p,y=0,H=0,S,R=0,V=-1;d<e;){for(u=d<=q?32:e-d|0;R<u;d=d+1|0,R=R+1|0){p=a[d]&255;switch(p>>4){case 15:S=a[d=d+1|0]&255;if(2!==S>>6||247<p){d=d-1|0;break}y=(p&7)<<6|S&63;H=5;p=256;case 14:S=a[d=d+1|0]&255,y<<=6,y|=(p&15)<<6|S&63,H=2===S>>6?H+4|0:24,p=p+256&768;case 13:case 12:S=a[d=d+1|0]&255,y<<=6,y|=(p&31)<<6|S&63,H=H+7|0,d<e&&2===S>>6&&y>>H&&1114112>y?(p=y,y=y-65536|0,0<=y&&(V=(y>>10)+55296|0,p=(y&1023)+56320|0,31>R?(t[R]=V,R=R+1|0,V=-1):(S=V,V=p,p=S))):(p>>=8,d=d-p-1|0,p=65533),y=H= +0,u=d<=q?32:e-d|0;default:t[R]=p;continue;case 11:case 10:case 9:case 8:}t[R]=65533}b+=h(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15],t[16],t[17],t[18],t[19],t[20],t[21],t[22],t[23],t[24],t[25],t[26],t[27],t[28],t[29],t[30],t[31]);32>R&&(b=b.slice(0,R-32|0));if(d<e){if(t[0]=V,R=~V>>>31,V=-1,b.length<c.length)continue}else-1!==V&&(b+=h(V));c+=b;b=""}return c};q.encode=function(a){a=void 0===a?"":""+a;var c=a.length|0,b=new l((c<<1)+8|0),d,f=0,e=!n;for(d=0;d< +c;d=d+1|0,f=f+1|0){var g=a.charCodeAt(d)|0;if(127>=g)b[f]=g;else{if(2047>=g)b[f]=192|g>>6;else{a:{if(55296<=g)if(56319>=g){var h=a.charCodeAt(d=d+1|0)|0;if(56320<=h&&57343>=h){g=(g<<10)+h-56613888|0;if(65535<g){b[f]=240|g>>18;b[f=f+1|0]=128|g>>12&63;b[f=f+1|0]=128|g>>6&63;b[f=f+1|0]=128|g&63;continue}break a}g=65533}else 57343>=g&&(g=65533);!e&&d<<1<f&&d<<1<(f-7|0)&&(e=!0,h=new l(3*c),h.set(b),b=h)}b[f]=224|g>>12;b[f=f+1|0]=128|g>>6&63}b[f=f+1|0]=128|g&63}}return n?b.subarray(0,f):b.slice(0,f)};p|| +(a.TextDecoder=c,a.TextEncoder=b)})("undefined"==typeof a?"undefined"==typeof self?this:self:a)}).call(this,a(0))},function(m,p){const a=/^(?:(.)?([<>=\^]))?([\+\-\s])?(#)?(0)?(\d+)?(,)?(?:\.(\d+))?([bcdeEfFgGnosxX%])?$/;Sk.formatting={};let b=function(a,c,b,d){Sk.asserts.assert("string"===typeof c);if(a[6]){var f=parseInt(a[6],10);d=a[2]||(a[5]?"=":d?">":"<");let e=f-(c.length+(b?b.length:0));if(0>=e)return c;f=(a[1]||(a[5]?"0":" ")).repeat(e);switch(d){case "=":if("s"===a[9])throw new Sk.builtin.ValueError("'=' alignment not allowed in string format specifier"); +return b+f+c;case ">":return f+b+c;case "<":return b+c+f;case "^":return a=Math.floor(e/2),f.substring(0,a)+b+c+f.substring(a)}}return b+c},c=function(a,c){return c?"-":"+"===a[3]?"+":" "===a[3]?" ":""},d=function(a,d,f){Sk.asserts.assert(d instanceof Sk.builtin.int_||d instanceof Sk.builtin.lng);if(a[8])throw new Sk.builtin.ValueError("Precision not allowed in integer format");let e=d.str$(f,!1);d=d.nb$isnegative();d=c(a,d);a[4]&&(16===f?d+="0x":8===f?d+="0o":2===f&&(d+="0b"));"X"===a[9]&&(e=e.toUpperCase()); +"n"===a[9]?e=(+e).toLocaleString():a[7]&&(f=e.toString().split("."),f[0]=f[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),e=f.join("."));return b(a,e,d,!0)},e=function(e,g,f){if(!g)return e.str$(10,!0);g=g.match(a);if(!g)throw new Sk.builtin.ValueError("Invalid format specifier");var k=g[9];k||(k=f?"g":"d");if(-1==(f?"fFeEgG%":"bcdoxXnfFeEgG%").indexOf(k))throw new Sk.builtin.ValueError("Unknown format code '"+g[9]+"' for object of type '"+Sk.abstr.typeName(e)+"'");switch(k){case "d":case "n":return d(g, +e,10);case "x":case "X":return d(g,e,16);case "o":return d(g,e,8);case "b":return d(g,e,2);case "c":if(g[3])throw new Sk.builtin.ValueError("Sign not allowed with integer format specifier 'c'");if(g[4])throw new Sk.builtin.ValueError("Alternate form not allowed with integer format specifier 'c'");if(g[7])throw new Sk.builtin.ValueError("Cannot specify ',' with 'c'");if(g[8])throw new Sk.builtin.ValueError("Cannot specify ',' with 'c'");return b(g,String.fromCodePoint(Sk.builtin.asnum$(e)),"",!0); +case "f":case "F":case "e":case "E":case "g":case "G":{if(g[4])throw new Sk.builtin.ValueError("Alternate form (#) not allowed in float format specifier");f=Sk.builtin.asnum$(e);"string"===typeof f&&(f=Number(f));if(Infinity===f)return b(g,"inf","",!0);if(-Infinity===f)return b(g,"inf","-",!0);if(isNaN(f))return b(g,"nan","",!0);e=!1;0>f&&(f=-f,e=!0);let a=["toExponential","toFixed","toPrecision"]["efg".indexOf(k.toLowerCase())],d=g[8]?parseInt(g[8],10):6;f=f[a](d);-1!=="EFG".indexOf(k)&&(f=f.toUpperCase()); +if("g"===k.toLowerCase()||!g[9]){if(k=f.match(/\.(\d*[1-9])?(0+)$/)){let [,a,c]=k;f=f.slice(0,a?-c.length:-(c.length+1))}-1!=f.indexOf(".")||g[9]||(f+=".0")}g[7]&&(k=f.toString().split("."),k[0]=k[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),f=k.join("."));return b(g,f,c(g,e),!0)}case "%":if(g[4])throw new Sk.builtin.ValueError("Alternate form (#) not allowed with format specifier '%'");e=Sk.builtin.asnum$(e);"string"===typeof e&&(e=Number(e));if(Infinity===e)return b(g,"inf%","",!0);if(-Infinity===e)return b(g, +"inf%","-",!0);if(isNaN(e))return b(g,"nan%","",!0);k=!1;0>e&&(e=-e,k=!0);f=g[8]?parseInt(g[8],10):6;e=(100*e).toFixed(f)+"%";return b(g,e,c(g,k),!0);default:throw new Sk.builtin.ValueError("Unknown format code '"+g[9]+"'");}};Sk.formatting.mkNumber__format__=a=>new Sk.builtin.func(function(c,b){Sk.builtin.pyCheckArgsLen("__format__",arguments.length,2,2);if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("format() argument 2 must be str, not "+Sk.abstr.typeName(b));return new Sk.builtin.str(e(c, +b.$jsstr(),a))});m=function(a){var c={};Sk.builtin.pyCheckArgsLen("format",arguments.length,0,Infinity,!0,!0);var b=new Sk.builtins.tuple(Array.prototype.slice.call(arguments,1));var d=new Sk.builtins.dict(a);if(void 0===arguments[1])return b.v;var e=0;if(0!==d.size){let a,b,f;a=d.tp$iter();for(b=a.tp$iternext();void 0!==b;b=a.tp$iternext())f=d.mp$lookup(b),c[b.v]=f}for(var h in b.v)"0"!==h&&(c[h-1]=b.v[h]);b=b.v[0].v.replace(/{(((?:\d+)|(?:\w+))?((?:\.(\w+))|(?:\[((?:\d+)|(?:\w+))\])?))?(?:!([rs]))?(?::([^}]*))?}/g, +function(a,b,d,f,g,h,k,l,n,m){let q;if(void 0!==h&&""!==h)a=c[d],q=a.constructor===Array?a[h]:/^\d+$/.test(h)?Sk.abstr.objectGetItem(a,new Sk.builtin.int_(parseInt(h,10)),!1):Sk.abstr.objectGetItem(a,new Sk.builtin.str(h),!1),e++;else if(void 0!==g&&""!==g)q=Sk.abstr.gattr(c[d||e++],new Sk.builtin.str(g));else if(void 0!==d&&""!==d)q=c[d];else if(void 0===b||""===b)q=c[e],e++;else if(b instanceof Sk.builtin.int_||b instanceof Sk.builtin.float_||b instanceof Sk.builtin.lng||/^\d+$/.test(b))q=c[b], +e++;if("s"===k)q=new Sk.builtin.str(q);else if("r"===k)q=Sk.builtin.repr(q);else if(""!==k&&void 0!==k)throw new Sk.builtin.ValueError("Unknown conversion specifier "+k);return Sk.abstr.objectFormat(q,new Sk.builtin.str(l)).$jsstr()});return new Sk.builtin.str(b)};m.co_kwargs=!0;Sk.builtin.str.prototype.format=new Sk.builtin.func(m);Sk.builtin.str.prototype.__format__=new Sk.builtin.func(function(c,d){Sk.builtin.pyCheckArgsLen("__format__",arguments.length,2,2);if(!Sk.builtin.checkString(d))throw new Sk.builtin.TypeError("format() argument 2 must be str, not "+ +Sk.abstr.typeName(d));let f=d.$jsstr().match(a);if(f[9]&&"s"!==f[9])throw new Sk.builtin.ValueError("Unknown format code '"+f[9]+"' for object of type 'str'");if(f[3])throw new Sk.builtin.ValueError("Sign not allowed in string format specifier");if(f[4])throw new Sk.builtin.ValueError("Alternate form (#) not allowed with string format specifier");if(f[7])throw new Sk.builtin.ValueError("Cannot specify ',' with 's'");let e=c.v;f[8]&&(e=e.substring(0,f[8]));return new Sk.builtin.str(b(f,e,"",!1))})}, +function(m,p){Sk.builtin.tuple=function(a,b){if(!(this instanceof Sk.builtin.tuple))return Sk.builtin.pyCheckArgsLen("tuple",arguments.length,0,1),new Sk.builtin.tuple(a,!0);if(void 0===a)this.v=[];else if(Array.isArray(a))this.v=a;else return Sk.misceval.chain(Sk.misceval.arrayFromIterable(a,b),a=>{this.v=a;return this})};Sk.abstr.setUpInheritance("tuple",Sk.builtin.tuple,Sk.builtin.seqtype);Sk.builtin.tuple.prototype.__class__=Sk.builtin.tuple;Sk.builtin.tuple.prototype.sk$asarray=function(){return this.v.slice(0)}; +Sk.builtin.tuple.prototype.$r=function(){var a;if(0===this.v.length)return new Sk.builtin.str("()");var 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){let b;if(Sk.misceval.isIndex(a)){b=Sk.misceval.asIndex(a);if("number"!==typeof b)throw new Sk.builtin.IndexError("cannot fit '"+Sk.abstr.typeName(a)+"' into an index-sized integer");if(void 0!== +b){0>b&&(b=this.v.length+b);if(0>b||b>=this.v.length)throw new Sk.builtin.IndexError("tuple index out of range");return this.v[b]}}else if(a instanceof Sk.builtin.slice){const c=[];a.sssiter$(this.v.length,a=>{c.push(this.v[a])});return new Sk.builtin.tuple(c)}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=1000003,c=3430008,d=this.v.length;for(a=0;a<d;++a){var e=Sk.builtin.hash(this.v[a]).v;if(-1=== +e)return new Sk.builtin.int_(-1);c=(c^e)*b;b+=82520+d+d}c+=97531;-1===c&&(c=-2);return new Sk.builtin.int_(c|0)};Sk.builtin.tuple.prototype.sq$repeat=function(a){if(!Sk.misceval.isIndex(a))throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '"+Sk.abstr.typeName(a)+"'");var b=Sk.misceval.asIndex(a);if("number"!==typeof b)throw new Sk.builtin.OverflowError("cannot fit '"+Sk.abstr.typeName(a)+"' into an index-sized integer");var c=[];for(a=0;a<b;++a)c.push.apply(c,this.v);return new Sk.builtin.tuple(c)}; +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.__iter__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("__iter__",arguments.length,1,1);return new Sk.builtin.tuple_iter_(a)});Sk.builtin.tuple.prototype.tp$iter=function(){return new Sk.builtin.tuple_iter_(this)};Sk.builtin.tuple.prototype.tp$richcompare=function(a,b){var c;if(!a.__class__||!Sk.misceval.isTrue(Sk.builtin.isinstance(a, +Sk.builtin.tuple)))return"Eq"===b?!1:"NotEq"===b?!0:Sk.__future__.python3?Sk.builtin.NotImplemented.NotImplemented$:!1;var d=this.v;a=a.v;var e=d.length;var h=a.length;for(c=0;c<e&&c<h;++c){var g=Sk.misceval.richCompareBool(d[c],a[c],"Eq");if(!g)break}if(c>=e||c>=h)switch(b){case "Lt":return e<h;case "LtE":return e<=h;case "Eq":return e===h;case "NotEq":return e!==h;case "Gt":return e>h;case "GtE":return e>=h;default:Sk.asserts.fail()}return"Eq"===b?!1:"NotEq"===b?!0:Sk.misceval.richCompareBool(d[c], +a[c],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=this.v;for(b=0;b<c.length;b++)if(Sk.misceval.richCompareBool(c[b],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=a.v.length,d=a.v;for(a=0;a<c;++a)if(Sk.misceval.richCompareBool(d[a],b,"Eq"))return new Sk.builtin.int_(a);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=a.v.length,d=a.v,e=0;for(a=0;a<c;++a)Sk.misceval.richCompareBool(d[a],b, +"Eq")&&(e+=1);return new Sk.builtin.int_(e)});Sk.exportSymbol("Sk.builtin.tuple",Sk.builtin.tuple);Sk.builtin.tuple_iter_=function(a){if(!(this instanceof Sk.builtin.tuple_iter_))return new Sk.builtin.tuple_iter_(a);this.$index=0;this.$obj=a.v.slice();this.sq$length=this.$obj.length;this.tp$iter=()=>this;this.tp$iternext=function(){if(!(this.$index>=this.sq$length))return this.$obj[this.$index++]};this.$r=function(){return new Sk.builtin.str("tupleiterator")};return this};Sk.abstr.setUpInheritance("tupleiterator", +Sk.builtin.tuple_iter_,Sk.builtin.object);Sk.builtin.tuple_iter_.prototype.__class__=Sk.builtin.tuple_iter_;Sk.builtin.tuple_iter_.prototype.__iter__=new Sk.builtin.func(function(a){return a});Sk.builtin.tuple_iter_.prototype.next$=function(a){a=a.tp$iternext();if(void 0===a)throw new Sk.builtin.StopIteration;return a}},function(m,p){function a(a){let c=a.$savedKeyHash_;return void 0!==c?c:a.ob$type===Sk.builtin.str?(c=a.$jsstr().replace(b,"!$&"),a.$savedKeyHash_=c):"string"===typeof a?a.replace(b, +"!$&"):Sk.builtin.hash(a).v}Sk.builtin.dict=function(a){var c,b;if(!(this instanceof Sk.builtin.dict))return new Sk.builtin.dict(a);void 0===a&&(a=[]);this.size=0;this.entries=Object.create(null);this.buckets={};if(Array.isArray(a))for(c=0;c<a.length;c+=2)this.mp$ass_subscript(a[c],a[c+1]);else if(a instanceof Sk.builtin.dict){var h=Sk.abstr.iter(a);for(b=h.tp$iternext();void 0!==b;b=h.tp$iternext())c=a.mp$subscript(b),void 0===c&&(c=null),this.mp$ass_subscript(b,c)}else if(Sk.builtin.checkIterable(a))for(h= +Sk.abstr.iter(a),c=h.tp$iternext();void 0!==c;c=h.tp$iternext())if(c.mp$subscript)this.mp$ass_subscript(c.mp$subscript(0),c.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;this.tp$call=void 0;return this};Sk.builtin.dict.tp$call=function(a,b){var c;Sk.builtin.pyCheckArgsLen("dict",a,0,1);a=new Sk.builtin.dict(a[0]);if(b)for(c=0;c<b.length;c+=2)a.mp$ass_subscript(new Sk.builtin.str(b[c]), +b[c+1]);return a};Sk.abstr.setUpInheritance("dict",Sk.builtin.dict,Sk.builtin.object);Sk.abstr.markUnhashable(Sk.builtin.dict);var b=/^[0-9!#_]/;Sk.builtin.dict.prototype.sk$asarray=function(){return Object.values(this.entries).map(a=>a.lhs)};Sk.builtin.dict.prototype.get$bucket_item=function(a,b){b=this.buckets[b];let c,d;if(void 0!==b)for(let e=0;e<b.length;e++)if(d=b[e],void 0!==d&&(c=d.lhs,c===a||Sk.misceval.richCompareBool(a,c,"Eq")))return d};Sk.builtin.dict.prototype.mp$lookup=function(c){const b= +a(c);c="string"===typeof b?this.entries[b]:this.get$bucket_item(c,b);if(void 0!==c)return c.rhs};Sk.builtin.dict.prototype.mp$subscript=function(a){Sk.builtin.pyCheckArgsLen("[]",arguments.length,1,2,!1,!1);var c=this.mp$lookup(a);if(void 0!==c)return c;throw new Sk.builtin.KeyError(a);};Sk.builtin.dict.prototype.sq$contains=function(a){return void 0!==this.mp$lookup(a)};Sk.builtin.dict.prototype.mp$ass_subscript=function(c,b){const d=a(c);let h;"string"===typeof d?(h=this.entries[d],void 0===h?(this.entries[d]= +{lhs:c,rhs:b},this.size++):h.rhs=b):(h=this.get$bucket_item(c,d),void 0===h?(this.set$bucket_item(c,b,d),this.size++):h.rhs=b)};Sk.builtin.dict.prototype.set$bucket_item=function(a,b,e){let c=this.buckets[e];a={lhs:a,rhs:b};void 0===c?(this.buckets[e]=[a],e="#"+e+"_0"):(b=c.indexOf(void 0),-1!==b?(e="#"+e+"_"+b,c[b]=a):(e="#"+e+"_"+c.length,c.push(a)));this.entries[e]=a};Sk.builtin.dict.prototype.pop$bucket_item=function(a,b){const c=this.buckets[b];let d,g;if(void 0!==c)for(let f=0;f<c.length;f++)if(g= +c[f],void 0!==g&&(d=g.lhs,d===a||Sk.misceval.richCompareBool(a,d,"Eq")))return delete this.entries["#"+b+"_"+f],c[f]=void 0,c.every(a=>void 0===a)&&delete this.buckets[b],g};Sk.builtin.dict.prototype.mp$del_subscript=function(c){Sk.builtin.pyCheckArgsLen("del",arguments.length,1,1,!1,!1);const b=a(c);let e;"string"===typeof b?(e=this.entries[b],delete this.entries[b]):e=this.pop$bucket_item(c,b);if(void 0!==e)this.size--;else throw new Sk.builtin.KeyError(c);};Sk.builtin.dict.prototype.$r=function(){var a, +b=[];var e=Sk.abstr.iter(this);for(a=e.tp$iternext();void 0!==a;a=e.tp$iternext()){var h=this.mp$subscript(a);void 0===h&&(h=null);h===this?b.push(Sk.misceval.objectRepr(a).v+": {...}"):b.push(Sk.misceval.objectRepr(a).v+": "+Sk.misceval.objectRepr(h).v)}return new Sk.builtin.str("{"+b.join(", ")+"}")};Sk.builtin.dict.prototype.mp$length=function(){return this.size};Sk.builtin.dict.prototype.get=new Sk.builtin.func(function(a,b,e){Sk.builtin.pyCheckArgsLen("get()",arguments.length,1,2,!1,!0);void 0=== +e&&(e=Sk.builtin.none.none$);var c=a.mp$lookup(b);void 0===c&&(c=e);return c});Sk.builtin.dict.prototype.pop=new Sk.builtin.func(function(c,b,e){Sk.builtin.pyCheckArgsLen("pop()",arguments.length,1,2,!1,!0);const d=a(b);let g,f;"string"===typeof d?(g=c.entries[d],void 0!==g&&(f=g.rhs,delete c.entries[d])):(g=c.pop$bucket_item(b,d),void 0!==g&&(f=g.rhs));if(void 0!==f)return c.size--,f;if(void 0!==e)return e;throw new Sk.builtin.KeyError(b);});Sk.builtin.dict.prototype.haskey$=function(a,b){Sk.builtin.pyCheckArgsLen("has_key()", +arguments.length,1,1,!1,!0);return new Sk.builtin.bool(a.sq$contains(b))};Sk.builtin.dictview=function(a,b){this.dict=b;this.type=a;return this};Sk.abstr.setUpInheritance("dictview",Sk.builtin.dictview,Sk.builtin.object);Sk.builtin.dictview.prototype.__class__=Sk.builtin.dictview;Sk.builtin.dictview.prototype.$r=function(){var a="dict_"+this.type+"([",b,e=!0;var h=Sk.abstr.iter(this.dict);for(b=h.tp$iternext();void 0!==b;b=h.tp$iternext())if(e=!1,"keys"===this.type)a+=Sk.misceval.objectRepr(b).v+ +", ";else{var g=this.dict.mp$subscript(b);void 0===g&&(g=null);"values"===this.type?a+=Sk.misceval.objectRepr(g).v+", ":"items"===this.type&&(a+="("+Sk.misceval.objectRepr(b).v+", "+Sk.misceval.objectRepr(g).v+"), ")}e||(a=a.slice(0,-2));return new Sk.builtin.str(a+"])")};Sk.builtin.dictview.prototype.sq$length=function(){return this.dict.mp$length()};Sk.builtin.dictview.prototype.sq$contains=function(a){var c;if("keys"===this.type)return this.dict.sq$contains(a);if("values"===this.type){var b=Sk.abstr.iter(this.dict); +for(c=b.tp$iternext();void 0!==c;c=b.tp$iternext()){var h=this.dict.mp$subscript(c);void 0===h&&(h=null);if(Sk.misceval.isTrue(Sk.misceval.richCompareBool(h,a,"Eq")))return!0}return!1}if("items"===this.type)return a.mp$subscript&&a.sq$length&&2===a.sq$length()&&(c=a.mp$subscript(new Sk.builtin.int_(0)),h=this.dict.mp$lookup(c),void 0!==h&&(b=new Sk.builtin.tuple([c,h]),Sk.misceval.isTrue(Sk.misceval.richCompareBool(b,a,"Eq"))))?!0:!1};Sk.builtin.dictview.prototype.tp$iter=function(){var a;"keys"=== +this.type?a=Sk.builtin.dict.prototype.py2$keys(this.dict).tp$iter():"values"===this.type?a=this.dict.py2$values(this.dict).tp$iter():"items"===this.type&&(a=this.dict.py2$items(this.dict).tp$iter());a.$r=function(){return new Sk.builtin.str("<dict_"+this.type+"iterator>")};return a};Sk.builtin.dictview.prototype.__iter__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("__iter__",arguments.length,0,0,!1,!0);return a.tp$iter()});Sk.builtin.dict.prototype.py2$items=function(a){Sk.builtin.pyCheckArgsLen("items", +arguments.length,0,0,!1,!0);var c,b=[];var h=Sk.abstr.iter(a);for(c=h.tp$iternext();void 0!==c;c=h.tp$iternext()){var g=a.mp$subscript(c);void 0===g&&(g=null);b.push(new Sk.builtin.tuple([c,g]))}return new Sk.builtin.list(b)};Sk.builtin.dict.prototype.py3$items=function(a){Sk.builtin.pyCheckArgsLen("items",arguments.length,0,0,!1,!0);return new Sk.builtin.dictview("items",a)};Sk.builtin.dict.prototype.items=new Sk.builtin.func(Sk.builtin.dict.prototype.py2$items);Sk.builtin.dict.prototype.py2$keys= +function(a){Sk.builtin.pyCheckArgsLen("keys",arguments.length,0,0,!1,!0);var c,b=[];var h=Sk.abstr.iter(a);for(c=h.tp$iternext();void 0!==c;c=h.tp$iternext())b.push(c);return new Sk.builtin.list(b)};Sk.builtin.dict.prototype.py3$keys=function(a){Sk.builtin.pyCheckArgsLen("keys",arguments.length,0,0,!1,!0);return new Sk.builtin.dictview("keys",a)};Sk.builtin.dict.prototype.keys=new Sk.builtin.func(Sk.builtin.dict.prototype.py2$keys);Sk.builtin.dict.prototype.py2$values=function(a){Sk.builtin.pyCheckArgsLen("values", +arguments.length,0,0,!1,!0);var c,b=[];var h=Sk.abstr.iter(a);for(c=h.tp$iternext();void 0!==c;c=h.tp$iternext())c=a.mp$subscript(c),void 0===c&&(c=null),b.push(c);return new Sk.builtin.list(b)};Sk.builtin.dict.prototype.py3$values=function(a){Sk.builtin.pyCheckArgsLen("values",arguments.length,0,0,!1,!0);return new Sk.builtin.dictview("values",a)};Sk.builtin.dict.prototype.values=new Sk.builtin.func(Sk.builtin.dict.prototype.py2$values);Sk.builtin.dict.prototype.clear=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("clear()", +arguments.length,0,0,!1,!0);a.entries=Object.create(null);a.buckets={};a.size=0});Sk.builtin.dict.prototype.setdefault=new Sk.builtin.func(function(a,b,e){try{return a.mp$subscript(b)}catch(h){return void 0===e&&(e=Sk.builtin.none.none$),a.mp$ass_subscript(b,e),e}});Sk.builtin.dict.prototype.dict_merge=function(a){var c;if(a instanceof Sk.builtin.dict){var b=a.tp$iter();for(c=b.tp$iternext();void 0!==c;c=b.tp$iternext()){var h=a.mp$subscript(c);if(void 0===h)throw new Sk.builtin.AttributeError("cannot get item for key: "+ +c.v);this.mp$ass_subscript(c,h)}}else for(b=Sk.misceval.callsimArray(a.keys,[a]),b=Sk.abstr.iter(b),c=b.tp$iternext();void 0!==c;c=b.tp$iternext()){h=a.tp$getitem(c);if(void 0===h)throw new Sk.builtin.AttributeError("cannot get item for key: "+c.v);this.mp$ass_subscript(c,h)}};m=function(a,b,e){if(void 0!==e&&("dict"===e.tp$name||e.keys))b.dict_merge(e);else if(void 0!==e&&Sk.builtin.checkIterable(e)){var c,d=0;e=Sk.abstr.iter(e);for(c=e.tp$iternext();void 0!==c;c=e.tp$iternext(),d++){if(!Sk.builtin.checkIterable(c))throw new Sk.builtin.TypeError("cannot convert dictionary update sequence element #"+ +d+" to a sequence");if(2===c.sq$length()){var f=Sk.abstr.iter(c);c=f.tp$iternext();f=f.tp$iternext();b.mp$ass_subscript(c,f)}else throw new Sk.builtin.ValueError("dictionary update sequence element #"+d+" has length "+c.sq$length()+"; 2 is required");}}else if(void 0!==e)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' object is not iterable");a=new Sk.builtin.dict(a);b.dict_merge(a);return Sk.builtin.none.none$};m.co_kwargs=!0;Sk.builtin.dict.prototype.update=new Sk.builtin.func(m);Sk.builtin.dict.prototype.__contains__= +new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgsLen("__contains__",arguments.length,2,2);return new Sk.builtin.bool(a.sq$contains(b))});Sk.builtin.dict.prototype.__cmp__=new Sk.builtin.func(function(a,b,e){return Sk.builtin.NotImplemented.NotImplemented$});Sk.builtin.dict.prototype.__delitem__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgsLen("__delitem__",arguments.length,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.pyCheckArgsLen("__getitem__",arguments.length,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,e){Sk.builtin.pyCheckArgsLen("__setitem__",arguments.length,2,2,!1,!0);return Sk.builtin.dict.prototype.mp$ass_subscript.call(a,b,e)});Sk.builtin.dict.prototype.__hash__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("__hash__",arguments.length,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.pyCheckArgsLen("__len__",arguments.length,0,0,!1,!0);return Sk.builtin.dict.prototype.mp$length.call(a)});Sk.builtin.dict.prototype.__getattribute__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgsLen("__getattribute__",arguments.length,1,1,!1,!0);if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("__getattribute__ requires a string");return Sk.builtin.dict.prototype.tp$getattr.call(a,b)});Sk.builtin.dict.prototype.__iter__= +new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("__iter__",arguments.length,0,0,!1,!0);return new Sk.builtin.dict_iter_(a)});Sk.builtin.dict.prototype.tp$iter=function(){return new Sk.builtin.dict_iter_(this)};Sk.builtin.dict.prototype.__repr__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("__repr__",arguments.length,0,0,!1,!0);return Sk.builtin.dict.prototype.$r.call(a)});Sk.builtin.dict.prototype.ob$eq=function(a){var c;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$;var b=this.tp$iter();for(c=b.tp$iternext();void 0!==c;c=b.tp$iternext()){var h=this.mp$lookup(c);c=a.mp$lookup(c);if(void 0===c||!Sk.misceval.richCompareBool(h,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===Sk.builtin.NotImplemented.NotImplemented$?a:a.v?Sk.builtin.bool.false$:Sk.builtin.bool.true$}; +Sk.builtin.dict.prototype.copy=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("copy",arguments.length,0,0,!1,!0);var c,b=new Sk.builtin.dict([]);var h=Sk.abstr.iter(a);for(c=h.tp$iternext();void 0!==c;c=h.tp$iternext()){var g=a.mp$subscript(c);void 0===g&&(g=null);b.mp$ass_subscript(c,g)}return b});Sk.builtin.dict.$fromkeys=function(a,b,e){if(a instanceof Sk.builtin.dict){Sk.builtin.pyCheckArgsLen("fromkeys",arguments.length,1,2,!1,!0);var c=a;var d=b;var f=void 0===e?Sk.builtin.none.none$: +e}else Sk.builtin.pyCheckArgsLen("fromkeys",arguments.length,1,2,!1,!1),c=new Sk.builtin.dict([]),d=a,f=void 0===b?Sk.builtin.none.none$:b;if(!Sk.builtin.checkIterable(d))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(d)+"' object is not iterable");var k=Sk.abstr.iter(d);for(d=k.tp$iternext();void 0!==d;d=k.tp$iternext())c.mp$ass_subscript(d,f);return c};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");});Sk.exportSymbol("Sk.builtin.dict",Sk.builtin.dict); +Sk.builtin.create_dict_iter_=function(a){const c={$index:0};c.$obj=a;c.$keys=a.sk$asarray();c.tp$iter=function(){return c};c.tp$iternext=function(){if(!(this.$index>=this.$keys.length))return this.$keys[this.$index++]};return c};Sk.builtin.dict_iter_=function(a){if(!(this instanceof Sk.builtin.dict_iter_))return new Sk.builtin.dict_iter_(a);a=Sk.builtin.create_dict_iter_(a);a.$r=function(){return new Sk.builtin.str("<dictionary-keyiterator>")};return a};Sk.abstr.setUpInheritance("dictionary-keyiterator", +Sk.builtin.dict_iter_,Sk.builtin.object);Sk.builtin.dict_iter_.prototype.__class__=Sk.builtin.dict_iter_;Sk.builtin.dict_iter_.prototype.__iter__=new Sk.builtin.func(function(a){return a});Sk.builtin.dict_iter_.prototype.next$=function(a){a=a.tp$iternext();if(void 0===a)throw new Sk.builtin.StopIteration;return a}},function(m,p){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.pyCheckArgsLen("__abs__",arguments.length,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.pyCheckArgsLen("__neg__", +arguments.length,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.pyCheckArgsLen("__pos__",arguments.length,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.pyCheckArgsLen("__int__", +arguments.length,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.pyCheckArgsLen("__long__",arguments.length,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.pyCheckArgsLen("__float__", +arguments.length,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.pyCheckArgsLen("__add__",arguments.length,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.pyCheckArgsLen("__radd__", +arguments.length,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.pyCheckArgsLen("__sub__",arguments.length,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.pyCheckArgsLen("__rsub__",arguments.length,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.pyCheckArgsLen("__mul__",arguments.length,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.pyCheckArgsLen("__rmul__",arguments.length,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.pyCheckArgsLen("__div__",arguments.length,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.pyCheckArgsLen("__rdiv__",arguments.length,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.pyCheckArgsLen("__floordiv__",arguments.length,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.pyCheckArgsLen("__rfloordiv__",arguments.length,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.pyCheckArgsLen("__mod__",arguments.length,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.pyCheckArgsLen("__rmod__",arguments.length,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.pyCheckArgsLen("__divmod__",arguments.length,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.pyCheckArgsLen("__rdivmod__",arguments.length,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.pyCheckArgsLen("__pow__",arguments.length,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.pyCheckArgsLen("__rpow__",arguments.length,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$}},function(m,p){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,h){for(var g;0<=--h;)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,h){for(var g,f,k=b&32767,n=b>>15;0<=--h;)f=this[a]&32767,g=this[a++]>>15,b=n*f+g*k,f=k*f+((b&32767)<<15)+c[d]+(e&1073741823),e=(f>>>30)+(b>>>15)+n*g+(e>>>30),c[d++]=f&1073741823;return e};Sk.builtin.biginteger.prototype.am3= +function(a,b,c,d,e,h){for(var g,f,k=b&16383,n=b>>14;0<=--h;)f=this[a]&16383,g=this[a++]>>14,b=n*f+g*k,f=k*f+((b&16383)<<14)+c[d]+e,e=(f>>28)+(b>>14)+n*g,c[d++]=f&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=[];m=48;for(p=0;9>=p;++p)Sk.builtin.biginteger.BI_RC[m++]=p;m=97;for(p=10;36>p;++p)Sk.builtin.biginteger.BI_RC[m++]=p;m=65;for(p=10;36>p;++p)Sk.builtin.biginteger.BI_RC[m++]= +p;Sk.builtin.biginteger.int2char=function(a){return Sk.builtin.biginteger.BI_RM.charAt(a)};Sk.builtin.biginteger.intAt=function(a,b){a=Sk.builtin.biginteger.BI_RC[a.charCodeAt(b)];return null==a?-1:a};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;if(16==b)var d=4;else if(8==b)d=3;else if(256==b)d=8;else if(2==b)d=1;else if(32==b)d=5;else if(4==b)d=2;else{this.fromRadix(a,b);return}this.s=this.t=0;var e=a.length;var h=!1;for(c=0;0<=--e;)b=8==d?a[e]&255:Sk.builtin.biginteger.intAt(a,e),0>b?"-"==a.charAt(e)&&(h=!0):(h=!1,0===c?this[this.t++]=b:c+d>this.DB?(this[this.t-1]|=(b&(1<<this.DB-c)-1)<<c,this[this.t++]=b>>this.DB-c):this[this.t-1]|=b<<c,c+=d,c>= +this.DB&&(c-=this.DB));8==d&&0!==(a[0]&128)&&(this.s=-1,0<c&&(this[this.t-1]|=(1<<this.DB-c)-1<<c));this.clamp();h&&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;if(0>this.s)return"-"+this.negate().toString(a);if(16==a)var c=4;else if(8==a)c=3;else if(2==a)c=1;else if(32==a)c=5;else if(4==a)c=2;else return this.toRadix(a);var d= +(1<<c)-1;var e=!1;var h="";var g=this.t;a=this.DB-g*this.DB%c;if(0<g--)for(a<this.DB&&0<(b=this[g]>>a)&&(e=!0,h=Sk.builtin.biginteger.int2char(b));0<=g;)a<c?(b=(this[g]&(1<<a)-1)<<c-a,b|=this[--g]>>(a+=this.DB-c)):(b=this[g]>>(a-=c)&d,0>=a&&(a+=this.DB,--g)),0<b&&(e=!0),e&&(h+=Sk.builtin.biginteger.int2char(b));return e?h:"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=this.s-a.s;if(0!==b)return b;var c=this.t;b=c-a.t;if(0!==b)return 0>this.s?-b:b;for(;0<=--c;)if(0!==(b=this[c]-a[c]))return b;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;a=Math.floor(a/this.DB);var h=this.s<<c& +this.DM,g;for(g=this.t-1;0<=g;--g)b[g+a+1]=this[g]>>d|h,h=(this[g]&e)<<c;for(g=a-1;0<=g;--g)b[g]=0;b[a]=h;b.t=this.t+a+1;b.s=this.s;b.clamp()};Sk.builtin.biginteger.prototype.bnpRShiftTo=function(a,b){b.s=this.s;var c=Math.floor(a/this.DB);if(c>=this.t)b.t=0;else{var d=a%this.DB;var e=this.DB-d;var h=(1<<d)-1;b[0]=this[c]>>d;for(a=c+1;a<this.t;++a)b[a-c-1]|=(this[a]&h)<<e,b[a-c]=this[a]>>d;0<d&&(b[this.t-c-1]|=(this.s&h)<<e);b.t=this.t-c;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=a.abs();if(!(0>=d.t)){var e=this.abs();if(e.t<d.t)null!=b&&b.fromInt(0),null!=c&&this.copyTo(c); +else{null==c&&(c=Sk.builtin.biginteger.nbi());var h=Sk.builtin.biginteger.nbi();var g=this.s;var f=a.s;a=this.DB-Sk.builtin.biginteger.nbits(d[d.t-1]);0<a?(d.lShiftTo(a,h),e.lShiftTo(a,c)):(d.copyTo(h),e.copyTo(c));var k=h.t;d=h[k-1];if(0!==d){var n=d*(1<<this.F1)+(1<k?h[k-2]>>this.F2:0);e=this.FV/n;var l=(1<<this.F1)/n;var q=1<<this.F2;var m=c.t;var p=m-k;var y=null==b?Sk.builtin.biginteger.nbi():b;h.dlShiftTo(p,y);0<=c.compareTo(y)&&(c[c.t++]=1,c.subTo(y,c));Sk.builtin.biginteger.ONE.dlShiftTo(k, +y);for(y.subTo(h,h);h.t<k;)h[h.t++]=0;for(;0<=--p;)if(n=c[--m]==d?this.DM:Math.floor(c[m]*e+(c[m-1]+q)*l),(c[m]+=h.am(0,n,c,p,0,k))<n)for(h.dlShiftTo(p,y),c.subTo(y,c);c[m]<--n;)c.subTo(y,c);null!=b&&(c.drShiftTo(k,b),g!=f&&Sk.builtin.biginteger.ZERO.subTo(b,b));c.t=k;c.clamp();0<a&&c.rShiftTo(a,c);0>g&&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(){if(1>this.t)return 0;var a=this[0];if(0===(a&1))return 0;var b= +a&3;b=b*(2-(a&15)*b)&15;b=b*(2-(a&255)*b)&255;b=b*(2-((a&65535)*b&65535))&65535;b=b*(2-a*b%this.DV)%this.DV;return 0<b?this.DV-b:-b};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){if(4294967295<a||1>a)return Sk.builtin.biginteger.ONE;var c=Sk.builtin.biginteger.nbi();var d=Sk.builtin.biginteger.nbi();var e=b.convert(this);var h=Sk.builtin.biginteger.nbits(a)-1;for(e.copyTo(c);0<=--h;)if(b.sqrTo(c,d),0<(a&1<<h))b.mulTo(d,e,c);else{var g=c;c= +d;d=g}return b.revert(c)};Sk.builtin.biginteger.prototype.bnModPowInt=function(a,b){b=256>a||b.isEven()?new Sk.builtin.biginteger.Classic(b):new Sk.builtin.biginteger.Montgomery(b);return this.exp(a,b)};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){null==a&&(a=10);if(0===this.signum()||2>a||36<a)return"0";var b=this.chunkSize(a);var c=Math.pow(a,b);b=Sk.builtin.biginteger.nbv(c);var d=Sk.builtin.biginteger.nbi();var e=Sk.builtin.biginteger.nbi(); +var h="";for(this.divRemTo(b,d,e);0<d.signum();)h=(c+e.intValue()).toString(a).substr(1)+h,d.divRemTo(b,d,e);return e.intValue().toString(a)+h};Sk.builtin.biginteger.prototype.bnpFromRadix=function(a,b){var c,d,e;this.fromInt(0);null==b&&(b=10);var h=this.chunkSize(b);var g=Math.pow(b,h);var f=!1;for(c=e=d=0;c<a.length;++c){var k=Sk.builtin.biginteger.intAt(a,c);if(0>k){if("-"==a.charAt(c)&&0===this.signum()&&(f=!0),"."==a.charAt(c))break}else e=b*e+k,++d>=h&&(this.dMultiply(g),this.dAddOffset(e, +0),e=d=0)}0<d&&(this.dMultiply(Math.pow(b,d)),this.dAddOffset(e,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=this.t,c=[];c[0]=this.s;var d=this.DB-b*this.DB%8;var e=0;if(0<b--)for(d<this.DB&&(a=this[b]>>d)!=(this.s&this.DM)>>d&&(c[e++]=a|this.s<<this.DB-d);0<=b;)if(8>d?(a=(this[b]&(1<<d)-1)<<8-d,a|=this[--b]>>(d+=this.DB-8)):(a=this[b]>>(d-=8)&255,0>=d&&(d+=this.DB,--b)),0!==(a&128)&&(a|=-256),0===e&&(this.s&128)!=(a&128)&&++e,0<e||a!=this.s)c[e++]=a;return c};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=Math.min(a.t,this.t);for(d=0;d<e;++d)c[d]=b(this[d],a[d]);if(a.t<this.t){var h=a.s&this.DM;for(d=e;d<this.t;++d)c[d]=b(this[d],h);c.t=this.t}else{h=this.s&this.DM;for(d=e;d<a.t;++d)c[d]=b(h,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){if(0===a)return-1;var 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){a=Sk.builtin.biginteger.ONE.shiftLeft(a);this.bitwiseTo(a,b,a);return a};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){--b;var 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){if(0>a.s||a.t>2*this.m.t)return a.mod(this.m);if(0>a.compareTo(this.m))return a;var 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=a.bitLength();var d=Sk.builtin.biginteger.nbv(1);if(0>=c)return d;var e= +18>c?1:48>c?3:144>c?4:768>c?5:6;var h=8>c?new Sk.builtin.biginteger.Classic(b):b.isEven()?new Sk.builtin.biginteger.Barrett(b):new Sk.builtin.biginteger.Montgomery(b);b=[];var g=3;var f=e-1;var k=(1<<e)-1;b[1]=h.convert(this);if(1<e)for(c=Sk.builtin.biginteger.nbi(),h.sqrTo(b[1],c);g<=k;)b[g]=Sk.builtin.biginteger.nbi(),h.mulTo(c,b[g-2],b[g]),g+=2;var n=a.t-1;var l=!0;var q=Sk.builtin.biginteger.nbi();for(c=Sk.builtin.biginteger.nbits(a[n])-1;0<=n;){if(c>=f)var m=a[n]>>c-f&k;else m=(a[n]&(1<<c+1)- +1)<<f-c,0<n&&(m|=a[n-1]>>this.DB+c-f);for(g=e;0===(m&1);)m>>=1,--g;0>(c-=g)&&(c+=this.DB,--n);if(l)b[m].copyTo(d),l=!1;else{for(;1<g;)h.sqrTo(d,q),h.sqrTo(q,d),g-=2;0<g?h.sqrTo(d,q):(g=d,d=q,q=g);h.mulTo(q,b[m],d)}for(;0<=n&&0===(a[n]&1<<c);)h.sqrTo(d,q),g=d,d=q,q=g,0>--c&&(c=this.DB-1,--n)}return h.revert(d)};Sk.builtin.biginteger.prototype.bnGCD=function(a){var b=0>this.s?this.negate():this.clone();a=0>a.s?a.negate():a.clone();if(0>b.compareTo(a)){var c=b;b=a;a=c}c=b.getLowestSetBit();var d=a.getLowestSetBit(); +if(0>d)return b;c<d&&(d=c);0<d&&(b.rShiftTo(d,b),a.rShiftTo(d,a));for(;0<b.signum();)0<(c=b.getLowestSetBit())&&b.rShiftTo(c,b),0<(c=a.getLowestSetBit())&&a.rShiftTo(c,a),0<=b.compareTo(a)?(b.subTo(a,b),b.rShiftTo(1,b)):(a.subTo(b,a),a.rShiftTo(1,a));0<d&&a.lShiftTo(d,a);return a};Sk.builtin.biginteger.prototype.bnpModInt=function(a){var b;if(0>=a)return 0;var c=this.DV%a;var 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=a.isEven();if(this.isEven()&&c||0===a.signum())return Sk.builtin.biginteger.ZERO;var d=a.clone();var e=this.clone();var h=Sk.builtin.biginteger.nbv(1);var g=Sk.builtin.biginteger.nbv(0);var f=Sk.builtin.biginteger.nbv(0);for(b=Sk.builtin.biginteger.nbv(1);0!==d.signum();){for(;d.isEven();)d.rShiftTo(1,d),c?(h.isEven()&&g.isEven()||(h.addTo(this,h),g.subTo(a,g)),h.rShiftTo(1,h)):g.isEven()||g.subTo(a,g),g.rShiftTo(1,g);for(;e.isEven();)e.rShiftTo(1,e),c?(f.isEven()&&b.isEven()|| +(f.addTo(this,f),b.subTo(a,b)),f.rShiftTo(1,f)):b.isEven()||b.subTo(a,b),b.rShiftTo(1,b);0<=d.compareTo(e)?(d.subTo(e,d),c&&h.subTo(f,h),g.subTo(b,g)):(e.subTo(d,e),c&&f.subTo(h,f),b.subTo(g,b))}if(0!==e.compareTo(Sk.builtin.biginteger.ONE))return Sk.builtin.biginteger.ZERO;if(0<=b.compareTo(a))return b.subtract(a);if(0>b.signum())b.addTo(a,b);else return b;return 0>b.signum()?b.add(a):b};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=this.abs();if(1==d.t&&d[0]<=Sk.builtin.biginteger.lowprimes[Sk.builtin.biginteger.lowprimes.length- +1]){for(c=0;c<Sk.builtin.biginteger.lowprimes.length;++c)if(d[0]==Sk.builtin.biginteger.lowprimes[c])return!0;return!1}if(d.isEven())return!1;for(c=1;c<Sk.builtin.biginteger.lowprimes.length;){var e=Sk.builtin.biginteger.lowprimes[c];for(b=c+1;b<Sk.builtin.biginteger.lowprimes.length&&e<Sk.builtin.biginteger.lplim;)e*=Sk.builtin.biginteger.lowprimes[b++];for(e=d.modInt(e);c<b;)if(0===e%Sk.builtin.biginteger.lowprimes[c++])return!1}return d.millerRabin(a)};Sk.builtin.biginteger.prototype.bnpMillerRabin= +function(a){var b,c,d=this.subtract(Sk.builtin.biginteger.ONE),e=d.getLowestSetBit();if(0>=e)return!1;var h=d.shiftRight(e);a=a+1>>1;a>Sk.builtin.biginteger.lowprimes.length&&(a=Sk.builtin.biginteger.lowprimes.length);var g=Sk.builtin.biginteger.nbi();for(c=0;c<a;++c){g.fromInt(Sk.builtin.biginteger.lowprimes[c]);var f=g.modPow(h,this);if(0!==f.compareTo(Sk.builtin.biginteger.ONE)&&0!==f.compareTo(d)){for(b=1;b++<e&&0!==f.compareTo(d);)if(f=f.modPowInt(2,this),0===f.compareTo(Sk.builtin.biginteger.ONE))return!1; +if(0!==f.compareTo(d))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},function(m,p){Sk.builtin.int_=function(a,c){if(!(this instanceof Sk.builtin.int_))return new Sk.builtin.int_(a,c);if(this instanceof Sk.builtin.bool)return this;if(a instanceof Sk.builtin.int_&&void 0===c)return this.v=a.v,this;if(c!==Sk.builtin.none.none$&&void 0!==c&&!Sk.builtin.checkInt(c)){if(Sk.builtin.checkFloat(c))throw new Sk.builtin.TypeError("integer argument expected, got "+Sk.abstr.typeName(c)); +if(c.__index__)c=Sk.misceval.callsimArray(c.__index__,[c]);else if(c.__int__)c=Sk.misceval.callsimArray(c.__int__,[c]);else throw new Sk.builtin.AttributeError(Sk.abstr.typeName(c)+" instance has no attribute '__index__' or '__int__'");}if(a instanceof Sk.builtin.str){c=Sk.builtin.asnum$(c);c===Sk.builtin.none.none$&&(c=10);var b=Sk.str2number(a.v,c,parseInt,function(a){return-a},"int");if(b>Sk.builtin.int_.threshold$||b<-Sk.builtin.int_.threshold$)return new Sk.builtin.lng(a,c);this.v=b;return this}if(void 0!== +c&&c!==Sk.builtin.none.none$)throw new Sk.builtin.TypeError("int() can't convert non-string with explicit base");if(void 0===a||a===Sk.builtin.none)a=0;if(void 0!==a&&a.tp$getattr&&(b=a.tp$getattr(Sk.builtin.str.$int_))){var e=Sk.misceval.callsimArray(b);var h="__int__"}else void 0!==a&&a.__int__?(e=Sk.misceval.callsimArray(a.__int__,[a]),h="__int__"):void 0!==a&&a.tp$getattr&&(b=a.tp$getattr(Sk.builtin.str.$trunc))?(e=Sk.misceval.callsimArray(b),h="__trunc__"):void 0!==a&&a.__trunc__&&(e=Sk.misceval.callsimArray(a.__trunc__, +[a]),h="__trunc__");if(void 0===e||Sk.builtin.checkInt(e))void 0!==e&&(a=e);else throw new Sk.builtin.TypeError(h+" returned non-Integral (type "+Sk.abstr.typeName(e)+")");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,c);return this};Sk.builtin.int_.$shiftconsts= +[.5,1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648,4294967296,8589934592,17179869184,34359738368,68719476736,137438953472,274877906944,549755813888,1099511627776,2199023255552,4398046511104,8796093022208,17592186044416,35184372088832,70368744177664,0x800000000000,281474976710656,562949953421312,0x4000000000000,0x8000000000000,4503599627370496,9007199254740992]; +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.__format__=Sk.formatting.mkNumber__format__(!1);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){if(a instanceof Sk.builtin.int_){var c=this.v+a.v;return c>Sk.builtin.int_.threshold$||c<-Sk.builtin.int_.threshold$? +(c=new Sk.builtin.lng(this.v),c.nb$add(a)):new Sk.builtin.int_(c)}return a instanceof Sk.builtin.lng?(c=new Sk.builtin.lng(this.v),c.nb$add(a)):a instanceof Sk.builtin.float_?(c=new Sk.builtin.float_(this.v),c.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){if(a instanceof Sk.builtin.int_){var c=this.v-a.v;return c>Sk.builtin.int_.threshold$|| +c<-Sk.builtin.int_.threshold$?(c=new Sk.builtin.lng(this.v),c.nb$subtract(a)):new Sk.builtin.int_(c)}return a instanceof Sk.builtin.lng?(c=new Sk.builtin.lng(this.v),c.nb$subtract(a)):a instanceof Sk.builtin.float_?(c=new Sk.builtin.float_(this.v),c.nb$subtract(a)):Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.int_.prototype.nb$reflected_subtract=function(a){var c=this.nb$negative();return Sk.builtin.int_.prototype.nb$add.call(c,a)};Sk.builtin.int_.prototype.nb$multiply=function(a){if(a instanceof +Sk.builtin.int_){var c=this.v*a.v;return c>Sk.builtin.int_.threshold$||c<-Sk.builtin.int_.threshold$?(c=new Sk.builtin.lng(this.v),c.nb$multiply(a)):new Sk.builtin.int_(c)}return a instanceof Sk.builtin.lng?(c=new Sk.builtin.lng(this.v),c.nb$multiply(a)):a instanceof Sk.builtin.float_?(c=new Sk.builtin.float_(this.v),c.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){if(Sk.__future__.division){var c=new Sk.builtin.float_(this.v);return c.nb$divide(a)}return a instanceof Sk.builtin.int_?this.nb$floor_divide(a):a instanceof Sk.builtin.lng?(c=new Sk.builtin.lng(this.v),c.nb$divide(a)):a instanceof Sk.builtin.float_?(c=new Sk.builtin.float_(this.v),c.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){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))}if(a instanceof Sk.builtin.lng){var c=new Sk.builtin.lng(this.v);return c.nb$floor_divide(a)}return a instanceof Sk.builtin.float_?(c=new Sk.builtin.float_(this.v),c.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){if(a instanceof Sk.builtin.int_){var c=Sk.abstr.numberBinOp(this,a,"FloorDiv");c=Sk.abstr.numberBinOp(c,a,"Mult");c=Sk.abstr.numberBinOp(this,c,"Sub");c=c.v;0>a.v&&0===c?c=-0:0===c&&-Infinity===Infinity/c&&(c=0);return new Sk.builtin.int_(c)}return a instanceof Sk.builtin.lng?(c=new Sk.builtin.lng(this.v),c.nb$remainder(a)):a instanceof Sk.builtin.float_?(c=new Sk.builtin.float_(this.v),c.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){if(a instanceof Sk.builtin.int_)return new Sk.builtin.tuple([this.nb$floor_divide(a),this.nb$remainder(a)]);if(a instanceof Sk.builtin.lng){var c=new Sk.builtin.lng(this.v);return c.nb$divmod(a)}return a instanceof Sk.builtin.float_?(c=new Sk.builtin.float_(this.v), +c.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,c){if(a instanceof Sk.builtin.int_&&(void 0===c||c instanceof Sk.builtin.int_)){var b=Math.pow(this.v,a.v);b>Sk.builtin.int_.threshold$||b<-Sk.builtin.int_.threshold$?(b=new Sk.builtin.lng(this.v), +b=b.nb$power(a,c)):b=0>a.v?new Sk.builtin.float_(b):new Sk.builtin.int_(b);if(void 0!==c){if(0>a.v)throw new Sk.builtin.TypeError("pow() 2nd argument cannot be negative when 3rd argument specified");return b.nb$remainder(c)}return b}return a instanceof Sk.builtin.lng?(b=new Sk.builtin.lng(this.v),b.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,c){return a instanceof +Sk.builtin.int_?a.nb$power(this,c):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){if(a instanceof Sk.builtin.int_){a=Sk.builtin.asnum$(a);var c=this.v&a;void 0!==c&&0>c&&(c+=4294967296);if(void 0!==c)return new Sk.builtin.int_(c)}return a instanceof Sk.builtin.lng?(c=new Sk.builtin.lng(this.v),c.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){if(a instanceof Sk.builtin.int_){a=Sk.builtin.asnum$(a);var c=this.v|a;void 0!==c&&0>c&&(c+=4294967296);if(void 0!==c)return new Sk.builtin.int_(c)}return a instanceof Sk.builtin.lng?(c=new Sk.builtin.lng(this.v),c.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){if(a instanceof Sk.builtin.int_){a=Sk.builtin.asnum$(a); +var c=this.v^a;void 0!==c&&0>c&&(c+=4294967296);if(void 0!==c)return new Sk.builtin.int_(c)}return a instanceof Sk.builtin.lng?(c=new Sk.builtin.lng(this.v),c.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){if(0===this.v)return this;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"); +if(53<c)return(new Sk.builtin.lng(this.v)).nb$lshift(new Sk.builtin.int_(c));var b=2*this.v*Sk.builtin.int_.$shiftconsts[c];if(b>Sk.builtin.int_.threshold$||b<-Sk.builtin.int_.threshold$)return new Sk.builtin.lng(b)}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){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");var 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===Sk.builtin.none.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===Sk.builtin.none.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,c){Sk.builtin.pyCheckArgsLen("__round__",arguments.length,1,2);if(void 0!==c&&!Sk.misceval.isIndex(c))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(c)+"' object cannot be interpreted as an index");var b=Sk.builtin.asnum$(a);var e=void 0===c?0:Sk.misceval.asIndex(c);if(Sk.__future__.bankers_rounding){b*=Math.pow(10,e);var h=Math.round(b); +e=(.5===(0<b?b:-b)%1?0===h%2?h:h-1:h)/Math.pow(10,e)}else e=Math.pow(10,e),e=Math.round(b*e)/e;return new Sk.builtin.int_(e)};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,c){void 0===c&&(c=!0);c=c?this.v:Math.abs(this.v);return void 0=== +a||10===a?c.toString():c.toString(a)};const a=/_(?=[^_])/g;Sk.str2number=function(b,c,d,e,h){var g=b,f=!1,k;b=b.replace(/^\s+|\s+$/g,"");"-"===b.charAt(0)&&(f=!0,b=b.substring(1));"+"===b.charAt(0)&&(b=b.substring(1));if(null===c||void 0===c)c=10;if((2>c||36<c)&&0!==c)throw new Sk.builtin.ValueError(h+"() base must be >= 2 and <= 36");if("0x"===b.substring(0,2).toLowerCase())if(16===c||0===c)b=b.substring(2),c=16;else{if(34>c)throw new Sk.builtin.ValueError("invalid literal for "+h+"() with base "+ +c+": '"+g+"'");}else if("0b"===b.substring(0,2).toLowerCase())if(2===c||0===c)b=b.substring(2),c=2;else{if(12>c)throw new Sk.builtin.ValueError("invalid literal for "+h+"() with base "+c+": '"+g+"'");}else if("0o"===b.substring(0,2).toLowerCase())if(8===c||0===c)b=b.substring(2),c=8;else{if(25>c)throw new Sk.builtin.ValueError("invalid literal for "+h+"() with base "+c+": '"+g+"'");}else if("0"===b.charAt(0)){if("0"===b)return 0;if(8===c||0===c)c=8}0===c&&(c=10);if(-1!==b.indexOf("_")){if(-1!==b.indexOf("__"))throw new Sk.builtin.ValueError("invalid literal for "+ +h+"() with base "+c+": '"+g+"'");b=10!==c?b.replace(a,""):b.charAt(0)+b.substring(1).replace(a,"")}if(0===b.length)throw new Sk.builtin.ValueError("invalid literal for "+h+"() with base "+c+": '"+g+"'");for(k=0;k<b.length;k+=1){var n=b.charCodeAt(k);var l=c;48<=n&&57>=n?l=n-48:65<=n&&90>=n?l=n-65+10:97<=n&&122>=n&&(l=n-97+10);if(l>=c)throw new Sk.builtin.ValueError("invalid literal for "+h+"() with base "+c+": '"+g+"'");}l=d(b,c);f&&(l=e(l));return l};Sk.exportSymbol("Sk.builtin.int_",Sk.builtin.int_)}, +function(m,p){Sk.builtin.bool=function(a){Sk.builtin.pyCheckArgsLen("bool",arguments.length,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))});Sk.builtin.bool.prototype.__format__=new Sk.builtin.func(function(a){return a.$r()});Sk.builtin.bool.prototype.nb$and=function(a){return a.ob$type===Sk.builtin.bool?new Sk.builtin.bool(this.v&a.v):Sk.builtin.int_.prototype.nb$and.call(this,a)};Sk.builtin.bool.prototype.nb$or=function(a){return a.ob$type===Sk.builtin.bool?new Sk.builtin.bool(this.v| +a.v):Sk.builtin.int_.prototype.nb$or.call(this,a)};Sk.builtin.bool.prototype.nb$xor=function(a){return a.ob$type===Sk.builtin.bool?new Sk.builtin.bool(this.v^a.v):Sk.builtin.int_.prototype.nb$xor.call(this,a)};Sk.builtin.bool.prototype.ob$eq=function(a){return Sk.builtin.int_.prototype.ob$eq.call(this,a)};Sk.builtin.bool.prototype.ob$ne=function(a){return Sk.builtin.int_.prototype.ob$ne.call(this,a)};Sk.builtin.bool.prototype.ob$lt=function(a){return Sk.builtin.int_.prototype.ob$lt.call(this,a)}; +Sk.builtin.bool.prototype.ob$le=function(a){return Sk.builtin.int_.prototype.ob$le.call(this,a)};Sk.builtin.bool.prototype.ob$gt=function(a){return Sk.builtin.int_.prototype.ob$gt.call(this,a)};Sk.builtin.bool.prototype.ob$ge=function(a){return Sk.builtin.int_.prototype.ob$ge.call(this,a)};Sk.exportSymbol("Sk.builtin.bool",Sk.builtin.bool);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}})},function(m,p){Sk.builtin.float_=function(c){if(!(this instanceof Sk.builtin.float_))return new Sk.builtin.float_(c);if(void 0===c)this.v=0;else if("number"===typeof c)this.v=c;else if(c.nb$float_){c=c.nb$float_();if(c.constructor!==Sk.builtin.float_)throw new Sk.builtin.TypeError("__float__ returned non-float (type "+Sk.abstr.typeName(c)+")");this.v=c.v}else if(Sk.builtin.checkString(c)){{let d=c=c.$jsstr();if(-1!==c.indexOf("_")){if(a.test(c))throw new Sk.builtin.ValueError("could not convert string to float: '"+ +c+"'");d=c.charAt(0)+c.substring(1).replace(b,"")}if(c.match(/^-inf$/i))c=-Infinity;else if(c.match(/^[+]?inf$/i))c=Infinity;else if(c.match(/^[-+]?nan$/i))c=NaN;else{if(isNaN(d))throw new Sk.builtin.ValueError("float: Argument: "+c+" is not number");c=parseFloat(d)}c=new Sk.builtin.float_(c)}this.v=c.v}else if("boolean"===typeof c)this.v=c?1:0;else if("string"===typeof c)this.v=parseFloat(c);else throw new Sk.builtin.TypeError("float() argument must be a string or a number");};Sk.abstr.setUpInheritance("float", +Sk.builtin.float_,Sk.builtin.numtype);const a=/_[eE]|[eE]_|\._|_\.|[+-]_|__/,b=/_(?=[^_])/g;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){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");var c=Sk.builtin.type.typeLookup(a.ob$type,Sk.builtin.str.$float_);if(null==c)throw new Sk.builtin.TypeError("a float is required");a=Sk.misceval.callsimArray(c,[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 c=this.nb$negative();return Sk.builtin.float_.prototype.nb$add.call(c,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){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);var 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);var 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){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");b=new Sk.builtin.float_(Math.pow(this.v,a.v));if(Infinity===Math.abs(b.v)&&Infinity!==Math.abs(this.v)&& +Infinity!==Math.abs(a.v))throw new Sk.builtin.OverflowError("Numerical result out of range");return b}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){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){var c=new Sk.builtin.lng(this.v);return a=c.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===Sk.builtin.none.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===Sk.builtin.none.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.pyCheckArgsLen("__round__",arguments.length,1,2);if(void 0!==b&&!Sk.misceval.isIndex(b))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object cannot be interpreted as an index");var c=Sk.builtin.asnum$(a);var d=void 0===b?0:Sk.misceval.asIndex(b);if(Sk.__future__.bankers_rounding){c*=Math.pow(10,d);var g=Math.round(c); +d=(.5===(0<c?c:-c)%1?0===g%2?g:g-1:g)/Math.pow(10,d);return void 0===b?new Sk.builtin.int_(d):new Sk.builtin.float_(d)}d=Math.pow(10,d);d=Math.round(c*d)/d;return new Sk.builtin.float_(d)};Sk.builtin.float_.prototype.__format__=Sk.formatting.mkNumber__format__(!0);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){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";b=b?this.v:Math.abs(this.v);if(void 0===a||10===a){var c=Sk.__future__.python3?b.toPrecision(16):b.toPrecision(12);var d=c.indexOf(".");a=b.toString().slice(0,d);d=b.toString().slice(d);a.match(/^-?0$/)&&d.slice(1).match(/^0{4,}/)&&(c=12>c.length?b.toExponential():b.toExponential(11));if(0>c.indexOf("e")&& +0<=c.indexOf(".")){for(;"0"==c.charAt(c.length-1);)c=c.substring(0,c.length-1);"."==c.charAt(c.length-1)&&(c+="0")}c=c.replace(/\.0+e/,"e","i");c=c.replace(/(e[-+])([1-9])$/,"$10$2");c=c.replace(/0+(e.*)/,"$1")}else c=b.toString(a);0===this.v&&-Infinity===1/this.v&&(c="-"+c);0>c.indexOf(".")&&0>c.indexOf("E")&&0>c.indexOf("e")&&(c+=".0");return c}},function(m,p){var a=new Sk.builtin.ExternalError("Sk.builtin.nmber is deprecated.");Sk.builtin.nmber=function(a,c){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 a;};Sk.builtin.nmber.fromInt$=function(b){throw a;};Sk.builtin.nmber.prototype.clone=function(){throw a;};Sk.builtin.nmber.prototype.toFixed=function(b){throw a;};Sk.builtin.nmber.prototype.nb$add=function(b){throw a;};Sk.builtin.nmber.prototype.nb$subtract=function(b){throw a;};Sk.builtin.nmber.prototype.nb$multiply=function(b){throw a;};Sk.builtin.nmber.prototype.nb$divide=function(b){throw a; +};Sk.builtin.nmber.prototype.nb$floor_divide=function(b){throw a;};Sk.builtin.nmber.prototype.nb$remainder=function(b){throw a;};Sk.builtin.nmber.prototype.nb$divmod=function(b){throw a;};Sk.builtin.nmber.prototype.nb$power=function(b){throw a;};Sk.builtin.nmber.prototype.nb$and=function(b){throw a;};Sk.builtin.nmber.prototype.nb$or=function(b){throw a;};Sk.builtin.nmber.prototype.nb$xor=function(b){throw a;};Sk.builtin.nmber.prototype.nb$lshift=function(b){throw a;};Sk.builtin.nmber.prototype.nb$rshift= +function(b){throw a;};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 a;};Sk.builtin.nmber.prototype.nb$positive=function(){throw a;};Sk.builtin.nmber.prototype.nb$nonzero=function(){throw a;};Sk.builtin.nmber.prototype.nb$isnegative=function(){throw a;};Sk.builtin.nmber.prototype.nb$ispositive=function(){throw a;};Sk.builtin.nmber.prototype.numberCompare=function(b){throw a;};Sk.builtin.nmber.prototype.__eq__=function(b,c){throw a;};Sk.builtin.nmber.prototype.__ne__=function(b,c){throw a;};Sk.builtin.nmber.prototype.__lt__=function(b,c){throw a;}; +Sk.builtin.nmber.prototype.__le__=function(b,c){throw a;};Sk.builtin.nmber.prototype.__gt__=function(b,c){throw a;};Sk.builtin.nmber.prototype.__ge__=function(b,c){throw a;};Sk.builtin.nmber.prototype.round$=function(b,c){throw a;};Sk.builtin.nmber.prototype.$r=function(){throw a;};Sk.builtin.nmber.prototype.tp$str=function(){throw a;};Sk.builtin.nmber.prototype.str$=function(b,c){throw a;};Sk.exportSymbol("Sk.builtin.nmber",Sk.builtin.nmber)},function(m,p){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.round$=function(a,b){Sk.builtin.pyCheckArgsLen("__round__",arguments.length,1,2);if(void 0!==b&&!Sk.misceval.isIndex(b))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object cannot be interpreted as an index");var c=Sk.builtin.asnum$(a);var d=void 0===b?0:Sk.misceval.asIndex(b);if(Sk.__future__.bankers_rounding){c*=Math.pow(10,d);var e=Math.round(c);d=(.5===(0<c?c:-c)%1?0===e%2?e:e-1:e)/Math.pow(10,d)}else d= +Math.pow(10,d),d=Math.round(c*d)/d;return new Sk.builtin.lng(d)};Sk.builtin.lng.prototype.__index__=new Sk.builtin.func(function(a){return a.nb$int_(a)});Sk.builtin.lng.prototype.__format__=Sk.formatting.mkNumber__format__(!1);Sk.builtin.lng.prototype.nb$lng_=function(){return this};Sk.builtin.lng.prototype.nb$float_=function(){let a=Sk.builtin.asnum$(this);a=parseFloat(a);if(!isFinite(a))throw new Sk.builtin.OverflowError("int too large to convert to float");return new Sk.builtin.float_(a)};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){a=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(a)};Sk.exportSymbol("Sk.longFromStr",Sk.longFromStr);Sk.builtin.lng.prototype.toInt$=function(){return parseInt(this.biginteger.toString(),10)};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){if(a instanceof Sk.builtin.float_){var b=new Sk.builtin.float_(this.str$(10,!0));return 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){if(a instanceof Sk.builtin.float_){var b= +new Sk.builtin.float_(this.str$(10,!0));return 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){if(a instanceof Sk.builtin.float_){var b=new Sk.builtin.float_(this.str$(10,!0));return 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){if(a instanceof Sk.builtin.float_){var b=new Sk.builtin.float_(this.str$(10,!0));return 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();var 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){if(a instanceof Sk.builtin.float_){var b=new Sk.builtin.float_(this.str$(10,!0));return 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){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_){var b=new Sk.builtin.float_(this.str$(10,!0));return 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){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));if(a instanceof Sk.builtin.lng)return new Sk.builtin.tuple([this.nb$floor_divide(a),this.nb$remainder(a)]);if(a instanceof Sk.builtin.float_){var b=new Sk.builtin.float_(this.str$(10,!0));return b.nb$divmod(a)}return Sk.builtin.NotImplemented.NotImplemented$};Sk.builtin.lng.prototype.nb$power=function(a,b){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 b=new Sk.builtin.float_(this.str$(10,!0)),b.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()?(b=new Sk.builtin.float_(this.str$(10,!0)),b.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()?(b=new Sk.builtin.float_(this.str$(10,!0)),b.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){"number"===typeof a&&(a=new Sk.builtin.lng(a));if(a instanceof Sk.builtin.int_||a instanceof Sk.builtin.float_&&0===a.v%1)return a=new Sk.builtin.lng(a.v),this.longCompare(a);if(a instanceof Sk.builtin.float_){var b=new Sk.builtin.float_(this);return b.numberCompare(a)}return 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===Sk.builtin.none.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===Sk.builtin.none.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(){var a=Sk.__future__.python3?"":"L";return new Sk.builtin.str(this.str$(10,!0)+a)};Sk.builtin.lng.prototype.tp$str=function(){return new Sk.builtin.str(this.str$(10,!0))};Sk.builtin.lng.prototype.str$=function(a,b){void 0===b&&(b=!0);b=b?this.biginteger:this.biginteger.abs();return void 0===a||10===a?b.toString():b.toString(a)}},function(m,p){Math.hypot=Math.hypot||function(){for(var a=0,b=arguments.length,e=0;e<b;e++){if(Infinity===arguments[e]||-Infinity=== +arguments[e])return Infinity;a+=arguments[e]*arguments[e]}return Math.sqrt(a)};Sk.builtin.complex=function(a,b){Sk.builtin.pyCheckArgsLen("complex",arguments.length,0,2);var c,d=!1,g=!1;if(!(this instanceof Sk.builtin.complex))return new Sk.builtin.complex(a,b);if("number"===typeof a&&"number"===typeof b)return this.real=a,this.imag=b,this;var f=null==a?Sk.builtin.bool.false$:a;if(f instanceof Sk.builtin.complex&&null==b)return a;if(null!=f&&Sk.builtin.checkString(f)){if(null!=b)throw new Sk.builtin.TypeError("complex() can't take second arg if first is a string"); +return Sk.builtin.complex.complex_subtype_from_string(f)}if(null!=b&&Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("complex() second arg can't be a string");var k=Sk.builtin.complex.try_complex_special_method(f);if(null!=k&&k!==Sk.builtin.NotImplemented.NotImplemented$){if(!Sk.builtin.checkComplex(k))throw new Sk.builtin.TypeError("__complex__ should return a complex object");f=k}k=Sk.builtin.asnum$(f);null!=b&&(c=Sk.builtin.asnum$(b));var n=function(a){if(Sk.builtin.checkNumber(a)||void 0!== +Sk.builtin.type.typeLookup(a.ob$type,Sk.builtin.str.$float_))return!0};if(null==k||!n(f)&&!Sk.builtin.checkComplex(f)||null!=b&&(null==c||!n(b)&&!Sk.builtin.checkComplex(b)))throw new Sk.builtin.TypeError("complex() argument must be a string or number");if(Sk.builtin.complex._complex_check(f))c=f.real,f=f.imag,d=!0;else{k=Sk.builtin.float_.PyFloat_AsDouble(f);if(null==k)return null;c=k;f=0}if(null==b)k=0;else if(Sk.builtin.complex._complex_check(b)){k=b.real;var l=b.imag;g=!0}else{k=Sk.builtin.float_.PyFloat_AsDouble(b); +if(null==k)return null;l=0}!0===g&&(c-=l);!0===d&&(k+=f);this.real=c;this.imag=k;return this};Sk.abstr.setUpInheritance("complex",Sk.builtin.complex,Sk.builtin.numtype);Sk.builtin.complex.prototype.__class__=Sk.builtin.complex;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){if(null==a)return null;var c=Sk.abstr.lookupSpecial(a,Sk.builtin.str.$complex);return null!=c?a=Sk.misceval.callsimArray(c, +[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};const a=/_[eE]|[eE]_|\._|_\.|[+-]_|_j|j_/,b=/_(?=[^_])/g;Sk.builtin.complex.complex_subtype_from_string=function(c){var d=0,e=0,h=!1;if(Sk.builtin.checkString(c))c=Sk.ffi.remapToJs(c);else if("string"!==typeof c)throw new TypeError("provided unsupported string-alike argument"); +if(-1!==c.indexOf("\x00")||0===c.length||""===c)throw new Sk.builtin.ValueError("complex() arg is a malformed string");var g=0;c=c.replace(/inf|infinity/gi,"Infinity");for(c=c.replace(/nan/gi,"NaN");" "===c[g];)g++;if("("===c[g])for(h=!0,g++;" "===c[g];)g++;if(-1!==c.indexOf("_")){if(a.test(c))throw new Sk.builtin.ValueError("could not convert string to complex: '"+c+"'");c=c.charAt(0)+c.substring(1).replace(b,"")}var f=/^(?:[+-]?(?:(?:(?:\d*\.\d+)|(?:\d+\.?))(?:[eE][+-]?\d+)?|NaN|Infinity))/;var k= +c.substr(g);var n=k.match(f);if(null!==n)if(g+=n[0].length,"j"===c[g]||"J"===c[g])e=parseFloat(n[0]),g++;else if("+"===c[g]||"-"===c[g]){d=parseFloat(n[0]);n=c.substr(g).match(f);null!==n?(e=parseFloat(n[0]),g+=n[0].length):(e="+"===c[g]?1:-1,g++);if("j"!==c[g]&&"J"!==c[g])throw new Sk.builtin.ValueError("complex() arg is malformed string");g++}else d=parseFloat(n[0]);else n=n=k.match(/^([+-]?[jJ])/),null!==n&&(e=1===n[0].length?1:"+"===n[0][0]?1:-1,g+=n[0].length);for(;" "===c[g];)g++;if(h){if(")"!== +c[g])throw new Sk.builtin.ValueError("complex() arg is malformed string");for(g++;" "===c[g];)g++}if(c.length!==g)throw new Sk.builtin.ValueError("complex() arg is malformed string");return new Sk.builtin.complex(d,e)};Sk.builtin.complex.prototype.tp$hash=function(){return new Sk.builtin.int_(1000003*this.imag+this.real)};Sk.builtin.complex.prototype.nb$add=function(a){a=Sk.builtin.complex.check_number_or_complex(a);return new Sk.builtin.complex(this.real+a.real,this.imag+a.imag)};Sk.builtin.complex.prototype.nb$reflected_add= +Sk.builtin.complex.prototype.nb$add;Sk.builtin.complex._c_diff=function(a,b){return new Sk.builtin.complex(a.real-b.real,a.imag-b.imag)};Sk.builtin.complex.prototype.nb$subtract=function(a){var c=Sk.builtin.complex.check_number_or_complex(this);a=Sk.builtin.complex.check_number_or_complex(a);return Sk.builtin.complex._c_diff(c,a)};Sk.builtin.complex.prototype.nb$reflected_subtract=function(a){return this.nb$negative().nb$add(a)};Sk.builtin.complex.prototype.nb$multiply=function(a){a=Sk.builtin.complex.check_number_or_complex(a); +return new Sk.builtin.complex(this.real*a.real-this.imag*a.imag,this.real*a.imag+this.imag*a.real)};Sk.builtin.complex.prototype.nb$reflected_multiply=Sk.builtin.complex.prototype.nb$multiply;Sk.builtin.complex.prototype.nb$divide=function(a){a=Sk.builtin.complex.check_number_or_complex(a);var c=a.real;var b=a.imag;a=this.real;var h=this.imag;var g=Math.abs(c);var f=Math.abs(b);if(g>=f){if(0===g)throw new Sk.builtin.ZeroDivisionError("complex division by zero");g=b/c;f=c+b*g;c=(a+h*g)/f;a=(h-a*g)/ +f}else f>=g?(g=c/b,f=c*g+b,Sk.asserts.assert(0!==b),c=(a*g+h)/f,a=(h*g-a)/f):a=c=NaN;return new Sk.builtin.complex(c,a)};Sk.builtin.complex.prototype.nb$reflected_divide=function(a){a=Sk.builtin.complex.check_number_or_complex(a);return a.nb$divide(this)};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){if(null!=b&&!Sk.builtin.checkNone(b))throw new Sk.builtin.ValueError("complex modulo");b=Sk.builtin.complex.check_number_or_complex(a);a=b.real|0;return 0===b.imag&&b.real===a?Sk.builtin.complex.c_powi(this,a):Sk.builtin.complex.c_pow(this,b)};Sk.builtin.complex.c_pow=function(a,b){var c=b.real;b=b.imag;var d=a.real;var g=a.imag;if(0===c&&0===b)b=1,a=0;else if(0===d&&0===g){if(0!==b||0>c)throw new Sk.builtin.ZeroDivisionError("complex division by zero"); +a=b=0}else{var f=Math.hypot(d,g);a=Math.pow(f,c);d=Math.atan2(g,d);c*=d;0!==b&&(a/=Math.exp(d*b),c+=b*Math.log(f));b=a*Math.cos(c);a*=Math.sin(c)}return new Sk.builtin.complex(b,a)};Sk.builtin.complex.c_powi=function(a,b){return 100<b||-100>b?(b=new Sk.builtin.complex(b,0),Sk.builtin.complex.c_pow(a,b)):0<b?Sk.builtin.complex.c_powu(a,b):(new Sk.builtin.complex(1,0)).nb$divide(Sk.builtin.complex.c_powu(a,-b))};Sk.builtin.complex.c_powu=function(a,b){var c,d=1;for(c=new Sk.builtin.complex(1,0);0<d&& +b>=d;)b&d&&(c=c.nb$multiply(a)),d<<=1,a=a.nb$multiply(a);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(){return new Sk.builtin.complex(-this.real,-this.imag)};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?!0:!1}; +Sk.builtin.complex.prototype.tp$richcompare=function(a,b){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$}var c=Sk.builtin.complex.check_number_or_complex(this);var d=c.real;c=c.imag;if(Sk.builtin.checkInt(a)){if(0===c)return a=Sk.misceval.richCompareBool(new Sk.builtin.float_(d),a,b),b=new Sk.builtin.bool(a);a=!1}else if(Sk.builtin.checkFloat(a))a= +d===Sk.builtin.float_.PyFloat_AsDouble(a)&&0===c;else if(Sk.builtin.complex._complex_check(a)){var g=a.imag;a=d===a.real&&c===g}else return Sk.builtin.NotImplemented.NotImplemented$;"NotEq"===b&&(a=!a);return b=new Sk.builtin.bool(a)};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){return a===Sk.builtin.str.$real||a===Sk.builtin.str.$imag?new Sk.builtin.float_(this[a.$jsstr()]): +this.$internalGenericGetAttr(a)};Sk.builtin.complex.prototype.tp$setattr=function(a,b){if(a===Sk.builtin.str.$real||a===Sk.builtin.str.$imag)throw new Sk.builtin.AttributeError("readonly attribute");return Sk.builtin.object.prototype.tp$setattr.call(this,a,b)};Sk.builtin.complex.complex_format=function(a,b,e){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 c,d,f=c="";if(d=0===a.real)d=a.real, +d=1==(d?0>d?-1:1:0>1/d?-1:1);d?(d="",b=Sk.builtin.complex.PyOS_double_to_string(a.imag,e,b,0,null)):(d=c=Sk.builtin.complex.PyOS_double_to_string(a.real,e,b,0,null),b=Sk.builtin.complex.PyOS_double_to_string(a.imag,e,b,Sk.builtin.complex.PyOS_double_to_string.Py_DTSF_SIGN,null),0===a.imag&&-Infinity===1/a.imag&&b&&"-"!==b[0]&&(b="-"+b),c="(",f=")");return new Sk.builtin.str(""+c+d+b+"j"+f)};Sk.builtin.complex.prototype.$r=function(){return Sk.builtin.complex.complex_format(this,null,"g")};Sk.builtin.complex.prototype.tp$str= +function(){return Sk.builtin.complex.complex_format(this,null,"g")};Sk.builtin.complex.prototype.int$format=function(a,b){if(null==b)return null;if(Sk.builtin.checkString(b))return a=Sk.builtin.complex._PyComplex_FormatAdvanced(a,b);throw new Sk.builtin.TypeError("__format__ requires str or unicode");};Sk.builtin.complex.prototype.int$format.co_name=new Sk.builtin.str("__format__");Sk.builtin.complex.prototype.__format__=new Sk.builtin.func(Sk.builtin.complex.prototype.int$format);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.nb$abs=function(){var a=this.real;var b=this.imag;if(!Sk.builtin.complex._is_finite(a)||!Sk.builtin.complex._is_finite(b))return Sk.builtin.complex._is_infinity(a)?(a=Math.abs(a),new Sk.builtin.float_(a)): +Sk.builtin.complex._is_infinity(b)?(a=Math.abs(b),new Sk.builtin.float_(a)):new Sk.builtin.float_(NaN);a=Math.hypot(a,b);if(!Sk.builtin.complex._is_finite(a))throw new Sk.builtin.OverflowError("absolute value too large");return new Sk.builtin.float_(a)};Sk.builtin.complex.prototype.__abs__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("__abs__",arguments.length,0,0,!1,!0);return a.nb$abs()});Sk.builtin.complex.prototype.int$bool=function(a){return new Sk.builtin.bool(a.real||a.imag)}; +Sk.builtin.complex.prototype.int$bool.co_name=new Sk.builtin.str("__bool__");Sk.builtin.complex.prototype.__bool__=new Sk.builtin.func(Sk.builtin.complex.prototype.int$bool);Sk.builtin.complex.prototype.int$truediv=function(a,b){Sk.builtin.pyCheckArgsLen("__truediv__",arguments.length,1,1,!0);return a.nb$divide.call(a,b)};Sk.builtin.complex.prototype.int$truediv.co_name=new Sk.builtin.str("__truediv__");Sk.builtin.complex.prototype.__truediv__=new Sk.builtin.func(Sk.builtin.complex.prototype.int$truediv); +Sk.builtin.complex.prototype.int$hash=function(a){Sk.builtin.pyCheckArgsLen("__hash__",arguments.length,0,0,!0);return a.tp$hash.call(a)};Sk.builtin.complex.prototype.int$hash.co_name=new Sk.builtin.str("__hash__");Sk.builtin.complex.prototype.__hash__=new Sk.builtin.func(Sk.builtin.complex.prototype.int$hash);Sk.builtin.complex.prototype.int$add=function(a,b){Sk.builtin.pyCheckArgsLen("__add__",arguments.length,1,1,!0);return a.nb$add.call(a,b)};Sk.builtin.complex.prototype.int$add.co_name=new Sk.builtin.str("__add__"); +Sk.builtin.complex.prototype.__add__=new Sk.builtin.func(Sk.builtin.complex.prototype.int$add);Sk.builtin.complex.prototype.int$repr=function(a){Sk.builtin.pyCheckArgsLen("__repr__",arguments.length,0,0,!0);return a.r$.call(a)};Sk.builtin.complex.prototype.int$repr.co_name=new Sk.builtin.str("__repr__");Sk.builtin.complex.prototype.__repr__=new Sk.builtin.func(Sk.builtin.complex.prototype.int$repr);Sk.builtin.complex.prototype.int$str=function(a){Sk.builtin.pyCheckArgsLen("__str__",arguments.length, +0,0,!0);return a.tp$str.call(a)};Sk.builtin.complex.prototype.int$str.co_name=new Sk.builtin.str("__str__");Sk.builtin.complex.prototype.__str__=new Sk.builtin.func(Sk.builtin.complex.prototype.int$str);Sk.builtin.complex.prototype.int$sub=function(a,b){Sk.builtin.pyCheckArgsLen("__sub__",arguments.length,1,1,!0);return a.nb$subtract.call(a,b)};Sk.builtin.complex.prototype.int$sub.co_name=new Sk.builtin.str("__sub__");Sk.builtin.complex.prototype.__sub__=new Sk.builtin.func(Sk.builtin.complex.prototype.int$sub); +Sk.builtin.complex.prototype.int$mul=function(a,b){Sk.builtin.pyCheckArgsLen("__mul__",arguments.length,1,1,!0);return a.nb$multiply.call(a,b)};Sk.builtin.complex.prototype.int$mul.co_name=new Sk.builtin.str("__mul__");Sk.builtin.complex.prototype.__mul__=new Sk.builtin.func(Sk.builtin.complex.prototype.int$mul);Sk.builtin.complex.prototype.int$div=function(a,b){Sk.builtin.pyCheckArgsLen("__div__",arguments.length,1,1,!0);return a.nb$divide.call(a,b)};Sk.builtin.complex.prototype.int$div.co_name= +new Sk.builtin.str("__div__");Sk.builtin.complex.prototype.__div__=new Sk.builtin.func(Sk.builtin.complex.prototype.int$div);Sk.builtin.complex.prototype.int$floordiv=function(a,b){Sk.builtin.pyCheckArgsLen("__floordiv__",arguments.length,1,1,!0);return a.nb$floor_divide.call(a,b)};Sk.builtin.complex.prototype.int$floordiv.co_name=new Sk.builtin.str("__floordiv__");Sk.builtin.complex.prototype.__floordiv__=new Sk.builtin.func(Sk.builtin.complex.prototype.int$floordiv);Sk.builtin.complex.prototype.int$mod= +function(a,b){Sk.builtin.pyCheckArgsLen("__mod__",arguments.length,1,1,!0);return a.nb$remainder.call(a,b)};Sk.builtin.complex.prototype.int$mod.co_name=new Sk.builtin.str("__mod__");Sk.builtin.complex.prototype.__mod__=new Sk.builtin.func(Sk.builtin.complex.prototype.int$mod);Sk.builtin.complex.prototype.int$pow=function(a,b,e){Sk.builtin.pyCheckArgsLen("__pow__",arguments.length,1,2,!0);return a.nb$power.call(a,b,e)};Sk.builtin.complex.prototype.int$pow.co_name=new Sk.builtin.str("__pow__");Sk.builtin.complex.prototype.__pow__= +new Sk.builtin.func(Sk.builtin.complex.prototype.int$pow);Sk.builtin.complex.prototype.int$neg=function(a){Sk.builtin.pyCheckArgsLen("__neg__",arguments.length,0,0,!0);return a.nb$negative.call(a)};Sk.builtin.complex.prototype.__neg__=new Sk.builtin.func(Sk.builtin.complex.prototype.int$neg);Sk.builtin.complex.prototype.int$pos=function(a){Sk.builtin.pyCheckArgsLen("__pos__",arguments.length,0,0,!0);return a.nb$positive.call(a)};Sk.builtin.complex.prototype.int$pos.co_name=new Sk.builtin.str("__pos__"); +Sk.builtin.complex.prototype.__pos__=new Sk.builtin.func(Sk.builtin.complex.prototype.int$pos);Sk.builtin.complex.prototype.int$conjugate=function(a){Sk.builtin.pyCheckArgsLen("conjugate",arguments.length,0,0,!0);return new Sk.builtin.complex(a.real,-a.imag)};Sk.builtin.complex.prototype.int$conjugate.co_name=new Sk.builtin.str("conjugate");Sk.builtin.complex.prototype.conjugate=new Sk.builtin.func(Sk.builtin.complex.prototype.int$conjugate);Sk.builtin.complex.prototype.int$divmod=function(a,b){Sk.builtin.pyCheckArgsLen("__divmod__", +arguments.length,1,1,!0);var c=Sk.builtin.complex.check_number_or_complex(a);var d=Sk.builtin.complex.check_number_or_complex(b);var g=c.nb$divide.call(c,d);g.real=Math.floor(g.real);g.imag=0;c=c.nb$subtract.call(c,d.nb$multiply.call(d,g));return new Sk.builtin.tuple([g,c])};Sk.builtin.complex.prototype.int$divmod.co_name=new Sk.builtin.str("__divmod__");Sk.builtin.complex.prototype.__divmod__=new Sk.builtin.func(Sk.builtin.complex.prototype.int$divmod);Sk.builtin.complex.prototype.int$getnewargs= +function(a){Sk.builtin.pyCheckArgsLen("__getnewargs__",arguments.length,0,0,!0);return new Sk.builtin.tuple([new Sk.builtin.float_(a.real),new Sk.builtin.float_(a.imag)])};Sk.builtin.complex.prototype.int$getnewargs.co_name=new Sk.builtin.str("__getnewargs__");Sk.builtin.complex.prototype.__getnewargs__=new Sk.builtin.func(Sk.builtin.complex.prototype.int$getnewargs);Sk.builtin.complex.prototype.int$nonzero=function(a){Sk.builtin.pyCheckArgsLen("__nonzero__",arguments.length,0,0,!0);return 0!==a.real|| +0!==a.imag?Sk.builtin.bool.true$:Sk.builtin.bool.false$};Sk.builtin.complex.prototype.int$nonzero.co_name=new Sk.builtin.str("__nonzero__");Sk.builtin.complex.prototype.__nonzero__=new Sk.builtin.func(Sk.builtin.complex.prototype.int$nonzero);Sk.builtin.complex.prototype.nb$bool=function(){return new Sk.builtin.bool(this.real||this.imag)};Sk.builtin.complex.prototype.nb$nonzero=function(){return new Sk.builtin.bool(this.real||this.imag)};Sk.exportSymbol("Sk.builtin.complex",Sk.builtin.complex);Sk.builtin.complex.PyOS_double_to_string= +function(a,b,e,h,g){g=!1;switch(b){case "e":case "f":case "g":break;case "E":g=!0;b="e";break;case "F":g=!0;b="f";break;case "r":if(0!==e)throw Error("Bad internall call");e=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{h&Sk.builtin.complex.PyOS_double_to_string.Py_DTSF_ADD_DOT_0&&(b="g");var c="%"+(h&Sk.builtin.complex.PyOS_double_to_string.Py_DTSF_ALT?"#":"");null!=e&&(c=c+"."+e);c=new Sk.builtin.str(c+ +b);a=c.nb$remainder(new Sk.builtin.float_(a));a=a.v}h&Sk.builtin.complex.PyOS_double_to_string.Py_DTSF_SIGN&&"-"!==a[0]&&(a="+"+a);g&&(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},function(m,p){Sk.builtin.slice=function(a,b,c){Sk.builtin.pyCheckArgsLen("slice",arguments.length,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){if(!a.__class__||a.__class__!=Sk.builtin.slice)return"Eq"=== +b?!1:"NotEq"===b?!0:Sk.__future__.python3?Sk.builtin.NotImplemented.NotImplemented$:!1;var c=new Sk.builtin.tuple([this.start,this.stop,this.step]);a=new Sk.builtin.tuple([a.start,a.stop,a.step]);return c.tp$richcompare(a,b)};Sk.builtin.slice.prototype.slice_indices_=function(a){if(Sk.builtin.checkNone(this.start))var 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))var 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))var 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.pyCheckArgsLen("indices",arguments.length,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=this.slice_indices_(a),d=c[0];a=c[1];c=c[2];if(0<c)for(;d<a;d+=c)b(d);else for(;d>a;d+=c)b(d)};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")},function(m,p){Sk.builtin.set=function(a){var b;if(!(this instanceof Sk.builtin.set))return Sk.builtin.pyCheckArgsLen("set",arguments.length,0,1),new Sk.builtin.set(a);this.set_reset_();if(void 0!==a){var c=a;c.sk$asarray&&(c=c.sk$asarray());if("[object Array]"===Object.prototype.toString.apply(c)){var d=c.length;for(b=0;b<d;b++)Sk.builtin.set.prototype.add.func_code(this, +c[b])}else if(Sk.builtin.checkIterable(c))for(c=Sk.abstr.iter(c),b=c.tp$iternext();void 0!==b;b=c.tp$iternext())Sk.builtin.set.prototype.add.func_code(this,b);else throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not iterable");}return this};Sk.abstr.setUpInheritance("set",Sk.builtin.set,Sk.builtin.object);Sk.abstr.markUnhashable(Sk.builtin.set);Sk.builtin.set.prototype.__class__=Sk.builtin.set;Sk.builtin.set.prototype.set_reset_=function(){this.v=new Sk.builtin.dict([])};Sk.builtin.set.prototype.$r= +function(){var a,b=[];var c=Sk.abstr.iter(this);for(a=c.tp$iternext();void 0!==a;a=c.tp$iternext())b.push(Sk.misceval.objectRepr(a).v);return Sk.__future__.python3?0===b.length?new Sk.builtin.str("set()"):new Sk.builtin.str("{"+b.join(", ")+"}"):new Sk.builtin.str("set(["+b.join(", ")+"])")};Sk.builtin.set.prototype.sk$asarray=function(){return this.v.sk$asarray()};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.nb$and=function(a){if(Sk.__future__.python3&&!(a instanceof Sk.builtin.set))throw new Sk.builtin.TypeError("unsupported operand type(s) for &: 'set' and '"+Sk.abstr.typeName(a)+"'");return this.intersection.func_code(this,a)};Sk.builtin.set.prototype.nb$or= +function(a){if(Sk.__future__.python3&&!(a instanceof Sk.builtin.set))throw new Sk.builtin.TypeError("unsupported operand type(s) for |: 'set' and '"+Sk.abstr.typeName(a)+"'");return this.union.func_code(this,a)};Sk.builtin.set.prototype.nb$xor=function(a){if(Sk.__future__.python3&&!(a instanceof Sk.builtin.set))throw new Sk.builtin.TypeError("unsupported operand type(s) for ^: 'set' and '"+Sk.abstr.typeName(a)+"'");return this.symmetric_difference.func_code(this,a)};Sk.builtin.set.prototype.nb$subtract= +function(a){if(Sk.__future__.python3&&!(a instanceof Sk.builtin.set))throw new Sk.builtin.TypeError("unsupported operand type(s) for -: 'set' and '"+Sk.abstr.typeName(a)+"'");return this.difference.func_code(this,a)};Sk.builtin.set.prototype.__iter__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("__iter__",arguments.length,0,0,!1,!0);return new Sk.builtin.set_iter_(a)});Sk.builtin.set.prototype.tp$iter=function(){return new Sk.builtin.set_iter_(this)};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;Sk.builtin.pyCheckArgsLen("isdisjoint",arguments.length,2,2);if(!Sk.builtin.checkIterable(b))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object is not iterable");var 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){Sk.builtin.pyCheckArgsLen("issubset",arguments.length,2,2);if(!Sk.builtin.checkIterable(b))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object is not iterable");var c=a.sq$length();var d=b.sq$length();if(c>d)return Sk.builtin.bool.false$;c=Sk.abstr.iter(a);for(d=c.tp$iternext();void 0!==d;d=c.tp$iternext())if(d=Sk.abstr.sequenceContains(b,d),!d)return Sk.builtin.bool.false$;return Sk.builtin.bool.true$}); +Sk.builtin.set.prototype.issuperset=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgsLen("issuperset",arguments.length,2,2);return Sk.builtin.set.prototype.issubset.func_code(b,a)});Sk.builtin.set.prototype.union=new Sk.builtin.func(function(a){var b;Sk.builtin.pyCheckArgsLen("union",arguments.length,1);var c=Sk.builtin.set.prototype.copy.func_code(a);var d=[c];for(b=1;b<arguments.length;b++)d.push(arguments[b]);Sk.builtin.set.prototype.update.func_code.apply(null,d);return c});Sk.builtin.set.prototype.intersection= +new Sk.builtin.func(function(a){var b;Sk.builtin.pyCheckArgsLen("intersection",arguments.length,1);var c=Sk.builtin.set.prototype.copy.func_code(a);var d=[c];for(b=1;b<arguments.length;b++)d.push(arguments[b]);Sk.builtin.set.prototype.intersection_update.func_code.apply(null,d);return c});Sk.builtin.set.prototype.difference=new Sk.builtin.func(function(a,b){var c;Sk.builtin.pyCheckArgsLen("difference",arguments.length,2);var d=Sk.builtin.set.prototype.copy.func_code(a);var e=[d];for(c=1;c<arguments.length;c++)e.push(arguments[c]); +Sk.builtin.set.prototype.difference_update.func_code.apply(null,e);return d});Sk.builtin.set.prototype.symmetric_difference=new Sk.builtin.func(function(a,b){var c;Sk.builtin.pyCheckArgsLen("symmetric_difference",arguments.length,2,2);var d=Sk.builtin.set.prototype.union.func_code(a,b);var e=Sk.abstr.iter(d);for(c=e.tp$iternext();void 0!==c;c=e.tp$iternext())Sk.abstr.sequenceContains(a,c)&&Sk.abstr.sequenceContains(b,c)&&Sk.builtin.set.prototype.discard.func_code(d,c);return d});Sk.builtin.set.prototype.copy= +new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("copy",arguments.length,1,1);return new Sk.builtin.set(a)});Sk.builtin.set.prototype.update=new Sk.builtin.func(function(a,b){var c,d;Sk.builtin.pyCheckArgsLen("update",arguments.length,2);for(c=1;c<arguments.length;c++){var e=arguments[c];if(!Sk.builtin.checkIterable(e))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' object is not iterable");e=Sk.abstr.iter(e);for(d=e.tp$iternext();void 0!==d;d=e.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;Sk.builtin.pyCheckArgsLen("intersection_update",arguments.length,2);for(c=1;c<arguments.length;c++)if(!Sk.builtin.checkIterable(arguments[c]))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(arguments[c])+"' object is not iterable");var e=Sk.abstr.iter(a);for(d=e.tp$iternext();void 0!==d;d=e.tp$iternext())for(c=1;c<arguments.length;c++)if(!Sk.abstr.sequenceContains(arguments[c], +d)){Sk.builtin.set.prototype.discard.func_code(a,d);break}return Sk.builtin.none.none$});Sk.builtin.set.prototype.difference_update=new Sk.builtin.func(function(a,b){var c,d;Sk.builtin.pyCheckArgsLen("difference_update",arguments.length,2);for(c=1;c<arguments.length;c++)if(!Sk.builtin.checkIterable(arguments[c]))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(arguments[c])+"' object is not iterable");var e=Sk.abstr.iter(a);for(d=e.tp$iternext();void 0!==d;d=e.tp$iternext())for(c=1;c<arguments.length;c++)if(Sk.abstr.sequenceContains(arguments[c], +d)){Sk.builtin.set.prototype.discard.func_code(a,d);break}return Sk.builtin.none.none$});Sk.builtin.set.prototype.symmetric_difference_update=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgsLen("symmetric_difference_update",arguments.length,2,2);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){Sk.builtin.pyCheckArgsLen("add", +arguments.length,2,2);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.pyCheckArgsLen("discard",arguments.length,2,2);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){Sk.builtin.pyCheckArgsLen("pop",arguments.length,1,1);if(0===a.sq$length())throw new Sk.builtin.KeyError("pop from an empty set");var 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){Sk.builtin.pyCheckArgsLen("remove",arguments.length,2,2);a.v.mp$del_subscript(b);return Sk.builtin.none.none$});Sk.builtin.set.prototype.__contains__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgsLen("__contains__",arguments.length,2,2);return new Sk.builtin.bool(a.sq$contains(b))});Sk.exportSymbol("Sk.builtin.set",Sk.builtin.set);Sk.builtin.set_iter_= +function(a){if(!(this instanceof Sk.builtin.set_iter_))return new Sk.builtin.set_iter_(a);var b=Sk.builtin.create_dict_iter_(a.v);b.$obj=a;b.$r=function(){return new Sk.builtin.str("<setiterator>")};return b};Sk.abstr.setUpInheritance("setiterator",Sk.builtin.set_iter_,Sk.builtin.object);Sk.builtin.set_iter_.prototype.__class__=Sk.builtin.set_iter_;Sk.builtin.set_iter_.prototype.__iter__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("__iter__",arguments.length,0,0,!0,!1);return a});Sk.builtin.set_iter_.prototype.next$= +function(a){a=a.tp$iternext();if(void 0===a)throw new Sk.builtin.StopIteration;return a}},function(m,p){Sk.builtin.frozenset=function(a){var b;if(!(this instanceof Sk.builtin.frozenset))return Sk.builtin.pyCheckArgsLen("frozenset",arguments.length,0,1),new Sk.builtin.frozenset(a);this.frozenset_reset_();if(void 0!==a){var c=a;c.sk$asarray&&(c=c.sk$asarray());if("[object Array]"===Object.prototype.toString.apply(c)){var d=c.length;for(b=0;b<d;b++)this.v.mp$ass_subscript(c[b],!0)}else if(Sk.builtin.checkIterable(c))for(c= +Sk.abstr.iter(c),b=c.tp$iternext();void 0!==b;b=c.tp$iternext())this.v.mp$ass_subscript(b,!0);else throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not iterable");}return this};Sk.abstr.setUpInheritance("frozenset",Sk.builtin.frozenset,Sk.builtin.object);Sk.builtin.frozenset.prototype.__class__=Sk.builtin.frozenset;Sk.builtin.frozenset.prototype.frozenset_reset_=function(){this.v=new Sk.builtin.dict([])};Sk.builtin.frozenset.prototype.$r=function(){var a,b=[];var c=Sk.abstr.iter(this); +for(a=c.tp$iternext();void 0!==a;a=c.tp$iternext())b.push(Sk.misceval.objectRepr(a).v);return Sk.__future__.python3?0===b.length?new Sk.builtin.str("frozenset()"):new Sk.builtin.str("frozenset({"+b.join(", ")+"})"):new Sk.builtin.str("frozenset(["+b.join(", ")+"])")};Sk.builtin.frozenset.prototype.sk$asarray=function(){return this.v.sk$asarray()};Sk.builtin.frozenset.prototype.tp$hash=function(){let a=1927868237;const b=this.sk$asarray();a*=b.length+1;for(let c=0;c<b.length;c++){const d=Sk.builtin.hash(b[c]).v; +a^=3644798167*(d^d<<16^89869747)}return this.$savedHash_=a=new Sk.builtin.int_(69069*a+907133923)};Sk.builtin.frozenset.prototype.ob$eq=function(a){return this===a?Sk.builtin.bool.true$:a instanceof Sk.builtin.frozenset&&Sk.builtin.frozenset.prototype.sq$length.call(this)===Sk.builtin.frozenset.prototype.sq$length.call(a)?this.issubset.func_code(this,a):Sk.builtin.bool.false$};Sk.builtin.frozenset.prototype.ob$ne=function(a){return this===a?Sk.builtin.bool.false$:a instanceof Sk.builtin.frozenset&& +Sk.builtin.frozenset.prototype.sq$length.call(this)===Sk.builtin.frozenset.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.frozenset.prototype.ob$lt=function(a){return this===a||Sk.builtin.frozenset.prototype.sq$length.call(this)>=Sk.builtin.frozenset.prototype.sq$length.call(a)?Sk.builtin.bool.false$:this.issubset.func_code(this,a)};Sk.builtin.frozenset.prototype.ob$le=function(a){return this===a?Sk.builtin.bool.true$: +Sk.builtin.frozenset.prototype.sq$length.call(this)>Sk.builtin.frozenset.prototype.sq$length.call(a)?Sk.builtin.bool.false$:this.issubset.func_code(this,a)};Sk.builtin.frozenset.prototype.ob$gt=function(a){return this===a||Sk.builtin.frozenset.prototype.sq$length.call(this)<=Sk.builtin.frozenset.prototype.sq$length.call(a)?Sk.builtin.bool.false$:this.issuperset.func_code(this,a)};Sk.builtin.frozenset.prototype.ob$ge=function(a){return this===a?Sk.builtin.bool.true$:Sk.builtin.frozenset.prototype.sq$length.call(this)< +Sk.builtin.frozenset.prototype.sq$length.call(a)?Sk.builtin.bool.false$:this.issuperset.func_code(this,a)};Sk.builtin.frozenset.prototype.nb$and=function(a){if(Sk.__future__.python3&&!(a instanceof Sk.builtin.frozenset))throw new Sk.builtin.TypeError("unsupported operand type(s) for &: 'frozenset' and '"+Sk.abstr.typeName(a)+"'");return this.intersection.func_code(this,a)};Sk.builtin.frozenset.prototype.nb$or=function(a){if(Sk.__future__.python3&&!(a instanceof Sk.builtin.frozenset))throw new Sk.builtin.TypeError("unsupported operand type(s) for |: 'frozenset' and '"+ +Sk.abstr.typeName(a)+"'");return this.union.func_code(this,a)};Sk.builtin.frozenset.prototype.nb$xor=function(a){if(Sk.__future__.python3&&!(a instanceof Sk.builtin.frozenset))throw new Sk.builtin.TypeError("unsupported operand type(s) for ^: 'frozenset' and '"+Sk.abstr.typeName(a)+"'");return this.symmetric_difference.func_code(this,a)};Sk.builtin.frozenset.prototype.nb$subtract=function(a){if(Sk.__future__.python3&&!(a instanceof Sk.builtin.frozenset))throw new Sk.builtin.TypeError("unsupported operand type(s) for -: 'frozenset' and '"+ +Sk.abstr.typeName(a)+"'");return this.difference.func_code(this,a)};Sk.builtin.frozenset.prototype.__iter__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("__iter__",arguments.length,0,0,!1,!0);return new Sk.builtin.set_iter_(a)});Sk.builtin.frozenset.prototype.tp$iter=function(){return new Sk.builtin.set_iter_(this)};Sk.builtin.frozenset.prototype.sq$length=function(){return this.v.mp$length()};Sk.builtin.frozenset.prototype.sq$contains=function(a){return this.v.sq$contains(a)};Sk.builtin.frozenset.prototype.isdisjoint= +new Sk.builtin.func(function(a,b){var c;Sk.builtin.pyCheckArgsLen("isdisjoint",arguments.length,2,2);if(!Sk.builtin.checkIterable(b))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object is not iterable");var 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.frozenset.prototype.issubset=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgsLen("issubset",arguments.length, +2,2);if(!Sk.builtin.checkIterable(b))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object is not iterable");var c=a.sq$length();var d=b.sq$length();if(c>d)return Sk.builtin.bool.false$;c=Sk.abstr.iter(a);for(d=c.tp$iternext();void 0!==d;d=c.tp$iternext())if(d=Sk.abstr.sequenceContains(b,d),!d)return Sk.builtin.bool.false$;return Sk.builtin.bool.true$});Sk.builtin.frozenset.prototype.issuperset=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgsLen("issuperset",arguments.length,2, +2);return Sk.builtin.frozenset.prototype.issubset.func_code(b,a)});Sk.builtin.frozenset.prototype.union=new Sk.builtin.func(function(a){var b;Sk.builtin.pyCheckArgsLen("union",arguments.length,1);var c=Sk.builtin.frozenset.prototype.copy.func_code(a);var d=[c];for(b=1;b<arguments.length;b++)d.push(arguments[b]);var e;for(b=0;b<d.length;b++){var h=d[b];if(!Sk.builtin.checkIterable(h))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(h)+"' object is not iterable");h=Sk.abstr.iter(h);for(e=h.tp$iternext();void 0!== +e;e=h.tp$iternext())c.v.mp$ass_subscript(e,!0)}return c});Sk.builtin.frozenset.prototype.intersection=new Sk.builtin.func(function(a){var b;Sk.builtin.pyCheckArgsLen("intersection",arguments.length,1);var c=Sk.builtin.frozenset.prototype.copy.func_code(a);var d=[c];for(b=1;b<arguments.length;b++)d.push(arguments[b]);var e;for(b=1;b<arguments.length;b++)if(!Sk.builtin.checkIterable(arguments[b]))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(arguments[b])+"' object is not iterable");d=Sk.abstr.iter(a); +for(e=d.tp$iternext();void 0!==e;e=d.tp$iternext())for(b=1;b<arguments.length;b++)if(!Sk.abstr.sequenceContains(arguments[b],e)){Sk.builtin.dict.prototype.pop.func_code(c.v,e,Sk.builtin.none.none$);break}return c});Sk.builtin.frozenset.prototype.difference=new Sk.builtin.func(function(a,b){var c;Sk.builtin.pyCheckArgsLen("difference",arguments.length,2);var d=Sk.builtin.frozenset.prototype.copy.func_code(a);var e=[d];for(c=1;c<arguments.length;c++)e.push(arguments[c]);var h;for(c=1;c<arguments.length;c++)if(!Sk.builtin.checkIterable(arguments[c]))throw new Sk.builtin.TypeError("'"+ +Sk.abstr.typeName(arguments[c])+"' object is not iterable");e=Sk.abstr.iter(a);for(h=e.tp$iternext();void 0!==h;h=e.tp$iternext())for(c=1;c<arguments.length;c++)if(Sk.abstr.sequenceContains(arguments[c],h)){Sk.builtin.dict.prototype.pop.func_code(d.v,h,Sk.builtin.none.none$);break}return d});Sk.builtin.frozenset.prototype.symmetric_difference=new Sk.builtin.func(function(a,b){var c;Sk.builtin.pyCheckArgsLen("symmetric_difference",arguments.length,2,2);var d=Sk.builtin.frozenset.prototype.union.func_code(a, +b);var e=Sk.abstr.iter(d);for(c=e.tp$iternext();void 0!==c;c=e.tp$iternext())Sk.abstr.sequenceContains(a,c)&&Sk.abstr.sequenceContains(b,c)&&Sk.builtin.dict.prototype.pop.func_code(d.v,c,Sk.builtin.none.none$);return d});Sk.builtin.frozenset.prototype.copy=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("copy",arguments.length,1,1);return new Sk.builtin.frozenset(a)});Sk.exportSymbol("Sk.builtin.frozenset",Sk.builtin.frozenset);Sk.builtin.frozenset.prototype.__contains__=new Sk.builtin.func(function(a, +b){Sk.builtin.pyCheckArgsLen("__contains__",arguments.length,2,2);return new Sk.builtin.bool(a.sq$contains(b))})},function(m,p){m=function(a){Sk.builtin.pyCheckArgsLen("print",arguments.length,0,Infinity,!0,!1);var b=Array.prototype.slice.call(arguments,1),c=new Sk.builtin.dict(a);Sk.ffi.remapToJs(c);var d={sep:" ",end:"\n",file:null};var e=c.mp$lookup(new Sk.builtin.str("sep"));if(void 0!==e){var h=Sk.builtin.checkNone(e);if(Sk.builtin.checkString(e)||h)d.sep=h?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(h=Sk.builtin.checkNone(e),Sk.builtin.checkString(e)||h)d.end=h?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((h=Sk.builtin.checkNone(e))||void 0!==e.tp$getattr("write"))d.file=h?d.file:e;else throw new Sk.builtin.AttributeError("'"+Sk.abstr.typeName(e)+"' object has no attribute 'write'"); +var g="";for(c=0;c<b.length;c++)g+=(new Sk.builtin.str(b[c])).v,g+=d.sep;0<b.length&&0<d.sep.length&&(g=g.substring(0,g.length-d.sep.length));g+=d.end;if(null!==d.file)Sk.misceval.callsimArray(d.file.write,[d.file,new Sk.builtin.str(g)]);else return Sk.misceval.chain(Sk.importModule("sys",!1,!0),function(a){return Sk.misceval.callsimOrSuspendArray(a.$d.stdout.write,[a.$d.stdout,new Sk.builtin.str(g)])})};m.co_kwargs=!0;Sk.builtin.print=new Sk.builtin.func(m);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.")}, +function(m,p){Sk.builtin.module=function(){};Sk.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.module.prototype.tp$name="module";Sk.builtin.module.prototype.$r=function(){let a=a=>{a=this.tp$getattr(new Sk.builtin.str(a));return Sk.builtin.repr(a|| +Sk.builtin.str.$emptystr).$jsstr()};return new Sk.builtin.str("<module "+a("__name__")+" from "+a("__file__")+">")}},function(m,p){Sk.builtin.structseq_types={};Sk.builtin.make_structseq=function(a,b,c,d){var e=a+"."+b,h=[];a=[];for(var g in c)h.push(g),a.push(c[g]);c=function(a){Sk.builtin.pyCheckArgsLen(e,arguments.length,1,1);var b;if(!(this instanceof Sk.builtin.structseq_types[e])){var c=Object.create(Sk.builtin.structseq_types[e].prototype);c.constructor.apply(c,arguments);return c}if(Array.isArray(a))var d= +a;else{d=[];c=Sk.abstr.iter(a);for(b=c.tp$iternext();void 0!==b;b=c.tp$iternext())d.push(b);if(d.length!=h.length)throw new Sk.builtin.TypeError(e+"() takes a "+h.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;Sk.abstr.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;if(0===this.v.length)return new Sk.builtin.str(e+"()");var b=[];for(a=0;a<this.v.length;++a)b[a]=h[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=a.$jsstr();b=h.indexOf(b);return 0<=b?this.v[b]:Sk.builtin.object.prototype.GenericGetAttr(a)};return c};Sk.exportSymbol("Sk.builtin.make_structseq",Sk.builtin.make_structseq)},function(m,p){Sk.builtin.generator=function(a,b,c,d,e){var h;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(h in e)d[h]=e[h];this.func_closure=d;return this}};Sk.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=this;this.gi$running=!0;void 0===b&&(b=Sk.builtin.none.none$);this.gi$sentvalue=b;b=[this];this.func_closure&&b.push(this.func_closure);return function h(b){if(b instanceof Sk.misceval.Suspension){if(a)return new Sk.misceval.Suspension(h,b);b=Sk.misceval.retryOptionalSuspensionOrThrow(b)}c.gi$running=!1;Sk.asserts.assert(void 0!==b);if(b!==Sk.builtin.none.none$)return c.gi$resumeat= +b[0],b=b[1]}(this.func_code.apply(this.func_globals,b))};Sk.builtin.generator.prototype.next$=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};Sk.exportSymbol("Sk.builtin.makeGenerator",Sk.builtin.makeGenerator)},function(m,p){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)if(this.fileno=10,c=document.getElementById(a.v), +null==c)if("w"==b.v||"a"==b.v)this.data$="";else throw new Sk.builtin.IOError("[Errno 2] No such file or directory: '"+a.v+"'");else"textarea"==c.nodeName.toLowerCase()?this.data$=c.value:this.data$=c.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;Sk.fileopen&&10<=this.fileno&&Sk.fileopen(this);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 '"+Sk.ffi.remapToJs(this.mode)+"'>")};Sk.builtin.file.prototype.__enter__=new Sk.builtin.func(function(a){return a});Sk.builtin.file.prototype.__exit__=new Sk.builtin.func(function(a){return Sk.misceval.callsimArray(Sk.builtin.file.prototype.close,[a])});Sk.builtin.file.prototype.tp$iter=function(){var a= +{tp$iter:function(){return a},$obj:this,$index:this.currentLine,$lines:this.lineList,tp$iternext:function(){if(!(a.$index>=a.$lines.length))return new Sk.builtin.str(a.$lines[a.$index++])}};return a};Sk.builtin.file.prototype.close=new Sk.builtin.func(function(a){a.closed=!0;return Sk.builtin.none.none$});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=a.data$.length;if(a.closed)throw new Sk.builtin.ValueError("I/O operation on closed file");var d=void 0===b?c:Sk.ffi.remapToJs(b);d=new Sk.builtin.str(a.data$.substr(a.pos$,d));a.pos$=void 0===b?c:a.pos$+Sk.ffi.remapToJs(b);a.pos$>=c&&(a.pos$=c);return d});Sk.builtin.file.$readline=function(a,b,c){if(0===a.fileno){a=Sk.ffi.remapToJs(c);a=Sk.inputfun(a?a:"");if(a instanceof Promise||a&&"function"===typeof a.then){var d=new Sk.misceval.Suspension; +d.resume=function(){if(d.data.error)throw d.data.error;return new Sk.builtin.str(d.data.result)};d.data={type:"Sk.promise",promise:a};return d}return new Sk.builtin.str(a)}b="";a.currentLine<a.lineList.length&&(b=a.lineList[a.currentLine],a.currentLine++);return new Sk.builtin.str(b)};Sk.builtin.file.prototype.readline=new Sk.builtin.func(function(a,b){return Sk.builtin.file.$readline(a,b,void 0)});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=[];for(b=a.currentLine;b<a.lineList.length;b++)c.push(new Sk.builtin.str(a.lineList[b]));return new Sk.builtin.list(c)});Sk.builtin.file.prototype.seek=new Sk.builtin.func(function(a,b,c){b=Sk.ffi.remapToJs(b);void 0===c&&(c=0);0===c?a.pos$=b:1==c?a.pos$=a.data$.length+b:2==c&&(a.pos$=a.data$.length+b);return Sk.builtin.none.none$});Sk.builtin.file.prototype.tell=new Sk.builtin.func(function(a){return Sk.ffi.remapToPy(a.pos$)});Sk.builtin.file.prototype.truncate=new Sk.builtin.func(function(a, +b){Sk.asserts.fail()});Sk.builtin.file.prototype.write=new Sk.builtin.func(function(a,b){var c=Sk.ffi.remapToJs(a.mode);if("w"===c||"wb"===c||"a"===c||"ab"===c)if(Sk.filewrite){if(a.closed)throw new Sk.builtin.ValueError("I/O operation on closed file");1===a.fileno?Sk.output(Sk.ffi.remapToJs(b)):Sk.filewrite(a,b)}else 1===a.fileno?Sk.output(Sk.ffi.remapToJs(b)):Sk.asserts.fail();else throw new Sk.builtin.IOError("File not open for writing");return Sk.builtin.none.none$});Sk.exportSymbol("Sk.builtin.file", +Sk.builtin.file)},function(m,p){Sk.ffi=Sk.ffi||{};Sk.ffi.remapToPy=function(a){var b;if(null===a||"undefined"===typeof a)return Sk.builtin.none.none$;if(a.ob$type)return a;if(a instanceof Sk.misceval.Suspension)return a;if("[object Array]"===Object.prototype.toString.call(a)){var 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);if("undefined"===typeof a)return Sk.builtin.none.none$;if("function"===typeof a)return new Sk.builtin.func(a);Sk.asserts.fail("unhandled remap type "+typeof a)};Sk.exportSymbol("Sk.ffi.remapToPy",Sk.ffi.remapToPy);Sk.ffi.remapToJs=function(a){var b;if(a instanceof Sk.builtin.dict){var c={};var d=a.tp$iter();for(b=d.tp$iternext();void 0!==b;b=d.tp$iternext()){var e= +a.mp$subscript(b);void 0===e&&(e=null);b=Sk.ffi.remapToJs(b);c[b]=Sk.ffi.remapToJs(e)}return c}if(a instanceof Sk.builtin.list||a instanceof Sk.builtin.tuple){c=[];for(e=0;e<a.v.length;++e)c.push(Sk.ffi.remapToJs(a.v[e]));return c}if(a instanceof Sk.builtin.bool)return a.v?!0:!1;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|| +"string"===typeof a)return a;if(void 0!==a)return a.v};Sk.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))}};Sk.exportSymbol("Sk.ffi.callback",Sk.ffi.callback);Sk.ffi.stdwrap=function(a,b){a=new a;a.v=b;return a};Sk.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);Sk.asserts.fail("unexpected type for basicwrap")};Sk.exportSymbol("Sk.ffi.basicwrap",Sk.ffi.basicwrap);Sk.ffi.unwrapo=function(a){if(void 0!==a)return a.v};Sk.exportSymbol("Sk.ffi.unwrapo",Sk.ffi.unwrapo);Sk.ffi.unwrapn=function(a){return null===a?null:a.v};Sk.exportSymbol("Sk.ffi.unwrapn", +Sk.ffi.unwrapn)},function(m,p){Sk.builtin.iterator=function(a,b){var c;if(a instanceof Sk.builtin.generator)return a;if(c=Sk.abstr.lookupSpecial(a,Sk.builtin.str.$iter))return Sk.misceval.callsimArray(c,[a]);this.sentinel=b;this.flag=!1;this.idx=0;this.obj=a;void 0===b?(this.getitem=Sk.abstr.lookupSpecial(a,Sk.builtin.str.$getitem),this.$r=function(){return new Sk.builtin.str("<iterator object>")}):(this.call=Sk.abstr.lookupSpecial(a,Sk.builtin.str.$call),this.$r=function(){return new Sk.builtin.str("<callable-iterator object>")}); +return this};Sk.abstr.setUpInheritance("iterator",Sk.builtin.iterator,Sk.builtin.object);Sk.builtin.iterator.prototype.__class__=Sk.builtin.iterator;Sk.builtin.iterator.prototype.__iter__=new Sk.builtin.func(function(a){return a.tp$iter()});Sk.builtin.iterator.prototype.tp$iter=function(){return this};Sk.builtin.iterator.prototype.tp$iternext=function(a){var b=this;if(!0!==this.flag){if(this.getitem){var c=Sk.misceval.tryCatch(function(){return Sk.misceval.callsimOrSuspendArray(b.getitem,[b.obj,Sk.ffi.remapToPy(b.idx++)])}, +function(a){if(!(a instanceof Sk.builtin.StopIteration||a instanceof Sk.builtin.IndexError))throw a;});return a?c:Sk.misceval.retryOptionalSuspensionOrThrow(c)}c=function(a){if(Sk.misceval.richCompareBool(a,b.sentinel,"Eq"))b.flag=!0;else return a};c=this.call?Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(this.call,[this.obj]),c):Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(this.obj),c);return a?c:Sk.misceval.retryOptionalSuspensionOrThrow(c)}};Sk.builtin.iterator.prototype.next$=function(a){a= +a.tp$iternext();if(!a)throw new Sk.builtin.StopIteration;return a};Sk.exportSymbol("Sk.builtin.iterator",Sk.builtin.iterator)},function(m,p){Sk.builtin.range_=function(a,b,c,d){if(!(this instanceof Sk.builtin.range_))return new Sk.builtin.range_(a,b,c,d);this.v=d;this.$start=a;this.$stop=b;this.$step=c;this.$r=function(){var a="range("+this.$start+", "+this.$stop;1!=this.$step&&(a+=", "+this.$step);return new Sk.builtin.str(a+")")};return this};Sk.abstr.setUpInheritance("range",Sk.builtin.range_, +Sk.builtin.object);Sk.builtin.range_.prototype.__class__=Sk.builtin.range_;Sk.builtin.range_.prototype.mp$subscript=function(a){var b=this.v.mp$subscript(a);if(b instanceof Sk.builtin.list){if(Sk.builtin.checkNone(a.start))var c=this.v.mp$subscript(new Sk.builtin.int_(0)).v;else try{c=this.v.mp$subscript(a.start).v}catch(e){c=this.$start}try{var d=this.v.mp$subscript(a.stop).v}catch(e){d=this.$stop}a=Sk.builtin.checkNone(a.step)?1:Sk.misceval.asIndex(a.step);a*=this.$step;return new Sk.builtin.range_(c, +d,a,b)}return b};Sk.builtin.range_.prototype.__getitem__=new Sk.builtin.func(function(a,b){return Sk.builtin.range_.prototype.mp$subscript.call(a,b)});Sk.builtin.range_.prototype.sq$contains=function(a){return this.v.sq$contains(a)};Sk.builtin.range_.prototype.sq$length=function(){return this.v.sq$length()};Sk.builtin.range_.prototype.tp$richcompare=function(a,b){a.__class__==Sk.builtin.range_&&(a=a.v);return this.v.tp$richcompare(a,b)};Sk.builtin.range_.prototype.tp$iter=function(){var a=this.v.tp$iter(); +a.$r=function(){return new Sk.builtin.str("<rangeiterator>")};return a};Sk.builtin.range_.prototype.__iter__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("__iter__",arguments.length,1,1);return a.tp$iter()});Sk.builtin.range_.prototype.__contains__=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgsLen("__contains__",arguments.length,2,2);return new Sk.builtin.bool(a.sq$contains(b))});Sk.builtin.range_.prototype.index=new Sk.builtin.func(function(a,b,c,d){Sk.builtin.pyCheckArgsLen("index", +arguments.length,2,4);return Sk.misceval.callsimArray(a.v.index,[a.v,b,c,d])});Sk.builtin.range_.prototype.count=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgsLen("count",arguments.length,2,2);return Sk.misceval.callsimArray(a.v.count,[a.v,b])})},function(m,p){Sk.builtin.enumerate=function(a,b){if(!(this instanceof Sk.builtin.enumerate))return new Sk.builtin.enumerate(a,b);Sk.builtin.pyCheckArgsLen("enumerate",arguments.length,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;var c=a.tp$iter();this.tp$iter=function(){return this};this.$index=b;this.tp$iternext=function(){var a=c.tp$iternext();if(void 0!==a){var b=new Sk.builtin.int_(this.$index++);return new Sk.builtin.tuple([b,a])}};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$=function(a){return a.tp$iternext()};Sk.builtin.enumerate.co_varnames=["iterable","start"];Sk.builtin.enumerate.co_argcount=2;Sk.builtin.enumerate.$defaults=[Sk.builtin.none.none$,0];Sk.builtin.enumerate.co_name=new Sk.builtin.str("enumerate");Sk.builtin.enumerate.prototype.$r=function(){return new Sk.builtin.str("<enumerate object>")}}, +function(m,p){Sk.builtin.filter_=function(a,b){var c,d;Sk.builtin.pyCheckArgsLen("filter_",arguments.length,2,2);if(!(this instanceof Sk.builtin.filter_))return new Sk.builtin.filter_(a,b);var e=Sk.abstr.iter(b);var h=function(b){c=a===Sk.builtin.none.none$?b:Sk.misceval.callsimArray(a,[b]);if(Sk.misceval.isTrue(c))return c};this.tp$iter=function(){return this};this.tp$iternext=function(){d=e.tp$iternext();if(void 0!==d){for(c=h(d);void 0===c;){d=e.tp$iternext();if(void 0===d)return;c=h(d)}return d}}; +this.__class__=Sk.builtin.filter_;return this};Sk.abstr.setUpInheritance("filter",Sk.builtin.filter_,Sk.builtin.object);Sk.builtin.filter_.prototype.__iter__=new Sk.builtin.func(function(a){return a.tp$iter()});Sk.builtin.filter_.prototype.next$=function(a){return a.tp$iternext()};Sk.builtin.filter_.prototype.$r=function(){return new Sk.builtin.str("<filter object>")};Sk.exportSymbol("Sk.builtin.filter_",Sk.builtin.filter_)},function(m,p){Sk.builtin.zip_=function(){var a,b;if(!(this instanceof Sk.builtin.zip_))return new Sk.builtin.zip_(...arguments); +if(0===arguments.length)return new Sk.builtin.zip_(new Sk.builtin.list([]));var c=[];for(a=0;a<arguments.length;a++)try{c.push(Sk.abstr.iter(arguments[a]))}catch(d){if(d instanceof Sk.builtin.TypeError)throw new Sk.builtin.TypeError("zip argument #"+(a+1)+" must support iteration");throw d;}this.tp$iter=function(){return this};this.tp$iternext=function(){var d=[];for(a=0;a<c.length;a++){b=c[a].tp$iternext();if(void 0===b)return;d.push(b)}return new Sk.builtin.tuple(d)};this.__class__=Sk.builtin.zip_; +return this};Sk.abstr.setUpInheritance("zip",Sk.builtin.zip_,Sk.builtin.object);Sk.builtin.zip_.prototype.__iter__=new Sk.builtin.func(function(a){return a.tp$iter()});Sk.builtin.zip_.prototype.next$=function(a){return a.tp$iternext()};Sk.builtin.zip_.prototype.$r=function(){return new Sk.builtin.str("<zip object>")};Sk.exportSymbol("Sk.builtin.zip_",Sk.builtin.zip_)},function(m,p){Sk.builtin.map_=function(a,b){var c,d,e,h;Sk.builtin.pyCheckArgsLen("map_",arguments.length,2);if(!(this instanceof Sk.builtin.map_)){var g= +Array.prototype.slice.apply(arguments).slice(1);return new Sk.builtin.map_(a,...g)}if(2<arguments.length){var f=Array.prototype.slice.apply(arguments).slice(1);for(d=0;d<f.length;d++)f[d]=Sk.abstr.iter(f[d]);var k=function(){h=[];for(d=0;d<f.length;d++){c=f[d].tp$iternext();if(void 0===c)return;h.push(c)}return h}}else b=Sk.abstr.iter(b),k=function(){return b.tp$iternext()};this.tp$iternext=function(){e=k();if(void 0!==e){if(a===Sk.builtin.none.none$)return e instanceof Array&&(e=new Sk.builtin.tuple(e)), +e;e instanceof Array||(e=[e]);return Sk.misceval.applyOrSuspend(a,void 0,void 0,void 0,e)}};this.tp$iter=function(){return this};this.__class__=Sk.builtin.map_;return this};Sk.abstr.setUpInheritance("map",Sk.builtin.map_,Sk.builtin.object);Sk.builtin.map_.prototype.__iter__=new Sk.builtin.func(function(a){return a.tp$iter()});Sk.builtin.map_.prototype.next$=function(a){return a.tp$iternext()};Sk.builtin.map_.prototype.$r=function(){return new Sk.builtin.str("<map object>")};Sk.exportSymbol("Sk.builtin.map_", +Sk.builtin.map_)},function(m,p){var a={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_LBRACE:25,T_RBRACE:26,T_EQEQUAL:27,T_NOTEQUAL:28,T_LESSEQUAL:29,T_GREATEREQUAL:30,T_TILDE:31,T_CIRCUMFLEX:32,T_LEFTSHIFT:33,T_RIGHTSHIFT:34,T_DOUBLESTAR:35,T_PLUSEQUAL:36,T_MINEQUAL:37,T_STAREQUAL:38, +T_SLASHEQUAL:39,T_PERCENTEQUAL:40,T_AMPEREQUAL:41,T_VBAREQUAL:42,T_CIRCUMFLEXEQUAL:43,T_LEFTSHIFTEQUAL:44,T_RIGHTSHIFTEQUAL:45,T_DOUBLESTAREQUAL:46,T_DOUBLESLASH:47,T_DOUBLESLASHEQUAL:48,T_AT:49,T_ATEQUAL:50,T_RARROW:51,T_ELLIPSIS:52,T_OP:53,T_AWAIT:54,T_ASYNC:55,T_ERRORTOKEN:56,T_NT_OFFSET:256,T_N_TOKENS:60,T_COMMENT:57,T_NL:58,T_ENCODING:59};m={"!=":a.NOTEQUAL,"%":a.PERCENT,"%=":a.PERCENTEQUAL,"&":a.AMPER,"&=":a.AMPEREQUAL,"(":a.LPAR,")":a.RPAR,"*":a.STAR,"**":a.DOUBLESTAR,"**=":a.DOUBLESTAREQUAL, +"*=":a.STAREQUAL,"+":a.PLUS,"+=":a.PLUSEQUAL,",":a.COMMA,"-":a.MINUS,"-=":a.MINEQUAL,"->":a.RARROW,".":a.DOT,"...":a.ELLIPSIS,"/":a.SLASH,"//":a.DOUBLESLASH,"//=":a.DOUBLESLASHEQUAL,"/=":a.SLASHEQUAL,":":a.COLON,":=":a.COLONEQUAL,";":a.SEMI,"<":a.LESS,"<<":a.LEFTSHIFT,"<<=":a.LEFTSHIFTEQUAL,"<=":a.LESSEQUAL,"=":a.EQUAL,"==":a.EQEQUAL,">":a.GREATER,">=":a.GREATEREQUAL,">>":a.RIGHTSHIFT,">>=":a.RIGHTSHIFTEQUAL,"@":a.AT,"@=":a.ATEQUAL,"[":a.LSQB,"]":a.RSQB,"^":a.CIRCUMFLEX,"^=":a.CIRCUMFLEXEQUAL,"{":a.LBRACE, +"|":a.VBAR,"|=":a.VBAREQUAL,"}":a.RBRACE,"~":a.TILDE};var b={};(function(){for(var c in a)b[a[c]]=c})();["tok_name","ISTERMINAL","ISNONTERMINAL","ISEOF"].concat(Object.keys(b).map(function(a){return b[a]}));Sk.token={};Sk.token.tokens=a;Sk.token.tok_name=b;Sk.token.EXACT_TOKEN_TYPES=m;Sk.token.ISTERMINAL=function(b){return b<a.T_NT_OFFSET};Sk.token.ISNONTERMINAL=function(b){return b>=a.T_NT_OFFSET};Sk.token.ISEOF=function(b){return b==a.T_ENDMARKER};Sk.exportSymbol("Sk.token",Sk.token);Sk.exportSymbol("Sk.token.tokens", +Sk.token.tokens);Sk.exportSymbol("Sk.token.tok_name",Sk.token.tok_name);Sk.exportSymbol("Sk.token.EXACT_TOKEN_TYPES");Sk.exportSymbol("Sk.token.ISTERMINAL",Sk.token.ISTERMINAL);Sk.exportSymbol("Sk.token.ISNONTERMINAL",Sk.token.ISNONTERMINAL);Sk.exportSymbol("Sk.token.ISEOF",Sk.token.ISEOF)},function(m,p){function a(a,b,c,d,f){this.type=a;this.string=b;this.start=c;this.end=d;this.line=f}function b(a){return"("+Array.prototype.slice.call(arguments).join("|")+")"}function c(a){return b.apply(null,arguments)+ +"?"}function d(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1}function e(){return" FR RF Br BR Fr r B R b bR f rb rB F Rf U rF u RB br fR fr rf Rb".split(" ")}var h=Sk.token.tokens;const g=Sk.builtin.SyntaxError,f=Sk.builtin.SyntaxError;a.prototype.exact_type=function(){return this.type==h.T_OP&&this.string in Sk.token.EXACT_TOKEN_TYPES?Sk.token.EXACT_TOKEN_TYPES[this.string]:this.type};var k=/[\\^$.*+?()[\]{}|]/g,n=RegExp(k.source);const l=function(){var a=b("[A-Z]","[a-z]","[\\u{10B99}-\\u{10B9C}\\u{112A9}\\u{115DC}-\\u{115DD}\\u034F\\u115F-\\u1160\\u17B4-\\u17B5\\u2065\\u3164\\uFFA0\\uFFF0-\\uFFF8\\u{E0000}\\u{E0002}-\\u{E001F}\\u{E0080}-\\u{E00FF}\\u{E01F0}-\\u{E0FFF}\\u{112A9}\\u00D7]", +"[\\u02B0-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0374\\u037A\\u0559\\u06E5-\\u06E6\\u07F4-\\u07F5\\u0971\\u1C78-\\u1C7D\\u1D2C-\\u1D6A\\u1DFD-\\u1DFF\\u2E2F\\u30FC\\uA67F\\uA69C-\\uA69D\\uA717-\\uA71F\\uA788\\uA7F8-\\uA7F9\\uAB5C-\\uAB5F\\uFF70\\uFF9E-\\uFF9F\\u{16F93}-\\u{16F9F}\\u02D0-\\u02D1\\u0640\\u07FA\\u0E46\\u0EC6\\u1843\\u1AA7\\u1C7B\\u3005\\u3031-\\u3035\\u309D-\\u309E\\u30FC-\\u30FE\\uA015\\uA60C\\uA9CF\\uA9E6\\uAA70\\uAADD\\uAAF3-\\uAAF4\\uFF70\\u{16B42}-\\u{16B43}\\u{16FE0}-\\u{16FE1}\\u02B0-\\u02B8\\u02C0-\\u02C1\\u02E0-\\u02E4\\u037A\\u1D2C-\\u1D6A\\u1D78\\u1D9B-\\u1DBF\\u2071\\u207F\\u2090-\\u209C\\u2C7C-\\u2C7D\\uA69C-\\uA69D\\uA770\\uA7F8-\\uA7F9\\uAB5C-\\uAB5F\\uFF9E-\\uFF9F\\u02B2\\u1D62\\u1DA4\\u1DA8\\u2071\\u2C7C\\u2E18-\\u2E19\\u2E2F]", +"[\\u2135-\\u2138\\u{1EE00}-\\u{1EE03}\\u{1EE05}-\\u{1EE1F}\\u{1EE21}-\\u{1EE22}\\u{1EE24}\\u{1EE27}\\u{1EE29}-\\u{1EE32}\\u{1EE34}-\\u{1EE37}\\u{1EE39}\\u{1EE3B}\\u{1EE42}\\u{1EE47}\\u{1EE49}\\u{1EE4B}\\u{1EE4D}-\\u{1EE4F}\\u{1EE51}-\\u{1EE52}\\u{1EE54}\\u{1EE57}\\u{1EE59}\\u{1EE5B}\\u{1EE5D}\\u{1EE5F}\\u{1EE61}-\\u{1EE62}\\u{1EE64}\\u{1EE67}-\\u{1EE6A}\\u{1EE6C}-\\u{1EE72}\\u{1EE74}-\\u{1EE77}\\u{1EE79}-\\u{1EE7C}\\u{1EE7E}\\u{1EE80}-\\u{1EE89}\\u{1EE8B}-\\u{1EE9B}\\u{1EEA1}-\\u{1EEA3}\\u{1EEA5}-\\u{1EEA9}\\u{1EEAB}-\\u{1EEBB}\\u3006\\u3400-\\u4DB5\\u4E00-\\u9FEF\\uF900-\\uFA6D\\uFA70-\\uFAD9\\u{17000}-\\u{187F1}\\u{18800}-\\u{18AF2}\\u{1B170}-\\u{1B2FB}\\u{20000}-\\u{2A6D6}\\u{2A700}-\\u{2B734}\\u{2B740}-\\u{2B81D}\\u{2B820}-\\u{2CEA1}\\u{2CEB0}-\\u{2EBE0}\\u{2F800}-\\u{2FA1D}\\uAAC0\\uAAC2\\uFE20-\\uFE2F\\u{10D22}-\\u{10D23}\\u{1135D}\\u00AA\\u00BA\\u3400-\\u4DB5\\u4E00-\\u9FEF\\uFA0E-\\uFA0F\\uFA11\\uFA13-\\uFA14\\uFA1F\\uFA21\\uFA23-\\uFA24\\uFA27-\\uFA29\\u{20000}-\\u{2A6D6}\\u{2A700}-\\u{2B734}\\u{2B740}-\\u{2B81D}\\u{2B820}-\\u{2CEA1}\\u{2CEB0}-\\u{2EBE0}\\u115F-\\u1160\\u3164\\uFFA0\\u0673\\u17A3-\\u17A4\\u0E40-\\u0E44\\u0EC0-\\u0EC4\\u19B5-\\u19B7\\u19BA\\uAAB5-\\uAAB6\\uAAB9\\uAABB-\\uAABC]", +"[\\u3007\\u3021-\\u3029\\u3038-\\u303A\\u2170-\\u217F\\u2160-\\u216F]","_","[\\u1885-\\u1886\\u2118\\u212E\\u309B-\\u309C]"),c=b(a,"[\\u104A-\\u104B\\u102B-\\u102C\\u102D-\\u1030\\u1031\\u1032-\\u1036\\u1038\\u103B-\\u103C\\u103D-\\u103E\\u1056-\\u1057\\u1058-\\u1059\\u105E-\\u1060\\u1062\\u1067-\\u1068\\u1071-\\u1074\\u1082\\u1083-\\u1084\\u1085-\\u1086\\u109C\\u109D\\u1037\\u1039-\\u103A\\u1087-\\u108C\\u108D\\u108F\\u109A-\\u109B\\uA9E5\\uAA7B\\uAA7C\\uAA7D\\uA9E6\\uAA70\\u104A-\\u104B]","[\\u0903\\u093B\\u093E-\\u0940\\u0949-\\u094C\\u094E-\\u094F\\u0982-\\u0983\\u09BE-\\u09C0\\u09C7-\\u09C8\\u09CB-\\u09CC\\u09D7\\u0A03\\u0A3E-\\u0A40\\u0A83\\u0ABE-\\u0AC0\\u0AC9\\u0ACB-\\u0ACC\\u0B02-\\u0B03\\u0B3E\\u0B40\\u0B47-\\u0B48\\u0B4B-\\u0B4C\\u0B57\\u0BBE-\\u0BBF\\u0BC1-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCC\\u0BD7\\u0C01-\\u0C03\\u0C41-\\u0C44\\u0C82-\\u0C83\\u0CBE\\u0CC0-\\u0CC4\\u0CC7-\\u0CC8\\u0CCA-\\u0CCB\\u0CD5-\\u0CD6\\u0D02-\\u0D03\\u0D3E-\\u0D40\\u0D46-\\u0D48\\u0D4A-\\u0D4C\\u0D57\\u0D82-\\u0D83\\u0DCF-\\u0DD1\\u0DD8-\\u0DDF\\u0DF2-\\u0DF3\\u0F7F\\u102B-\\u102C\\u1031\\u1038\\u103B-\\u103C\\u1056-\\u1057\\u1062\\u1067-\\u1068\\u1083-\\u1084\\u109C\\u17B6\\u17BE-\\u17C5\\u17C7-\\u17C8\\u1923-\\u1926\\u1929-\\u192B\\u1930-\\u1931\\u1933-\\u1938\\u1A19-\\u1A1A\\u1A55\\u1A57\\u1A61\\u1A63-\\u1A64\\u1A6D-\\u1A72\\u1B04\\u1B35\\u1B3B\\u1B3D-\\u1B41\\u1B43\\u1B82\\u1BA1\\u1BA6-\\u1BA7\\u1BE7\\u1BEA-\\u1BEC\\u1BEE\\u1C24-\\u1C2B\\u1C34-\\u1C35\\u1CF2-\\u1CF3\\uA823-\\uA824\\uA827\\uA880-\\uA881\\uA8B4-\\uA8C3\\uA952\\uA983\\uA9B4-\\uA9B5\\uA9BA-\\uA9BB\\uA9BD-\\uA9BF\\uAA2F-\\uAA30\\uAA33-\\uAA34\\uAA4D\\uAAEB\\uAAEE-\\uAAEF\\uAAF5\\uABE3-\\uABE4\\uABE6-\\uABE7\\uABE9-\\uABEA\\u{11000}\\u{11002}\\u{11082}\\u{110B0}-\\u{110B2}\\u{110B7}-\\u{110B8}\\u{1112C}\\u{11145}-\\u{11146}\\u{11182}\\u{111B3}-\\u{111B5}\\u{111BF}\\u{1122C}-\\u{1122E}\\u{11232}-\\u{11233}\\u{112E0}-\\u{112E2}\\u{11302}-\\u{11303}\\u{1133E}-\\u{1133F}\\u{11341}-\\u{11344}\\u{11347}-\\u{11348}\\u{1134B}-\\u{1134C}\\u{11357}\\u{11362}-\\u{11363}\\u{11435}-\\u{11437}\\u{11440}-\\u{11441}\\u{11445}\\u{114B0}-\\u{114B2}\\u{114B9}\\u{114BB}-\\u{114BE}\\u{114C1}\\u{115AF}-\\u{115B1}\\u{115B8}-\\u{115BB}\\u{115BE}\\u{11630}-\\u{11632}\\u{1163B}-\\u{1163C}\\u{1163E}\\u{116AC}\\u{116AE}-\\u{116AF}\\u{11720}-\\u{11721}\\u{11726}\\u{1182C}-\\u{1182E}\\u{11838}\\u{11A39}\\u{11A57}-\\u{11A58}\\u{11A97}\\u{11C2F}\\u{11C3E}\\u{11CA9}\\u{11CB1}\\u{11CB4}\\u{11D8A}-\\u{11D8E}\\u{11D93}-\\u{11D94}\\u{11D96}\\u{11EF5}-\\u{11EF6}\\u{16F51}-\\u{16F7E}\\u0F3E-\\u0F3F\\u1087-\\u108C\\u108F\\u109A-\\u109B\\u1B44\\u1BAA\\u1CE1\\u1CF7\\u302E-\\u302F\\uA953\\uA9C0\\uAA7B\\uAA7D\\uABEC\\u{111C0}\\u{11235}\\u{1134D}\\u{116B6}\\u{1D16D}-\\u{1D172}\\u09BE\\u09D7\\u0B3E\\u0B57\\u0BBE\\u0BD7\\u0CC2\\u0CD5-\\u0CD6\\u0D3E\\u0D57\\u0DCF\\u0DDF\\u302E-\\u302F\\u{1133E}\\u{11357}\\u{114B0}\\u{114BD}\\u{115AF}\\u{1D165}\\u{1D16E}-\\u{1D172}]", +"[\\u{1D7CE}-\\u{1D7FF}\\uFF10-\\uFF19]","\\u2040","[\\u00B7\\u0387\\u1369-\\u1371\\u19DA]");if(!1===RegExp().unicode)return new RegExp("^"+a+"+"+c+"*$","u");a=b("[A-Z]","[a-z]","_");c=b(a,"[0-9]");return new RegExp("^"+a+"+"+c+"*$")}();(function(a){return b.apply(null,arguments)+"*"})("\\\\\\r?\\n[ \\f\\t]*");c("#[^\\r\\n]*");m=b("[0-9](?:_?[0-9])*\\.(?:[0-9](?:_?[0-9])*)?","\\.[0-9](?:_?[0-9])*")+c("[eE][-+]?[0-9](?:_?[0-9])*");var q=b(m,"[0-9](?:_?[0-9])*[eE][-+]?[0-9](?:_?[0-9])*"),u=b("[0-9](?:_?[0-9])*[jJ]", +q+"[jJ]");m=b.apply(null,e());p=b(m+"'''",m+'"""');b(m+"'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*'",m+'"[^\\n"\\\\]*(?:\\\\.[^\\n"\\\\]*)*"');var z=Object.keys(Sk.token.EXACT_TOKEN_TYPES).sort();z=b.apply(this,z.reverse().map(function(a){return a&&n.test(a)?a.replace(k,"\\$&"):a}));var y=b("\\r?\\n",z),t=b(m+"'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*"+b("'","\\\\\\r?\\n"),m+'"[^\\n"\\\\]*(?:\\\\.[^\\n"\\\\]*)*'+b('"',"\\\\\\r?\\n")),H=b("\\\\\\r?\\n|$","#[^\\r\\n]*",p),K={};m=e();for(let a of m)K[a+"'"]="^[^'\\\\]*(?:\\\\.[^'\\\\]*)*'", +K[a+'"']='^[^"\\\\]*(?:\\\\.[^"\\\\]*)*"',K[a+"'''"]="^[^'\\\\]*(?:(?:\\\\.|'(?!''))[^'\\\\]*)*'''",K[a+'"""']='^[^"\\\\]*(?:(?:\\\\.|"(?!""))[^"\\\\]*)*"""';let C=[],F=[];for(let a of m)C.push(a+'"'),C.push(a+"'"),F.push(a+'"""'),F.push(a+"'''");Sk._tokenize=function(c,e,k,n){var m=Sk.__future__.python3?"":"(?:L?)";m=b("0[xX](?:_?[0-9a-fA-F])+"+m,"0[bB](?:_?[01])+"+m,Sk.__future__.silent_octal_literal?"0([oO]?)(?:_?[0-7])+"+m:"0([oO])(?:_?[0-7])+"+m,"(?:0(?:_?0)*|[1-9](?:_?[0-9])*)"+m);m=b(u,q,m); +m="[ \\f\\t]*"+b(H,m,y,t,"\\w+");m=new RegExp(m);var p=0,z=0,L=0,E="",W=0,N=null,M=[0],I,Z=void 0,Y=void 0,J,U;void 0!==k&&("utf-8-sig"==k&&(k="utf-8"),n(new a(h.T_ENCODING,k,[0,0],[0,0],"")));for(var A=k="";;){try{k=A,A=e()}catch(w){A=""}p+=1;var G=0,T=A.length;if(E){if(!A)throw new g("EOF in multi-line string",c,Y[0],Y[1]);Z.lastIndex=0;var x=Z.exec(A);if(x)G=J=x[0].length,n(new a(h.T_STRING,E+A.substring(0,J),Y,[p,J],N+A)),E="",W=0,N=null;else{W&&"\\\n"!==A.substring(A.length-2)&&"\\\r\n"!==A.substring(A.length- +3)?(n(new a(h.T_ERRORTOKEN,E+A,Y,[p,A.length],N)),E="",N=null):(E+=A,N+=A);continue}}else if(0!=z||L){if(!A)throw new g("EOF in multi-line statement",c,p,0);L=0}else{if(!A)break;for(I=0;G<T;){if(" "==A[G])I+=1;else if("\t"==A[G])I=8*Math.floor(I/8+1);else if("\f"==A[G])I=0;else break;G+=1}if(G==T)break;if(d("#\r\n",A[G])){if("#"==A[G]){I=A.substring(G);for(T=I.length;0<T&&-1!=="\r\n".indexOf(I.charAt(T-1));--T);T=I.substring(0,T);n(new a(h.T_COMMENT,T,[p,G],[p,G+T.length],A));G+=T.length}n(new a(h.T_NL, +A.substring(G),[p,G],[p,A.length],A));continue}I>M[M.length-1]&&(M.push(I),n(new a(h.T_INDENT,A.substring(G),[p,0],[p,G],A)));for(;I<M[M.length-1];){if(!d(M,I))throw new f("unindent does not match any outer indentation level",c,p,G);M=M.slice(0,-1);n(new a(h.T_DEDENT,"",[p,G],[p,G],A))}}for(;G<T;){for(I=A.charAt(G);" "===I||"\f"===I||"\t"===I;)G+=1,I=A.charAt(G);if(U=m.exec(A.substring(G))){if(I=G,J=I+U[1].length,U=[p,I],x=[p,J],G=J,I!=J){J=A.substring(I,J);var O=A[I];if(d("0123456789",O)||"."==O&& +"."!=J&&"..."!=J)n(new a(h.T_NUMBER,J,U,x,A));else if(d("\r\n",O))0<z?n(new a(h.T_NL,J,U,x,A)):n(new a(h.T_NEWLINE,J,U,x,A));else if("#"==O)n(new a(h.T_COMMENT,J,U,x,A));else if(d(F,J))if(Z=RegExp(K[J]),x=Z.exec(A.substring(G)))G=x[0].length+G,J=A.substring(I,G),n(new a(h.T_STRING,J,U,[p,G],A));else{Y=[p,I];E=A.substring(I);N=A;break}else if(d(C,O)||d(C,J.substring(0,2))||d(C,J.substring(0,3)))if("\n"==J[J.length-1]){Y=[p,I];Z=RegExp(K[O]||K[J[1]]||K[J[2]]);E=A.substring(I);W=1;N=A;break}else n(new a(h.T_STRING, +J,U,x,A));else I=O.normalize("NFKC"),l.test(I)?n(new a(h.T_NAME,J,U,x,A)):"\\"==O?L=1:(d("([{",O)?z+=1:d(")]}",O)&&--z,n(new a(h.T_OP,J,U,x,A)))}}else n(new a(h.T_ERRORTOKEN,A[G],[p,G],[p,G+1],A)),G+=1}}k&&!d("\r\n",k[k.length-1])&&n(new a(h.T_NEWLINE,"",[p-1,k.length],[p-1,k.length+1],""));for(var r in M.slice(1))n(new a(h.T_DEDENT,"",[p,0],[p,0],""));n(new a(h.T_ENDMARKER,"",[p,0],[p,0],""))};Sk.exportSymbol("Sk._tokenize",Sk._tokenize)},function(m,p){Sk.OpMap={"(":Sk.token.tokens.T_LPAR,")":Sk.token.tokens.T_RPAR, +"[":Sk.token.tokens.T_LSQB,"]":Sk.token.tokens.T_RSQB,":":Sk.token.tokens.T_COLON,",":Sk.token.tokens.T_COMMA,";":Sk.token.tokens.T_SEMI,"+":Sk.token.tokens.T_PLUS,"-":Sk.token.tokens.T_MINUS,"*":Sk.token.tokens.T_STAR,"/":Sk.token.tokens.T_SLASH,"|":Sk.token.tokens.T_VBAR,"&":Sk.token.tokens.T_AMPER,"<":Sk.token.tokens.T_LESS,">":Sk.token.tokens.T_GREATER,"=":Sk.token.tokens.T_EQUAL,".":Sk.token.tokens.T_DOT,"%":Sk.token.tokens.T_PERCENT,"`":Sk.token.tokens.T_BACKQUOTE,"{":Sk.token.tokens.T_LBRACE, +"}":Sk.token.tokens.T_RBRACE,"@":Sk.token.tokens.T_AT,"@=":Sk.token.tokens.T_ATEQUAL,"==":Sk.token.tokens.T_EQEQUAL,"!=":Sk.token.tokens.T_NOTEQUAL,"<>":Sk.token.tokens.T_NOTEQUAL,"<=":Sk.token.tokens.T_LESSEQUAL,">=":Sk.token.tokens.T_GREATEREQUAL,"~":Sk.token.tokens.T_TILDE,"^":Sk.token.tokens.T_CIRCUMFLEX,"<<":Sk.token.tokens.T_LEFTSHIFT,">>":Sk.token.tokens.T_RIGHTSHIFT,"**":Sk.token.tokens.T_DOUBLESTAR,"+=":Sk.token.tokens.T_PLUSEQUAL,"-=":Sk.token.tokens.T_MINEQUAL,"*=":Sk.token.tokens.T_STAREQUAL, +"/=":Sk.token.tokens.T_SLASHEQUAL,"%=":Sk.token.tokens.T_PERCENTEQUAL,"&=":Sk.token.tokens.T_AMPEREQUAL,"|=":Sk.token.tokens.T_VBAREQUAL,"^=":Sk.token.tokens.T_CIRCUMFLEXEQUAL,"<<=":Sk.token.tokens.T_LEFTSHIFTEQUAL,">>=":Sk.token.tokens.T_RIGHTSHIFTEQUAL,"**=":Sk.token.tokens.T_DOUBLESTAREQUAL,"//":Sk.token.tokens.T_DOUBLESLASH,"//=":Sk.token.tokens.T_DOUBLESLASHEQUAL,"->":Sk.token.tokens.T_RARROW,"...":Sk.token.tokens.T_ELLIPSIS};Sk.ParseTables={sym:{and_expr:257,and_test:258,annassign:259,arglist:260, +argument:261,arith_expr:262,assert_stmt:263,async_funcdef:264,async_stmt:265,atom:266,atom_expr:267,augassign:268,break_stmt:269,classdef:270,comp_for:271,comp_if:272,comp_iter:273,comp_op:274,comparison:275,compound_stmt:276,continue_stmt:277,debugger_stmt:278,decorated:279,decorator:280,decorators:281,del_stmt:282,dictorsetmaker:283,dotted_as_name:284,dotted_as_names:285,dotted_name:286,encoding_decl:287,eval_input:288,except_clause:289,expr:290,expr_stmt:291,exprlist:292,factor:293,file_input:294, +flow_stmt:295,for_stmt: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,lambdef_nocond:306,nonlocal_stmt:307,not_test:308,or_test:309,parameters:310,pass_stmt:311,power:312,print_stmt:313,raise_stmt:314,return_stmt:315,shift_expr:316,simple_stmt:317,single_input:256,sliceop:318,small_stmt:319,star_expr:320,stmt:321,subscript:322,subscriptlist:323,suite:324,term:325,test:326,test_nocond:327,testlist:328,testlist_comp:329, +testlist_star_expr:330,tfpdef:331,trailer:332,try_stmt:333,typedargslist:334,varargslist:335,vfpdef:336,while_stmt:337,with_item:338,with_stmt:339,xor_expr:340,yield_arg:341,yield_expr:342,yield_stmt:343},number2symbol:{256:"single_input",257:"and_expr",258:"and_test",259:"annassign",260:"arglist",261:"argument",262:"arith_expr",263:"assert_stmt",264:"async_funcdef",265:"async_stmt",266:"atom",267:"atom_expr",268:"augassign",269:"break_stmt",270:"classdef",271:"comp_for",272:"comp_if",273:"comp_iter", +274:"comp_op",275:"comparison",276:"compound_stmt",277:"continue_stmt",278:"debugger_stmt",279:"decorated",280:"decorator",281:"decorators",282:"del_stmt",283:"dictorsetmaker",284:"dotted_as_name",285:"dotted_as_names",286:"dotted_name",287:"encoding_decl",288:"eval_input",289:"except_clause",290:"expr",291:"expr_stmt",292:"exprlist",293:"factor",294:"file_input",295:"flow_stmt",296:"for_stmt",297:"funcdef",298:"global_stmt",299:"if_stmt",300:"import_as_name",301:"import_as_names",302:"import_from", +303:"import_name",304:"import_stmt",305:"lambdef",306:"lambdef_nocond",307:"nonlocal_stmt",308:"not_test",309:"or_test",310:"parameters",311:"pass_stmt",312:"power",313:"print_stmt",314:"raise_stmt",315:"return_stmt",316:"shift_expr",317:"simple_stmt",318:"sliceop",319:"small_stmt",320:"star_expr",321:"stmt",322:"subscript",323:"subscriptlist",324:"suite",325:"term",326:"test",327:"test_nocond",328:"testlist",329:"testlist_comp",330:"testlist_star_expr",331:"tfpdef",332:"trailer",333:"try_stmt",334:"typedargslist", +335:"varargslist",336:"vfpdef",337:"while_stmt",338:"with_item",339:"with_stmt",340:"xor_expr",341:"yield_arg",342:"yield_expr",343:"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,38:1,39:1,40:1,41:1,42:1,43:1}],257:[[[[44,1]],[[45,0],[0,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],258:[[[[46, +1]],[[47,0],[0,1]]],{6:1,7:1,8:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],259:[[[[48,1]],[[49,2]],[[50,3],[0,2]],[[49,4]],[[0,4]]],{48:1}],260:[[[[51,1]],[[52,2],[0,1]],[[51,1],[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1,53:1}],261:[[[[49,1],[15,2],[53,2]],[[50,2],[54,3],[0,1]],[[49,3]],[[0,3]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1,53:1}],262:[[[[55,1]],[[30,0],[43,0],[0,1]]],{6:1,7:1,9:1, +11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],263:[[[[24,1]],[[49,2]],[[52,3],[0,2]],[[49,4]],[[0,4]]],{24:1}],264:[[[[10,1]],[[56,2]],[[0,2]]],{10:1}],265:[[[[10,1]],[[57,2],[56,2],[58,2]],[[0,2]]],{10:1}],266:[[[[6,1],[25,1],[33,1],[9,1],[11,1],[12,2],[35,3],[38,4],[19,1],[7,5]],[[0,1]],[[59,1],[60,6]],[[61,1],[62,7],[63,7]],[[64,1],[63,8]],[[7,5],[0,5]],[[59,1]],[[61,1]],[[64,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,25:1,33:1,35:1,38:1}],267:[[[[29,1],[65,2]],[[65,2]],[[66,2],[0,2]]],{6:1,7:1, +9:1,11:1,12:1,19:1,25:1,29:1,33:1,35:1,38:1}],268:[[[[67,1],[68,1],[69,1],[70,1],[71,1],[72,1],[73,1],[74,1],[75,1],[76,1],[77,1],[78,1],[79,1]],[[0,1]]],{67:1,68:1,69:1,70:1,71:1,72:1,73:1,74:1,75:1,76:1,77:1,78:1,79:1}],269:[[[[39,1]],[[0,1]]],{39:1}],270:[[[[13,1]],[[25,2]],[[48,3],[35,4]],[[80,5]],[[61,6],[81,7]],[[0,5]],[[48,3]],[[61,6]]],{13:1}],271:[[[[10,1],[34,2]],[[34,2]],[[82,3]],[[83,4]],[[84,5]],[[85,6],[0,5]],[[0,6]]],{10:1,34:1}],272:[[[[37,1]],[[86,2]],[[85,3],[0,2]],[[0,3]]],{37:1}], +273:[[[[87,1],[54,1]],[[0,1]]],{10:1,34:1,37:1}],274:[[[[88,1],[89,1],[8,2],[90,1],[88,1],[83,1],[91,1],[92,3],[93,1],[94,1]],[[0,1]],[[83,1]],[[8,1],[0,3]]],{8:1,83:1,88:1,89:1,90:1,91:1,92:1,93:1,94:1}],275:[[[[95,1]],[[96,0],[0,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],276:[[[[97,1],[98,1],[58,1],[99,1],[57,1],[100,1],[56,1],[101,1],[102,1]],[[0,1]]],{4:1,10:1,13:1,20:1,21:1,34:1,37:1,41:1,42:1}],277:[[[[40,1]],[[0,1]]],{40:1}],278:[[[[17,1]],[[0,1]]],{17:1}],279:[[[[103, +1]],[[56,2],[104,2],[99,2]],[[0,2]]],{41:1}],280:[[[[41,1]],[[105,2]],[[2,4],[35,3]],[[61,5],[81,6]],[[0,4]],[[2,4]],[[61,5]]],{41:1}],281:[[[[106,1]],[[106,1],[0,1]]],{41:1}],282:[[[[27,1]],[[82,2]],[[0,2]]],{27:1}],283:[[[[49,1],[107,2],[53,3]],[[48,4],[54,5],[52,6],[0,1]],[[54,5],[52,6],[0,2]],[[95,7]],[[49,7]],[[0,5]],[[49,8],[107,8],[0,6]],[[54,5],[52,9],[0,7]],[[52,6],[0,8]],[[49,10],[53,11],[0,9]],[[48,12]],[[95,13]],[[49,13]],[[52,9],[0,13]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,19:1,22:1, +25:1,29:1,30:1,33:1,35:1,38:1,43:1,53:1}],284:[[[[105,1]],[[108,2],[0,1]],[[25,3]],[[0,3]]],{25:1}],285:[[[[109,1]],[[52,0],[0,1]]],{25:1}],286:[[[[25,1]],[[110,0],[0,1]]],{25:1}],287:[[[[25,1]],[[0,1]]],{25:1}],288:[[[[111,1]],[[2,1],[112,2]],[[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],289:[[[[113,1]],[[49,2],[0,1]],[[108,3],[52,3],[0,2]],[[49,4]],[[0,4]]],{113:1}],290:[[[[114,1]],[[115,0],[0,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1, +38:1,43:1}],291:[[[[116,1]],[[117,2],[50,3],[118,4],[0,1]],[[111,4],[62,4]],[[116,5],[62,5]],[[0,4]],[[50,3],[0,5]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],292:[[[[95,1],[107,1]],[[52,2],[0,1]],[[95,1],[107,1],[0,2]]],{6:1,7:1,9:1,11:1,12:1,15:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],293:[[[[119,2],[30,1],[22,1],[43,1]],[[120,2]],[[0,2]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],294:[[[[2,0],[112,1],[121,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,38:1,39:1,40:1,41:1,42:1,43:1,112:1}],295:[[[[122,1],[123,1],[124,1],[125,1],[126,1]],[[0,1]]],{5:1,23:1,31:1,39:1,40:1}],296:[[[[34,1]],[[82,2]],[[83,3]],[[111,4]],[[48,5]],[[80,6]],[[127,7],[0,6]],[[48,8]],[[80,9]],[[0,9]]],{34:1}],297:[[[[4,1]],[[25,2]],[[128,3]],[[48,4],[129,5]],[[80,6]],[[49,7]],[[0,6]],[[48,4]]],{4:1}],298:[[[[26, +1]],[[25,2]],[[52,1],[0,2]]],{26:1}],299:[[[[37,1]],[[49,2]],[[48,3]],[[80,4]],[[127,5],[130,1],[0,4]],[[48,6]],[[80,7]],[[0,7]]],{37:1}],300:[[[[25,1]],[[108,2],[0,1]],[[25,3]],[[0,3]]],{25:1}],301:[[[[131,1]],[[52,2],[0,1]],[[131,1],[0,2]]],{25:1}],302:[[[[36,1]],[[105,2],[19,3],[110,3]],[[32,4]],[[105,2],[19,3],[32,4],[110,3]],[[132,5],[15,5],[35,6]],[[0,5]],[[132,7]],[[61,5]]],{36:1}],303:[[[[32,1]],[[133,2]],[[0,2]]],{32:1}],304:[[[[134,1],[135,1]],[[0,1]]],{32:1,36:1}],305:[[[[14,1]],[[48,2], +[136,3]],[[49,4]],[[48,2]],[[0,4]]],{14:1}],306:[[[[14,1]],[[48,2],[136,3]],[[86,4]],[[48,2]],[[0,4]]],{14:1}],307:[[[[18,1]],[[25,2]],[[52,1],[0,2]]],{18:1}],308:[[[[8,1],[137,2]],[[46,2]],[[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],309:[[[[138,1]],[[139,0],[0,1]]],{6:1,7:1,8:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],310:[[[[35,1]],[[61,2],[140,3]],[[0,2]],[[61,2]]],{35:1}],311:[[[[28,1]],[[0,1]]],{28:1}],312:[[[[141,1]],[[53,2],[0,1]], +[[120,3]],[[0,3]]],{6:1,7:1,9:1,11:1,12:1,19:1,25:1,29:1,33:1,35:1,38:1}],313:[[[[16,1]],[[49,2],[142,3],[0,1]],[[52,4],[0,2]],[[49,5]],[[49,2],[0,4]],[[52,6],[0,5]],[[49,7]],[[52,8],[0,7]],[[49,7],[0,8]]],{16:1}],314:[[[[5,1]],[[49,2],[0,1]],[[36,3],[52,3],[0,2]],[[49,4]],[[52,5],[0,4]],[[49,6]],[[0,6]]],{5:1}],315:[[[[23,1]],[[111,2],[0,1]],[[0,2]]],{23:1}],316:[[[[143,1]],[[144,0],[142,0],[0,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],317:[[[[145,1]],[[2,2],[146, +3]],[[0,2]],[[145,1],[2,2]]],{5:1,6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,16:1,17:1,18:1,19: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,35:1,36:1,38:1,39:1,40:1,43:1}],318:[[[[48,1]],[[49,2],[0,1]],[[0,2]]],{48:1}],319:[[[[147,1],[148,1],[149,1],[150,1],[151,1],[152,1],[153,1],[154,1],[155,1],[156,1]],[[0,1]]],{5:1,6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,16:1,17:1,18:1,19: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,35:1,36:1,38:1,39:1,40:1,43:1}],320:[[[[15,1]],[[95,2]], +[[0,2]]],{15:1}],321:[[[[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,38:1,39:1,40:1,41:1,42:1,43:1}],322:[[[[49,1],[48,2]],[[48,2],[0,1]],[[49,3],[157,4],[0,2]],[[157,4],[0,3]],[[0,4]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1,48:1}],323:[[[[158,1]],[[52,2],[0,1]],[[158,1],[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1, +25:1,29:1,30:1,33:1,35:1,38:1,43:1,48:1}],324:[[[[1,1],[2,2]],[[0,1]],[[159,3]],[[121,4]],[[160,1],[121,4]]],{2:1,5:1,6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,16:1,17:1,18:1,19: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,35:1,36:1,38:1,39:1,40:1,43:1}],325:[[[[120,1]],[[161,0],[15,0],[162,0],[41,0],[163,0],[0,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],326:[[[[84,1],[164,2]],[[37,3],[0,1]],[[0,2]],[[84,4]],[[127,5]],[[49,2]]],{6:1,7:1,8:1,9:1,11:1,12:1, +14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],327:[[[[165,1],[84,1]],[[0,1]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],328:[[[[49,1]],[[52,2],[0,1]],[[49,1],[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],329:[[[[49,1],[107,1]],[[54,2],[52,3],[0,1]],[[0,2]],[[49,4],[107,4],[0,3]],[[52,3],[0,4]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],330:[[[[49,1],[107,1]],[[52,2],[0,1]], +[[49,1],[107,1],[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],331:[[[[25,1]],[[48,2],[0,1]],[[49,3]],[[0,3]]],{25:1}],332:[[[[35,1],[110,2],[38,3]],[[61,4],[81,5]],[[25,4]],[[166,6]],[[0,4]],[[61,4]],[[64,4]]],{35:1,38:1,110:1}],333:[[[[20,1]],[[48,2]],[[80,3]],[[167,4],[168,5]],[[48,6]],[[48,7]],[[80,8]],[[80,9]],[[167,4],[127,10],[168,5],[0,8]],[[0,9]],[[48,11]],[[80,12]],[[168,5],[0,12]]],{20:1}],334:[[[[15,1],[169,2],[53,3]],[[169,4],[52,5],[0,1]], +[[50,6],[52,7],[0,2]],[[169,8]],[[52,5],[0,4]],[[169,9],[53,3],[0,5]],[[49,10]],[[15,11],[169,2],[53,3],[0,7]],[[52,12],[0,8]],[[50,13],[52,5],[0,9]],[[52,7],[0,10]],[[169,14],[52,15],[0,11]],[[0,12]],[[49,4]],[[52,15],[0,14]],[[169,16],[53,3],[0,15]],[[50,17],[52,15],[0,16]],[[49,14]]],{15:1,25:1,53:1}],335:[[[[15,1],[53,2],[170,3]],[[170,5],[52,4],[0,1]],[[170,6]],[[50,7],[52,8],[0,3]],[[53,2],[170,9],[0,4]],[[52,4],[0,5]],[[52,10],[0,6]],[[49,11]],[[15,12],[53,2],[170,3],[0,8]],[[50,13],[52,4], +[0,9]],[[0,10]],[[52,8],[0,11]],[[52,15],[170,14],[0,12]],[[49,5]],[[52,15],[0,14]],[[53,2],[170,16],[0,15]],[[50,17],[52,15],[0,16]],[[49,14]]],{15:1,25:1,53:1}],336:[[[[25,1]],[[0,1]]],{25:1}],337:[[[[21,1]],[[49,2]],[[48,3]],[[80,4]],[[127,5],[0,4]],[[48,6]],[[80,7]],[[0,7]]],{21:1}],338:[[[[49,1]],[[108,2],[0,1]],[[95,3]],[[0,3]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],339:[[[[42,1]],[[171,2]],[[48,3],[52,1]],[[80,4]],[[0,4]]],{42:1}],340:[[[[172,1]],[[173, +0],[0,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],341:[[[[111,2],[36,1]],[[49,2]],[[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,36:1,38:1,43:1}],342:[[[[31,1]],[[174,2],[0,1]],[[0,2]]],{31:1}],343:[[[[62,1]],[[0,1]]],{31:1}]},states:[[[[1,1],[2,1],[3,2]],[[0,1]],[[2,1]]],[[[44,1]],[[45,0],[0,1]]],[[[46,1]],[[47,0],[0,1]]],[[[48,1]],[[49,2]],[[50,3],[0,2]],[[49,4]],[[0,4]]],[[[51,1]],[[52,2],[0,1]],[[51,1],[0,2]]],[[[49,1],[15,2],[53,2]], +[[50,2],[54,3],[0,1]],[[49,3]],[[0,3]]],[[[55,1]],[[30,0],[43,0],[0,1]]],[[[24,1]],[[49,2]],[[52,3],[0,2]],[[49,4]],[[0,4]]],[[[10,1]],[[56,2]],[[0,2]]],[[[10,1]],[[57,2],[56,2],[58,2]],[[0,2]]],[[[6,1],[25,1],[33,1],[9,1],[11,1],[12,2],[35,3],[38,4],[19,1],[7,5]],[[0,1]],[[59,1],[60,6]],[[61,1],[62,7],[63,7]],[[64,1],[63,8]],[[7,5],[0,5]],[[59,1]],[[61,1]],[[64,1]]],[[[29,1],[65,2]],[[65,2]],[[66,2],[0,2]]],[[[67,1],[68,1],[69,1],[70,1],[71,1],[72,1],[73,1],[74,1],[75,1],[76,1],[77,1],[78,1],[79, +1]],[[0,1]]],[[[39,1]],[[0,1]]],[[[13,1]],[[25,2]],[[48,3],[35,4]],[[80,5]],[[61,6],[81,7]],[[0,5]],[[48,3]],[[61,6]]],[[[10,1],[34,2]],[[34,2]],[[82,3]],[[83,4]],[[84,5]],[[85,6],[0,5]],[[0,6]]],[[[37,1]],[[86,2]],[[85,3],[0,2]],[[0,3]]],[[[87,1],[54,1]],[[0,1]]],[[[88,1],[89,1],[8,2],[90,1],[88,1],[83,1],[91,1],[92,3],[93,1],[94,1]],[[0,1]],[[83,1]],[[8,1],[0,3]]],[[[95,1]],[[96,0],[0,1]]],[[[97,1],[98,1],[58,1],[99,1],[57,1],[100,1],[56,1],[101,1],[102,1]],[[0,1]]],[[[40,1]],[[0,1]]],[[[17,1]], +[[0,1]]],[[[103,1]],[[56,2],[104,2],[99,2]],[[0,2]]],[[[41,1]],[[105,2]],[[2,4],[35,3]],[[61,5],[81,6]],[[0,4]],[[2,4]],[[61,5]]],[[[106,1]],[[106,1],[0,1]]],[[[27,1]],[[82,2]],[[0,2]]],[[[49,1],[107,2],[53,3]],[[48,4],[54,5],[52,6],[0,1]],[[54,5],[52,6],[0,2]],[[95,7]],[[49,7]],[[0,5]],[[49,8],[107,8],[0,6]],[[54,5],[52,9],[0,7]],[[52,6],[0,8]],[[49,10],[53,11],[0,9]],[[48,12]],[[95,13]],[[49,13]],[[52,9],[0,13]]],[[[105,1]],[[108,2],[0,1]],[[25,3]],[[0,3]]],[[[109,1]],[[52,0],[0,1]]],[[[25,1]], +[[110,0],[0,1]]],[[[25,1]],[[0,1]]],[[[111,1]],[[2,1],[112,2]],[[0,2]]],[[[113,1]],[[49,2],[0,1]],[[108,3],[52,3],[0,2]],[[49,4]],[[0,4]]],[[[114,1]],[[115,0],[0,1]]],[[[116,1]],[[117,2],[50,3],[118,4],[0,1]],[[111,4],[62,4]],[[116,5],[62,5]],[[0,4]],[[50,3],[0,5]]],[[[95,1],[107,1]],[[52,2],[0,1]],[[95,1],[107,1],[0,2]]],[[[119,2],[30,1],[22,1],[43,1]],[[120,2]],[[0,2]]],[[[2,0],[112,1],[121,0]],[[0,1]]],[[[122,1],[123,1],[124,1],[125,1],[126,1]],[[0,1]]],[[[34,1]],[[82,2]],[[83,3]],[[111,4]],[[48, +5]],[[80,6]],[[127,7],[0,6]],[[48,8]],[[80,9]],[[0,9]]],[[[4,1]],[[25,2]],[[128,3]],[[48,4],[129,5]],[[80,6]],[[49,7]],[[0,6]],[[48,4]]],[[[26,1]],[[25,2]],[[52,1],[0,2]]],[[[37,1]],[[49,2]],[[48,3]],[[80,4]],[[127,5],[130,1],[0,4]],[[48,6]],[[80,7]],[[0,7]]],[[[25,1]],[[108,2],[0,1]],[[25,3]],[[0,3]]],[[[131,1]],[[52,2],[0,1]],[[131,1],[0,2]]],[[[36,1]],[[105,2],[19,3],[110,3]],[[32,4]],[[105,2],[19,3],[32,4],[110,3]],[[132,5],[15,5],[35,6]],[[0,5]],[[132,7]],[[61,5]]],[[[32,1]],[[133,2]],[[0,2]]], +[[[134,1],[135,1]],[[0,1]]],[[[14,1]],[[48,2],[136,3]],[[49,4]],[[48,2]],[[0,4]]],[[[14,1]],[[48,2],[136,3]],[[86,4]],[[48,2]],[[0,4]]],[[[18,1]],[[25,2]],[[52,1],[0,2]]],[[[8,1],[137,2]],[[46,2]],[[0,2]]],[[[138,1]],[[139,0],[0,1]]],[[[35,1]],[[61,2],[140,3]],[[0,2]],[[61,2]]],[[[28,1]],[[0,1]]],[[[141,1]],[[53,2],[0,1]],[[120,3]],[[0,3]]],[[[16,1]],[[49,2],[142,3],[0,1]],[[52,4],[0,2]],[[49,5]],[[49,2],[0,4]],[[52,6],[0,5]],[[49,7]],[[52,8],[0,7]],[[49,7],[0,8]]],[[[5,1]],[[49,2],[0,1]],[[36,3], +[52,3],[0,2]],[[49,4]],[[52,5],[0,4]],[[49,6]],[[0,6]]],[[[23,1]],[[111,2],[0,1]],[[0,2]]],[[[143,1]],[[144,0],[142,0],[0,1]]],[[[145,1]],[[2,2],[146,3]],[[0,2]],[[145,1],[2,2]]],[[[48,1]],[[49,2],[0,1]],[[0,2]]],[[[147,1],[148,1],[149,1],[150,1],[151,1],[152,1],[153,1],[154,1],[155,1],[156,1]],[[0,1]]],[[[15,1]],[[95,2]],[[0,2]]],[[[1,1],[3,1]],[[0,1]]],[[[49,1],[48,2]],[[48,2],[0,1]],[[49,3],[157,4],[0,2]],[[157,4],[0,3]],[[0,4]]],[[[158,1]],[[52,2],[0,1]],[[158,1],[0,2]]],[[[1,1],[2,2]],[[0,1]], +[[159,3]],[[121,4]],[[160,1],[121,4]]],[[[120,1]],[[161,0],[15,0],[162,0],[41,0],[163,0],[0,1]]],[[[84,1],[164,2]],[[37,3],[0,1]],[[0,2]],[[84,4]],[[127,5]],[[49,2]]],[[[165,1],[84,1]],[[0,1]]],[[[49,1]],[[52,2],[0,1]],[[49,1],[0,2]]],[[[49,1],[107,1]],[[54,2],[52,3],[0,1]],[[0,2]],[[49,4],[107,4],[0,3]],[[52,3],[0,4]]],[[[49,1],[107,1]],[[52,2],[0,1]],[[49,1],[107,1],[0,2]]],[[[25,1]],[[48,2],[0,1]],[[49,3]],[[0,3]]],[[[35,1],[110,2],[38,3]],[[61,4],[81,5]],[[25,4]],[[166,6]],[[0,4]],[[61,4]],[[64, +4]]],[[[20,1]],[[48,2]],[[80,3]],[[167,4],[168,5]],[[48,6]],[[48,7]],[[80,8]],[[80,9]],[[167,4],[127,10],[168,5],[0,8]],[[0,9]],[[48,11]],[[80,12]],[[168,5],[0,12]]],[[[15,1],[169,2],[53,3]],[[169,4],[52,5],[0,1]],[[50,6],[52,7],[0,2]],[[169,8]],[[52,5],[0,4]],[[169,9],[53,3],[0,5]],[[49,10]],[[15,11],[169,2],[53,3],[0,7]],[[52,12],[0,8]],[[50,13],[52,5],[0,9]],[[52,7],[0,10]],[[169,14],[52,15],[0,11]],[[0,12]],[[49,4]],[[52,15],[0,14]],[[169,16],[53,3],[0,15]],[[50,17],[52,15],[0,16]],[[49,14]]], +[[[15,1],[53,2],[170,3]],[[170,5],[52,4],[0,1]],[[170,6]],[[50,7],[52,8],[0,3]],[[53,2],[170,9],[0,4]],[[52,4],[0,5]],[[52,10],[0,6]],[[49,11]],[[15,12],[53,2],[170,3],[0,8]],[[50,13],[52,4],[0,9]],[[0,10]],[[52,8],[0,11]],[[52,15],[170,14],[0,12]],[[49,5]],[[52,15],[0,14]],[[53,2],[170,16],[0,15]],[[50,17],[52,15],[0,16]],[[49,14]]],[[[25,1]],[[0,1]]],[[[21,1]],[[49,2]],[[48,3]],[[80,4]],[[127,5],[0,4]],[[48,6]],[[80,7]],[[0,7]]],[[[49,1]],[[108,2],[0,1]],[[95,3]],[[0,3]]],[[[42,1]],[[171,2]],[[48, +3],[52,1]],[[80,4]],[[0,4]]],[[[172,1]],[[173,0],[0,1]]],[[[111,2],[36,1]],[[49,2]],[[0,2]]],[[[31,1]],[[174,2],[0,1]],[[0,2]]],[[[62,1]],[[0,1]]]],labels:[[0,"EMPTY"],[317,null],[4,null],[276,null],[1,"def"],[1,"raise"],[1,"True"],[3,null],[1,"not"],[1,"null"],[55,null],[2,null],[25,null],[1,"class"],[1,"lambda"],[16,null],[1,"print"],[1,"debugger"],[1,"nonlocal"],[52,null],[1,"try"],[1,"while"],[31,null],[1,"return"],[1,"assert"],[1,null],[1,"global"],[1,"del"],[1,"pass"],[54,null],[15,null],[1, +"yield"],[1,"import"],[1,"False"],[1,"for"],[7,null],[1,"from"],[1,"if"],[9,null],[1,"break"],[1,"continue"],[49,null],[1,"with"],[14,null],[316,null],[19,null],[308,null],[1,"and"],[11,null],[326,null],[22,null],[261,null],[12,null],[35,null],[271,null],[325,null],[297,null],[339,null],[296,null],[26,null],[283,null],[8,null],[342,null],[329,null],[10,null],[266,null],[332,null],[45,null],[38,null],[40,null],[50,null],[46,null],[41,null],[42,null],[36,null],[43,null],[48,null],[44,null],[37,null], +[39,null],[324,null],[260,null],[292,null],[1,"in"],[309,null],[273,null],[327,null],[272,null],[28,null],[21,null],[27,null],[29,null],[1,"is"],[30,null],[20,null],[290,null],[274,null],[333,null],[299,null],[270,null],[337,null],[279,null],[265,null],[281,null],[264,null],[286,null],[280,null],[320,null],[1,"as"],[284,null],[23,null],[328,null],[0,null],[1,"except"],[340,null],[18,null],[330,null],[268,null],[259,null],[312,null],[293,null],[321,null],[269,null],[277,null],[314,null],[315,null], +[343,null],[1,"else"],[310,null],[51,null],[1,"elif"],[300,null],[301,null],[285,null],[303,null],[302,null],[335,null],[275,null],[258,null],[1,"or"],[334,null],[267,null],[34,null],[262,null],[33,null],[319,null],[13,null],[295,null],[263,null],[291,null],[311,null],[307,null],[313,null],[282,null],[298,null],[304,null],[278,null],[318,null],[322,null],[5,null],[6,null],[47,null],[17,null],[24,null],[305,null],[306,null],[323,null],[289,null],[1,"finally"],[331,null],[336,null],[338,null],[257, +null],[32,null],[341,null]],keywords:{False:33,"null":9,True:6,and:47,as:108,assert:24,"break":39,"class":13,"continue":40,"debugger":17,def:4,del:27,elif:130,"else":127,except:113,"finally":168,"for":34,from:36,global:26,"if":37,"import":32,"in":83,is:92,lambda:14,nonlocal:18,not:8,or:139,pass:28,print:16,raise:5,"return":23,"try":20,"while":21,"with":42,yield:31},tokens:{0:112,1:25,2:11,3:7,4:2,5:159,6:160,7:35,8:61,9:38,10:64,11:48,12:52,13:146,14:43,15:30,16:15,17:162,18:115,19:45,20:94,21:89, +22:50,23:110,24:163,25:12,26:59,27:90,28:88,29:91,30:93,31:22,32:173,33:144,34:142,35:53,36:74,37:78,38:68,39:79,40:69,41:72,42:73,43:75,44:77,45:67,46:71,47:161,48:76,49:41,50:70,51:129,52:19,54:29,55:10},start:256}},function(m,p){function a(a,b){this.filename=a;this.grammar=b;this.p_flags=0;return this}function b(b,d){void 0===d&&(d="file_input");b=new a(b,Sk.ParseTables);"file_input"===d?b.setup(Sk.ParseTables.sym.file_input):Sk.asserts.fail("todo;");return b}a.FUTURE_PRINT_FUNCTION="print_function"; +a.FUTURE_UNICODE_LITERALS="unicode_literals";a.FUTURE_DIVISION="division";a.FUTURE_ABSOLUTE_IMPORT="absolute_import";a.FUTURE_WITH_STATEMENT="with_statement";a.FUTURE_NESTED_SCOPES="nested_scopes";a.FUTURE_GENERATORS="generators";a.CO_FUTURE_PRINT_FUNCTION=65536;a.CO_FUTURE_UNICODE_LITERALS=131072;a.CO_FUTURE_DIVISON=8192;a.CO_FUTURE_ABSOLUTE_IMPORT=16384;a.CO_FUTURE_WITH_STATEMENT=32768;a.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={}};a.prototype.addtoken=function(a,b,e){var c,d=this.classify(a,b,e);a:for(;;){var f=this.stack[this.stack.length-1];var k=f.dfa[0];var n=k[f.state];for(c=0;c<n.length;++c){var l=n[c][0];var q=n[c][1];var m=this.grammar.labels[l][0];if(d===l){Sk.asserts.assert(256>m);this.shift(a,b,q,e);for(e=q;1===k[e].length&&0===k[e][0][0]&&k[e][0][1]===e;){this.pop();if(0===this.stack.length)return!0;f=this.stack[this.stack.length-1];e=f.state;k=f.dfa[0]}return!1}if(256<= +m&&(l=this.grammar.dfas[m],l=l[1],l.hasOwnProperty(d))){this.push(m,this.grammar.dfas[m],q,e);continue a}}b:{k=[0,f.state];for(f=n.length;f--;)if(n[f][0]===k[0]&&n[f][1]===k[1]){n=!0;break b}n=!1}if(n){if(this.pop(),0===this.stack.length)throw new Sk.builtin.SyntaxError("too much input",this.filename);}else throw a=e[0][0],new Sk.builtin.SyntaxError("bad input",this.filename,a,e);}};a.prototype.classify=function(b,d,e){if(b===Sk.token.tokens.T_NAME){this.used_names[d]=!0;var c=this.grammar.keywords.hasOwnProperty(d)&& +this.grammar.keywords[d];"print"===d&&(this.p_flags&a.CO_FUTURE_PRINT_FUNCTION||!0===Sk.__future__.print_function)&&(c=!1);if(c)return c}c=this.grammar.tokens.hasOwnProperty(b)&&this.grammar.tokens[b];if(!c){d="#"+b;for(let a in Sk.token.tokens)if(Sk.token.tokens[a]==b){d=a;break}throw new Sk.builtin.SyntaxError("bad token "+d,this.filename,e[0][0],e);}return c};a.prototype.shift=function(a,b,e,h){var c=this.stack[this.stack.length-1].dfa,d=this.stack[this.stack.length-1].node;d.children.push({type:a, +value:b,lineno:h[0][0],col_offset:h[0][1],children:null});this.stack[this.stack.length-1]={dfa:c,state:e,node:d}};a.prototype.push=function(a,b,e,h){a={type:a,value:null,lineno:h[0][0],col_offset:h[0][1],children:[]};this.stack[this.stack.length-1]={dfa:this.stack[this.stack.length-1].dfa,state:e,node:this.stack[this.stack.length-1].node};this.stack.push({dfa:b,state:0,node:a})};a.prototype.pop=function(){var a=this.stack.pop().node;if(a)if(0!==this.stack.length){var b=this.stack[this.stack.length- +1].node;b.children.push(a)}else this.rootnode=a,this.rootnode.used_names=this.used_names};Sk.parse=function(a,d){var c=Sk.token.tokens.T_COMMENT,h=Sk.token.tokens.T_NL,g=Sk.token.tokens.T_OP,f=Sk.token.tokens.T_ENDMARKER,k=Sk.token.tokens.T_ENCODING,n=!1,l=b(a);Sk._tokenize(a,function(a){var b=a.split("\n").reverse().map(function(a){return a+"\n"});return function(){if(0===b.length)throw new Sk.builtin.Exception("EOF");return b.pop()}}(d),"utf-8",function(a){var b=null;a.type!==c&&a.type!==h&&a.type!== +k&&(a.type===g&&(b=Sk.OpMap[a.string]),l.addtoken(b||a.type,a.string,[a.start,a.end,a.line]),a.type===f&&(n=!0))});if(!n)throw new Sk.builtin.SyntaxError("incomplete input",this.filename);return{cst:l.rootnode,flags:l.p_flags}};Sk.parseTreeDump=function(a,b){var c;b=b||"";var 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.token.tok_name[a.type]+": "+(new Sk.builtin.str(a.value)).$r().v+"\n";return d}; +Sk.exportSymbol("Sk.Parser",a);Sk.exportSymbol("Sk.parse",Sk.parse);Sk.exportSymbol("Sk.parseTreeDump",Sk.parseTreeDump)},function(m,p){Sk.astnodes={};Sk.astnodes.Load=function(){};Sk.astnodes.Store=function(){};Sk.astnodes.Del=function(){};Sk.astnodes.AugLoad=function(){};Sk.astnodes.AugStore=function(){};Sk.astnodes.Param=function(){};Sk.astnodes.And=function(){};Sk.astnodes.Or=function(){};Sk.astnodes.Add=function(){};Sk.astnodes.Sub=function(){};Sk.astnodes.Mult=function(){};Sk.astnodes.MatMult= +function(){};Sk.astnodes.Div=function(){};Sk.astnodes.Mod=function(){};Sk.astnodes.Pow=function(){};Sk.astnodes.LShift=function(){};Sk.astnodes.RShift=function(){};Sk.astnodes.BitOr=function(){};Sk.astnodes.BitXor=function(){};Sk.astnodes.BitAnd=function(){};Sk.astnodes.FloorDiv=function(){};Sk.astnodes.Invert=function(){};Sk.astnodes.Not=function(){};Sk.astnodes.UAdd=function(){};Sk.astnodes.USub=function(){};Sk.astnodes.Eq=function(){};Sk.astnodes.NotEq=function(){};Sk.astnodes.Lt=function(){}; +Sk.astnodes.LtE=function(){};Sk.astnodes.Gt=function(){};Sk.astnodes.GtE=function(){};Sk.astnodes.Is=function(){};Sk.astnodes.IsNot=function(){};Sk.astnodes.In=function(){};Sk.astnodes.NotIn=function(){};Sk.astnodes.Module=function(a,b){this.body=a;this.docstring=b;return this};Sk.astnodes.Interactive=function(a){this.body=a;return this};Sk.astnodes.Expression=function(a){this.body=a;return this};Sk.astnodes.Suite=function(a){this.body=a;return this};Sk.astnodes.FunctionDef=function(a,b,c,d,e,h,g, +f){Sk.asserts.assert(null!==g&&void 0!==g);Sk.asserts.assert(null!==f&&void 0!==f);this.name=a;this.args=b;this.body=c;this.decorator_list=d;this.returns=e;this.docstring=h;this.lineno=g;this.col_offset=f;return this};Sk.astnodes.AsyncFunctionDef=function(a,b,c,d,e,h,g,f){Sk.asserts.assert(null!==g&&void 0!==g);Sk.asserts.assert(null!==f&&void 0!==f);this.name=a;this.args=b;this.body=c;this.decorator_list=d;this.returns=e;this.docstring=h;this.lineno=g;this.col_offset=f;return this};Sk.astnodes.ClassDef= +function(a,b,c,d,e,h,g,f){Sk.asserts.assert(null!==g&&void 0!==g);Sk.asserts.assert(null!==f&&void 0!==f);this.name=a;this.bases=b;this.keywords=c;this.body=d;this.decorator_list=e;this.docstring=h;this.lineno=g;this.col_offset=f;return this};Sk.astnodes.Return=function(a,b,c){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==c&&void 0!==c);this.value=a;this.lineno=b;this.col_offset=c;return this};Sk.astnodes.Delete=function(a,b,c){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!== +c&&void 0!==c);this.targets=a;this.lineno=b;this.col_offset=c;return this};Sk.astnodes.Assign=function(a,b,c,d){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==d&&void 0!==d);this.targets=a;this.value=b;this.lineno=c;this.col_offset=d;return this};Sk.astnodes.AugAssign=function(a,b,c,d,e){Sk.asserts.assert(null!==d&&void 0!==d);Sk.asserts.assert(null!==e&&void 0!==e);this.target=a;this.op=b;this.value=c;this.lineno=d;this.col_offset=e;return this};Sk.astnodes.AnnAssign=function(a, +b,c,d,e,h){Sk.asserts.assert(null!==e&&void 0!==e);Sk.asserts.assert(null!==h&&void 0!==h);this.target=a;this.annotation=b;this.value=c;this.simple=d;this.lineno=e;this.col_offset=h;return this};Sk.astnodes.For=function(a,b,c,d,e,h){Sk.asserts.assert(null!==e&&void 0!==e);Sk.asserts.assert(null!==h&&void 0!==h);this.target=a;this.iter=b;this.body=c;this.orelse=d;this.lineno=e;this.col_offset=h;return this};Sk.astnodes.AsyncFor=function(a,b,c,d,e,h){Sk.asserts.assert(null!==e&&void 0!==e);Sk.asserts.assert(null!== +h&&void 0!==h);this.target=a;this.iter=b;this.body=c;this.orelse=d;this.lineno=e;this.col_offset=h;return this};Sk.astnodes.While=function(a,b,c,d,e){Sk.asserts.assert(null!==d&&void 0!==d);Sk.asserts.assert(null!==e&&void 0!==e);this.test=a;this.body=b;this.orelse=c;this.lineno=d;this.col_offset=e;return this};Sk.astnodes.If=function(a,b,c,d,e){Sk.asserts.assert(null!==d&&void 0!==d);Sk.asserts.assert(null!==e&&void 0!==e);this.test=a;this.body=b;this.orelse=c;this.lineno=d;this.col_offset=e;return this}; +Sk.astnodes.With=function(a,b,c,d){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==d&&void 0!==d);this.items=a;this.body=b;this.lineno=c;this.col_offset=d;return this};Sk.astnodes.AsyncWith=function(a,b,c,d){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==d&&void 0!==d);this.items=a;this.body=b;this.lineno=c;this.col_offset=d;return this};Sk.astnodes.Raise=function(a,b,c,d,e,h){Sk.asserts.assert(null!==e&&void 0!==e);Sk.asserts.assert(null!==h&&void 0!==h);this.exc= +a;this.cause=b;this.inst=c;this.tback=d;this.lineno=e;this.col_offset=h;return this};Sk.astnodes.Try=function(a,b,c,d,e,h){Sk.asserts.assert(null!==e&&void 0!==e);Sk.asserts.assert(null!==h&&void 0!==h);this.body=a;this.handlers=b;this.orelse=c;this.finalbody=d;this.lineno=e;this.col_offset=h;return this};Sk.astnodes.Assert=function(a,b,c,d){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==d&&void 0!==d);this.test=a;this.msg=b;this.lineno=c;this.col_offset=d;return this};Sk.astnodes.Import= +function(a,b,c){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==c&&void 0!==c);this.names=a;this.lineno=b;this.col_offset=c;return this};Sk.astnodes.ImportFrom=function(a,b,c,d,e){Sk.asserts.assert(null!==d&&void 0!==d);Sk.asserts.assert(null!==e&&void 0!==e);this.module=a;this.names=b;this.level=c;this.lineno=d;this.col_offset=e;return this};Sk.astnodes.Global=function(a,b,c){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==c&&void 0!==c);this.names=a;this.lineno= +b;this.col_offset=c;return this};Sk.astnodes.Nonlocal=function(a,b,c){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==c&&void 0!==c);this.names=a;this.lineno=b;this.col_offset=c;return this};Sk.astnodes.Expr=function(a,b,c){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==c&&void 0!==c);this.value=a;this.lineno=b;this.col_offset=c;return this};Sk.astnodes.Pass=function(a,b){Sk.asserts.assert(null!==a&&void 0!==a);Sk.asserts.assert(null!==b&&void 0!==b);this.lineno= +a;this.col_offset=b;return this};Sk.astnodes.Break=function(a,b){Sk.asserts.assert(null!==a&&void 0!==a);Sk.asserts.assert(null!==b&&void 0!==b);this.lineno=a;this.col_offset=b;return this};Sk.astnodes.Continue=function(a,b){Sk.asserts.assert(null!==a&&void 0!==a);Sk.asserts.assert(null!==b&&void 0!==b);this.lineno=a;this.col_offset=b;return this};Sk.astnodes.Print=function(a,b,c,d,e){Sk.asserts.assert(null!==d&&void 0!==d);Sk.asserts.assert(null!==e&&void 0!==e);this.dest=a;this.values=b;this.nl= +c;this.lineno=d;this.col_offset=e;return this};Sk.astnodes.Debugger=function(a,b){Sk.asserts.assert(null!==a&&void 0!==a);Sk.asserts.assert(null!==b&&void 0!==b);this.lineno=a;this.col_offset=b;return this};Sk.astnodes.BoolOp=function(a,b,c,d){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==d&&void 0!==d);this.op=a;this.values=b;this.lineno=c;this.col_offset=d;return this};Sk.astnodes.BinOp=function(a,b,c,d,e){Sk.asserts.assert(null!==d&&void 0!==d);Sk.asserts.assert(null!==e&&void 0!== +e);this.left=a;this.op=b;this.right=c;this.lineno=d;this.col_offset=e;return this};Sk.astnodes.UnaryOp=function(a,b,c,d){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==d&&void 0!==d);this.op=a;this.operand=b;this.lineno=c;this.col_offset=d;return this};Sk.astnodes.Lambda=function(a,b,c,d){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==d&&void 0!==d);this.args=a;this.body=b;this.lineno=c;this.col_offset=d;return this};Sk.astnodes.IfExp=function(a,b,c,d,e){Sk.asserts.assert(null!== +d&&void 0!==d);Sk.asserts.assert(null!==e&&void 0!==e);this.test=a;this.body=b;this.orelse=c;this.lineno=d;this.col_offset=e;return this};Sk.astnodes.Dict=function(a,b,c,d){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==d&&void 0!==d);this.keys=a;this.values=b;this.lineno=c;this.col_offset=d;return this};Sk.astnodes.Set=function(a,b,c){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==c&&void 0!==c);this.elts=a;this.lineno=b;this.col_offset=c;return this};Sk.astnodes.ListComp= +function(a,b,c,d){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==d&&void 0!==d);this.elt=a;this.generators=b;this.lineno=c;this.col_offset=d;return this};Sk.astnodes.SetComp=function(a,b,c,d){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==d&&void 0!==d);this.elt=a;this.generators=b;this.lineno=c;this.col_offset=d;return this};Sk.astnodes.DictComp=function(a,b,c,d,e){Sk.asserts.assert(null!==d&&void 0!==d);Sk.asserts.assert(null!==e&&void 0!==e);this.key=a;this.value= +b;this.generators=c;this.lineno=d;this.col_offset=e;return this};Sk.astnodes.GeneratorExp=function(a,b,c,d){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==d&&void 0!==d);this.elt=a;this.generators=b;this.lineno=c;this.col_offset=d;return this};Sk.astnodes.Await=function(a,b,c){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==c&&void 0!==c);this.value=a;this.lineno=b;this.col_offset=c;return this};Sk.astnodes.Yield=function(a,b,c){Sk.asserts.assert(null!==b&&void 0!== +b);Sk.asserts.assert(null!==c&&void 0!==c);this.value=a;this.lineno=b;this.col_offset=c;return this};Sk.astnodes.YieldFrom=function(a,b,c){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==c&&void 0!==c);this.value=a;this.lineno=b;this.col_offset=c;return this};Sk.astnodes.Compare=function(a,b,c,d,e){Sk.asserts.assert(null!==d&&void 0!==d);Sk.asserts.assert(null!==e&&void 0!==e);this.left=a;this.ops=b;this.comparators=c;this.lineno=d;this.col_offset=e;return this};Sk.astnodes.Call= +function(a,b,c,d,e){Sk.asserts.assert(null!==d&&void 0!==d);Sk.asserts.assert(null!==e&&void 0!==e);this.func=a;this.args=b;this.keywords=c;this.lineno=d;this.col_offset=e;return this};Sk.astnodes.Num=function(a,b,c){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==c&&void 0!==c);this.n=a;this.lineno=b;this.col_offset=c;return this};Sk.astnodes.Str=function(a,b,c){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==c&&void 0!==c);this.s=a;this.lineno=b;this.col_offset= +c;return this};Sk.astnodes.FormattedValue=function(a,b,c,d,e){Sk.asserts.assert(null!==d&&void 0!==d);Sk.asserts.assert(null!==e&&void 0!==e);this.value=a;this.conversion=b;this.format_spec=c;this.lineno=d;this.col_offset=e;return this};Sk.astnodes.JoinedStr=function(a,b,c){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==c&&void 0!==c);this.values=a;this.lineno=b;this.col_offset=c;return this};Sk.astnodes.Bytes=function(a,b,c){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!== +c&&void 0!==c);this.s=a;this.lineno=b;this.col_offset=c;return this};Sk.astnodes.NameConstant=function(a,b,c){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==c&&void 0!==c);this.value=a;this.lineno=b;this.col_offset=c;return this};Sk.astnodes.Ellipsis=function(a,b){Sk.asserts.assert(null!==a&&void 0!==a);Sk.asserts.assert(null!==b&&void 0!==b);this.lineno=a;this.col_offset=b;return this};Sk.astnodes.Constant=function(a,b,c){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!== +c&&void 0!==c);this.value=a;this.lineno=b;this.col_offset=c;return this};Sk.astnodes.Attribute=function(a,b,c,d,e){Sk.asserts.assert(null!==d&&void 0!==d);Sk.asserts.assert(null!==e&&void 0!==e);this.value=a;this.attr=b;this.ctx=c;this.lineno=d;this.col_offset=e;return this};Sk.astnodes.Subscript=function(a,b,c,d,e){Sk.asserts.assert(null!==d&&void 0!==d);Sk.asserts.assert(null!==e&&void 0!==e);this.value=a;this.slice=b;this.ctx=c;this.lineno=d;this.col_offset=e;return this};Sk.astnodes.Starred=function(a, +b,c,d){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==d&&void 0!==d);this.value=a;this.ctx=b;this.lineno=c;this.col_offset=d;return this};Sk.astnodes.Name=function(a,b,c,d){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==d&&void 0!==d);this.id=a;this.ctx=b;this.lineno=c;this.col_offset=d;return this};Sk.astnodes.List=function(a,b,c,d){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==d&&void 0!==d);this.elts=a;this.ctx=b;this.lineno=c;this.col_offset= +d;return this};Sk.astnodes.Tuple=function(a,b,c,d){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==d&&void 0!==d);this.elts=a;this.ctx=b;this.lineno=c;this.col_offset=d;return this};Sk.astnodes.Slice=function(a,b,c){this.lower=a;this.upper=b;this.step=c;return this};Sk.astnodes.ExtSlice=function(a){this.dims=a;return this};Sk.astnodes.Index=function(a){this.value=a;return this};Sk.astnodes.comprehension=function(a,b,c,d){this.target=a;this.iter=b;this.ifs=c;this.is_async=d;return this}; +Sk.astnodes.ExceptHandler=function(a,b,c,d,e){Sk.asserts.assert(null!==d&&void 0!==d);Sk.asserts.assert(null!==e&&void 0!==e);this.type=a;this.name=b;this.body=c;this.lineno=d;this.col_offset=e;return this};Sk.astnodes.arguments_=function(a,b,c,d,e,h){this.args=a;this.vararg=b;this.kwonlyargs=c;this.kw_defaults=d;this.kwarg=e;this.defaults=h;return this};Sk.astnodes.arg=function a(a,b){this.arg=a;this.annotation=b;return this};Sk.astnodes.keyword=function(a,b){this.arg=a;this.value=b;return this}; +Sk.astnodes.alias=function(a,b){this.name=a;this.asname=b;return this};Sk.astnodes.withitem=function(a,b){this.context_expr=a;this.optional_vars=b;return this};Sk.astnodes.Module.prototype._astname="Module";Sk.astnodes.Module.prototype._fields=["body",function(a){return a.body},"docstring",function(a){return a.docstring}];Sk.astnodes.Interactive.prototype._astname="Interactive";Sk.astnodes.Interactive.prototype._fields=["body",function(a){return a.body}];Sk.astnodes.Expression.prototype._astname= +"Expression";Sk.astnodes.Expression.prototype._fields=["body",function(a){return a.body}];Sk.astnodes.Suite.prototype._astname="Suite";Sk.astnodes.Suite.prototype._fields=["body",function(a){return a.body}];Sk.astnodes.FunctionDef.prototype._astname="FunctionDef";Sk.astnodes.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},"returns",function(a){return a.returns}, +"docstring",function(a){return a.docstring}];Sk.astnodes.AsyncFunctionDef.prototype._astname="AsyncFunctionDef";Sk.astnodes.AsyncFunctionDef.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},"returns",function(a){return a.returns},"docstring",function(a){return a.docstring}];Sk.astnodes.ClassDef.prototype._astname="ClassDef";Sk.astnodes.ClassDef.prototype._fields=["name",function(a){return a.name}, +"bases",function(a){return a.bases},"keywords",function(a){return a.keywords},"body",function(a){return a.body},"decorator_list",function(a){return a.decorator_list},"docstring",function(a){return a.docstring}];Sk.astnodes.Return.prototype._astname="Return";Sk.astnodes.Return.prototype._fields=["value",function(a){return a.value}];Sk.astnodes.Delete.prototype._astname="Delete";Sk.astnodes.Delete.prototype._fields=["targets",function(a){return a.targets}];Sk.astnodes.Assign.prototype._astname="Assign"; +Sk.astnodes.Assign.prototype._fields=["targets",function(a){return a.targets},"value",function(a){return a.value}];Sk.astnodes.AugAssign.prototype._astname="AugAssign";Sk.astnodes.AugAssign.prototype._fields=["target",function(a){return a.target},"op",function(a){return a.op},"value",function(a){return a.value}];Sk.astnodes.AnnAssign.prototype._astname="AnnAssign";Sk.astnodes.AnnAssign.prototype._fields=["target",function(a){return a.target},"annotation",function(a){return a.annotation},"value",function(a){return a.value}, +"simple",function(a){return a.simple}];Sk.astnodes.For.prototype._astname="For";Sk.astnodes.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}];Sk.astnodes.AsyncFor.prototype._astname="AsyncFor";Sk.astnodes.AsyncFor.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}];Sk.astnodes.While.prototype._astname= +"While";Sk.astnodes.While.prototype._fields=["test",function(a){return a.test},"body",function(a){return a.body},"orelse",function(a){return a.orelse}];Sk.astnodes.If.prototype._astname="If";Sk.astnodes.If.prototype._fields=["test",function(a){return a.test},"body",function(a){return a.body},"orelse",function(a){return a.orelse}];Sk.astnodes.With.prototype._astname="With";Sk.astnodes.With.prototype._fields=["items",function(a){return a.items},"body",function(a){return a.body}];Sk.astnodes.AsyncWith.prototype._astname= +"AsyncWith";Sk.astnodes.AsyncWith.prototype._fields=["items",function(a){return a.items},"body",function(a){return a.body}];Sk.astnodes.Raise.prototype._astname="Raise";Sk.astnodes.Raise.prototype._fields=["exc",function(a){return a.exc},"cause",function(a){return a.cause},"inst",function(a){return a.inst},"tback",function(a){return a.tback}];Sk.astnodes.Try.prototype._astname="Try";Sk.astnodes.Try.prototype._fields=["body",function(a){return a.body},"handlers",function(a){return a.handlers},"orelse", +function(a){return a.orelse},"finalbody",function(a){return a.finalbody}];Sk.astnodes.Assert.prototype._astname="Assert";Sk.astnodes.Assert.prototype._fields=["test",function(a){return a.test},"msg",function(a){return a.msg}];Sk.astnodes.Import.prototype._astname="Import";Sk.astnodes.Import.prototype._fields=["names",function(a){return a.names}];Sk.astnodes.ImportFrom.prototype._astname="ImportFrom";Sk.astnodes.ImportFrom.prototype._fields=["module",function(a){return a.module},"names",function(a){return a.names}, +"level",function(a){return a.level}];Sk.astnodes.Global.prototype._astname="Global";Sk.astnodes.Global.prototype._fields=["names",function(a){return a.names}];Sk.astnodes.Nonlocal.prototype._astname="Nonlocal";Sk.astnodes.Nonlocal.prototype._fields=["names",function(a){return a.names}];Sk.astnodes.Expr.prototype._astname="Expr";Sk.astnodes.Expr.prototype._fields=["value",function(a){return a.value}];Sk.astnodes.Pass.prototype._astname="Pass";Sk.astnodes.Pass.prototype._fields=[];Sk.astnodes.Break.prototype._astname= +"Break";Sk.astnodes.Break.prototype._fields=[];Sk.astnodes.Continue.prototype._astname="Continue";Sk.astnodes.Continue.prototype._fields=[];Sk.astnodes.Print.prototype._astname="Print";Sk.astnodes.Print.prototype._fields=["dest",function(a){return a.dest},"values",function(a){return a.values},"nl",function(a){return a.nl}];Sk.astnodes.Debugger.prototype._astname="Debugger";Sk.astnodes.Debugger.prototype._fields=[];Sk.astnodes.BoolOp.prototype._astname="BoolOp";Sk.astnodes.BoolOp.prototype._fields= +["op",function(a){return a.op},"values",function(a){return a.values}];Sk.astnodes.BinOp.prototype._astname="BinOp";Sk.astnodes.BinOp.prototype._fields=["left",function(a){return a.left},"op",function(a){return a.op},"right",function(a){return a.right}];Sk.astnodes.UnaryOp.prototype._astname="UnaryOp";Sk.astnodes.UnaryOp.prototype._fields=["op",function(a){return a.op},"operand",function(a){return a.operand}];Sk.astnodes.Lambda.prototype._astname="Lambda";Sk.astnodes.Lambda.prototype._fields=["args", +function(a){return a.args},"body",function(a){return a.body}];Sk.astnodes.IfExp.prototype._astname="IfExp";Sk.astnodes.IfExp.prototype._fields=["test",function(a){return a.test},"body",function(a){return a.body},"orelse",function(a){return a.orelse}];Sk.astnodes.Dict.prototype._astname="Dict";Sk.astnodes.Dict.prototype._fields=["keys",function(a){return a.keys},"values",function(a){return a.values}];Sk.astnodes.Set.prototype._astname="Set";Sk.astnodes.Set.prototype._fields=["elts",function(a){return a.elts}]; +Sk.astnodes.ListComp.prototype._astname="ListComp";Sk.astnodes.ListComp.prototype._fields=["elt",function(a){return a.elt},"generators",function(a){return a.generators}];Sk.astnodes.SetComp.prototype._astname="SetComp";Sk.astnodes.SetComp.prototype._fields=["elt",function(a){return a.elt},"generators",function(a){return a.generators}];Sk.astnodes.DictComp.prototype._astname="DictComp";Sk.astnodes.DictComp.prototype._fields=["key",function(a){return a.key},"value",function(a){return a.value},"generators", +function(a){return a.generators}];Sk.astnodes.GeneratorExp.prototype._astname="GeneratorExp";Sk.astnodes.GeneratorExp.prototype._fields=["elt",function(a){return a.elt},"generators",function(a){return a.generators}];Sk.astnodes.Await.prototype._astname="Await";Sk.astnodes.Await.prototype._fields=["value",function(a){return a.value}];Sk.astnodes.Yield.prototype._astname="Yield";Sk.astnodes.Yield.prototype._fields=["value",function(a){return a.value}];Sk.astnodes.YieldFrom.prototype._astname="YieldFrom"; +Sk.astnodes.YieldFrom.prototype._fields=["value",function(a){return a.value}];Sk.astnodes.Compare.prototype._astname="Compare";Sk.astnodes.Compare.prototype._fields=["left",function(a){return a.left},"ops",function(a){return a.ops},"comparators",function(a){return a.comparators}];Sk.astnodes.Call.prototype._astname="Call";Sk.astnodes.Call.prototype._fields=["func",function(a){return a.func},"args",function(a){return a.args},"keywords",function(a){return a.keywords}];Sk.astnodes.Num.prototype._astname= +"Num";Sk.astnodes.Num.prototype._fields=["n",function(a){return a.n}];Sk.astnodes.Str.prototype._astname="Str";Sk.astnodes.Str.prototype._fields=["s",function(a){return a.s}];Sk.astnodes.FormattedValue.prototype._astname="FormattedValue";Sk.astnodes.FormattedValue.prototype._fields=["value",function(a){return a.value},"conversion",function(a){return a.conversion},"format_spec",function(a){return a.format_spec}];Sk.astnodes.JoinedStr.prototype._astname="JoinedStr";Sk.astnodes.JoinedStr.prototype._fields= +["values",function(a){return a.values}];Sk.astnodes.Bytes.prototype._astname="Bytes";Sk.astnodes.Bytes.prototype._fields=["s",function(a){return a.s}];Sk.astnodes.NameConstant.prototype._astname="NameConstant";Sk.astnodes.NameConstant.prototype._fields=["value",function(a){return a.value}];Sk.astnodes.Ellipsis.prototype._astname="Ellipsis";Sk.astnodes.Ellipsis.prototype._fields=[];Sk.astnodes.Constant.prototype._astname="Constant";Sk.astnodes.Constant.prototype._fields=["value",function(a){return a.value}]; +Sk.astnodes.Attribute.prototype._astname="Attribute";Sk.astnodes.Attribute.prototype._fields=["value",function(a){return a.value},"attr",function(a){return a.attr},"ctx",function(a){return a.ctx}];Sk.astnodes.Subscript.prototype._astname="Subscript";Sk.astnodes.Subscript.prototype._fields=["value",function(a){return a.value},"slice",function(a){return a.slice},"ctx",function(a){return a.ctx}];Sk.astnodes.Starred.prototype._astname="Starred";Sk.astnodes.Starred.prototype._fields=["value",function(a){return a.value}, +"ctx",function(a){return a.ctx}];Sk.astnodes.Name.prototype._astname="Name";Sk.astnodes.Name.prototype._fields=["id",function(a){return a.id},"ctx",function(a){return a.ctx}];Sk.astnodes.List.prototype._astname="List";Sk.astnodes.List.prototype._fields=["elts",function(a){return a.elts},"ctx",function(a){return a.ctx}];Sk.astnodes.Tuple.prototype._astname="Tuple";Sk.astnodes.Tuple.prototype._fields=["elts",function(a){return a.elts},"ctx",function(a){return a.ctx}];Sk.astnodes.Load.prototype._astname= +"Load";Sk.astnodes.Load.prototype._isenum=!0;Sk.astnodes.Store.prototype._astname="Store";Sk.astnodes.Store.prototype._isenum=!0;Sk.astnodes.Del.prototype._astname="Del";Sk.astnodes.Del.prototype._isenum=!0;Sk.astnodes.AugLoad.prototype._astname="AugLoad";Sk.astnodes.AugLoad.prototype._isenum=!0;Sk.astnodes.AugStore.prototype._astname="AugStore";Sk.astnodes.AugStore.prototype._isenum=!0;Sk.astnodes.Param.prototype._astname="Param";Sk.astnodes.Param.prototype._isenum=!0;Sk.astnodes.Slice.prototype._astname= +"Slice";Sk.astnodes.Slice.prototype._fields=["lower",function(a){return a.lower},"upper",function(a){return a.upper},"step",function(a){return a.step}];Sk.astnodes.ExtSlice.prototype._astname="ExtSlice";Sk.astnodes.ExtSlice.prototype._fields=["dims",function(a){return a.dims}];Sk.astnodes.Index.prototype._astname="Index";Sk.astnodes.Index.prototype._fields=["value",function(a){return a.value}];Sk.astnodes.And.prototype._astname="And";Sk.astnodes.And.prototype._isenum=!0;Sk.astnodes.Or.prototype._astname= +"Or";Sk.astnodes.Or.prototype._isenum=!0;Sk.astnodes.Add.prototype._astname="Add";Sk.astnodes.Add.prototype._isenum=!0;Sk.astnodes.Sub.prototype._astname="Sub";Sk.astnodes.Sub.prototype._isenum=!0;Sk.astnodes.Mult.prototype._astname="Mult";Sk.astnodes.Mult.prototype._isenum=!0;Sk.astnodes.MatMult.prototype._astname="MatMult";Sk.astnodes.MatMult.prototype._isenum=!0;Sk.astnodes.Div.prototype._astname="Div";Sk.astnodes.Div.prototype._isenum=!0;Sk.astnodes.Mod.prototype._astname="Mod";Sk.astnodes.Mod.prototype._isenum= +!0;Sk.astnodes.Pow.prototype._astname="Pow";Sk.astnodes.Pow.prototype._isenum=!0;Sk.astnodes.LShift.prototype._astname="LShift";Sk.astnodes.LShift.prototype._isenum=!0;Sk.astnodes.RShift.prototype._astname="RShift";Sk.astnodes.RShift.prototype._isenum=!0;Sk.astnodes.BitOr.prototype._astname="BitOr";Sk.astnodes.BitOr.prototype._isenum=!0;Sk.astnodes.BitXor.prototype._astname="BitXor";Sk.astnodes.BitXor.prototype._isenum=!0;Sk.astnodes.BitAnd.prototype._astname="BitAnd";Sk.astnodes.BitAnd.prototype._isenum= +!0;Sk.astnodes.FloorDiv.prototype._astname="FloorDiv";Sk.astnodes.FloorDiv.prototype._isenum=!0;Sk.astnodes.Invert.prototype._astname="Invert";Sk.astnodes.Invert.prototype._isenum=!0;Sk.astnodes.Not.prototype._astname="Not";Sk.astnodes.Not.prototype._isenum=!0;Sk.astnodes.UAdd.prototype._astname="UAdd";Sk.astnodes.UAdd.prototype._isenum=!0;Sk.astnodes.USub.prototype._astname="USub";Sk.astnodes.USub.prototype._isenum=!0;Sk.astnodes.Eq.prototype._astname="Eq";Sk.astnodes.Eq.prototype._isenum=!0;Sk.astnodes.NotEq.prototype._astname= +"NotEq";Sk.astnodes.NotEq.prototype._isenum=!0;Sk.astnodes.Lt.prototype._astname="Lt";Sk.astnodes.Lt.prototype._isenum=!0;Sk.astnodes.LtE.prototype._astname="LtE";Sk.astnodes.LtE.prototype._isenum=!0;Sk.astnodes.Gt.prototype._astname="Gt";Sk.astnodes.Gt.prototype._isenum=!0;Sk.astnodes.GtE.prototype._astname="GtE";Sk.astnodes.GtE.prototype._isenum=!0;Sk.astnodes.Is.prototype._astname="Is";Sk.astnodes.Is.prototype._isenum=!0;Sk.astnodes.IsNot.prototype._astname="IsNot";Sk.astnodes.IsNot.prototype._isenum= +!0;Sk.astnodes.In.prototype._astname="In";Sk.astnodes.In.prototype._isenum=!0;Sk.astnodes.NotIn.prototype._astname="NotIn";Sk.astnodes.NotIn.prototype._isenum=!0;Sk.astnodes.comprehension.prototype._astname="comprehension";Sk.astnodes.comprehension.prototype._fields=["target",function(a){return a.target},"iter",function(a){return a.iter},"ifs",function(a){return a.ifs},"is_async",function(a){return a.is_async}];Sk.astnodes.ExceptHandler.prototype._astname="ExceptHandler";Sk.astnodes.ExceptHandler.prototype._fields= +["type",function(a){return a.type},"name",function(a){return a.name},"body",function(a){return a.body}];Sk.astnodes.arguments_.prototype._astname="arguments";Sk.astnodes.arguments_.prototype._fields=["args",function(a){return a.args},"vararg",function(a){return a.vararg},"kwonlyargs",function(a){return a.kwonlyargs},"kw_defaults",function(a){return a.kw_defaults},"kwarg",function(a){return a.kwarg},"defaults",function(a){return a.defaults}];Sk.astnodes.arg.prototype._astname="arg";Sk.astnodes.arg.prototype._fields= +["arg",function(a){return a.arg},"annotation",function(a){return a.annotation}];Sk.astnodes.keyword.prototype._astname="keyword";Sk.astnodes.keyword.prototype._fields=["arg",function(a){return a.arg},"value",function(a){return a.value}];Sk.astnodes.alias.prototype._astname="alias";Sk.astnodes.alias.prototype._fields=["name",function(a){return a.name},"asname",function(a){return a.asname}];Sk.astnodes.withitem.prototype._astname="withitem";Sk.astnodes.withitem.prototype._fields=["context_expr",function(a){return a.context_expr}, +"optional_vars",function(a){return a.optional_vars}];Sk.exportSymbol("Sk.astnodes",Sk.astnodes)},function(m,p){function a(a,b,c){this.c_encoding=a;this.c_filename=b;this.c_flags=c||0}function b(a){Sk.asserts.assert(void 0!==a,"node must be defined");return null===a.children?0:a.children.length}function c(a,b){Sk.asserts.assert(void 0!==a,"node must be defined");Sk.asserts.assert(void 0!==b,"index of child must be specified");return a.children[b]}function d(a,b){Sk.asserts.assert(a.type===b,"node wasn't expected type")} +function e(a,b,c){throw new Sk.builtin.SyntaxError(c,a.c_filename,b.lineno);}function h(a){Sk.asserts.assert("string"===typeof a,"expecting string, got "+typeof a);return new Sk.builtin.str(a)}function g(a){var d,f;switch(a.type){case r.single_input:if(c(a,0).type===w.T_NEWLINE)break;else return g(c(a,0));case r.file_input:for(d=f=0;d<b(a);++d){var e=c(a,d);e.type===r.stmt&&(f+=g(e))}return f;case r.stmt:return g(c(a,0));case r.compound_stmt:return 1;case r.simple_stmt:return Math.floor(b(a)/2);case r.suite:if(1=== +b(a))return g(c(a,0));f=0;for(d=2;d<b(a)-1;++d)f+=g(c(a,d));return f;default:Sk.asserts.fail("Non-statement found")}return 0}function f(a,b,c,d){c instanceof Sk.builtin.str&&(c=c.v);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 k(a,b,c,d){var e;Sk.asserts.assert(c!==Sk.astnodes.AugStore&&c!==Sk.astnodes.AugLoad,"context not AugStore or AugLoad"); +var g=e=null;switch(b.constructor){case Sk.astnodes.Attribute:case Sk.astnodes.Name:c===Sk.astnodes.Store&&f(a,d,b.attr,d.lineno);b.ctx=c;break;case Sk.astnodes.Starred:b.ctx=c;k(a,b.value,c,d);break;case Sk.astnodes.Subscript:b.ctx=c;break;case Sk.astnodes.List:b.ctx=c;e=b.elts;break;case Sk.astnodes.Tuple:if(0===b.elts.length)throw new Sk.builtin.SyntaxError("can't assign to ()",a.c_filename,d.lineno);b.ctx=c;e=b.elts;break;case Sk.astnodes.Lambda:g="lambda";break;case Sk.astnodes.Call:g="function call"; +break;case Sk.astnodes.BoolOp:case Sk.astnodes.BinOp:case Sk.astnodes.UnaryOp:g="operator";break;case Sk.astnodes.GeneratorExp:g="generator expression";break;case Sk.astnodes.Yield:g="yield expression";break;case Sk.astnodes.ListComp:g="list comprehension";break;case Sk.astnodes.SetComp:g="set comprehension";break;case Sk.astnodes.DictComp:g="dict comprehension";break;case Sk.astnodes.Dict:case Sk.astnodes.Set:case Sk.astnodes.Num:case Sk.astnodes.Str:g="literal";break;case Sk.astnodes.NameConstant:g= +"True, False or None";break;case Sk.astnodes.Compare:g="comparison";break;case Sk.astnodes.Repr:g="repr";break;case Sk.astnodes.IfExp:g="conditional expression";break;default:Sk.asserts.fail("unhandled expression in assignment")}if(g)throw new Sk.builtin.SyntaxError("can't "+(c===Sk.astnodes.Store?"assign to":"delete")+" "+g,a.c_filename,d.lineno);if(e)for(b=0;b<e.length;++b)k(a,e[b],c,d)}function n(a){if(void 0===Q[a.type])throw new Sk.builtin.SyntaxError("invalid syntax",a.type,a.lineno);return Q[a.type]} +function l(a,b){return a.value?new Sk.builtin.str(a.value):new Sk.builtin.str(a)}function q(a,f){d(f,r.comp_op);if(1===b(f))switch(f=c(f,0),f.type){case w.T_LESS:return Sk.astnodes.Lt;case w.T_GREATER:return Sk.astnodes.Gt;case w.T_EQEQUAL:return Sk.astnodes.Eq;case w.T_LESSEQUAL:return Sk.astnodes.LtE;case w.T_GREATEREQUAL:return Sk.astnodes.GtE;case w.T_NOTEQUAL:return Sk.astnodes.NotEq;case w.T_NAME:if("in"===f.value)return Sk.astnodes.In;if("is"===f.value)return Sk.astnodes.Is}else if(2===b(f)&& +c(f,0).type===w.T_NAME){if("in"===c(f,1).value)return Sk.astnodes.NotIn;if("is"===c(f,0).value)return Sk.astnodes.IsNot}Sk.asserts.fail("invalid comp_op")}function u(a,b){a&&(a.lineno=b.lineno,a.col_offset=b.col_offset,a.end_lineno=b.end_lineno,a.end_col_offset=b.end_col_offset);return a}function z(a,d){var f,e=[];Sk.asserts.assert(d.type===r.testlist||d.type===r.testlist_star_expr||d.type===r.listmaker||d.type===r.testlist_comp||d.type===r.testlist_safe||d.type===r.testlist1,"node type must be listlike"); +for(f=0;f<b(d);f+=2)Sk.asserts.assert(c(d,f).type===r.test||c(d,f).type===r.old_test||c(d,f).type===r.star_expr),e[f/2]=x(a,c(d,f));return e}function y(a,f){var e;d(f,r.suite);var k=[];var h=0;if(c(f,0).type===r.simple_stmt){f=c(f,0);var v=b(f)-1;c(f,v-1).type===w.T_SEMI&&--v;for(e=0;e<v;e+=2)k[h++]=O(a,c(f,e))}else for(e=2;e<b(f)-1;++e){v=c(f,e);d(v,r.stmt);var l=g(v);if(1===l)k[h++]=O(a,v);else for(v=c(v,0),d(v,r.simple_stmt),l=0;l<b(v);l+=2){if(0===b(c(v,l))){Sk.asserts.assert(l+1===b(v));break}k[h++]= +O(a,c(v,l))}}Sk.asserts.assert(h===g(f));return k}function t(a,f,e){var g;d(f,r.exprlist);var h=[];for(g=0;g<b(f);g+=2){var v=x(a,c(f,g));h[g/2]=v;e&&k(a,v,e,c(f,g))}return h}function H(a,d){a:for(;;)switch(d.type){case r.import_as_name:a=null;var f=h(c(d,0).value);3===b(d)&&(a=c(d,2).value);return new Sk.astnodes.alias(f,null==a?null:h(a));case r.dotted_as_name:if(1===b(d)){d=c(d,0);continue a}else return a=H(a,c(d,0)),Sk.asserts.assert(!a.asname),a.asname=h(c(d,2).value),a;case r.dotted_name:if(1=== +b(d))return new Sk.astnodes.alias(h(c(d,0).value),null);a="";for(f=0;f<b(d);f+=2)a+=c(d,f).value+".";return new Sk.astnodes.alias(h(a.substr(0,a.length-1)),null);case w.T_STAR:return new Sk.astnodes.alias(h("*"),null);default:throw new Sk.builtin.SyntaxError("unexpected import name",a.c_filename,d.lineno);}}function K(a,b){Sk.asserts.assert(b.type==r.testlist_comp||b.type==r.argument);return ca(a,b,0)}function C(a,d){if(c(d,0).type===w.T_MINUS&&2===b(d)){var f=c(d,1);if(f.type===r.factor&&1===b(f)&& +(f=c(f,0),f.type===r.power&&1===b(f))){var e=c(f,0);if(e.type===r.atom&&(f=c(e,0),f.type===w.T_NUMBER))return f.value="-"+f.value,G(a,e)}}a=x(a,c(d,1));switch(c(d,0).type){case w.T_PLUS:return new Sk.astnodes.UnaryOp(Sk.astnodes.UAdd,a,d.lineno,d.col_offset);case w.T_MINUS:return new Sk.astnodes.UnaryOp(Sk.astnodes.USub,a,d.lineno,d.col_offset);case w.T_TILDE:return new Sk.astnodes.UnaryOp(Sk.astnodes.Invert,a,d.lineno,d.col_offset)}Sk.asserts.fail("unhandled factor")}function F(a,g,k,h){var v,l, +n;d(g,r.arglist);for(v=n=l=0;v<b(g);v++){var D=c(g,v);D.type==r.argument&&(1==b(D)?l++:c(D,1).type==r.comp_for?(l++,h||e(a,D,"invalid syntax"),1<b(g)&&e(a,D,"Generator expression must be parenthesized")):c(D,0).type==w.T_STAR?l++:n++)}var B=[];var q=[];for(v=h=n=l=0;v<b(g);v++)if(D=c(g,v),D.type==r.argument){var P=c(D,0);if(1==b(D)){n&&(h?e(a,P,"positional argument follows keyword argument unpacking"):e(a,P,"positional argument follows keyword argument"));var m=x(a,P);if(!m)return null;B[l++]=m}else if(P.type== +w.T_STAR){if(h)return e(a,P,"iterable argument unpacking follows keyword argument unpacking"),null;m=x(a,c(D,1));if(!m)return null;D=new Sk.astnodes.Starred(m,Sk.astnodes.Load,P.lineno,P.col_offset);B[l++]=D}else if(P.type==w.T_DOUBLESTAR){v++;m=x(a,c(D,1));if(!m)return null;D=new Sk.astnodes.keyword(null,m);q[n++]=D;h++}else if(c(D,1).type==r.comp_for){m=K(a,D);if(!m)return null;B[l++]=m}else{var p;m=x(a,P);if(!m)return null;if(m.constructor===Sk.astnodes.Lambda)return e(a,P,"lambda cannot contain assignment"), +null;if(m.constructor!==Sk.astnodes.Name)return e(a,P,"keyword can't be an expression"),null;if(f(a,m.id,D,1))return null;var u=m.id;for(p=0;p<n;p++)if((m=q[p].arg)&&m===u)return e(a,P,"keyword argument repeated"),null;m=x(a,c(D,2));if(!m)return null;D=new Sk.astnodes.keyword(u,m);q[n++]=D}}return new Sk.astnodes.Call(k,B,q,k.lineno,k.col_offset)}function L(a,f,e){d(f,r.trailer);if(c(f,0).type==w.T_LPAR)return 2==b(f)?new Sk.astnodes.Call(e,null,null,f.lineno,f.col_offset):F(a,c(f,1),e,!0);if(c(f, +0).type==w.T_DOT){var g=l(c(f,1));return g?new Sk.astnodes.Attribute(e,g,Sk.astnodes.Load,f.lineno,f.col_offset):null}d(c(f,0),w.T_LSQB);d(c(f,2),w.T_RSQB);f=c(f,1);if(1==b(f))return(g=A(a,c(f,0)))?new Sk.astnodes.Subscript(e,g,Sk.astnodes.Load,f.lineno,f.col_offset):null;var k,h=1,v=[];for(k=0;k<b(f);k+=2){g=A(a,c(f,k));if(!g)return null;g.kind!=da.Index_kind&&(h=0);v[k/2]=g}if(!h)return new Sk.astnodes.Subscript(e,new Sk.astnodes.ExtSlice(v),Sk.astnodes.Load,f.lineno,f.col_offset);a=[];for(k=0;k< +v.length;++k)g=v[k],Sk.asserts.assert(g.kind==da.Index_kind&&g.v.Index.value),a[k]=g.v.Index.value;g=new Sk.astnodes.Tuple(a,Sk.astnodes.Load,f.lineno,f.col_offset);return new Sk.astnodes.Subscript(e,new Sk.astnodes.Index(g),Sk.astnodes.Load,f.lineno,f.col_offset)}function W(a,f){d(f,r.flow_stmt);var g=c(f,0);switch(g.type){case r.break_stmt:return new Sk.astnodes.Break(f.lineno,f.col_offset,f.end_lineno,f.end_col_offset);case r.continue_stmt:return new Sk.astnodes.Continue(f.lineno,f.col_offset, +f.end_lineno,f.end_col_offset);case r.yield_stmt:return(a=x(a,c(g,0)))?new Sk.astnodes.Expr(a,f.lineno,f.col_offset,f.end_lineno,f.end_col_offset):null;case r.return_stmt:if(1==b(g))return new Sk.astnodes.Return(null,f.lineno,f.col_offset,f.end_lineno,f.end_col_offset);var k=M(a,c(g,1));return k?new Sk.astnodes.Return(k,f.lineno,f.col_offset,f.end_lineno,f.end_col_offset):null;case r.raise_stmt:if(1==b(g))return new Sk.astnodes.Raise(null,null,null,null,f.lineno,f.col_offset,f.end_lineno,f.end_col_offset); +if(2<=b(g)){var h=null;k=x(a,c(g,1));var l=null,v=null;4==b(g)&&"from"==c(g,2).value?(Sk.__future__.python3||e(a,c(g,2),"raise ... from ... is not available in Python 2"),h=x(a,c(g,3))):4<=b(g)&&","==c(g,2).value&&(Sk.__future__.python3&&e(a,f,"Old raise syntax is not available in Python 3"),l=x(a,c(g,3)),6==b(g)&&(v=x(a,c(g,5))));return new Sk.astnodes.Raise(k,h,l,v,f.lineno,f.col_offset,f.end_lineno,f.end_col_offset)}default:return Sk.asserts.fail("unexpected flow_stmt: ",g.type),null}}function N(a, +d){var e=null;Sk.asserts.assert(d.type===r.tfpdef||d.type===r.vfpdef);var g=c(d,0);f(a,g,g.value,g.lineno);g=h(g.value);3==b(d)&&c(d,1).type===w.T_COLON&&(e=x(a,c(d,2)));return new Sk.astnodes.arg(g,e,d.lineno,d.col_offset)}function E(a,d,g,k,l){var n=g,v=0;k||e(a,c(d,g),"named arguments must follow bare *");for(Sk.asserts.assert(l);n<b(d);){var D=c(d,n);switch(D.type){case r.vfpdef:case r.tfpdef:n+1<b(d)&&c(d,n+1).type==w.T_EQUAL?(l[v]=x(a,c(d,n+2)),n+=2):l[v]=null;var B=3==b(D)?x(a,c(D,2)):null; +D=c(D,0);f(a,D,D.value,D.lineno);g=h(D.value);k[v++]=new Sk.astnodes.arg(g,B,D.lineno,D.col_offset);n+=2;break;case w.T_DOUBLESTAR:return n;default:e(a,D,"unexpected node")}}return n}function X(a,d){var f,e,g,k=[],h=[],l=[],n=[],v=null,q=null;if(d.type===r.parameters){if(2===b(d))return new Sk.astnodes.arguments_([],null,[],[],null,[]);d=c(d,1)}Sk.asserts.assert(d.type===r.varargslist||d.type===r.typedargslist);for(f=e=g=0;g<b(d);){var B=c(d,g);switch(B.type){case r.tfpdef:case r.vfpdef:if(g+1<b(d)&& +c(d,g+1).type==w.T_EQUAL){h[e++]=x(a,c(d,g+2));g+=2;var m=1}else if(m)throw new Sk.builtin.SyntaxError("non-default argument follows default argument",a.c_filename,d.lineno);k[f++]=N(a,B);g+=2;break;case w.T_STAR:if(g+1>=b(d)||g+2==b(d)&&c(d,g+1).type==w.T_COMMA)throw new Sk.builtin.SyntaxError("named arguments must follow bare *",a.c_filename,d.lineno);B=c(d,g+1);B.type==w.T_COMMA?(g+=2,g=E(a,d,g,l,n)):(v=N(a,B),g+=3,g<b(d)&&(c(d,g).type==r.tfpdef||c(d,g).type==r.vfpdef)&&(g=E(a,d,g,l,n)));break; +case w.T_DOUBLESTAR:B=c(d,g+1);Sk.asserts.assert(B.type==r.tfpdef||B.type==r.vfpdef);q=N(a,B);g+=3;break;default:Sk.asserts.fail("unexpected node in varargslist");return}}return new Sk.astnodes.arguments_(k,v,l,n,q,h)}function aa(a,g,k,h){var n=h?c(g,1):g,v=null,D=1,q=null;if(h&&5>a.c_feature_version)return e(a,n,"Async functions are only supported in Python 3.5 and greater"),null;d(n,r.funcdef);var B=l(c(n,D));if(f(a,B,c(n,D),0))return null;var m=X(a,c(n,D+1));if(!m)return null;if(c(n,D+2).type== +w.T_RARROW){v=x(a,c(n,D+3));if(!v)return null;D+=2}if(c(n,D+3).type==w.T_TYPE_COMMENT){q=w.T_NEW_TYPE_COMMENT(c(n,D+3));if(!q)return null;D+=1}var P=y(a,c(n,D+3));if(!P)return null;if(1<b(c(n,D+3))&&(D=c(c(n,D+3),1),D.type==w.T_TYPE_COMMENT)){if(null!=q)return e(a,n,"Cannot have two type comments on def"),null;q=w.T_NEW_TYPE_COMMENT(D);if(!q)return null}return h?new Sk.astnodes.AsyncFunctionDef(B,m,P,k,v,q,g.lineno,g.col_offset,void 0,void 0):new Sk.astnodes.FunctionDef(B,m,P,k,v,q,n.lineno,n.col_offset, +void 0,void 0)}function S(a,e,g){d(e,r.classdef);if(4==b(e)){var k=y(a,c(e,3));var h=l(c(e,1).value);f(a,c(e,3),h,e.lineno);return new Sk.astnodes.ClassDef(h,[],[],k,g,null,e.lineno,e.col_offset)}if(c(e,3).type===w.T_RPAR)return k=y(a,c(e,5)),h=l(c(e,1).value),f(a,c(e,3),h,c(e,3).lineno),new Sk.astnodes.ClassDef(h,[],[],k,g,null,e.lineno,e.col_offset);h=l(c(e,1));h=new Sk.astnodes.Name(h,Sk.astnodes.Load,e.lineno,e.col_offset);var n=F(a,c(e,3),h,!1);k=y(a,c(e,6));h=l(c(e,1).value);f(a,c(e,1),h,c(e, +1).lineno);return new Sk.astnodes.ClassDef(h,n.args,n.keywords,k,g,null,e.lineno,e.col_offset)}function R(a,f){function e(a,f){for(a=0;;){d(f,r.comp_iter);if(c(f,0).type===r.comp_for)return a;f=c(f,0);d(f,r.comp_if);a++;if(2===b(f))return a;f=c(f,2)}}var g;var k=function(a,f){a=0;a:for(;;){a++;d(f,r.comp_for);if(5===b(f))f=c(f,4);else return a;b:for(;;){d(f,r.comp_iter);f=c(f,0);if(f.type===r.comp_for)continue a;else if(f.type===r.comp_if)if(3===b(f)){f=c(f,2);continue b}else return a;break}break}Sk.asserts.fail("logic error in countCompFors")}(a, +f);var h=[];for(g=0;g<k;++g){d(f,r.comp_for);var l=c(f,1);var n=t(a,l,Sk.astnodes.Store);var v=x(a,c(f,3));var q=1===b(l)?new Sk.astnodes.comprehension(n[0],v,[]):new Sk.astnodes.comprehension(new Sk.astnodes.Tuple(n,Sk.astnodes.Store,f.lineno,f.col_offset),v,[]);if(5===b(f)){f=c(f,4);var m=e(a,f);l=[];for(n=0;n<m;++n)d(f,r.comp_iter),f=c(f,0),d(f,r.comp_if),v=x(a,c(f,1)),l[n]=v,3===b(f)&&(f=c(f,2));f.type===r.comp_iter&&(f=c(f,0));q.ifs=l}h[g]=q}return h}function V(a,f){var e=[];a:{var g=f;var k= +0;b:for(;;){var h=0;k++;d(g,r.comp_for);c(g,0).type==w.T_ASYNC&&(h=1);if(b(g)==5+h)g=c(g,4+h);else break a;c:for(;;){d(g,r.comp_iter);g=c(g,0);if(g.type===r.comp_for)continue b;else if(g.type===r.comp_if)if(3===b(g)){g=c(g,2);continue c}else break a;break}break}k=void 0}for(g=0;g<k;g++){var l=0;c(f,0).type==w.T_ASYNC&&(l=1);var n=c(f,1+l);var v=t(a,n,Sk.astnodes.Store);if(!v)return null;h=x(a,c(f,3+l));if(!h)return null;var q=v[0];v=1==b(n)?new Sk.astnodes.comprehension(q,h,null,l):new Sk.astnodes.comprehension(new Sk.astnodes.Tuple(v, +Sk.astnodes.Store,q.lineno,q.col_offset,n.end_lineno,n.end_col_offset),h,null,l);if(b(f)==5+l){q=[];f=c(f,4+l);a:for(h=f,l=0;;){d(h,r.comp_iter);if(c(h,0).type==r.comp_for){n=l;break a}h=c(h,0);d(h,r.comp_if);l++;if(2==b(h)){n=l;break a}h=c(h,2)}if(-1==n)return null;for(l=0;l<n;l++){d(f,r.comp_iter);f=c(f,0);d(f,r.comp_if);h=x(a,c(f,1));if(!h)return null;q[l]=h;3==b(f)&&(f=c(f,2))}f.type==r.comp_iter&&(f=c(f,0));v.ifs=q}e[g]=v}return e}function ca(a,d,f){Sk.asserts.assert(1<b(d));var g=c(d,0);var k= +x(a,g);if(k.constructor===Sk.astnodes.Starred)return e(a,g,"iterable unpacking cannot be used in comprehension"),null;a=V(a,c(d,1));return 0==f?new Sk.astnodes.GeneratorExp(k,a,d.lineno,d.col_offset,d.end_lineno,d.end_col_offset):1==f?new Sk.astnodes.ListComp(k,a,d.lineno,d.col_offset,d.end_lineno,d.end_col_offset):2==f?new Sk.astnodes.SetComp(k,a,d.lineno,d.col_offset,d.end_lineno,d.end_col_offset):null}function ea(a,b){d(b,r.augassign);b=c(b,0);switch(b.value.charAt(0)){case "+":return Sk.astnodes.Add; +case "-":return Sk.astnodes.Sub;case "/":return"/"===b.value.charAt(1)?Sk.astnodes.FloorDiv:Sk.astnodes.Div;case "%":return Sk.astnodes.Mod;case "<":return Sk.astnodes.LShift;case ">":return Sk.astnodes.RShift;case "&":return Sk.astnodes.BitAnd;case "^":return Sk.astnodes.BitXor;case "|":return Sk.astnodes.BitOr;case "*":return"*"===b.value.charAt(1)?Sk.astnodes.Pow:Sk.astnodes.Mult;case "@":if(Sk.__future__.python3)return Sk.astnodes.MatMult;default:Sk.asserts.fail("invalid augassign")}}function M(a, +d){Sk.asserts.assert(0<b(d));d.type===r.testlist_comp?1<b(d)&&Sk.asserts.assert(c(d,1).type!==r.comp_for):Sk.asserts.assert(d.type===r.testlist||d.type===r.testlist_star_expr);return 1===b(d)?x(a,c(d,0)):new Sk.astnodes.Tuple(z(a,d),Sk.astnodes.Load,d.lineno,d.col_offset)}function I(a,e){d(e,r.expr_stmt);if(1===b(e))return new Sk.astnodes.Expr(M(a,c(e,0)),e.lineno,e.col_offset);if(c(e,1).type===r.augassign){var g=c(e,0);var h=M(a,g);k(a,h,Sk.astnodes.Store,g);switch(h.constructor){case Sk.astnodes.Name:var l= +h.id;f(a,g,l,e.lineno);break;case Sk.astnodes.Attribute:case Sk.astnodes.Subscript:break;case Sk.astnodes.GeneratorExp:throw new Sk.builtin.SyntaxError("augmented assignment to generator expression not possible",a.c_filename,e.lineno);case Sk.astnodes.Yield:throw new Sk.builtin.SyntaxError("augmented assignment to yield expression not possible",a.c_filename,e.lineno);default:throw new Sk.builtin.SyntaxError("illegal expression for augmented assignment",a.c_filename,e.lineno);}g=c(e,2);l=g.type=== +r.testlist?M(a,g):x(a,g);return new Sk.astnodes.AugAssign(h,ea(a,c(e,1)),l,e.lineno,e.col_offset)}if(c(e,1).type===r.annassign){if(!Sk.__future__.python3)throw new Sk.builtin.SyntaxError("Annotated assignment is not supported in Python 2",a.c_filename,e.lineno);g=c(e,0);var n=c(e,1);var v=1;for(h=g;1==b(h);)h=c(h,0);0<b(h)&&c(h,0).type==w.T_LPAR&&(v=0);h=M(a,g);switch(h.constructor){case Sk.astnodes.Name:l=h.id;f(a,g,l,e.lineno);k(a,h,Sk.astnodes.Store,g);break;case Sk.astnodes.Attribute:l=h.attr; +f(a,g,l,e.lineno);k(a,h,Sk.astnodes.Store,g);break;case Sk.astnodes.Subscript:k(a,h,Sk.astnodes.Store,g);break;case Sk.astnodes.List:throw new Sk.builtin.SyntaxError("only single target (not list) can be annotated",a.c_filename,e.lineno);case Sk.astnodes.Tuple:throw new Sk.builtin.SyntaxError("only single target (not tuple) can be annotated",a.c_filename,e.lineno);default:throw new Sk.builtin.SyntaxError("illegal target for annotation",a.c_filename,e.lineno);}h.constructor!=Sk.astnodes.Name&&(v=0); +g=c(n,1);l=x(a,g);if(2==b(n))return new Sk.astnodes.AnnAssign(h,l,null,v,e.lineno,e.col_offset);g=c(n,3);a=x(a,g);return new Sk.astnodes.AnnAssign(h,l,a,v,e.lineno,e.col_offset)}d(c(e,1),w.T_EQUAL);v=[];for(h=0;h<b(e)-2;h+=2){g=c(e,h);if(g.type===r.yield_expr)throw new Sk.builtin.SyntaxError("assignment to yield expression not possible",a.c_filename,e.lineno);g=M(a,g);k(a,g,Sk.astnodes.Store,c(e,h));v[h/2]=g}g=c(e,b(e)-1);a=g.type===r.testlist_star_expr?M(a,g):x(a,g);return new Sk.astnodes.Assign(v, +a,e.lineno,e.col_offset)}function Z(a,b,c,d,f){Sk.asserts.assert(c>=b);Sk.asserts.assert("{"==a.charAt(b-1));Sk.asserts.assert("}"==a.charAt(c)||"!"==a.charAt(c)||":"==a.charAt(c));a=a.substring(b,c);/^\s*$/.test(a)&&e(d,f,"f-string: empty expression not allowed");try{let b=Sk.parse("<fstring>","("+a+")");var g=Sk.astFromParse(b.cst,"<fstring>",b.flags)}catch(ba){throw ba.traceback&&ba.traceback[0]&&(g=ba.traceback[0],g.lineno=(g.lineno||1)-1+f.lineno,g.filename=d.c_filename),ba;}Sk.asserts.assert(1== +g.body.length&&g.body[0].constructor===Sk.astnodes.Expr);return g.body[0].value}function Y(a,b,c,d,f,g,k){Sk.asserts.assert("{"==a.charAt(b));b++;var h=b;let l=null,n=0,D=0,v,q,m=()=>e(g,k,"f-string: expecting '}'");for(Sk.asserts.assert(b<=c);b<c;b++){let d=a.charAt(b);"\\"==d&&e(g,k,"f-string expression part cannot include a backslash");if(l)d==l&&(3==n?b+2<c&&a.charAt(b+1)==d&&a.charAt(b+2)==d&&(b+=2,l=n=0):n=l=0);else if("'"==d||'"'==d)b+2<c&&a.charAt(b+1)==d&&a.charAt(b+2)==d?(n=3,b+=2):n=1, +l=d;else if("["==d||"{"==d||"("==d)D++;else if(0!=D&&("]"==d||"}"==d||")"==d))D--;else if("#"==d)e(g,k,"f-string expression part cannot include '#'");else if(!(0!=D||"!"!=d&&":"!=d&&"}"!=d||"!"==d&&b+1<c&&"="==a.charAt(b+1)))break}l&&e(g,k,"f-string: unterminated string");D&&e(g,k,"f-string: mismatched '(', '{', or '['");h=Z(a,h,b,g,k);"!"==a.charAt(b)&&(b++,b>=c&&m(),q=a.charAt(b),b++,"s"!=q&&"r"!=q&&"a"!=q&&e(g,k,"f-string: invalid conversion character: expected 's', 'r', or 'a'"));b>=c&&m();":"== +a.charAt(b)&&(b++,b>=c&&m(),[v,b]=J(a,b,c,d,f+1,g,k));(b>=c||"}"!=a.charAt(b))&&m();b++;return[new Sk.astnodes.FormattedValue(h,q,v,k.lineno,k.col_offset),b]}function J(a,b,c,d,f,e,g){let k=[],h=a=>{if(-1!==a.indexOf("}")){if(/(^|[^}])}(}})*($|[^}])/.test(a))throw new SyntaxError("f-string: single '}' is not allowed",g.lineno,g.col_offset);a=a.replace(/}}/g,"}")}k.push(new Sk.astnodes.Str(new Sk.builtin.str(a),g.lineno,g.col_offset,e.end_lineno,g.end_col_offset))};for(;b<c;){let l=a.indexOf("{",b); +if(0!==f){let d=a.indexOf("}",b);-1!==d&&(-1===l?c=d:l>d&&(l=-1,c=d))}if(-1===l){h(a.substring(b,c));b=c;break}else if(l+1<c&&"{"===a.charAt(l+1))h(a.substring(b,l+1)),b=l+2;else{h(a.substring(b,l));b=l;let [n,D]=Y(a,l,c,d,f,e,g);k.push(n);b=D}}return[new Sk.astnodes.JoinedStr(k,g.lineno,g.col_offset),b]}function U(a,b,c){var d=b.charAt(b.length-1);if(-1!==b.indexOf("_")){if(fa.test(b))throw new Sk.builtin.SyntaxError("invalid syntax",a.c_filename,c);if(ha.test(b))throw new Sk.builtin.SyntaxError("invalid decimal literal", +a.c_filename,c);b=b.replace(ia,"")}if("j"===d||"J"===d)return Sk.builtin.complex.complex_subtype_from_string(b);if("l"===d||"L"===d)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 A(a,f){var e,g;d(f,r.subscript);var k=c(f,0);var h=e=g=null;if(k.type===w.T_DOT)return new Sk.astnodes.Ellipsis; +if(1===b(f)&&k.type===r.test)return new Sk.astnodes.Index(x(a,k));k.type===r.test&&(g=x(a,k));k.type===w.T_COLON?1<b(f)&&(k=c(f,1),k.type===r.test&&(e=x(a,k))):2<b(f)&&(k=c(f,2),k.type===r.test&&(e=x(a,k)));k=c(f,b(f)-1);k.type===r.sliceop&&(1===b(k)?(k=c(k,0),h=new Sk.astnodes.NameConstant(Sk.builtin.none.none$,Sk.astnodes.Load,k.lineno,k.col_offset)):(k=c(k,1),k.type===r.test&&(h=x(a,k))));return new Sk.astnodes.Slice(g,e,h)}function G(a,f){var g=c(f,0);switch(g.type){case w.T_NAME:var k=g.value; +if(4<=k.length&&5>=k.length){if("None"===k)return new Sk.astnodes.NameConstant(Sk.builtin.none.none$,f.lineno,f.col_offset);if("True"===k)return new Sk.astnodes.NameConstant(Sk.builtin.bool.true$,f.lineno,f.col_offset);if("False"===k)return new Sk.astnodes.NameConstant(Sk.builtin.bool.false$,f.lineno,f.col_offset)}a=l(k,a);return new Sk.astnodes.Name(a,Sk.astnodes.Load,f.lineno,f.col_offset,f.end_lineno,f.end_col_offset);case w.T_STRING:g=[];for(var n=0;n<b(f);++n){var q=c(f,n).value;var m=a;var v= +c(f,n);var p=q;var B=p.charAt(0);for(var t=!1,y=q=!1;;){if("u"!==B&&"U"!==B)if("r"===B||"R"===B)t=!0;else if("b"===B||"B"===B)y=!0;else if("f"===B||"F"===B)q=!0;else break;p=p.substr(1);B=p.charAt(0)}Sk.asserts.assert("'"===B||'"'===B&&p.charAt(p.length-1)===B);p=p.substr(1,p.length-2);4<=p.length&&p.charAt(0)===B&&p.charAt(1)===B&&(Sk.asserts.assert(p.charAt(p.length-1)===B&&p.charAt(p.length-2)===B),p=p.substr(2,p.length-4));if(t||-1===p.indexOf("\\")){if(y)for(B=0;B<p.length;B++)127<p.charCodeAt(B)&& +e(m,v,"bytes can only contain ASCII literal characters");m=[h(p),q,y]}else{t=p;var F=t.length,C="";for(p=0;p<F;++p)B=t.charAt(p),"\\"===B?(++p,B=t.charAt(p),"n"===B?C+="\n":"\\"===B?C+="\\":"t"===B?C+="\t":"r"===B?C+="\r":"b"===B?C+="\b":"f"===B?C+="\f":"v"===B?C+="\v":"0"===B?C+="\x00":'"'===B?C+='"':"'"===B?C+="'":"\n"!==B&&("x"===B?(p+2>=F&&e(m,v,"Truncated \\xNN escape"),C+=String.fromCharCode(parseInt(t.substr(p+1,2),16)),p+=2):y||"u"!==B?y||"U"!==B?C+="\\"+B:(p+8>=F&&e(m,v,"Truncated \\UXXXXXXXX escape"), +C+=String.fromCodePoint(parseInt(t.substr(p+1,8),16)),p+=8):(p+4>=F&&e(m,v,"Truncated \\uXXXX escape"),C+=String.fromCharCode(parseInt(t.substr(p+1,4),16)),p+=4))):y&&127<B.charCodeAt(0)?e(m,v,"bytes can only contain ASCII literal characters"):C+=B;m=C;m=[h(m),q,y]}q=m;m=q[0];v=q[1];q=q[2];0!=n&&k!==q&&e(a,f,"cannot mix bytes and nonbytes literals");k=q;if(v){if(!Sk.__future__.python3)throw new Sk.builtin.SyntaxError("invalid string (f-strings are not supported in Python 2)",a.c_filename,c(f,n).lineno); +var A=m.$jsstr();[A]=J(A,0,A.length,!1,0,a,c(f,n));g.push.apply(g,A.values);A=null}else A?A.s=A.s.sq$concat(m):(A=new (k?Sk.astnodes.Bytes:Sk.astnodes.Str)(m,f.lineno,f.col_offset,a.end_lineno,f.end_col_offset),g.push(A))}f=1===g.length&&g[0].constructor===Sk.astnodes.Str?g[0]:new Sk.astnodes.JoinedStr(g,f.lineno,f.col_offset,a.end_lineno,f.end_col_offset);return f;case w.T_NUMBER:return new Sk.astnodes.Num(U(a,g.value,f.lineno),f.lineno,f.col_offset);case w.T_ELLIPSIS:return new Sk.astnodes.Ellipsis(f.lineno, +f.col_offset,f.end_lineno,f.end_col_offset);case w.T_LPAR:return g=c(f,1),g.type==w.T_RPAR?new Sk.astnodes.Tuple([],Sk.astnodes.Load,f.lineno,f.col_offset,f.end_lineno,f.end_col_offset):g.type==r.yield_expr?x(a,g):1==b(g)?M(a,g):c(g,1).type==r.comp_for?u(K(a,g),f):u(M(a,g),f);case w.T_LSQB:g=c(f,1);if(g.type==w.T_RSQB)return new Sk.astnodes.List([],Sk.astnodes.Load,f.lineno,f.col_offset,f.end_lineno,f.end_col_offset);d(g,r.testlist_comp);if(1==b(g)||c(g,1).type==w.T_COMMA)return(a=z(a,g))?new Sk.astnodes.List(a, +Sk.astnodes.Load,f.lineno,f.col_offset,f.end_lineno,f.end_col_offset):null;k=g;Sk.asserts.assert(k.type==r.testlist_comp);a=ca(a,k,1);return u(a,f);case w.T_LBRACE:g=c(f,1);if(g.type==w.T_RBRACE)return new Sk.astnodes.Dict(null,null,f.lineno,f.col_offset,f.end_lineno,f.end_col_offset);k=c(g,0).type==w.T_DOUBLESTAR;if(1==b(g)||1<b(g)&&c(g,1).type==w.T_COMMA){k=g;n=[];Sk.asserts.assert(k.type===r.dictorsetmaker);for(g=0;g<b(k);g+=2)A=x(a,c(k,g)),n[g/2]=A;a=new Sk.astnodes.Set(n,k.lineno,k.col_offset)}else if(1< +b(g)&&c(g,1).type==r.comp_for)k=g,Sk.asserts.assert(k.type===r.dictorsetmaker),Sk.asserts.assert(1<b(k)),g=x(a,c(k,0)),a=R(a,c(k,1)),a=new Sk.astnodes.SetComp(g,a,k.lineno,k.col_offset);else if(b(g)>3-k&&c(g,3-k).type==r.comp_for){if(k)return e(a,f,"dict unpacking cannot be used in dict comprehension"),null;k=g;Sk.asserts.assert(3<b(k));d(c(k,1),w.T_COLON);g=x(a,c(k,0));n=x(a,c(k,2));a=R(a,c(k,3));a=new Sk.astnodes.DictComp(g,n,a,k.lineno,k.col_offset)}else{k=g;n=[];A=[];for(q=g=0;q<b(k);q++)m=a, +v=k,y=q,c(v,y).type==w.T_DOUBLESTAR?(Sk.asserts.assert(2<=b(v)-y),q=x(m,c(v,y+1)),m={key:null,value:q,i:y+2}):(Sk.asserts.assert(3<=b(v)-y),(q=x(m,c(v,y)))?(p=q,d(c(v,y+1),w.T_COLON),m=(q=x(m,c(v,y+2)))?{key:p,value:q,i:y+3}:!1):m=0),q=m.i,n[g]=m.key,A[g]=m.value,g++;a=new Sk.astnodes.Dict(n,A,k.lineno,k.col_offset,k.end_lineno,k.end_col_offset)}return u(a,f);default:return Sk.asserts.fail("unhandled atom "+g.type),null}}function T(a,f){var e,g=0;d(f,r.atom_expr);var k=b(f);c(f,0).type===w.T_AWAIT&& +(g=1,Sk.asserts.assert(1<k));var h=G(a,c(f,g));if(!h)return null;if(1===k)return h;if(g&&2===k)return new Sk.astnodes.Await(h,f.lineno,f.col_offset);for(e=g+1;e<k;e++){var l=c(f,e);if(l.type!==r.trailer)break;l=L(a,l,h);if(!l)return null;l.lineno=h.lineno;l.col_offset=h.col_offset;h=l}return g?new Sk.astnodes.Await(h,f.line,f.col_offset):h}function x(a,f){a:for(;;){switch(f.type){case r.test:case r.test_nocond:if(c(f,0).type===r.lambdef||c(f,0).type===r.lambdef_nocond){var e=c(f,0);3===b(e)?(f=new Sk.astnodes.arguments_([], +null,null,[]),a=x(a,c(e,2))):(f=X(a,c(e,1)),a=x(a,c(e,3)));return new Sk.astnodes.Lambda(f,a,e.lineno,e.col_offset)}if(1<b(f))return Sk.asserts.assert(5===b(f)),new Sk.astnodes.IfExp(x(a,c(f,2)),x(a,c(f,0)),x(a,c(f,4)),f.lineno,f.col_offset);case r.or_test:case r.and_test:if(1===b(f)){f=c(f,0);continue a}var g=[];for(e=0;e<b(f);e+=2)g[e/2]=x(a,c(f,e));if("and"===c(f,1).value)return new Sk.astnodes.BoolOp(Sk.astnodes.And,g,f.lineno,f.col_offset);Sk.asserts.assert("or"===c(f,1).value);return new Sk.astnodes.BoolOp(Sk.astnodes.Or, +g,f.lineno,f.col_offset);case r.not_test:if(1===b(f)){f=c(f,0);continue a}else return new Sk.astnodes.UnaryOp(Sk.astnodes.Not,x(a,c(f,1)),f.lineno,f.col_offset);case r.comparison:if(1===b(f)){f=c(f,0);continue a}else{var k=[];g=[];for(e=1;e<b(f);e+=2)k[(e-1)/2]=q(a,c(f,e)),g[(e-1)/2]=x(a,c(f,e+1));return new Sk.astnodes.Compare(x(a,c(f,0)),k,g,f.lineno,f.col_offset)}case r.star_expr:return d(f,r.star_expr),new Sk.astnodes.Starred(x(a,c(f,1)),Sk.astnodes.Load,f.lineno,f.col_offset);case r.expr:case r.xor_expr:case r.and_expr:case r.shift_expr:case r.arith_expr:case r.term:if(1=== +b(f)){f=c(f,0);continue a}var h=f,l=new Sk.astnodes.BinOp(x(a,c(h,0)),n(c(h,1)),x(a,c(h,2)),h.lineno,h.col_offset),m=(b(h)-1)/2;for(f=1;f<m;++f)e=c(h,2*f+1),g=n(e),k=x(a,c(h,2*f+2)),l=new Sk.astnodes.BinOp(l,g,k,e.lineno,e.col_offset);return l;case r.yield_expr:return g=!1,k=null,1<b(f)&&(e=c(f,1)),e&&(k=c(e,b(e)-1),2==b(e)?(g=!0,k=x(a,k)):k=M(a,k)),g?new Sk.astnodes.YieldFrom(k,f.lineno,f.col_offset):new Sk.astnodes.Yield(k,f.lineno,f.col_offset);case r.factor:if(1===b(f)){f=c(f,0);continue a}return C(a, +f);case r.power:return e=f,d(e,r.power),f=T(a,c(e,0)),1!==b(e)&&c(e,b(e)-1).type===r.factor&&(a=x(a,c(e,b(e)-1)),f=new Sk.astnodes.BinOp(f,Sk.astnodes.Pow,a,e.lineno,e.col_offset)),f;default:Sk.asserts.fail("unhandled expr","n.type: %d",f.type)}break}}function O(a,f){f.type===r.stmt&&(Sk.asserts.assert(1===b(f)),f=c(f,0));f.type===r.simple_stmt&&(Sk.asserts.assert(1===g(f)),f=c(f,0));if(f.type===r.small_stmt)switch(f=c(f,0),f.type){case r.expr_stmt:return I(a,f);case r.del_stmt:var l=f;d(l,r.del_stmt); +return new Sk.astnodes.Delete(t(a,c(l,1),Sk.astnodes.Del),l.lineno,l.col_offset);case r.pass_stmt:return new Sk.astnodes.Pass(f.lineno,f.col_offset);case r.flow_stmt:return W(a,f);case r.import_stmt:var n=f,q;d(n,r.import_stmt);var m=n.lineno;f=n.col_offset;n=c(n,0);if(n.type===r.import_name){n=c(n,1);d(n,r.dotted_as_names);var p=[];for(q=0;q<b(n);q+=2)p[q/2]=H(a,c(n,q));a=new Sk.astnodes.Import(p,m,f)}else if(n.type===r.import_from){var u=null;l=0;for(p=1;p<b(n);++p)if(c(n,p).type===r.dotted_name){u= +H(a,c(n,p));p++;break}else if(c(n,p).type===w.T_DOT)l++;else if(c(n,p).type===w.T_ELLIPSIS)l+=3;else break;++p;switch(c(n,p).type){case w.T_STAR:n=c(n,p);break;case w.T_LPAR:n=c(n,p+1);b(n);break;case r.import_as_names:n=c(n,p);p=b(n);if(0===p%2)throw new Sk.builtin.SyntaxError("trailing comma not allowed without surrounding parentheses",a.c_filename,n.lineno);break;default:throw new Sk.builtin.SyntaxError("Unexpected node-type in from-import",a.c_filename,n.lineno);}p=[];if(n.type===w.T_STAR)p[0]= +H(a,n);else for(q=0;q<b(n);q+=2)p[q/2]=H(a,c(n,q));a=u?u.name.v:"";a=new Sk.astnodes.ImportFrom(h(a),p,l,m,f)}else throw new Sk.builtin.SyntaxError("unknown import statement",a.c_filename,n.lineno);return a;case r.global_stmt:a=f;f=[];d(a,r.global_stmt);for(l=1;l<b(a);l+=2)f[(l-1)/2]=h(c(a,l).value);return new Sk.astnodes.Global(f,a.lineno,a.col_offset);case r.nonlocal_stmt:e(a,f,"Not implemented: nonlocal");break;case r.assert_stmt:return l=f,d(l,r.assert_stmt),2===b(l)?a=new Sk.astnodes.Assert(x(a, +c(l,1)),null,l.lineno,l.col_offset):4===b(l)?a=new Sk.astnodes.Assert(x(a,c(l,1)),x(a,c(l,3)),l.lineno,l.col_offset):(Sk.asserts.fail("improper number of parts to assert stmt"),a=void 0),a;case r.print_stmt:l=f;Sk.__future__.print_function&&e(a,l,"Missing parentheses in call to 'print'");n=1;m=null;d(l,r.print_stmt);2<=b(l)&&c(l,1).type===w.T_RIGHTSHIFT&&(m=x(a,c(l,2)),n=4);f=[];for(u=0;n<b(l);n+=2,++u)f[u]=x(a,c(l,n));a=c(l,b(l)-1).type===w.T_COMMA?!1:!0;return new Sk.astnodes.Print(m,f,a,l.lineno, +l.col_offset);case r.debugger_stmt:return new Sk.astnodes.Debugger(f.lineno,f.col_offset);default:Sk.asserts.fail("unhandled small_stmt")}else switch(l=c(f,0),d(f,r.compound_stmt),l.type){case r.if_stmt:d(l,r.if_stmt);if(4===b(l))a=new Sk.astnodes.If(x(a,c(l,1)),y(a,c(l,3)),[],l.lineno,l.col_offset);else if(f=c(l,4).value.charAt(2),"s"===f)a=new Sk.astnodes.If(x(a,c(l,1)),y(a,c(l,3)),y(a,c(l,6)),l.lineno,l.col_offset);else if("i"===f){m=b(l)-4;n=!1;f=[];c(l,m+1).type===w.T_NAME&&"s"===c(l,m+1).value.charAt(2)&& +(n=!0,m-=3);m/=4;n&&(f=[new Sk.astnodes.If(x(a,c(l,b(l)-6)),y(a,c(l,b(l)-4)),y(a,c(l,b(l)-1)),c(l,b(l)-6).lineno,c(l,b(l)-6).col_offset)],m--);for(u=0;u<m;++u)n=5+4*(m-u-1),f=[new Sk.astnodes.If(x(a,c(l,n)),y(a,c(l,n+2)),f,c(l,n).lineno,c(l,n).col_offset)];a=new Sk.astnodes.If(x(a,c(l,1)),y(a,c(l,3)),f,l.lineno,l.col_offset)}else Sk.asserts.fail("unexpected token in 'if' statement"),a=void 0;return a;case r.while_stmt:return d(l,r.while_stmt),4===b(l)?a=new Sk.astnodes.While(x(a,c(l,1)),y(a,c(l,3)), +[],l.lineno,l.col_offset):7===b(l)?a=new Sk.astnodes.While(x(a,c(l,1)),y(a,c(l,3)),y(a,c(l,6)),l.lineno,l.col_offset):(Sk.asserts.fail("wrong number of tokens for 'while' stmt"),a=void 0),a;case r.for_stmt:return f=[],d(l,r.for_stmt),9===b(l)&&(f=y(a,c(l,8))),n=c(l,1),m=t(a,n,Sk.astnodes.Store),m=1===b(n)?m[0]:new Sk.astnodes.Tuple(m,Sk.astnodes.Store,l.lineno,l.col_offset),new Sk.astnodes.For(m,M(a,c(l,3)),y(a,c(l,5)),f,l.lineno,l.col_offset);case r.try_stmt:f=[];q=b(l);m=(q-3)/3;u=[];p=null;d(l, +r.try_stmt);n=y(a,c(l,2));if(c(l,q-3).type===w.T_NAME)"finally"===c(l,q-3).value?(9<=q&&c(l,q-6).type===w.T_NAME&&(u=y(a,c(l,q-4)),m--),p=y(a,c(l,q-1))):u=y(a,c(l,q-1)),m--;else if(c(l,q-3).type!==r.except_clause)throw new Sk.builtin.SyntaxError("malformed 'try' statement",a.c_filename,l.lineno);if(0<m)for(q=0;q<m;q++){var z=q;var v=a,C=c(l,3+3*q),A=c(l,5+3*q);d(C,r.except_clause);d(A,r.suite);if(1===b(C))var B=new Sk.astnodes.ExceptHandler(null,null,y(v,A),C.lineno,C.col_offset);else 2===b(C)?B= +new Sk.astnodes.ExceptHandler(x(v,c(C,1)),null,y(v,A),C.lineno,C.col_offset):4===b(C)?(Sk.__future__.python3&&","==c(C,2).value&&e(v,C,"Old-style 'except' clauses are not supported in Python 3"),x(v,c(C,1)),B=x(v,c(C,3)),k(v,B,Sk.astnodes.Store,c(C,3)),B=new Sk.astnodes.ExceptHandler(x(v,c(C,1)),B,y(v,A),C.lineno,C.col_offset)):(Sk.asserts.fail("wrong number of children for except clause"),B=void 0);f[z]=B}Sk.asserts.assert(!!p||0!=f.length);return new Sk.astnodes.Try(n,f,u,p,l.lineno,l.col_offset); +case r.with_stmt:f=[];d(l,r.with_stmt);for(m=1;m<b(l)-2;m+=2)n=void 0,p=a,q=c(l,m),d(q,r.with_item),u=x(p,c(q,0)),3==b(q)&&(n=x(p,c(q,2)),k(p,n,Sk.astnodes.Store,q)),n=new Sk.astnodes.withitem(u,n),f[(m-1)/2]=n;a=y(a,c(l,b(l)-1));a=new Sk.astnodes.With(f,a,l.lineno,l.col_offset);return a;case r.funcdef:return aa(a,l,[],!1);case r.classdef:return S(a,l,[]);case r.decorated:m=null;d(l,r.decorated);n=c(l,0);d(n,r.decorators);f=[];for(u=0;u<b(n);++u){p=f;q=u;z=a;B=c(n,u);d(B,r.decorator);d(c(B,0),w.T_AT); +d(c(B,b(B)-1),w.T_NEWLINE);var K,E=c(B,1);d(E,r.dotted_name);v=E.lineno;C=E.col_offset;A=h(c(E,0).value);var L=new Sk.astnodes.Name(A,Sk.astnodes.Load,v,C);for(K=2;K<b(E);K+=2)A=h(c(E,K).value),L=new Sk.astnodes.Attribute(L,A,Sk.astnodes.Load,v,C);v=L;z=3===b(B)?v:5===b(B)?new Sk.astnodes.Call(v,[],[],null,null,B.lineno,B.col_offset):F(z,c(B,3),v);p[q]=z}Sk.asserts.assert(c(l,1).type==r.funcdef||c(l,1).type==r.async_funcdef||c(l,1).type==r.classdef);c(l,1).type==r.funcdef?(m=c(l,1),m=aa(a,m,f,!1)): +c(l,1).type==r.classdef?m=S(a,c(l,1),f):c(l,1).type==r.async_funcdef&&(m=c(l,1),d(m,r.async_funcdef),d(c(m,0),w.T_NAME),Sk.asserts.assert(("async"===c(m,0)).value),d(c(m,1),r.funcdef),m=aa(a,m,f,!0));m&&(m.lineno=l.lineno,m.col_offset=l.col_offset);return m;case r.async_stmt:e(a,l,"Not implemented: async");break;default:Sk.asserts.assert("unhandled compound_stmt")}}var r=Sk.ParseTables.sym,w=Sk.token.tokens,da={Slice_kind:1,ExtSlice_kind:2,Index_kind:3},Q={};Q[w.T_VBAR]=Sk.astnodes.BitOr;Q[w.T_CIRCUMFLEX]= +Sk.astnodes.BitXor;Q[w.T_AMPER]=Sk.astnodes.BitAnd;Q[w.T_LEFTSHIFT]=Sk.astnodes.LShift;Q[w.T_RIGHTSHIFT]=Sk.astnodes.RShift;Q[w.T_PLUS]=Sk.astnodes.Add;Q[w.T_MINUS]=Sk.astnodes.Sub;Q[w.T_STAR]=Sk.astnodes.Mult;Q[w.T_SLASH]=Sk.astnodes.Div;Q[w.T_DOUBLESLASH]=Sk.astnodes.FloorDiv;Q[w.T_PERCENT]=Sk.astnodes.Mod;Sk.setupOperators=function(a){a?Q[w.T_AT]=Sk.astnodes.MatMult:Q[w.T_AT]&&delete Q[w.T_AT]};Sk.exportSymbol("Sk.setupOperators",Sk.setupOperators);const fa=/_[eE]|[eE]_|\._|j_/,ha=/_\.|[+-]_|^0_\D|_j/, +ia=/_(?=[^_])/g;Sk.astFromParse=function(f,e,k){var h,l=new a("utf-8",e,k),n=[],q=0;switch(f.type){case r.file_input:for(h=0;h<b(f)-1;++h){var m=c(f,h);if(f.type!==w.T_NEWLINE)if(d(m,r.stmt),k=g(m),1===k)n[q++]=O(l,m);else for(m=c(m,0),d(m,r.simple_stmt),e=0;e<k;++e)n[q++]=O(l,c(m,2*e))}return new Sk.astnodes.Module(n);case r.eval_input:Sk.asserts.fail("todo;");case r.single_input:Sk.asserts.fail("todo;");default:Sk.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,f){var d;if(null===a)return f+"None";if(a.prototype&&void 0!==a.prototype._astname&&a.prototype._isenum)return f+a.prototype._astname+"()";if(void 0!==a._astname){var e=b(a._astname.length+1);var g=[];for(d=0;d<a._fields.length;d+=2){var k=a._fields[d];var h=a._fields[d+1](a);var l=b(k.length+1);g.push([k,c(h,f+e+l)])}h=[];for(d=0;d<g.length;++d)l=g[d],h.push(l[0]+"="+l[1].replace(/^\s+/,""));d=h.join(",\n"+f+e);return f+a._astname+"("+d+")"}if(Sk.isArrayLike(a)){e= +[];for(d=0;d<a.length;++d)g=a[d],e.push(c(g,f+" "));a=e.join(",\n");return f+"["+a.replace(/^\s+/,"")+"]"}a=!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 f+a};return c(a,"")};Sk.exportSymbol("Sk.astFromParse",Sk.astFromParse);Sk.exportSymbol("Sk.astDump",Sk.astDump)},function(m,p){function a(a,b,c){this.__name=a;this.__flags=b;this.__scope=b>>11&7;this.__namespaces=c||[]}function b(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||"function"===a.cur.blockType)&&(this.isNested=!0);d.scopeId=h++;a.stss[d.scopeId]=this;this.symbols={}}function c(a){this.filename=a;this.top=this.cur=null;this.stack=[];this.curClass=this.global=null;this.tmpname=0;this.stss={}}function d(a,b){var c;for(c=0;c<b.length;c++)a(b[c])}function e(a,b){for(var c in b)a[c]= +b[c]}Sk.exportSymbol("Sk.SYMTAB_CONSTS",{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:1030,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"});a.prototype.get_name=function(){return this.__name}; +a.prototype.is_referenced=function(){return!!(this.__flags&8)};a.prototype.is_parameter=function(){return!!(this.__flags&4)};a.prototype.is_global=function(){return 3===this.__scope||2==this.__scope};a.prototype.is_declared_global=function(){return 2==this.__scope};a.prototype.is_local=function(){return!!(this.__flags&1030)};a.prototype.is_free=function(){return 4==this.__scope};a.prototype.is_imported=function(){return!!(this.__flags&1024)};a.prototype.is_assigned=function(){return!!(this.__flags& +2)};a.prototype.is_namespace=function(){return this.__namespaces&&0<this.__namespaces.length};a.prototype.get_namespaces=function(){return this.__namespaces};var h=0;b.prototype.get_type=function(){return this.blockType};b.prototype.get_name=function(){return this.name};b.prototype.get_lineno=function(){return this.lineno};b.prototype.is_nested=function(){return this.isNested};b.prototype.has_children=function(){return 0<this.children.length};b.prototype.get_identifiers=function(){return this._identsMatching(function(){return!0})}; +b.prototype.lookup=function(b){if(this.symbols.hasOwnProperty(b))b=this.symbols[b];else{var c=this.symFlags[b];var d=this.__check_children(b);b=this.symbols[b]=new a(b,c,d)}return b};b.prototype.__check_children=function(a){var b,c=[];for(b=0;b<this.children.length;++b){var d=this.children[b];d.name===a&&c.push(d)}return c};b.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};b.prototype.get_parameters= +function(){Sk.asserts.assert("function"==this.get_type(),"get_parameters only valid for function scopes");this._funcParams||(this._funcParams=this._identsMatching(function(a){return a&4}));return this._funcParams};b.prototype.get_locals=function(){Sk.asserts.assert("function"==this.get_type(),"get_locals only valid for function scopes");this._funcLocals||(this._funcLocals=this._identsMatching(function(a){return a&1030}));return this._funcLocals};b.prototype.get_globals=function(){Sk.asserts.assert("function"== +this.get_type(),"get_globals only valid for function scopes");this._funcGlobals||(this._funcGlobals=this._identsMatching(function(a){a=a>>11&7;return 3==a||2==a}));return this._funcGlobals};b.prototype.get_frees=function(){Sk.asserts.assert("function"==this.get_type(),"get_frees only valid for function scopes");this._funcFrees||(this._funcFrees=this._identsMatching(function(a){return 4==(a>>11&7)}));return this._funcFrees};b.prototype.get_methods=function(){var a;Sk.asserts.assert("class"==this.get_type(), +"get_methods only valid for class scopes");if(!this._classMethods){var b=[];for(a=0;a<this.children.length;++a)b.push(this.children[a].name);b.sort();this._classMethods=b}return this._classMethods};b.prototype.getScope=function(a){a=this.symFlags[a];return void 0===a?0:a>>11&7};c.prototype.getStsForAst=function(a){Sk.asserts.assert(void 0!==a.scopeId,"ast wasn't added to st?");a=this.stss[a.scopeId];Sk.asserts.assert(void 0!==a,"unknown sym tab entry");return a};c.prototype.SEQStmt=function(a){var b, +c;if(null!==a){Sk.asserts.assert(Sk.isArrayLike(a),"SEQ: nodes isn't array? got "+a.toString());var d=a.length;for(c=0;c<d;++c)(b=a[c])&&this.visitStmt(b)}};c.prototype.SEQExpr=function(a){var b,c;if(null!==a){Sk.asserts.assert(Sk.isArrayLike(a),"SEQ: nodes isn't array? got "+a.toString());var d=a.length;for(c=0;c<d;++c)(b=a[c])&&this.visitExpr(b)}};c.prototype.enterBlock=function(a,c,d,e){a=Sk.fixReserved(a);var f=null;this.cur&&(f=this.cur,this.stack.push(this.cur));this.cur=new b(this,a,c,d,e); +"top"===a&&(this.global=this.cur.symFlags);f&&f.children.push(this.cur)};c.prototype.exitBlock=function(){this.cur=null;0<this.stack.length&&(this.cur=this.stack.pop())};c.prototype.visitParams=function(a,b){var c;for(c=0;c<a.length;++c)if(b=a[c],b.constructor===Sk.astnodes.arg)this.addDef(b.arg,4,b.lineno);else throw new Sk.builtin.SyntaxError("invalid expression in parameter list",this.filename);};c.prototype.visitArguments=function(a,b){a.args&&this.visitParams(a.args,!0);a.kwonlyargs&&this.visitParams(a.kwonlyargs, +!0);a.vararg&&(this.addDef(a.vararg.arg,4,b),this.cur.varargs=!0);a.kwarg&&(this.addDef(a.kwarg.arg,4,b),this.cur.varkeywords=!0)};c.prototype.newTmpname=function(a){this.addDef(new Sk.builtin.str("_["+ ++this.tmpname+"]"),2,a)};c.prototype.addDef=function(a,b,c){var d=Sk.mangleName(this.curClass,a).v;d=Sk.fixReserved(d);var f=this.cur.symFlags[d];if(void 0!==f){if(b&4&&f&4)throw new Sk.builtin.SyntaxError("duplicate argument '"+a.v+"' in function definition",this.filename,c);f|=b}else f=b;this.cur.symFlags[d]= +f;b&4?this.cur.varnames.push(d):b&1&&(f=b,a=this.global[d],void 0!==a&&(f|=a),this.global[d]=f)};c.prototype.visitSlice=function(a){var b;switch(a.constructor){case Sk.astnodes.Slice:a.lower&&this.visitExpr(a.lower);a.upper&&this.visitExpr(a.upper);a.step&&this.visitExpr(a.step);break;case Sk.astnodes.ExtSlice:for(b=0;b<a.dims.length;++b)this.visitSlice(a.dims[b]);break;case Sk.astnodes.Index:this.visitExpr(a.value)}};c.prototype.visitStmt=function(a){var b;Sk.asserts.assert(void 0!==a,"visitStmt called with undefined"); +switch(a.constructor){case Sk.astnodes.FunctionDef:this.addDef(a.name,2,a.lineno);a.args.defaults&&this.SEQExpr(a.args.defaults);a.decorator_list&&this.SEQExpr(a.decorator_list);this.enterBlock(a.name.v,"function",a,a.lineno);this.visitArguments(a.args,a.lineno);this.SEQStmt(a.body);this.exitBlock();break;case Sk.astnodes.ClassDef:this.addDef(a.name,2,a.lineno);this.SEQExpr(a.bases);a.decorator_list&&this.SEQExpr(a.decorator_list);this.enterBlock(a.name.v,"class",a,a.lineno);this.curClass=a.name; +this.SEQStmt(a.body);this.exitBlock();break;case Sk.astnodes.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 Sk.astnodes.Delete:this.SEQExpr(a.targets);break;case Sk.astnodes.Assign:this.SEQExpr(a.targets);this.visitExpr(a.value);break;case Sk.astnodes.AnnAssign:if(a.target.constructor==Sk.astnodes.Name){var c=a.target;var e=Sk.mangleName(this.curClass,c.id).v; +e=Sk.fixReserved(e);c=this.cur.symFlags[e];if(c&2049&&this.global!=this.cur.symFlags&&a.simple)throw new Sk.builtin.SyntaxError("annotated name '"+e+"' can't be global",this.filename,a.lineno);a.simple?this.addDef(new Sk.builtin.str(e),4098,a.lineno):a.value&&this.addDef(new Sk.builtin.str(e),2,a.lineno)}else this.visitExpr(a.target);this.visitExpr(a.annotation);a.value&&this.visitExpr(a.value);break;case Sk.astnodes.AugAssign:this.visitExpr(a.target);this.visitExpr(a.value);break;case Sk.astnodes.Print:a.dest&& +this.visitExpr(a.dest);this.SEQExpr(a.values);break;case Sk.astnodes.For:this.visitExpr(a.target);this.visitExpr(a.iter);this.SEQStmt(a.body);a.orelse&&this.SEQStmt(a.orelse);break;case Sk.astnodes.While:this.visitExpr(a.test);this.SEQStmt(a.body);a.orelse&&this.SEQStmt(a.orelse);break;case Sk.astnodes.If:this.visitExpr(a.test);this.SEQStmt(a.body);a.orelse&&this.SEQStmt(a.orelse);break;case Sk.astnodes.Raise:a.exc&&(this.visitExpr(a.exc),a.inst&&(this.visitExpr(a.inst),a.tback&&this.visitExpr(a.tback)), +a.cause&&this.visitExpr(a.cause));break;case Sk.astnodes.Assert:this.visitExpr(a.test);a.msg&&this.visitExpr(a.msg);break;case Sk.astnodes.Import:case Sk.astnodes.ImportFrom:this.visitAlias(a.names,a.lineno);break;case Sk.astnodes.Global:var g=a.names.length;for(b=0;b<g;++b){e=Sk.mangleName(this.curClass,a.names[b]).v;e=Sk.fixReserved(e);c=this.cur.symFlags[e];if(c&10){if(c&2)throw new Sk.builtin.SyntaxError("name '"+e+"' is assigned to before global declaration",this.filename,a.lineno);throw new Sk.builtin.SyntaxError("name '"+ +e+"' is used prior to global declaration",this.filename,a.lineno);}this.addDef(new Sk.builtin.str(e),1,a.lineno)}break;case Sk.astnodes.Expr:this.visitExpr(a.value);break;case Sk.astnodes.Pass:case Sk.astnodes.Break:case Sk.astnodes.Continue:case Sk.astnodes.Debugger:break;case Sk.astnodes.With:d(this.visit_withitem.bind(this),a.items);d(this.visitStmt.bind(this),a.body);break;case Sk.astnodes.Try:this.SEQStmt(a.body);this.visitExcepthandlers(a.handlers);this.SEQStmt(a.orelse);this.SEQStmt(a.finalbody); +break;default:Sk.asserts.fail("Unhandled type "+a.constructor.name+" in visitStmt")}};c.prototype.visit_withitem=function(a){this.visitExpr(a.context_expr);a.optional_vars&&this.visitExpr(a.optional_vars)};c.prototype.visitExpr=function(a){Sk.asserts.assert(void 0!==a,"visitExpr called with undefined");switch(a.constructor){case Sk.astnodes.BoolOp:this.SEQExpr(a.values);break;case Sk.astnodes.BinOp:this.visitExpr(a.left);this.visitExpr(a.right);break;case Sk.astnodes.UnaryOp:this.visitExpr(a.operand); +break;case Sk.astnodes.Lambda:this.addDef(new Sk.builtin.str("lambda"),2,a.lineno);a.args.defaults&&this.SEQExpr(a.args.defaults);this.enterBlock("lambda","function",a,a.lineno);this.visitArguments(a.args,a.lineno);this.visitExpr(a.body);this.exitBlock();break;case Sk.astnodes.IfExp:this.visitExpr(a.test);this.visitExpr(a.body);this.visitExpr(a.orelse);break;case Sk.astnodes.Dict:this.SEQExpr(a.keys);this.SEQExpr(a.values);break;case Sk.astnodes.DictComp:case Sk.astnodes.SetComp:this.visitComprehension(a.generators, +0);break;case Sk.astnodes.ListComp:this.newTmpname(a.lineno);this.visitExpr(a.elt);this.visitComprehension(a.generators,0);break;case Sk.astnodes.GeneratorExp:this.visitGenexp(a);break;case Sk.astnodes.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 Sk.astnodes.Compare:this.visitExpr(a.left);this.SEQExpr(a.comparators);break;case Sk.astnodes.Call:this.visitExpr(a.func); +if(a.args)for(let b of a.args)b.constructor===Sk.astnodes.Starred?this.visitExpr(b.value):this.visitExpr(b);if(a.keywords)for(let b of a.keywords)this.visitExpr(b.value);break;case Sk.astnodes.Num:case Sk.astnodes.Str:case Sk.astnodes.Bytes:break;case Sk.astnodes.JoinedStr:for(let b of a.values)this.visitExpr(b);break;case Sk.astnodes.FormattedValue:this.visitExpr(a.value);a.format_spec&&this.visitExpr(a.format_spec);break;case Sk.astnodes.Attribute:this.visitExpr(a.value);break;case Sk.astnodes.Subscript:this.visitExpr(a.value); +this.visitSlice(a.slice);break;case Sk.astnodes.Name:this.addDef(a.id,a.ctx===Sk.astnodes.Load?8:2,a.lineno);break;case Sk.astnodes.NameConstant:break;case Sk.astnodes.List:case Sk.astnodes.Tuple:case Sk.astnodes.Set:this.SEQExpr(a.elts);break;case Sk.astnodes.Starred:this.visitExpr(a.value);break;default:Sk.asserts.fail("Unhandled type "+a.constructor.name+" in visitExpr")}};c.prototype.visitComprehension=function(a,b){var c,d=a.length;for(c=b;c<d;++c)b=a[c],this.visitExpr(b.target),this.visitExpr(b.iter), +this.SEQExpr(b.ifs)};c.prototype.visitAlias=function(a,b){var c,d;for(d=0;d<a.length;++d){var f=a[d];var e=c=null===f.asname?f.name.v:f.asname.v;f=c.indexOf(".");-1!==f&&(e=c.substr(0,f));if("*"!==c)this.addDef(new Sk.builtin.str(e),1024,b);else if("module"!==this.cur.blockType)throw new Sk.builtin.SyntaxError("import * only allowed at module level",this.filename);}};c.prototype.visitGenexp=function(a){var b=a.generators[0];this.visitExpr(b.iter);this.enterBlock("genexpr","function",a,a.lineno);this.cur.generator= +!0;this.addDef(new Sk.builtin.str(".0"),4,a.lineno);this.visitExpr(b.target);this.SEQExpr(b.ifs);this.visitComprehension(a.generators,1);this.visitExpr(a.elt);this.exitBlock()};c.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)};c.prototype.analyzeBlock=function(a,b,c,d){var f={};var g={},k={},h={},n={};"class"==a.blockType&&(e(k,d),b&&e(h,b));for(p in a.symFlags){var m=a.symFlags[p];this.analyzeName(a, +g,p,m,b,f,c,d)}"class"!==a.blockType&&("function"===a.blockType&&e(h,f),b&&e(h,b),e(k,d));f={};var p=a.children.length;for(m=0;m<p;++m)if(d=a.children[m],this.analyzeChildBlock(d,h,n,k,f),d.hasFree||d.childHasFree)a.childHasFree=!0;e(n,f);"function"===a.blockType&&this.analyzeCells(g,n);b=this.updateSymbols(a.symFlags,g,b,n,"class"===a.blockType);a.hasFree=a.hasFree||b;e(c,n)};c.prototype.analyzeChildBlock=function(a,b,c,d,h){var f={};e(f,b);b={};e(b,c);c={};e(c,d);this.analyzeBlock(a,f,b,c);e(h, +b)};c.prototype.analyzeCells=function(a,b){var c;for(c in a){var d=a[c];1===d&&void 0!==b[c]&&(a[c]=5,delete b[c])}};c.prototype.updateSymbols=function(a,b,c,d,e){var f,g=!1;for(f in a){var k=a[f];var h=b[f];k|=h<<11;a[f]=k}for(f in d)b=a[f],void 0!==b?e&&b&1031&&(b|=512,a[f]=b):void 0!==c[f]&&(a[f]=8192,g=!0);return g};c.prototype.analyzeName=function(a,b,c,d,e,h,m,p){if(d&1){if(d&4)throw new Sk.builtin.SyntaxError("name '"+c+"' is local and global",this.filename,a.lineno);b[c]=2;p[c]=null;e&&void 0!== +e[c]&&delete e[c]}else d&1030?(b[c]=1,h[c]=null,delete p[c]):e&&void 0!==e[c]?(b[c]=4,a.hasFree=!0,m[c]=null):(p&&void 0!==p[c]||!a.isNested||(a.hasFree=!0),b[c]=3)};c.prototype.analyze=function(){this.analyzeBlock(this.top,null,{},{})};Sk.symboltable=function(a,b){var d=new c(b);d.enterBlock("top","module",a,0);d.top=d.cur;for(b=0;b<a.body.length;++b)d.visitStmt(a.body[b]);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 e,g;void 0===f&&(f="");var k=f+"Sym_type: "+a.get_type()+"\n";k+=f+"Sym_name: "+a.get_name()+"\n";k+=f+"Sym_lineno: "+a.get_lineno()+"\n";k+=f+"Sym_nested: "+b(a.is_nested())+"\n";k+=f+"Sym_haschildren: "+b(a.has_children())+"\n";"class"===a.get_type()?k+=f+"Class_methods: "+c(a.get_methods())+"\n":"function"===a.get_type()&&(k+=f+"Func_params: "+c(a.get_parameters())+"\n",k+=f+"Func_locals: "+ +c(a.get_locals())+"\n",k+=f+"Func_globals: "+c(a.get_globals())+"\n",k+=f+"Func_frees: "+c(a.get_frees())+"\n");k+=f+"-- Identifiers --\n";var h=a.get_identifiers();var l=h.length;for(g=0;g<l;++g){var n=a.lookup(h[g]);k+=f+"name: "+n.get_name()+"\n";k+=f+" is_referenced: "+b(n.is_referenced())+"\n";k+=f+" is_imported: "+b(n.is_imported())+"\n";k+=f+" is_parameter: "+b(n.is_parameter())+"\n";k+=f+" is_global: "+b(n.is_global())+"\n";k+=f+" is_declared_global: "+b(n.is_declared_global())+"\n"; +k+=f+" is_local: "+b(n.is_local())+"\n";k+=f+" is_free: "+b(n.is_free())+"\n";k+=f+" is_assigned: "+b(n.is_assigned())+"\n";k+=f+" is_namespace: "+b(n.is_namespace())+"\n";var m=n.get_namespaces();var q=m.length;k+=f+" namespaces: [\n";var p=[];for(e=0;e<q;++e)n=m[e],p.push(d(n,f+" "));k+=p.join("\n");k+=f+" ]\n"}return k};return d(a.top,"")};Sk.exportSymbol("Sk.symboltable",Sk.symboltable);Sk.exportSymbol("Sk.dumpSymtab",Sk.dumpSymtab)},function(m,p){function a(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 b(){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.consts={};this.scopename=null;this.suffixCode=this.switchCode=this.varDeclsCode=this.prefixCode= +"";this.breakBlocks=[];this.continueBlocks=[];this.exceptBlocks=[];this.finallyBlocks=[]}function c(a){return void 0===g[a]?a:a+"_$rw$"}function d(a,b){var c=b.v;if(null===a||null===c||"_"!==c.charAt(0)||"_"!==c.charAt(1)||"_"===c.charAt(c.length-1)&&"_"===c.charAt(c.length-2))return b;var d=a.v;d.replace(/_/g,"");if(""===d)return b;d=a.v;d.replace(/^_*/,"");return d=new Sk.builtin.str("_"+d+c)}function e(a){let b='"';for(let c=0;c<a.length;c++){let d=a.charCodeAt(c);b=10==d?b+"\\n":92==d?b+"\\\\": +34==d||32>d||127<=d&&256>d?b+("\\x"+("0"+d.toString(16)).substr(-2)):256<=d?b+("\\u"+("000"+d.toString(16)).substr(-4)):b+a.charAt(c)}return b+'"'}var h;Sk.gensymcount=0;b.prototype.activateScope=function(){var a=this;h=function(){var b,c=a.blocks[a.curblock];if(null===c._next)for(b=0;b<arguments.length;++b)c.push(arguments[b])}};a.prototype.getSourceLine=function(a){Sk.asserts.assert(this.source);return this.source[a-1]};a.prototype.annotateSource=function(a){var b;if(this.source){var c=a.lineno; +var d=a.col_offset;h("\n//\n// line ",c,":\n// ",this.getSourceLine(c),"\n// ");for(b=0;b<d;++b)h(" ");h("^\n//\n");Sk.asserts.assert(void 0!==a.lineno&&void 0!==a.col_offset);h("$currLineNo = ",c,";\n$currColNo = ",d,";\n\n")}};a.prototype.gensym=function(a){return a="$"+(a||"")+Sk.gensymcount++};a.prototype.niceName=function(a){return this.gensym(a.replace("<","").replace(">","").replace(" ","_"))};var g=Sk.builtin.str.reservedWords_;a.prototype.makeConstant=function(a){var b,c="";for(b=0;b<arguments.length;++b)c+= +arguments[b];for(d in this.u.consts)if(this.u.consts.hasOwnProperty(d)&&(b=this.u.consts[d],b==c))return d;var d=this.u.scopename+"."+this.gensym("const");this.u.consts[d]=c;return d};a.prototype._gr=function(a,b){var c,d=this.gensym(a);this.u.localtemps.push(d);h("var ",d,"=");for(c=1;c<arguments.length;++c)h(arguments[c]);h(";");return d};a.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;$susp.optional = true;return $susp;}",this.u.doesSuspend=!0);return a};a.prototype._jumpfalse=function(a,b){a=this._gr("jfalse","(",a,"===false||!Sk.misceval.isTrue(", +a,"))");h("if(",a,"){/*test failed */$blk=",b,";continue;}")};a.prototype._jumpundef=function(a,b){h("if(",a,"===undefined){$blk=",b,";continue;}")};a.prototype._jumpnotundef=function(a,b){h("if(",a,"!==undefined){$blk=",b,";continue;}")};a.prototype._jumptrue=function(a,b){a=this._gr("jtrue","(",a,"===true||Sk.misceval.isTrue(",a,"))");h("if(",a,"){/*test passed */$blk=",b,";continue;}")};a.prototype._jump=function(a){null===this.u.blocks[this.u.curblock]._next&&(h("$blk=",a,";"),this.u.blocks[this.u.curblock]._next= +a)};a.prototype._checkSuspension=function(a){if(this.u.canSuspend){var b=this.newBlock("function return or resume suspension");this._jump(b);this.setBlock(b);a=a||{lineno:"$currLineNo",col_offset:"$currColNo"};h("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)}else h("if ($ret && $ret.$isSuspension) { $ret = Sk.misceval.retryOptionalSuspensionOrThrow($ret); }")}; +a.prototype.cunpackstarstoarray=function(a,b){if(!a||0==a.length)return"[]";let c=!1;for(let d of a){if(b&&c)throw new Sk.builtin.SyntaxError("Extended argument unpacking is not permitted in Python 2");d.constructor===Sk.astnodes.Starred&&(c=!0)}if(c){b=this._gr("unpack","[]");for(let c of a)c.constructor!==Sk.astnodes.Starred?h(b,".push(",this.vexpr(c),");"):(h("$ret = Sk.misceval.iterFor(Sk.abstr.iter(",this.vexpr(c.value),"), function(e) { ",b,".push(e); });"),this._checkSuspension());return b}return"["+ +a.map(a=>this.vexpr(a)).join(",")+"]"};a.prototype.ctuplelistorset=function(a,b,c){var d;Sk.asserts.assert("tuple"===c||"list"===c||"set"===c);var f=!1;for(d=0;d<a.elts.length;d++)if(a.elts[d].constructor===Sk.astnodes.Starred){f=!0;var e=d;break}if(a.ctx===Sk.astnodes.Store){if(f){if(!Sk.__future__.python3)throw new Sk.builtin.SyntaxError("assignment unpacking with stars is not supported in Python 2",this.filename,a.lineno);for(d=e+1;d<a.elts.length;d++)if(a.elts[d].constructor===Sk.astnodes.Starred)throw new Sk.builtin.SyntaxError("multiple starred expressions in assignment", +this.filename,a.lineno);}c=f?e:a.elts.length;h("$ret = Sk.abstr.sequenceUnpack("+b+","+c+","+(f?a.elts.length-1:c)+", "+f+");");this._checkSuspension();b=this._gr("items","$ret");for(d=0;d<a.elts.length;++d)d===e?this.vexpr(a.elts[d].value,b+"["+d+"]"):this.vexpr(a.elts[d],b+"["+d+"]")}else if(a.ctx===Sk.astnodes.Load||"set"===c){if(f){if(!Sk.__future__.python3)throw new Sk.builtin.SyntaxError("List packing with stars is not supported in Python 2");return this._gr("load"+c,"new Sk.builtins['",c,"'](", +this.cunpackstarstoarray(a.elts),")")}if("tuple"===c){f=!0;b=[];for(d=0;d<a.elts.length;++d)e=this.vexpr(a.elts[d]),f&&-1==e.indexOf("$const")&&(f=!1),b.push(e);if(f)return this.makeConstant("new Sk.builtin.tuple(["+b+"])");for(d=0;d<b.length;++d)b[d]=this._gr("elem",b[d]);return this._gr("load"+c,"new Sk.builtins['",c,"']([",b,"])")}b=[];for(d=0;d<a.elts.length;++d)b.push(this._gr("elem",this.vexpr(a.elts[d])));return this._gr("load"+c,"new Sk.builtins['",c,"']([",b,"])")}};a.prototype.cdict=function(a){var b; +var c=[];if(null!==a.keys)for(Sk.asserts.assert(a.values.length===a.keys.length),b=0;b<a.values.length;++b){var d=this.vexpr(a.values[b]);c.push(this.vexpr(a.keys[b]));c.push(d)}return this._gr("loaddict","new Sk.builtins['dict']([",c,"])")};a.prototype.clistcomp=function(a){Sk.asserts.assert(a instanceof Sk.astnodes.ListComp);var b=this._gr("_compr","new Sk.builtins['list']([])");return this.ccompgen("list",b,a.generators,0,a.elt,null,a)};a.prototype.cdictcomp=function(a){Sk.asserts.assert(a instanceof +Sk.astnodes.DictComp);var b=this._gr("_dcompr","new Sk.builtins.dict([])");return this.ccompgen("dict",b,a.generators,0,a.value,a.key,a)};a.prototype.csetcomp=function(a){Sk.asserts.assert(a instanceof Sk.astnodes.SetComp);var b=this._gr("_setcompr","new Sk.builtins.set([])");return this.ccompgen("set",b,a.generators,0,a.elt,null,a)};a.prototype.ccompgen=function(a,b,c,d,e,g,m){var f=this.newBlock(a+" comp start"),k=this.newBlock(a+" comp skip"),l=this.newBlock(a+" comp anchor"),n=c[d],q=this.vexpr(n.iter); +q=this._gr("iter","Sk.abstr.iter(",q,")");var p;this._jump(f);this.setBlock(f);h("$ret = Sk.abstr.iternext(",q,", true);");this._checkSuspension(m);q=this._gr("next","$ret");this._jumpundef(q,l);this.vexpr(n.target,q);var u=n.ifs?n.ifs.length:0;for(p=0;p<u;++p)q=this.vexpr(n.ifs[p]),this._jumpfalse(q,f);++d<c.length&&this.ccompgen(a,b,c,d,e,g,m);d>=c.length&&(c=this.vexpr(e),"dict"===a?(a=this.vexpr(g),h(b,".mp$ass_subscript(",a,",",c,");")):"list"===a?h(b,".v.push(",c,");"):"set"===a&&h(b,".v.mp$ass_subscript(", +c,", true);"),this._jump(k),this.setBlock(k));this._jump(f);this.setBlock(l);return b};a.prototype.cyield=function(a){if(this.u.ste.blockType!==Sk.SYMTAB_CONSTS.FunctionBlock)throw new Sk.builtin.SyntaxError("'yield' outside function",this.filename,a.lineno);var b="Sk.builtin.none.none$";a.value&&(b=this.vexpr(a.value));a=this.newBlock("after yield");h("return [/*resume*/",a,",/*ret*/",b,"];");this.setBlock(a);return"$gen.gi$sentvalue"};a.prototype.ccompare=function(a){var b;Sk.asserts.assert(a.ops.length=== +a.comparators.length);var c=this.vexpr(a.left);var d=a.ops.length;var f=this.newBlock("done");var e=this._gr("compareres","null");for(b=0;b<d;++b){var g=this.vexpr(a.comparators[b]);h("$ret = Sk.builtin.bool(Sk.misceval.richCompareBool(",c,",",g,",'",a.ops[b].prototype._astname,"', true));");this._checkSuspension(a);h(e,"=$ret;");this._jumpfalse("$ret",f);c=g}this._jump(f);this.setBlock(f);return e};a.prototype.ccall=function(a){var b=this.vexpr(a.func);let c=this.cunpackstarstoarray(a.args,!Sk.__future__.python3); +var d="undefined";if(a.keywords&&0<a.keywords.length){let c=!1;d=[];for(let b of a.keywords){if(c&&!Sk.__future__.python3)throw new SyntaxError("Advanced unpacking of function arguments is not supported in Python 2");b.arg?(d.push("'"+b.arg.v+"'"),d.push(this.vexpr(b.value))):c=!0}d="["+d.join(",")+"]";if(c){d=this._gr("keywordArgs",d);for(let c of a.keywords)c.arg||(h("$ret = Sk.abstr.mappingUnpackIntoKeywordArray(",d,",",this.vexpr(c.value),",",b,");"),this._checkSuspension())}}Sk.__future__.super_args&& +a.func.id&&"super"===a.func.id.v&&"[]"===c&&(h('if (typeof self === "undefined" || self.toString().indexOf("Window") > 0) { throw new Sk.builtin.RuntimeError("super(): no arguments") };'),c="[$gbl.__class__,self]");h("$ret = (",b,".tp$call)?",b,".tp$call(",c,",",d,") : Sk.misceval.applyOrSuspend(",b,",undefined,undefined,",d,",",c,");");this._checkSuspension(a);return this._gr("call","$ret")};a.prototype.cslice=function(a){Sk.asserts.assert(a instanceof Sk.astnodes.Slice);if(Sk.__future__.python3){var b= +a.lower?this.vexpr(a.lower):"Sk.builtin.none.none$";var c=a.upper?this.vexpr(a.upper):"Sk.builtin.none.none$"}else b=a.lower?this.vexpr(a.lower):a.step?"Sk.builtin.none.none$":"new Sk.builtin.int_(0)",c=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'](",b,",",c,",",a,")")};a.prototype.eslice=function(a){var b;Sk.asserts.assert(a instanceof Array);var c= +[];for(b=0;b<a.length;b++)c.push(this.vslicesub(a[b]));return this._gr("extslice","new Sk.builtins['tuple']([",c,"])")};a.prototype.vslicesub=function(a){switch(a.constructor){case Sk.astnodes.Index:var b=this.vexpr(a.value);break;case Sk.astnodes.Slice:b=this.cslice(a);break;case Sk.astnodes.Ellipsis:Sk.asserts.fail("todo compile.js Ellipsis;");break;case Sk.astnodes.ExtSlice:b=this.eslice(a.dims);break;default:Sk.asserts.fail("invalid subscript kind")}return b};a.prototype.vslice=function(a,b,c, +d){a=this.vslicesub(a);return this.chandlesubscr(b,c,a,d)};a.prototype.chandlesubscr=function(a,b,c,d){if(a===Sk.astnodes.Load||a===Sk.astnodes.AugLoad)return h("$ret = Sk.abstr.objectGetItem(",b,",",c,", true);"),this._checkSuspension(),this._gr("lsubscr","$ret");a===Sk.astnodes.Store||a===Sk.astnodes.AugStore?(h("$ret = Sk.abstr.objectSetItem(",b,",",c,",",d,", true);"),this._checkSuspension()):a===Sk.astnodes.Del?h("Sk.abstr.objectDelItem(",b,",",c,");"):Sk.asserts.fail("handlesubscr fail")};a.prototype.cboolop= +function(a){var b,c;Sk.asserts.assert(a instanceof Sk.astnodes.BoolOp);var d=a.op===Sk.astnodes.And?this._jumpfalse:this._jumptrue;var f=this.newBlock("end of boolop");var e=a.values;var g=e.length;for(b=0;b<g;++b)a=this.vexpr(e[b]),0===b&&(c=this._gr("boolopsucc",a)),h(c,"=",a,";"),d.call(this,a,f);this._jump(f);this.setBlock(f);return c};a.prototype.cjoinedstr=function(a){let b;Sk.asserts.assert(a instanceof Sk.astnodes.JoinedStr);for(let c of a.values)a=this.vexpr(c),b?h(b,"=",b,".sq$concat(", +a,");"):b=this._gr("joinedstr",a);b||(b="Sk.builtin.str.$emptystr");return b};a.prototype.cformattedvalue=function(a){let b=this.vexpr(a.value);switch(a.conversion){case "s":b=this._gr("value","new Sk.builtin.str(",b,")");break;case "a":b=this._gr("value","Sk.builtin.ascii(",b,")");break;case "r":b=this._gr("value","Sk.builtin.repr(",b,")")}a=a.format_spec?this.vexpr(a.format_spec):"Sk.builtin.str.$emptystr";return this._gr("formatted","Sk.abstr.objectFormat("+b+","+a+")")};a.prototype.vexpr=function(a, +b,c,g){var f;a.lineno>this.u.lineno&&(this.u.lineno=a.lineno,this.u.linenoSet=!1);switch(a.constructor){case Sk.astnodes.BoolOp:return this.cboolop(a);case Sk.astnodes.BinOp:return this._gr("binop","Sk.abstr.numberBinOp(",this.vexpr(a.left),",",this.vexpr(a.right),",'",a.op.prototype._astname,"')");case Sk.astnodes.UnaryOp:return this._gr("unaryop","Sk.abstr.numberUnaryOp(",this.vexpr(a.operand),",'",a.op.prototype._astname,"')");case Sk.astnodes.Lambda:return this.clambda(a);case Sk.astnodes.IfExp:return this.cifexp(a); +case Sk.astnodes.Dict:return this.cdict(a);case Sk.astnodes.ListComp:return this.clistcomp(a);case Sk.astnodes.DictComp:return this.cdictcomp(a);case Sk.astnodes.SetComp:return this.csetcomp(a);case Sk.astnodes.GeneratorExp:return this.cgenexp(a);case Sk.astnodes.Yield:return this.cyield(a);case Sk.astnodes.Compare:return this.ccompare(a);case Sk.astnodes.Call:return b=this.ccall(a),this.annotateSource(a),b;case Sk.astnodes.Num:if("number"===typeof a.n)return a.n;if(a.n instanceof Sk.builtin.int_)return this.makeConstant("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,this.makeConstant("new Sk.builtin.float_("+a+")");if(a.n instanceof Sk.builtin.lng)return this.makeConstant("Sk.longFromStr('"+a.n.tp$str().v+"')");if(a.n instanceof Sk.builtin.complex)return this.makeConstant("new Sk.builtin.complex("+(0===a.n.real&&-Infinity===1/a.n.real?"-0":a.n.real)+", "+(0===a.n.imag&&-Infinity===1/a.n.imag?"-0":a.n.imag)+")");Sk.asserts.fail("unhandled Num type");case Sk.astnodes.Bytes:if(Sk.__future__.python3){b= +[];a=a.s.$jsstr();for(c=0;c<a.length;c++)b.push(a.charCodeAt(c));return this.makeConstant("new Sk.builtin.bytes([",b.join(", "),"])")}case Sk.astnodes.Str:return this.makeConstant("new Sk.builtin.str(",e(a.s.$jsstr()),")");case Sk.astnodes.Attribute:a.ctx!==Sk.astnodes.AugLoad&&a.ctx!==Sk.astnodes.AugStore&&(f=this.vexpr(a.value));g=a.attr.$r().v;g=g.substring(1,g.length-1);g=d(this.u.private_,new Sk.builtin.str(g)).v;g=this.makeConstant("new Sk.builtin.str('"+g+"')");switch(a.ctx){case Sk.astnodes.AugLoad:return h("$ret = Sk.abstr.gattr(", +c,",",g,", true);"),this._checkSuspension(a),this._gr("lattr","$ret");case Sk.astnodes.Load:return h("$ret = Sk.abstr.gattr(",f,",",g,", true);"),this._checkSuspension(a),this._gr("lattr","$ret");case Sk.astnodes.AugStore:h("$ret = undefined;");h("if(",b,"!==undefined){");h("$ret = Sk.abstr.sattr(",c,",",g,",",b,", true);");h("}");this._checkSuspension(a);break;case Sk.astnodes.Store:h("$ret = Sk.abstr.sattr(",f,",",g,",",b,", true);");this._checkSuspension(a);break;case Sk.astnodes.Del:Sk.asserts.fail("todo Del;"); +break;default:Sk.asserts.fail("invalid attribute expression")}break;case Sk.astnodes.Subscript:switch(a.ctx){case Sk.astnodes.AugLoad:return h("$ret = Sk.abstr.objectGetItem(",c,",",g,", true);"),this._checkSuspension(a),this._gr("gitem","$ret");case Sk.astnodes.Load:case Sk.astnodes.Store:case Sk.astnodes.Del:return this.vslice(a.slice,a.ctx,this.vexpr(a.value),b);case Sk.astnodes.AugStore:h("$ret=undefined;");h("if(",b,"!==undefined){");h("$ret=Sk.abstr.objectSetItem(",c,",",g,",",b,", true)"); +h("}");this._checkSuspension(a);break;default:Sk.asserts.fail("invalid subscript expression")}break;case Sk.astnodes.Name:return this.nameop(a.id,a.ctx,b);case Sk.astnodes.NameConstant:if(a.ctx===Sk.astnodes.Store||a.ctx===Sk.astnodes.AugStore||a.ctx===Sk.astnodes.Del)throw new Sk.builtin.SyntaxError("can not assign to a constant name");switch(a.value){case Sk.builtin.none.none$:return"Sk.builtin.none.none$";case Sk.builtin.bool.true$:return"Sk.builtin.bool.true$";case Sk.builtin.bool.false$:return"Sk.builtin.bool.false$"; +default:Sk.asserts.fail("invalid named constant")}break;case Sk.astnodes.List:return this.ctuplelistorset(a,b,"list");case Sk.astnodes.Tuple:return this.ctuplelistorset(a,b,"tuple");case Sk.astnodes.Set:return this.ctuplelistorset(a,b,"set");case Sk.astnodes.Starred:switch(a.ctx){case Sk.astnodes.Store:throw new Sk.builtin.SyntaxError("starred assignment target must be in a list or tuple",this.filename,a.lineno);default:throw new Sk.builtin.SyntaxError("can't use starred expression here",this.filename, +a.lineno);}case Sk.astnodes.JoinedStr:return this.cjoinedstr(a);case Sk.astnodes.FormattedValue:return this.cformattedvalue(a);default:Sk.asserts.fail("unhandled case "+a.constructor.name+" vexpr")}};a.prototype.vseqexpr=function(a,b){var c;Sk.asserts.assert(void 0===b||a.length===b.length);var d=[];for(c=0;c<a.length;++c)d.push(this.vexpr(a[c],void 0===b?void 0:b[c]));return d};a.prototype.caugassign=function(a){Sk.asserts.assert(a instanceof Sk.astnodes.AugAssign);var b=a.target;switch(b.constructor){case Sk.astnodes.Attribute:var c= +this.vexpr(b.value);b=new Sk.astnodes.Attribute(b.value,b.attr,Sk.astnodes.AugLoad,b.lineno,b.col_offset);var d=this.vexpr(b,void 0,c);var f=this.vexpr(a.value);a=this._gr("inplbinopattr","Sk.abstr.numberInplaceBinOp(",d,",",f,",'",a.op.prototype._astname,"')");b.ctx=Sk.astnodes.AugStore;return this.vexpr(b,a,c);case Sk.astnodes.Subscript:c=this.vexpr(b.value);var e=this.vslicesub(b.slice);b=new Sk.astnodes.Subscript(b.value,e,Sk.astnodes.AugLoad,b.lineno,b.col_offset);d=this.vexpr(b,void 0,c,e); +f=this.vexpr(a.value);a=this._gr("inplbinopsubscr","Sk.abstr.numberInplaceBinOp(",d,",",f,",'",a.op.prototype._astname,"')");b.ctx=Sk.astnodes.AugStore;return this.vexpr(b,a,c,e);case Sk.astnodes.Name:return c=this.nameop(b.id,Sk.astnodes.Load),f=this.vexpr(a.value),a=this._gr("inplbinop","Sk.abstr.numberInplaceBinOp(",c,",",f,",'",a.op.prototype._astname,"')"),this.nameop(b.id,Sk.astnodes.Store,a);default:Sk.asserts.fail("unhandled case in augassign")}};a.prototype.exprConstant=function(a){switch(a.constructor){case Sk.astnodes.Num:return Sk.misceval.isTrue(a.n)? +1:0;case Sk.astnodes.Str:return Sk.misceval.isTrue(a.s)?1:0;default:return-1}};a.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};a.prototype.setBlock=function(a){Sk.asserts.assert(0<=a&&a<this.u.blocknum);this.u.curblock=a};a.prototype.pushBreakBlock=function(a){Sk.asserts.assert(0<=a&&a<this.u.blocknum);this.u.breakBlocks.push(a)};a.prototype.popBreakBlock=function(){this.u.breakBlocks.pop()};a.prototype.pushContinueBlock= +function(a){Sk.asserts.assert(0<=a&&a<this.u.blocknum);this.u.continueBlocks.push(a)};a.prototype.popContinueBlock=function(){this.u.continueBlocks.pop()};a.prototype.pushExceptBlock=function(a){Sk.asserts.assert(0<=a&&a<this.u.blocknum);this.u.exceptBlocks.push(a)};a.prototype.popExceptBlock=function(){this.u.exceptBlocks.pop()};a.prototype.pushFinallyBlock=function(a){Sk.asserts.assert(0<=a&&a<this.u.blocknum);Sk.asserts.assert(this.u.breakBlocks.length===this.u.continueBlocks.length);this.u.finallyBlocks.push({blk:a, +breakDepth:this.u.breakBlocks.length})};a.prototype.popFinallyBlock=function(){this.u.finallyBlocks.pop()};a.prototype.peekFinallyBlock=function(){return 0<this.u.finallyBlocks.length?this.u.finallyBlocks[this.u.finallyBlocks.length-1]:void 0};a.prototype.setupExcept=function(a){h("$exc.push(",a,");")};a.prototype.endExcept=function(){h("$exc.pop();")};a.prototype.outputLocals=function(a){var b,c={};for(b=0;a.argnames&&b<a.argnames.length;++b)c[a.argnames[b]]=!0;a.localnames.sort();var d=[];for(b= +0;b<a.localnames.length;++b){var f=a.localnames[b];void 0===c[f]&&(d.push(f),c[f]=!0)}return 0<d.length?"var "+d.join(",")+"; /* locals */":""};a.prototype.outputSuspensionHelpers=function(a){var b,c=[],d=a.localnames.concat(a.tempsToSave),f={},e=a.ste.blockType===Sk.SYMTAB_CONSTS.FunctionBlock&&a.ste.childHasFree,g=(0<d.length?"var "+d.join(",")+";":"")+"var $wakeFromSuspension = function() {var susp = "+a.scopename+".$wakingSuspension; "+a.scopename+".$wakingSuspension = undefined;$blk=susp.$blk; $loc=susp.$loc; $gbl=susp.$gbl; $exc=susp.$exc; $err=susp.$err; $postfinally=susp.$postfinally;$currLineNo=susp.$lineno; $currColNo=susp.$colno; Sk.lastYield=Date.now();"+ +(e?"$cell=susp.$cell;":"");for(b=0;b<d.length;b++){var h=d[b];void 0===f[h]&&(g+=h+"=susp.$tmps."+h+";",f[h]=!0)}g+="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; } }};";g+="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.$postfinally=$postfinally;susp.$filename=$filename;susp.$lineno=$lineno;susp.$colno=$colno;susp.optional=susp.child.optional;"+(e?"susp.$cell=$cell;":"");f={};for(b=0;b<d.length;b++)h=d[b],void 0===f[h]&&(c.push('"'+h+'":'+h),f[h]=!0);return g+="susp.$tmps={"+c.join(",")+"};return susp;};"};a.prototype.outputAllUnits= +function(){var a,b,c="";for(b=0;b<this.allUnits.length;++b){var d=this.allUnits[b];c+=d.prefixCode;c+=this.outputLocals(d);d.doesSuspend&&(c+=this.outputSuspensionHelpers(d));c+=d.varDeclsCode;c+=d.switchCode;var e=d.blocks;var g=Object.create(null);for(a=0;a<e.length;++a){var h=a;if(!(h in g))for(;;)if(g[h]=!0,c+="case "+h+": /* --- "+e[h]._name+" --- */",c+=e[h].join(""),null!==e[h]._next)if(e[h]._next in g){c+="/* jump */ continue;";break}else c+="/* allowing case fallthrough */",h=e[h]._next; +else{c+="throw new Sk.builtin.SystemError('internal error: unterminated block');";break}}c+=d.suffixCode}return c};a.prototype.cif=function(a){var b;Sk.asserts.assert(a instanceof Sk.astnodes.If);var c=this.exprConstant(a.test);if(0===c)a.orelse&&0<a.orelse.length&&this.vseqstmt(a.orelse);else if(1===c)this.vseqstmt(a.body);else{var d=this.newBlock("end of if");a.orelse&&0<a.orelse.length&&(b=this.newBlock("next branch of if"));c=this.vexpr(a.test);a.orelse&&0<a.orelse.length?(this._jumpfalse(c,b), +this.vseqstmt(a.body),this._jump(d),this.setBlock(b),this.vseqstmt(a.orelse)):(this._jumpfalse(c,d),this.vseqstmt(a.body));this._jump(d);this.setBlock(d)}};a.prototype.cwhile=function(a){if(0===this.exprConstant(a.test))a.orelse&&this.vseqstmt(a.orelse);else{var b=this.newBlock("while test");this._jump(b);this.setBlock(b);var c=this.newBlock("after while");var d=0<a.orelse.length?this.newBlock("while orelse"):null;var f=this.newBlock("while body");this.annotateSource(a);this._jumpfalse(this.vexpr(a.test), +d?d:c);this._jump(f);this.pushBreakBlock(c);this.pushContinueBlock(b);this.setBlock(f);(Sk.debugging||Sk.killableWhile)&&this.u.canSuspend&&(f=this.newBlock("debug breakpoint for line "+a.lineno),h("if (Sk.breakpoints('"+this.filename+"',"+a.lineno+","+a.col_offset+")) {","var $susp = $saveSuspension({data: {type: 'Sk.delay'}, resume: function() {}}, '"+this.filename+"',"+a.lineno+","+a.col_offset+");","$susp.$blk = "+f+";","$susp.optional = true;","return $susp;","}"),this._jump(f),this.setBlock(f), +this.u.doesSuspend=!0);this.vseqstmt(a.body);this._jump(b);this.popContinueBlock();this.popBreakBlock();0<a.orelse.length&&(this.setBlock(d),this.vseqstmt(a.orelse),this._jump(c));this.setBlock(c)}};a.prototype.cfor=function(a){var b=this.newBlock("for start"),c=this.newBlock("for cleanup"),d=this.newBlock("for end");this.pushBreakBlock(d);this.pushContinueBlock(b);var f=this.vexpr(a.iter);if(this.u.ste.generator){var e="$loc."+this.gensym("iter");h(e,"=Sk.abstr.iter(",f,");")}else e=this._gr("iter", +"Sk.abstr.iter(",f,")"),this.u.tempsToSave.push(e);this._jump(b);this.setBlock(b);h("$ret = Sk.abstr.iternext(",e,this.u.canSuspend?", true":", false",");");this._checkSuspension(a);e=this._gr("next","$ret");this._jumpundef(e,c);this.vexpr(a.target,e);(Sk.debugging||Sk.killableFor)&&this.u.canSuspend&&(e=this.newBlock("debug breakpoint for line "+a.lineno),h("if (Sk.breakpoints('"+this.filename+"',"+a.lineno+","+a.col_offset+")) {","var $susp = $saveSuspension({data: {type: 'Sk.delay'}, resume: function() {}}, '"+ +this.filename+"',"+a.lineno+","+a.col_offset+");","$susp.$blk = "+e+";","$susp.optional = true;","return $susp;","}"),this._jump(e),this.setBlock(e),this.u.doesSuspend=!0);this.vseqstmt(a.body);this._jump(b);this.setBlock(c);this.popContinueBlock();this.popBreakBlock();this.vseqstmt(a.orelse);this._jump(d);this.setBlock(d)};a.prototype.craise=function(a){if(a.exc){var b=this._gr("exc",this.vexpr(a.exc)),c=this.newBlock("exception now instantiated"),d=this._gr("isclass",b+".prototype instanceof Sk.builtin.BaseException"); +this._jumpfalse(d,c);a.inst?(d=this._gr("inst",this.vexpr(a.inst)),h("if(!(",d," instanceof Sk.builtin.tuple)) {",d,"= new Sk.builtin.tuple([",d,"]);","}"),h("$ret = Sk.misceval.callsimOrSuspendArray(",b,",",d,".v);")):h("$ret = Sk.misceval.callsimOrSuspend(",b,");");this._checkSuspension(a);h(b,"=$ret;");this._jump(c);this.setBlock(c);h("if (",b," instanceof Sk.builtin.BaseException) {throw ",b,";} else {throw new Sk.builtin.TypeError('exceptions must derive from BaseException');};")}else h("throw $err;")}; +a.prototype.outputFinallyCascade=function(a){if(0==this.u.finallyBlocks.length)h("if($postfinally!==undefined) { if ($postfinally.returning) { return $postfinally.returning; } else { $blk=$postfinally.gotoBlock; $postfinally=undefined; continue; } }");else{var b=this.peekFinallyBlock();h("if($postfinally!==undefined) {","if ($postfinally.returning",b.breakDepth==a.breakDepth?"|| $postfinally.isBreak":"",") {","$blk=",b.blk,";continue;","} else {","$blk=$postfinally.gotoBlock;$postfinally=undefined;continue;", +"}","}")}};a.prototype.ctry=function(a){var b,c=a.handlers.length;if(a.finalbody){var d=this.newBlock("finalbody");var f=this.newBlock("finalexh");var e=this._gr("finally_reraise","undefined");this.u.tempsToSave.push(e);this.pushFinallyBlock(d);var g=this.peekFinallyBlock();this.setupExcept(f)}var m=[];for(b=0;b<c;++b)m.push(this.newBlock("except_"+b+"_"));var p=this.newBlock("unhandled");var H=this.newBlock("orelse");var K=this.newBlock("end");0!=m.length&&this.setupExcept(m[0]);this.vseqstmt(a.body); +0!=m.length&&this.endExcept();this._jump(H);for(b=0;b<c;++b){this.setBlock(m[b]);var C=a.handlers[b];if(!C.type&&b<c-1)throw new Sk.builtin.SyntaxError("default 'except:' must be last",this.filename,C.lineno);if(C.type){var F=this.vexpr(C.type);var L=b==c-1?p:m[b+1];F=this._gr("instance","Sk.misceval.isTrue(Sk.builtin.isinstance($err, ",F,"))");this._jumpfalse(F,L)}C.name&&this.vexpr(C.name,"$err");this.vseqstmt(C.body);this._jump(K)}this.setBlock(p);h("throw $err;");this.setBlock(H);this.vseqstmt(a.orelse); +this._jump(K);this.setBlock(K);a.finalbody&&(this.endExcept(),this._jump(d),this.setBlock(f),h(e,"=$err;"),this._jump(d),this.setBlock(d),this.popFinallyBlock(),this.vseqstmt(a.finalbody),h("if(",e,"!==undefined) { throw ",e,";}"),this.outputFinallyCascade(g))};a.prototype.cwith=function(a,b){var c=this.newBlock("withexh"),d=this.newBlock("withtidyup"),f=this.newBlock("withcarryon");var e=this._gr("mgr",this.vexpr(a.items[b].context_expr));h("$ret = Sk.abstr.gattr(",e,",Sk.builtin.str.$exit, true);"); +this._checkSuspension(a);var g=this._gr("exit","$ret");this.u.tempsToSave.push(g);h("$ret = Sk.abstr.gattr(",e,",Sk.builtin.str.$enter, true);");this._checkSuspension(a);h("$ret = Sk.misceval.callsimOrSuspendArray($ret);");this._checkSuspension(a);e=this._gr("value","$ret");this.pushFinallyBlock(d);var k=this.u.finallyBlocks[this.u.finallyBlocks.length-1];this.setupExcept(c);a.items[b].optional_vars&&this.nameop(a.items[b].optional_vars.id,Sk.astnodes.Store,e);b+1<a.items.length?this.cwith(a,b+1): +this.vseqstmt(a.body);this.endExcept();this._jump(d);this.setBlock(c);h("$ret = Sk.misceval.applyOrSuspend(",g,",undefined,Sk.builtin.getExcInfo($err),undefined,[]);");this._checkSuspension(a);this._jumptrue("$ret",f);h("throw $err;");this.setBlock(d);this.popFinallyBlock();h("$ret = Sk.misceval.callsimOrSuspendArray(",g,",[Sk.builtin.none.none$,Sk.builtin.none.none$,Sk.builtin.none.none$]);");this._checkSuspension(a);this.outputFinallyCascade(k);this._jump(f);this.setBlock(f)};a.prototype.cassert= +function(a){var b=this.vexpr(a.test),c=this.newBlock("end");this._jumptrue(b,c);h("throw new Sk.builtin.AssertionError(",a.msg?this.vexpr(a.msg):"",");");this.setBlock(c)};a.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,", new Sk.builtin.str('",c,"'))"),a=a.substr(d+1);return this.nameop(b,Sk.astnodes.Store,e)};a.prototype.cimport=function(a){var b,c=a.names.length; +for(b=0;b<c;++b){var d=a.names[b];h("$ret = Sk.builtin.__import__(",d.name.$r().v,",$gbl,$loc,[],",Sk.__future__.absolute_import?0:-1,");");this._checkSuspension(a);var e=this._gr("module","$ret");if(d.asname)this.cimportas(d.name,d.asname,e);else{var f=d.name;d=f.v.indexOf(".");-1!==d&&(f=new Sk.builtin.str(f.v.substr(0,d)));this.nameop(f,Sk.astnodes.Store,e)}}};a.prototype.cfromimport=function(a){var b,d=a.names.length;var e=[];var f=a.level;0!=f||Sk.__future__.absolute_import||(f=-1);for(b=0;b< +d;++b)e[b]="'"+c(a.names[b].name.v)+"'";h("$ret = Sk.builtin.__import__(",a.module.$r().v,",$gbl,$loc,[",e,"],",f,");");this._checkSuspension(a);f=this._gr("module","$ret");for(b=0;b<d;++b){e=a.names[b];var g="'"+e.name.v+"'";if(0===b&&"*"===e.name.v){Sk.asserts.assert(1===d);h("Sk.importStar(",f,",$loc, $gbl);");break}var m=this._gr("item","Sk.abstr.gattr(",f,", new Sk.builtin.str(",g,"))");g=e.name;e.asname&&(g=e.asname);this.nameop(g,Sk.astnodes.Store,m)}};a.prototype.buildcodeobj=function(a,b, +e,g,m,p){var f=[],k=[],l=[],n=[],q=null,u=null;e&&(k=this.vseqexpr(e));g&&g.defaults&&(l=this.vseqexpr(g.defaults));g&&g.kw_defaults&&(n=g.kw_defaults.map(a=>a?this.vexpr(a):"undefined"));g&&g.vararg&&(q=g.vararg);g&&g.kwarg&&(u=g.kwarg);if(!Sk.__future__.python3&&g&&g.kwonlyargs&&0!=g.kwonlyargs.length)throw new Sk.builtin.SyntaxError("Keyword-only arguments are not supported in Python 2");var F=this.enterScope(b,a,a.lineno,this.canSuspend);e=this.u.ste.generator;var L=this.u.ste.hasFree;var W=this.u.ste.childHasFree; +var N=this.newBlock("codeobj entry");this.u.prefixCode="var "+F+"=(function "+this.niceName(b.v)+"$(";var E=[];if(e){if(u)throw new Sk.builtin.SyntaxError(b.v+"(): keyword arguments in generators not supported",this.filename,a.lineno);if(q)throw new Sk.builtin.SyntaxError(b.v+"(): variable number of arguments in generators not supported",this.filename,a.lineno);E.push("$gen")}else{u&&(E.push("$kwa"),this.u.tempsToSave.push("$kwa"));for(a=0;g&&a<g.args.length;++a)E.push(this.nameop(g.args[a].arg,Sk.astnodes.Param)); +for(a=0;g&&g.kwonlyargs&&a<g.kwonlyargs.length;++a)E.push(this.nameop(g.kwonlyargs[a].arg,Sk.astnodes.Param));q&&E.push(this.nameop(g.vararg.arg,Sk.astnodes.Param))}let X=!e;L&&(X||E.push("$free"),this.u.tempsToSave.push("$free"));this.u.prefixCode=X?this.u.prefixCode+"$posargs,$kwargs":this.u.prefixCode+E.join(",");this.u.prefixCode+="){";e&&(this.u.prefixCode+="\n// generator\n");L&&(this.u.prefixCode+="\n// has free\n");W&&(this.u.prefixCode+="\n// has cell\n");X&&(this.u.prefixCode+="\n// fast call\n"); +var aa="{}";e&&(N="$gen.gi$resumeat",aa="$gen.gi$locals");a=",$cell={}";W&&e&&(a=",$cell=$gen.gi$cells");this.u.varDeclsCode+="var $blk="+N+",$exc=[],$loc="+aa+a+",$gbl="+(X?"this.func_globals":"this")+(X&&L?",$free=this.func_closure":"")+",$err=undefined,$ret=undefined,$postfinally=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 ("+F+".$wakingSuspension!==undefined) { $wakeFromSuspension(); } else {";if(X){this.u.varDeclsCode=u||q||g&&g.kwonlyargs&&0!==g.kwonlyargs.length?this.u.varDeclsCode+"\nvar $args = this.$resolveArgs($posargs,$kwargs)\n":this.u.varDeclsCode+("var $args = ((!$kwargs || $kwargs.length===0) && $posargs.length==="+E.length+") ? $posargs : this.$resolveArgs($posargs,$kwargs)");for(a=0;a<E.length;a++)this.u.varDeclsCode+= +","+E[a]+"=$args["+a+"]";this.u.varDeclsCode+=";\n"}if(e&&0<l.length)for(N=g.args.length-l.length,a=0;a<l.length;++a)E=this.nameop(g.args[a+N].arg,Sk.astnodes.Param),this.u.varDeclsCode+="if("+E+"===undefined)"+E+"="+F+".$defaults["+a+"];";for(a=0;g&&a<g.args.length;++a)E=g.args[a].arg,this.isCell(E)&&(E=c(d(this.u.private_,E).v),this.u.varDeclsCode+="$cell."+E+"="+E+";");for(a=0;g&&g.kwonlyargs&&a<g.kwonlyargs.length;++a)E=g.kwonlyargs[a].arg,this.isCell(E)&&(E=c(d(this.u.private_,E).v),this.u.varDeclsCode+= +"$cell."+E+"="+E+";");q&&this.isCell(q.arg)&&(a=c(d(this.u.private_,q.arg).v),this.u.varDeclsCode+="$cell."+a+"="+a+";");u&&(this.u.localnames.push(u.arg.v),this.u.varDeclsCode+=u.arg.v+"=new Sk.builtins['dict']($kwa);",this.isCell(u.arg)&&(a=c(d(this.u.private_,u.arg).v),this.u.varDeclsCode+="$cell."+a+"="+a+";"));this.u.varDeclsCode+="}";Sk.__future__.python3&&p&&(this.u.varDeclsCode+="$gbl.__class__=$gbl."+p.v+";");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; }} }});";m.call(this,F);if(g){for(let a of g.args)f.push(a.arg.v);for(let a of g.kwonlyargs||[])f.push(a.arg.v);this.u.argnames=f}this.exitScope();0<l.length&&h(F,".$defaults=[", +l.join(","),"];");g&&g.kwonlyargs&&0<g.kwonlyargs.length&&(h(F,".co_argcount=",g.args.length,";"),h(F,".co_kwonlyargcount=",g.kwonlyargs.length,";"),h(F,".$kwdefs=[",n.join(","),"];"));0<f.length?h(F,".co_varnames=['",f.join("','"),"'];"):h(F,".co_varnames=[];");u&&h(F,".co_kwargs=1;");q&&h(F,".co_varargs=1;");e||h(F,".co_fastcall=1;");m="";L&&(m=",$cell",(p=this.u.ste.hasFree)&&(m+=",$free"));if(e)return g&&0<g.args.length?this._gr("gener","new Sk.builtins['function']((function(){var $origargs=Array.prototype.slice.call(arguments);Sk.builtin.pyCheckArgsLen(\"", +b.v,'",arguments.length,',g.args.length-l.length,",",g.args.length,");return new Sk.builtins['generator'](",F,",$gbl,$origargs",m,");}))"):this._gr("gener","new Sk.builtins['function']((function(){Sk.builtin.pyCheckArgsLen(\"",b.v,"\",arguments.length,0,0);return new Sk.builtins['generator'](",F,",$gbl,[]",m,");}))");if(0<k.length){h("$ret = new Sk.builtins['function'](",F,",$gbl",m,");");for(let a of k.reverse())h("$ret = Sk.misceval.callsimOrSuspendArray(",a,",[$ret]);"),this._checkSuspension(); +return this._gr("funcobj","$ret")}return this._gr("funcobj","new Sk.builtins['function'](",F,",$gbl",m,")")};a.prototype.cfunction=function(a,b){Sk.asserts.assert(a instanceof Sk.astnodes.FunctionDef);b=this.buildcodeobj(a,a.name,a.decorator_list,a.args,function(b){this.vseqstmt(a.body);h("return Sk.builtin.none.none$;")},b);this.nameop(a.name,Sk.astnodes.Store,b)};a.prototype.clambda=function(a){Sk.asserts.assert(a instanceof Sk.astnodes.Lambda);return this.buildcodeobj(a,new Sk.builtin.str("<lambda>"), +null,a.args,function(b){b=this.vexpr(a.body);h("return ",b,";")})};a.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);h(d,"=",this.vexpr(a.body),";");this._jump(c);this.setBlock(b);h(d,"=",this.vexpr(a.orelse),";");this._jump(c);this.setBlock(c);return d};a.prototype.cgenexpgen=function(a,b,c){var d=this.newBlock("start for "+b),e=this.newBlock("skip for "+b);this.newBlock("if cleanup for "+ +b);var f=this.newBlock("end for "+b),g=a[b];if(0===b)var k="$loc.$iter0";else{var n=this.vexpr(g.iter);k="$loc."+this.gensym("iter");h(k,"=","Sk.abstr.iter(",n,");")}this._jump(d);this.setBlock(d);this.annotateSource(c);h("$ret = Sk.abstr.iternext(",k,this.u.canSuspend?", true":", false",");");this._checkSuspension(c);n=this._gr("next","$ret");this._jumpundef(n,f);this.vexpr(g.target,n);var m=g.ifs?g.ifs.length:0;for(k=0;k<m;++k)this.annotateSource(g.ifs[k]),n=this.vexpr(g.ifs[k]),this._jumpfalse(n, +d);++b<a.length&&this.cgenexpgen(a,b,c);b>=a.length&&(this.annotateSource(c),a=this.vexpr(c),h("return [",e,"/*resume*/,",a,"/*ret*/];"),this.setBlock(e));this._jump(d);this.setBlock(f);1===b&&h("return Sk.builtin.none.none$;")};a.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.callsimArray(",b,");");h(b,".gi$locals.$iter0=Sk.abstr.iter(",this.vexpr(a.generators[0].iter), +");");return b};a.prototype.cclass=function(a){Sk.asserts.assert(a instanceof Sk.astnodes.ClassDef);var b=this.vseqexpr(a.decorator_list);var c=this.vseqexpr(a.bases);var d=this.enterScope(a.name,a,a.lineno);var e=this.newBlock("class entry");this.u.prefixCode="var "+d+"=(function $"+a.name.v+"$class_outer($globals,$locals,$cell){var $gbl=$globals,$loc=$locals;$free=$globals;";this.u.switchCode+="(function $"+a.name.v+"$_closure($cell){";this.u.switchCode+="var $blk="+e+",$exc=[],$ret=undefined,$postfinally=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+="}).call(null, $cell);});";this.u.private_=a.name;this.cbody(a.body,a.name);h("return;");this.exitScope();h("$ret = Sk.misceval.buildClass($gbl,",d,",",a.name.$r().v,",[",c,"], $cell);");for(let a of b)h("$ret = Sk.misceval.callsimOrSuspendArray(",a,", [$ret]);"),this._checkSuspension();this.nameop(a.name,Sk.astnodes.Store,"$ret")};a.prototype.ccontinue=function(a){var b=this.peekFinallyBlock(); +if(0==this.u.continueBlocks.length)throw new Sk.builtin.SyntaxError("'continue' outside loop",this.filename,a.lineno);a=this.u.continueBlocks[this.u.continueBlocks.length-1];Sk.asserts.assert(this.u.breakBlocks.length===this.u.continueBlocks.length);b&&b.breakDepth==this.u.continueBlocks.length?h("$postfinally={isBreak:true,gotoBlock:",a,"};"):this._jump(a)};a.prototype.cbreak=function(a){var b=this.peekFinallyBlock();if(0===this.u.breakBlocks.length)throw new Sk.builtin.SyntaxError("'break' outside loop", +this.filename,a.lineno);a=this.u.breakBlocks[this.u.breakBlocks.length-1];b&&b.breakDepth==this.u.breakBlocks.length?h("$postfinally={isBreak:true,gotoBlock:",a,"};"):this._jump(a)};a.prototype.vstmt=function(a,b){this.u.lineno=a.lineno;this.u.linenoSet=!1;this.u.localtemps=[];if(Sk.debugging&&this.u.canSuspend){var c=this.newBlock("debug breakpoint for line "+a.lineno);h("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 = "+c+";","$susp.optional = true;","return $susp;","}");this._jump(c);this.setBlock(c);this.u.doesSuspend=!0}this.annotateSource(a);switch(a.constructor){case Sk.astnodes.FunctionDef:this.cfunction(a,b);break;case Sk.astnodes.ClassDef:this.cclass(a);break;case Sk.astnodes.Return:if(this.u.ste.blockType!==Sk.SYMTAB_CONSTS.FunctionBlock)throw new Sk.builtin.SyntaxError("'return' outside function",this.filename,a.lineno);c=a.value?this.vexpr(a.value): +"Sk.builtin.none.none$";0==this.u.finallyBlocks.length?h("return ",c,";"):(h("$postfinally={returning:",c,"};"),this._jump(this.peekFinallyBlock().blk));break;case Sk.astnodes.Delete:this.vseqexpr(a.targets);break;case Sk.astnodes.Assign:var d=a.targets.length;c=this.vexpr(a.value);for(b=0;b<d;++b)this.vexpr(a.targets[b],c);break;case Sk.astnodes.AnnAssign:c=this.vexpr(a.value);this.vexpr(a.target,c);this.vexpr(a.annotation);break;case Sk.astnodes.AugAssign:return this.caugassign(a);case Sk.astnodes.Print:this.cprint(a); +break;case Sk.astnodes.For:return this.cfor(a);case Sk.astnodes.While:return this.cwhile(a);case Sk.astnodes.If:return this.cif(a);case Sk.astnodes.Raise:return this.craise(a);case Sk.astnodes.Try:return this.ctry(a);case Sk.astnodes.With:return this.cwith(a,0);case Sk.astnodes.Assert:return this.cassert(a);case Sk.astnodes.Import:return this.cimport(a);case Sk.astnodes.ImportFrom:return this.cfromimport(a);case Sk.astnodes.Global:break;case Sk.astnodes.Expr:this.vexpr(a.value);break;case Sk.astnodes.Pass:break; +case Sk.astnodes.Break:this.cbreak(a);break;case Sk.astnodes.Continue:this.ccontinue(a);break;case Sk.astnodes.Debugger:h("debugger;");break;default:Sk.asserts.fail("unhandled case in vstmt: "+JSON.stringify(a))}};a.prototype.vseqstmt=function(a){var b;for(b=0;b<a.length;++b)this.vstmt(a[b])};a.prototype.isCell=function(a){a=c(d(this.u.private_,a).v);return this.u.ste.getScope(a)===Sk.SYMTAB_CONSTS.CELL};a.prototype.nameop=function(a,b,e){if((b===Sk.astnodes.Store||b===Sk.astnodes.AugStore||b===Sk.astnodes.Del)&& +"__debug__"===a.v)throw new Sk.builtin.SyntaxError("can not assign to __debug__",this.filename,this.u.lineno);Sk.asserts.assert("None"!==a.v);if("NotImplemented"===a.v)return"Sk.builtin.NotImplemented.NotImplemented$";var f=d(this.u.private_,a).v;f=c(f);var g=3;var k=this.u.ste.getScope(f);var n=null;switch(k){case Sk.SYMTAB_CONSTS.FREE:n="$free";g=2;break;case Sk.SYMTAB_CONSTS.CELL:n="$cell";g=2;break;case Sk.SYMTAB_CONSTS.LOCAL:this.u.ste.blockType!==Sk.SYMTAB_CONSTS.FunctionBlock||this.u.ste.generator|| +(g=0);break;case Sk.SYMTAB_CONSTS.GLOBAL_IMPLICIT:this.u.ste.blockType===Sk.SYMTAB_CONSTS.FunctionBlock&&(g=1);break;case Sk.SYMTAB_CONSTS.GLOBAL_EXPLICIT:g=1}Sk.asserts.assert(k||"_"===a.v.charAt(1));a=f;this.u.ste.generator||this.u.ste.blockType!==Sk.SYMTAB_CONSTS.FunctionBlock?f="$loc."+f:(0===g||3===g)&&this.u.localnames.push(f);switch(g){case 0:switch(b){case Sk.astnodes.Load:case Sk.astnodes.Param:return h("if (",f," === undefined) { throw new Sk.builtin.UnboundLocalError('local variable \\'", +f,"\\' referenced before assignment'); }\n"),f;case Sk.astnodes.Store:h(f,"=",e,";");break;case Sk.astnodes.Del:h("delete ",f,";");break;default:Sk.asserts.fail("unhandled")}break;case 3:switch(b){case Sk.astnodes.Load:return this._gr("loadname",f,"!==undefined?",f,":Sk.misceval.loadname('",a,"',$gbl);");case Sk.astnodes.Store:h(f,"=",e,";");break;case Sk.astnodes.Del:h("delete ",f,";");break;case Sk.astnodes.Param:return f;default:Sk.asserts.fail("unhandled")}break;case 1:switch(b){case Sk.astnodes.Load:return this._gr("loadgbl", +"Sk.misceval.loadname('",a,"',$gbl)");case Sk.astnodes.Store:h("$gbl.",a,"=",e,";");break;case Sk.astnodes.Del:h("delete $gbl.",a);break;default:Sk.asserts.fail("unhandled case in name op_global")}break;case 2:switch(b){case Sk.astnodes.Load:return n+"."+a;case Sk.astnodes.Store:h(n,".",a,"=",e,";");break;case Sk.astnodes.Param:return a;default:Sk.asserts.fail("unhandled case in name op_deref")}break;default:Sk.asserts.fail("unhandled case")}};a.prototype.enterScope=function(a,c,d,e){var f=new b; +f.ste=this.st.getStsForAst(c);f.name=a;f.firstlineno=d;f.canSuspend=e||!1;this.u&&this.u.private_&&(f.private_=this.u.private_);this.stack.push(this.u);this.allUnits.push(f);a=this.gensym("scope");f.scopename=a;this.u=f;this.u.activateScope();this.nestlevel++;return a};a.prototype.exitScope=function(){var a=this.u;this.nestlevel--;(this.u=0<=this.stack.length-1?this.stack.pop():null)&&this.u.activateScope();if("<module>"!==a.name.v){var b=a.name.$r().v;b=b.substring(1,b.length-1);h(a.scopename,".co_name=new Sk.builtins['str']('", +b,"');")}for(var c in a.consts)a.consts.hasOwnProperty(c)&&(a.suffixCode+=c+" = "+a.consts[c]+";")};a.prototype.cbody=function(a,b){var c;for(c=0;c<a.length;++c)this.vstmt(a[c],b)};a.prototype.cprint=function(a){var b;Sk.asserts.assert(a instanceof Sk.astnodes.Print);a.dest&&this.vexpr(a.dest);var c=a.values.length;for(b=0;b<c;++b)h("$ret = Sk.misceval.print_(","new Sk.builtins['str'](",this.vexpr(a.values[b]),").v);"),this._checkSuspension(a);a.nl&&(h("$ret = Sk.misceval.print_(",'"\\n");'),this._checkSuspension(a))}; +a.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($forcegbl){";this.u.varDeclsCode="var $gbl = $forcegbl || {}, $blk="+c+",$exc=[],$loc=$gbl,$cell={},$err=undefined;$loc.__file__=new Sk.builtins.str('"+this.filename+"');var $ret=undefined,$postfinally=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; } if (Sk.globals) { $gbl = Sk.globals; Sk.globals = $gbl; $loc = $gbl; $loc.__file__=new Sk.builtins.str('"+this.filename+"');} 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 Sk.astnodes.Module:this.cbody(a.body); +h("return $loc;");break;default:Sk.asserts.fail("todo; unhandled case in compilerMod")}this.exitScope();this.result.push(this.outputAllUnits());return b};Sk.compile=function(b,c,d,e){d=Sk.__future__;Sk.__future__=Object.create(Sk.__future__);var f=Sk.parse(c,b),g=Sk.astFromParse(f.cst,c,f.flags);f=f.flags;var h=Sk.symboltable(g,c);b=new a(c,h,f,e,b);c=b.cmod(g);Sk.__future__=d;return{funcname:"$compiledmod",code:"$compiledmod = function() {"+b.result.join("")+"\nreturn "+c+";}();"}};Sk.exportSymbol("Sk.compile", +Sk.compile);Sk.resetCompiler=function(){Sk.gensymcount=0};Sk.exportSymbol("Sk.resetCompiler",Sk.resetCompiler);Sk.fixReserved=c;Sk.exportSymbol("Sk.fixReserved",Sk.fixReserved);Sk.unfixReserved=function(a){return a.replace(/_\$rw\$$/,"")};Sk.exportSymbol("Sk.unfixReserved",Sk.unfixReserved);Sk.mangleName=d;Sk.exportSymbol("Sk.mangleName",Sk.mangleName)},function(m,p){Sk.sysmodules=new Sk.builtin.dict([]);Sk.realsyspath=void 0;Sk.importSearchPathForName=function(a,b,c){var d=a.replace(/\./g,"/"),e= +function(a,b){return Sk.misceval.chain(Sk.misceval.tryCatch(function(){return Sk.read(a)},function(a){}),function(c){if(void 0!==c)return new Sk.misceval.Break({filename:a,code:c,packagePath:b})})};void 0===c&&(c=Sk.realsyspath);return Sk.misceval.iterFor(c.tp$iter(),function(a){return Sk.misceval.chain(e(a.v+"/"+d+b,!1),function(c){return c?c:e(a.v+"/"+d+"/__init__"+b,a.v+"/"+d)})})};Sk.doOneTimeInitialization=function(a){Sk.builtin.type.basesStr_=new Sk.builtin.str("__bases__");Sk.builtin.type.mroStr_= +new Sk.builtin.str("__mro__");for(var b in Sk.builtin)if(a=Sk.builtin[b],a instanceof Sk.builtin.type&&void 0===a.sk$abstract){for(var c=a.prototype.tp$base,d=[];void 0!==c;c=c.prototype.tp$base)!c.sk$abstract&&Sk.builtins[c.prototype.tp$name]&&d.push(c);a.tp$mro=new Sk.builtin.tuple([a].concat(d));a.hasOwnProperty("tp$base")||(a.tp$base=d[0]);a.$d=new Sk.builtin.dict([]);a.$d.mp$ass_subscript(Sk.builtin.type.basesStr_,a.tp$base?new Sk.builtin.tuple([a.tp$base]):new Sk.builtin.tuple([]));a.$d.mp$ass_subscript(Sk.builtin.type.mroStr_, +a.tp$mro);a.$d.mp$ass_subscript(new Sk.builtin.str("__name__"),new Sk.builtin.str(a.prototype.tp$name))}b=[Sk.builtin.object,Sk.builtin.type,Sk.builtin.func,Sk.builtin.method];for(a=0;a<b.length;a++){d=b[a];c=d.prototype;for(let a=0;a<d.pythonFunctions.length;a++){const b=d.pythonFunctions[a];if(c[b]instanceof Sk.builtin.func)break;c[b].co_kwargs=null;c[b]=new Sk.builtin.func(c[b])}}for(var e in Sk.internalPy.files)b=e.split(".")[0].split("/")[1],a=Sk.importBuiltinWithBody(b,!1,Sk.internalPy.files[e], +!0),a=Sk.misceval.retryOptionalSuspensionOrThrow(a),Sk.asserts.assert(void 0!==a.$d[b],"Should have imported name "+b),Sk.builtins[b]=a.$d[b],delete Sk.builtins[b].__module__,delete Sk.globals[b]};Sk.importSetUpPath=function(a){var b;if(!Sk.realsyspath){var c=[new Sk.builtin.str("src/builtin"),new Sk.builtin.str("src/lib"),new Sk.builtin.str(".")];for(b=0;b<Sk.syspath.length;++b)c.push(new Sk.builtin.str(Sk.syspath[b]));Sk.realsyspath=new Sk.builtin.list(c);Sk.doOneTimeInitialization(a)}};Sk.importModuleInternal_= +function(a,b,c,d,e,h,g){var f,k,m,l,p=null,u=void 0!==e?e.tp$getattr(Sk.builtin.str.$name):void 0,z=void 0!==u?u.v+".":"",y=void 0!==e?e.tp$getattr(Sk.builtin.str.$path):void 0;Sk.importSetUpPath(g);if(e&&!u){if(h)return;throw new Sk.builtin.ValueError("Attempted to import relative to invalid package (no name)");}void 0===c&&(c=z+a);var t=a.split(".");if(1<t.length){var H=t.slice(0,t.length-1).join(".");p=Sk.importModuleInternal_(H,b,void 0,void 0,e,h,g)}var K=Sk.misceval.chain(p,function(n){p=n; +k=Sk.sysmodules.mp$lookup(c);return void 0!==k?p||k:Sk.misceval.chain(void 0,function(){var b=a;if(1<t.length){if(!p)return;m=Sk.sysmodules.mp$subscript(z+H);b=t[t.length-1];y=m.tp$getattr(Sk.builtin.str.$path)}l=new Sk.builtin.module;if("string"===typeof d){f=a+".py";var c=Sk.compile(d,f,"exec",g)}else c=Sk.misceval.chain(void 0,function(){if(Sk.onBeforeImport&&"function"===typeof Sk.onBeforeImport)return Sk.onBeforeImport(a)},function(c){if(!1===c)throw new Sk.builtin.ImportError("Importing "+a+ +" is not allowed");if("string"===typeof c)throw new Sk.builtin.ImportError(c);return Sk.importSearchPathForName(b,".js",y)},function(a){return a?{funcname:"$builtinmodule",code:a.code,filename:a.filename,packagePath:a.packagePath}:Sk.misceval.chain(Sk.importSearchPathForName(b,".py",y),function(b){if(a=b)return Sk.compile(a.code,a.filename,"exec",g)},function(b){if(b)return b.packagePath=a.packagePath,b})});return c},function(a){if(a){Sk.sysmodules.mp$ass_subscript(c,l);var d=l.$js=a.code;null==f&& +(f=a.filename);null!=Sk.dateSet&&Sk.dateSet||(d="Sk.execStart = Sk.lastYield = new Date();\n"+a.code,Sk.dateSet=!0);if(b){var e=function(a){var b,c=Sk.js_beautify(a).split("\n");for(b=1;b<=c.length;++b){var d=(""+b).length;for(a="";5>d;++d)a+=" ";c[b-1]="/* "+a+b+" */ "+c[b-1]}return c.join("\n")};d=e(d);Sk.debugout(d)}d+="\n"+a.funcname+";";d=Sk.global.eval(d);l.$d={__name__:new Sk.builtin.str(c),__doc__:Sk.builtin.none.none$,__package__:a.packagePath?new Sk.builtin.str(c):H?new Sk.builtin.str(z+ +H):u?u:Sk.builtin.none.none$};a.packagePath&&(l.$d.__path__=new Sk.builtin.tuple([new Sk.builtin.str(a.packagePath)]));return d(l.$d)}},function(b){var c;if(void 0===b){if(h&&!p)return;throw new Sk.builtin.ImportError("No module named "+a);}if(b!==l.$d){for(c in l.$d)b[c]||(b[c]=l.$d[c]);l.$d=b}if(Sk.onAfterImport&&"function"===typeof Sk.onAfterImport)try{Sk.onAfterImport(a)}catch(W){}if(p)return m.tp$setattr(new Sk.builtin.str(t[t.length-1]),l),p;e&&e.tp$setattr(new Sk.builtin.str(a),l);return l})}); +return g?K:Sk.misceval.retryOptionalSuspensionOrThrow(K)};Sk.importModule=function(a,b,c){return Sk.importModuleInternal_(a,b,void 0,void 0,void 0,!1,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,void 0,!1,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,void 0,!1,d)};Sk.importBuiltinWithBody=function(a,b,c,d){return Sk.importModuleInternal_(a,b,"__builtin__."+a,c,void 0,!1,d)};Sk.builtin.__import__=function(a,b,c,d,e){var h=Sk.globals,g;void 0===e&&(e=Sk.__future__.absolute_import?0:-1);if(0!==e&&b.__package__&&b.__package__!==Sk.builtin.none.none$){if((g=b.__package__.v)&&0<e){b=g.split(".");if(e-1>=b.length)throw new Sk.builtin.ValueError("Attempted relative import beyond toplevel package");b.length-= +e-1;g=b.join(".")}var f=Sk.sysmodules.mp$lookup(g)}if(0<e&&void 0===f)throw new Sk.builtin.ValueError("Attempted relative import in non-package");a.split(".");return Sk.misceval.chain(void 0,function(){if(0!==e&&void 0!==f)return""===a?f:Sk.importModuleInternal_(a,void 0,g+"."+a,void 0,f,-1==e,!0)},function(b){return void 0===b?(g=f=void 0,Sk.importModuleInternal_(a,void 0,void 0,void 0,void 0,!1,!0)):b},function(b){if(d&&0!==d.length){var c;var e=Sk.sysmodules.mp$subscript((g||"")+(g&&a?".":"")+ +a);for(b=0;b<d.length;b++){var f=d[b];"*"!=f&&void 0===e.tp$getattr(new Sk.builtin.str(f))&&(c=Sk.misceval.chain(c,Sk.importModuleInternal_.bind(null,f,void 0,void 0,void 0,e,!0,!0)))}return Sk.misceval.chain(c,function(){Sk.asserts.assert(e);return e})}return b},function(a){h!==Sk.globals&&(Sk.globals=h);return a})};Sk.importStar=function(a,b,c){if(c=a.tp$getattr(new Sk.builtin.str("__all__")))for(let d=Sk.abstr.iter(c),e=d.tp$iternext();void 0!==e;e=d.tp$iternext())b[e.v]=Sk.abstr.gattr(a,e);else{c= +Object.getOwnPropertyNames(a.$d);for(let d in c)"_"!=c[d].charAt(0)&&(b[c[d]]=a.$d[c[d]])}};Sk.exportSymbol("Sk.importMain",Sk.importMain);Sk.exportSymbol("Sk.importMainWithBody",Sk.importMainWithBody);Sk.exportSymbol("Sk.importBuiltinWithBody",Sk.importBuiltinWithBody);Sk.exportSymbol("Sk.builtin.__import__",Sk.builtin.__import__);Sk.exportSymbol("Sk.importStar",Sk.importStar)},function(m,p){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;for(c=a.base+b;c<a.base+a.len;c++){var d=a.base;var e=c;for(b=a.getitem(e);d<e;){var h=d+(e-d>>1);this.lt(b,a.getitem(h))?e=h:d=h+1}Sk.asserts.assert(d===e);for(h=c;h>d;h--)a.setitem(h,a.getitem(h- +1));a.setitem(d,b)}};Sk.builtin.timSort.prototype.count_run=function(a){var b;if(1>=a.len){var c=a.len;var d=!1}else if(c=2,this.lt(a.getitem(a.base+1),a.getitem(a.base)))for(d=!0,b=a.base+2;b<a.base+a.len;b++)if(this.lt(a.getitem(b),a.getitem(b-1)))c++;else break;else for(d=!1,b=a.base+2;b<a.base+a.len&&!this.lt(a.getitem(b),a.getitem(b-1));b++)c++;return{run:new Sk.builtin.listSlice(a.list,a.base,c),descending:d}};Sk.builtin.timSort.prototype.sort=function(){var a,b=new Sk.builtin.listSlice(this.list, +0,this.listlength);if(!(2>b.len)){this.merge_init();for(a=this.merge_compute_minrun(b.len);0<b.len;){var c=this.count_run(b);c.descending&&c.run.reverse();if(c.run.len<a){var d=c.run.len;c.run.len=a<b.len?a:b.len;this.binary_sort(c.run,d)}b.advance(c.run.len);this.pending.push(c.run);this.merge_collapse()}Sk.asserts.assert(b.base==this.listlength);this.merge_force_collapse();Sk.asserts.assert(1==this.pending.length);Sk.asserts.assert(0===this.pending[0].base);Sk.asserts.assert(this.pending[0].len== +this.listlength)}};Sk.builtin.timSort.prototype.gallop=function(a,b,c,d){var e;Sk.asserts.assert(0<=c&&c<b.len);var h=this;d=d?function(a,b){return h.le(a,b)}:function(a,b){return h.lt(a,b)};var g=b.base+c;var f=0;var k=1;if(d(b.getitem(g),a)){for(e=b.len-c;k<e;)if(d(b.getitem(g+k),a)){f=k;try{k=(k<<1)+1}catch(n){k=e}}else break;k>e&&(k=e);f+=c;k+=c}else{for(e=c+1;k<e&&!d(b.getitem(g-k),a);){f=k;try{k=(k<<1)+1}catch(n){k=e}}k>e&&(k=e);g=c-f;f=c-k;k=g}Sk.asserts.assert(-1<=f<k<=b.len);for(f+=1;f<k;)c= +f+(k-f>>1),d(b.getitem(b.base+c),a)?f=c+1:k=c;Sk.asserts.assert(f==k);return k};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;Sk.asserts.assert(0<a.len&&0<b.len&&a.base+a.len==b.base);var h=this.min_gallop;var g=a.base;a=a.copyitems();try{if(this.setitem(g,b.popleft()),g++,1!=a.len&&0!==b.len)for(;;){for(d=c=0;;)if(this.lt(b.getitem(b.base),a.getitem(a.base))){this.setitem(g,b.popleft()); +g++;if(0===b.len)return;d++;c=0;if(d>=h)break}else{this.setitem(g,a.popleft());g++;if(1==a.len)return;c++;d=0;if(c>=h)break}for(h+=1;;){this.min_gallop=h-=1<h;c=this.gallop(b.getitem(b.base),a,0,!0);for(e=a.base;e<a.base+c;e++)this.setitem(g,a.getitem(e)),g++;a.advance(c);if(1>=a.len)return;this.setitem(g,b.popleft());g++;if(0===b.len)return;d=this.gallop(a.getitem(a.base),b,0,!1);for(e=b.base;e<b.base+d;e++)this.setitem(g,b.getitem(e)),g++;b.advance(d);if(0===b.len)return;this.setitem(g,a.popleft()); +g++;if(1==a.len)return;if(c<this.MIN_GALLOP&&d<this.MIN_GALLOP)break;h++;this.min_gallop=h}}}finally{Sk.asserts.assert(0<=a.len&&0<=b.len);for(e=b.base;e<b.base+b.len;e++)this.setitem(g,b.getitem(e)),g++;for(e=a.base;e<a.base+a.len;e++)this.setitem(g,a.getitem(e)),g++}};Sk.builtin.timSort.prototype.merge_hi=function(a,b){var c,d,e;Sk.asserts.assert(0<a.len&&0<b.len&&a.base+a.len==b.base);var h=this.min_gallop;var g=b.base+b.len;b=b.copyitems();try{if(g--,this.setitem(g,a.popright()),0!==a.len&&1!= +b.len)for(;;){for(d=c=0;;){var f=a.getitem(a.base+a.len-1);var k=b.getitem(b.base+b.len-1);if(this.lt(k,f)){g--;this.setitem(g,f);a.len--;if(0===a.len)return;c++;d=0;if(c>=h)break}else{g--;this.setitem(g,k);b.len--;if(1==b.len)return;d++;c=0;if(d>=h)break}}for(h+=1;;){this.min_gallop=h-=1<h;k=b.getitem(b.base+b.len-1);var m=this.gallop(k,a,a.len-1,!0);c=a.len-m;for(e=a.base+a.len-1;e>a.base+m-1;e--)g--,this.setitem(g,a.getitem(e));a.len-=c;if(0===a.len)return;g--;this.setitem(g,b.popright());if(1== +b.len)return;f=a.getitem(a.base+a.len-1);m=this.gallop(f,b,b.len-1,!1);d=b.len-m;for(e=b.base+b.len-1;e>b.base+m-1;e--)g--,this.setitem(g,b.getitem(e));b.len-=d;if(1>=b.len)return;g--;this.setitem(g,a.popright());if(0===a.len)return;if(c<this.MIN_GALLOP&&d<this.MIN_GALLOP)break;h++;this.min_gallop=h}}}finally{Sk.asserts.assert(0<=a.len&&0<=b.len);for(e=a.base+a.len-1;e>a.base-1;e--)g--,this.setitem(g,a.getitem(e));for(e=b.base+b.len-1;e>b.base-1;e--)g--,this.setitem(g,b.getitem(e))}};Sk.builtin.timSort.prototype.merge_at= +function(a){0>a&&(a=this.pending.length+a);var b=this.pending[a];var c=this.pending[a+1];Sk.asserts.assert(0<b.len&&0<c.len);Sk.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;Sk.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;Sk.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--};Sk.exportSymbol("Sk.builtin.listSlice",Sk.builtin.listSlice);Sk.exportSymbol("Sk.builtin.timSort", +Sk.builtin.timSort)},function(m,p){Sk.builtin.sorted=function(a,b,c,d){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!==Sk.builtin.none.none$){var e=b===Sk.builtin.none.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.callsimArray(b,[a[0],c[0]])};var h=a.tp$iter();var g=h.tp$iternext();for(a=[];void 0!==g;)a.push([Sk.misceval.callsimArray(c,[g]),g]),g=h.tp$iternext();a=new Sk.builtin.list(a)}else b!==Sk.builtin.none.none$&&void 0!==b&&(e=b),a=new Sk.builtin.list(a);void 0!==e?a.list_sort_(a,e):a.list_sort_(a);d&&a.list_reverse_(a);if(void 0!==c&&c!==Sk.builtin.none.none$){h=a.tp$iter();g=h.tp$iternext();for(a=[];void 0!==g;)a.push(g[1]), +g=h.tp$iternext();a=new Sk.builtin.list(a)}return a}},function(m,p){Sk.builtin.type_is_subtype_base_chain=function(a,b){do{if(a==b)return!0;a=a.tp$base}while(void 0!==a);return b==Sk.builtin.object};Sk.builtin.PyType_IsSubtype=function(a,b){var c=a.tp$mro;if(c){Sk.asserts.assert(c instanceof Sk.builtin.tuple);for(a=0;a<c.v.length;a++)if(c.v[a]==b)return!0;return!1}return Sk.builtin.type_is_subtype_base_chain(a,b)};Sk.builtin.super_=function(a,b){Sk.builtin.pyCheckArgsLen("super",arguments.length, +1);if(!(this instanceof Sk.builtin.super_))return new Sk.builtin.super_(a,b);Sk.misceval.callsimArray(Sk.builtin.super_.__init__,[this,a,b]);return this};Sk.builtin.super_.__init__=new Sk.builtin.func(function(a,b,c){a.obj=c;a.type=b;if(!b.tp$mro)throw new Sk.builtin.TypeError("must be type, not "+Sk.abstr.typeName(b));a.obj_type=b.tp$mro.v[1];if(!c)throw new Sk.builtin.NotImplementedError("unbound super not supported because skulpts implementation of type descriptors aren't brilliant yet, see this question for more information https://stackoverflow.com/a/30190341/117242"); +if(!Sk.builtin.PyType_IsSubtype(a.obj.ob$type,a.type))throw new Sk.builtin.TypeError("super(type, obj): obj must be an instance of subtype of type");return Sk.builtin.none.none$});Sk.abstr.setUpInheritance("super",Sk.builtin.super_,Sk.builtin.object);Sk.builtin.super_.prototype.tp$getattr=function(a,b){var c,d,e=a.$jsstr();var h=this.obj_type;Sk.asserts.assert(void 0!==h,"object has no ob$type!");if(d=this.obj.$d||this.obj.constructor.$d)if(d.mp$lookup?c=d.mp$lookup(a):d.mp$subscript?c=Sk.builtin._tryGetSubscript(d, +a):"object"===typeof d&&(c=d[e]),void 0!==c)return c;c=Sk.builtin.type.typeLookup(h,a);if(void 0!==c&&null!==c&&(a=c.tp$descr_get))return a.call(c,this.obj,this.obj_type,b);if(void 0!==c)return c};Sk.builtin.super_.prototype.$r=function(a){return this.obj?new Sk.builtin.str("<super: <class '"+(this.type?this.type.prototype.tp$name:"NULL")+"'>, <"+Sk.abstr.typeName(this.obj)+" object>>"):new Sk.builtin.str("<super: <class '"+(this.type?this.type.prototype.tp$name:"NULL")+"'>, NULL>")};Sk.builtin.super_.__doc__= +new Sk.builtin.str("super(type, obj) -> bound super object; requires isinstance(obj, type)\nsuper(type) -> unbound super object\nsuper(type, type2) -> bound super object; requires issubclass(type2, type)\nTypical use to call a cooperative superclass method:\nclass C(B):\n def meth(self, arg):\n super(C, self).meth(arg)")},function(m,p){Sk.builtins={range:new Sk.builtin.func(Sk.builtin.range),round:new Sk.builtin.func(Sk.builtin.round),len:new Sk.builtin.func(Sk.builtin.len),min:new Sk.builtin.func(Sk.builtin.min), +max:new Sk.builtin.func(Sk.builtin.max),sum:new Sk.builtin.func(Sk.builtin.sum),abs:new Sk.builtin.func(Sk.builtin.abs),fabs:new Sk.builtin.func(Sk.builtin.fabs),ord:new Sk.builtin.func(Sk.builtin.ord),chr:new Sk.builtin.func(Sk.builtin.chr),hex:new Sk.builtin.func(Sk.builtin.hex),oct:new Sk.builtin.func(Sk.builtin.oct),bin:new Sk.builtin.func(Sk.builtin.bin),dir:new Sk.builtin.func(Sk.builtin.dir),repr:new Sk.builtin.func(Sk.builtin.repr),open:new Sk.builtin.func(Sk.builtin.open),isinstance:new Sk.builtin.func(Sk.builtin.isinstance), +hash:new Sk.builtin.func(Sk.builtin.hash),getattr:new Sk.builtin.func(Sk.builtin.getattr),hasattr:new Sk.builtin.func(Sk.builtin.hasattr),id:new Sk.builtin.func(Sk.builtin.id),reduce:new Sk.builtin.func(Sk.builtin.reduce),sorted:new Sk.builtin.func(Sk.builtin.sorted),any:new Sk.builtin.func(Sk.builtin.any),all:new Sk.builtin.func(Sk.builtin.all),BaseException:Sk.builtin.BaseException,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,LookupError:Sk.builtin.LookupError,UnicodeDecodeError:Sk.builtin.UnicodeDecodeError,UnicodeEncodeError:Sk.builtin.UnicodeEncodeError,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,NegativePowerError:Sk.builtin.NegativePowerError,RuntimeError:Sk.builtin.RuntimeError,StopIteration:Sk.builtin.StopIteration,SyntaxError:Sk.builtin.SyntaxError,float_$rw$:Sk.builtin.float_,int_$rw$:Sk.builtin.int_,bool:Sk.builtin.bool,complex:Sk.builtin.complex,enumerate:Sk.builtin.enumerate,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:new Sk.builtin.func(Sk.builtin.input),raw_input:new Sk.builtin.func(Sk.builtin.raw_input),setattr:new Sk.builtin.func(Sk.builtin.setattr),jseval:Sk.builtin.jseval,jsmillis:Sk.builtin.jsmillis,quit:new Sk.builtin.func(Sk.builtin.quit),exit:new Sk.builtin.func(Sk.builtin.quit),print:Sk.builtin.print,divmod:new Sk.builtin.func(Sk.builtin.divmod), +format:new Sk.builtin.func(Sk.builtin.format),globals:new Sk.builtin.func(Sk.builtin.globals),issubclass:new Sk.builtin.func(Sk.builtin.issubclass),iter:Sk.builtin.iter,bytearray:Sk.builtin.bytearray,callable:Sk.builtin.callable,delattr:Sk.builtin.delattr,eval_$rw$: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,reload:Sk.builtin.reload,reversed:Sk.builtin.reversed, +"super":Sk.builtin.super_,unichr:Sk.builtin.unichr,vars:Sk.builtin.vars,xrange:Sk.builtin.xrange,apply_$rw$:Sk.builtin.apply_,buffer:Sk.builtin.buffer,coerce:Sk.builtin.coerce,intern:Sk.builtin.intern};Sk.setupObjects=function(a){a?(Sk.builtins.filter=Sk.builtin.filter_,Sk.builtins.map=Sk.builtin.map_,Sk.builtins.zip=Sk.builtin.zip_,Sk.builtins.bytes=Sk.builtin.bytes,Sk.builtins.range=new Sk.builtin.func(Sk.builtin.xrange),delete Sk.builtins.xrange,delete Sk.builtins.StandardError,delete Sk.builtins.unicode, +delete Sk.builtins.basestring,delete Sk.builtin.str.prototype.decode,Sk.builtins.bytes=Sk.builtin.bytes,Sk.builtins.ascii=new Sk.builtin.func(Sk.builtin.ascii)):(Sk.builtins.filter=new Sk.builtin.func(Sk.builtin.filter),Sk.builtins.map=new Sk.builtin.func(Sk.builtin.map),Sk.builtins.zip=new Sk.builtin.func(Sk.builtin.zip),Sk.builtins.range=new Sk.builtin.func(Sk.builtin.range),Sk.builtins.xrange=new Sk.builtin.func(Sk.builtin.xrange),Sk.builtins.StandardError=Sk.builtin.Exception,Sk.builtins.unicode= +Sk.builtin.str,Sk.builtins.basestring=Sk.builtin.str,Sk.builtin.str.prototype.decode=Sk.builtin.str.$py2decode,delete Sk.builtins.bytes,delete Sk.builtins.ascii)};Sk.exportSymbol("Sk.setupObjects",Sk.setupObjects);Sk.exportSymbol("Sk.builtins",Sk.builtins)},function(m,p){Sk.builtin.str.$emptystr=new Sk.builtin.str("");Sk.builtin.int_.co_varnames=["number","base"];Sk.builtin.int_.$defaults=[0,Sk.builtin.none.none$];Sk.builtin.lng.co_varnames=["number","base"];Sk.builtin.lng.$defaults=[0,Sk.builtin.none.none$]; +Sk.builtin.sorted.co_varnames=["list","cmp","key","reverse"];Sk.builtin.sorted.$defaults=[Sk.builtin.none.none$,Sk.builtin.none.none$,Sk.builtin.bool.false$];Sk.builtin.dict.$fromkeys.co_name=new Sk.builtin.str("fromkeys");Sk.builtin.dict.prototype.fromkeys=new Sk.builtin.func(Sk.builtin.dict.$fromkeys);Sk.builtin.str.$empty=new Sk.builtin.str("");Sk.builtin.str.$utf8=new Sk.builtin.str("utf-8");Sk.builtin.str.$ascii=new Sk.builtin.str("ascii");Sk.builtin.str.$default_factory=new Sk.builtin.str("default_factory"); +Sk.builtin.str.$imag=new Sk.builtin.str("imag");Sk.builtin.str.$real=new Sk.builtin.str("real");Sk.builtin.str.$abs=new Sk.builtin.str("__abs__");Sk.builtin.str.$bytes=new Sk.builtin.str("__bytes__");Sk.builtin.str.$call=new Sk.builtin.str("__call__");Sk.builtin.str.$cmp=new Sk.builtin.str("__cmp__");Sk.builtin.str.$complex=new Sk.builtin.str("__complex__");Sk.builtin.str.$contains=new Sk.builtin.str("__contains__");Sk.builtin.str.$copy=new Sk.builtin.str("__copy__");Sk.builtin.str.$dict=new Sk.builtin.str("__dict__"); +Sk.builtin.str.$dir=new Sk.builtin.str("__dir__");Sk.builtin.str.$enter=new Sk.builtin.str("__enter__");Sk.builtin.str.$eq=new Sk.builtin.str("__eq__");Sk.builtin.str.$exit=new Sk.builtin.str("__exit__");Sk.builtin.str.$index=new Sk.builtin.str("__index__");Sk.builtin.str.$init=new Sk.builtin.str("__init__");Sk.builtin.str.$int_=new Sk.builtin.str("__int__");Sk.builtin.str.$iter=new Sk.builtin.str("__iter__");Sk.builtin.str.$float_=new Sk.builtin.str("__float__");Sk.builtin.str.$format=new Sk.builtin.str("__format__"); +Sk.builtin.str.$ge=new Sk.builtin.str("__ge__");Sk.builtin.str.$getattr=new Sk.builtin.str("__getattr__");Sk.builtin.str.$getattribute=new Sk.builtin.str("__getattribute__");Sk.builtin.str.$getitem=new Sk.builtin.str("__getitem__");Sk.builtin.str.$gt=new Sk.builtin.str("__gt__");Sk.builtin.str.$le=new Sk.builtin.str("__le__");Sk.builtin.str.$len=new Sk.builtin.str("__len__");Sk.builtin.str.$lt=new Sk.builtin.str("__lt__");Sk.builtin.str.$module=new Sk.builtin.str("__module__");Sk.builtin.str.$name= +new Sk.builtin.str("__name__");Sk.builtin.str.$ne=new Sk.builtin.str("__ne__");Sk.builtin.str.$new=new Sk.builtin.str("__new__");Sk.builtin.str.$next=new Sk.builtin.str("__next__");Sk.builtin.str.$path=new Sk.builtin.str("__path__");Sk.builtin.str.$repr=new Sk.builtin.str("__repr__");Sk.builtin.str.$reversed=new Sk.builtin.str("__reversed__");Sk.builtin.str.$round=new Sk.builtin.str("__round__");Sk.builtin.str.$setattr=new Sk.builtin.str("__setattr__");Sk.builtin.str.$setitem=new Sk.builtin.str("__setitem__"); +Sk.builtin.str.$str=new Sk.builtin.str("__str__");Sk.builtin.str.$trunc=new Sk.builtin.str("__trunc__");Sk.builtin.str.$write=new Sk.builtin.str("write");Sk.misceval.op2method_={Eq:Sk.builtin.str.$eq,NotEq:Sk.builtin.str.$ne,Gt:Sk.builtin.str.$gt,GtE:Sk.builtin.str.$ge,Lt:Sk.builtin.str.$lt,LtE:Sk.builtin.str.$le};m="int_ lng sorted range round len min max sum zip abs fabs ord chr hex oct bin dir repr open isinstance hash getattr hasattr id map filter reduce sorted any all input raw_input setattr quit quit divmod format globals issubclass".split(" "); +for(p=0;p<m.length;p++)Sk.builtin[m[p]].co_name=new Sk.builtin.str(m[p])},function(m,p){Sk.internalPy={files:{"src/classmethod.py":'class classmethod(object):\n "Emulate PyClassMethod_Type() in Objects/funcobject.c"\n\n def __init__(self, f):\n self.f = f\n\n def __get__(self, obj, klass=None):\n if klass is None:\n klass = type(obj)\n def newfunc(*args):\n return self.f(klass, *args)\n return newfunc\n',"src/property.py":'class property(object):\n "Emulate PyProperty_Type() in Objects/descrobject.c"\n\n def __init__(self, fget=None, fset=None, fdel=None, doc=None):\n self.fget = fget\n self.fset = fset\n self.fdel = fdel\n if doc is None and fget is not None:\n if hasattr(fget, \'__doc__\'):\n doc = fget.__doc__\n else:\n doc = None\n self.__doc__ = doc\n\n def __get__(self, obj, objtype=None):\n if obj is None:\n return self\n if self.fget is None:\n raise AttributeError("unreadable attribute")\n return self.fget(obj)\n\n def __set__(self, obj, value):\n if self.fset is None:\n raise AttributeError("can\'t set attribute")\n self.fset(obj, value)\n\n def __delete__(self, obj):\n if self.fdel is None:\n raise AttributeError("can\'t delete attribute")\n self.fdel(obj)\n\n def getter(self, fget):\n return type(self)(fget, self.fset, self.fdel, self.__doc__)\n\n def setter(self, fset):\n return type(self)(self.fget, fset, self.fdel, self.__doc__)\n\n def deleter(self, fdel):\n return type(self)(self.fget, self.fset, fdel, self.__doc__)\n', +"src/staticmethod.py":'class staticmethod(object):\n "Emulate PyStaticMethod_Type() in Objects/funcobject.c"\n\n def __init__(self, f):\n self.f = f\n\n def __get__(self, obj, objtype=None):\n return self.f\n'}}}]);}).call(this || window) + +//# sourceMappingURL=skulpt.min.js.map \ No newline at end of file From a2d6e5bc411422cd0ad3f191f8e6abe022c9ae70 Mon Sep 17 00:00:00 2001 From: Evgeniy Raev <evgeni.raev@dhl.com> Date: Thu, 24 Dec 2020 15:21:14 +0200 Subject: [PATCH 03/14] dirtry vizualization test --- index.html | 9 + script.js | 535 +++++++++++++++++++++++++++++++++++++++++++++++++++++ style.css | 5 + 3 files changed, 549 insertions(+) create mode 100644 index.html create mode 100644 script.js create mode 100644 style.css diff --git a/index.html b/index.html new file mode 100644 index 0000000..f2948b3 --- /dev/null +++ b/index.html @@ -0,0 +1,9 @@ +<html> + <head> + <script src="https://threejs.org/build/three.js"></script> + <script src="./script.js"></script> + <link rel="stylesheet" href="./style.css"> + </head> + <body> + </body> +</html> \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..f1fea87 --- /dev/null +++ b/script.js @@ -0,0 +1,535 @@ +var scene = new THREE.Scene(); +var camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 1000 ); + +var renderer = new THREE.WebGLRenderer(); +renderer.setSize( window.innerWidth, window.innerHeight ); +document.body.appendChild( renderer.domElement ); + +[ + [-60, -39, -335], + [-57, -94, -372], + [-111, -121, -394], + [-113, -149, -401], + [-121, -126, -348], + [-164, -180, -355], + [-185, -155, -319], + [-227, -157, -326], + [-215, -102, -328], + [-249, -102, -354], + [-249, -62, -360], + [-200, -19, -381], + [-231, 23, -402], + [-194, 26, -329], + [-205, 34, -434], + [-168, 70, -336], + [-150, 93, -379], + [-144, 73, -377], + [-130, 73, -357], + [-113, 86, -294], + [-79, 58, -280], + [-61, 66, -239], + [-15, 85, -257], + [-46, 122, -289], + [-48, 140, -256], + [-20, 163, -285], + [-1, 157, -277], + [17, 120, -272], + [48, 144, -363], + [51, 148, -356], + [90, 159, -350], + [107, 113, -381], + [101, 91, -323], + [109, 99, -364], + [136, 46, -430], + [96, 29, -365], + [119, 24, -356], + [100, -3, -320], + [144, 6, -322], + [140, -27, -262], + [140, -20, -321], + [165, 22, -293], + [193, -9, -316], + [244, -56, -364], + [228, -84, -334], + [191, -83, -418], + [186, -70, -427], + [153, -70, -454], + [139, -90, -416], + [108, -44, -416], + [38, -34, -341], + [17, -66, -389], + [-20, -114, -390], + [-25, -60, -401], + [-43, -48, -357], + [-66, -104, -394], + [-26, -111, -359], + [3, -86, -332], + [-11, -92, -364], + [26, -128, -384], + [50, -101, -376], + [95, -116, -322], + [111, -72, -300], + [76, -81, -331], + [50, -112, -356], + [96, -151, -358], + [121, -169, -350], + [94, -125, -297], + [165, -148, -276], + [176, -164, -313], + [162, -164, -340], + [115, -198, -346], + [111, -201, -356], + [79, -186, -353], + [47, -158, -316], + [32, -134, -229], + [21, -126, -298], + [11, -112, -250], + [11, -72, -250], + [10, -59, -214], + [-45, -40, -240], + [-25, -102, -274], + [-32, -135, -259], + [-35, -154, -266], + [-26, -191, -253], + [22, -173, -213], + [-2, -193, -178], + [68, -223, -269], + [68, -230, -276], + [14, -200, -267], + [28, -218, -398], + [-6, -211, -414], + [-8, -188, -438], + [-43, -212, -434], + [-51, -157, -410], + [-103, -209, -369], + [-120, -206, -342], + [-132, -148, -278], + [-123, -209, -270], + [-84, -170, -251], + [-131, -191, -233], + [-96, -215, -240], + [-119, -164, -266], + [-59, -102, -260], + [-126, -103, -240], + [-114, -102, -216], + [-128, -85, -213], + [-118, -64, -239], + [-156, -48, -306], + [-159, 18, -260], + [-109, 8, -280], + [-129, 48, -290], + [-61, 44, -272], + [-109, 48, -280], + [-104, 63, -252], + [-177, 46, -294], + [-208, 62, -231], + [-186, -4, -323], + [-231, 18, -352], + [-208, 68, -230], + [-233, 110, -222], + [-204, 123, -254], + [-237, 135, -302], + [-216, 162, -324], + [-192, 132, -350], + [-208, 164, -376], + [-185, 144, -418], + [-119, 138, -390], + [-107, 168, -362], + [-77, 152, -320], + [-102, 198, -286], + [-89, 174, -243], + [-63, 200, -248], + [-105, 225, -293], + [-106, 171, -324], + [-92, 157, -270], + [-64, 200, -240], + [-32, 186, -289], + [-77, 229, -302], + [-94, 239, -288], + [-93, 224, -276], + [-47, 189, -219], + [-56, 200, -174], + [-8, 185, -222], + [-9, 138, -189], + [7, 95, -185], + [25, 79, -165], + [50, 108, -218], + [29, 82, -198], + [25, 64, -183], + [-11, 94, -228], + [-40, 159, -234], + [-23, 102, -166], + [-48, 136, -125], + [-13, 96, -109], + [-20, 109, -101], + [-24, 120, -120], + [-3, 163, -130], + [-3, 145, -148], + [3, 163, -175], + [13, 209, -210], + [-20, 200, -164], + [-32, 252, -198], + [-82, 239, -234], + [-108, 222, -194], + [-78, 198, -177], + [-109, 229, -196], + [-72, 194, -258], + [-122, 192, -278], + [-102, 159, -282], + [-144, 171, -292], + [-156, 159, -231], + [-113, 178, -189], + [-101, 160, -176], + [-101, 169, -162], + [-124, 153, -102], + [-166, 176, -100], + [-138, 138, -40], + [-143, 100, -69], + [-126, 52, -86], + [-130, 48, -113], + [-139, 41, -143], + [-159, 27, -135], + [-139, 49, -81], + [-163, 23, -120], + [-159, 26, -84], + [-193, 90, -79], + [-184, 81, -59], + [-232, 110, -106], + [-201, 115, -136], + [-230, 96, -168], + [-184, 80, -218], + [-213, 53, -180], + [-192, 56, -168], + [-173, 15, -186], + [-178, 48, -148], + [-163, 14, -123], + [-130, 52, -81], + [-99, 30, -100], + [-115, -14, -108], + [-188, -13, -175], + [-216, -37, -173], + [-190, -90, -170], + [-226, -79, -271], + [-173, -79, -216], + [-223, -94, -302], + [-179, -92, -306], + [-167, -66, -300], + [-159, -40, -289], + [-150, -72, -256], + [-146, -58, -198], + [-133, -52, -191], + [-127, -40, -173], + [-159, -60, -158], + [-130, -41, -117], + [-129, -40, -87], + [-100, -27, -68], + [-119, 19, -39], + [-126, 20, -20], + [-98, 8, 3], + [-115, 20, 56], + [-115, 35, 76], + [-57, 36, 75], + [-98, 29, 79], + [-96, 4, 68], + [-119, -43, 123], + [-168, -37, 120], + [-148, -36, 91], + [-106, -46, 42], + [-103, -20, -4], + [-95, -12, -45], + [-88, -24, -76], + [-75, -29, -64], + [-115, -2, -76], + [-76, -38, -57], + [-108, 2, -62], + [-79, -24, -64], + [-111, -37, -14], + [-115, -47, -22], + [-98, -68, 2], + [-140, -113, 49], + [-181, -171, 6], + [-190, -153, -32], + [-190, -157, -84], + [-159, -184, -130], + [-181, -156, -158], + [-155, -160, -188], + [-181, -149, -211], + [-124, -139, -202], + [-140, -158, -232], + [-76, -168, -161], + [-109, -192, -239], + [-99, -198, -172], + [-108, -211, -146], + [-69, -207, -150], + [-104, -209, -114], + [-30, -176, -143], + [-32, -212, -145], + [-57, -171, -129], + [-129, -62, -110], + [-37, -180, -134], + [-30, -182, -145], + [-51, -191, -122], + [-33, -190, -104], + [-87, -152, -54], + [-26, -165, -36], + [-76, -127, 4], + [-73, -162, 35], + [-46, -110, 48], + [-25, -145, 79], + [-47, -116, 90], + [-61, -130, 133], + [-56, -134, 80], + [-83, -157, 48], + [-66, -165, 41], + [-36, -129, -29], + [-15, -125, -57], + [24, -90, -38], + [-16, -112, -57], + [12, -109, -35], + [21, -155, -47], + [55, -170, -70], + [61, -181, -81], + [54, -159, -148], + [51, -160, -153], + [102, -176, -173], + [43, -176, -188], + [81, -161, -254], + [61, -194, -314], + [77, -191, -372], + [35, -166, -403], + [80, -183, -374], + [94, -175, -367], + [91, -205, -398], + [109, -224, -346], + [94, -199, -350], + [153, -197, -359], + [205, -252, -398], + [210, -249, -414], + [177, -202, -440], + [118, -156, -327], + [143, -162, -295], + [110, -62, -294], + [106, -115, -270], + [71, -135, -243], + [71, -106, -244], + [83, -83, -232], + [62, -106, -196], + [92, -83, -194], + [84, -93, -128], + [89, -94, -88], + [58, -111, -103], + [52, -95, -146], + [77, -162, -138], + [112, -146, -124], + [66, -132, -104], + [67, -128, -43], + [39, -89, -48], + [49, -94, -33], + [73, -101, 29], + [48, -97, 65], + [71, -124, 38], + [118, -137, 24], + [106, -112, -28], + [143, -75, -56], + [126, -72, -56], + [168, -84, -100], + [162, -51, -132], + [209, -82, -158], + [182, -83, -192], + [177, -79, -174], + [250, -118, -222], + [205, -56, -284], + [206, -48, -282], + [204, -32, -240], + [181, -67, -255], + [190, -31, -218], + [177, -28, -192], + [158, -72, -196], + [107, -21, -202], + [95, -25, -208], + [68, -49, -167], + [67, -37, -130], + [80, -44, -162], + [76, 8, -192], + [120, -25, -251], + [162, -41, -194], + [117, -4, -210], + [132, 7, -153], + [142, -37, -205], + [125, 10, -172], + [127, 33, -147], + [153, 50, -139], + [152, 14, -153], + [141, 18, -90], + [160, 44, -98], + [151, 94, -74], + [158, 73, -141], + [143, 91, -143], + [163, 119, -168], + [175, 73, -218], + [167, 125, -239], + [188, 138, -266], + [193, 88, -305], + [238, 154, -326], + [181, 141, -330], + [173, 183, -302], + [158, 118, -220], + [150, 167, -242], + [181, 184, -215], + [151, 216, -210], + [91, 179, -167], + [93, 160, -183], + [147, 237, -226], + [155, 253, -281], + [109, 206, -216], + [171, 224, -317], + [203, 225, -325], + [186, 168, -350], + [210, 167, -321], + [166, 110, -326], + [223, 67, -213], + [225, 85, -282], + [151, 53, -223], + [186, 30, -156], + [193, 43, -182], + [186, 0, -145], + [150, 4, -128], + [132, -7, -139], + [116, -2, -139], + [96, -3, -129], + [101, 27, -61], + [94, 24, -58], + [115, -23, -14], + [123, -12, -7], + [102, -21, 60], + [84, 20, 75], + [52, 11, 91], + [65, 55, 89], + [63, 77, 114], + [49, 134, 88], + [55, 135, 24], + [37, 152, 8], + [27, 89, 0], + [15, 120, -30], + [-21, 120, -22], + [-42, 139, -19], + [-21, 129, 20], + [-90, 152, 32], + [-111, 142, 42], + [-118, 158, 51], + [-111, 96, 74], + [-124, 88, 119], + [-94, 57, 119], + [-84, 84, 133], + [-42, 45, 93], + [-5, 85, 79], + [31, 90, 90], + [53, 91, 99], + [70, 53, 98], + [101, 30, 94], + [96, 20, 87], + [118, -3, 111], + [101, 4, 111], + [100, 11, 164], + [73, -24, 166], + [87, -14, 170], + [46, -25, 164], + [18, 22, 137], + [-8, 15, 144], + [-17, 17, 149], + [-20, -17, 137], + [-67, -34, 184], + [-21, -82, 141], + [-43, -72, 144], + [-65, -150, 157], + [-69, -151, 157], + [-38, -159, 137], + [-2, -157, 113], + [-9, -143, 87], + [25, -133, 74], + [56, -131, 71], + [33, -130, 109], + [89, -100, 88], + [49, -59, 118], + [72, -84, 125], + [24, -79, 153], + [29, -22, 138], + [44, -59, 174], + [40, -44, 209], + [-65, -14, 192], + [-104, 10, 229], + [-93, 70, 252], + [-121, 25, 276], + [-80, 51, 215], + [-61, 82, 209], + [-23, 72, 196], + [-20, 63, 183], + [-23, 72, 176], + [63, 92, 190], + [69, 108, 246], + [59, 64, 186], + [115, 66, 212], + [66, 1, 208], + [80, 20, 239], + [92, 14, 252], + [80, -22, 266], + [93, -12, 293], + [72, -36, 316], + [80, -19, 332], + [79, -64, 399], + [22, -32, 323], + [15, -18, 324], + [-10, -14, 359], + [-12, 0, 393], + [-3, 0, 406], + [49, 30, 423], + [38, -4, 414], + [32, -50, 453], + [-5, -21, 446], + [-10, 4, 430], + [10, 23, 400], + [-29, 54, 370], + [-35, 45, 325], + [-34, 38, 310], + [-42, 34, 277], + [8, 35, 231], + [-39, -26, 244], + [-23, -50, 282], + [-56, -49, 294], + [-5, -44, 233], + [1, -95, 282], + [49, -76, 234], + [49, -114, 288], + [20, -88, 255], + [71, -97, 242], + [69, -94, 223], + [47, -144, 170], + [19, -132, 172], + [48, -128, 142], +].forEach(([x,y,z]) => { + var geometry = new THREE.SphereGeometry(10); + geometry.translate(x, y, z); + var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + var sphere = new THREE.Mesh( geometry, material ); + scene.add( sphere ); +}) + + +camera.position.y = -800; +camera.rotation.x = Math.PI/2; +let r = 800; +let angle = 0; + +var animate = function () { + requestAnimationFrame( animate ); + + angle += 0.02; + + camera.position.y = r * Math.cos(angle) * -1; + camera.position.x = r * Math.sin(angle); + camera.rotation.y = angle; + + renderer.render( scene, camera ); +}; + +animate(); \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..3bcc6ba --- /dev/null +++ b/style.css @@ -0,0 +1,5 @@ +body { margin: 0; } +canvas { + width: 100%; + height: 100% +} \ No newline at end of file From 528a527d762981ff0f8c65d091d25ac376571414 Mon Sep 17 00:00:00 2001 From: Evgeniy Raev <evgeni.raev@dhl.com> Date: Thu, 24 Dec 2020 15:28:18 +0200 Subject: [PATCH 04/14] fixing loading issue --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index f2948b3..369fde2 100644 --- a/index.html +++ b/index.html @@ -1,7 +1,7 @@ <html> <head> <script src="https://threejs.org/build/three.js"></script> - <script src="./script.js"></script> + <script async=false defer=false src="./script.js"></script> <link rel="stylesheet" href="./style.css"> </head> <body> From a97e819fb5e1637c12867f65425d9324deb27317 Mon Sep 17 00:00:00 2001 From: Evgeniy Raev <evgeni.raev@dhl.com> Date: Thu, 24 Dec 2020 15:49:10 +0200 Subject: [PATCH 05/14] correct way of reading the data --- script.js | 534 +++--------------------------------------------------- 1 file changed, 23 insertions(+), 511 deletions(-) diff --git a/script.js b/script.js index f1fea87..170647e 100644 --- a/script.js +++ b/script.js @@ -5,515 +5,29 @@ var renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); document.body.appendChild( renderer.domElement ); -[ - [-60, -39, -335], - [-57, -94, -372], - [-111, -121, -394], - [-113, -149, -401], - [-121, -126, -348], - [-164, -180, -355], - [-185, -155, -319], - [-227, -157, -326], - [-215, -102, -328], - [-249, -102, -354], - [-249, -62, -360], - [-200, -19, -381], - [-231, 23, -402], - [-194, 26, -329], - [-205, 34, -434], - [-168, 70, -336], - [-150, 93, -379], - [-144, 73, -377], - [-130, 73, -357], - [-113, 86, -294], - [-79, 58, -280], - [-61, 66, -239], - [-15, 85, -257], - [-46, 122, -289], - [-48, 140, -256], - [-20, 163, -285], - [-1, 157, -277], - [17, 120, -272], - [48, 144, -363], - [51, 148, -356], - [90, 159, -350], - [107, 113, -381], - [101, 91, -323], - [109, 99, -364], - [136, 46, -430], - [96, 29, -365], - [119, 24, -356], - [100, -3, -320], - [144, 6, -322], - [140, -27, -262], - [140, -20, -321], - [165, 22, -293], - [193, -9, -316], - [244, -56, -364], - [228, -84, -334], - [191, -83, -418], - [186, -70, -427], - [153, -70, -454], - [139, -90, -416], - [108, -44, -416], - [38, -34, -341], - [17, -66, -389], - [-20, -114, -390], - [-25, -60, -401], - [-43, -48, -357], - [-66, -104, -394], - [-26, -111, -359], - [3, -86, -332], - [-11, -92, -364], - [26, -128, -384], - [50, -101, -376], - [95, -116, -322], - [111, -72, -300], - [76, -81, -331], - [50, -112, -356], - [96, -151, -358], - [121, -169, -350], - [94, -125, -297], - [165, -148, -276], - [176, -164, -313], - [162, -164, -340], - [115, -198, -346], - [111, -201, -356], - [79, -186, -353], - [47, -158, -316], - [32, -134, -229], - [21, -126, -298], - [11, -112, -250], - [11, -72, -250], - [10, -59, -214], - [-45, -40, -240], - [-25, -102, -274], - [-32, -135, -259], - [-35, -154, -266], - [-26, -191, -253], - [22, -173, -213], - [-2, -193, -178], - [68, -223, -269], - [68, -230, -276], - [14, -200, -267], - [28, -218, -398], - [-6, -211, -414], - [-8, -188, -438], - [-43, -212, -434], - [-51, -157, -410], - [-103, -209, -369], - [-120, -206, -342], - [-132, -148, -278], - [-123, -209, -270], - [-84, -170, -251], - [-131, -191, -233], - [-96, -215, -240], - [-119, -164, -266], - [-59, -102, -260], - [-126, -103, -240], - [-114, -102, -216], - [-128, -85, -213], - [-118, -64, -239], - [-156, -48, -306], - [-159, 18, -260], - [-109, 8, -280], - [-129, 48, -290], - [-61, 44, -272], - [-109, 48, -280], - [-104, 63, -252], - [-177, 46, -294], - [-208, 62, -231], - [-186, -4, -323], - [-231, 18, -352], - [-208, 68, -230], - [-233, 110, -222], - [-204, 123, -254], - [-237, 135, -302], - [-216, 162, -324], - [-192, 132, -350], - [-208, 164, -376], - [-185, 144, -418], - [-119, 138, -390], - [-107, 168, -362], - [-77, 152, -320], - [-102, 198, -286], - [-89, 174, -243], - [-63, 200, -248], - [-105, 225, -293], - [-106, 171, -324], - [-92, 157, -270], - [-64, 200, -240], - [-32, 186, -289], - [-77, 229, -302], - [-94, 239, -288], - [-93, 224, -276], - [-47, 189, -219], - [-56, 200, -174], - [-8, 185, -222], - [-9, 138, -189], - [7, 95, -185], - [25, 79, -165], - [50, 108, -218], - [29, 82, -198], - [25, 64, -183], - [-11, 94, -228], - [-40, 159, -234], - [-23, 102, -166], - [-48, 136, -125], - [-13, 96, -109], - [-20, 109, -101], - [-24, 120, -120], - [-3, 163, -130], - [-3, 145, -148], - [3, 163, -175], - [13, 209, -210], - [-20, 200, -164], - [-32, 252, -198], - [-82, 239, -234], - [-108, 222, -194], - [-78, 198, -177], - [-109, 229, -196], - [-72, 194, -258], - [-122, 192, -278], - [-102, 159, -282], - [-144, 171, -292], - [-156, 159, -231], - [-113, 178, -189], - [-101, 160, -176], - [-101, 169, -162], - [-124, 153, -102], - [-166, 176, -100], - [-138, 138, -40], - [-143, 100, -69], - [-126, 52, -86], - [-130, 48, -113], - [-139, 41, -143], - [-159, 27, -135], - [-139, 49, -81], - [-163, 23, -120], - [-159, 26, -84], - [-193, 90, -79], - [-184, 81, -59], - [-232, 110, -106], - [-201, 115, -136], - [-230, 96, -168], - [-184, 80, -218], - [-213, 53, -180], - [-192, 56, -168], - [-173, 15, -186], - [-178, 48, -148], - [-163, 14, -123], - [-130, 52, -81], - [-99, 30, -100], - [-115, -14, -108], - [-188, -13, -175], - [-216, -37, -173], - [-190, -90, -170], - [-226, -79, -271], - [-173, -79, -216], - [-223, -94, -302], - [-179, -92, -306], - [-167, -66, -300], - [-159, -40, -289], - [-150, -72, -256], - [-146, -58, -198], - [-133, -52, -191], - [-127, -40, -173], - [-159, -60, -158], - [-130, -41, -117], - [-129, -40, -87], - [-100, -27, -68], - [-119, 19, -39], - [-126, 20, -20], - [-98, 8, 3], - [-115, 20, 56], - [-115, 35, 76], - [-57, 36, 75], - [-98, 29, 79], - [-96, 4, 68], - [-119, -43, 123], - [-168, -37, 120], - [-148, -36, 91], - [-106, -46, 42], - [-103, -20, -4], - [-95, -12, -45], - [-88, -24, -76], - [-75, -29, -64], - [-115, -2, -76], - [-76, -38, -57], - [-108, 2, -62], - [-79, -24, -64], - [-111, -37, -14], - [-115, -47, -22], - [-98, -68, 2], - [-140, -113, 49], - [-181, -171, 6], - [-190, -153, -32], - [-190, -157, -84], - [-159, -184, -130], - [-181, -156, -158], - [-155, -160, -188], - [-181, -149, -211], - [-124, -139, -202], - [-140, -158, -232], - [-76, -168, -161], - [-109, -192, -239], - [-99, -198, -172], - [-108, -211, -146], - [-69, -207, -150], - [-104, -209, -114], - [-30, -176, -143], - [-32, -212, -145], - [-57, -171, -129], - [-129, -62, -110], - [-37, -180, -134], - [-30, -182, -145], - [-51, -191, -122], - [-33, -190, -104], - [-87, -152, -54], - [-26, -165, -36], - [-76, -127, 4], - [-73, -162, 35], - [-46, -110, 48], - [-25, -145, 79], - [-47, -116, 90], - [-61, -130, 133], - [-56, -134, 80], - [-83, -157, 48], - [-66, -165, 41], - [-36, -129, -29], - [-15, -125, -57], - [24, -90, -38], - [-16, -112, -57], - [12, -109, -35], - [21, -155, -47], - [55, -170, -70], - [61, -181, -81], - [54, -159, -148], - [51, -160, -153], - [102, -176, -173], - [43, -176, -188], - [81, -161, -254], - [61, -194, -314], - [77, -191, -372], - [35, -166, -403], - [80, -183, -374], - [94, -175, -367], - [91, -205, -398], - [109, -224, -346], - [94, -199, -350], - [153, -197, -359], - [205, -252, -398], - [210, -249, -414], - [177, -202, -440], - [118, -156, -327], - [143, -162, -295], - [110, -62, -294], - [106, -115, -270], - [71, -135, -243], - [71, -106, -244], - [83, -83, -232], - [62, -106, -196], - [92, -83, -194], - [84, -93, -128], - [89, -94, -88], - [58, -111, -103], - [52, -95, -146], - [77, -162, -138], - [112, -146, -124], - [66, -132, -104], - [67, -128, -43], - [39, -89, -48], - [49, -94, -33], - [73, -101, 29], - [48, -97, 65], - [71, -124, 38], - [118, -137, 24], - [106, -112, -28], - [143, -75, -56], - [126, -72, -56], - [168, -84, -100], - [162, -51, -132], - [209, -82, -158], - [182, -83, -192], - [177, -79, -174], - [250, -118, -222], - [205, -56, -284], - [206, -48, -282], - [204, -32, -240], - [181, -67, -255], - [190, -31, -218], - [177, -28, -192], - [158, -72, -196], - [107, -21, -202], - [95, -25, -208], - [68, -49, -167], - [67, -37, -130], - [80, -44, -162], - [76, 8, -192], - [120, -25, -251], - [162, -41, -194], - [117, -4, -210], - [132, 7, -153], - [142, -37, -205], - [125, 10, -172], - [127, 33, -147], - [153, 50, -139], - [152, 14, -153], - [141, 18, -90], - [160, 44, -98], - [151, 94, -74], - [158, 73, -141], - [143, 91, -143], - [163, 119, -168], - [175, 73, -218], - [167, 125, -239], - [188, 138, -266], - [193, 88, -305], - [238, 154, -326], - [181, 141, -330], - [173, 183, -302], - [158, 118, -220], - [150, 167, -242], - [181, 184, -215], - [151, 216, -210], - [91, 179, -167], - [93, 160, -183], - [147, 237, -226], - [155, 253, -281], - [109, 206, -216], - [171, 224, -317], - [203, 225, -325], - [186, 168, -350], - [210, 167, -321], - [166, 110, -326], - [223, 67, -213], - [225, 85, -282], - [151, 53, -223], - [186, 30, -156], - [193, 43, -182], - [186, 0, -145], - [150, 4, -128], - [132, -7, -139], - [116, -2, -139], - [96, -3, -129], - [101, 27, -61], - [94, 24, -58], - [115, -23, -14], - [123, -12, -7], - [102, -21, 60], - [84, 20, 75], - [52, 11, 91], - [65, 55, 89], - [63, 77, 114], - [49, 134, 88], - [55, 135, 24], - [37, 152, 8], - [27, 89, 0], - [15, 120, -30], - [-21, 120, -22], - [-42, 139, -19], - [-21, 129, 20], - [-90, 152, 32], - [-111, 142, 42], - [-118, 158, 51], - [-111, 96, 74], - [-124, 88, 119], - [-94, 57, 119], - [-84, 84, 133], - [-42, 45, 93], - [-5, 85, 79], - [31, 90, 90], - [53, 91, 99], - [70, 53, 98], - [101, 30, 94], - [96, 20, 87], - [118, -3, 111], - [101, 4, 111], - [100, 11, 164], - [73, -24, 166], - [87, -14, 170], - [46, -25, 164], - [18, 22, 137], - [-8, 15, 144], - [-17, 17, 149], - [-20, -17, 137], - [-67, -34, 184], - [-21, -82, 141], - [-43, -72, 144], - [-65, -150, 157], - [-69, -151, 157], - [-38, -159, 137], - [-2, -157, 113], - [-9, -143, 87], - [25, -133, 74], - [56, -131, 71], - [33, -130, 109], - [89, -100, 88], - [49, -59, 118], - [72, -84, 125], - [24, -79, 153], - [29, -22, 138], - [44, -59, 174], - [40, -44, 209], - [-65, -14, 192], - [-104, 10, 229], - [-93, 70, 252], - [-121, 25, 276], - [-80, 51, 215], - [-61, 82, 209], - [-23, 72, 196], - [-20, 63, 183], - [-23, 72, 176], - [63, 92, 190], - [69, 108, 246], - [59, 64, 186], - [115, 66, 212], - [66, 1, 208], - [80, 20, 239], - [92, 14, 252], - [80, -22, 266], - [93, -12, 293], - [72, -36, 316], - [80, -19, 332], - [79, -64, 399], - [22, -32, 323], - [15, -18, 324], - [-10, -14, 359], - [-12, 0, 393], - [-3, 0, 406], - [49, 30, 423], - [38, -4, 414], - [32, -50, 453], - [-5, -21, 446], - [-10, 4, 430], - [10, 23, 400], - [-29, 54, 370], - [-35, 45, 325], - [-34, 38, 310], - [-42, 34, 277], - [8, 35, 231], - [-39, -26, 244], - [-23, -50, 282], - [-56, -49, 294], - [-5, -44, 233], - [1, -95, 282], - [49, -76, 234], - [49, -114, 288], - [20, -88, 255], - [71, -97, 242], - [69, -94, 223], - [47, -144, 170], - [19, -132, 172], - [48, -128, 142], -].forEach(([x,y,z]) => { - var geometry = new THREE.SphereGeometry(10); - geometry.translate(x, y, z); - var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); - var sphere = new THREE.Mesh( geometry, material ); - scene.add( sphere ); -}) +fetch('./coords.txt') + .then(response => { + return response.text() + }) + .then(t => { + return t.split(/\n|\r/g) + .filter(e => e.length > 0) + .map(el => JSON.parse(el)) + }) + .then(data => { + prepareScere(data); + animate() + }); +var prepareScere = function (data) { + data.forEach(([x, y, z]) => { + var geometry = new THREE.SphereGeometry(10); + geometry.translate(x, y, z); + var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + var sphere = new THREE.Mesh( geometry, material ); + scene.add( sphere ); + }) +} camera.position.y = -800; camera.rotation.x = Math.PI/2; @@ -530,6 +44,4 @@ var animate = function () { camera.rotation.y = angle; renderer.render( scene, camera ); -}; - -animate(); \ No newline at end of file +}; \ No newline at end of file From de52a94475bcf6c28a6c030a046af5bf8ed724b6 Mon Sep 17 00:00:00 2001 From: Jan Krems <jankrems@google.com> Date: Thu, 24 Dec 2020 10:43:00 -0800 Subject: [PATCH 06/14] Let people edit the script --- preview/codemirror.min.css | 5 + preview/codemirror.min.js | 3 + preview/index.html | 81 ++++--- preview/mode/python/python.js | 399 ++++++++++++++++++++++++++++++++++ preview/render.js | 106 +++++++-- 5 files changed, 549 insertions(+), 45 deletions(-) create mode 100644 preview/codemirror.min.css create mode 100644 preview/codemirror.min.js create mode 100644 preview/mode/python/python.js diff --git a/preview/codemirror.min.css b/preview/codemirror.min.css new file mode 100644 index 0000000..944842e --- /dev/null +++ b/preview/codemirror.min.css @@ -0,0 +1,5 @@ +/** + * CodeMirror, copyright (c) by Marijn Haverbeke and others + * Distributed under an MIT license: https://codemirror.net/LICENSE + */ +.CodeMirror{font-family:monospace;height:300px;color:black;direction:ltr}.CodeMirror-lines{padding:4px 0}.CodeMirror pre.CodeMirror-line, .CodeMirror pre.CodeMirror-line-like{padding:0 4px}.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{background-color:transparent}.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;white-space:nowrap}.CodeMirror-guttermarker{color:black}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid black;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0 !important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-fat-cursor-mark{background-color:rgba(20, 255, 20, 0.5);-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite}.cm-animate-fat-cursor{width:auto;border:0;-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite;background-color:#7e7}@-moz-keyframes blink{0%{}50%{background-color:transparent}100%{}}@-webkit-keyframes blink{0%{}50%{background-color:transparent}100%{}}@keyframes blink{0%{}50%{background-color:transparent}100%{}}.CodeMirror-overwrite .CodeMirror-cursor{}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:0;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:blue}.cm-s-default .cm-quote{color:#090}.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-strikethrough{text-decoration:line-through}.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, .cm-s-default .cm-punctuation, .cm-s-default .cm-property, .cm-s-default .cm-operator{}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3, .cm-s-default .cm-type{color:#085}.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-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-s-default .cm-error{color:#f00}.cm-invalidchar{color:#f00}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}.CodeMirror-matchingtag{background:rgba(255,150,0,.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:white}.CodeMirror-scroll{overflow:scroll !important;margin-bottom:-50px;margin-right:-50px;padding-bottom:50px;height:100%;outline:none;position:relative}.CodeMirror-sizer{position:relative;border-right:50px solid transparent}.CodeMirror-vscrollbar,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{position:absolute;z-index:6;display:none;outline: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;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-50px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:none !important;border:none !important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper ::selection{background-color:transparent}.CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre.CodeMirror-line, .CodeMirror pre.CodeMirror-line-like{-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;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}.CodeMirror-wrap pre.CodeMirror-line, .CodeMirror-wrap pre.CodeMirror-line-like{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;padding:0.1px}.CodeMirror-widget{}.CodeMirror-rtl pre{direction:rtl}.CodeMirror-code{outline:none}.CodeMirror-scroll,.CodeMirror-sizer,.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}div.CodeMirror-dragcursors{visibility:visible}.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background-color:#ffa;background-color:rgba(255,255,0,.4)}.cm-force-border{padding-right: .1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:none} diff --git a/preview/codemirror.min.js b/preview/codemirror.min.js new file mode 100644 index 0000000..92468e8 --- /dev/null +++ b/preview/codemirror.min.js @@ -0,0 +1,3 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: https://codemirror.net/LICENSE +var e,t;e=this,t=function(){var e=navigator.userAgent,t=navigator.platform,r=/gecko\/\d/i.test(e),n=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),l=n||i||o,s=l&&(n?document.documentMode||6:+(o||i)[1]),a=!o&&/WebKit\//.test(e),u=a&&/Qt\/\d+\.\d+/.test(e),c=!o&&/Chrome\//.test(e),h=/Opera\//.test(e),f=/Apple Computer/.test(navigator.vendor),d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),p=/PhantomJS/.test(e),g=!o&&/AppleWebKit/.test(e)&&(/Mobile\/\w+/.test(e)||navigator.maxTouchPoints>2),v=/Android/.test(e),m=g||v||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=g||/Mac/.test(t),b=/\bCrOS\b/.test(e),w=/win/i.test(t),x=h&&e.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(h=!1,a=!0);var C=y&&(u||h&&(null==x||x<12.11)),S=r||l&&s>=9;function L(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var k,T=function(e,t){var r=e.className,n=L(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}};function M(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function N(e,t){return M(e).appendChild(t)}function A(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function O(e,t,r,n){var i=A(e,t,r,n);return i.setAttribute("role","presentation"),i}function D(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function W(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function H(e,t){var r=e.className;L(t).test(r)||(e.className+=(r?" ":"")+t)}function F(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!L(r[n]).test(t)&&(t+=" "+r[n]);return t}k=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(e){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var P=function(e){e.select()};function E(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function I(e,t,r){for(var n in t||(t={}),e)!e.hasOwnProperty(n)||!1===r&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function R(e,t,r,n,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=n||0,l=i||0;;){var s=e.indexOf("\t",o);if(s<0||s>=t)return l+(t-o);l+=s-o,l+=r-l%r,o=s+1}}g?P=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:l&&(P=function(e){try{e.select()}catch(e){}});var z=function(){this.id=null,this.f=null,this.time=0,this.handler=E(this.onTimeout,this)};function B(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}z.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},z.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=r)};var G={toString:function(){return"CodeMirror.Pass"}},U={scroll:!1},V={origin:"*mouse"},K={origin:"+move"};function j(e,t,r){for(var n=0,i=0;;){var o=e.indexOf("\t",n);-1==o&&(o=e.length);var l=o-n;if(o==e.length||i+l>=t)return n+Math.min(l,t-i);if(i+=o-n,n=o+1,(i+=r-i%r)>=t)return n}}var X=[""];function Y(e){for(;X.length<=e;)X.push(_(X)+" ");return X[e]}function _(e){return e[e.length-1]}function $(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function q(){}function Z(e,t){var r;return Object.create?r=Object.create(e):(q.prototype=e,r=new q),t&&I(t,r),r}var Q=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function J(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||Q.test(e))}function ee(e,t){return t?!!(t.source.indexOf("\\w")>-1&&J(e))||t.test(e):J(e)}function te(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var re=/[\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 ne(e){return e.charCodeAt(0)>=768&&re.test(e)}function ie(e,t,r){for(;(r<0?t>0:t<e.length)&&ne(e.charAt(t));)t+=r;return t}function oe(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t;var i=(t+r)/2,o=n<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:r;e(o)?r=o:t=o+n}}var le=null;function se(e,t,r){var n;le=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==r?n=i:le=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:le=i)}return null!=n?n:le}var ae=function(){var e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,r=/[LRr]/,n=/[Lb1n]/,i=/[1n]/;function o(e,t,r){this.level=e,this.from=t,this.to=r}return function(l,s){var a="ltr"==s?"L":"R";if(0==l.length||"ltr"==s&&!e.test(l))return!1;for(var u,c=l.length,h=[],f=0;f<c;++f)h.push((u=l.charCodeAt(f))<=247?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(u):1424<=u&&u<=1524?"R":1536<=u&&u<=1785?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(u-1536):1774<=u&&u<=2220?"r":8192<=u&&u<=8203?"w":8204==u?"b":"L");for(var d=0,p=a;d<c;++d){var g=h[d];"m"==g?h[d]=p:p=g}for(var v=0,m=a;v<c;++v){var y=h[v];"1"==y&&"r"==m?h[v]="n":r.test(y)&&(m=y,"r"==y&&(h[v]="R"))}for(var b=1,w=h[0];b<c-1;++b){var x=h[b];"+"==x&&"1"==w&&"1"==h[b+1]?h[b]="1":","!=x||w!=h[b+1]||"1"!=w&&"n"!=w||(h[b]=w),w=x}for(var C=0;C<c;++C){var S=h[C];if(","==S)h[C]="N";else if("%"==S){var L=void 0;for(L=C+1;L<c&&"%"==h[L];++L);for(var k=C&&"!"==h[C-1]||L<c&&"1"==h[L]?"1":"N",T=C;T<L;++T)h[T]=k;C=L-1}}for(var M=0,N=a;M<c;++M){var A=h[M];"L"==N&&"1"==A?h[M]="L":r.test(A)&&(N=A)}for(var O=0;O<c;++O)if(t.test(h[O])){var D=void 0;for(D=O+1;D<c&&t.test(h[D]);++D);for(var W="L"==(O?h[O-1]:a),H=W==("L"==(D<c?h[D]:a))?W?"L":"R":a,F=O;F<D;++F)h[F]=H;O=D-1}for(var P,E=[],I=0;I<c;)if(n.test(h[I])){var R=I;for(++I;I<c&&n.test(h[I]);++I);E.push(new o(0,R,I))}else{var z=I,B=E.length,G="rtl"==s?1:0;for(++I;I<c&&"L"!=h[I];++I);for(var U=z;U<I;)if(i.test(h[U])){z<U&&(E.splice(B,0,new o(1,z,U)),B+=G);var V=U;for(++U;U<I&&i.test(h[U]);++U);E.splice(B,0,new o(2,V,U)),B+=G,z=U}else++U;z<I&&E.splice(B,0,new o(1,z,I))}return"ltr"==s&&(1==E[0].level&&(P=l.match(/^\s+/))&&(E[0].from=P[0].length,E.unshift(new o(0,0,P[0].length))),1==_(E).level&&(P=l.match(/\s+$/))&&(_(E).to-=P[0].length,E.push(new o(0,c-P[0].length,c)))),"rtl"==s?E.reverse():E}}();function ue(e,t){var r=e.order;return null==r&&(r=e.order=ae(e.text,t)),r}var ce=[],he=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||ce).concat(r)}};function fe(e,t){return e._handlers&&e._handlers[t]||ce}function de(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,i=n&&n[t];if(i){var o=B(i,r);o>-1&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function pe(e,t){var r=fe(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function ge(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),pe(e,r||t.type,e,t),xe(t)||t.codemirrorIgnore}function ve(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==B(r,t[n])&&r.push(t[n])}function me(e,t){return fe(e,t).length>0}function ye(e){e.prototype.on=function(e,t){he(this,e,t)},e.prototype.off=function(e,t){de(this,e,t)}}function be(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function we(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function xe(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Ce(e){be(e),we(e)}function Se(e){return e.target||e.srcElement}function Le(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var ke,Te,Me=function(){if(l&&s<9)return!1;var e=A("div");return"draggable"in e||"dragDrop"in e}();function Ne(e){if(null==ke){var t=A("span","");N(e,A("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(ke=t.offsetWidth<=1&&t.offsetHeight>2&&!(l&&s<8))}var r=ke?A("span",""):A("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Ae(e){if(null!=Te)return Te;var t=N(e,document.createTextNode("AخA")),r=k(t,0,1).getBoundingClientRect(),n=k(t,1,2).getBoundingClientRect();return M(e),!(!r||r.left==r.right)&&(Te=n.right-r.right<3)}var Oe,De=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(r.push(o.slice(0,l)),t+=l+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},We=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},He="oncopy"in(Oe=A("div"))||(Oe.setAttribute("oncopy","return;"),"function"==typeof Oe.oncopy),Fe=null,Pe={},Ee={};function Ie(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Pe[e]=t}function Re(e){if("string"==typeof e&&Ee.hasOwnProperty(e))e=Ee[e];else if(e&&"string"==typeof e.name&&Ee.hasOwnProperty(e.name)){var t=Ee[e.name];"string"==typeof t&&(t={name:t}),(e=Z(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Re("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Re("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function ze(e,t){t=Re(t);var r=Pe[t.name];if(!r)return ze(e,"text/plain");var n=r(e,t);if(Be.hasOwnProperty(t.name)){var i=Be[t.name];for(var o in i)i.hasOwnProperty(o)&&(n.hasOwnProperty(o)&&(n["_"+o]=n[o]),n[o]=i[o])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)n[l]=t.modeProps[l];return n}var Be={};function Ge(e,t){I(t,Be.hasOwnProperty(e)?Be[e]:Be[e]={})}function Ue(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function Ve(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode;return r||{mode:e,state:t}}function Ke(e,t,r){return!e.startState||e.startState(t,r)}var je=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};function Xe(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t<o){r=i;break}t-=o}return r.lines[t]}function Ye(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,(function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i})),n}function _e(e,t,r){var n=[];return e.iter(t,r,(function(e){n.push(e.text)})),n}function $e(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function qe(e){if(null==e.parent)return null;for(var t=e.parent,r=B(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function Ze(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(t<o){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var l=0;l<e.lines.length;++l){var s=e.lines[l].height;if(t<s)break;t-=s}return r+l}function Qe(e,t){return t>=e.first&&t<e.first+e.size}function Je(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function et(e,t,r){if(void 0===r&&(r=null),!(this instanceof et))return new et(e,t,r);this.line=e,this.ch=t,this.sticky=r}function tt(e,t){return e.line-t.line||e.ch-t.ch}function rt(e,t){return e.sticky==t.sticky&&0==tt(e,t)}function nt(e){return et(e.line,e.ch)}function it(e,t){return tt(e,t)<0?t:e}function ot(e,t){return tt(e,t)<0?e:t}function lt(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function st(e,t){if(t.line<e.first)return et(e.first,0);var r=e.first+e.size-1;return t.line>r?et(r,Xe(e,r).text.length):function(e,t){var r=e.ch;return null==r||r>t?et(e.line,t):r<0?et(e.line,0):e}(t,Xe(e,t.line).text.length)}function at(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=st(e,t[n]);return r}je.prototype.eol=function(){return this.pos>=this.string.length},je.prototype.sol=function(){return this.pos==this.lineStart},je.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},je.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},je.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},je.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},je.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},je.prototype.skipToEnd=function(){this.pos=this.string.length},je.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},je.prototype.backUp=function(e){this.pos-=e},je.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=R(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?R(this.string,this.lineStart,this.tabSize):0)},je.prototype.indentation=function(){return R(this.string,null,this.tabSize)-(this.lineStart?R(this.string,this.lineStart,this.tabSize):0)},je.prototype.match=function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},je.prototype.current=function(){return this.string.slice(this.start,this.pos)},je.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},je.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},je.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var ut=function(e,t){this.state=e,this.lookAhead=t},ct=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};function ht(e,t,r,n){var i=[e.state.modeGen],o={};wt(e,t.text,e.doc.mode,r,(function(e,t){return i.push(e,t)}),o,n);for(var l=r.state,s=function(n){r.baseTokens=i;var s=e.state.overlays[n],a=1,u=0;r.state=!0,wt(e,t.text,s.mode,r,(function(e,t){for(var r=a;u<e;){var n=i[a];n>e&&i.splice(a,1,e,i[a+1],n),a+=2,u=Math.min(e,n)}if(t)if(s.opaque)i.splice(r,a-r,e,"overlay "+t),a=r+2;else for(;r<a;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"overlay "+t}}),o),r.state=l,r.baseTokens=null,r.baseTokenPos=1},a=0;a<e.state.overlays.length;++a)s(a);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function ft(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=dt(e,qe(t)),i=t.text.length>e.options.maxHighlightLength&&Ue(e.doc.mode,n.state),o=ht(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function dt(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new ct(n,!0,t);var o=function(e,t,r){for(var n,i,o=e.doc,l=r?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;s>l;--s){if(s<=o.first)return o.first;var a=Xe(o,s-1),u=a.stateAfter;if(u&&(!r||s+(u instanceof ut?u.lookAhead:0)<=o.modeFrontier))return s;var c=R(a.text,null,e.options.tabSize);(null==i||n>c)&&(i=s-1,n=c)}return i}(e,t,r),l=o>n.first&&Xe(n,o-1).stateAfter,s=l?ct.fromSaved(n,l,o):new ct(n,Ke(n.mode),o);return n.iter(o,t,(function(r){pt(e,r.text,s);var n=s.line;r.stateAfter=n==t-1||n%5==0||n>=i.viewFrom&&n<i.viewTo?s.save():null,s.nextLine()})),r&&(n.modeFrontier=s.line),s}function pt(e,t,r,n){var i=e.doc.mode,o=new je(t,e.options.tabSize,r);for(o.start=o.pos=n||0,""==t&>(i,r.state);!o.eol();)vt(i,o,r.state),o.start=o.pos}function gt(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var r=Ve(e,t);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function vt(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=Ve(e,r).mode);var o=e.token(t,r);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}ct.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ct.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ct.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ct.fromSaved=function(e,t,r){return t instanceof ut?new ct(e,Ue(e.mode,t.state),r,t.lookAhead):new ct(e,Ue(e.mode,t),r)},ct.prototype.save=function(e){var t=!1!==e?Ue(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ut(t,this.maxLookAhead):t};var mt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function yt(e,t,r,n){var i,o,l=e.doc,s=l.mode,a=Xe(l,(t=st(l,t)).line),u=dt(e,t.line,r),c=new je(a.text,e.options.tabSize,u);for(n&&(o=[]);(n||c.pos<t.ch)&&!c.eol();)c.start=c.pos,i=vt(s,c,u.state),n&&o.push(new mt(c,i,Ue(l.mode,u.state)));return n?o:new mt(c,i,u.state)}function bt(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|\\s)"+r[2]+"(?:$|\\s)").test(t[n])||(t[n]+=" "+r[2])}return e}function wt(e,t,r,n,i,o,l){var s=r.flattenSpans;null==s&&(s=e.options.flattenSpans);var a,u=0,c=null,h=new je(t,e.options.tabSize,n),f=e.options.addModeClass&&[null];for(""==t&&bt(gt(r,n.state),o);!h.eol();){if(h.pos>e.options.maxHighlightLength?(s=!1,l&&pt(e,t,n,h.pos),h.pos=t.length,a=null):a=bt(vt(r,h,n.state,f),o),f){var d=f[0].name;d&&(a="m-"+(a?d+" "+a:d))}if(!s||c!=a){for(;u<h.start;)i(u=Math.min(h.start,u+5e3),c);c=a}h.start=h.pos}for(;u<h.pos;){var p=Math.min(h.pos,u+5e3);i(p,c),u=p}}var xt=!1,Ct=!1;function St(e,t,r){this.marker=e,this.from=t,this.to=r}function Lt(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function kt(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Tt(e,t){if(t.full)return null;var r=Qe(e,t.from.line)&&Xe(e,t.from.line).markedSpans,n=Qe(e,t.to.line)&&Xe(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,l=0==tt(t.from,t.to),s=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker;if(null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==l.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new St(l,o.from,s?null:o.to))}}return n}(r,i,l),a=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker;if(null==o.to||(l.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==l.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new St(l,s?null:o.from-t,null==o.to?null:o.to-t))}}return n}(n,o,l),u=1==t.text.length,c=_(t.text).length+(u?i:0);if(s)for(var h=0;h<s.length;++h){var f=s[h];if(null==f.to){var d=Lt(a,f.marker);d?u&&(f.to=null==d.to?null:d.to+c):f.to=i}}if(a)for(var p=0;p<a.length;++p){var g=a[p];null!=g.to&&(g.to+=c),null==g.from?Lt(s,g.marker)||(g.from=c,u&&(s||(s=[])).push(g)):(g.from+=c,u&&(s||(s=[])).push(g))}s&&(s=Mt(s)),a&&a!=s&&(a=Mt(a));var v=[s];if(!u){var m,y=t.text.length-2;if(y>0&&s)for(var b=0;b<s.length;++b)null==s[b].to&&(m||(m=[])).push(new St(s[b].marker,null,null));for(var w=0;w<y;++w)v.push(m);v.push(a)}return v}function Mt(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&!1!==r.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Nt(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function At(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function Ot(e){return e.inclusiveLeft?-1:0}function Dt(e){return e.inclusiveRight?1:0}function Wt(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=tt(n.from,i.from)||Ot(e)-Ot(t);if(o)return-o;var l=tt(n.to,i.to)||Dt(e)-Dt(t);return l||t.id-e.id}function Ht(e,t){var r,n=Ct&&e.markedSpans;if(n)for(var i=void 0,o=0;o<n.length;++o)(i=n[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!r||Wt(r,i.marker)<0)&&(r=i.marker);return r}function Ft(e){return Ht(e,!0)}function Pt(e){return Ht(e,!1)}function Et(e,t){var r,n=Ct&&e.markedSpans;if(n)for(var i=0;i<n.length;++i){var o=n[i];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!r||Wt(r,o.marker)<0)&&(r=o.marker)}return r}function It(e,t,r,n,i){var o=Xe(e,t),l=Ct&&o.markedSpans;if(l)for(var s=0;s<l.length;++s){var a=l[s];if(a.marker.collapsed){var u=a.marker.find(0),c=tt(u.from,r)||Ot(a.marker)-Ot(i),h=tt(u.to,n)||Dt(a.marker)-Dt(i);if(!(c>=0&&h<=0||c<=0&&h>=0)&&(c<=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?tt(u.to,r)>=0:tt(u.to,r)>0)||c>=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?tt(u.from,n)<=0:tt(u.from,n)<0)))return!0}}}function Rt(e){for(var t;t=Ft(e);)e=t.find(-1,!0).line;return e}function zt(e,t){var r=Xe(e,t),n=Rt(r);return r==n?t:qe(n)}function Bt(e,t){if(t>e.lastLine())return t;var r,n=Xe(e,t);if(!Gt(e,n))return t;for(;r=Pt(n);)n=r.find(1,!0).line;return qe(n)+1}function Gt(e,t){var r=Ct&&t.markedSpans;if(r)for(var n=void 0,i=0;i<r.length;++i)if((n=r[i]).marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&Ut(e,t,n))return!0}}function Ut(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return Ut(e,n.line,Lt(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&Ut(e,t,i))return!0}function Vt(e){for(var t=0,r=(e=Rt(e)).parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;o=(r=o).parent)for(var l=0;l<o.children.length;++l){var s=o.children[l];if(s==r)break;t+=s.height}return t}function Kt(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=Ft(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=Pt(n);){var o=t.find(0,!0);r-=n.text.length-o.from.ch,r+=(n=o.to.line).text.length-o.to.ch}return r}function jt(e){var t=e.display,r=e.doc;t.maxLine=Xe(r,r.first),t.maxLineLength=Kt(t.maxLine),t.maxLineChanged=!0,r.iter((function(e){var r=Kt(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)}))}var Xt=function(e,t,r){this.text=e,At(this,t),this.height=r?r(this):1};function Yt(e){e.parent=null,Nt(e)}Xt.prototype.lineNo=function(){return qe(this)},ye(Xt);var _t={},$t={};function qt(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?$t:_t;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Zt(e,t){var r=O("span",null,null,a?"padding-right: .1px":null),n={pre:O("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,l=void 0;n.pos=0,n.addToken=Jt,Ae(e.display.measure)&&(l=ue(o,e.doc.direction))&&(n.addToken=er(n.addToken,l)),n.map=[],rr(o,n,ft(e,o,t!=e.display.externalMeasured&&qe(o))),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=F(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=F(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Ne(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(a){var s=n.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return pe(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=F(n.pre.className,n.textClass||"")),n}function Qt(e){var t=A("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Jt(e,t,r,n,i,o,a){if(t){var u,c=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),n+=o,r=" "==o}return n}(t,e.trailingSpace):t,h=e.cm.state.specialChars,f=!1;if(h.test(t)){u=document.createDocumentFragment();for(var d=0;;){h.lastIndex=d;var p=h.exec(t),g=p?p.index-d:t.length-d;if(g){var v=document.createTextNode(c.slice(d,d+g));l&&s<9?u.appendChild(A("span",[v])):u.appendChild(v),e.map.push(e.pos,e.pos+g,v),e.col+=g,e.pos+=g}if(!p)break;d+=g+1;var m=void 0;if("\t"==p[0]){var y=e.cm.options.tabSize,b=y-e.col%y;(m=u.appendChild(A("span",Y(b),"cm-tab"))).setAttribute("role","presentation"),m.setAttribute("cm-text","\t"),e.col+=b}else"\r"==p[0]||"\n"==p[0]?((m=u.appendChild(A("span","\r"==p[0]?"␍":"","cm-invalidchar"))).setAttribute("cm-text",p[0]),e.col+=1):((m=e.cm.options.specialCharPlaceholder(p[0])).setAttribute("cm-text",p[0]),l&&s<9?u.appendChild(A("span",[m])):u.appendChild(m),e.col+=1);e.map.push(e.pos,e.pos+1,m),e.pos++}}else e.col+=t.length,u=document.createTextNode(c),e.map.push(e.pos,e.pos+t.length,u),l&&s<9&&(f=!0),e.pos+=t.length;if(e.trailingSpace=32==c.charCodeAt(t.length-1),r||n||i||f||o||a){var w=r||"";n&&(w+=n),i&&(w+=i);var x=A("span",[u],w,o);if(a)for(var C in a)a.hasOwnProperty(C)&&"style"!=C&&"class"!=C&&x.setAttribute(C,a[C]);return e.content.appendChild(x)}e.content.appendChild(u)}}function er(e,t){return function(r,n,i,o,l,s,a){i=i?i+" cm-force-border":"cm-force-border";for(var u=r.pos,c=u+n.length;;){for(var h=void 0,f=0;f<t.length&&!((h=t[f]).to>u&&h.from<=u);f++);if(h.to>=c)return e(r,n,i,o,l,s,a);e(r,n.slice(0,h.to-u),i,o,null,s,a),o=null,n=n.slice(h.to-u),u=h.to}}}function tr(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function rr(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var l,s,a,u,c,h,f,d=i.length,p=0,g=1,v="",m=0;;){if(m==p){a=u=c=s="",f=null,h=null,m=1/0;for(var y=[],b=void 0,w=0;w<n.length;++w){var x=n[w],C=x.marker;if("bookmark"==C.type&&x.from==p&&C.widgetNode)y.push(C);else if(x.from<=p&&(null==x.to||x.to>p||C.collapsed&&x.to==p&&x.from==p)){if(null!=x.to&&x.to!=p&&m>x.to&&(m=x.to,u=""),C.className&&(a+=" "+C.className),C.css&&(s=(s?s+";":"")+C.css),C.startStyle&&x.from==p&&(c+=" "+C.startStyle),C.endStyle&&x.to==m&&(b||(b=[])).push(C.endStyle,x.to),C.title&&((f||(f={})).title=C.title),C.attributes)for(var S in C.attributes)(f||(f={}))[S]=C.attributes[S];C.collapsed&&(!h||Wt(h.marker,C)<0)&&(h=x)}else x.from>p&&m>x.from&&(m=x.from)}if(b)for(var L=0;L<b.length;L+=2)b[L+1]==m&&(u+=" "+b[L]);if(!h||h.from==p)for(var k=0;k<y.length;++k)tr(t,0,y[k]);if(h&&(h.from||0)==p){if(tr(t,(null==h.to?d+1:h.to)-p,h.marker,null==h.from),null==h.to)return;h.to==p&&(h=!1)}}if(p>=d)break;for(var T=Math.min(d,m);;){if(v){var M=p+v.length;if(!h){var N=M>T?v.slice(0,T-p):v;t.addToken(t,N,l?l+a:a,c,p+N.length==m?u:"",s,f)}if(M>=T){v=v.slice(T-p),p=T;break}p=M,c=""}v=i.slice(o,o=r[g++]),l=qt(r[g++],t.cm.options)}}else for(var A=1;A<r.length;A+=2)t.addToken(t,i.slice(o,o=r[A]),qt(r[A+1],t.cm.options))}function nr(e,t,r){this.line=t,this.rest=function(e){for(var t,r;t=Pt(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}(t),this.size=this.rest?qe(_(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Gt(e,t)}function ir(e,t,r){for(var n,i=[],o=t;o<r;o=n){var l=new nr(e.doc,Xe(e.doc,o),o);n=o+l.size,i.push(l)}return i}var or=null,lr=null;function sr(e,t){var r=fe(e,t);if(r.length){var n,i=Array.prototype.slice.call(arguments,2);or?n=or.delayedCallbacks:lr?n=lr:(n=lr=[],setTimeout(ar,0));for(var o=function(e){n.push((function(){return r[e].apply(null,i)}))},l=0;l<r.length;++l)o(l)}}function ar(){var e=lr;lr=null;for(var t=0;t<e.length;++t)e[t]()}function ur(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?fr(e,t):"gutter"==o?pr(e,t,r,n):"class"==o?dr(e,t):"widget"==o&&gr(e,t,n)}t.changes=null}function cr(e){return e.node==e.text&&(e.node=A("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),l&&s<8&&(e.node.style.zIndex=2)),e.node}function hr(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Zt(e,t)}function fr(e,t){var r=t.text.className,n=hr(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,dr(e,t)):r&&(t.text.className=r)}function dr(e,t){!function(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var n=cr(t);t.background=n.insertBefore(A("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?cr(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function pr(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=cr(t);t.gutterBackground=A("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var l=cr(t),s=t.gutter=A("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(s),l.insertBefore(s,t.text),t.line.gutterClass&&(s.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=s.appendChild(A("div",Je(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var a=0;a<e.display.gutterSpecs.length;++a){var u=e.display.gutterSpecs[a].className,c=o.hasOwnProperty(u)&&o[u];c&&s.appendChild(A("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[u]+"px; width: "+n.gutterWidth[u]+"px"))}}}function gr(e,t,r){t.alignable&&(t.alignable=null);for(var n=L("CodeMirror-linewidget"),i=t.node.firstChild,o=void 0;i;i=o)o=i.nextSibling,n.test(i.className)&&t.node.removeChild(i);mr(e,t,r)}function vr(e,t,r,n){var i=hr(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),dr(e,t),pr(e,t,r,n),mr(e,t,n),t.node}function mr(e,t,r){if(yr(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)yr(e,t.rest[n],t,r,!1)}function yr(e,t,r,n,i){if(t.widgets)for(var o=cr(r),l=0,s=t.widgets;l<s.length;++l){var a=s[l],u=A("div",[a.node],"CodeMirror-linewidget"+(a.className?" "+a.className:""));a.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),br(a,u,r,n),e.display.input.setUneditable(u),i&&a.above?o.insertBefore(u,r.gutter||r.text):o.appendChild(u),sr(a,"redraw")}}function br(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function wr(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!D(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),N(t.display.measure,A("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function xr(e,t){for(var r=Se(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function Cr(e){return e.lineSpace.offsetTop}function Sr(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Lr(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=N(e.measure,A("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function kr(e){return 50-e.display.nativeBarWidth}function Tr(e){return e.display.scroller.clientWidth-kr(e)-e.display.barWidth}function Mr(e){return e.display.scroller.clientHeight-kr(e)-e.display.barHeight}function Nr(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var i=0;i<e.rest.length;i++)if(qe(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Ar(e,t,r,n){return Wr(e,Dr(e,t),r,n)}function Or(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[cn(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Dr(e,t){var r=qe(t),n=Or(e,r);n&&!n.text?n=null:n&&n.changes&&(ur(e,n,r,on(e)),e.curOp.forceUpdate=!0),n||(n=function(e,t){var r=qe(t=Rt(t)),n=e.display.externalMeasured=new nr(e.doc,t,r);n.lineN=r;var i=n.built=Zt(e,n);return n.text=i.pre,N(e.display.lineMeasure,i.pre),n}(e,t));var i=Nr(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Wr(e,t,r,n,i){t.before&&(r=-1);var o,a=r+(n||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(function(e,t,r){var n=e.options.lineWrapping,i=n&&Tr(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var l=t.text.firstChild.getClientRects(),s=0;s<l.length-1;s++){var a=l[s],u=l[s+1];Math.abs(a.bottom-u.bottom)>2&&o.push((a.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,r,n){var i,o=Pr(t.map,r,n),a=o.node,u=o.start,c=o.end,h=o.collapse;if(3==a.nodeType){for(var f=0;f<4;f++){for(;u&&ne(t.line.text.charAt(o.coverStart+u));)--u;for(;o.coverStart+c<o.coverEnd&&ne(t.line.text.charAt(o.coverStart+c));)++c;if((i=l&&s<9&&0==u&&c==o.coverEnd-o.coverStart?a.parentNode.getBoundingClientRect():Er(k(a,u,c).getClientRects(),n)).left||i.right||0==u)break;c=u,u-=1,h="right"}l&&s<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=Fe)return Fe;var t=N(e,A("span","x")),r=t.getBoundingClientRect(),n=k(t,0,1).getBoundingClientRect();return Fe=Math.abs(r.left-n.left)>1}(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}(e.display.measure,i))}else{var d;u>0&&(h=n="right"),i=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==n?d.length-1:0]:a.getBoundingClientRect()}if(l&&s<9&&!u&&(!i||!i.left&&!i.right)){var p=a.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+nn(e.display),top:p.top,bottom:p.bottom}:Fr}for(var g=i.top-t.rect.top,v=i.bottom-t.rect.top,m=(g+v)/2,y=t.view.measure.heights,b=0;b<y.length-1&&!(m<y[b]);b++);var w=b?y[b-1]:0,x=y[b],C={left:("right"==h?i.right:i.left)-t.rect.left,right:("left"==h?i.left:i.right)-t.rect.left,top:w,bottom:x};return i.left||i.right||(C.bogus=!0),e.options.singleCursorHeightPerLine||(C.rtop=g,C.rbottom=v),C}(e,t,r,n)).bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var Hr,Fr={left:0,right:0,top:0,bottom:0};function Pr(e,t,r){for(var n,i,o,l,s,a,u=0;u<e.length;u+=3)if(s=e[u],a=e[u+1],t<s?(i=0,o=1,l="left"):t<a?o=1+(i=t-s):(u==e.length-3||t==a&&e[u+3]>t)&&(i=(o=a-s)-1,t>=a&&(l="right")),null!=i){if(n=e[u+2],s==a&&r==(n.insertLeft?"left":"right")&&(l=r),"left"==r&&0==i)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)n=e[2+(u-=3)],l="left";if("right"==r&&i==a-s)for(;u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft;)n=e[(u+=3)+2],l="right";break}return{node:n,start:i,end:o,collapse:l,coverStart:s,coverEnd:a}}function Er(e,t){var r=Fr;if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var i=e.length-1;i>=0&&(r=e[i]).left==r.right;i--);return r}function Ir(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Rr(e){e.display.externalMeasure=null,M(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Ir(e.display.view[t])}function zr(e){Rr(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Br(){return c&&v?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Gr(){return c&&v?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Ur(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=wr(e.widgets[r]));return t}function Vr(e,t,r,n,i){if(!i){var o=Ur(t);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var l=Vt(t);if("local"==n?l+=Cr(e.display):l-=e.display.viewOffset,"page"==n||"window"==n){var s=e.display.lineSpace.getBoundingClientRect();l+=s.top+("window"==n?0:Gr());var a=s.left+("window"==n?0:Br());r.left+=a,r.right+=a}return r.top+=l,r.bottom+=l,r}function Kr(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=Br(),i-=Gr();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var l=e.display.lineSpace.getBoundingClientRect();return{left:n-l.left,top:i-l.top}}function jr(e,t,r,n,i){return n||(n=Xe(e.doc,t.line)),Vr(e,n,Ar(e,n,t.ch,i),r)}function Xr(e,t,r,n,i,o){function l(t,l){var s=Wr(e,i,t,l?"right":"left",o);return l?s.left=s.right:s.right=s.left,Vr(e,n,s,r)}n=n||Xe(e.doc,t.line),i||(i=Dr(e,n));var s=ue(n,e.doc.direction),a=t.ch,u=t.sticky;if(a>=n.text.length?(a=n.text.length,u="before"):a<=0&&(a=0,u="after"),!s)return l("before"==u?a-1:a,"before"==u);function c(e,t,r){return l(r?e-1:e,1==s[t].level!=r)}var h=se(s,a,u),f=le,d=c(a,h,"before"==u);return null!=f&&(d.other=c(a,f,"before"!=u)),d}function Yr(e,t){var r=0;t=st(e.doc,t),e.options.lineWrapping||(r=nn(e.display)*t.ch);var n=Xe(e.doc,t.line),i=Vt(n)+Cr(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function _r(e,t,r,n,i){var o=et(e,t,r);return o.xRel=i,n&&(o.outside=n),o}function $r(e,t,r){var n=e.doc;if((r+=e.display.viewOffset)<0)return _r(n.first,0,null,-1,-1);var i=Ze(n,r),o=n.first+n.size-1;if(i>o)return _r(n.first+n.size-1,Xe(n,o).text.length,null,1,1);t<0&&(t=0);for(var l=Xe(n,i);;){var s=Jr(e,l,i,t,r),a=Et(l,s.ch+(s.xRel>0||s.outside>0?1:0));if(!a)return s;var u=a.find(1);if(u.line==i)return u;l=Xe(n,i=u.line)}}function qr(e,t,r,n){n-=Ur(t);var i=t.text.length,o=oe((function(t){return Wr(e,r,t-1).bottom<=n}),i,0);return{begin:o,end:i=oe((function(t){return Wr(e,r,t).top>n}),o,i)}}function Zr(e,t,r,n){return r||(r=Dr(e,t)),qr(e,t,r,Vr(e,t,Wr(e,r,n),"line").top)}function Qr(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function Jr(e,t,r,n,i){i-=Vt(t);var o=Dr(e,t),l=Ur(t),s=0,a=t.text.length,u=!0,c=ue(t,e.doc.direction);if(c){var h=(e.options.lineWrapping?tn:en)(e,t,r,o,c,n,i);s=(u=1!=h.level)?h.from:h.to-1,a=u?h.to:h.from-1}var f,d,p=null,g=null,v=oe((function(t){var r=Wr(e,o,t);return r.top+=l,r.bottom+=l,!!Qr(r,n,i,!1)&&(r.top<=i&&r.left<=n&&(p=t,g=r),!0)}),s,a),m=!1;if(g){var y=n-g.left<g.right-n,b=y==u;v=p+(b?0:1),d=b?"after":"before",f=y?g.left:g.right}else{u||v!=a&&v!=s||v++,d=0==v?"after":v==t.text.length?"before":Wr(e,o,v-(u?1:0)).bottom+l<=i==u?"after":"before";var w=Xr(e,et(r,v,d),"line",t,o);f=w.left,m=i<w.top?-1:i>=w.bottom?1:0}return _r(r,v=ie(t.text,v,1),d,m,n-f)}function en(e,t,r,n,i,o,l){var s=oe((function(s){var a=i[s],u=1!=a.level;return Qr(Xr(e,et(r,u?a.to:a.from,u?"before":"after"),"line",t,n),o,l,!0)}),0,i.length-1),a=i[s];if(s>0){var u=1!=a.level,c=Xr(e,et(r,u?a.from:a.to,u?"after":"before"),"line",t,n);Qr(c,o,l,!0)&&c.top>l&&(a=i[s-1])}return a}function tn(e,t,r,n,i,o,l){var s=qr(e,t,n,l),a=s.begin,u=s.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,h=null,f=0;f<i.length;f++){var d=i[f];if(!(d.from>=u||d.to<=a)){var p=Wr(e,n,1!=d.level?Math.min(u,d.to)-1:Math.max(a,d.from)).right,g=p<o?o-p+1e9:p-o;(!c||h>g)&&(c=d,h=g)}}return c||(c=i[i.length-1]),c.from<a&&(c={from:a,to:c.to,level:c.level}),c.to>u&&(c={from:c.from,to:u,level:c.level}),c}function rn(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Hr){Hr=A("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Hr.appendChild(document.createTextNode("x")),Hr.appendChild(A("br"));Hr.appendChild(document.createTextNode("x"))}N(e.measure,Hr);var r=Hr.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),M(e.measure),r||1}function nn(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=A("span","xxxxxxxxxx"),r=A("pre",[t],"CodeMirror-line-like");N(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function on(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l){var s=e.display.gutterSpecs[l].className;r[s]=o.offsetLeft+o.clientLeft+i,n[s]=o.clientWidth}return{fixedPos:ln(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function ln(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function sn(e){var t=rn(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/nn(e.display)-3);return function(i){if(Gt(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;l<i.widgets.length;l++)i.widgets[l].height&&(o+=i.widgets[l].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function an(e){var t=e.doc,r=sn(e);t.iter((function(e){var t=r(e);t!=e.height&&$e(e,t)}))}function un(e,t,r,n){var i=e.display;if(!r&&"true"==Se(t).getAttribute("cm-not-content"))return null;var o,l,s=i.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left,l=t.clientY-s.top}catch(e){return null}var a,u=$r(e,o,l);if(n&&u.xRel>0&&(a=Xe(e.doc,u.line).text).length==u.ch){var c=R(a,a.length,e.options.tabSize)-a.length;u=et(u.line,Math.max(0,Math.round((o-Lr(e.display).left)/nn(e.display))-c))}return u}function cn(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if((t-=r[n].size)<0)return n}function hn(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Ct&&zt(e.doc,t)<i.viewTo&&dn(e);else if(r<=i.viewFrom)Ct&&Bt(e.doc,r+n)>i.viewFrom?dn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)dn(e);else if(t<=i.viewFrom){var o=pn(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):dn(e)}else if(r>=i.viewTo){var l=pn(e,t,t,-1);l?(i.view=i.view.slice(0,l.index),i.viewTo=l.lineN):dn(e)}else{var s=pn(e,t,t,-1),a=pn(e,r,r+n,1);s&&a?(i.view=i.view.slice(0,s.index).concat(ir(e,s.lineN,a.lineN)).concat(i.view.slice(a.index)),i.viewTo+=n):dn(e)}var u=i.externalMeasured;u&&(r<u.lineN?u.lineN+=n:t<u.lineN+u.size&&(i.externalMeasured=null))}function fn(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[cn(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==B(l,r)&&l.push(r)}}}function dn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function pn(e,t,r,n){var i,o=cn(e,t),l=e.display.view;if(!Ct||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var s=e.display.viewFrom,a=0;a<o;a++)s+=l[a].size;if(s!=t){if(n>0){if(o==l.length-1)return null;i=s+l[o].size-t,o++}else i=s-t;t+=i,r+=i}for(;zt(e.doc,r)!=r;){if(o==(n<0?0:l.length-1))return null;r+=n*l[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function gn(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function vn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function mn(e,t){void 0===t&&(t=!0);for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),l=0;l<r.sel.ranges.length;l++)if(t||l!=r.sel.primIndex){var s=r.sel.ranges[l];if(!(s.from().line>=e.display.viewTo||s.to().line<e.display.viewFrom)){var a=s.empty();(a||e.options.showCursorWhenSelecting)&&yn(e,s.head,i),a||wn(e,s,o)}}return n}function yn(e,t,r){var n=Xr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(A("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var o=r.appendChild(A("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function bn(e,t){return e.top-t.top||e.left-t.left}function wn(e,t,r){var n=e.display,i=e.doc,o=document.createDocumentFragment(),l=Lr(e.display),s=l.left,a=Math.max(n.sizerWidth,Tr(e)-n.sizer.offsetLeft)-l.right,u="ltr"==i.direction;function c(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),o.appendChild(A("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==r?a-e:r)+"px;\n height: "+(n-t)+"px"))}function h(t,r,n){var o,l,h=Xe(i,t),f=h.text.length;function d(r,n){return jr(e,et(t,r),"div",h,n)}function p(t,r,n){var i=Zr(e,h,null,t),o="ltr"==r==("after"==n)?"left":"right";return d("after"==n?i.begin:i.end-(/\s/.test(h.text.charAt(i.end-1))?2:1),o)[o]}var g=ue(h,i.direction);return function(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var l=e[o];(l.from<r&&l.to>t||t==r&&l.to==t)&&(n(Math.max(l.from,t),Math.min(l.to,r),1==l.level?"rtl":"ltr",o),i=!0)}i||n(t,r,"ltr")}(g,r||0,null==n?f:n,(function(e,t,i,h){var v="ltr"==i,m=d(e,v?"left":"right"),y=d(t-1,v?"right":"left"),b=null==r&&0==e,w=null==n&&t==f,x=0==h,C=!g||h==g.length-1;if(y.top-m.top<=3){var S=(u?w:b)&&C,L=(u?b:w)&&x?s:(v?m:y).left,k=S?a:(v?y:m).right;c(L,m.top,k-L,m.bottom)}else{var T,M,N,A;v?(T=u&&b&&x?s:m.left,M=u?a:p(e,i,"before"),N=u?s:p(t,i,"after"),A=u&&w&&C?a:y.right):(T=u?p(e,i,"before"):s,M=!u&&b&&x?a:m.right,N=!u&&w&&C?s:y.left,A=u?p(t,i,"after"):a),c(T,m.top,M-T,m.bottom),m.bottom<y.top&&c(s,m.bottom,null,y.top),c(N,y.top,A-N,y.bottom)}(!o||bn(m,o)<0)&&(o=m),bn(y,o)<0&&(o=y),(!l||bn(m,l)<0)&&(l=m),bn(y,l)<0&&(l=y)})),{start:o,end:l}}var f=t.from(),d=t.to();if(f.line==d.line)h(f.line,f.ch,d.ch);else{var p=Xe(i,f.line),g=Xe(i,d.line),v=Rt(p)==Rt(g),m=h(f.line,f.ch,v?p.text.length+1:null).end,y=h(d.line,v?0:null,d.ch).start;v&&(m.top<y.top-2?(c(m.right,m.top,null,m.bottom),c(s,y.top,y.left,y.bottom)):c(m.right,m.top,y.left-m.right,m.bottom)),m.bottom<y.top&&c(s,m.bottom,null,y.top)}r.appendChild(o)}function xn(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval((function(){e.hasFocus()||kn(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Cn(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ln(e))}function Sn(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&kn(e))}),100)}function Ln(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(pe(e,"focus",e,t),e.state.focused=!0,H(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),a&&setTimeout((function(){return e.display.input.reset(!0)}),20)),e.display.input.receivedFocus()),xn(e))}function kn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(pe(e,"blur",e,t),e.state.focused=!1,T(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout((function(){e.state.focused||(e.display.shift=!1)}),150))}function Tn(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i=t.view[n],o=e.options.lineWrapping,a=void 0,u=0;if(!i.hidden){if(l&&s<8){var c=i.node.offsetTop+i.node.offsetHeight;a=c-r,r=c}else{var h=i.node.getBoundingClientRect();a=h.bottom-h.top,!o&&i.text.firstChild&&(u=i.text.firstChild.getBoundingClientRect().right-h.left-1)}var f=i.line.height-a;if((f>.005||f<-.005)&&($e(i.line,a),Mn(i.line),i.rest))for(var d=0;d<i.rest.length;d++)Mn(i.rest[d]);if(u>e.display.sizerWidth){var p=Math.ceil(u/nn(e.display));p>e.display.maxLineLength&&(e.display.maxLineLength=p,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function Mn(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function Nn(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-Cr(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=Ze(t,n),l=Ze(t,i);if(r&&r.ensure){var s=r.ensure.from.line,a=r.ensure.to.line;s<o?(o=s,l=Ze(t,Vt(Xe(t,s))+e.wrapper.clientHeight)):Math.min(a,t.lastLine())>=l&&(o=Ze(t,Vt(Xe(t,a))-e.wrapper.clientHeight),l=a)}return{from:o,to:Math.max(l,o+1)}}function An(e,t){var r=e.display,n=rn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:r.scroller.scrollTop,o=Mr(e),l={};t.bottom-t.top>o&&(t.bottom=t.top+o);var s=e.doc.height+Sr(r),a=t.top<n,u=t.bottom>s-n;if(t.top<i)l.scrollTop=a?0:t.top;else if(t.bottom>i+o){var c=Math.min(t.top,(u?s:t.bottom)-o);c!=i&&(l.scrollTop=c)}var h=e.options.fixedGutter?0:r.gutters.offsetWidth,f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft-h,d=Tr(e)-r.gutters.offsetWidth,p=t.right-t.left>d;return p&&(t.right=t.left+d),t.left<10?l.scrollLeft=0:t.left<f?l.scrollLeft=Math.max(0,t.left+h-(p?0:10)):t.right>d+f-3&&(l.scrollLeft=t.right+(p?0:10)-d),l}function On(e,t){null!=t&&(Hn(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Dn(e){Hn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Wn(e,t,r){null==t&&null==r||Hn(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function Hn(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Fn(e,Yr(e,t.from),Yr(e,t.to),t.margin))}function Fn(e,t,r,n){var i=An(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});Wn(e,i.scrollLeft,i.scrollTop)}function Pn(e,t){Math.abs(e.doc.scrollTop-t)<2||(r||ai(e,{top:t}),En(e,t,!0),r&&ai(e),ni(e,100))}function En(e,t,r){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||r)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function In(e,t,r,n){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n||(e.doc.scrollLeft=t,hi(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Rn(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Sr(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+kr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var zn=function(e,t,r){this.cm=r;var n=this.vert=A("div",[A("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=A("div",[A("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=i.tabIndex=-1,e(n),e(i),he(n,"scroll",(function(){n.clientHeight&&t(n.scrollTop,"vertical")})),he(i,"scroll",(function(){i.clientWidth&&t(i.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,l&&s<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};zn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},zn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},zn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},zn.prototype.zeroWidthHack=function(){var e=y&&!d?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new z,this.disableVert=new z},zn.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto",t.set(1e3,(function n(){var i=e.getBoundingClientRect();("vert"==r?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,n)}))},zn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Bn=function(){};function Gn(e,t){t||(t=Rn(e));var r=e.display.barWidth,n=e.display.barHeight;Un(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&Tn(e),Un(e,Rn(e)),r=e.display.barWidth,n=e.display.barHeight}function Un(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}Bn.prototype.update=function(){return{bottom:0,right:0}},Bn.prototype.setScrollLeft=function(){},Bn.prototype.setScrollTop=function(){},Bn.prototype.clear=function(){};var Vn={native:zn,null:Bn};function Kn(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&T(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Vn[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),he(t,"mousedown",(function(){e.state.focused&&setTimeout((function(){return e.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,r){"horizontal"==r?In(e,t):Pn(e,t)}),e),e.display.scrollbars.addClass&&H(e.display.wrapper,e.display.scrollbars.addClass)}var jn=0;function Xn(e){var t;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++jn},t=e.curOp,or?or.ops.push(t):t.ownsGroup=or={ops:[t],delayedCallbacks:[]}}function Yn(e){var t=e.curOp;t&&function(e,t){var r=e.ownsGroup;if(r)try{!function(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}(r)}finally{or=null,t(r)}}(t,(function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;!function(e){for(var t=e.ops,r=0;r<t.length;r++)_n(t[r]);for(var n=0;n<t.length;n++)$n(t[n]);for(var i=0;i<t.length;i++)qn(t[i]);for(var o=0;o<t.length;o++)Zn(t[o]);for(var l=0;l<t.length;l++)Qn(t[l])}(e)}))}function _n(e){var t=e.cm,r=t.display;!function(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=kr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=kr(e)+"px",t.scrollbarsClipped=!0)}(t),e.updateMaxLine&&jt(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new oi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function $n(e){e.updatedDisplay=e.mustUpdate&&li(e.cm,e.update)}function qn(e){var t=e.cm,r=t.display;e.updatedDisplay&&Tn(t),e.barMeasure=Rn(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ar(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+kr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Tr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Zn(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&In(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==W();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Gn(t,e.barMeasure),e.updatedDisplay&&ci(t,e.barMeasure),e.selectionChanged&&xn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&Cn(e.cm)}function Qn(e){var t=e.cm,r=t.display,n=t.doc;e.updatedDisplay&&si(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=e.scrollTop&&En(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&In(t,e.scrollLeft,!0,!0),e.scrollToPos&&function(e,t){if(!ge(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=A("div","",null,"position: absolute;\n top: "+(t.top-r.viewOffset-Cr(e.display))+"px;\n height: "+(t.bottom-t.top+kr(e)+r.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,function(e,t,r,n){var i;null==n&&(n=0),e.options.lineWrapping||t!=r||(r="before"==(t=t.ch?et(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?et(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var l=!1,s=Xr(e,t),a=r&&r!=t?Xr(e,r):s,u=An(e,i={left:Math.min(s.left,a.left),top:Math.min(s.top,a.top)-n,right:Math.max(s.left,a.left),bottom:Math.max(s.bottom,a.bottom)+n}),c=e.doc.scrollTop,h=e.doc.scrollLeft;if(null!=u.scrollTop&&(Pn(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(l=!0)),null!=u.scrollLeft&&(In(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-h)>1&&(l=!0)),!l)break}return i}(t,st(n,e.scrollToPos.from),st(n,e.scrollToPos.to),e.scrollToPos.margin));var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var l=0;l<i.length;++l)i[l].lines.length||pe(i[l],"hide");if(o)for(var s=0;s<o.length;++s)o[s].lines.length&&pe(o[s],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&pe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Jn(e,t){if(e.curOp)return t();Xn(e);try{return t()}finally{Yn(e)}}function ei(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Xn(e);try{return t.apply(e,arguments)}finally{Yn(e)}}}function ti(e){return function(){if(this.curOp)return e.apply(this,arguments);Xn(this);try{return e.apply(this,arguments)}finally{Yn(this)}}}function ri(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Xn(t);try{return e.apply(this,arguments)}finally{Yn(t)}}}function ni(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,E(ii,e))}function ii(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=dt(e,t.highlightFrontier),i=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(o){if(n.line>=e.display.viewFrom){var l=o.styles,s=o.text.length>e.options.maxHighlightLength?Ue(t.mode,n.state):null,a=ht(e,o,n,!0);s&&(n.state=s),o.styles=a.styles;var u=o.styleClasses,c=a.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var h=!l||l.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),f=0;!h&&f<l.length;++f)h=l[f]!=o.styles[f];h&&i.push(n.line),o.stateAfter=n.save(),n.nextLine()}else o.text.length<=e.options.maxHighlightLength&&pt(e,o.text,n),o.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>r)return ni(e,e.options.workDelay),!0})),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),i.length&&Jn(e,(function(){for(var t=0;t<i.length;t++)fn(e,i[t],"text")}))}}var oi=function(e,t,r){var n=e.display;this.viewport=t,this.visible=Nn(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Tr(e),this.force=r,this.dims=on(e),this.events=[]};function li(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return dn(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==gn(e))return!1;fi(e)&&(dn(e),t.dims=on(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>l&&r.viewTo-l<20&&(l=Math.min(i,r.viewTo)),Ct&&(o=zt(e.doc,o),l=Bt(e.doc,l));var s=o!=r.viewFrom||l!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;!function(e,t,r){var n=e.display;0==n.view.length||t>=n.viewTo||r<=n.viewFrom?(n.view=ir(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=ir(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(cn(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(ir(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,cn(e,r)))),n.viewTo=r}(e,o,l),r.viewOffset=Vt(Xe(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var u=gn(e);if(!s&&0==u&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var c=function(e){if(e.hasFocus())return null;var t=W();if(!t||!D(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&D(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}(e);return u>4&&(r.lineDiv.style.display="none"),function(e,t,r){var n=e.display,i=e.options.lineNumbers,o=n.lineDiv,l=o.firstChild;function s(t){var r=t.nextSibling;return a&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var u=n.view,c=n.viewFrom,h=0;h<u.length;h++){var f=u[h];if(f.hidden);else if(f.node&&f.node.parentNode==o){for(;l!=f.node;)l=s(l);var d=i&&null!=t&&t<=c&&f.lineNumber;f.changes&&(B(f.changes,"gutter")>-1&&(d=!1),ur(e,f,c,r)),d&&(M(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(Je(e.options,c)))),l=f.node.nextSibling}else{var p=vr(e,f,c,r);o.insertBefore(p,l)}c+=f.size}for(;l;)l=s(l)}(e,r.updateLineNumbers,t.dims),u>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,function(e){if(e&&e.activeElt&&e.activeElt!=W()&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&D(document.body,e.anchorNode)&&D(document.body,e.focusNode))){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}(c),M(r.cursorDiv),M(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,s&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,ni(e,400)),r.updateLineNumbers=null,!0}function si(e,t){for(var r=t.viewport,n=!0;;n=!1){if(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Tr(e))n&&(t.visible=Nn(e.display,e.doc,r));else if(r&&null!=r.top&&(r={top:Math.min(e.doc.height+Sr(e.display)-Mr(e),r.top)}),t.visible=Nn(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!li(e,t))break;Tn(e);var i=Rn(e);vn(e),Gn(e,i),ci(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ai(e,t){var r=new oi(e,t);if(li(e,r)){Tn(e),si(e,r);var n=Rn(e);vn(e),Gn(e,n),ci(e,n),r.finish()}}function ui(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ci(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+kr(e)+"px"}function hi(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=ln(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",l=0;l<r.length;l++)if(!r[l].hidden){e.options.fixedGutter&&(r[l].gutter&&(r[l].gutter.style.left=o),r[l].gutterBackground&&(r[l].gutterBackground.style.left=o));var s=r[l].alignable;if(s)for(var a=0;a<s.length;a++)s[a].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function fi(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=Je(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(A("div",[A("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,l=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-l)+1,n.lineNumWidth=n.lineNumInnerWidth+l,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",ui(e.display),!0}return!1}function di(e,t){for(var r=[],n=!1,i=0;i<e.length;i++){var o=e[i],l=null;if("string"!=typeof o&&(l=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!t)continue;n=!0}r.push({className:o,style:l})}return t&&!n&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function pi(e){var t=e.gutters,r=e.gutterSpecs;M(t),e.lineGutter=null;for(var n=0;n<r.length;++n){var i=r[n],o=i.className,l=i.style,s=t.appendChild(A("div",null,"CodeMirror-gutter "+o));l&&(s.style.cssText=l),"CodeMirror-linenumbers"==o&&(e.lineGutter=s,s.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",ui(e)}function gi(e){pi(e.display),hn(e),hi(e)}function vi(e,t,n,i){var o=this;this.input=n,o.scrollbarFiller=A("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=A("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=O("div",null,"CodeMirror-code"),o.selectionDiv=A("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=A("div",null,"CodeMirror-cursors"),o.measure=A("div",null,"CodeMirror-measure"),o.lineMeasure=A("div",null,"CodeMirror-measure"),o.lineSpace=O("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var u=O("div",[o.lineSpace],"CodeMirror-lines");o.mover=A("div",[u],null,"position: relative"),o.sizer=A("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=A("div",null,null,"position: absolute; height: 50px; width: 1px;"),o.gutters=A("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=A("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=A("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),l&&s<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),a||r&&m||(o.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(o.wrapper):e(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=di(i.gutters,i.lineNumbers),pi(o),n.init(o)}oi.prototype.signal=function(e,t){me(e,t)&&this.events.push(arguments)},oi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)pe.apply(null,this.events[e])};var mi=0,yi=null;function bi(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}}function wi(e){var t=bi(e);return t.x*=yi,t.y*=yi,t}function xi(e,t){var n=bi(t),i=n.x,o=n.y,l=e.display,s=l.scroller,u=s.scrollWidth>s.clientWidth,c=s.scrollHeight>s.clientHeight;if(i&&u||o&&c){if(o&&y&&a)e:for(var f=t.target,d=l.view;f!=s;f=f.parentNode)for(var p=0;p<d.length;p++)if(d[p].node==f){e.display.currentWheelTarget=f;break e}if(i&&!r&&!h&&null!=yi)return o&&c&&Pn(e,Math.max(0,s.scrollTop+o*yi)),In(e,Math.max(0,s.scrollLeft+i*yi)),(!o||o&&c)&&be(t),void(l.wheelStartX=null);if(o&&null!=yi){var g=o*yi,v=e.doc.scrollTop,m=v+l.wrapper.clientHeight;g<0?v=Math.max(0,v+g-50):m=Math.min(e.doc.height,m+g+50),ai(e,{top:v,bottom:m})}mi<20&&(null==l.wheelStartX?(l.wheelStartX=s.scrollLeft,l.wheelStartY=s.scrollTop,l.wheelDX=i,l.wheelDY=o,setTimeout((function(){if(null!=l.wheelStartX){var e=s.scrollLeft-l.wheelStartX,t=s.scrollTop-l.wheelStartY,r=t&&l.wheelDY&&t/l.wheelDY||e&&l.wheelDX&&e/l.wheelDX;l.wheelStartX=l.wheelStartY=null,r&&(yi=(yi*mi+r)/(mi+1),++mi)}}),200)):(l.wheelDX+=i,l.wheelDY+=o))}}l?yi=-.53:r?yi=15:c?yi=-.7:f&&(yi=-1/3);var Ci=function(e,t){this.ranges=e,this.primIndex=t};Ci.prototype.primary=function(){return this.ranges[this.primIndex]},Ci.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t];if(!rt(r.anchor,n.anchor)||!rt(r.head,n.head))return!1}return!0},Ci.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Si(nt(this.ranges[t].anchor),nt(this.ranges[t].head));return new Ci(e,this.primIndex)},Ci.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Ci.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(tt(t,n.from())>=0&&tt(e,n.to())<=0)return r}return-1};var Si=function(e,t){this.anchor=e,this.head=t};function Li(e,t,r){var n=e&&e.options.selectionsMayTouch,i=t[r];t.sort((function(e,t){return tt(e.from(),t.from())})),r=B(t,i);for(var o=1;o<t.length;o++){var l=t[o],s=t[o-1],a=tt(s.to(),l.from());if(n&&!l.empty()?a>0:a>=0){var u=ot(s.from(),l.from()),c=it(s.to(),l.to()),h=s.empty()?l.from()==l.head:s.from()==s.head;o<=r&&--r,t.splice(--o,2,new Si(h?c:u,h?u:c))}}return new Ci(t,r)}function ki(e,t){return new Ci([new Si(e,t||e)],0)}function Ti(e){return e.text?et(e.from.line+e.text.length-1,_(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Mi(e,t){if(tt(e,t.from)<0)return e;if(tt(e,t.to)<=0)return Ti(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Ti(t).ch-t.to.ch),et(r,n)}function Ni(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new Si(Mi(i.anchor,t),Mi(i.head,t)))}return Li(e.cm,r,e.sel.primIndex)}function Ai(e,t,r){return e.line==t.line?et(r.line,e.ch-t.ch+r.ch):et(r.line+(e.line-t.line),e.ch)}function Oi(e){e.doc.mode=ze(e.options,e.doc.modeOption),Di(e)}function Di(e){e.doc.iter((function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)})),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,ni(e,100),e.state.modeGen++,e.curOp&&hn(e)}function Wi(e,t){return 0==t.from.ch&&0==t.to.ch&&""==_(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Hi(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){!function(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Nt(e),At(e,r);var i=n?n(e):1;i!=e.height&&$e(e,i)}(e,r,i,n),sr(e,"change",e,t)}function l(e,t){for(var r=[],o=e;o<t;++o)r.push(new Xt(u[o],i(o),n));return r}var s=t.from,a=t.to,u=t.text,c=Xe(e,s.line),h=Xe(e,a.line),f=_(u),d=i(u.length-1),p=a.line-s.line;if(t.full)e.insert(0,l(0,u.length)),e.remove(u.length,e.size-u.length);else if(Wi(e,t)){var g=l(0,u.length-1);o(h,h.text,d),p&&e.remove(s.line,p),g.length&&e.insert(s.line,g)}else if(c==h)if(1==u.length)o(c,c.text.slice(0,s.ch)+f+c.text.slice(a.ch),d);else{var v=l(1,u.length-1);v.push(new Xt(f+c.text.slice(a.ch),d,n)),o(c,c.text.slice(0,s.ch)+u[0],i(0)),e.insert(s.line+1,v)}else if(1==u.length)o(c,c.text.slice(0,s.ch)+u[0]+h.text.slice(a.ch),i(0)),e.remove(s.line+1,p);else{o(c,c.text.slice(0,s.ch)+u[0],i(0)),o(h,f+h.text.slice(a.ch),d);var m=l(1,u.length-1);p>1&&e.remove(s.line+1,p-1),e.insert(s.line+1,m)}sr(e,"change",e,t)}function Fi(e,t,r){!function e(n,i,o){if(n.linked)for(var l=0;l<n.linked.length;++l){var s=n.linked[l];if(s.doc!=i){var a=o&&s.sharedHist;r&&!a||(t(s.doc,a),e(s.doc,n,a))}}}(e,null,!0)}function Pi(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,an(e),Oi(e),Ei(e),e.options.lineWrapping||jt(e),e.options.mode=t.modeOption,hn(e)}function Ei(e){("rtl"==e.doc.direction?H:T)(e.display.lineDiv,"CodeMirror-rtl")}function Ii(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ri(e,t){var r={from:nt(t.from),to:Ti(t),text:Ye(e,t.from,t.to)};return Vi(e,r,t.from.line,t.to.line+1),Fi(e,(function(e){return Vi(e,r,t.from.line,t.to.line+1)}),!0),r}function zi(e){for(;e.length&&_(e).ranges;)e.pop()}function Bi(e,t,r,n){var i=e.history;i.undone.length=0;var o,l,s=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>s-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=function(e,t){return t?(zi(e.done),_(e.done)):e.done.length&&!_(e.done).ranges?_(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),_(e.done)):void 0}(i,i.lastOp==n)))l=_(o.changes),0==tt(t.from,t.to)&&0==tt(t.from,l.to)?l.to=Ti(t):o.changes.push(Ri(e,t));else{var a=_(i.done);for(a&&a.ranges||Ui(e.sel,i.done),o={changes:[Ri(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=s,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,l||pe(e,"historyAdded")}function Gi(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||function(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,o,_(i.done),t))?i.done[i.done.length-1]=t:Ui(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&!1!==n.clearRedo&&zi(i.undone)}function Ui(e,t){var r=_(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Vi(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),(function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o}))}function Ki(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function ji(e,t){var r=function(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],i=0;i<t.text.length;++i)n.push(Ki(r[i]));return n}(e,t),n=Tt(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],l=n[i];if(o&&l)e:for(var s=0;s<l.length;++s){for(var a=l[s],u=0;u<o.length;++u)if(o[u].marker==a.marker)continue e;o.push(a)}else l&&(r[i]=l)}return r}function Xi(e,t,r){for(var n=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)n.push(r?Ci.prototype.deepCopy.call(o):o);else{var l=o.changes,s=[];n.push({changes:s});for(var a=0;a<l.length;++a){var u=l[a],c=void 0;if(s.push({from:u.from,to:u.to,text:u.text}),t)for(var h in u)(c=h.match(/^spans_(\d+)$/))&&B(t,Number(c[1]))>-1&&(_(s)[h]=u[h],delete u[h])}}}return n}function Yi(e,t,r,n){if(n){var i=e.anchor;if(r){var o=tt(t,i)<0;o!=tt(r,i)<0?(i=t,t=r):o!=tt(t,r)<0&&(t=r)}return new Si(i,t)}return new Si(r||t,t)}function _i(e,t,r,n,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Ji(e,new Ci([Yi(e.sel.primary(),t,r,i)],0),n)}function $i(e,t,r){for(var n=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)n[o]=Yi(e.sel.ranges[o],t[o],null,i);Ji(e,Li(e.cm,n,e.sel.primIndex),r)}function qi(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,Ji(e,Li(e.cm,i,e.sel.primIndex),n)}function Zi(e,t,r,n){Ji(e,ki(t,r),n)}function Qi(e,t,r){var n=e.history.done,i=_(n);i&&i.ranges?(n[n.length-1]=t,eo(e,t,r)):Ji(e,t,r)}function Ji(e,t,r){eo(e,t,r),Gi(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function eo(e,t,r){(me(e,"beforeSelectionChange")||e.cm&&me(e.cm,"beforeSelectionChange"))&&(t=function(e,t,r){var n={ranges:t.ranges,update:function(t){this.ranges=[];for(var r=0;r<t.length;r++)this.ranges[r]=new Si(st(e,t[r].anchor),st(e,t[r].head))},origin:r&&r.origin};return pe(e,"beforeSelectionChange",e,n),e.cm&&pe(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?Li(e.cm,n.ranges,n.ranges.length-1):t}(e,t,r));var n=r&&r.bias||(tt(t.primary().head,e.sel.primary().head)<0?-1:1);to(e,no(e,t,n,!0)),r&&!1===r.scroll||!e.cm||Dn(e.cm)}function to(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ve(e.cm)),sr(e,"cursorActivity",e))}function ro(e){to(e,no(e,e.sel,null,!1))}function no(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var l=t.ranges[o],s=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],a=oo(e,l.anchor,s&&s.anchor,r,n),u=oo(e,l.head,s&&s.head,r,n);(i||a!=l.anchor||u!=l.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new Si(a,u))}return i?Li(e.cm,i,t.primIndex):t}function io(e,t,r,n,i){var o=Xe(e,t.line);if(o.markedSpans)for(var l=0;l<o.markedSpans.length;++l){var s=o.markedSpans[l],a=s.marker,u="selectLeft"in a?!a.selectLeft:a.inclusiveLeft,c="selectRight"in a?!a.selectRight:a.inclusiveRight;if((null==s.from||(u?s.from<=t.ch:s.from<t.ch))&&(null==s.to||(c?s.to>=t.ch:s.to>t.ch))){if(i&&(pe(a,"beforeCursorEnter"),a.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(!a.atomic)continue;if(r){var h=a.find(n<0?1:-1),f=void 0;if((n<0?c:u)&&(h=lo(e,h,-n,h&&h.line==t.line?o:null)),h&&h.line==t.line&&(f=tt(h,r))&&(n<0?f<0:f>0))return io(e,h,t,n,i)}var d=a.find(n<0?-1:1);return(n<0?u:c)&&(d=lo(e,d,n,d.line==t.line?o:null)),d?io(e,d,t,n,i):null}}return t}function oo(e,t,r,n,i){var o=n||1,l=io(e,t,r,o,i)||!i&&io(e,t,r,o,!0)||io(e,t,r,-o,i)||!i&&io(e,t,r,-o,!0);return l||(e.cantEdit=!0,et(e.first,0))}function lo(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?st(e,et(t.line-1)):null:r>0&&t.ch==(n||Xe(e,t.line)).text.length?t.line<e.first+e.size-1?et(t.line+1,0):null:new et(t.line,t.ch+r)}function so(e){e.setSelection(et(e.firstLine(),0),et(e.lastLine()),U)}function ao(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}};return r&&(n.update=function(t,r,i,o){t&&(n.from=st(e,t)),r&&(n.to=st(e,r)),i&&(n.text=i),void 0!==o&&(n.origin=o)}),pe(e,"beforeChange",e,n),e.cm&&pe(e.cm,"beforeChange",e.cm,n),n.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:n.from,to:n.to,text:n.text,origin:n.origin}}function uo(e,t,r){if(e.cm){if(!e.cm.curOp)return ei(e.cm,uo)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(me(e,"beforeChange")||e.cm&&me(e.cm,"beforeChange"))||(t=ao(e,t,!0))){var n=xt&&!r&&function(e,t,r){var n=null;if(e.iter(t.line,r.line+1,(function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=B(n,r)||(n||(n=[])).push(r)}})),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var l=n[o],s=l.find(0),a=0;a<i.length;++a){var u=i[a];if(!(tt(u.to,s.from)<0||tt(u.from,s.to)>0)){var c=[a,1],h=tt(u.from,s.from),f=tt(u.to,s.to);(h<0||!l.inclusiveLeft&&!h)&&c.push({from:u.from,to:s.from}),(f>0||!l.inclusiveRight&&!f)&&c.push({from:s.to,to:u.to}),i.splice.apply(i,c),a+=c.length-3}}return i}(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)co(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else co(e,t)}}function co(e,t){if(1!=t.text.length||""!=t.text[0]||0!=tt(t.from,t.to)){var r=Ni(e,t);Bi(e,t,r,e.cm?e.cm.curOp.id:NaN),po(e,t,r,Tt(e,t));var n=[];Fi(e,(function(e,r){r||-1!=B(n,e.history)||(yo(e.history,t),n.push(e.history)),po(e,t,null,Tt(e,t))}))}}function ho(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(!n||r){for(var i,o=e.history,l=e.sel,s="undo"==t?o.done:o.undone,a="undo"==t?o.undone:o.done,u=0;u<s.length&&(i=s[u],r?!i.ranges||i.equals(e.sel):i.ranges);u++);if(u!=s.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(!(i=s.pop()).ranges){if(n)return void s.push(i);break}if(Ui(i,a),r&&!i.equals(e.sel))return void Ji(e,i,{clearRedo:!1});l=i}var c=[];Ui(l,a),a.push({changes:c,generation:o.generation}),o.generation=i.generation||++o.maxGeneration;for(var h=me(e,"beforeChange")||e.cm&&me(e.cm,"beforeChange"),f=function(r){var n=i.changes[r];if(n.origin=t,h&&!ao(e,n,!1))return s.length=0,{};c.push(Ri(e,n));var o=r?Ni(e,n):_(s);po(e,n,o,ji(e,n)),!r&&e.cm&&e.cm.scrollIntoView({from:n.from,to:Ti(n)});var l=[];Fi(e,(function(e,t){t||-1!=B(l,e.history)||(yo(e.history,n),l.push(e.history)),po(e,n,null,ji(e,n))}))},d=i.changes.length-1;d>=0;--d){var p=f(d);if(p)return p.v}}}}function fo(e,t){if(0!=t&&(e.first+=t,e.sel=new Ci($(e.sel.ranges,(function(e){return new Si(et(e.anchor.line+t,e.anchor.ch),et(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){hn(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)fn(e.cm,n,"gutter")}}function po(e,t,r,n){if(e.cm&&!e.cm.curOp)return ei(e.cm,po)(e,t,r,n);if(t.to.line<e.first)fo(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);fo(e,i),t={from:et(e.first,0),to:et(t.to.line+i,t.to.ch),text:[_(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:et(o,Xe(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ye(e,t.from,t.to),r||(r=Ni(e,t)),e.cm?function(e,t,r){var n=e.doc,i=e.display,o=t.from,l=t.to,s=!1,a=o.line;e.options.lineWrapping||(a=qe(Rt(Xe(n,o.line))),n.iter(a,l.line+1,(function(e){if(e==i.maxLine)return s=!0,!0}))),n.sel.contains(t.from,t.to)>-1&&ve(e),Hi(n,t,r,sn(e)),e.options.lineWrapping||(n.iter(a,o.line+t.text.length,(function(e){var t=Kt(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)})),s&&(e.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var r=e.first,n=t-1;n>r;n--){var i=Xe(e,n).stateAfter;if(i&&(!(i instanceof ut)||n+i.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}}(n,o.line),ni(e,400);var u=t.text.length-(l.line-o.line)-1;t.full?hn(e):o.line!=l.line||1!=t.text.length||Wi(e.doc,t)?hn(e,o.line,l.line+1,u):fn(e,o.line,"text");var c=me(e,"changes"),h=me(e,"change");if(h||c){var f={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin};h&&sr(e,"change",e,f),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(f)}e.display.selForContextMenu=null}(e.cm,t,n):Hi(e,t,n),eo(e,r,U),e.cantEdit&&oo(e,et(e.firstLine(),0))&&(e.cantEdit=!1)}}function go(e,t,r,n,i){var o;n||(n=r),tt(n,r)<0&&(r=(o=[n,r])[0],n=o[1]),"string"==typeof t&&(t=e.splitLines(t)),uo(e,{from:r,to:n,text:t,origin:i})}function vo(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function mo(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],l=!0;if(o.ranges){o.copied||((o=e[i]=o.deepCopy()).copied=!0);for(var s=0;s<o.ranges.length;s++)vo(o.ranges[s].anchor,t,r,n),vo(o.ranges[s].head,t,r,n)}else{for(var a=0;a<o.changes.length;++a){var u=o.changes[a];if(r<u.from.line)u.from=et(u.from.line+n,u.from.ch),u.to=et(u.to.line+n,u.to.ch);else if(t<=u.to.line){l=!1;break}}l||(e.splice(0,i+1),i=0)}}}function yo(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;mo(e.done,r,n,i),mo(e.undone,r,n,i)}function bo(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=Xe(e,lt(e,t)):i=qe(t),null==i?null:(n(o,i)&&e.cm&&fn(e.cm,i,r),o)}function wo(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}function xo(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}Si.prototype.from=function(){return ot(this.anchor,this.head)},Si.prototype.to=function(){return it(this.anchor,this.head)},Si.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},wo.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;r<n;++r){var i=this.lines[r];this.height-=i.height,Yt(i),sr(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}},xo.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(e<i){var o=Math.min(t,i-e),l=n.height;if(n.removeInner(e,o),this.height-=l-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof wo))){var s=[];this.collapse(s),this.children=[new wo(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(var l=i.lines.length%25+25,s=l;s<i.lines.length;){var a=new wo(i.lines.slice(s,s+=25));i.height-=a.height,this.children.splice(++n,0,a),a.parent=this}i.lines=i.lines.slice(0,l),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=new xo(e.children.splice(e.children.length-5,5));if(e.parent){e.size-=t.size,e.height-=t.height;var r=B(e.parent.children,e);e.parent.children.splice(r+1,0,t)}else{var n=new xo(e.children);n.parent=e,e.children=[n,t],e=n}t.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<o){var l=Math.min(t,o-e);if(i.iterN(e,l,r))return!0;if(0==(t-=l))break;e=0}else e-=o}}};var Co=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};function So(e,t,r){Vt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&On(e,r)}Co.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=qe(r);if(null!=n&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(r.widgets=null);var o=wr(this);$e(r,Math.max(0,r.height-o)),e&&(Jn(e,(function(){So(e,r,-o),fn(e,n,"widget")})),sr(e,"lineWidgetCleared",e,this,n))}},Co.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var i=wr(this)-t;i&&(Gt(this.doc,n)||$e(n,n.height+i),r&&Jn(r,(function(){r.curOp.forceUpdate=!0,So(r,n,i),sr(r,"lineWidgetChanged",r,e,qe(n))})))},ye(Co);var Lo=0,ko=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Lo};function To(e,t,r,n,i){if(n&&n.shared)return function(e,t,r,n,i){(n=I(n)).shared=!1;var o=[To(e,t,r,n,i)],l=o[0],s=n.widgetNode;return Fi(e,(function(e){s&&(n.widgetNode=s.cloneNode(!0)),o.push(To(e,st(e,t),st(e,r),n,i));for(var a=0;a<e.linked.length;++a)if(e.linked[a].isParent)return;l=_(o)})),new Mo(o,l)}(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return ei(e.cm,To)(e,t,r,n,i);var o=new ko(e,i),l=tt(t,r);if(n&&I(n,o,!1),l>0||0==l&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=O("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(It(e,t.line,t,r,o)||t.line!=r.line&&It(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ct=!0}o.addToHistory&&Bi(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var s,a=t.line,u=e.cm;if(e.iter(a,r.line+1,(function(e){u&&o.collapsed&&!u.options.lineWrapping&&Rt(e)==u.display.maxLine&&(s=!0),o.collapsed&&a!=t.line&&$e(e,0),function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}(e,new St(o,a==t.line?t.ch:null,a==r.line?r.ch:null)),++a})),o.collapsed&&e.iter(t.line,r.line+1,(function(t){Gt(e,t)&&$e(t,0)})),o.clearOnEnter&&he(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(xt=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++Lo,o.atomic=!0),u){if(s&&(u.curOp.updateMaxLine=!0),o.collapsed)hn(u,t.line,r.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=t.line;c<=r.line;c++)fn(u,c,"text");o.atomic&&ro(u.doc),sr(u,"markerAdded",u,o)}return o}ko.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Xn(e),me(this,"clear")){var r=this.find();r&&sr(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;o<this.lines.length;++o){var l=this.lines[o],s=Lt(l.markedSpans,this);e&&!this.collapsed?fn(e,qe(l),"text"):e&&(null!=s.to&&(i=qe(l)),null!=s.from&&(n=qe(l))),l.markedSpans=kt(l.markedSpans,s),null==s.from&&this.collapsed&&!Gt(this.doc,l)&&e&&$e(l,rn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var a=0;a<this.lines.length;++a){var u=Rt(this.lines[a]),c=Kt(u);c>e.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&hn(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&ro(e.doc)),e&&sr(e,"markerCleared",e,this,n,i),t&&Yn(e),this.parent&&this.parent.clear()}},ko.prototype.find=function(e,t){var r,n;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i<this.lines.length;++i){var o=this.lines[i],l=Lt(o.markedSpans,this);if(null!=l.from&&(r=et(t?o:qe(o),l.from),-1==e))return r;if(null!=l.to&&(n=et(t?o:qe(o),l.to),1==e))return n}return r&&{from:r,to:n}},ko.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;t&&n&&Jn(n,(function(){var i=t.line,o=qe(t.line),l=Or(n,o);if(l&&(Ir(l),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!Gt(r.doc,i)&&null!=r.height){var s=r.height;r.height=null;var a=wr(r)-s;a&&$e(i,i.height+a)}sr(n,"markerChanged",n,e)}))},ko.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=B(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ko.prototype.detachLine=function(e){if(this.lines.splice(B(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ye(ko);var Mo=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};function No(e){return e.findMarks(et(e.first,0),e.clipPos(et(e.lastLine())),(function(e){return e.parent}))}function Ao(e){for(var t=function(t){var r=e[t],n=[r.primary.doc];Fi(r.primary.doc,(function(e){return n.push(e)}));for(var i=0;i<r.markers.length;i++){var o=r.markers[i];-1==B(n,o.doc)&&(o.parent=null,r.markers.splice(i--,1))}},r=0;r<e.length;r++)t(r)}Mo.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();sr(this,"clear")}},Mo.prototype.find=function(e,t){return this.primary.find(e,t)},ye(Mo);var Oo=0,Do=function(e,t,r,n,i){if(!(this instanceof Do))return new Do(e,t,r,n,i);null==r&&(r=0),xo.call(this,[new wo([new Xt("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var o=et(r,0);this.sel=ki(o),this.history=new Ii(null),this.id=++Oo,this.modeOption=t,this.lineSep=n,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Hi(this,{from:o,to:o,text:e}),Ji(this,ki(o),U)};Do.prototype=Z(xo.prototype,{constructor:Do,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=_e(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:ri((function(e){var t=et(this.first,0),r=this.first+this.size-1;uo(this,{from:t,to:et(r,Xe(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Wn(this.cm,0,0),Ji(this,ki(t),U)})),replaceRange:function(e,t,r,n){go(this,e,t=st(this,t),r=r?st(this,r):t,n)},getRange:function(e,t,r){var n=Ye(this,st(this,e),st(this,t));return!1===r?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Qe(this,e))return Xe(this,e)},getLineNumber:function(e){return qe(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Xe(this,e)),Rt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return st(this,e)},getCursor:function(e){var t=this.sel.primary();return null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:ri((function(e,t,r){Zi(this,st(this,"number"==typeof e?et(e,t||0):e),null,r)})),setSelection:ri((function(e,t,r){Zi(this,st(this,e),st(this,t||e),r)})),extendSelection:ri((function(e,t,r){_i(this,st(this,e),t&&st(this,t),r)})),extendSelections:ri((function(e,t){$i(this,at(this,e),t)})),extendSelectionsBy:ri((function(e,t){$i(this,at(this,$(this.sel.ranges,e)),t)})),setSelections:ri((function(e,t,r){if(e.length){for(var n=[],i=0;i<e.length;i++)n[i]=new Si(st(this,e[i].anchor),st(this,e[i].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Ji(this,Li(this.cm,n,t),r)}})),addSelection:ri((function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new Si(st(this,e),st(this,t||e))),Ji(this,Li(this.cm,n,n.length-1),r)})),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=Ye(this,r[n].from(),r[n].to());t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=Ye(this,r[n].from(),r[n].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:ri((function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var l=i.ranges[o];n[o]={from:l.from(),to:l.to(),text:this.splitLines(e[o]),origin:r}}for(var s=t&&"end"!=t&&function(e,t,r){for(var n=[],i=et(e.first,0),o=i,l=0;l<t.length;l++){var s=t[l],a=Ai(s.from,i,o),u=Ai(Ti(s),i,o);if(i=s.to,o=u,"around"==r){var c=e.sel.ranges[l],h=tt(c.head,c.anchor)<0;n[l]=new Si(h?u:a,h?a:u)}else n[l]=new Si(a,a)}return new Ci(n,e.sel.primIndex)}(this,n,t),a=n.length-1;a>=0;a--)uo(this,n[a]);s?Qi(this,s):this.cm&&Dn(this.cm)})),undo:ri((function(){ho(this,"undo")})),redo:ri((function(){ho(this,"redo")})),undoSelection:ri((function(){ho(this,"undo",!0)})),redoSelection:ri((function(){ho(this,"redo",!0)})),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){var e=this;this.history=new Ii(this.history.maxGeneration),Fi(this,(function(t){return t.history=e.history}),!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Xi(this.history.done),undone:Xi(this.history.undone)}},setHistory:function(e){var t=this.history=new Ii(this.history.maxGeneration);t.done=Xi(e.done.slice(0),null,!0),t.undone=Xi(e.undone.slice(0),null,!0)},setGutterMarker:ri((function(e,t,r){return bo(this,e,"gutter",(function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&te(n)&&(e.gutterMarkers=null),!0}))})),clearGutter:ri((function(e){var t=this;this.iter((function(r){r.gutterMarkers&&r.gutterMarkers[e]&&bo(t,r,"gutter",(function(){return r.gutterMarkers[e]=null,te(r.gutterMarkers)&&(r.gutterMarkers=null),!0}))}))})),lineInfo:function(e){var t;if("number"==typeof e){if(!Qe(this,e))return null;if(t=e,!(e=Xe(this,e)))return null}else if(null==(t=qe(e)))return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:ri((function(e,t,r){return bo(this,e,"gutter"==t?"gutter":"class",(function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[n]){if(L(r).test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0}))})),removeLineClass:ri((function(e,t,r){return bo(this,e,"gutter"==t?"gutter":"class",(function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[n];if(!i)return!1;if(null==r)e[n]=null;else{var o=i.match(L(r));if(!o)return!1;var l=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&l!=i.length?" ":"")+i.slice(l)||null}return!0}))})),addLineWidget:ri((function(e,t,r){return function(e,t,r,n){var i=new Co(e,r,n),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),bo(e,t,"widget",(function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!Gt(e,t)){var n=Vt(t)<e.scrollTop;$e(t,t.height+wr(i)),n&&On(o,i.height),o.curOp.forceUpdate=!0}return!0})),o&&sr(o,"lineWidgetAdded",o,i,"number"==typeof t?t:qe(t)),i}(this,e,t,r)})),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return To(this,st(this,e),st(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return To(this,e=st(this,e),e,r,"bookmark")},findMarksAt:function(e){var t=[],r=Xe(this,(e=st(this,e)).line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=st(this,e),t=st(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,(function(o){var l=o.markedSpans;if(l)for(var s=0;s<l.length;s++){var a=l[s];null!=a.to&&i==e.line&&e.ch>=a.to||null==a.from&&i!=e.line||null!=a.from&&i==t.line&&a.from>=t.ch||r&&!r(a.marker)||n.push(a.marker.parent||a.marker)}++i})),n},getAllMarks:function(){var e=[];return this.iter((function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)})),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;return this.iter((function(i){var o=i.text.length+n;if(o>e)return t=e,!0;e-=o,++r})),st(this,et(r,t))},indexFromPos:function(e){var t=(e=st(this,e)).ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,(function(e){t+=e.text.length+r})),t},copy:function(e){var t=new Do(_e(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new Do(_e(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),l=e.clipPos(i.to);if(tt(o,l)){var s=To(e,o,l,n.primary,n.primary.type);n.markers.push(s),s.parent=n}}}(n,No(this)),n},unlinkDoc:function(e){if(e instanceof Ml&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t)if(this.linked[t].doc==e){this.linked.splice(t,1),e.unlinkDoc(this),Ao(No(this));break}if(e.history==this.history){var r=[e.id];Fi(e,(function(e){return r.push(e.id)}),!0),e.history=new Ii(null),e.history.done=Xi(this.history.done,r),e.history.undone=Xi(this.history.undone,r)}},iterLinkedDocs:function(e){Fi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):De(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:ri((function(e){var t;"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter((function(e){return e.order=null})),this.cm&&Jn(t=this.cm,(function(){Ei(t),hn(t)})))}))}),Do.prototype.eachLine=Do.prototype.iter;var Wo=0;function Ho(e){var t=this;if(Fo(t),!ge(t,e)&&!xr(t.display,e)){be(e),l&&(Wo=+new Date);var r=un(t,e,!0),n=e.dataTransfer.files;if(r&&!t.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),s=0,a=function(){++s==i&&ei(t,(function(){var e={from:r=st(t.doc,r),to:r,text:t.doc.splitLines(o.filter((function(e){return null!=e})).join(t.doc.lineSeparator())),origin:"paste"};uo(t.doc,e),Qi(t.doc,ki(st(t.doc,r),st(t.doc,Ti(e))))}))()},u=function(e,r){if(t.options.allowDropFileTypes&&-1==B(t.options.allowDropFileTypes,e.type))a();else{var n=new FileReader;n.onerror=function(){return a()},n.onload=function(){var e=n.result;/[\x00-\x08\x0e-\x1f]{2}/.test(e)||(o[r]=e),a()},n.readAsText(e)}},c=0;c<n.length;c++)u(n[c],c);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout((function(){return t.display.input.focus()}),20);try{var h=e.dataTransfer.getData("Text");if(h){var f;if(t.state.draggingText&&!t.state.draggingText.copy&&(f=t.listSelections()),eo(t.doc,ki(r,r)),f)for(var d=0;d<f.length;++d)go(t.doc,"",f[d].anchor,f[d].head,"drag");t.replaceSelection(h,"around","paste"),t.display.input.focus()}}catch(e){}}}}function Fo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Po(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),r=[],n=0;n<t.length;n++){var i=t[n].CodeMirror;i&&r.push(i)}r.length&&r[0].operation((function(){for(var t=0;t<r.length;t++)e(r[t])}))}}var Eo=!1;function Io(){var e;Eo||(he(window,"resize",(function(){null==e&&(e=setTimeout((function(){e=null,Po(Ro)}),100))})),he(window,"blur",(function(){return Po(kn)})),Eo=!0)}function Ro(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var zo={3:"Pause",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",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Bo=0;Bo<10;Bo++)zo[Bo+48]=zo[Bo+96]=String(Bo);for(var Go=65;Go<=90;Go++)zo[Go]=String.fromCharCode(Go);for(var Uo=1;Uo<=12;Uo++)zo[Uo+111]=zo[Uo+63235]="F"+Uo;var Vo={};function Ko(e){var t,r,n,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var l=0;l<o.length-1;l++){var s=o[l];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))r=!0;else{if(!/^s(hift)?$/i.test(s))throw new Error("Unrecognized modifier name: "+s);n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function jo(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=$(r.split(" "),Ko),o=0;o<i.length;o++){var l=void 0,s=void 0;o==i.length-1?(s=i.join(" "),l=n):(s=i.slice(0,o+1).join(" "),l="...");var a=t[s];if(a){if(a!=l)throw new Error("Inconsistent bindings for "+s)}else t[s]=l}delete e[r]}for(var u in t)e[u]=t[u];return e}function Xo(e,t,r,n){var i=(t=qo(t)).call?t.call(e,n):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&r(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Xo(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var l=Xo(e,t.fallthrough[o],r,n);if(l)return l}}}function Yo(e){var t="string"==typeof e?e:zo[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function _o(e,t,r){var n=e;return t.altKey&&"Alt"!=n&&(e="Alt-"+e),(C?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e),(C?t.ctrlKey:t.metaKey)&&"Mod"!=n&&(e="Cmd-"+e),!r&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e),e}function $o(e,t){if(h&&34==e.keyCode&&e.char)return!1;var r=zo[e.keyCode];return null!=r&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(r=e.code),_o(r,e,t))}function qo(e){return"string"==typeof e?Vo[e]:e}function Zo(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&tt(o.from,_(n).to)<=0;){var l=n.pop();if(tt(l.from,o.from)<0){o.from=l.from;break}}n.push(o)}Jn(e,(function(){for(var t=n.length-1;t>=0;t--)go(e.doc,"",n[t].from,n[t].to,"+delete");Dn(e)}))}function Qo(e,t,r){var n=ie(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Jo(e,t,r){var n=Qo(e,t.ch,r);return null==n?null:new et(t.line,n,r<0?"after":"before")}function el(e,t,r,n,i){if(e){"rtl"==t.doc.direction&&(i=-i);var o=ue(r,t.doc.direction);if(o){var l,s=i<0?_(o):o[0],a=i<0==(1==s.level)?"after":"before";if(s.level>0||"rtl"==t.doc.direction){var u=Dr(t,r);l=i<0?r.text.length-1:0;var c=Wr(t,u,l).top;l=oe((function(e){return Wr(t,u,e).top==c}),i<0==(1==s.level)?s.from:s.to-1,l),"before"==a&&(l=Qo(r,l,1))}else l=i<0?s.to:s.from;return new et(n,l,a)}}return new et(n,i<0?r.text.length:0,i<0?"before":"after")}Vo.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"},Vo.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","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"},Vo.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","Ctrl-O":"openLine"},Vo.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","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":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Vo.default=y?Vo.macDefault:Vo.pcDefault;var tl={selectAll:so,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),U)},killLine:function(e){return Zo(e,(function(t){if(t.empty()){var r=Xe(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:et(t.head.line+1,0)}:{from:t.head,to:et(t.head.line,r)}}return{from:t.from(),to:t.to()}}))},deleteLine:function(e){return Zo(e,(function(t){return{from:et(t.from().line,0),to:st(e.doc,et(t.to().line+1,0))}}))},delLineLeft:function(e){return Zo(e,(function(e){return{from:et(e.from().line,0),to:e.from()}}))},delWrappedLineLeft:function(e){return Zo(e,(function(t){var r=e.charCoords(t.head,"div").top+5;return{from:e.coordsChar({left:0,top:r},"div"),to:t.from()}}))},delWrappedLineRight:function(e){return Zo(e,(function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}}))},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(et(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(et(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy((function(t){return rl(e,t.head.line)}),{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy((function(t){return nl(e,t.head)}),{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy((function(t){return function(e,t){var r=Xe(e.doc,t),n=function(e){for(var t;t=Pt(e);)e=t.find(1,!0).line;return e}(r);return n!=r&&(t=qe(n)),el(!0,e,r,t,-1)}(e,t.head.line)}),{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy((function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")}),K)},goLineLeft:function(e){return e.extendSelectionsBy((function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")}),K)},goLineLeftSmart:function(e){return e.extendSelectionsBy((function(t){var r=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?nl(e,t.head):n}),K)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),l=R(e.getLine(o.line),o.ch,n);t.push(Y(n-l%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Jn(e,(function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++)if(t[n].empty()){var i=t[n].head,o=Xe(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new et(i.line,i.ch-1)),i.ch>0)i=new et(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),et(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var l=Xe(e.doc,i.line-1).text;l&&(i=new et(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),et(i.line-1,l.length-1),i,"+transpose"))}r.push(new Si(i,i))}e.setSelections(r)}))},newlineAndIndent:function(e){return Jn(e,(function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;n<t.length;n++)e.indentLine(t[n].from().line,null,!0);Dn(e)}))},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function rl(e,t){var r=Xe(e.doc,t),n=Rt(r);return n!=r&&(t=qe(n)),el(!0,e,n,t,1)}function nl(e,t){var r=rl(e,t.line),n=Xe(e.doc,r.line),i=ue(n,e.doc.direction);if(!i||0==i[0].level){var o=Math.max(r.ch,n.text.search(/\S/)),l=t.line==r.line&&t.ch<=o&&t.ch;return et(r.line,l?0:o,r.sticky)}return r}function il(e,t,r){if("string"==typeof t&&!(t=tl[t]))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=G}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}var ol=new z;function ll(e,t,r,n){var i=e.state.keySeq;if(i){if(Yo(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:ol.set(50,(function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())})),sl(e,i+" "+t,r,n))return!0}return sl(e,t,r,n)}function sl(e,t,r,n){var i=function(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=Xo(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&Xo(t,e.options.extraKeys,r,e)||Xo(t,e.options.keyMap,r,e)}(e,t,n);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&sr(e,"keyHandled",e,t,r),"handled"!=i&&"multi"!=i||(be(r),xn(e)),!!i}function al(e,t){var r=$o(t,!0);return!!r&&(t.shiftKey&&!e.state.keySeq?ll(e,"Shift-"+r,t,(function(t){return il(e,t,!0)}))||ll(e,r,t,(function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return il(e,t)})):ll(e,r,t,(function(t){return il(e,t)})))}var ul=null;function cl(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField()||(t.curOp.focus=W(),ge(t,e)))){l&&s<11&&27==e.keyCode&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=16==n||e.shiftKey;var i=al(t,e);h&&(ul=i?n:null,i||88!=n||He||!(y?e.metaKey:e.ctrlKey)||t.replaceSelection("",null,"cut")),r&&!y&&!i&&46==n&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=n||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||function(e){var t=e.display.lineDiv;function r(e){18!=e.keyCode&&e.altKey||(T(t,"CodeMirror-crosshair"),de(document,"keyup",r),de(document,"mouseover",r))}H(t,"CodeMirror-crosshair"),he(document,"keyup",r),he(document,"mouseover",r)}(t)}}function hl(e){16==e.keyCode&&(this.doc.sel.shift=!1),ge(this,e)}function fl(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField()||xr(t.display,e)||ge(t,e)||e.ctrlKey&&!e.altKey||y&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(h&&r==ul)return ul=null,void be(e);if(!h||e.which&&!(e.which<10)||!al(t,e)){var i=String.fromCharCode(null==n?r:n);"\b"!=i&&(function(e,t,r){return ll(e,"'"+r+"'",t,(function(t){return il(e,t,!0)}))}(t,e,i)||t.display.input.onKeyPress(e))}}}var dl,pl,gl=function(e,t,r){this.time=e,this.pos=t,this.button=r};function vl(e){var t=this,r=t.display;if(!(ge(t,e)||r.activeTouch&&r.input.supportsTouch()))if(r.input.ensurePolled(),r.shift=e.shiftKey,xr(r,e))a||(r.scroller.draggable=!1,setTimeout((function(){return r.scroller.draggable=!0}),100));else if(!bl(t,e)){var n=un(t,e),i=Le(e),o=n?function(e,t){var r=+new Date;return pl&&pl.compare(r,e,t)?(dl=pl=null,"triple"):dl&&dl.compare(r,e,t)?(pl=new gl(r,e,t),dl=null,"double"):(dl=new gl(r,e,t),pl=null,"single")}(n,i):"single";window.focus(),1==i&&t.state.selectingText&&t.state.selectingText(e),n&&function(e,t,r,n,i){var o="Click";return"double"==n?o="Double"+o:"triple"==n&&(o="Triple"+o),ll(e,_o(o=(1==t?"Left":2==t?"Middle":"Right")+o,i),i,(function(t){if("string"==typeof t&&(t=tl[t]),!t)return!1;var n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n=t(e,r)!=G}finally{e.state.suppressEdits=!1}return n}))}(t,i,n,o,e)||(1==i?n?function(e,t,r,n){l?setTimeout(E(Cn,e),0):e.curOp.focus=W();var i,o=function(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};if(null==i.unit){var o=b?r.shiftKey&&r.metaKey:r.altKey;i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}return(null==i.extend||e.doc.extend)&&(i.extend=e.doc.extend||r.shiftKey),null==i.addNew&&(i.addNew=y?r.metaKey:r.ctrlKey),null==i.moveOnDrag&&(i.moveOnDrag=!(y?r.altKey:r.ctrlKey)),i}(e,r,n),u=e.doc.sel;e.options.dragDrop&&Me&&!e.isReadOnly()&&"single"==r&&(i=u.contains(t))>-1&&(tt((i=u.ranges[i]).from(),t)<0||t.xRel>0)&&(tt(i.to(),t)>0||t.xRel<0)?function(e,t,r,n){var i=e.display,o=!1,u=ei(e,(function(t){a&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Sn(e)),de(i.wrapper.ownerDocument,"mouseup",u),de(i.wrapper.ownerDocument,"mousemove",c),de(i.scroller,"dragstart",h),de(i.scroller,"drop",u),o||(be(t),n.addNew||_i(e.doc,r,null,null,n.extend),a&&!f||l&&9==s?setTimeout((function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()}),20):i.input.focus())})),c=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},h=function(){return o=!0};a&&(i.scroller.draggable=!0),e.state.draggingText=u,u.copy=!n.moveOnDrag,he(i.wrapper.ownerDocument,"mouseup",u),he(i.wrapper.ownerDocument,"mousemove",c),he(i.scroller,"dragstart",h),he(i.scroller,"drop",u),e.state.delayingBlurEvent=!0,setTimeout((function(){return i.input.focus()}),20),i.scroller.dragDrop&&i.scroller.dragDrop()}(e,n,t,o):function(e,t,r,n){l&&Sn(e);var i=e.display,o=e.doc;be(t);var s,a,u=o.sel,c=u.ranges;if(n.addNew&&!n.extend?(a=o.sel.contains(r),s=a>-1?c[a]:new Si(r,r)):(s=o.sel.primary(),a=o.sel.primIndex),"rectangle"==n.unit)n.addNew||(s=new Si(r,r)),r=un(e,t,!0,!0),a=-1;else{var h=ml(e,r,n.unit);s=n.extend?Yi(s,h.anchor,h.head,n.extend):h}n.addNew?-1==a?(a=c.length,Ji(o,Li(e,c.concat([s]),a),{scroll:!1,origin:"*mouse"})):c.length>1&&c[a].empty()&&"char"==n.unit&&!n.extend?(Ji(o,Li(e,c.slice(0,a).concat(c.slice(a+1)),0),{scroll:!1,origin:"*mouse"}),u=o.sel):qi(o,a,s,V):(a=0,Ji(o,new Ci([s],0),V),u=o.sel);var f=r;function d(t){if(0!=tt(f,t))if(f=t,"rectangle"==n.unit){for(var i=[],l=e.options.tabSize,c=R(Xe(o,r.line).text,r.ch,l),h=R(Xe(o,t.line).text,t.ch,l),d=Math.min(c,h),p=Math.max(c,h),g=Math.min(r.line,t.line),v=Math.min(e.lastLine(),Math.max(r.line,t.line));g<=v;g++){var m=Xe(o,g).text,y=j(m,d,l);d==p?i.push(new Si(et(g,y),et(g,y))):m.length>y&&i.push(new Si(et(g,y),et(g,j(m,p,l))))}i.length||i.push(new Si(r,r)),Ji(o,Li(e,u.ranges.slice(0,a).concat(i),a),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,w=s,x=ml(e,t,n.unit),C=w.anchor;tt(x.anchor,C)>0?(b=x.head,C=ot(w.from(),x.anchor)):(b=x.anchor,C=it(w.to(),x.head));var S=u.ranges.slice(0);S[a]=function(e,t){var r=t.anchor,n=t.head,i=Xe(e.doc,r.line);if(0==tt(r,n)&&r.sticky==n.sticky)return t;var o=ue(i);if(!o)return t;var l=se(o,r.ch,r.sticky),s=o[l];if(s.from!=r.ch&&s.to!=r.ch)return t;var a,u=l+(s.from==r.ch==(1!=s.level)?0:1);if(0==u||u==o.length)return t;if(n.line!=r.line)a=(n.line-r.line)*("ltr"==e.doc.direction?1:-1)>0;else{var c=se(o,n.ch,n.sticky),h=c-l||(n.ch-r.ch)*(1==s.level?-1:1);a=c==u-1||c==u?h<0:h>0}var f=o[u+(a?-1:0)],d=a==(1==f.level),p=d?f.from:f.to,g=d?"after":"before";return r.ch==p&&r.sticky==g?t:new Si(new et(r.line,p,g),n)}(e,new Si(st(o,C),b)),Ji(o,Li(e,S,a),V)}}var p=i.wrapper.getBoundingClientRect(),g=0;function v(t){var r=++g,l=un(e,t,!0,"rectangle"==n.unit);if(l)if(0!=tt(l,f)){e.curOp.focus=W(),d(l);var s=Nn(i,o);(l.line>=s.to||l.line<s.from)&&setTimeout(ei(e,(function(){g==r&&v(t)})),150)}else{var a=t.clientY<p.top?-20:t.clientY>p.bottom?20:0;a&&setTimeout(ei(e,(function(){g==r&&(i.scroller.scrollTop+=a,v(t))})),50)}}function m(t){e.state.selectingText=!1,g=1/0,t&&(be(t),i.input.focus()),de(i.wrapper.ownerDocument,"mousemove",y),de(i.wrapper.ownerDocument,"mouseup",b),o.history.lastSelOrigin=null}var y=ei(e,(function(e){0!==e.buttons&&Le(e)?v(e):m(e)})),b=ei(e,m);e.state.selectingText=b,he(i.wrapper.ownerDocument,"mousemove",y),he(i.wrapper.ownerDocument,"mouseup",b)}(e,n,t,o)}(t,n,o,e):Se(e)==r.scroller&&be(e):2==i?(n&&_i(t.doc,n),setTimeout((function(){return r.input.focus()}),20)):3==i&&(S?t.display.input.onContextMenu(e):Sn(t)))}}function ml(e,t,r){if("char"==r)return new Si(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new Si(et(t.line,0),st(e.doc,et(t.line+1,0)));var n=r(e,t);return new Si(n.from,n.to)}function yl(e,t,r,n){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(e){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&be(t);var l=e.display,s=l.lineDiv.getBoundingClientRect();if(o>s.bottom||!me(e,r))return xe(t);o-=s.top-l.viewOffset;for(var a=0;a<e.display.gutterSpecs.length;++a){var u=l.gutters.childNodes[a];if(u&&u.getBoundingClientRect().right>=i)return pe(e,r,e,Ze(e.doc,o),e.display.gutterSpecs[a].className,t),xe(t)}}function bl(e,t){return yl(e,t,"gutterClick",!0)}function wl(e,t){xr(e.display,t)||function(e,t){return!!me(e,"gutterContextMenu")&&yl(e,t,"gutterContextMenu",!1)}(e,t)||ge(e,t,"contextmenu")||S||e.display.input.onContextMenu(t)}function xl(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),zr(e)}gl.prototype.compare=function(e,t,r){return this.time+400>e&&0==tt(t,this.pos)&&r==this.button};var Cl={toString:function(){return"CodeMirror.Init"}},Sl={},Ll={};function kl(e,t,r){if(!t!=!(r&&r!=Cl)){var n=e.display.dragFunctions,i=t?he:de;i(e.display.scroller,"dragstart",n.start),i(e.display.scroller,"dragenter",n.enter),i(e.display.scroller,"dragover",n.over),i(e.display.scroller,"dragleave",n.leave),i(e.display.scroller,"drop",n.drop)}}function Tl(e){e.options.lineWrapping?(H(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(T(e.display.wrapper,"CodeMirror-wrap"),jt(e)),an(e),hn(e),zr(e),setTimeout((function(){return Gn(e)}),100)}function Ml(e,t){var r=this;if(!(this instanceof Ml))return new Ml(e,t);this.options=t=t?I(t):{},I(Sl,t,!1);var n=t.value;"string"==typeof n?n=new Do(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var i=new Ml.inputStyles[t.inputStyle](this),o=this.display=new vi(e,n,i,t);for(var u in o.wrapper.CodeMirror=this,xl(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Kn(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new z,keySeq:null,specialChars:null},t.autofocus&&!m&&o.input.focus(),l&&s<11&&setTimeout((function(){return r.display.input.reset(!0)}),20),function(e){var t=e.display;he(t.scroller,"mousedown",ei(e,vl)),he(t.scroller,"dblclick",l&&s<11?ei(e,(function(t){if(!ge(e,t)){var r=un(e,t);if(r&&!bl(e,t)&&!xr(e.display,t)){be(t);var n=e.findWordAt(r);_i(e.doc,n.anchor,n.head)}}})):function(t){return ge(e,t)||be(t)}),he(t.scroller,"contextmenu",(function(t){return wl(e,t)})),he(t.input.getField(),"contextmenu",(function(r){t.scroller.contains(r.target)||wl(e,r)}));var r,n={end:0};function i(){t.activeTouch&&(r=setTimeout((function(){return t.activeTouch=null}),1e3),(n=t.activeTouch).end=+new Date)}function o(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function a(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}he(t.scroller,"touchstart",(function(i){if(!ge(e,i)&&!o(i)&&!bl(e,i)){t.input.ensurePolled(),clearTimeout(r);var l=+new Date;t.activeTouch={start:l,moved:!1,prev:l-n.end<=300?n:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}})),he(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),he(t.scroller,"touchend",(function(r){var n=t.activeTouch;if(n&&!xr(t,r)&&null!=n.left&&!n.moved&&new Date-n.start<300){var o,l=e.coordsChar(t.activeTouch,"page");o=!n.prev||a(n,n.prev)?new Si(l,l):!n.prev.prev||a(n,n.prev.prev)?e.findWordAt(l):new Si(et(l.line,0),st(e.doc,et(l.line+1,0))),e.setSelection(o.anchor,o.head),e.focus(),be(r)}i()})),he(t.scroller,"touchcancel",i),he(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(Pn(e,t.scroller.scrollTop),In(e,t.scroller.scrollLeft,!0),pe(e,"scroll",e))})),he(t.scroller,"mousewheel",(function(t){return xi(e,t)})),he(t.scroller,"DOMMouseScroll",(function(t){return xi(e,t)})),he(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){ge(e,t)||Ce(t)},over:function(t){ge(e,t)||(function(e,t){var r=un(e,t);if(r){var n=document.createDocumentFragment();yn(e,r,n),e.display.dragCursor||(e.display.dragCursor=A("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),N(e.display.dragCursor,n)}}(e,t),Ce(t))},start:function(t){return function(e,t){if(l&&(!e.state.draggingText||+new Date-Wo<100))Ce(t);else if(!ge(e,t)&&!xr(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f)){var r=A("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",h&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),h&&r.parentNode.removeChild(r)}}(e,t)},drop:ei(e,Ho),leave:function(t){ge(e,t)||Fo(e)}};var u=t.input.getField();he(u,"keyup",(function(t){return hl.call(e,t)})),he(u,"keydown",ei(e,cl)),he(u,"keypress",ei(e,fl)),he(u,"focus",(function(t){return Ln(e,t)})),he(u,"blur",(function(t){return kn(e,t)}))}(this),Io(),Xn(this),this.curOp.forceUpdate=!0,Pi(this,n),t.autofocus&&!m||this.hasFocus()?setTimeout((function(){r.hasFocus()&&!r.state.focused&&Ln(r)}),20):kn(this),Ll)Ll.hasOwnProperty(u)&&Ll[u](this,t[u],Cl);fi(this),t.finishInit&&t.finishInit(this);for(var c=0;c<Nl.length;++c)Nl[c](this);Yn(this),a&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}Ml.defaults=Sl,Ml.optionHandlers=Ll;var Nl=[];function Al(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=dt(e,t).state:r="prev");var l=e.options.tabSize,s=Xe(o,t),a=R(s.text,null,l);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==r&&((u=o.mode.indent(i,s.text.slice(c.length),s.text))==G||u>150)){if(!n)return;r="prev"}}else u=0,r="not";"prev"==r?u=t>o.first?R(Xe(o,t-1).text,null,l):0:"add"==r?u=a+e.options.indentUnit:"subtract"==r?u=a-e.options.indentUnit:"number"==typeof r&&(u=a+r),u=Math.max(0,u);var h="",f=0;if(e.options.indentWithTabs)for(var d=Math.floor(u/l);d;--d)f+=l,h+="\t";if(f<u&&(h+=Y(u-f)),h!=c)return go(o,h,et(t,0),et(t,c.length),"+input"),s.stateAfter=null,!0;for(var p=0;p<o.sel.ranges.length;p++){var g=o.sel.ranges[p];if(g.head.line==t&&g.head.ch<c.length){var v=et(t,c.length);qi(o,p,new Si(v,v));break}}}Ml.defineInitHook=function(e){return Nl.push(e)};var Ol=null;function Dl(e){Ol=e}function Wl(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n||(n=o.sel);var l=+new Date-200,s="paste"==i||e.state.pasteIncoming>l,a=De(t),u=null;if(s&&n.ranges.length>1)if(Ol&&Ol.text.join("\n")==t){if(n.ranges.length%Ol.text.length==0){u=[];for(var c=0;c<Ol.text.length;c++)u.push(o.splitLines(Ol.text[c]))}}else a.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(u=$(a,(function(e){return[e]})));for(var h=e.curOp.updateInput,f=n.ranges.length-1;f>=0;f--){var d=n.ranges[f],p=d.from(),g=d.to();d.empty()&&(r&&r>0?p=et(p.line,p.ch-r):e.state.overwrite&&!s?g=et(g.line,Math.min(Xe(o,g.line).text.length,g.ch+_(a).length)):s&&Ol&&Ol.lineWise&&Ol.text.join("\n")==a.join("\n")&&(p=g=et(p.line,0)));var v={from:p,to:g,text:u?u[f%u.length]:a,origin:i||(s?"paste":e.state.cutIncoming>l?"cut":"+input")};uo(e.doc,v),sr(e,"inputRead",e,v)}t&&!s&&Fl(e,t),Dn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=h),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Hl(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Jn(t,(function(){return Wl(t,r,0,null,"paste")})),!0}function Fl(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),l=!1;if(o.electricChars){for(var s=0;s<o.electricChars.length;s++)if(t.indexOf(o.electricChars.charAt(s))>-1){l=Al(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Xe(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=Al(e,i.head.line,"smart"));l&&sr(e,"electricInput",e,i.head.line)}}}function Pl(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,o={anchor:et(i,0),head:et(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function El(e,t,r,n){e.setAttribute("autocorrect",r?"":"off"),e.setAttribute("autocapitalize",n?"":"off"),e.setAttribute("spellcheck",!!t)}function Il(){var e=A("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=A("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return a?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(e.style.border="1px solid black"),El(e),t}function Rl(e,t,r,n,i){var o=t,l=r,s=Xe(e,t.line),a=i&&"rtl"==e.direction?-r:r;function u(o){var l,u;if("codepoint"==n){var c=s.text.charCodeAt(t.ch+(n>0?0:-1));l=isNaN(c)?null:new et(t.line,Math.max(0,Math.min(s.text.length,t.ch+r*(c>=55296&&c<56320?2:1))),-r)}else l=i?function(e,t,r,n){var i=ue(t,e.doc.direction);if(!i)return Jo(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var o=se(i,r.ch,r.sticky),l=i[o];if("ltr"==e.doc.direction&&l.level%2==0&&(n>0?l.to>r.ch:l.from<r.ch))return Jo(t,r,n);var s,a=function(e,r){return Qo(t,e instanceof et?e.ch:e,r)},u=function(r){return e.options.lineWrapping?(s=s||Dr(e,t),Zr(e,t,s,r)):{begin:0,end:t.text.length}},c=u("before"==r.sticky?a(r,-1):r.ch);if("rtl"==e.doc.direction||1==l.level){var h=1==l.level==n<0,f=a(r,h?1:-1);if(null!=f&&(h?f<=l.to&&f<=c.end:f>=l.from&&f>=c.begin)){var d=h?"before":"after";return new et(r.line,f,d)}}var p=function(e,t,n){for(var o=function(e,t){return t?new et(r.line,a(e,1),"before"):new et(r.line,e,"after")};e>=0&&e<i.length;e+=t){var l=i[e],s=t>0==(1!=l.level),u=s?n.begin:a(n.end,-1);if(l.from<=u&&u<l.to)return o(u,s);if(u=s?l.from:a(l.to,-1),n.begin<=u&&u<n.end)return o(u,s)}},g=p(o+n,n,c);if(g)return g;var v=n>0?c.end:a(c.begin,-1);return null==v||n>0&&v==t.text.length||!(g=p(n>0?0:i.length-1,n,u(v)))?null:g}(e.cm,s,t,r):Jo(s,t,r);if(null==l){if(o||(u=t.line+a)<e.first||u>=e.first+e.size||(t=new et(u,t.ch,t.sticky),!(s=Xe(e,u))))return!1;t=el(i,e.cm,s,t.line,a)}else t=l;return!0}if("char"==n||"codepoint"==n)u();else if("column"==n)u(!0);else if("word"==n||"group"==n)for(var c=null,h="group"==n,f=e.cm&&e.cm.getHelper(t,"wordChars"),d=!0;!(r<0)||u(!d);d=!1){var p=s.text.charAt(t.ch)||"\n",g=ee(p,f)?"w":h&&"\n"==p?"n":!h||/\s/.test(p)?null:"p";if(!h||d||g||(g="s"),c&&c!=g){r<0&&(r=1,u(),t.sticky="after");break}if(g&&(c=g),r>0&&!u(!d))break}var v=oo(e,t,o,l,!0);return rt(o,v)&&(v.hitSide=!0),v}function zl(e,t,r,n){var i,o,l=e.doc,s=t.left;if("page"==n){var a=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(a-.5*rn(e.display),3);i=(r>0?t.bottom:t.top)+r*u}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;(o=$r(e,s,i)).outside;){if(r<0?i<=0:i>=l.height){o.hitSide=!0;break}i+=5*r}return o}var Bl=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new z,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Gl(e,t){var r=Or(e,t.line);if(!r||r.hidden)return null;var n=Xe(e.doc,t.line),i=Nr(r,n,t.line),o=ue(n,e.doc.direction),l="left";o&&(l=se(o,t.ch)%2?"right":"left");var s=Pr(i.map,t.ch,l);return s.offset="right"==s.collapse?s.end:s.start,s}function Ul(e,t){return t&&(e.bad=!0),e}function Vl(e,t,r){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return Ul(e.clipPos(et(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return Kl(o,t,r)}}function Kl(e,t,r){var n=e.text.firstChild,i=!1;if(!t||!D(n,t))return Ul(et(qe(e.line),0),!0);if(t==n&&(i=!0,t=n.childNodes[r],r=0,!t)){var o=e.rest?_(e.rest):e.line;return Ul(et(qe(o),o.text.length),i)}var l=3==t.nodeType?t:null,s=t;for(l||1!=t.childNodes.length||3!=t.firstChild.nodeType||(l=t.firstChild,r&&(r=l.nodeValue.length));s.parentNode!=n;)s=s.parentNode;var a=e.measure,u=a.maps;function c(t,r,n){for(var i=-1;i<(u?u.length:0);i++)for(var o=i<0?a.map:u[i],l=0;l<o.length;l+=3){var s=o[l+2];if(s==t||s==r){var c=qe(i<0?e.line:e.rest[i]),h=o[l]+n;return(n<0||s!=t)&&(h=o[l+(n?1:0)]),et(c,h)}}}var h=c(l,s,r);if(h)return Ul(h,i);for(var f=s.nextSibling,d=l?l.nodeValue.length-r:0;f;f=f.nextSibling){if(h=c(f,f.firstChild,0))return Ul(et(h.line,h.ch-d),i);d+=f.textContent.length}for(var p=s.previousSibling,g=r;p;p=p.previousSibling){if(h=c(p,p.firstChild,-1))return Ul(et(h.line,h.ch+g),i);g+=p.textContent.length}}Bl.prototype.init=function(e){var t=this,r=this,n=r.cm,i=r.div=e.lineDiv;function o(e){for(var t=e.target;t;t=t.parentNode){if(t==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(t.className))break}return!1}function l(e){if(o(e)&&!ge(n,e)){if(n.somethingSelected())Dl({lineWise:!1,text:n.getSelections()}),"cut"==e.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var t=Pl(n);Dl({lineWise:!0,text:t.text}),"cut"==e.type&&n.operation((function(){n.setSelections(t.ranges,0,U),n.replaceSelection("",null,"cut")}))}if(e.clipboardData){e.clipboardData.clearData();var l=Ol.text.join("\n");if(e.clipboardData.setData("Text",l),e.clipboardData.getData("Text")==l)return void e.preventDefault()}var s=Il(),a=s.firstChild;n.display.lineSpace.insertBefore(s,n.display.lineSpace.firstChild),a.value=Ol.text.join("\n");var u=document.activeElement;P(a),setTimeout((function(){n.display.lineSpace.removeChild(s),u.focus(),u==i&&r.showPrimarySelection()}),50)}}El(i,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize),he(i,"paste",(function(e){!o(e)||ge(n,e)||Hl(e,n)||s<=11&&setTimeout(ei(n,(function(){return t.updateFromDOM()})),20)})),he(i,"compositionstart",(function(e){t.composing={data:e.data,done:!1}})),he(i,"compositionupdate",(function(e){t.composing||(t.composing={data:e.data,done:!1})})),he(i,"compositionend",(function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)})),he(i,"touchstart",(function(){return r.forceCompositionEnd()})),he(i,"input",(function(){t.composing||t.readFromDOMSoon()})),he(i,"copy",l),he(i,"cut",l)},Bl.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Bl.prototype.prepareSelection=function(){var e=mn(this.cm,!1);return e.focus=document.activeElement==this.div,e},Bl.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Bl.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Bl.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),i=n.from(),o=n.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||o.line<t.display.viewFrom)e.removeAllRanges();else{var l=Vl(t,e.anchorNode,e.anchorOffset),s=Vl(t,e.focusNode,e.focusOffset);if(!l||l.bad||!s||s.bad||0!=tt(ot(l,s),i)||0!=tt(it(l,s),o)){var a=t.display.view,u=i.line>=t.display.viewFrom&&Gl(t,i)||{node:a[0].measure.map[2],offset:0},c=o.line<t.display.viewTo&&Gl(t,o);if(!c){var h=a[a.length-1].measure,f=h.maps?h.maps[h.maps.length-1]:h.map;c={node:f[f.length-1],offset:f[f.length-2]-f[f.length-3]}}if(u&&c){var d,p=e.rangeCount&&e.getRangeAt(0);try{d=k(u.node,u.offset,c.offset,c.node)}catch(e){}d&&(!r&&t.state.focused?(e.collapse(u.node,u.offset),d.collapsed||(e.removeAllRanges(),e.addRange(d))):(e.removeAllRanges(),e.addRange(d)),p&&null==e.anchorNode?e.addRange(p):r&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},Bl.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout((function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation((function(){return e.cm.curOp.selectionChanged=!0}))}),20)},Bl.prototype.showMultipleSelections=function(e){N(this.cm.display.cursorDiv,e.cursors),N(this.cm.display.selectionDiv,e.selection)},Bl.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Bl.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return D(this.div,t)},Bl.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&document.activeElement==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Bl.prototype.blur=function(){this.div.blur()},Bl.prototype.getField=function(){return this.div},Bl.prototype.supportsTouch=function(){return!0},Bl.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Jn(this.cm,(function(){return e.cm.curOp.selectionChanged=!0})),this.polling.set(this.cm.options.pollInterval,(function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}))},Bl.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Bl.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(v&&c&&this.cm.display.gutterSpecs.length&&function(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var r=Vl(t,e.anchorNode,e.anchorOffset),n=Vl(t,e.focusNode,e.focusOffset);r&&n&&Jn(t,(function(){Ji(t.doc,ki(r,n),U),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)}))}}},Bl.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t,r,n=this.cm,i=n.display,o=n.doc.sel.primary(),l=o.from(),s=o.to();if(0==l.ch&&l.line>n.firstLine()&&(l=et(l.line-1,Xe(n.doc,l.line-1).length)),s.ch==Xe(n.doc,s.line).text.length&&s.line<n.lastLine()&&(s=et(s.line+1,0)),l.line<i.viewFrom||s.line>i.viewTo-1)return!1;l.line==i.viewFrom||0==(e=cn(n,l.line))?(t=qe(i.view[0].line),r=i.view[0].node):(t=qe(i.view[e].line),r=i.view[e-1].node.nextSibling);var a,u,c=cn(n,s.line);if(c==i.view.length-1?(a=i.viewTo-1,u=i.lineDiv.lastChild):(a=qe(i.view[c+1].line)-1,u=i.view[c+1].node.previousSibling),!r)return!1;for(var h=n.doc.splitLines(function(e,t,r,n,i){var o="",l=!1,s=e.doc.lineSeparator(),a=!1;function u(e){return function(t){return t.id==e}}function c(){l&&(o+=s,a&&(o+=s),l=a=!1)}function h(e){e&&(c(),o+=e)}function f(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(r)return void h(r);var o,d=t.getAttribute("cm-marker");if(d){var p=e.findMarks(et(n,0),et(i+1,0),u(+d));return void(p.length&&(o=p[0].find(0))&&h(Ye(e.doc,o.from,o.to).join(s)))}if("false"==t.getAttribute("contenteditable"))return;var g=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;g&&c();for(var v=0;v<t.childNodes.length;v++)f(t.childNodes[v]);/^(pre|p)$/i.test(t.nodeName)&&(a=!0),g&&(l=!0)}else 3==t.nodeType&&h(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;f(t),t!=r;)t=t.nextSibling,a=!1;return o}(n,r,u,t,a)),f=Ye(n.doc,et(t,0),et(a,Xe(n.doc,a).text.length));h.length>1&&f.length>1;)if(_(h)==_(f))h.pop(),f.pop(),a--;else{if(h[0]!=f[0])break;h.shift(),f.shift(),t++}for(var d=0,p=0,g=h[0],v=f[0],m=Math.min(g.length,v.length);d<m&&g.charCodeAt(d)==v.charCodeAt(d);)++d;for(var y=_(h),b=_(f),w=Math.min(y.length-(1==h.length?d:0),b.length-(1==f.length?d:0));p<w&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;if(1==h.length&&1==f.length&&t==l.line)for(;d&&d>l.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)d--,p++;h[h.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),h[0]=h[0].slice(d).replace(/\u200b+$/,"");var x=et(t,d),C=et(a,f.length?_(f).length-p:0);return h.length>1||h[0]||tt(x,C)?(go(n.doc,h,x,C,"+input"),!0):void 0},Bl.prototype.ensurePolled=function(){this.forceCompositionEnd()},Bl.prototype.reset=function(){this.forceCompositionEnd()},Bl.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Bl.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()}),80))},Bl.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Jn(this.cm,(function(){return hn(e.cm)}))},Bl.prototype.setUneditable=function(e){e.contentEditable="false"},Bl.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||ei(this.cm,Wl)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Bl.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Bl.prototype.onContextMenu=function(){},Bl.prototype.resetPosition=function(){},Bl.prototype.needsContentAttribute=!0;var jl=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new z,this.hasSelection=!1,this.composing=null};jl.prototype.init=function(e){var t=this,r=this,n=this.cm;this.createField(e);var i=this.textarea;function o(e){if(!ge(n,e)){if(n.somethingSelected())Dl({lineWise:!1,text:n.getSelections()});else{if(!n.options.lineWiseCopyCut)return;var t=Pl(n);Dl({lineWise:!0,text:t.text}),"cut"==e.type?n.setSelections(t.ranges,null,U):(r.prevInput="",i.value=t.text.join("\n"),P(i))}"cut"==e.type&&(n.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),g&&(i.style.width="0px"),he(i,"input",(function(){l&&s>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()})),he(i,"paste",(function(e){ge(n,e)||Hl(e,n)||(n.state.pasteIncoming=+new Date,r.fastPoll())})),he(i,"cut",o),he(i,"copy",o),he(e.scroller,"paste",(function(t){if(!xr(e,t)&&!ge(n,t)){if(!i.dispatchEvent)return n.state.pasteIncoming=+new Date,void r.focus();var o=new Event("paste");o.clipboardData=t.clipboardData,i.dispatchEvent(o)}})),he(e.lineSpace,"selectstart",(function(t){xr(e,t)||be(t)})),he(i,"compositionstart",(function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}})),he(i,"compositionend",(function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)}))},jl.prototype.createField=function(e){this.wrapper=Il(),this.textarea=this.wrapper.firstChild},jl.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},jl.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=mn(e);if(e.options.moveInputWithCursor){var i=Xr(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return n},jl.prototype.showSelection=function(e){var t=this.cm.display;N(t.cursorDiv,e.cursors),N(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},jl.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&P(this.textarea),l&&s>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",l&&s>=9&&(this.hasSelection=null))}},jl.prototype.getField=function(){return this.textarea},jl.prototype.supportsTouch=function(){return!1},jl.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!m||W()!=this.textarea))try{this.textarea.focus()}catch(e){}},jl.prototype.blur=function(){this.textarea.blur()},jl.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},jl.prototype.receivedFocus=function(){this.slowPoll()},jl.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},jl.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,(function r(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,r))}))},jl.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||We(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=r.value;if(i==n&&!t.somethingSelected())return!1;if(l&&s>=9&&this.hasSelection===i||y&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||n||(n=""),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var a=0,u=Math.min(n.length,i.length);a<u&&n.charCodeAt(a)==i.charCodeAt(a);)++a;return Jn(t,(function(){Wl(t,i.slice(a),n.length-a,null,e.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?r.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},jl.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},jl.prototype.onKeyPress=function(){l&&s>=9&&(this.hasSelection=null),this.fastPoll()},jl.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=un(r,e),u=n.scroller.scrollTop;if(o&&!h){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(o)&&ei(r,Ji)(r.doc,ki(o),U);var c,f=i.style.cssText,d=t.wrapper.style.cssText,p=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-p.top-5)+"px; left: "+(e.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(l?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",a&&(c=window.scrollY),n.input.focus(),a&&window.scrollTo(null,c),n.input.reset(),r.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=m,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll),l&&s>=9&&v(),S){Ce(e);var g=function(){de(window,"mouseup",g),setTimeout(m,20)};he(window,"mouseup",g)}else setTimeout(m,50)}function v(){if(null!=i.selectionStart){var e=r.somethingSelected(),o=""+(e?i.value:"");i.value="⇚",i.value=o,t.prevInput=e?"":"",i.selectionStart=1,i.selectionEnd=o.length,n.selForContextMenu=r.doc.sel}}function m(){if(t.contextMenuPending==m&&(t.contextMenuPending=!1,t.wrapper.style.cssText=d,i.style.cssText=f,l&&s<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=u),null!=i.selectionStart)){(!l||l&&s<9)&&v();var e=0,o=function(){n.selForContextMenu==r.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&""==t.prevInput?ei(r,so)(r):e++<10?n.detectingSelectAll=setTimeout(o,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(o,200)}}},jl.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},jl.prototype.setUneditable=function(){},jl.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers;function r(r,n,i,o){e.defaults[r]=n,i&&(t[r]=o?function(e,t,r){r!=Cl&&i(e,t,r)}:i)}e.defineOption=r,e.Init=Cl,r("value","",(function(e,t){return e.setValue(t)}),!0),r("mode",null,(function(e,t){e.doc.modeOption=t,Oi(e)}),!0),r("indentUnit",2,Oi,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,(function(e){Di(e),zr(e),hn(e)}),!0),r("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter((function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,r.push(et(n,o))}n++}));for(var i=r.length-1;i>=0;i--)go(e.doc,t,r[i],et(r[i].line,r[i].ch+t.length))}})),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(e,t,r){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),r!=Cl&&e.refresh()})),r("specialCharPlaceholder",Qt,(function(e){return e.refresh()}),!0),r("electricChars",!0),r("inputStyle",m?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),r("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),r("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),r("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),r("rtlMoveVisually",!w),r("wholeLineUpdateBefore",!0),r("theme","default",(function(e){xl(e),gi(e)}),!0),r("keyMap","default",(function(e,t,r){var n=qo(t),i=r!=Cl&&qo(r);i&&i.detach&&i.detach(e,n),n.attach&&n.attach(e,i||null)})),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Tl,!0),r("gutters",[],(function(e,t){e.display.gutterSpecs=di(t,e.options.lineNumbers),gi(e)}),!0),r("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?ln(e.display)+"px":"0",e.refresh()}),!0),r("coverGutterNextToScrollbar",!1,(function(e){return Gn(e)}),!0),r("scrollbarStyle","native",(function(e){Kn(e),Gn(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),r("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=di(e.options.gutters,t),gi(e)}),!0),r("firstLineNumber",1,gi,!0),r("lineNumberFormatter",(function(e){return e}),gi,!0),r("showCursorWhenSelecting",!1,vn,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,(function(e,t){"nocursor"==t&&(kn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),r("screenReaderLabel",null,(function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)})),r("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),r("dragDrop",!0,kl),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,vn,!0),r("singleCursorHeightPerLine",!0,vn,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Di,!0),r("addModeClass",!1,Di,!0),r("pollInterval",100),r("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),r("historyEventDelay",1250),r("viewportMargin",10,(function(e){return e.refresh()}),!0),r("maxHighlightLength",1e4,Di,!0),r("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),r("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),r("autofocus",null),r("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),r("phrases",null)}(Ml),function(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,r){var n=this.options,i=n[e];n[e]==r&&"mode"!=e||(n[e]=r,t.hasOwnProperty(e)&&ei(this,t[e])(this,r,i),pe(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](qo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||t[r].name==e)return t.splice(r,1),!0},addOverlay:ti((function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");!function(e,t,r){for(var n=0,i=r(t);n<e.length&&r(e[n])<=i;)n++;e.splice(n,0,t)}(this.state.overlays,{mode:n,modeSpec:t,opaque:r&&r.opaque,priority:r&&r.priority||0},(function(e){return e.priority})),this.state.modeGen++,hn(this)})),removeOverlay:ti((function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void hn(this)}})),indentLine:ti((function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),Qe(this.doc,e)&&Al(this,e,t,r)})),indentSelection:ti((function(e){for(var t=this.doc.sel.ranges,r=-1,n=0;n<t.length;n++){var i=t[n];if(i.empty())i.head.line>r&&(Al(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&Dn(this));else{var o=i.from(),l=i.to(),s=Math.max(r,o.line);r=Math.min(this.lastLine(),l.line-(l.ch?0:1))+1;for(var a=s;a<r;++a)Al(this,a,e);var u=this.doc.sel.ranges;0==o.ch&&t.length==u.length&&u[n].from().ch>0&&qi(this.doc,n,new Si(o,u[n].to()),U)}}})),getTokenAt:function(e,t){return yt(this,e,t)},getLineTokens:function(e,t){return yt(this,et(e),t,!0)},getTokenTypeAt:function(e){e=st(this.doc,e);var t,r=ft(this,Xe(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var l=n+i>>1;if((l?r[2*l-1]:0)>=o)i=l;else{if(!(r[2*l+1]<o)){t=r[2*l+2];break}n=l+1}}var s=t?t.indexOf("overlay "):-1;return s<0?t:0==s?null:t.slice(0,s-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(!r.hasOwnProperty(t))return n;var i=r[t],o=this.getModeAt(e);if("string"==typeof o[t])i[o[t]]&&n.push(i[o[t]]);else if(o[t])for(var l=0;l<o[t].length;l++){var s=i[o[t][l]];s&&n.push(s)}else o.helperType&&i[o.helperType]?n.push(i[o.helperType]):i[o.name]&&n.push(i[o.name]);for(var a=0;a<i._global.length;a++){var u=i._global[a];u.pred(o,this)&&-1==B(n,u.val)&&n.push(u.val)}return n},getStateAfter:function(e,t){var r=this.doc;return dt(this,(e=lt(r,null==e?r.first+r.size-1:e))+1,t).state},cursorCoords:function(e,t){var r=this.doc.sel.primary();return Xr(this,null==e?r.head:"object"==typeof e?st(this.doc,e):e?r.from():r.to(),t||"page")},charCoords:function(e,t){return jr(this,st(this.doc,e),t||"page")},coordsChar:function(e,t){return $r(this,(e=Kr(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Kr(this,{top:e,left:0},t||"page").top,Ze(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,r){var n,i=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>o&&(e=o,i=!0),n=Xe(this.doc,e)}else n=e;return Vr(this,n,{top:0,left:0},t||"page",r||i).top+(i?this.doc.height-Vt(n):0)},defaultTextHeight:function(){return rn(this.display)},defaultCharWidth:function(){return nn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o,l,s,a=this.display,u=(e=Xr(this,st(this.doc,e))).bottom,c=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),a.sizer.appendChild(t),"over"==n)u=e.top;else if("above"==n||"near"==n){var h=Math.max(a.wrapper.clientHeight,this.doc.height),f=Math.max(a.sizer.clientWidth,a.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>h)&&e.top>t.offsetHeight?u=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=h&&(u=e.bottom),c+t.offsetWidth>f&&(c=f-t.offsetWidth)}t.style.top=u+"px",t.style.left=t.style.right="","right"==i?(c=a.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?c=0:"middle"==i&&(c=(a.sizer.clientWidth-t.offsetWidth)/2),t.style.left=c+"px"),r&&(o=this,l={left:c,top:u,right:c+t.offsetWidth,bottom:u+t.offsetHeight},null!=(s=An(o,l)).scrollTop&&Pn(o,s.scrollTop),null!=s.scrollLeft&&In(o,s.scrollLeft))},triggerOnKeyDown:ti(cl),triggerOnKeyPress:ti(fl),triggerOnKeyUp:hl,triggerOnMouseDown:ti(vl),execCommand:function(e){if(tl.hasOwnProperty(e))return tl[e].call(null,this)},triggerElectric:ti((function(e){Fl(this,e)})),findPosH:function(e,t,r,n){var i=1;t<0&&(i=-1,t=-t);for(var o=st(this.doc,e),l=0;l<t&&!(o=Rl(this.doc,o,i,r,n)).hitSide;++l);return o},moveH:ti((function(e,t){var r=this;this.extendSelectionsBy((function(n){return r.display.shift||r.doc.extend||n.empty()?Rl(r.doc,n.head,e,t,r.options.rtlMoveVisually):e<0?n.from():n.to()}),K)})),deleteH:ti((function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Zo(this,(function(r){var i=Rl(n,r.head,e,t,!1);return e<0?{from:i,to:r.head}:{from:r.head,to:i}}))})),findPosV:function(e,t,r,n){var i=1,o=n;t<0&&(i=-1,t=-t);for(var l=st(this.doc,e),s=0;s<t;++s){var a=Xr(this,l,"div");if(null==o?o=a.left:a.left=o,(l=zl(this,a,i,r)).hitSide)break}return l},moveV:ti((function(e,t){var r=this,n=this.doc,i=[],o=!this.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy((function(l){if(o)return e<0?l.from():l.to();var s=Xr(r,l.head,"div");null!=l.goalColumn&&(s.left=l.goalColumn),i.push(s.left);var a=zl(r,s,e,t);return"page"==t&&l==n.sel.primary()&&On(r,jr(r,a,"div").top-s.top),a}),K),i.length)for(var l=0;l<n.sel.ranges.length;l++)n.sel.ranges[l].goalColumn=i[l]})),findWordAt:function(e){var t=Xe(this.doc,e.line).text,r=e.ch,n=e.ch;if(t){var i=this.getHelper(e,"wordChars");"before"!=e.sticky&&n!=t.length||!r?++n:--r;for(var o=t.charAt(r),l=ee(o,i)?function(e){return ee(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!ee(e)};r>0&&l(t.charAt(r-1));)--r;for(;n<t.length&&l(t.charAt(n));)++n}return new Si(et(e.line,r),et(e.line,n))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?H(this.display.cursorDiv,"CodeMirror-overwrite"):T(this.display.cursorDiv,"CodeMirror-overwrite"),pe(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==W()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:ti((function(e,t){Wn(this,e,t)})),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-kr(this)-this.display.barHeight,width:e.scrollWidth-kr(this)-this.display.barWidth,clientHeight:Mr(this),clientWidth:Tr(this)}},scrollIntoView:ti((function(e,t){null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:et(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line?function(e,t){Hn(e),e.curOp.scrollToPos=t}(this,e):Fn(this,e.from,e.to,e.margin)})),setSize:ti((function(e,t){var r=this,n=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&Rr(this);var i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,(function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){fn(r,i,"widget");break}++i})),this.curOp.forceUpdate=!0,pe(this,"refresh",this)})),operation:function(e){return Jn(this,e)},startOperation:function(){return Xn(this)},endOperation:function(){return Yn(this)},refresh:ti((function(){var e=this.display.cachedTextHeight;hn(this),this.curOp.forceUpdate=!0,zr(this),Wn(this,this.doc.scrollLeft,this.doc.scrollTop),ui(this.display),(null==e||Math.abs(e-rn(this.display))>.5||this.options.lineWrapping)&&an(this),pe(this,"refresh",this)})),swapDoc:ti((function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),Pi(this,e),zr(this),this.display.input.reset(),Wn(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,sr(this,"swapDoc",this,t),t})),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ye(e),e.registerHelper=function(t,n,i){r.hasOwnProperty(t)||(r[t]=e[t]={_global:[]}),r[t][n]=i},e.registerGlobalHelper=function(t,n,i,o){e.registerHelper(t,n,o),r[t]._global.push({pred:i,val:o})}}(Ml);var Xl="iter insert remove copy getEditor constructor".split(" ");for(var Yl in Do.prototype)Do.prototype.hasOwnProperty(Yl)&&B(Xl,Yl)<0&&(Ml.prototype[Yl]=function(e){return function(){return e.apply(this.doc,arguments)}}(Do.prototype[Yl]));return ye(Do),Ml.inputStyles={textarea:jl,contenteditable:Bl},Ml.defineMode=function(e){Ml.defaults.mode||"null"==e||(Ml.defaults.mode=e),Ie.apply(this,arguments)},Ml.defineMIME=function(e,t){Ee[e]=t},Ml.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),Ml.defineMIME("text/plain","null"),Ml.defineExtension=function(e,t){Ml.prototype[e]=t},Ml.defineDocExtension=function(e,t){Do.prototype[e]=t},Ml.fromTextArea=function(e,t){if((t=t?I(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var r=W();t.autofocus=r==e||null!=e.getAttribute("autofocus")&&r==document.body}function n(){e.value=s.getValue()}var i;if(e.form&&(he(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var l=o.submit=function(){n(),o.submit=i,o.submit(),o.submit=l}}catch(e){}}t.finishInit=function(r){r.save=n,r.getTextArea=function(){return e},r.toTextArea=function(){r.toTextArea=isNaN,n(),e.parentNode.removeChild(r.getWrapperElement()),e.style.display="",e.form&&(de(e.form,"submit",n),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=i))}},e.style.display="none";var s=Ml((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t);return s},function(e){e.off=de,e.on=he,e.wheelEventPixels=wi,e.Doc=Do,e.splitLines=De,e.countColumn=R,e.findColumn=j,e.isWordChar=J,e.Pass=G,e.signal=pe,e.Line=Xt,e.changeEnd=Ti,e.scrollbarModel=Vn,e.Pos=et,e.cmpPos=tt,e.modes=Pe,e.mimeModes=Ee,e.resolveMode=Re,e.getMode=ze,e.modeExtensions=Be,e.extendMode=Ge,e.copyState=Ue,e.startState=Ke,e.innerMode=Ve,e.commands=tl,e.keyMap=Vo,e.keyName=$o,e.isModifierKey=Yo,e.lookupKey=Xo,e.normalizeKeyMap=jo,e.StringStream=je,e.SharedTextMarker=Mo,e.TextMarker=ko,e.LineWidget=Co,e.e_preventDefault=be,e.e_stopPropagation=we,e.e_stop=Ce,e.addClass=H,e.contains=D,e.rmClass=T,e.keyNames=zo}(Ml),Ml.version="5.59.0",Ml},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).CodeMirror=t(); diff --git a/preview/index.html b/preview/index.html index 8422fb0..69450d8 100644 --- a/preview/index.html +++ b/preview/index.html @@ -1,6 +1,59 @@ <!DOCTYPE html> <meta charset="utf-8" /> <title>FinFiddle</title> +<link rel="stylesheet" href="codemirror.min.css"> +<style> +html, body { + height: 100%; + margin: 0; + padding: 0; +} + +main { + display: flex; + height: 100%; +} + +.editing { + flex: 1 1 50%; + height: 100%; + width: 50%; +} + +.execution { + flex: 1 1 50%; + height: 100%; + width: 50%; + display: flex; + flex-direction: column; +} + +.CodeMirror { + height: 100%; +} + +canvas#preview { + width: 100%; + height: 100%; +} + +.coords { + display: none; +} +</style> +<main> +<div class="editing"> + <textarea id="source"># Loading...</textarea> +</div> +<div class="execution"> + <form> + <button type="button" id="play-btn" title="Play">▶</button> + </form> + <canvas id="preview"></canvas> +</div> +</main> +<pre id="output"></pre> +<pre id="Python/coords.txt" class="coords"></pre> <script id="vshader" type="x-shader/x-vertex"> attribute vec3 pos; attribute vec4 colorIn; @@ -25,32 +78,8 @@ gl_FragColor = color; } </script> -<style> -html, body { - height: 100%; - margin: 0; - padding: 0; -} - -main { - display: flex; - height: 100%; -} - -textarea#source { - flex: 1 1 50%; -} - -canvas#preview { - flex: 1 1 50%; -} -</style> -<main> -<textarea id="source" readonly>Loading...</textarea> -<canvas id="preview"></canvas> -</main> -<pre id="output" ></pre> -<pre id="Python/coords.txt" class="coords"></pre> <script src="skulpt.min.js" type="text/javascript"></script> <script src="skulpt-stdlib.js" type="text/javascript"></script> +<script src="codemirror.min.js" type="text/javascript"></script> +<script src="mode/python/python.js" type="text/javascript"></script> <script type="module" src="render.js" async></script> diff --git a/preview/mode/python/python.js b/preview/mode/python/python.js new file mode 100644 index 0000000..de5fd38 --- /dev/null +++ b/preview/mode/python/python.js @@ -0,0 +1,399 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: https://codemirror.net/LICENSE + +(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"; + + function wordRegexp(words) { + return new RegExp("^((" + words.join(")|(") + "))\\b"); + } + + var wordOperators = wordRegexp(["and", "or", "not", "is"]); + 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", "in"]; + 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__"]; + CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins)); + + function top(state) { + return state.scopes[state.scopes.length - 1]; + } + + CodeMirror.defineMode("python", function(conf, parserConf) { + var ERRORCLASS = "error"; + + var delimiters = parserConf.delimiters || parserConf.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.\\]/; + // (Backwards-compatibility with old, cumbersome config system) + var operators = [parserConf.singleOperators, parserConf.doubleOperators, parserConf.doubleDelimiters, parserConf.tripleDelimiters, + parserConf.operators || /^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/] + for (var i = 0; i < operators.length; i++) if (!operators[i]) operators.splice(i--, 1) + + var hangingIndent = parserConf.hangingIndent || conf.indentUnit; + + var myKeywords = commonKeywords, myBuiltins = commonBuiltins; + if (parserConf.extra_keywords != undefined) + myKeywords = myKeywords.concat(parserConf.extra_keywords); + + if (parserConf.extra_builtins != undefined) + myBuiltins = myBuiltins.concat(parserConf.extra_builtins); + + var py3 = !(parserConf.version && Number(parserConf.version) < 3) + if (py3) { + // since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator + var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/; + myKeywords = myKeywords.concat(["nonlocal", "False", "True", "None", "async", "await"]); + myBuiltins = myBuiltins.concat(["ascii", "bytes", "exec", "print"]); + var stringPrefixes = new RegExp("^(([rbuf]|(br)|(fr))?('{3}|\"{3}|['\"]))", "i"); + } else { + var identifiers = parserConf.identifiers|| /^[_A-Za-z][_A-Za-z0-9]*/; + myKeywords = myKeywords.concat(["exec", "print"]); + myBuiltins = myBuiltins.concat(["apply", "basestring", "buffer", "cmp", "coerce", "execfile", + "file", "intern", "long", "raw_input", "reduce", "reload", + "unichr", "unicode", "xrange", "False", "True", "None"]); + var stringPrefixes = new RegExp("^(([rubf]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i"); + } + var keywords = wordRegexp(myKeywords); + var builtins = wordRegexp(myBuiltins); + + // tokenizers + function tokenBase(stream, state) { + var sol = stream.sol() && state.lastToken != "\\" + if (sol) state.indent = stream.indentation() + // Handle scope changes + if (sol && top(state).type == "py") { + var scopeOffset = top(state).offset; + if (stream.eatSpace()) { + var lineOffset = stream.indentation(); + if (lineOffset > scopeOffset) + pushPyScope(state); + else if (lineOffset < scopeOffset && dedent(stream, state) && stream.peek() != "#") + state.errorToken = true; + return null; + } else { + var style = tokenBaseInner(stream, state); + if (scopeOffset > 0 && dedent(stream, state)) + style += " " + ERRORCLASS; + return style; + } + } + return tokenBaseInner(stream, state); + } + + function tokenBaseInner(stream, state, inFormat) { + if (stream.eatSpace()) return null; + + // Handle Comments + if (!inFormat && stream.match(/^#.*/)) 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)) { + var isFmtString = stream.current().toLowerCase().indexOf('f') !== -1; + if (!isFmtString) { + state.tokenize = tokenStringFactory(stream.current(), state.tokenize); + return state.tokenize(stream, state); + } else { + state.tokenize = formatStringFactory(stream.current(), state.tokenize); + return state.tokenize(stream, state); + } + } + + for (var i = 0; i < operators.length; i++) + if (stream.match(operators[i])) return "operator" + + if (stream.match(delimiters)) return "punctuation"; + + if (state.lastToken == "." && stream.match(identifiers)) + return "property"; + + if (stream.match(keywords) || stream.match(wordOperators)) + 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 inFormat ? null :ERRORCLASS; + } + + function formatStringFactory(delimiter, tokenOuter) { + while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0) + delimiter = delimiter.substr(1); + + var singleline = delimiter.length == 1; + var OUTCLASS = "string"; + + function tokenNestedExpr(depth) { + return function(stream, state) { + var inner = tokenBaseInner(stream, state, true) + if (inner == "punctuation") { + if (stream.current() == "{") { + state.tokenize = tokenNestedExpr(depth + 1) + } else if (stream.current() == "}") { + if (depth > 1) state.tokenize = tokenNestedExpr(depth - 1) + else state.tokenize = tokenString + } + } + return inner + } + } + + 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 = tokenOuter; + return OUTCLASS; + } else if (stream.match('{{')) { + // ignore {{ in f-str + return OUTCLASS; + } else if (stream.match('{', false)) { + // switch to nested mode + state.tokenize = tokenNestedExpr(0) + if (stream.current()) return OUTCLASS; + else return state.tokenize(stream, state) + } else if (stream.match('}}')) { + return OUTCLASS; + } else if (stream.match('}')) { + // single } in f-string is an error + return ERRORCLASS; + } else { + stream.eat(/['"]/); + } + } + if (singleline) { + if (parserConf.singleLineStringErrors) + return ERRORCLASS; + else + state.tokenize = tokenOuter; + } + return OUTCLASS; + } + tokenString.isString = true; + return tokenString; + } + + function tokenStringFactory(delimiter, tokenOuter) { + while ("rubf".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 = tokenOuter; + return OUTCLASS; + } else { + stream.eat(/['"]/); + } + } + if (singleline) { + if (parserConf.singleLineStringErrors) + return ERRORCLASS; + else + state.tokenize = tokenOuter; + } + return OUTCLASS; + } + tokenString.isString = true; + return tokenString; + } + + function pushPyScope(state) { + while (top(state).type != "py") state.scopes.pop() + state.scopes.push({offset: top(state).offset + conf.indentUnit, + type: "py", + align: null}) + } + + function pushBracketScope(stream, state, type) { + var align = stream.match(/^([\s\[\{\(]|#.*)*$/, false) ? null : stream.column() + 1 + state.scopes.push({offset: state.indent + hangingIndent, + type: type, + align: align}) + } + + function dedent(stream, state) { + var indented = stream.indentation(); + while (state.scopes.length > 1 && top(state).offset > indented) { + if (top(state).type != "py") return true; + state.scopes.pop(); + } + return top(state).offset != indented; + } + + function tokenLexer(stream, state) { + if (stream.sol()) state.beginningOfLine = true; + + var style = state.tokenize(stream, state); + var current = stream.current(); + + // Handle decorators + if (state.beginningOfLine && current == "@") + return stream.match(identifiers, false) ? "meta" : py3 ? "operator" : ERRORCLASS; + + if (/\S/.test(current)) state.beginningOfLine = false; + + if ((style == "variable" || style == "builtin") + && state.lastToken == "meta") + style = "meta"; + + // Handle scope changes. + if (current == "pass" || current == "return") + state.dedent += 1; + + if (current == "lambda") state.lambda = true; + if (current == ":" && !state.lambda && top(state).type == "py") + pushPyScope(state); + + if (current.length == 1 && !/string|comment/.test(style)) { + var delimiter_index = "[({".indexOf(current); + if (delimiter_index != -1) + pushBracketScope(stream, state, "])}".slice(delimiter_index, delimiter_index+1)); + + delimiter_index = "])}".indexOf(current); + if (delimiter_index != -1) { + if (top(state).type == current) state.indent = state.scopes.pop().offset - hangingIndent + else return ERRORCLASS; + } + } + if (state.dedent > 0 && stream.eol() && top(state).type == "py") { + if (state.scopes.length > 1) state.scopes.pop(); + state.dedent -= 1; + } + + return style; + } + + var external = { + startState: function(basecolumn) { + return { + tokenize: tokenBase, + scopes: [{offset: basecolumn || 0, type: "py", align: null}], + indent: basecolumn || 0, + lastToken: null, + lambda: false, + dedent: 0 + }; + }, + + token: function(stream, state) { + var addErr = state.errorToken; + if (addErr) state.errorToken = false; + var style = tokenLexer(stream, state); + + if (style && style != "comment") + state.lastToken = (style == "keyword" || style == "punctuation") ? stream.current() : style; + if (style == "punctuation") style = null; + + if (stream.eol() && state.lambda) + state.lambda = false; + return addErr ? style + " " + ERRORCLASS : style; + }, + + indent: function(state, textAfter) { + if (state.tokenize != tokenBase) + return state.tokenize.isString ? CodeMirror.Pass : 0; + + var scope = top(state), closing = scope.type == textAfter.charAt(0) + if (scope.align != null) + return scope.align - (closing ? 1 : 0) + else + return scope.offset - (closing ? hangingIndent : 0) + }, + + electricInput: /^\s*[\}\]\)]$/, + closeBrackets: {triples: "'\""}, + 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/preview/render.js b/preview/render.js index e3bedb0..2819d17 100644 --- a/preview/render.js +++ b/preview/render.js @@ -1,4 +1,4 @@ -globalThis.DELAY_MS = 250; +globalThis.treeShowDelayMs = 250; function createShader(gl, type, source) { const shader = gl.createShader(type); @@ -28,16 +28,54 @@ function loadVertices() { return vertices; } +/** + * @param {string} source + * @param {AbortSignal} abortSignal + */ +async function runCurrentScript(source, abortSignal) { + let shouldRun = true; + + function interruptHandler(susp) { + if (shouldRun !== true) { + throw new Error('interrupt'); + } + return null; + } + + abortSignal.addEventListener('abort', () => { + shouldRun = false; + }); + + try { + await Sk.misceval.asyncToPromise(() => { + return Sk.importMainWithBody("<stdin>", false, source, true); + }, {"*": interruptHandler}); + } catch (e) { + if (e.message !== 'interrupt') { + console.log(e); + } + } +} + async function runProgram() { /** * Load initial data: */ const coordsSource = await fetch('../coords.txt').then(res => res.text()); document.querySelector('pre.coords').textContent = coordsSource + '\n'; - const spinSource = await fetch('../xmaslights-spin.py').then(res => res.text()); - document.getElementById('source').textContent = spinSource + '\n'; - const source = document.getElementById('source').textContent; + if (location.hash.length > 1) { + document.getElementById('source').textContent = atob(location.hash.slice(1)); + } else { + const spinSource = await fetch('../xmaslights-spin.py') + .then(res => res.text()); + document.getElementById('source').textContent = spinSource + '\n'; + } + + const editor = CodeMirror.fromTextArea(document.getElementById('source'), { + lineNumbers: true, + mode: 'python', + }); const vertices = loadVertices(); @@ -133,7 +171,7 @@ var $builtinmodule = ${function () { // TODO: Maybe use animation frame..? Sk.setTimeout(() => { resolve(Sk.builtin.none.none$); - }, DELAY_MS); + }, treeShowDelayMs); }); })()); }); @@ -142,6 +180,24 @@ var $builtinmodule = ${function () { return mod; }};`; + Sk.onAfterImport = (library) => { + switch (library) { + case 're': { + // HACK: Get support for re.sub + const re = Sk.sysmodules.entries.re.rhs.$d; + re.sub = new Sk.builtin.func((pattern, replacement, original) => { + const patternStr = Sk.ffi.remapToJs(pattern); + const replStr = Sk.ffi.remapToJs(replacement); + const originalStr = Sk.ffi.remapToJs(original); + // TODO: Do this properly, maybe using other re.* things. + const regex = new RegExp(patternStr, 'g'); + return new Sk.builtin.str(originalStr.replace(regex, replStr)); + }); + break; + } + } + }; + Sk.pre = 'output'; Sk.configure({ output: (text) => { @@ -154,24 +210,36 @@ var $builtinmodule = ${function () { } let fileContents = Sk.builtinFiles["files"][filename]; - // HACK - if (filename === 'src/lib/re.js') { - fileContents = fileContents.replace('__name__:', `sub: new Sk.builtin.func(function (pattern, replacement, original) { - const patternStr = Sk.ffi.remapToJs(pattern); - const replStr = Sk.ffi.remapToJs(replacement); - const originalStr = Sk.ffi.remapToJs(original); - // TODO: Do this properly, maybe using other re.* things. - const regex = new RegExp(patternStr, 'g'); - return new Sk.builtin.str(originalStr.replace(regex, replStr)); - }),__name__:`); - } - return fileContents; }, }); - await Sk.misceval.asyncToPromise(() => { - return Sk.importMainWithBody("<stdin>", false, source, true); + editor.on('change', () => { + const currentSource = editor.getValue(); + const base64 = btoa(currentSource); + location.hash = base64; + }); + + /** + * @type {AbortController|null} + */ + let lastAbort = null; + + async function handleRunButtonClick() { + if (lastAbort !== null) { + lastAbort.abort(); + } + + const abort = new AbortController(); + lastAbort = abort; + + await runCurrentScript(editor.getValue(), abort.signal); + } + + handleRunButtonClick(); + + document.getElementById('play-btn').addEventListener('click', (e) => { + handleRunButtonClick(); }); } runProgram(); From 59cf183cc0f19d5c8caa1592aa92df540546a63f Mon Sep 17 00:00:00 2001 From: Jan Krems <jankrems@google.com> Date: Thu, 24 Dec 2020 11:09:21 -0800 Subject: [PATCH 07/14] Add some rotation as an example --- preview/index.html | 7 ++++++- preview/render.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/preview/index.html b/preview/index.html index 69450d8..0b3cf70 100644 --- a/preview/index.html +++ b/preview/index.html @@ -48,6 +48,10 @@ <div class="execution"> <form> <button type="button" id="play-btn" title="Play">▶</button> + <label> + <input type="checkbox" id="rotate-check" /> + Rotate Tree + </label> </form> <canvas id="preview"></canvas> </div> @@ -58,13 +62,14 @@ attribute vec3 pos; attribute vec4 colorIn; uniform float pointSize; +uniform mat4 vMatrix; varying vec4 color; void main() { gl_PointSize = pointSize; color = colorIn; - gl_Position = vec4(pos.xyz, 3.0); + gl_Position = vMatrix * vec4(pos.xyz, 3.0); } </script> <script id="fshader" type="x-shader/x-fragment"> diff --git a/preview/render.js b/preview/render.js index 2819d17..86bec1b 100644 --- a/preview/render.js +++ b/preview/render.js @@ -101,15 +101,31 @@ async function runProgram() { } gl.useProgram(program); + let lastColors = new Uint8Array(500 * 4); + + let angleZ = 0; + /** * @param {Uint8Array} colors */ function renderPixels(colors) { + lastColors = colors; + gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); gl.clearColor(0.05, 0.05, 0.05, 1); gl.clear(gl.COLOR_BUFFER_BIT); + const vMatrixLoc = gl.getUniformLocation(program, 'vMatrix'); + var cos = Math.cos(angleZ); + var sin = Math.sin(angleZ); + gl.uniformMatrix4fv(vMatrixLoc, false, [ + cos, 0, sin, 0, + 0, 1, 0, 0, + -sin, 0, cos, 0, + 0, 0, 0, 1, + ]); + const colorOffset = vertices.byteLength; const buffer = gl.createBuffer(); @@ -238,6 +254,33 @@ var $builtinmodule = ${function () { handleRunButtonClick(); + let shouldRotate = false; + document.getElementById('rotate-check').addEventListener('click', (e) => { + if (shouldRotate) { + shouldRotate = false; + return; + } + + let lastT = 0; + shouldRotate = true; + function doRotate(t) { + if (!shouldRotate) return; + + if (lastT === 0) { + lastT = t; + } else { + const dt = t - lastT; + lastT = t; + + const scaledInc = dt * 0.001; + angleZ = (angleZ + scaledInc) % 360; + renderPixels(lastColors); + } + requestAnimationFrame(doRotate); + } + requestAnimationFrame(doRotate); + }); + document.getElementById('play-btn').addEventListener('click', (e) => { handleRunButtonClick(); }); From 1fbfd8c68e3df49c1e506ac5df64e355b10232fc Mon Sep 17 00:00:00 2001 From: Evgeniy Raev <evgeni.raev@dhl.com> Date: Fri, 25 Dec 2020 21:50:16 +0200 Subject: [PATCH 08/14] fixing the preview --- preview/index.html | 8 ++- preview/render.js | 171 +++++++++++++++++++++------------------------ 2 files changed, 83 insertions(+), 96 deletions(-) diff --git a/preview/index.html b/preview/index.html index 0b3cf70..22c65c4 100644 --- a/preview/index.html +++ b/preview/index.html @@ -32,7 +32,7 @@ height: 100%; } -canvas#preview { +#preview, canvas { width: 100%; height: 100%; } @@ -49,11 +49,12 @@ <form> <button type="button" id="play-btn" title="Play">▶</button> <label> - <input type="checkbox" id="rotate-check" /> + <input type="checkbox" id="rotate-check" checked /> Rotate Tree </label> </form> - <canvas id="preview"></canvas> + <div id="preview"> + </div> </div> </main> <pre id="output"></pre> @@ -87,4 +88,5 @@ <script src="skulpt-stdlib.js" type="text/javascript"></script> <script src="codemirror.min.js" type="text/javascript"></script> <script src="mode/python/python.js" type="text/javascript"></script> +<script src="https://threejs.org/build/three.js"></script> <script type="module" src="render.js" async></script> diff --git a/preview/render.js b/preview/render.js index 86bec1b..e89dfa0 100644 --- a/preview/render.js +++ b/preview/render.js @@ -1,5 +1,7 @@ globalThis.treeShowDelayMs = 250; + + function createShader(gl, type, source) { const shader = gl.createShader(type); gl.shaderSource(shader, source); @@ -17,15 +19,7 @@ function loadVertices() { const text = document.querySelector('pre.coords').textContent; const lines = text.split(/\n/g).filter(Boolean).map(line => JSON.parse(line)); - const vertices = new Float32Array(lines.length * 3); - for (let i = 0; i < lines.length; ++i) { - const offset = i * 3; - vertices[offset + 0] = lines[i][1] * 0.005; - vertices[offset + 1] = lines[i][2] * 0.005; - vertices[offset + 2] = lines[i][0] * 0.005; - } - - return vertices; + return lines; } /** @@ -61,7 +55,11 @@ async function runProgram() { /** * Load initial data: */ - const coordsSource = await fetch('../coords.txt').then(res => res.text()); + + + const coordsSource = await fetch('../coords.txt') + .then(res => res.text()) + document.querySelector('pre.coords').textContent = coordsSource + '\n'; if (location.hash.length > 1) { @@ -79,27 +77,50 @@ async function runProgram() { const vertices = loadVertices(); + + //document.body.appendChild( renderer.domElement ); + /** @type {HTMLCanvasElement} */ const preview = document.getElementById('preview'); - const gl = preview.getContext('webgl'); - gl.enable(gl.DEPTH_TEST); - gl.enable(gl.BLEND); - gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); - - const program = gl.createProgram(); - { - const vertexShaderSource = document.getElementById('vshader').text; - const fragmentShaderSource = document.getElementById('fshader').text; - const vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexShaderSource); - const fragmentShader = createShader(gl, gl.FRAGMENT_SHADER, fragmentShaderSource); - gl.attachShader(program, vertexShader); - gl.attachShader(program, fragmentShader); - gl.linkProgram(program); - - gl.bindAttribLocation(program, 0, 'pos'); - gl.bindAttribLocation(program, 1, 'colorIn'); - } - gl.useProgram(program); + + + var scene = new THREE.Scene(); + var camera = new THREE.PerspectiveCamera( 75, preview.clientWidth/preview.clientHeight, 0.1, 1000 ); + + var renderer = new THREE.WebGLRenderer(); + + renderer.setSize( preview.clientWidth, preview.clientHeight ); + preview.appendChild( renderer.domElement ); + + camera.position.y = -800; + camera.rotation.x = Math.PI/2; + let r = 800; + let angle = 0; + const baseSpeed = 0.003; + var speed = baseSpeed; + + vertices.forEach(([x, y, z]) => { + var geometry = new THREE.SphereGeometry(10); + geometry.translate(x, y, z); + //console.log("hi") + var material = new THREE.MeshBasicMaterial( { color: 0x000000 } ); + var sphere = new THREE.Mesh( geometry, material ); + scene.add( sphere ); + }) + + var animate = function () { + requestAnimationFrame( animate ); + + angle += speed; + + camera.position.y = r * Math.cos(angle) * -1; + camera.position.x = r * Math.sin(angle); + camera.rotation.y = angle; + + renderer.render( scene, camera ); + }; + + animate(); let lastColors = new Uint8Array(500 * 4); @@ -110,42 +131,16 @@ async function runProgram() { */ function renderPixels(colors) { lastColors = colors; + colors.forEach(({r,g,b}, i) => { + let { material } = scene.children[i]; + + if(material) { - gl.viewport(0, 0, - gl.drawingBufferWidth, gl.drawingBufferHeight); - gl.clearColor(0.05, 0.05, 0.05, 1); - gl.clear(gl.COLOR_BUFFER_BIT); - - const vMatrixLoc = gl.getUniformLocation(program, 'vMatrix'); - var cos = Math.cos(angleZ); - var sin = Math.sin(angleZ); - gl.uniformMatrix4fv(vMatrixLoc, false, [ - cos, 0, sin, 0, - 0, 1, 0, 0, - -sin, 0, cos, 0, - 0, 0, 0, 1, - ]); - - const colorOffset = vertices.byteLength; - - const buffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, buffer); - gl.bufferData(gl.ARRAY_BUFFER, colorOffset + colors.byteLength, gl.STATIC_DRAW); - gl.bufferSubData(gl.ARRAY_BUFFER, 0, vertices); - gl.bufferSubData(gl.ARRAY_BUFFER, colorOffset, colors); - - const verticesLoc = gl.getAttribLocation(program, 'pos'); - gl.vertexAttribPointer(verticesLoc, 3, gl.FLOAT, false, 0, 0); - gl.enableVertexAttribArray(verticesLoc); - const colorsLoc = gl.getAttribLocation(program, 'colorIn'); - gl.vertexAttribPointer(colorsLoc, 4, gl.UNSIGNED_BYTE, true, 0, colorOffset); - gl.enableVertexAttribArray(colorsLoc); - - const locPointSize = gl.getUniformLocation(program, 'pointSize'); - gl.uniform1f(locPointSize, 2.0); - gl.drawArrays(gl.POINTS, 0, vertices.length / 3); - - gl.deleteBuffer(buffer); + material.color.setRGB(r/255, g/255, b/255) + material.needsUpdate = true; + } + + }) } globalThis.renderPixels = renderPixels; @@ -165,18 +160,21 @@ var $builtinmodule = ${function () { self.pixelCount = pixelCount; // console.log({kwargs}); // self.autoWrite = kwargs['auto_write'] ?? false; - self.pixels = new Uint8Array(Sk.ffi.remapToJs(pixelCount) * 4); + self.pixels = new Array(Sk.ffi.remapToJs(pixelCount)); } initNeoPixel['co_kwargs'] = true; $loc.__init__ = new Sk.builtin.func(initNeoPixel); $loc.__setitem__ = new Sk.builtin.func((self, offset, value) => { const [r, g, b] = Sk.ffi.remapToJs(value); - const scaledOffset = Sk.ffi.remapToJs(offset) * 4; - self.pixels[scaledOffset + 1] = r; - self.pixels[scaledOffset + 0] = g; - self.pixels[scaledOffset + 2] = b; - self.pixels[scaledOffset + 3] = 255; // alpha + const scaledOffset = Sk.ffi.remapToJs(offset); + + self.pixels[scaledOffset] = { r, g, b }; + + // self.pixels[scaledOffset + 0] = g; + // self.pixels[scaledOffset + 2] = b; + // self.pixels[scaledOffset + 3] = 255; // alpha + return value; }); @@ -255,30 +253,17 @@ var $builtinmodule = ${function () { handleRunButtonClick(); let shouldRotate = false; - document.getElementById('rotate-check').addEventListener('click', (e) => { - if (shouldRotate) { - shouldRotate = false; - return; - } - - let lastT = 0; - shouldRotate = true; - function doRotate(t) { - if (!shouldRotate) return; - - if (lastT === 0) { - lastT = t; - } else { - const dt = t - lastT; - lastT = t; - - const scaledInc = dt * 0.001; - angleZ = (angleZ + scaledInc) % 360; - renderPixels(lastColors); - } - requestAnimationFrame(doRotate); + document.getElementById('rotate-check').addEventListener('change', (e) => { + + let { target: { checked }} = e; + + //debugger; + if( checked ) { + speed = baseSpeed; + } else { + speed = 0; } - requestAnimationFrame(doRotate); + }); document.getElementById('play-btn').addEventListener('click', (e) => { From 61bf6c3f64d9e172cb19d3e01159b44bb1ba816c Mon Sep 17 00:00:00 2001 From: Evgeniy Raev <evgeni.raev@dhl.com> Date: Fri, 25 Dec 2020 21:55:40 +0200 Subject: [PATCH 09/14] removing tem files --- index.html | 9 --------- script.js | 47 ----------------------------------------------- style.css | 5 ----- 3 files changed, 61 deletions(-) delete mode 100644 index.html delete mode 100644 script.js delete mode 100644 style.css diff --git a/index.html b/index.html deleted file mode 100644 index 369fde2..0000000 --- a/index.html +++ /dev/null @@ -1,9 +0,0 @@ -<html> - <head> - <script src="https://threejs.org/build/three.js"></script> - <script async=false defer=false src="./script.js"></script> - <link rel="stylesheet" href="./style.css"> - </head> - <body> - </body> -</html> \ No newline at end of file diff --git a/script.js b/script.js deleted file mode 100644 index 170647e..0000000 --- a/script.js +++ /dev/null @@ -1,47 +0,0 @@ -var scene = new THREE.Scene(); -var camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 1000 ); - -var renderer = new THREE.WebGLRenderer(); -renderer.setSize( window.innerWidth, window.innerHeight ); -document.body.appendChild( renderer.domElement ); - -fetch('./coords.txt') - .then(response => { - return response.text() - }) - .then(t => { - return t.split(/\n|\r/g) - .filter(e => e.length > 0) - .map(el => JSON.parse(el)) - }) - .then(data => { - prepareScere(data); - animate() - }); - -var prepareScere = function (data) { - data.forEach(([x, y, z]) => { - var geometry = new THREE.SphereGeometry(10); - geometry.translate(x, y, z); - var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); - var sphere = new THREE.Mesh( geometry, material ); - scene.add( sphere ); - }) -} - -camera.position.y = -800; -camera.rotation.x = Math.PI/2; -let r = 800; -let angle = 0; - -var animate = function () { - requestAnimationFrame( animate ); - - angle += 0.02; - - camera.position.y = r * Math.cos(angle) * -1; - camera.position.x = r * Math.sin(angle); - camera.rotation.y = angle; - - renderer.render( scene, camera ); -}; \ No newline at end of file diff --git a/style.css b/style.css deleted file mode 100644 index 3bcc6ba..0000000 --- a/style.css +++ /dev/null @@ -1,5 +0,0 @@ -body { margin: 0; } -canvas { - width: 100%; - height: 100% -} \ No newline at end of file From bd5700ab9fe241f953f977e7441c1594d5b1a017 Mon Sep 17 00:00:00 2001 From: Evgeniy Raev <evgeni.raev@dhl.com> Date: Fri, 25 Dec 2020 22:33:49 +0200 Subject: [PATCH 10/14] adding controlls adding rotations speed max brightness for better vizualization and background color --- preview/index.html | 12 ++++++++++++ preview/render.js | 40 +++++++++++++++++++++++++++++++--------- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/preview/index.html b/preview/index.html index 22c65c4..9b3f99f 100644 --- a/preview/index.html +++ b/preview/index.html @@ -52,6 +52,18 @@ <input type="checkbox" id="rotate-check" checked /> Rotate Tree </label> + <label> + <input type="number" id="rotation-speed" value="0.003" step="0.001" /> + Rotation speed + </label> + <label> + <input type="number" id="max-brightness" min=0 max=255 value="50" /> + Max Brightness + </label> + <label> + <input type="color" id="background-color" value="0x000000" /> + Background Color + </label> </form> <div id="preview"> </div> diff --git a/preview/render.js b/preview/render.js index e89dfa0..ecffa8d 100644 --- a/preview/render.js +++ b/preview/render.js @@ -85,6 +85,7 @@ async function runProgram() { var scene = new THREE.Scene(); + scene.background = new THREE.Color( 0x0 ); var camera = new THREE.PerspectiveCamera( 75, preview.clientWidth/preview.clientHeight, 0.1, 1000 ); var renderer = new THREE.WebGLRenderer(); @@ -96,11 +97,12 @@ async function runProgram() { camera.rotation.x = Math.PI/2; let r = 800; let angle = 0; - const baseSpeed = 0.003; + var baseSpeed = 0.003; + var maxBrightness = 50; var speed = baseSpeed; vertices.forEach(([x, y, z]) => { - var geometry = new THREE.SphereGeometry(10); + var geometry = new THREE.SphereGeometry(3); geometry.translate(x, y, z); //console.log("hi") var material = new THREE.MeshBasicMaterial( { color: 0x000000 } ); @@ -136,7 +138,7 @@ async function runProgram() { if(material) { - material.color.setRGB(r/255, g/255, b/255) + material.color.setRGB(r/maxBrightness, g/maxBrightness, b/maxBrightness) material.needsUpdate = true; } @@ -166,15 +168,11 @@ var $builtinmodule = ${function () { $loc.__init__ = new Sk.builtin.func(initNeoPixel); $loc.__setitem__ = new Sk.builtin.func((self, offset, value) => { - const [r, g, b] = Sk.ffi.remapToJs(value); + const [g, r, b] = Sk.ffi.remapToJs(value); const scaledOffset = Sk.ffi.remapToJs(offset); self.pixels[scaledOffset] = { r, g, b }; - // self.pixels[scaledOffset + 0] = g; - // self.pixels[scaledOffset + 2] = b; - // self.pixels[scaledOffset + 3] = 255; // alpha - return value; }); @@ -257,7 +255,6 @@ var $builtinmodule = ${function () { let { target: { checked }} = e; - //debugger; if( checked ) { speed = baseSpeed; } else { @@ -266,6 +263,31 @@ var $builtinmodule = ${function () { }); + document.getElementById('rotation-speed').addEventListener('change', (e) => { + + let { target: { value }} = e; + + baseSpeed = Number(value) + if(speed != 0) { + speed = baseSpeed; + } + + }); + + document.getElementById('max-brightness').addEventListener('change', (e) => { + + let { target: { value }} = e; + + maxBrightness = Number(value) + }); + + document.getElementById('background-color').addEventListener('change', (e) => { + + let { target: { value }} = e; + //debugger; + scene.background.setHex(parseInt(value.replace("#", "0x"))) + }); + document.getElementById('play-btn').addEventListener('click', (e) => { handleRunButtonClick(); }); From e3d8b5a6c88f7e8ee315160a8791c419dc21443c Mon Sep 17 00:00:00 2001 From: Evgeniy Raev <evgeni.raev@dhl.com> Date: Sat, 26 Dec 2020 01:21:27 +0200 Subject: [PATCH 11/14] adding orbital controlls now the user can scroll to zoom and drag to rotate around the tree --- preview/OrbitControls.js | 1220 ++++++++++++++++++++++++++++++++++++++ preview/index.html | 5 +- preview/render.js | 37 +- 3 files changed, 1237 insertions(+), 25 deletions(-) create mode 100644 preview/OrbitControls.js diff --git a/preview/OrbitControls.js b/preview/OrbitControls.js new file mode 100644 index 0000000..c0b34bd --- /dev/null +++ b/preview/OrbitControls.js @@ -0,0 +1,1220 @@ +let { + EventDispatcher, + MOUSE, + Quaternion, + Spherical, + TOUCH, + Vector2, + Vector3 +} = THREE + + +// This set of controls performs orbiting, dollying (zooming), and panning. +// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default). +// +// Orbit - left mouse / touch: one-finger move +// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish +// Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move + +var OrbitControls = function ( object, domElement ) { + + if ( domElement === undefined ) console.warn( 'THREE.OrbitControls: The second parameter "domElement" is now mandatory.' ); + if ( domElement === document ) console.error( 'THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.' ); + + this.object = object; + this.domElement = domElement; + + // Set to false to disable this control + this.enabled = true; + + // "target" sets the location of focus, where the object orbits around + this.target = new Vector3(); + + // How far you can dolly in and out ( PerspectiveCamera only ) + this.minDistance = 0; + this.maxDistance = Infinity; + + // How far you can zoom in and out ( OrthographicCamera only ) + this.minZoom = 0; + this.maxZoom = Infinity; + + // How far you can orbit vertically, upper and lower limits. + // Range is 0 to Math.PI radians. + this.minPolarAngle = 0; // radians + this.maxPolarAngle = Math.PI; // radians + + // How far you can orbit horizontally, upper and lower limits. + // If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI ) + this.minAzimuthAngle = - Infinity; // radians + this.maxAzimuthAngle = Infinity; // radians + + // Set to true to enable damping (inertia) + // If damping is enabled, you must call controls.update() in your animation loop + this.enableDamping = false; + this.dampingFactor = 0.05; + + // This option actually enables dollying in and out; left as "zoom" for backwards compatibility. + // Set to false to disable zooming + this.enableZoom = true; + this.zoomSpeed = 1.0; + + // Set to false to disable rotating + this.enableRotate = true; + this.rotateSpeed = 1.0; + + // Set to false to disable panning + this.enablePan = true; + this.panSpeed = 1.0; + this.screenSpacePanning = true; // if false, pan orthogonal to world-space direction camera.up + this.keyPanSpeed = 7.0; // pixels moved per arrow key push + + // Set to true to automatically rotate around the target + // If auto-rotate is enabled, you must call controls.update() in your animation loop + this.autoRotate = false; + this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60 + + // Set to false to disable use of the keys + this.enableKeys = true; + + // The four arrow keys + this.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 }; + + // Mouse buttons + this.mouseButtons = { LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.PAN }; + + // Touch fingers + this.touches = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN }; + + // for reset + this.target0 = this.target.clone(); + this.position0 = this.object.position.clone(); + this.zoom0 = this.object.zoom; + + // + // public methods + // + + this.getPolarAngle = function () { + + return spherical.phi; + + }; + + this.getAzimuthalAngle = function () { + + return spherical.theta; + + }; + + this.saveState = function () { + + scope.target0.copy( scope.target ); + scope.position0.copy( scope.object.position ); + scope.zoom0 = scope.object.zoom; + + }; + + this.reset = function () { + + scope.target.copy( scope.target0 ); + scope.object.position.copy( scope.position0 ); + scope.object.zoom = scope.zoom0; + + scope.object.updateProjectionMatrix(); + scope.dispatchEvent( changeEvent ); + + scope.update(); + + state = STATE.NONE; + + }; + + // this method is exposed, but perhaps it would be better if we can make it private... + this.update = function () { + + var offset = new Vector3(); + + // so camera.up is the orbit axis + var quat = new Quaternion().setFromUnitVectors( object.up, new Vector3( 0, 1, 0 ) ); + var quatInverse = quat.clone().invert(); + + var lastPosition = new Vector3(); + var lastQuaternion = new Quaternion(); + + var twoPI = 2 * Math.PI; + + return function update() { + + var position = scope.object.position; + + offset.copy( position ).sub( scope.target ); + + // rotate offset to "y-axis-is-up" space + offset.applyQuaternion( quat ); + + // angle from z-axis around y-axis + spherical.setFromVector3( offset ); + + if ( scope.autoRotate && state === STATE.NONE ) { + + rotateLeft( getAutoRotationAngle() ); + + } + + if ( scope.enableDamping ) { + + spherical.theta += sphericalDelta.theta * scope.dampingFactor; + spherical.phi += sphericalDelta.phi * scope.dampingFactor; + + } else { + + spherical.theta += sphericalDelta.theta; + spherical.phi += sphericalDelta.phi; + + } + + // restrict theta to be between desired limits + + var min = scope.minAzimuthAngle; + var max = scope.maxAzimuthAngle; + + if ( isFinite( min ) && isFinite( max ) ) { + + if ( min < - Math.PI ) min += twoPI; else if ( min > Math.PI ) min -= twoPI; + + if ( max < - Math.PI ) max += twoPI; else if ( max > Math.PI ) max -= twoPI; + + if ( min <= max ) { + + spherical.theta = Math.max( min, Math.min( max, spherical.theta ) ); + + } else { + + spherical.theta = ( spherical.theta > ( min + max ) / 2 ) ? + Math.max( min, spherical.theta ) : + Math.min( max, spherical.theta ); + + } + + } + + // restrict phi to be between desired limits + spherical.phi = Math.max( scope.minPolarAngle, Math.min( scope.maxPolarAngle, spherical.phi ) ); + + spherical.makeSafe(); + + + spherical.radius *= scale; + + // restrict radius to be between desired limits + spherical.radius = Math.max( scope.minDistance, Math.min( scope.maxDistance, spherical.radius ) ); + + // move target to panned location + + if ( scope.enableDamping === true ) { + + scope.target.addScaledVector( panOffset, scope.dampingFactor ); + + } else { + + scope.target.add( panOffset ); + + } + + offset.setFromSpherical( spherical ); + + // rotate offset back to "camera-up-vector-is-up" space + offset.applyQuaternion( quatInverse ); + + position.copy( scope.target ).add( offset ); + + scope.object.lookAt( scope.target ); + + if ( scope.enableDamping === true ) { + + sphericalDelta.theta *= ( 1 - scope.dampingFactor ); + sphericalDelta.phi *= ( 1 - scope.dampingFactor ); + + panOffset.multiplyScalar( 1 - scope.dampingFactor ); + + } else { + + sphericalDelta.set( 0, 0, 0 ); + + panOffset.set( 0, 0, 0 ); + + } + + scale = 1; + + // update condition is: + // min(camera displacement, camera rotation in radians)^2 > EPS + // using small-angle approximation cos(x/2) = 1 - x^2 / 8 + + if ( zoomChanged || + lastPosition.distanceToSquared( scope.object.position ) > EPS || + 8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) { + + scope.dispatchEvent( changeEvent ); + + lastPosition.copy( scope.object.position ); + lastQuaternion.copy( scope.object.quaternion ); + zoomChanged = false; + + return true; + + } + + return false; + + }; + + }(); + + this.dispose = function () { + + scope.domElement.removeEventListener( 'contextmenu', onContextMenu, false ); + + scope.domElement.removeEventListener( 'pointerdown', onPointerDown, false ); + scope.domElement.removeEventListener( 'wheel', onMouseWheel, false ); + + scope.domElement.removeEventListener( 'touchstart', onTouchStart, false ); + scope.domElement.removeEventListener( 'touchend', onTouchEnd, false ); + scope.domElement.removeEventListener( 'touchmove', onTouchMove, false ); + + scope.domElement.ownerDocument.removeEventListener( 'pointermove', onPointerMove, false ); + scope.domElement.ownerDocument.removeEventListener( 'pointerup', onPointerUp, false ); + + scope.domElement.removeEventListener( 'keydown', onKeyDown, false ); + + //scope.dispatchEvent( { type: 'dispose' } ); // should this be added here? + + }; + + // + // internals + // + + var scope = this; + + var changeEvent = { type: 'change' }; + var startEvent = { type: 'start' }; + var endEvent = { type: 'end' }; + + var STATE = { + NONE: - 1, + ROTATE: 0, + DOLLY: 1, + PAN: 2, + TOUCH_ROTATE: 3, + TOUCH_PAN: 4, + TOUCH_DOLLY_PAN: 5, + TOUCH_DOLLY_ROTATE: 6 + }; + + var state = STATE.NONE; + + var EPS = 0.000001; + + // current position in spherical coordinates + var spherical = new Spherical(); + var sphericalDelta = new Spherical(); + + var scale = 1; + var panOffset = new Vector3(); + var zoomChanged = false; + + var rotateStart = new Vector2(); + var rotateEnd = new Vector2(); + var rotateDelta = new Vector2(); + + var panStart = new Vector2(); + var panEnd = new Vector2(); + var panDelta = new Vector2(); + + var dollyStart = new Vector2(); + var dollyEnd = new Vector2(); + var dollyDelta = new Vector2(); + + function getAutoRotationAngle() { + + return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed; + + } + + function getZoomScale() { + + return Math.pow( 0.95, scope.zoomSpeed ); + + } + + function rotateLeft( angle ) { + + sphericalDelta.theta -= angle; + + } + + function rotateUp( angle ) { + + sphericalDelta.phi -= angle; + + } + + var panLeft = function () { + + var v = new Vector3(); + + return function panLeft( distance, objectMatrix ) { + + v.setFromMatrixColumn( objectMatrix, 0 ); // get X column of objectMatrix + v.multiplyScalar( - distance ); + + panOffset.add( v ); + + }; + + }(); + + var panUp = function () { + + var v = new Vector3(); + + return function panUp( distance, objectMatrix ) { + + if ( scope.screenSpacePanning === true ) { + + v.setFromMatrixColumn( objectMatrix, 1 ); + + } else { + + v.setFromMatrixColumn( objectMatrix, 0 ); + v.crossVectors( scope.object.up, v ); + + } + + v.multiplyScalar( distance ); + + panOffset.add( v ); + + }; + + }(); + + // deltaX and deltaY are in pixels; right and down are positive + var pan = function () { + + var offset = new Vector3(); + + return function pan( deltaX, deltaY ) { + + var element = scope.domElement; + + if ( scope.object.isPerspectiveCamera ) { + + // perspective + var position = scope.object.position; + offset.copy( position ).sub( scope.target ); + var targetDistance = offset.length(); + + // half of the fov is center to top of screen + targetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 ); + + // we use only clientHeight here so aspect ratio does not distort speed + panLeft( 2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix ); + panUp( 2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix ); + + } else if ( scope.object.isOrthographicCamera ) { + + // orthographic + panLeft( deltaX * ( scope.object.right - scope.object.left ) / scope.object.zoom / element.clientWidth, scope.object.matrix ); + panUp( deltaY * ( scope.object.top - scope.object.bottom ) / scope.object.zoom / element.clientHeight, scope.object.matrix ); + + } else { + + // camera neither orthographic nor perspective + console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' ); + scope.enablePan = false; + + } + + }; + + }(); + + function dollyOut( dollyScale ) { + + if ( scope.object.isPerspectiveCamera ) { + + scale /= dollyScale; + + } else if ( scope.object.isOrthographicCamera ) { + + scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom * dollyScale ) ); + scope.object.updateProjectionMatrix(); + zoomChanged = true; + + } else { + + console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' ); + scope.enableZoom = false; + + } + + } + + function dollyIn( dollyScale ) { + + if ( scope.object.isPerspectiveCamera ) { + + scale *= dollyScale; + + } else if ( scope.object.isOrthographicCamera ) { + + scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / dollyScale ) ); + scope.object.updateProjectionMatrix(); + zoomChanged = true; + + } else { + + console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' ); + scope.enableZoom = false; + + } + + } + + // + // event callbacks - update the object state + // + + function handleMouseDownRotate( event ) { + + rotateStart.set( event.clientX, event.clientY ); + + } + + function handleMouseDownDolly( event ) { + + dollyStart.set( event.clientX, event.clientY ); + + } + + function handleMouseDownPan( event ) { + + panStart.set( event.clientX, event.clientY ); + + } + + function handleMouseMoveRotate( event ) { + + rotateEnd.set( event.clientX, event.clientY ); + + rotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed ); + + var element = scope.domElement; + + rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height + + rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight ); + + rotateStart.copy( rotateEnd ); + + scope.update(); + + } + + function handleMouseMoveDolly( event ) { + + dollyEnd.set( event.clientX, event.clientY ); + + dollyDelta.subVectors( dollyEnd, dollyStart ); + + if ( dollyDelta.y > 0 ) { + + dollyOut( getZoomScale() ); + + } else if ( dollyDelta.y < 0 ) { + + dollyIn( getZoomScale() ); + + } + + dollyStart.copy( dollyEnd ); + + scope.update(); + + } + + function handleMouseMovePan( event ) { + + panEnd.set( event.clientX, event.clientY ); + + panDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed ); + + pan( panDelta.x, panDelta.y ); + + panStart.copy( panEnd ); + + scope.update(); + + } + + function handleMouseUp( /*event*/ ) { + + // no-op + + } + + function handleMouseWheel( event ) { + + if ( event.deltaY < 0 ) { + + dollyIn( getZoomScale() ); + + } else if ( event.deltaY > 0 ) { + + dollyOut( getZoomScale() ); + + } + + scope.update(); + + } + + function handleKeyDown( event ) { + + var needsUpdate = false; + + switch ( event.keyCode ) { + + case scope.keys.UP: + pan( 0, scope.keyPanSpeed ); + needsUpdate = true; + break; + + case scope.keys.BOTTOM: + pan( 0, - scope.keyPanSpeed ); + needsUpdate = true; + break; + + case scope.keys.LEFT: + pan( scope.keyPanSpeed, 0 ); + needsUpdate = true; + break; + + case scope.keys.RIGHT: + pan( - scope.keyPanSpeed, 0 ); + needsUpdate = true; + break; + + } + + if ( needsUpdate ) { + + // prevent the browser from scrolling on cursor keys + event.preventDefault(); + + scope.update(); + + } + + + } + + function handleTouchStartRotate( event ) { + + if ( event.touches.length == 1 ) { + + rotateStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); + + } else { + + var x = 0.5 * ( event.touches[ 0 ].pageX + event.touches[ 1 ].pageX ); + var y = 0.5 * ( event.touches[ 0 ].pageY + event.touches[ 1 ].pageY ); + + rotateStart.set( x, y ); + + } + + } + + function handleTouchStartPan( event ) { + + if ( event.touches.length == 1 ) { + + panStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); + + } else { + + var x = 0.5 * ( event.touches[ 0 ].pageX + event.touches[ 1 ].pageX ); + var y = 0.5 * ( event.touches[ 0 ].pageY + event.touches[ 1 ].pageY ); + + panStart.set( x, y ); + + } + + } + + function handleTouchStartDolly( event ) { + + var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX; + var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY; + + var distance = Math.sqrt( dx * dx + dy * dy ); + + dollyStart.set( 0, distance ); + + } + + function handleTouchStartDollyPan( event ) { + + if ( scope.enableZoom ) handleTouchStartDolly( event ); + + if ( scope.enablePan ) handleTouchStartPan( event ); + + } + + function handleTouchStartDollyRotate( event ) { + + if ( scope.enableZoom ) handleTouchStartDolly( event ); + + if ( scope.enableRotate ) handleTouchStartRotate( event ); + + } + + function handleTouchMoveRotate( event ) { + + if ( event.touches.length == 1 ) { + + rotateEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); + + } else { + + var x = 0.5 * ( event.touches[ 0 ].pageX + event.touches[ 1 ].pageX ); + var y = 0.5 * ( event.touches[ 0 ].pageY + event.touches[ 1 ].pageY ); + + rotateEnd.set( x, y ); + + } + + rotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed ); + + var element = scope.domElement; + + rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height + + rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight ); + + rotateStart.copy( rotateEnd ); + + } + + function handleTouchMovePan( event ) { + + if ( event.touches.length == 1 ) { + + panEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); + + } else { + + var x = 0.5 * ( event.touches[ 0 ].pageX + event.touches[ 1 ].pageX ); + var y = 0.5 * ( event.touches[ 0 ].pageY + event.touches[ 1 ].pageY ); + + panEnd.set( x, y ); + + } + + panDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed ); + + pan( panDelta.x, panDelta.y ); + + panStart.copy( panEnd ); + + } + + function handleTouchMoveDolly( event ) { + + var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX; + var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY; + + var distance = Math.sqrt( dx * dx + dy * dy ); + + dollyEnd.set( 0, distance ); + + dollyDelta.set( 0, Math.pow( dollyEnd.y / dollyStart.y, scope.zoomSpeed ) ); + + dollyOut( dollyDelta.y ); + + dollyStart.copy( dollyEnd ); + + } + + function handleTouchMoveDollyPan( event ) { + + if ( scope.enableZoom ) handleTouchMoveDolly( event ); + + if ( scope.enablePan ) handleTouchMovePan( event ); + + } + + function handleTouchMoveDollyRotate( event ) { + + if ( scope.enableZoom ) handleTouchMoveDolly( event ); + + if ( scope.enableRotate ) handleTouchMoveRotate( event ); + + } + + function handleTouchEnd( /*event*/ ) { + + // no-op + + } + + // + // event handlers - FSM: listen for events and reset state + // + + function onPointerDown( event ) { + + if ( scope.enabled === false ) return; + + switch ( event.pointerType ) { + + case 'mouse': + case 'pen': + onMouseDown( event ); + break; + + // TODO touch + + } + + } + + function onPointerMove( event ) { + + if ( scope.enabled === false ) return; + + switch ( event.pointerType ) { + + case 'mouse': + case 'pen': + onMouseMove( event ); + break; + + // TODO touch + + } + + } + + function onPointerUp( event ) { + + switch ( event.pointerType ) { + + case 'mouse': + case 'pen': + onMouseUp( event ); + break; + + // TODO touch + + } + + } + + function onMouseDown( event ) { + + // Prevent the browser from scrolling. + event.preventDefault(); + + // Manually set the focus since calling preventDefault above + // prevents the browser from setting it automatically. + + scope.domElement.focus ? scope.domElement.focus() : window.focus(); + + var mouseAction; + + switch ( event.button ) { + + case 0: + + mouseAction = scope.mouseButtons.LEFT; + break; + + case 1: + + mouseAction = scope.mouseButtons.MIDDLE; + break; + + case 2: + + mouseAction = scope.mouseButtons.RIGHT; + break; + + default: + + mouseAction = - 1; + + } + + switch ( mouseAction ) { + + case MOUSE.DOLLY: + + if ( scope.enableZoom === false ) return; + + handleMouseDownDolly( event ); + + state = STATE.DOLLY; + + break; + + case MOUSE.ROTATE: + + if ( event.ctrlKey || event.metaKey || event.shiftKey ) { + + if ( scope.enablePan === false ) return; + + handleMouseDownPan( event ); + + state = STATE.PAN; + + } else { + + if ( scope.enableRotate === false ) return; + + handleMouseDownRotate( event ); + + state = STATE.ROTATE; + + } + + break; + + case MOUSE.PAN: + + if ( event.ctrlKey || event.metaKey || event.shiftKey ) { + + if ( scope.enableRotate === false ) return; + + handleMouseDownRotate( event ); + + state = STATE.ROTATE; + + } else { + + if ( scope.enablePan === false ) return; + + handleMouseDownPan( event ); + + state = STATE.PAN; + + } + + break; + + default: + + state = STATE.NONE; + + } + + if ( state !== STATE.NONE ) { + + scope.domElement.ownerDocument.addEventListener( 'pointermove', onPointerMove, false ); + scope.domElement.ownerDocument.addEventListener( 'pointerup', onPointerUp, false ); + + scope.dispatchEvent( startEvent ); + + } + + } + + function onMouseMove( event ) { + + if ( scope.enabled === false ) return; + + event.preventDefault(); + + switch ( state ) { + + case STATE.ROTATE: + + if ( scope.enableRotate === false ) return; + + handleMouseMoveRotate( event ); + + break; + + case STATE.DOLLY: + + if ( scope.enableZoom === false ) return; + + handleMouseMoveDolly( event ); + + break; + + case STATE.PAN: + + if ( scope.enablePan === false ) return; + + handleMouseMovePan( event ); + + break; + + } + + } + + function onMouseUp( event ) { + + scope.domElement.ownerDocument.removeEventListener( 'pointermove', onPointerMove, false ); + scope.domElement.ownerDocument.removeEventListener( 'pointerup', onPointerUp, false ); + + if ( scope.enabled === false ) return; + + handleMouseUp( event ); + + scope.dispatchEvent( endEvent ); + + state = STATE.NONE; + + } + + function onMouseWheel( event ) { + + if ( scope.enabled === false || scope.enableZoom === false || ( state !== STATE.NONE && state !== STATE.ROTATE ) ) return; + + event.preventDefault(); + event.stopPropagation(); + + scope.dispatchEvent( startEvent ); + + handleMouseWheel( event ); + + scope.dispatchEvent( endEvent ); + + } + + function onKeyDown( event ) { + + if ( scope.enabled === false || scope.enableKeys === false || scope.enablePan === false ) return; + + handleKeyDown( event ); + + } + + function onTouchStart( event ) { + + if ( scope.enabled === false ) return; + + event.preventDefault(); // prevent scrolling + + switch ( event.touches.length ) { + + case 1: + + switch ( scope.touches.ONE ) { + + case TOUCH.ROTATE: + + if ( scope.enableRotate === false ) return; + + handleTouchStartRotate( event ); + + state = STATE.TOUCH_ROTATE; + + break; + + case TOUCH.PAN: + + if ( scope.enablePan === false ) return; + + handleTouchStartPan( event ); + + state = STATE.TOUCH_PAN; + + break; + + default: + + state = STATE.NONE; + + } + + break; + + case 2: + + switch ( scope.touches.TWO ) { + + case TOUCH.DOLLY_PAN: + + if ( scope.enableZoom === false && scope.enablePan === false ) return; + + handleTouchStartDollyPan( event ); + + state = STATE.TOUCH_DOLLY_PAN; + + break; + + case TOUCH.DOLLY_ROTATE: + + if ( scope.enableZoom === false && scope.enableRotate === false ) return; + + handleTouchStartDollyRotate( event ); + + state = STATE.TOUCH_DOLLY_ROTATE; + + break; + + default: + + state = STATE.NONE; + + } + + break; + + default: + + state = STATE.NONE; + + } + + if ( state !== STATE.NONE ) { + + scope.dispatchEvent( startEvent ); + + } + + } + + function onTouchMove( event ) { + + if ( scope.enabled === false ) return; + + event.preventDefault(); // prevent scrolling + event.stopPropagation(); + + switch ( state ) { + + case STATE.TOUCH_ROTATE: + + if ( scope.enableRotate === false ) return; + + handleTouchMoveRotate( event ); + + scope.update(); + + break; + + case STATE.TOUCH_PAN: + + if ( scope.enablePan === false ) return; + + handleTouchMovePan( event ); + + scope.update(); + + break; + + case STATE.TOUCH_DOLLY_PAN: + + if ( scope.enableZoom === false && scope.enablePan === false ) return; + + handleTouchMoveDollyPan( event ); + + scope.update(); + + break; + + case STATE.TOUCH_DOLLY_ROTATE: + + if ( scope.enableZoom === false && scope.enableRotate === false ) return; + + handleTouchMoveDollyRotate( event ); + + scope.update(); + + break; + + default: + + state = STATE.NONE; + + } + + } + + function onTouchEnd( event ) { + + if ( scope.enabled === false ) return; + + handleTouchEnd( event ); + + scope.dispatchEvent( endEvent ); + + state = STATE.NONE; + + } + + function onContextMenu( event ) { + + if ( scope.enabled === false ) return; + + event.preventDefault(); + + } + + // + + scope.domElement.addEventListener( 'contextmenu', onContextMenu, false ); + + scope.domElement.addEventListener( 'pointerdown', onPointerDown, false ); + scope.domElement.addEventListener( 'wheel', onMouseWheel, false ); + + scope.domElement.addEventListener( 'touchstart', onTouchStart, false ); + scope.domElement.addEventListener( 'touchend', onTouchEnd, false ); + scope.domElement.addEventListener( 'touchmove', onTouchMove, false ); + + scope.domElement.addEventListener( 'keydown', onKeyDown, false ); + + // force an update at start + + this.update(); + +}; + +OrbitControls.prototype = Object.create( EventDispatcher.prototype ); +OrbitControls.prototype.constructor = OrbitControls; + + +// This set of controls performs orbiting, dollying (zooming), and panning. +// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default). +// This is very similar to OrbitControls, another set of touch behavior +// +// Orbit - right mouse, or left mouse + ctrl/meta/shiftKey / touch: two-finger rotate +// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish +// Pan - left mouse, or arrow keys / touch: one-finger move + +var MapControls = function ( object, domElement ) { + + OrbitControls.call( this, object, domElement ); + + this.screenSpacePanning = false; // pan orthogonal to world-space direction camera.up + + this.mouseButtons.LEFT = MOUSE.PAN; + this.mouseButtons.RIGHT = MOUSE.ROTATE; + + this.touches.ONE = TOUCH.PAN; + this.touches.TWO = TOUCH.DOLLY_ROTATE; + +}; + +MapControls.prototype = Object.create( EventDispatcher.prototype ); +MapControls.prototype.constructor = MapControls; + +//export { OrbitControls, MapControls }; diff --git a/preview/index.html b/preview/index.html index 9b3f99f..ab9ea9b 100644 --- a/preview/index.html +++ b/preview/index.html @@ -53,7 +53,7 @@ Rotate Tree </label> <label> - <input type="number" id="rotation-speed" value="0.003" step="0.001" /> + <input type="number" id="rotation-speed" value="-2" step="0.5" /> Rotation speed </label> <label> @@ -100,5 +100,6 @@ <script src="skulpt-stdlib.js" type="text/javascript"></script> <script src="codemirror.min.js" type="text/javascript"></script> <script src="mode/python/python.js" type="text/javascript"></script> -<script src="https://threejs.org/build/three.js"></script> +<script src="https://threejs.org/build/three.js" type="text/javascript"></script> +<script src="./OrbitControls.js" type="text/javascript"></script> <script type="module" src="render.js" async></script> diff --git a/preview/render.js b/preview/render.js index ecffa8d..7dbf463 100644 --- a/preview/render.js +++ b/preview/render.js @@ -86,25 +86,27 @@ async function runProgram() { var scene = new THREE.Scene(); scene.background = new THREE.Color( 0x0 ); - var camera = new THREE.PerspectiveCamera( 75, preview.clientWidth/preview.clientHeight, 0.1, 1000 ); + var camera = new THREE.PerspectiveCamera( 75, preview.clientWidth/preview.clientHeight, 0.1, 2000 ); var renderer = new THREE.WebGLRenderer(); + + const controls = new OrbitControls( camera, preview ); renderer.setSize( preview.clientWidth, preview.clientHeight ); preview.appendChild( renderer.domElement ); - camera.position.y = -800; - camera.rotation.x = Math.PI/2; - let r = 800; - let angle = 0; - var baseSpeed = 0.003; + //camera.position.y = -800; + //camera.rotation.x = Math.PI/2; + camera.position.set(-800, 480, 140) + controls.update(); + controls.autoRotate = true; + var maxBrightness = 50; - var speed = baseSpeed; + controls.autoRotateSpeed = -2; - vertices.forEach(([x, y, z]) => { + vertices.forEach(([x, z, y]) => { var geometry = new THREE.SphereGeometry(3); geometry.translate(x, y, z); - //console.log("hi") var material = new THREE.MeshBasicMaterial( { color: 0x000000 } ); var sphere = new THREE.Mesh( geometry, material ); scene.add( sphere ); @@ -113,11 +115,7 @@ async function runProgram() { var animate = function () { requestAnimationFrame( animate ); - angle += speed; - - camera.position.y = r * Math.cos(angle) * -1; - camera.position.x = r * Math.sin(angle); - camera.rotation.y = angle; + controls.update(); renderer.render( scene, camera ); }; @@ -255,11 +253,7 @@ var $builtinmodule = ${function () { let { target: { checked }} = e; - if( checked ) { - speed = baseSpeed; - } else { - speed = 0; - } + controls.autoRotate = checked; }); @@ -267,10 +261,7 @@ var $builtinmodule = ${function () { let { target: { value }} = e; - baseSpeed = Number(value) - if(speed != 0) { - speed = baseSpeed; - } + controls.autoRotateSpeed = Number(value) }); From c5ff86c4a983de64f7f9fa3cc2be5b8ec03f36a5 Mon Sep 17 00:00:00 2001 From: Evgeniy Raev <evgeni.raev@dhl.com> Date: Sat, 26 Dec 2020 01:50:35 +0200 Subject: [PATCH 12/14] adding floor --- preview/render.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/preview/render.js b/preview/render.js index 7dbf463..a548446 100644 --- a/preview/render.js +++ b/preview/render.js @@ -104,6 +104,8 @@ async function runProgram() { var maxBrightness = 50; controls.autoRotateSpeed = -2; + + vertices.forEach(([x, z, y]) => { var geometry = new THREE.SphereGeometry(3); geometry.translate(x, y, z); @@ -112,6 +114,32 @@ async function runProgram() { scene.add( sphere ); }) + const material = new THREE.LineBasicMaterial({ + color: 0x00FF00 + }); + for (var i = 0; i < 7; i++) { + const points = []; + points.push( new THREE.Vector3( -300, -450, i*100 - 300 ) ); + points.push( new THREE.Vector3( 300, -450, i*100 - 300 ) ); + + const geometry = new THREE.BufferGeometry().setFromPoints( points ); + + const line = new THREE.Line( geometry, material.clone() ); + scene.add( line ); + } + + for (var i = 0; i < 7; i++) { + const points = []; + points.push( new THREE.Vector3( i*100 - 300, -450, -300) ); + points.push( new THREE.Vector3( i*100 - 300, -450, 300 ) ); + + const geometry = new THREE.BufferGeometry().setFromPoints( points ); + + const line = new THREE.Line( geometry, material.clone() ); + scene.add( line ); + } + + var animate = function () { requestAnimationFrame( animate ); From bb8eab2b56c265b2495fc0c40f48fc54a1bd04f4 Mon Sep 17 00:00:00 2001 From: Will Stott <willstott101@gmail.com> Date: Sun, 27 Dec 2020 12:23:27 +0000 Subject: [PATCH 13/14] Auto-resize preview renderer --- preview/render.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/preview/render.js b/preview/render.js index a548446..a40adcb 100644 --- a/preview/render.js +++ b/preview/render.js @@ -77,9 +77,6 @@ async function runProgram() { const vertices = loadVertices(); - - //document.body.appendChild( renderer.domElement ); - /** @type {HTMLCanvasElement} */ const preview = document.getElementById('preview'); @@ -95,6 +92,14 @@ async function runProgram() { renderer.setSize( preview.clientWidth, preview.clientHeight ); preview.appendChild( renderer.domElement ); + // Auto resize preview renderer. + const resizeObserver = new ResizeObserver(entries => { + preview.width = preview.clientWidth + preview.height = preview.clientHeight + renderer.setSize( preview.clientWidth, preview.clientHeight ); + }); + resizeObserver.observe( preview ); + //camera.position.y = -800; //camera.rotation.x = Math.PI/2; camera.position.set(-800, 480, 140) From 332d5e6aaf068b6b2d4325e5e4403bad988ea5a3 Mon Sep 17 00:00:00 2001 From: Will Stott <willstott101@gmail.com> Date: Sun, 27 Dec 2020 12:27:57 +0000 Subject: [PATCH 14/14] Stop scrollbar appearing when from controls take up two lines. --- preview/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/preview/index.html b/preview/index.html index ab9ea9b..22c2058 100644 --- a/preview/index.html +++ b/preview/index.html @@ -26,6 +26,7 @@ width: 50%; display: flex; flex-direction: column; + overflow: hidden; } .CodeMirror {