(self["webpackChunkWebComponents"] = self["webpackChunkWebComponents"] || []).push([["node_modules_moment_locale_sync_recursive_-runestone_activecode_js_acfactory_js"],{

/***/ 48243:
/*!***************************************************************************************!*\
  !*** ./node_modules/css-loader/dist/cjs.js!./runestone/activecode/css/activecode.css ***!
  \***************************************************************************************/
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_css_loader_dist_runtime_cssWithMappingToString_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/cssWithMappingToString.js */ 94015);
/* harmony import */ var _node_modules_css_loader_dist_runtime_cssWithMappingToString_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_cssWithMappingToString_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ 23645);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_cssWithMappingToString_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".modal-profile {\n    display: none;\n    min-height: 300px;\n    overflow: hidden;\n    width: 700px;\n    padding: 25px;\n    border: 1px solid #fff;\n    box-shadow: 0px 2px 7px #292929;\n    -moz-box-shadow: 0px 2px 7px #292929;\n    -webkit-box-shadow: 0px 2px 7px #292929;\n    border-radius: 10px;\n    -moz-border-radius: 10px;\n    -webkit-border-radius: 10px;\n    background: #f2f2f2;\n    z-index: 50;\n}\n\n.modal-lightsout {\n    display: none;\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    z-index: 25;\n    background: #000;\n}\n\n.modal-close-profile {\n    display: none;\n    position: absolute;\n    height: 43px;\n    width: 43px;\n    /*background-image: url('close.png'); */\n    top: 1px;\n    right: 0.5px;\n}\n\n.ac_actions {\n    text-align: center;\n}\n\n.ac_sep {\n    background: #000;\n    display: inline-block;\n    margin: -15px 10px;\n    width: 1px;\n    height: 35px;\n    padding: 0;\n    border: 0;\n}\n\n.ac_section {\n    position: relative;\n    margin-right: auto;\n    margin-left: auto;\n    max-width: 800px;\n    clear: both;\n}\n\n.ac_section > *:not(.ac_section) {\n    max-width: 500pt;\n    margin-left: auto;\n    margin-right: auto;\n    position: relative;\n}\n\n.ac_section .clearfix {\n    position: initial;\n}\n\n.ac_output {\n    display: none;\n    max-width: 450px;\n    background-color: inherit;\n}\n.ac_output pre {\n    background-color: lightgray;\n}\n\n.ac_caption {\n    text-align: center;\n    font-weight: bold;\n}\n\n.ac_caption_text {\n    font-weight: normal;\n}\n\n.ac_question {\n    background-color: rgb(224, 236, 217);\n    padding-left: 10px;\n    padding-top: 10px;\n    margin: 5px;\n}\n\n.active_out {\n    background-color: #dcdcdc;\n    border-radius: 6px;\n    min-width: 20em;\n    max-height: 300px;\n    overflow: auto;\n}\n\n.visible-ac-canvas {\n    border: 2px solid black;\n}\n\n.ac_section > .col-md-12 {\n    max-width: 100% !important;\n}\n\n.full_width ol {\n    max-width: 100% !important;\n}\n\n.ac-disabled {\n    pointer-events: none;\n}\n\n.ac-feedback {\n    border: 1px solid black;\n    padding: 3px;\n}\n\n.ac_sql_result {\n    background-color: lightgrey;\n    padding: 10px;\n    border-radius: 6px;\n    margin-bottom: 10px;\n}\n\n.ac_sql_result_success {\n    background-color: transparent;\n    color: green;\n    border: 0px;\n    padding: 0px;\n    margin-top: 10px;\n    margin-bottom: 10px;\n    min-height: 0px !important;\n}\n\n.ac_sql_result_failure {\n    background-color: transparent;\n    color: red;\n    border: 0px;\n    padding: 0px;\n    margin-top: 10px;\n    margin-bottom: 10px;\n    min-height: 0px !important;\n}\n", "",{"version":3,"sources":["webpack://./runestone/activecode/css/activecode.css"],"names":[],"mappings":"AAAA;IACI,aAAa;IACb,iBAAiB;IACjB,gBAAgB;IAChB,YAAY;IACZ,aAAa;IACb,sBAAsB;IACtB,+BAA+B;IAC/B,oCAAoC;IACpC,uCAAuC;IACvC,mBAAmB;IACnB,wBAAwB;IACxB,2BAA2B;IAC3B,mBAAmB;IACnB,WAAW;AACf;;AAEA;IACI,aAAa;IACb,kBAAkB;IAClB,MAAM;IACN,OAAO;IACP,WAAW;IACX,WAAW;IACX,gBAAgB;AACpB;;AAEA;IACI,aAAa;IACb,kBAAkB;IAClB,YAAY;IACZ,WAAW;IACX,uCAAuC;IACvC,QAAQ;IACR,YAAY;AAChB;;AAEA;IACI,kBAAkB;AACtB;;AAEA;IACI,gBAAgB;IAChB,qBAAqB;IACrB,kBAAkB;IAClB,UAAU;IACV,YAAY;IACZ,UAAU;IACV,SAAS;AACb;;AAEA;IACI,kBAAkB;IAClB,kBAAkB;IAClB,iBAAiB;IACjB,gBAAgB;IAChB,WAAW;AACf;;AAEA;IACI,gBAAgB;IAChB,iBAAiB;IACjB,kBAAkB;IAClB,kBAAkB;AACtB;;AAEA;IACI,iBAAiB;AACrB;;AAEA;IACI,aAAa;IACb,gBAAgB;IAChB,yBAAyB;AAC7B;AACA;IACI,2BAA2B;AAC/B;;AAEA;IACI,kBAAkB;IAClB,iBAAiB;AACrB;;AAEA;IACI,mBAAmB;AACvB;;AAEA;IACI,oCAAoC;IACpC,kBAAkB;IAClB,iBAAiB;IACjB,WAAW;AACf;;AAEA;IACI,yBAAyB;IACzB,kBAAkB;IAClB,eAAe;IACf,iBAAiB;IACjB,cAAc;AAClB;;AAEA;IACI,uBAAuB;AAC3B;;AAEA;IACI,0BAA0B;AAC9B;;AAEA;IACI,0BAA0B;AAC9B;;AAEA;IACI,oBAAoB;AACxB;;AAEA;IACI,uBAAuB;IACvB,YAAY;AAChB;;AAEA;IACI,2BAA2B;IAC3B,aAAa;IACb,kBAAkB;IAClB,mBAAmB;AACvB;;AAEA;IACI,6BAA6B;IAC7B,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,gBAAgB;IAChB,mBAAmB;IACnB,0BAA0B;AAC9B;;AAEA;IACI,6BAA6B;IAC7B,UAAU;IACV,WAAW;IACX,YAAY;IACZ,gBAAgB;IAChB,mBAAmB;IACnB,0BAA0B;AAC9B","sourcesContent":[".modal-profile {\n    display: none;\n    min-height: 300px;\n    overflow: hidden;\n    width: 700px;\n    padding: 25px;\n    border: 1px solid #fff;\n    box-shadow: 0px 2px 7px #292929;\n    -moz-box-shadow: 0px 2px 7px #292929;\n    -webkit-box-shadow: 0px 2px 7px #292929;\n    border-radius: 10px;\n    -moz-border-radius: 10px;\n    -webkit-border-radius: 10px;\n    background: #f2f2f2;\n    z-index: 50;\n}\n\n.modal-lightsout {\n    display: none;\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    z-index: 25;\n    background: #000;\n}\n\n.modal-close-profile {\n    display: none;\n    position: absolute;\n    height: 43px;\n    width: 43px;\n    /*background-image: url('close.png'); */\n    top: 1px;\n    right: 0.5px;\n}\n\n.ac_actions {\n    text-align: center;\n}\n\n.ac_sep {\n    background: #000;\n    display: inline-block;\n    margin: -15px 10px;\n    width: 1px;\n    height: 35px;\n    padding: 0;\n    border: 0;\n}\n\n.ac_section {\n    position: relative;\n    margin-right: auto;\n    margin-left: auto;\n    max-width: 800px;\n    clear: both;\n}\n\n.ac_section > *:not(.ac_section) {\n    max-width: 500pt;\n    margin-left: auto;\n    margin-right: auto;\n    position: relative;\n}\n\n.ac_section .clearfix {\n    position: initial;\n}\n\n.ac_output {\n    display: none;\n    max-width: 450px;\n    background-color: inherit;\n}\n.ac_output pre {\n    background-color: lightgray;\n}\n\n.ac_caption {\n    text-align: center;\n    font-weight: bold;\n}\n\n.ac_caption_text {\n    font-weight: normal;\n}\n\n.ac_question {\n    background-color: rgb(224, 236, 217);\n    padding-left: 10px;\n    padding-top: 10px;\n    margin: 5px;\n}\n\n.active_out {\n    background-color: #dcdcdc;\n    border-radius: 6px;\n    min-width: 20em;\n    max-height: 300px;\n    overflow: auto;\n}\n\n.visible-ac-canvas {\n    border: 2px solid black;\n}\n\n.ac_section > .col-md-12 {\n    max-width: 100% !important;\n}\n\n.full_width ol {\n    max-width: 100% !important;\n}\n\n.ac-disabled {\n    pointer-events: none;\n}\n\n.ac-feedback {\n    border: 1px solid black;\n    padding: 3px;\n}\n\n.ac_sql_result {\n    background-color: lightgrey;\n    padding: 10px;\n    border-radius: 6px;\n    margin-bottom: 10px;\n}\n\n.ac_sql_result_success {\n    background-color: transparent;\n    color: green;\n    border: 0px;\n    padding: 0px;\n    margin-top: 10px;\n    margin-bottom: 10px;\n    min-height: 0px !important;\n}\n\n.ac_sql_result_failure {\n    background-color: transparent;\n    color: red;\n    border: 0px;\n    padding: 0px;\n    margin-top: 10px;\n    margin-bottom: 10px;\n    min-height: 0px !important;\n}\n"],"sourceRoot":""}]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 46700:
/*!***************************************************!*\
  !*** ./node_modules/moment/locale/ sync ^\.\/.*$ ***!
  \***************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var map = {
	"./af": 42786,
	"./af.js": 42786,
	"./ar": 30867,
	"./ar-dz": 14130,
	"./ar-dz.js": 14130,
	"./ar-kw": 96135,
	"./ar-kw.js": 96135,
	"./ar-ly": 56440,
	"./ar-ly.js": 56440,
	"./ar-ma": 47702,
	"./ar-ma.js": 47702,
	"./ar-sa": 16040,
	"./ar-sa.js": 16040,
	"./ar-tn": 37100,
	"./ar-tn.js": 37100,
	"./ar.js": 30867,
	"./az": 31083,
	"./az.js": 31083,
	"./be": 9808,
	"./be.js": 9808,
	"./bg": 68338,
	"./bg.js": 68338,
	"./bm": 67438,
	"./bm.js": 67438,
	"./bn": 8905,
	"./bn.js": 8905,
	"./bo": 11560,
	"./bo.js": 11560,
	"./br": 1278,
	"./br.js": 1278,
	"./bs": 80622,
	"./bs.js": 80622,
	"./ca": 2468,
	"./ca.js": 2468,
	"./cs": 5822,
	"./cs.js": 5822,
	"./cv": 50877,
	"./cv.js": 50877,
	"./cy": 47373,
	"./cy.js": 47373,
	"./da": 24780,
	"./da.js": 24780,
	"./de": 59740,
	"./de-at": 60217,
	"./de-at.js": 60217,
	"./de-ch": 60894,
	"./de-ch.js": 60894,
	"./de.js": 59740,
	"./dv": 5300,
	"./dv.js": 5300,
	"./el": 50837,
	"./el.js": 50837,
	"./en-au": 78348,
	"./en-au.js": 78348,
	"./en-ca": 77925,
	"./en-ca.js": 77925,
	"./en-gb": 22243,
	"./en-gb.js": 22243,
	"./en-ie": 46436,
	"./en-ie.js": 46436,
	"./en-nz": 76319,
	"./en-nz.js": 76319,
	"./eo": 92915,
	"./eo.js": 92915,
	"./es": 55655,
	"./es-do": 55251,
	"./es-do.js": 55251,
	"./es-us": 71146,
	"./es-us.js": 71146,
	"./es.js": 55655,
	"./et": 5603,
	"./et.js": 5603,
	"./eu": 77763,
	"./eu.js": 77763,
	"./fa": 76959,
	"./fa.js": 76959,
	"./fi": 11897,
	"./fi.js": 11897,
	"./fo": 94694,
	"./fo.js": 94694,
	"./fr": 94470,
	"./fr-ca": 63049,
	"./fr-ca.js": 63049,
	"./fr-ch": 52330,
	"./fr-ch.js": 52330,
	"./fr.js": 94470,
	"./fy": 5044,
	"./fy.js": 5044,
	"./gd": 2101,
	"./gd.js": 2101,
	"./gl": 38794,
	"./gl.js": 38794,
	"./gom-latn": 23168,
	"./gom-latn.js": 23168,
	"./gu": 95349,
	"./gu.js": 95349,
	"./he": 24206,
	"./he.js": 24206,
	"./hi": 30094,
	"./hi.js": 30094,
	"./hr": 30316,
	"./hr.js": 30316,
	"./hu": 22138,
	"./hu.js": 22138,
	"./hy-am": 11423,
	"./hy-am.js": 11423,
	"./id": 29218,
	"./id.js": 29218,
	"./is": 90135,
	"./is.js": 90135,
	"./it": 90626,
	"./it.js": 90626,
	"./ja": 39183,
	"./ja.js": 39183,
	"./jv": 24286,
	"./jv.js": 24286,
	"./ka": 40415,
	"./ka.js": 40415,
	"./kk": 47772,
	"./kk.js": 47772,
	"./km": 18758,
	"./km.js": 18758,
	"./kn": 79282,
	"./kn.js": 79282,
	"./ko": 33730,
	"./ko.js": 33730,
	"./ky": 33291,
	"./ky.js": 33291,
	"./lb": 36841,
	"./lb.js": 36841,
	"./lo": 55466,
	"./lo.js": 55466,
	"./lt": 57010,
	"./lt.js": 57010,
	"./lv": 37595,
	"./lv.js": 37595,
	"./me": 39861,
	"./me.js": 39861,
	"./mi": 35493,
	"./mi.js": 35493,
	"./mk": 95966,
	"./mk.js": 95966,
	"./ml": 87341,
	"./ml.js": 87341,
	"./mr": 10370,
	"./mr.js": 10370,
	"./ms": 9847,
	"./ms-my": 41237,
	"./ms-my.js": 41237,
	"./ms.js": 9847,
	"./mt": 72126,
	"./mt.js": 72126,
	"./my": 56165,
	"./my.js": 56165,
	"./nb": 64924,
	"./nb.js": 64924,
	"./ne": 16744,
	"./ne.js": 16744,
	"./nl": 93901,
	"./nl-be": 59814,
	"./nl-be.js": 59814,
	"./nl.js": 93901,
	"./nn": 83877,
	"./nn.js": 83877,
	"./pa-in": 15858,
	"./pa-in.js": 15858,
	"./pl": 64495,
	"./pl.js": 64495,
	"./pt": 89520,
	"./pt-br": 57971,
	"./pt-br.js": 57971,
	"./pt.js": 89520,
	"./ro": 96459,
	"./ro.js": 96459,
	"./ru": 21793,
	"./ru.js": 21793,
	"./sd": 40950,
	"./sd.js": 40950,
	"./se": 10490,
	"./se.js": 10490,
	"./si": 90124,
	"./si.js": 90124,
	"./sk": 64249,
	"./sk.js": 64249,
	"./sl": 14985,
	"./sl.js": 14985,
	"./sq": 51104,
	"./sq.js": 51104,
	"./sr": 49131,
	"./sr-cyrl": 13709,
	"./sr-cyrl.js": 13709,
	"./sr.js": 49131,
	"./ss": 85893,
	"./ss.js": 85893,
	"./sv": 98760,
	"./sv.js": 98760,
	"./sw": 91172,
	"./sw.js": 91172,
	"./ta": 27333,
	"./ta.js": 27333,
	"./te": 23110,
	"./te.js": 23110,
	"./tet": 52095,
	"./tet.js": 52095,
	"./th": 9041,
	"./th.js": 9041,
	"./tl-ph": 75768,
	"./tl-ph.js": 75768,
	"./tlh": 89444,
	"./tlh.js": 89444,
	"./tr": 72397,
	"./tr.js": 72397,
	"./tzl": 28254,
	"./tzl.js": 28254,
	"./tzm": 51106,
	"./tzm-latn": 30699,
	"./tzm-latn.js": 30699,
	"./tzm.js": 51106,
	"./uk": 67691,
	"./uk.js": 67691,
	"./ur": 13795,
	"./ur.js": 13795,
	"./uz": 6791,
	"./uz-latn": 60588,
	"./uz-latn.js": 60588,
	"./uz.js": 6791,
	"./vi": 65666,
	"./vi.js": 65666,
	"./x-pseudo": 14378,
	"./x-pseudo.js": 14378,
	"./yo": 75805,
	"./yo.js": 75805,
	"./zh-cn": 83839,
	"./zh-cn.js": 83839,
	"./zh-hk": 55726,
	"./zh-hk.js": 55726,
	"./zh-tw": 74152,
	"./zh-tw.js": 74152
};


function webpackContext(req) {
	var id = webpackContextResolve(req);
	return __webpack_require__(id);
}
function webpackContextResolve(req) {
	if(!__webpack_require__.o(map, req)) {
		var e = new Error("Cannot find module '" + req + "'");
		e.code = 'MODULE_NOT_FOUND';
		throw e;
	}
	return map[req];
}
webpackContext.keys = function webpackContextKeys() {
	return Object.keys(map);
};
webpackContext.resolve = webpackContextResolve;
module.exports = webpackContext;
webpackContext.id = 46700;

/***/ }),

/***/ 33592:
/*!*************************************************!*\
  !*** ./runestone/activecode/css/activecode.css ***!
  \*************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! !../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js */ 93379);
/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_css_loader_dist_cjs_js_activecode_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! !!../../../node_modules/css-loader/dist/cjs.js!./activecode.css */ 48243);

            

var options = {};

options.insert = "head";
options.singleton = false;

var update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_node_modules_css_loader_dist_cjs_js_activecode_css__WEBPACK_IMPORTED_MODULE_1__.default, options);



/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_css_loader_dist_cjs_js_activecode_css__WEBPACK_IMPORTED_MODULE_1__.default.locals || {});

/***/ }),

/***/ 86902:
/*!**********************************************!*\
  !*** ./runestone/activecode/js/acfactory.js ***!
  \**********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (/* binding */ ACFactory)
/* harmony export */ });
/* harmony import */ var _activecode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./activecode.js */ 750);
/* harmony import */ var _activecode_js_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./activecode_js.js */ 40653);
/* harmony import */ var _activecode_html_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./activecode_html.js */ 15033);
/* harmony import */ var _activecode_sql_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./activecode_sql.js */ 23538);
/* harmony import */ var _livecode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./livecode.js */ 45425);
/* harmony import */ var _timed_activecode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./timed_activecode */ 12797);
/* harmony import */ var _common_js_jquery_highlight_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../common/js/jquery.highlight.js */ 33194);
/* harmony import */ var _common_js_jquery_highlight_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_common_js_jquery_highlight_js__WEBPACK_IMPORTED_MODULE_6__);








class ACFactory {
    constructor() {
        this.foo = "bar";
    }
    static createActiveCode(orig, lang, addopts) {
        var opts = {
            orig: orig,
            useRunestoneServices: eBookConfig.useRunestoneServices,
            python3: eBookConfig.python3,
        };
        if (addopts) {
            for (var attrname in addopts) {
                opts[attrname] = addopts[attrname];
            }
        }
        if (lang === undefined) {
            lang = $(opts.orig).find("[data-lang]").data("lang");
        }
        if (opts.timed == true) {
            if (lang === "python") {
                return new _timed_activecode__WEBPACK_IMPORTED_MODULE_5__.TimedActiveCode(opts);
            } else if (
                lang === "java" ||
                lang === "cpp" ||
                lang === "c" ||
                lang === "python3"
            ) {
                return new _timed_activecode__WEBPACK_IMPORTED_MODULE_5__.TimedLiveCode(opts);
            } else if (lang === "javascript") {
                return new _timed_activecode__WEBPACK_IMPORTED_MODULE_5__.TimedJSActiveCode(opts);
            } else if (lang === "htmlmixed") {
                return new _timed_activecode__WEBPACK_IMPORTED_MODULE_5__.TimedHTMLActiveCode(opts);
            } else if (lang === "sql") {
                return new _timed_activecode__WEBPACK_IMPORTED_MODULE_5__.TimedSQLActiveCode(opts);
            } else {
                return new _timed_activecode__WEBPACK_IMPORTED_MODULE_5__.TimedActiveCode(opts);
            }
        } else {
            if (lang === "javascript") {
                return new _activecode_js_js__WEBPACK_IMPORTED_MODULE_1__.default(opts);
            } else if (lang === "htmlmixed") {
                return new _activecode_html_js__WEBPACK_IMPORTED_MODULE_2__.default(opts);
            } else if (lang === "sql") {
                return new _activecode_sql_js__WEBPACK_IMPORTED_MODULE_3__.default(opts);
            } else if (
                ["java", "cpp", "c", "python3", "python2", "octave"].indexOf(
                    lang
                ) > -1
            ) {
                return new _livecode_js__WEBPACK_IMPORTED_MODULE_4__.default(opts);
            } else {
                // default is python
                return new _activecode_js__WEBPACK_IMPORTED_MODULE_0__.ActiveCode(opts);
            }
        }
    }
    // used by web2py controller(s)
    static addActiveCodeToDiv(outerdivid, acdivid, sid, initialcode, language) {
        var thepre, newac;
        var acdiv = document.getElementById(acdivid);
        $(acdiv).empty();
        thepre = document.createElement("textarea");
        thepre["data-component"] = "activecode";
        thepre.id = outerdivid;
        $(thepre).data("lang", language);
        $(acdiv).append(thepre);
        var opts = {
            orig: thepre,
            useRunestoneServices: true,
        };
        var addopts = {
            sid: sid,
            graderactive: true,
        };
        if (language === "htmlmixed") {
            addopts["vertical"] = true;
        }
        newac = ACFactory.createActiveCode(thepre, language, addopts);
        var savediv = newac.divid;
        newac.divid = savediv;
        newac.editor.setSize(500, 300);
        setTimeout(function () {
            newac.editor.refresh();
        }, 500);
    }
    static createActiveCodeFromOpts(opts) {
        return ACFactory.createActiveCode(opts.orig, opts.lang, opts);
    }
    static createScratchActivecode() {
        /* set up the scratch Activecode editor in the search menu */
        // use the URL to assign a divid - each page should have a unique Activecode block id.
        // Remove everything from the URL but the course and page name
        // todo:  this could probably be eliminated and simply moved to the template file

        if (eBookConfig.enableScratchAC == false) return;

        var divid = eBookConfig.course + "_scratch_ac";
        divid = divid.replace(/[#.]/g, ""); // in case book title has characters that will mess up our selectors
        eBookConfig.scratchDiv = divid;
        let stdin = "";
        var lang = eBookConfig.acDefaultLanguage
            ? eBookConfig.acDefaultLanguage
            : "python";
        if (lang === "java" || lang === "cpp" || lang === "python3") {
            stdin = `data-stdin="text for stdin"`;
        }
        // generate the HTML
        var html = `<div id="ac_modal_${divid}" class="modal fade">
              <div class="modal-dialog scratch-ac-modal">
                <div class="modal-content">
                  <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title">Scratch ActiveCode</h4>
                  </div>
                  <div class="modal-body">
                  <div data-component="activecode" id=${divid}>
                  <div id=${divid}_question class="ac_question"><p>Use this area for writing code or taking notes.</p></div>
                  <textarea data-codelens="true" data-lang="${lang}" ${stdin}>




                  </textarea>
                  </div>
                  </div>
                </div>
              </div>
            </div>`;
        var el = $(html);
        $("body").append(el);
        el.on("shown.bs.modal show.bs.modal", function () {
            el.find(".CodeMirror").each(function (i, e) {
                e.CodeMirror.refresh();
                e.CodeMirror.focus();
            });
        });
    }
    static toggleScratchActivecode() {
        var divid = "ac_modal_" + eBookConfig.scratchDiv;
        var div = $("#" + divid);
        $(`#${eBookConfig.scratchDiv}`).removeClass("ac_section");
        div.modal("toggle");
    }
}

//
// Page Initialization
//

$(document).bind("runestone:login-complete", function () {
    ACFactory.createScratchActivecode();
    $("[data-component=activecode]").each(function () {
        if ($(this).closest("[data-component=timedAssessment]").length == 0) {
            // If this element exists within a timed component, don't render it here
            try {
                window.edList[this.id] = ACFactory.createActiveCode(
                    this,
                    $(this).find("textarea").data("lang")
                );
            } catch (err) {
                console.log(`Error rendering Activecode Problem ${this.id}
                Details: ${err}`);
            }
        }
    });
    if (loggedout) {
        for (let k in window.edList) {
            window.edList[k].disableSaveLoad();
        }
    } else {
        for (let k in window.edList) {
            window.edList[k].enableSaveLoad();
        }
    }
});

if (typeof window.component_factory === "undefined") {
    window.component_factory = {};
}

window.component_factory.activecode = ACFactory.createActiveCodeFromOpts;

// This is the easiest way to expose this outside the module.
window.ACFactory = ACFactory;

// This seems a bit hacky and possibly brittle, but its hard to know how long it will take to
// figure out the login/logout status of the user.  Sometimes its immediate, and sometimes its
// long.  So to be safe we'll do it both ways..
var loggedout;
$(document).bind("runestone:logout", function () {
    loggedout = true;
});
$(document).bind("runestone:logout", function () {
    for (let k in window.edList) {
        if (window.edList.hasOwnProperty(k)) {
            window.edList[k].disableSaveLoad();
        }
    }
});


/***/ }),

/***/ 40053:
/*!*******************************************************!*\
  !*** ./runestone/activecode/js/activecode-i18n.en.js ***!
  \*******************************************************/
/***/ (() => {

$.i18n().load({
    en: {
        msg_activecode_load_history: "Load History",
        msg_activecode_audio_tour: "Audio Tour",
        msg_activecode_loaded_code: "Loaded your saved code.",
        msg_activecode_no_saved_code: "No saved code.",
        msg_activecode_run_code: "Run",
        msg_activecode_show_feedback: "Show Feedback",
        msg_activecode_show_code: "Show Code",
        msg_activecode_hide_code: "Hide Code",
        msg_activecode_show_codelens: "Show CodeLens",
        msg_activecode_show_in_codelens: "Show in CodeLens",
        msg_activecode_hide_codelens: "Hide Codelens",

        msg_activecode_parse_error:
            "A parse error means that Python does not understand the syntax on the line the error message points out. Common examples are forgetting commas beteween arguments or forgetting a : on a for statement",
        msg_activecode_parse_error_fix:
            "To fix a parse error you just need to look carefully at the line with the error and possibly the line before it.  Make sure it conforms to all of Python's rules.",
        msg_activecode_type_error:
            "Type errors most often occur when an expression tries to combine two objects with types that should not be combined.  Like raising a string to a power",
        msg_activecode_type_error_fix:
            "To fix a type error you will most likely need to trace through your code and make sure the variables have the types you expect them to have.  It may be helpful to print out each variable along the way to be sure its value is what you think it should be.",
        msg_activecode_name_error:
            "A name error almost always means that you have used a variable before it has a value.  Often this may be a simple typo, so check the spelling carefully.",
        msg_activecode_name_error_fix:
            "Check the right hand side of assignment statements and your function calls, this is the most likely place for a NameError to be found.",
        msg_activecode_value_error:
            "A ValueError most often occurs when you pass a parameter to a function and the function is expecting one type and you pass another.",
        msg_activecode_value_error_fix:
            "The error message gives you a pretty good hint about the name of the function as well as the value that is incorrect. Look at the error message closely and then trace back to the variable containing the problematic value.",
        msg_activecode_attribute_error:
            "This error message is telling you that the object on the left hand side of the dot, does not have the attribute or method on the right hand side.",
        msg_activecode_attribute_error_fix:
            "The most common variant of this message is that the object undefined does not have attribute X.  This tells you that the object on the left hand side of the dot is not what you think. Trace the variable back and print it out in various places until you discover where it becomes undefined.  Otherwise check the attribute on the right hand side of the dot for a typo.",
        msg_activecode_token_error:
            "Most of the time this error indicates that you have forgotten a right parenthesis or have forgotten to close a pair of quotes.",
        msg_activecode_token_error_fix:
            "Check each line of your program and make sure that your parenthesis are balanced.",
        msg_activecode_time_limit_error:
            "Your program is running too long.  Most programs in this book should run in less than 10 seconds easily. This probably indicates your program is in an infinite loop.",
        msg_activecode_time_limit_error_fix:
            "Add some print statements to figure out if your program is in an infinte loop.  If it is not you can increase the run time with sys.setExecutionLimit(msecs)",
        msg_activecode_general_error:
            "Your program is running for too long.  Most programs in this book should run in less than 30 seconds easily. This probably indicates your program is in an infinite loop.",
        msg_activecode_general_error_fix:
            "Add some print statements to figure out if your program is in an infinte loop.  If it is not you can increase the run time with sys.setExecutionLimit(msecs)",
        msg_activecode_syntax_error:
            "This message indicates that Python can't figure out the syntax of a particular statement.  Some examples are assigning to a literal, or a function call",
        msg_activecode_syntax_error_fix:
            "Check your assignment statements and make sure that the left hand side of the assignment is a variable, not a literal or a function.",
        msg_activecode_key_error:
            "This message indicates that you are trying to access an element of a dictionary, but the dictionary does not have that the key you are using.",
        msg_activecode_key_error_fix:
            "You may have a typo in the name of your key.  It is also good practice to check if the key exists using a statement like if key in mydict.  You can also use mydict.get(key,defaultvalue) so that if the key is not in the dictionary you get the default value instead of an error.",
        msg_activecode_index_error:
            "This message means that you are trying to index past the end of a string or a list.  For example if your list has 3 things in it and you try to access the item at position 3 or more.",
        msg_activecode_index_error_fix:
            "Remember that the first item in a list or string is at index position 0, quite often this message comes about because you are off by one.  Remember in a list of length 3 the last legal index is 2",
        msg_activecode_uri_error: "",
        msg_activecode_uri_error_fix: "",
        msg_activecode_import_error:
            "This error message indicates that you are trying to import a module that does not exist",
        msg_activecode_import_error_fix:
            "One problem may simply be that you have a typo.  It may also be that you are trying to import a module that exists in 'real' Python, but does not exist in this book.  If this is the case, please submit a feature request to have the module added.",
        msg_activecode_reference_error:
            "This is most likely an internal error, particularly if the message references the console.",
        msg_activecode_reference_error_fix:
            "Try refreshing the webpage, and if the error continues, submit a bug report along with your code",
        msg_activecode_zero_division_error:
            "This tells you that you are trying to divide by 0. Typically this is because the value of the variable in the denominator of a division expression has the value 0",
        msg_activecode_zero_division_error_fix:
            "You may need to protect against dividing by 0 with an if statment, or you may need to rexamine your assumptions about the legal values of variables, it could be an earlier statment that is unexpectedly assigning a value of zero to the variable in question.",
        msg_activecode_range_error:
            "This message almost always shows up in the form of Maximum call stack size exceeded.",
        msg_activecode_range_error_fix:
            "This always occurs when a function calls itself.  Its pretty likely that you are not doing this on purpose. Except in the chapter on recursion.  If you are in that chapter then its likely you haven't identified a good base case.",
        msg_activecode_internal_error:
            "An Internal error may mean that you've triggered a bug in our Python",
        msg_activecode_internal_error_fix:
            "Report this error, along with your code as a bug.",
        msg_activecode_indentation_error:
            "This error occurs when you have not indented your code properly.  This is most likely to happen as part of an if, for, while or def statement.",
        msg_activecode_indentation_error_fix:
            "Check your if, def, for, and while statements to be sure the lines are properly indented beneath them.  Another source of this error comes from copying and pasting code where you have accidentally left some bits of code lying around that don't belong there anymore.",
        msg_activecode_not_implemented_error:
            "This error occurs when you try to use a builtin function of Python that has not been implemented in this in-browser version of Python.",
        msg_activecode_not_implemented_error_fix:
            "For now the only way to fix this is to not use the function.  There may be workarounds.  If you really need this builtin function then file a bug report and tell us how you are trying to use the function.",

        msg_activecode_file_not_found: "File not found: '$1'",
        msg_activecode_no_file_or_dir:
            "[Errno 2] No such file or directory: '$1'",
        msg_activecode_starting: "Click the play button to begin the $1",
        msg_activecode_playing: "Playing the $1",
        msg_activecode_loading_audio:
            "Loading audio.  Please wait.   If the tour doesn't start soon click on the leftmost control button (Play first audio in tour)",
        msg_activecode_pause_current_audio: "Pause current audio",
        msg_activecode_pause_audio: "Pause audio",
        msg_activecode_play_paused_audio: "Play paused audio",
        msg_activecode_audio_paused:
            "The $1 has been paused. Click on the play button to resume the tour.",
        msg_activecode_input_prg: "Input for Program",
        msg_activecode_were_compiling_err:
            "There were errors compiling your code. See below.",
        msg_activecode_time_limit_exc: "Time Limit Exceeded on your program",
        msg_activecode_server_err: "A server error occurred: $1 $2",
        msg_activecode_compiling_running:
            "Compiling and Running your Code Now...",
        msg_activecode_server_comm_err: "Error communicating with the server.",
        msg_activecode_save_run: "Save & Run",
        msg_activecode_render: "Save & Render",
        msg_activecode_assertion_error:
            "An assertion error happens when python encounters an assertion statement.  Python evaluates the expression to the right of the word assert; if that expression is True everything is fine and the program continues.  If the expression is False Python raises an error and stops.",
        msg_activecode_assertion_error_fix:
            "Check the expression to the right of assert.  The expression is False and you will need to determine why that is.  You may want to simply print out the individual parts of the expression to understand why it is evaluating to False.",
        msg_activecode_load_db: "Loading DB...",
    },
});


/***/ }),

/***/ 46108:
/*!**********************************************************!*\
  !*** ./runestone/activecode/js/activecode-i18n.pt-br.js ***!
  \**********************************************************/
/***/ (() => {

$.i18n().load({
    "pt-br": {
        msg_activecode_load_history: "Carregar histórico",
        msg_activecode_audio_tour: "Tour de áudio",
        msg_activecode_loaded_code: "Código salvo carregado.",
        msg_activecode_no_saved_code: "Não há código salvo.",
        msg_activecode_run_code: "Executar",
        msg_activecode_show_feedback: "Exibir Feedbacks",
        msg_activecode_show_code: "Mostrar Código",
        msg_activecode_hide_code: "Ocultar Código",
        msg_activecode_show_codelens: "Mostrar CodeLens",
        msg_activecode_show_in_codelens: "Mostrar em CodeLens",
        msg_activecode_hide_codelens: "Ocultar Codelens",

        msg_activecode_parse_error:
            "Um erro de Parse significa que Python não entende a sintaxe da linha que a mensagem de erro aponta. Exemplos comuns são esquecer vírgulas entre argumentos ou esquecer ':' em um comando for.",
        msg_activecode_parse_error_fix:
            "Para corrigir um erro de Parse, você só precisa olhar cuidadosamente a linha com o erro e possivelmente a linha antes dela. Tenha certeza que estão de acordo com todas as regras de Python.",
        msg_activecode_type_error:
            "Erros de tipagem ocorrem mais frequentemente quando uma expressão tenta combinar dois objetos com tipos que não deveriam ser combinados. Como elevar uma String a uma potência.",
        msg_activecode_type_error_fix:
            "Para corrigir um erro de tipagem você provavelmente precisará percorrer seu código e ter certeza de que as variáveis possuem os tipos que você espera que elas tenham. Pode ser útil imprimir cada variável ao longo do caminho para checar se elas possuem o valor que você acha que deveriam ter.",
        msg_activecode_name_error:
            "Um erro de nome quase sempre significa que você usou uma variável antes dela ter um valor. Frequentemente isso pode ser um erro de digitação, então cheque a ortografia cuidadosamente.",
        msg_activecode_name_error_fix:
            "Cheque o lado direito das atribuições e suas chamadas de funções, são os lugares mais prováveis de encontrar um erro de nome.",
        msg_activecode_value_error:
            "Um erro de valor ocorre mais frequentemente quando uma função está esperando um tipo mas você passa um parâmetro de outro tipo.",
        msg_activecode_value_error_fix:
            "A mensagem de erro te dá uma boa dica sobre o nome da função e o valor incorreto. Leia atentamente a mensagem de erro e volte à variável que contém o valor problemático.",
        msg_activecode_attribute_error:
            "Essa mensagem de erro está te dizendo que o objeto do lado esquerdo do ponto não tem o atributo ou método do seu lado direito.",
        msg_activecode_attribute_error_fix:
            "A variante mais comum dessa mensagem é que o objeto indefinido não tem o atributo X. Isso diz que o objeto do lado esquerdo do ponto não é o que você pensa. Rastreie essa variável e imprima-a em vários lugares até descobrir onde ela se torna indefinida. Caso contrário, cheque se há erro de digitação no atributo do lado direito do ponto.",
        msg_activecode_token_error:
            "Na maioria das vezes este erro indica que você esqueceu de fechar um parênteses ou aspas.",
        msg_activecode_token_error_fix:
            "Cheque cada linha do seu programa e certifique-se de que todos os parênteses estão fechados.",
        msg_activecode_time_limit_error:
            "Seu programa está demorando muito. Os programas deste livro deveriam rodar em menos de 10 segundos. Isso provavelmente indica que seu programa está em um loop infinito.",
        msg_activecode_time_limit_error_fix:
            "Imprima mensagens em algumas linhas para descobrir se seu programa está em um loop infinito. Caso não esteja, você pode aumentar o tempo limite de execução com o comando sys.setExecutionLimit(ms)",
        msg_activecode_general_error:
            "Seu programa está demorando muito. Os programas deste livro deveriam rodar em menos de 30 segundos. Isso provavelmente indica que seu programa está em um loop infinito.",
        msg_activecode_general_error_fix:
            "Imprima mensagens em algumas linhas para descobrir se seu programa está em um loop infinito. Caso não esteja, você pode aumentar o tempo limite de execução com o comando sys.setExecutionLimit(ms)",
        msg_activecode_syntax_error:
            "Esta mensagem indica que Python não entendeu a sintaxe de um comando. Alguns exemplos são atribuição de um literal, ou uma chamada de função",
        msg_activecode_syntax_error_fix:
            "Cheque as atribuições de seu programa e certifique-se de que o lado esquerdo é uma variável, e não um literal ou função.",
        msg_activecode_key_error:
            "Esta mensagem indica que você está tentando acessar um elemento cuja chave não existe no dicionário.",
        msg_activecode_key_error_fix:
            "Você pode ter um erro de digitação no nome da sua chave. É uma boa prática checar se a chave existe usando um comando 'if (chave) in meu_dicionario'. Você também pode usar o comando 'meu_dicionario.get(chave, valorPadrão)' para obter o valor padrão ao invés de um erro caso a chave não exista.",
        msg_activecode_index_error:
            "Você está tentando acessar um índice além do final de uma string ou lista. Por exemplo, se sua lista possui 3 elementos nela e você tenta acessar o item na posição 3 ou mais.",
        msg_activecode_index_error_fix:
            "Lembre-se que o primeiro elemento de uma lista ou string está no índice 0, normalmente esta mensagem é exibida porque você errou o índice por 1. Em uma lista de tamanho 3, o último índice válido é 2",
        msg_activecode_uri_error: "",
        msg_activecode_uri_error_fix: "",
        msg_activecode_import_error:
            "Esta mensagem indica que você está tentando importar um módulo que não existe",
        msg_activecode_import_error_fix:
            "Um problema pode ser apenas um erro de digitação. Também pode ser que você está tentando importar um módulo que existe em Python 'real', mas não existe neste livro. Se este é o caso, por favor envie um pedido para ter esse módulo adicionado.",
        msg_activecode_reference_error:
            "Isso parece ser um erro interno, especialmente se a mensagem faz referência ao console.",
        msg_activecode_reference_error_fix:
            "Tente atualizar a página. Se o erro persistir, envie um relatório de bug junto com seu código",
        msg_activecode_zero_division_error:
            "Isso diz que você está tentando dividir por 0. Normalmente é porque o valor da variável no denominador de uma divisão tem o valor 0",
        msg_activecode_zero_division_error_fix:
            "Você pode proteger contra dividir por 0 com um comando 'if', ou você pode precisar reavaliar suas suposições sobre os valores das variáveis, pois um comando anterior pode ter inesperadamente atribuído o valor 0 a essa variável.",
        msg_activecode_range_error:
            "Esta mensagem quase sempre aparece na forma de 'Tamanho máximo da pilha de chamadas excedido'.",
        msg_activecode_range_error_fix:
            "Isso sempre ocorre quando uma função chama ela mesma. Provavelmente você não está fazendo isso de propósito, exceto no capítulo sobre recursão. Se você está nesse capítulo, então provavelmente ainda não identificou um bom caso base.",
        msg_activecode_internal_error:
            "Um erro interno pode significar que você desencadeou um bug no nosso Python",
        msg_activecode_internal_error_fix:
            "Reporte este erro como um bug, juntamente com seu código",
        msg_activecode_indentation_error:
            "Este erro ocorre quando você não indentou seu código devidamente. Isso é mais provável de ocorrer como parte de um comando if, for, while ou def.",
        msg_activecode_indentation_error_fix:
            "Cheque seus comandos if, def, for e while para ter certeza de que as linhas estão devidamente indentadas abaixo delas. Outra fonte deste erro é copiar e colar código em que você acidentalmente deixou restos de código que não pertencem mais ali.",
        msg_activecode_not_implemented_error:
            "Este erro ocorre quando você tenta usar uma função embutida de Python que não foi implementada nesta versão browser de Python.",
        msg_activecode_not_implemented_error_fix:
            "Por enquanto a única maneira de consertar isso é não usando a função. Podem haver soluções alternativas. Se você realmente precisa desta função embutida, envie-nos um relatório de bug e digac omo está tentando usar a função.",

        msg_activecode_file_not_found: "Arquivo não encontrado: '$1'",
        msg_activecode_no_file_or_dir:
            "[Erro nº 2] Arquivo ou diretório inexistente: '$1'",
        msg_activecode_starting: "Clique no botão de execução para começar $1",
        msg_activecode_playing: "Executando $1",
        msg_activecode_loading_audio:
            "Carregando áudio. Por favor, espere. Se o tour não começar logo, clique em 'Stop Tour' e tente novamente.",
        msg_activecode_pause_current_audio: "Pausar áudio atual",
        msg_activecode_pause_audio: "Pausar áudio",
        msg_activecode_play_paused_audio: "Reproduzir áudio pausado",
        msg_activecode_audio_paused:
            "$1 foi pausado. Clique no botão de execução para retomar o tour.",
        msg_activecode_input_prg: "Entrada para o programa",
        msg_activecode_were_compiling_err:
            "Houveram erros ao compilar seu código. Veja abaixo.",
        msg_activecode_time_limit_exc: "Limite de tempo excedido no seu programa",
        msg_activecode_server_err: "Um erro de servidor ocorreu: $1 $2",
        msg_activecode_compiling_running:
            "Compilando e executando seu código...",
        msg_activecode_server_comm_err: "Erro ao comunicar com o servidor.",
        msg_activecode_save_run: "Salvar & Executar",
        msg_activecode_render: "Salvar & Renderizar",
        msg_activecode_assertion_error:
            "Um erro de asserção ocorre quando python encontra um comando 'assert'. Python avalia a expressão do lado direito; se é verdadeira, o programa continua normalmente. Se é falsa, python gera um erro e para a execução." ,
        msg_activecode_assertion_error_fix:
            "Cheque a expressão do lado direito de 'assert'. Essa expressão é falsa e é preciso verificar o motivo. Você pode querer imprimir cada parte da expressão e entender porque é falsa.",
        msg_activecode_load_db: "Carregando banco de dados...",
    },
});


/***/ }),

/***/ 82510:
/*!************************************************************!*\
  !*** ./runestone/activecode/js/activecode-i18n.sr-Cyrl.js ***!
  \************************************************************/
/***/ (() => {

$.i18n().load({
    "sr-Cyrl": {
        msg_activecode_load_history: "Учитај историју",
        msg_activecode_audio_tour: "Аудио тура",
        msg_activecode_loaded_code: "Ваш изворни код је учитан.",
        msg_activecode_no_saved_code: "Не постоји снимљен код.",
        msg_activecode_run_code: "Покрени програм",
        msg_activecode_show_feedback: "Прикажи резултат",
        msg_activecode_show_code: "Прикажи код",
        msg_activecode_hide_code: "Затвори код",
        msg_activecode_show_codelens: "Корак по корак",
        msg_activecode_show_in_codelens: "Корак по корак",
        msg_activecode_hide_codelens: "Затвори корак по корак",

        msg_sctivecode_parse_error:
            "Синтаксна грешка (parse error) значи да Пајтон не разуме синтаксу у линији кога на коју порука о грешци указује. Типични примери овакве грешке су заборавлјена двотачка код 'if' или 'for' исказа или заборављена запета између аргумената код позива функције",
        msg_sctivecode_parse_error_fix:
            "Да бисте исправили синтаксну грешку треба пажњиво да погледате линију изворног кода на коју указује поруга о грешци и можда претходну линину изворног кода. Проверите да ли су поштована сва синтаксна правила Пајтона.",
    },
});


/***/ }),

/***/ 750:
/*!***********************************************!*\
  !*** ./runestone/activecode/js/activecode.js ***!
  \***********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "ActiveCode": () => (/* binding */ ActiveCode)
/* harmony export */ });
/* harmony import */ var _common_js_runestonebase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../common/js/runestonebase.js */ 2568);
/* harmony import */ var _audiotour_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./audiotour.js */ 27350);
/* harmony import */ var _activecode_i18n_en_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./activecode-i18n.en.js */ 40053);
/* harmony import */ var _activecode_i18n_en_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_activecode_i18n_en_js__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _activecode_i18n_pt_br_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./activecode-i18n.pt-br.js */ 46108);
/* harmony import */ var _activecode_i18n_pt_br_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_activecode_i18n_pt_br_js__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _activecode_i18n_sr_Cyrl_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./activecode-i18n.sr-Cyrl.js */ 82510);
/* harmony import */ var _activecode_i18n_sr_Cyrl_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_activecode_i18n_sr_Cyrl_js__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! codemirror */ 4631);
/* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(codemirror__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var codemirror_mode_python_python_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! codemirror/mode/python/python.js */ 5321);
/* harmony import */ var codemirror_mode_python_python_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(codemirror_mode_python_python_js__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var codemirror_mode_css_css_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! codemirror/mode/css/css.js */ 36629);
/* harmony import */ var codemirror_mode_css_css_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(codemirror_mode_css_css_js__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var codemirror_mode_htmlmixed_htmlmixed_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! codemirror/mode/htmlmixed/htmlmixed.js */ 16531);
/* harmony import */ var codemirror_mode_htmlmixed_htmlmixed_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(codemirror_mode_htmlmixed_htmlmixed_js__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var codemirror_mode_xml_xml_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! codemirror/mode/xml/xml.js */ 29589);
/* harmony import */ var codemirror_mode_xml_xml_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(codemirror_mode_xml_xml_js__WEBPACK_IMPORTED_MODULE_9__);
/* harmony import */ var codemirror_mode_javascript_javascript_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! codemirror/mode/javascript/javascript.js */ 96876);
/* harmony import */ var codemirror_mode_javascript_javascript_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(codemirror_mode_javascript_javascript_js__WEBPACK_IMPORTED_MODULE_10__);
/* harmony import */ var codemirror_mode_sql_sql_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! codemirror/mode/sql/sql.js */ 54086);
/* harmony import */ var codemirror_mode_sql_sql_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(codemirror_mode_sql_sql_js__WEBPACK_IMPORTED_MODULE_11__);
/* harmony import */ var codemirror_mode_clike_clike_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! codemirror/mode/clike/clike.js */ 99762);
/* harmony import */ var codemirror_mode_clike_clike_js__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(codemirror_mode_clike_clike_js__WEBPACK_IMPORTED_MODULE_12__);
/* harmony import */ var codemirror_mode_octave_octave_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! codemirror/mode/octave/octave.js */ 15734);
/* harmony import */ var codemirror_mode_octave_octave_js__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(codemirror_mode_octave_octave_js__WEBPACK_IMPORTED_MODULE_13__);
/* harmony import */ var _css_activecode_css__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./../css/activecode.css */ 33592);
/* harmony import */ var codemirror_lib_codemirror_css__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! codemirror/lib/codemirror.css */ 91380);
/**
 *
 * Created by bmiller on 3/19/15.
 */
/* Define global variables for ESLint */
/* global Sk */




















var isMouseDown = false;
document.onmousedown = function () {
    isMouseDown = true;
};

document.onmouseup = function () {
    isMouseDown = false;
};
window.edList = {};

var socket, connection, doc;
var chatcodesServer = "chat.codes";

// separate into constructor and init
class ActiveCode extends _common_js_runestonebase_js__WEBPACK_IMPORTED_MODULE_0__.default {
    constructor(opts) {
        super(opts);
        var suffStart;
        var orig = $(opts.orig).find("textarea")[0];
        this.containerDiv = opts.orig;
        this.useRunestoneServices = opts.useRunestoneServices;
        this.python3 = opts.python3;
        this.alignVertical = opts.vertical;
        this.origElem = orig;
        this.origText = this.origElem.textContent;
        this.divid = opts.orig.id;
        this.code = $(orig).text() || "\n\n\n\n\n";
        this.language = $(orig).data("lang");
        this.timelimit = $(orig).data("timelimit");
        this.includes = $(orig).data("include");
        this.hidecode = $(orig).data("hidecode");
        this.chatcodes = $(orig).data("chatcodes");
        this.hidehistory = $(orig).data("hidehistory");
        this.question = $(opts.orig).find(`#${this.divid}_question`)[0];
        this.tie = $(orig).data("tie");
        this.dburl = $(orig).data("dburl");
        this.runButton = null;
        this.enabledownload = $(orig).data("enabledownload");
        this.downloadButton = null;
        this.saveButton = null;
        this.loadButton = null;
        this.outerDiv = null;
        this.partner = "";
        this.logResults = true;
        if (!eBookConfig.allow_pairs || $(orig).data("nopair")) {
            this.enablePartner = false;
        } else {
            this.enablePartner = true;
        }
        this.output = null; // create pre for output
        this.graphics = null; // create div for turtle graphics
        this.codecoach = null;
        this.codelens = null;
        this.controlDiv = null;
        this.historyScrubber = null;
        this.timestamps = ["Original"];
        this.autorun = $(orig).data("autorun");
        if (this.chatcodes && eBookConfig.enable_chatcodes) {
            if (!socket) {
                socket = new WebSocket("wss://" + chatcodesServer);
            }
            if (!connection) {
                connection = new window.sharedb.Connection(socket);
            }
            if (!doc) {
                doc = connection.get("chatcodes", "channels");
            }
        }
        if (this.graderactive || this.isTimed) {
            this.hidecode = false;
        }
        if (this.includes) {
            this.includes = this.includes.split(/\s+/);
        }
        let prefixEnd = this.code.indexOf("^^^^");
        if (prefixEnd > -1) {
            this.prefix = this.code.substring(0, prefixEnd);
            this.code = this.code.substring(prefixEnd + 5);
        }
        suffStart = this.code.indexOf("====");
        if (suffStart > -1) {
            this.suffix = this.code.substring(suffStart + 5);
            this.code = this.code.substring(0, suffStart);
        }
        this.history = [this.code];
        this.createEditor();
        this.createOutput();
        this.createControls();
        if ($(orig).data("caption")) {
            this.caption = $(orig).data("caption");
        } else {
            this.caption = "ActiveCode";
        }
        this.addCaption("runestone");
        setTimeout(
            function () {
                this.editor.refresh();
            }.bind(this),
            1000
        );
        if (this.autorun) {
            // Simulate pressing the run button, since this will also prevent the user from clicking it until the initial run is complete, and also help the user understand why they're waiting.
            $(document).ready(this.runButtonHandler.bind(this));
        }
        this.indicate_component_ready();
    }

    createEditor(index) {
        this.outerDiv = document.createElement("div");
        var linkdiv = document.createElement("div");
        linkdiv.id = this.divid.replace(/_/g, "-").toLowerCase(); // :ref: changes _ to - so add this as a target
        $(this.outerDiv).addClass("ac_section alert alert-warning");
        var codeDiv = document.createElement("div");
        $(codeDiv).addClass("ac_code_div col-md-12");
        this.codeDiv = codeDiv;
        this.outerDiv.lang = this.language;
        $(this.origElem).replaceWith(this.outerDiv);
        if (linkdiv.id !== this.divid) {
            // Don't want the 'extra' target if they match.
            this.outerDiv.appendChild(linkdiv);
        }
        this.outerDiv.appendChild(codeDiv);
        var edmode = this.outerDiv.lang;
        if (edmode === "sql") {
            edmode = "text/x-sql";
        } else if (edmode === "java") {
            edmode = "text/x-java";
        } else if (edmode === "cpp") {
            edmode = "text/x-c++src";
        } else if (edmode === "c") {
            edmode = "text/x-csrc";
        } else if (edmode === "python3") {
            edmode = "python";
        } else if (edmode === "octave" || edmode === "MATLAB") {
            edmode = "text/x-octave";
        }
        var editor = codemirror__WEBPACK_IMPORTED_MODULE_5___default()(codeDiv, {
            value: this.code,
            lineNumbers: true,
            mode: edmode,
            indentUnit: 4,
            matchBrackets: true,
            autoMatchParens: true,
            extraKeys: {
                Tab: "indentMore",
                "Shift-Tab": "indentLess",
            },
        });
        // Make the editor resizable
        $(editor.getWrapperElement()).resizable({
            resize: function () {
                editor.setSize($(this).width(), $(this).height());
                editor.refresh();
            },
        });
        // give the user a visual cue that they have changed but not saved
        editor.on(
            "change",
            function (ev) {
                if (
                    editor.acEditEvent == false ||
                    editor.acEditEvent === undefined
                ) {
                    // change events can come before any real changes for various reasons, some unknown
                    // this avoids unneccsary log events and updates to the activity counter
                    if (this.origText === editor.getValue()) {
                        return;
                    }
                    $(editor.getWrapperElement()).css(
                        "border-top",
                        "2px solid #b43232"
                    );
                    $(editor.getWrapperElement()).css(
                        "border-bottom",
                        "2px solid #b43232"
                    );
                    this.isAnswered = true;
                    this.logBookEvent({
                        event: "activecode",
                        act: "edit",
                        div_id: this.divid,
                    });
                }
                editor.acEditEvent = true;
            }.bind(this)
        ); // use bind to preserve *this* inside the on handler.
        //Solving Keyboard Trap of ActiveCode: If user use tab for navigation outside of ActiveCode, then change tab behavior in ActiveCode to enable tab user to tab out of the textarea
        $(window).keydown(function (e) {
            var code = e.keyCode ? e.keyCode : e.which;
            if (code == 9 && $("textarea:focus").length === 0) {
                editor.setOption("extraKeys", {
                    Tab: function (cm) {
                        $(document.activeElement)
                            .closest(".tab-content")
                            .nextSibling.focus();
                    },
                    "Shift-Tab": function (cm) {
                        $(document.activeElement)
                            .closest(".tab-content")
                            .previousSibling.focus();
                    },
                });
            }
        });
        this.editor = editor;
        if (this.hidecode) {
            $(this.codeDiv).css("display", "none");
        }
    }

    async runButtonHandler() {
        // Disable the run button until the run is finished.
        this.runButton.disabled = true;
        try {
            await this.runProg();
        } catch (e) {
            console.log(`there was an error ${e} running the code`);
        }
        if (this.logResults) {
            this.logCurrentAnswer();
        }
        this.renderFeedback();
        // The run is finished; re-enable the button.
        this.runButton.disabled = false;
    }

    createControls() {
        var ctrlDiv = document.createElement("div");
        var butt;
        $(ctrlDiv).addClass("ac_actions");
        $(ctrlDiv).addClass("col-md-12");
        // Run
        butt = document.createElement("button");
        $(butt).text($.i18n("msg_activecode_run_code"));
        $(butt).addClass("btn btn-success run-button");
        ctrlDiv.appendChild(butt);
        this.runButton = butt;
        console.log("adding click function for run");
        this.runButton.onclick = this.runButtonHandler.bind(this);
        $(butt).attr("type", "button");

        if (this.enabledownload || eBookConfig.downloadsEnabled) {
            this.addDownloadButton(ctrlDiv);
        }
        if (!this.hidecode && !this.hidehistory) {
            this.addHistoryButton(ctrlDiv);
        }
        if ($(this.origElem).data("gradebutton") && !this.graderactive) {
            this.addFeedbackButton(ctrlDiv);
        }
        // Show/Hide Code
        if (this.hidecode) {
            this.enableHideShow(ctrlDiv);
        }
        // CodeLens
        if ($(this.origElem).data("codelens") && !this.graderactive) {
            this.enableCodeLens(ctrlDiv);
        }
        // Audio Tour
        if ($(this.origElem).data("audio")) {
            this.enableAudioTours(ctrlDiv);
        }
        if (eBookConfig.isInstructor) {
            this.enableInstructorSharing(ctrlDiv);
        }
        if (this.enablePartner) {
            this.setupPartner(ctrlDiv);
        }
        if (this.chatcodes && eBookConfig.enable_chatcodes) {
            this.enableChatCodes(ctrlDiv);
        }

        $(this.outerDiv).prepend(ctrlDiv);
        if (this.question) {
            if ($(this.question).html().match(/^\s+$/)) {
                $(this.question).remove();
            } else {
                $(this.outerDiv).prepend(this.question);
            }
        }
        this.controlDiv = ctrlDiv;
    }

    addFeedbackButton(ctrlDiv) {
        let butt = document.createElement("button");
        $(butt).addClass("ac_opt btn btn-default");
        $(butt).text($.i18n("msg_activecode_show_feedback"));
        $(butt).css("margin-left", "10px");
        $(butt).attr("type", "button");
        this.gradeButton = butt;
        ctrlDiv.appendChild(butt);
        $(butt).click(this.createGradeSummary.bind(this));
    }

    addHistoryButton(ctrlDiv) {
        let butt = document.createElement("button");
        $(butt).text($.i18n("msg_activecode_load_history"));
        $(butt).addClass("btn btn-default");
        $(butt).attr("type", "button");
        ctrlDiv.appendChild(butt);
        this.histButton = butt;
        $(butt).click(this.addHistoryScrubber.bind(this));
        if (this.graderactive) {
            this.addHistoryScrubber(true);
        }
    }

    addDownloadButton(ctrlDiv) {
        let butt = document.createElement("button");
        $(butt).text("Download");
        $(butt).addClass("btn save-button");
        ctrlDiv.appendChild(butt);
        this.downloadButton = butt;
        $(butt).click(this.downloadFile.bind(this, this.language));
        $(butt).attr("type", "button");
    }

    enableHideShow(ctrlDiv) {
        $(this.runButton).attr("disabled", "disabled");
        let butt = document.createElement("button");
        $(butt).addClass("ac_opt btn btn-default");
        $(butt).text($.i18n("msg_activecode_show_code"));
        $(butt).css("margin-left", "10px");
        $(butt).attr("type", "button");
        this.showHideButt = butt;
        ctrlDiv.appendChild(butt);
        $(butt).click(
            function () {
                $(this.codeDiv).toggle();
                if (this.historyScrubber == null) {
                    this.addHistoryScrubber(true);
                } else {
                    $(this.historyScrubber.parentElement).toggle();
                }
                if (
                    $(this.showHideButt).text() ==
                    $.i18n("msg_activecode_show_code")
                ) {
                    $(this.showHideButt).text(
                        $.i18n("msg_activecode_hide_code")
                    );
                } else {
                    $(this.showHideButt).text(
                        $.i18n("msg_activecode_show_code")
                    );
                }
                if ($(this.runButton).attr("disabled")) {
                    $(this.runButton).removeAttr("disabled");
                } else {
                    $(this.runButton).attr("disabled", "disabled");
                }
            }.bind(this)
        );
    }

    enableCodeLens(ctrlDiv) {
        let butt = document.createElement("button");
        $(butt).addClass("ac_opt btn btn-default");
        $(butt).text($.i18n("msg_activecode_show_codelens"));
        $(butt).css("margin-left", "10px");
        this.clButton = butt;
        ctrlDiv.appendChild(butt);
        $(butt).click(this.showCodelens.bind(this));
    }

    enableAudioTours(ctrlDiv) {
        let butt = document.createElement("button");
        $(butt).addClass("ac_opt btn btn-default");
        $(butt).text($.i18n("msg_activecode_audio_tour"));
        $(butt).css("margin-left", "10px");
        this.atButton = butt;
        ctrlDiv.appendChild(butt);
        $(butt).click(
            function () {
                new _audiotour_js__WEBPACK_IMPORTED_MODULE_1__.default(
                    this.divid,
                    this.code,
                    1,
                    $(this.origElem).data("audio")
                );
            }.bind(this)
        );
    }

    enableInstructorSharing(ctrlDiv) {
        let butt = document.createElement("button");
        $(butt).addClass("btn btn-info");
        $(butt).text("Share Code");
        $(butt).css("margin-left", "10px");
        this.shareButt = butt;
        ctrlDiv.appendChild(butt);
        $(butt).click(
            async function () {
                if (
                    !confirm(
                        "You are about to share this code with ALL of your students.  Are you sure you want to continue?"
                    )
                ) {
                    return;
                }
                let data = {
                    divid: this.divid,
                    code: this.editor.getValue(),
                    lang: this.language,
                };
                let request = new Request(
                    eBookConfig.ajaxURL + "broadcast_code.json",
                    {
                        method: "POST",
                        headers: this.jsonHeaders,
                        body: JSON.stringify(data),
                    }
                );
                let post_promise = await fetch(request);
                let status = await post_promise.json();
                if (status.mess === "success") {
                    alert(`Shared Code with ${status.share_count} students`);
                } else {
                    alert("Sharing Failed");
                }
            }.bind(this)
        );
    }

    setupPartner(ctrlDiv) {
        var checkPartner = document.createElement("input");
        checkPartner.type = "checkbox";
        checkPartner.id = `${this.divid}_part`;
        ctrlDiv.appendChild(checkPartner);
        var plabel = document.createElement("label");
        plabel.for = `${this.divid}_part`;
        $(plabel).text("Pair?");
        ctrlDiv.appendChild(plabel);
        $(checkPartner).click(
            function () {
                if (this.partner) {
                    this.partner = false;
                    $(partnerTextBox).hide();
                    this.partner = "";
                    partnerTextBox.value = "";
                    $(plabel).text("Pair?");
                } else {
                    let didAgree = localStorage.getItem("partnerAgree");
                    if (!didAgree) {
                        didAgree = confirm(
                            "Pair Programming should only be used with the consent of your instructor." +
                                "Your partner must be a registered member of the class and have agreed to pair with you." +
                                "By clicking OK you certify that both of these conditions have been met."
                        );
                        if (didAgree) {
                            localStorage.setItem("partnerAgree", "true");
                        } else {
                            return;
                        }
                    }
                    this.partner = true;
                    $(plabel).text("with: ");
                    $(partnerTextBox).show();
                }
            }.bind(this)
        );
        var partnerTextBox = document.createElement("input");
        partnerTextBox.type = "text";
        ctrlDiv.appendChild(partnerTextBox);
        $(partnerTextBox).hide();
        $(partnerTextBox).change(
            function () {
                this.partner = partnerTextBox.value;
            }.bind(this)
        );
    }

    // This is probably obsolete.  Not sure if anyone at Michigan will come back
    // to working on this again.
    enableChatCodes(ctrlDiv) {
        var chatBar = document.createElement("div");
        var channels = document.createElement("span");
        var topic = window.location.host + "-" + this.divid;
        ctrlDiv.appendChild(chatBar);
        $(chatBar).text("Chat: ");
        $(chatBar).append(channels);
        let butt = document.createElement("a");
        $(butt).addClass("ac_opt btn btn-default");
        $(butt).text("Create Channel");
        $(butt).css("margin-left", "10px");
        $(butt).attr("type", "button");
        $(butt).attr("target", "_blank");
        $(butt).attr(
            "href",
            "http://" +
                chatcodesServer +
                "/new?" +
                $.param({
                    topic: window.location.host + "-" + this.divid,
                    code: this.editor.getValue(),
                    lang: "Python",
                })
        );
        this.chatButton = butt;
        chatBar.appendChild(butt);
        var updateChatCodesChannels = function () {
            var data = doc.data;
            var i = 1;
            $(channels).html("");
            data["channels"].forEach(function (channel) {
                if (!channel.archived && topic === channel.topic) {
                    var link = $("<a />");
                    var href =
                        "http://" + chatcodesServer + "/" + channel.channelName;
                    link.attr({
                        href: href,
                        target: "_blank",
                    });
                    link.text(" " + channel.channelName + "(" + i + ") ");
                    $(channels).append(link);
                    i++;
                }
            });
            if (i === 1) {
                $(channels).text("(no active converstations on this problem)");
            }
        };
        doc.subscribe(updateChatCodesChannels);
        doc.on("op", updateChatCodesChannels);
    }

    enableSaveLoad() {
        $(this.runButton).text($.i18n("msg_activecode_save_run"));
    }

    // Activecode -- If the code has not changed wrt the scrubber position value then don't save the code or reposition the scrubber
    //  -- still call runlog, but add a parameter to not save the code
    // add an initial load history button
    // if there is no edit then there is no append   to_save (True/False)
    async addHistoryScrubber(pos_last) {
        let response;
        var reqData = {
            acid: this.divid,
        };
        if (this.sid !== undefined) {
            reqData["sid"] = this.sid;
        }
        console.log("before get hist");
        if (
            eBookConfig.practice_mode ||
            (this.isTimed && !this.assessmentTaken)
        ) {
            // If this is timed and already taken we should restore history info
            this.renderScrubber();
        } else {
            let request = new Request(eBookConfig.ajaxURL + "gethist.json", {
                method: "POST",
                headers: this.jsonHeaders,
                body: JSON.stringify(reqData),
            });
            try {
                response = await fetch(request);
                let data = await response.json();
                if (data.history !== undefined) {
                    this.history = this.history.concat(data.history);
                    for (let t in data.timestamps) {
                        this.timestamps.push(
                            new Date(data.timestamps[t]).toLocaleString()
                        );
                    }
                }
            } catch (e) {
                console.log("unable to fetch history");
            }
            this.renderScrubber(pos_last);
        }
        return "success";
    }

    renderScrubber(pos_last) {
        console.log("making a new scrubber");
        var scrubberDiv = document.createElement("div");
        $(scrubberDiv).css("display", "inline-block");
        $(scrubberDiv).css("margin-left", "10px");
        $(scrubberDiv).css("margin-right", "10px");
        $(scrubberDiv).css({
            "min-width": "200px",
            "max-width": "300px",
        });
        var scrubber = document.createElement("div");
        this.timestampP = document.createElement("span");
        this.slideit = function () {
            this.editor.setValue(this.history[$(scrubber).slider("value")]);
            var curVal = this.timestamps[$(scrubber).slider("value")];
            let pos = $(scrubber).slider("value");
            let outOf = this.history.length;
            $(this.timestampP).text(`${curVal} - ${pos + 1} of ${outOf}`);
            this.logBookEvent({
                event: "activecode",
                act: "slide:" + curVal,
                div_id: this.divid,
            });
        };
        $(scrubber).slider({
            max: this.history.length - 1,
            value: this.history.length - 1,
        });
        $(scrubber).css("margin", "10px");
        $(scrubber).on("slide", this.slideit.bind(this));
        $(scrubber).on("slidechange", this.slideit.bind(this));
        scrubberDiv.appendChild(scrubber);
        scrubberDiv.appendChild(this.timestampP);
        // If there is a deadline set then position the scrubber at the last submission
        // prior to the deadline
        if (this.deadline) {
            let i = 0;
            let done = false;
            while (i < this.history.length && !done) {
                if (new Date(this.timestamps[i]) > this.deadline) {
                    done = true;
                } else {
                    i += 1;
                }
            }
            i = i - 1;
            scrubber.value = Math.max(i, 0);
            this.editor.setValue(this.history[scrubber.value]);
            $(scrubber).slider("value", scrubber.value);
        } else if (pos_last) {
            scrubber.value = this.history.length - 1;
            this.editor.setValue(this.history[scrubber.value]);
        } else {
            scrubber.value = 0;
        }
        let pos = $(scrubber).slider("value");
        let outOf = this.history.length;
        let ts = this.timestamps[$(scrubber).slider("value")];
        $(this.timestampP).text(`${ts} - ${pos + 1} of ${outOf}`);
        $(this.histButton).remove();
        this.histButton = null;
        this.historyScrubber = scrubber;
        $(scrubberDiv).insertAfter(this.runButton);
    } // end definition of helper

    createOutput() {
        // Create a parent div with two elements:  pre for standard output and a div
        // to hold turtle graphics output.  We use a div in case the turtle changes from
        // using a canvas to using some other element like svg in the future.
        var outDiv = document.createElement("div");
        $(outDiv).addClass("ac_output col-md-12");
        this.outDiv = outDiv;
        this.output = document.createElement("pre");
        this.output.id = this.divid + "_stdout";
        $(this.output).css("visibility", "hidden");
        this.graphics = document.createElement("div");
        this.graphics.id = this.divid + "_graphics";
        $(this.graphics).addClass("ac-canvas");
        // This bit of magic adds an event which waits for a canvas child to be created on our
        // newly created div.  When a canvas child is added we add a new class so that the visible
        // canvas can be styled in CSS.  Which a the moment means just adding a border.
        $(this.graphics).on(
            "DOMNodeInserted",
            "canvas",
            function () {
                $(this.graphics).addClass("visible-ac-canvas");
            }.bind(this)
        );
        var clearDiv = document.createElement("div");
        $(clearDiv).css("clear", "both"); // needed to make parent div resize properly
        this.outerDiv.appendChild(clearDiv);
        outDiv.appendChild(this.output);
        outDiv.appendChild(this.graphics);
        this.outerDiv.appendChild(outDiv);
        var lensDiv = document.createElement("div");
        lensDiv.id = `${this.divid}_codelens`;
        $(lensDiv).addClass("col-md-12");
        $(lensDiv).css("display", "none");
        this.codelens = lensDiv;
        this.outerDiv.appendChild(lensDiv);
        var coachDiv = document.createElement("div");
        $(coachDiv).addClass("col-md-12");
        $(coachDiv).css("display", "none");
        this.codecoach = coachDiv;
        this.outerDiv.appendChild(coachDiv);
        clearDiv = document.createElement("div");
        $(clearDiv).css("clear", "both"); // needed to make parent div resize properly
        this.outerDiv.appendChild(clearDiv);
    }

    disableSaveLoad() {
        $(this.saveButton).addClass("disabled");
        $(this.saveButton).attr("title", "Login to save your code");
        $(this.loadButton).addClass("disabled");
        $(this.loadButton).attr("title", "Login to load your code");
    }

    downloadFile(lang) {
        var fnb = this.divid;
        var d = new Date();
        var fileName =
            fnb +
            "_" +
            d
                .toJSON()
                .substring(0, 10) // reverse date format
                .split("-")
                .join("") +
            "." +
            languageExtensions[lang];
        var code = this.editor.getValue();
        if ("Blob" in window) {
            var textToWrite = code.replace(/\n/g, "\r\n");
            var textFileAsBlob = new Blob([textToWrite], {
                type: "text/plain",
            });
            if ("msSaveOrOpenBlob" in navigator) {
                navigator.msSaveOrOpenBlob(textFileAsBlob, fileName);
            } else {
                var downloadLink = document.createElement("a");
                downloadLink.download = fileName;
                downloadLink.innerHTML = "Download File";
                downloadLink.href = window.URL.createObjectURL(textFileAsBlob);
                downloadLink.style.display = "none";
                document.body.appendChild(downloadLink);
                downloadLink.click();
            }
        } else {
            alert("Your browser does not support the HTML5 Blob.");
        }
    }

    async createGradeSummary() {
        // get grade and comments for this assignment
        // get summary of all grades for this student
        // display grades in modal window
        var data = {
            div_id: this.divid,
        };
        let request = new Request(eBookConfig.ajaxURL + "getassignmentgrade", {
            method: "POST",
            headers: this.jsonHeaders,
            body: JSON.stringify(data),
        });
        let response = await fetch(request);
        let report = await response.json();
        var body;
        // check for report['message']
        if (report) {
            if (report["version"] == 2) {
                // new version; would be better to embed this in HTML for the activecode
                body =
                    "<h4>Grade Report</h4>" +
                    "<p>This question: " +
                    report["grade"];
                if (report["released"]) {
                    body += " out of " + report["max"];
                }
                body += "</p> <p>";
                if (report["released"] == false) {
                    body += "Preliminary Comments: ";
                }
                body += report["comment"] + "</p>";
            } else {
                body =
                    "<h4>Grade Report</h4>" +
                    "<p>This assignment: " +
                    report["grade"] +
                    "</p>" +
                    "<p>" +
                    report["comment"] +
                    "</p>" +
                    "<p>Number of graded assignments: " +
                    report["count"] +
                    "</p>" +
                    "<p>Average score: " +
                    report["avg"] +
                    "</p>";
            }
        } else {
            body = "<h4>The server did not return any grade information</h4>";
        }
        var html = `<div class="modal fade">
                  <div class="modal-dialog compare-modal">
                    <div class="modal-content">
                      <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title">Assignment Feedback</h4>
                      </div>
                      <div class="modal-body">
                        ${body}
                      </div>
                    </div>
                  </div>
                </div>`;
        var el = $(html);
        el.modal();

        return response;
    }

    async showCodelens() {
        if (this.codelens.style.display == "none") {
            this.codelens.style.display = "block";
            this.clButton.innerText = $.i18n("msg_activecode_hide_codelens");
        } else {
            this.codelens.style.display = "none";
            this.clButton.innerText = $.i18n("msg_activecode_show_in_codelens");
            return;
        }
        var cl = this.codelens.firstChild;
        if (cl) {
            this.codelens.removeChild(cl);
        }
        var code = await this.buildProg(false);
        var myVars = {};
        myVars.code = code;
        myVars.origin = "opt-frontend.js";
        myVars.cumulative = false;
        myVars.heapPrimitives = false;
        myVars.drawParentPointers = false;
        myVars.textReferences = false;
        myVars.showOnlyOutputs = false;
        myVars.rawInputLstJSON = JSON.stringify([]);
        if (this.language == "python") {
            if (this.python3) {
                myVars.py = 3;
            } else {
                myVars.py = 2;
            }
        } else if (this.langauge == "javascript") {
            myVars.py = "js";
        } else {
            myVars.py = this.language;
        }
        myVars.curInstr = 0;
        myVars.codeDivWidth = 350;
        myVars.codeDivHeight = 400;
        var srcURL = "https://pythontutor.com/iframe-embed.html";
        var srcVars = $.param(myVars);
        var embedUrlStr = `${srcURL}#${srcVars}`;
        var myIframe = document.createElement("iframe");
        myIframe.setAttribute("id", this.divid + "_codelens");
        myIframe.setAttribute("width", "800");
        myIframe.setAttribute("height", "500");
        myIframe.setAttribute("style", "display:block");
        myIframe.style.background = "#fff";
        //myIframe.setAttribute("src",srcURL)
        myIframe.src = embedUrlStr;
        this.codelens.appendChild(myIframe);
        this.logBookEvent({
            event: "codelens",
            act: "view",
            div_id: this.divid,
        });
    }
    // <iframe id="%(divid)s_codelens" width="800" height="500" style="display:block"src="#">
    // </iframe>
    showCodeCoach() {
        var myIframe;
        var srcURL;
        var cl;
        var div_id = this.divid;
        if (this.codecoach === null) {
            this.codecoach = document.createElement("div");
            this.codecoach.style.display = "block";
        }
        cl = this.codecoach.firstChild;
        if (cl) {
            this.codecoach.removeChild(cl);
        }
        srcURL = eBookConfig.app + "/admin/diffviewer?divid=" + div_id;
        myIframe = document.createElement("iframe");
        myIframe.setAttribute("id", div_id + "_coach");
        myIframe.setAttribute("width", "800px");
        myIframe.setAttribute("height", "500px");
        myIframe.setAttribute("style", "display:block");
        myIframe.style.background = "#fff";
        myIframe.style.width = "100%";
        myIframe.src = srcURL;
        this.codecoach.appendChild(myIframe);
        $(this.codecoach).show();
        this.logBookEvent({
            event: "coach",
            act: "view",
            div_id: this.divid,
        });
    }

    toggleEditorVisibility() {}

    addErrorMessage(err) {
        // Add the error message
        this.errLastRun = true;
        var errHead = $("<h3>").html("Error");
        this.eContainer = this.outerDiv.appendChild(
            document.createElement("div")
        );
        this.eContainer.className = "error alert alert-danger";
        this.eContainer.id = this.divid + "_errinfo";
        this.eContainer.appendChild(errHead[0]);
        var errText = this.eContainer.appendChild(
            document.createElement("pre")
        );
        // But, adjust the line numbers.  If the line number is <= pretextLines then it is in included code
        // if it is greater than the number of included lines but less than the pretext + current editor then it is in the student code.
        // adjust the line number we display by eliminating the pre-included code.
        if (err.traceback.length >= 1) {
            var errorLine = err.traceback[0].lineno;
            if (errorLine <= this.pretextLines) {
                errText.innerHTML =
                    "An error occurred in the hidden, included code. Sorry we can't give you a more helpful error message";
                return;
            } else if (errorLine > this.progLines + this.pretextLines) {
                errText.innerHTML = `An error occurred after the end of your code.
One possible reason is that you have an unclosed parenthesis or string.
Another possibility is that there is an error in the hidden test code.
Yet another is that there is an internal error.  The internal error message is: ${err.message}`;
                return;
            } else {
                if (this.pretextLines > 0) {
                    err.traceback[0].lineno =
                        err.traceback[0].lineno - this.pretextLines + 1;
                }
            }
        }
        var errString = err.toString();
        var to = errString.indexOf(":");
        var errName = errString.substring(0, to);
        errText.innerHTML = errString;
        $(this.eContainer).append("<h3>Description</h3>");
        var errDesc = this.eContainer.appendChild(document.createElement("p"));
        errDesc.innerHTML = errorText[errName];
        $(this.eContainer).append("<h3>To Fix</h3>");
        var errFix = this.eContainer.appendChild(document.createElement("p"));
        errFix.innerHTML = errorText[errName + "Fix"];
        var moreInfo = "../ErrorHelp/" + errName.toLowerCase() + ".html";
        //console.log("Runtime Error: " + err.toString());
    }
    setTimeLimit(timer) {
        var timelimit = this.timelimit;
        if (timer !== undefined) {
            timelimit = timer;
        }
        // set execLimit in milliseconds  -- for student projects set this to
        // 25 seconds -- just less than Chrome's own timer.
        if (
            this.code.indexOf("ontimer") > -1 ||
            this.code.indexOf("onclick") > -1 ||
            this.code.indexOf("onkey") > -1 ||
            this.code.indexOf("setDelay") > -1
        ) {
            Sk.execLimit = null;
        } else {
            if (timelimit === "off") {
                Sk.execLimit = null;
            } else if (timelimit) {
                Sk.execLimit = timelimit;
            } else {
                Sk.execLimit = 25000;
            }
        }
    }
    builtinRead(x) {
        if (
            Sk.builtinFiles === undefined ||
            Sk.builtinFiles["files"][x] === undefined
        )
            throw $.i18n("msg_activecode_file_not_found", x);
        return Sk.builtinFiles["files"][x];
    }
    fileReader(divid) {
        let elem = document.getElementById(divid);
        let data = "";
        let result = "";
        if (elem == null && Sk.builtinFiles.files.hasOwnProperty(divid)) {
            return Sk.builtinFiles["files"][divid];
        } else {
            // try remote file unless it ends with .js or .py -- otherwise we'll ask the server for all
            // kinds of modules that we are trying to import
            if (!(divid.endsWith(".js") || divid.endsWith(".py"))) {
                $.ajax({
                    async: false,
                    url: `/runestone/ajax/get_datafile?course_id=${eBookConfig.course}&acid=${divid}`,
                    success: function (data) {
                        result = JSON.parse(data).data;
                    },
                    error: function (err) {
                        result = null;
                    },
                });
                if (result) {
                    return result;
                }
            }
        }
        if (elem == null && result === null) {
            throw new Sk.builtin.IOError(
                $.i18n("msg_activecode_no_file_or_dir", divid)
            );
        } else {
            if (elem.nodeName.toLowerCase() == "textarea") {
                data = elem.value;
            } else {
                data = elem.textContent;
            }
        }
        return data;
    }
    outputfun(text) {
        // bnm python 3
        var pyStr = function (x) {
            if (x instanceof Array) {
                return "[" + x.join(", ") + "]";
            } else {
                return x;
            }
        };
        var x = text;
        if (!this.python3) {
            if (x.charAt(0) == "(") {
                x = x.slice(1, -1);
                x = "[" + x + "]";
                try {
                    var xl = eval(x);
                    xl = xl.map(pyStr);
                    x = xl.join(" ");
                } catch (err) {}
            }
        }
        $(this.output).css("visibility", "visible");
        text = x;
        text = text
            .replace(/</g, "&lt;")
            .replace(/>/g, "&gt;")
            .replace(/\n/g, "<br/>");
        return Promise.resolve().then(
            function () {
                setTimeout(
                    function () {
                        $(this.output).append(text);
                    }.bind(this),
                    0
                );
            }.bind(this)
        );
    }

    filewriter(fobj, bytes) {
        let filecomponent = document.getElementById(fobj.name);
        if (!filecomponent) {
            let container = document.createElement("div");
            $(container).addClass("runestone");
            let tab = document.createElement("div");
            $(tab).addClass("datafile_caption");
            tab.innerHTML = `Data file: <code>${fobj.name}</code>`;
            filecomponent = document.createElement("textarea");
            filecomponent.rows = 10;
            filecomponent.cols = 50;
            filecomponent.id = fobj.name;
            $(filecomponent).css("margin-bottom", "5px");
            $(filecomponent).addClass("ac_output");
            container.appendChild(tab);
            container.appendChild(filecomponent);
            this.outerDiv.appendChild(container);
        } else {
            if (fobj.pos$ == 0) {
                $(filecomponent).val("");
            }
        }
        let current = $(filecomponent).val();
        current = current + bytes.v;
        $(filecomponent).val(current);
        $(filecomponent).css("display", "block");
        fobj.pos$ = current.length;
        return current.length;
    }

    async getIncludedCode(divid) {
        if (window.edList[divid]) {
            return window.edList[divid].editor.getValue();
        } else {
            let request = new Request(
                `/runestone/ajax/get_datafile?course_id=${eBookConfig.course}&acid=${divid}`,
                {
                    method: "GET",
                    headers: this.jsonHeaders,
                }
            );
            let wresult = await fetch(request);
            let obj = await wresult.json();
            return obj.data;
        }
    }

    async buildProg(useSuffix) {
        // assemble code from prefix, suffix, and editor for running.
        var pretext;
        var prog = this.editor.getValue() + "\n";
        if (this.prefix) {
            prog = this.prefix + prog;
        }
        this.pretext = "";
        this.pretextLines = 0;
        this.progLines = prog.match(/\n/g).length + 1;
        if (this.includes) {
            // iterate over the includes, in-order prepending to prog
            pretext = "";
            for (var x = 0; x < this.includes.length; x++) {
                let iCode = await this.getIncludedCode(this.includes[x]);
                pretext = pretext + iCode + "\n";
            }
            this.pretext = pretext;
            if (this.pretext) {
                this.pretextLines = (this.pretext.match(/\n/g) || "").length;
            }
            prog = pretext + prog;
        }
        if (useSuffix && this.suffix) {
            prog = prog + this.suffix;
        }
        return Promise.resolve(prog);
    }

    async manage_scrubber(saveCode) {
        if (this.historyScrubber === null && !this.autorun) {
            await this.addHistoryScrubber();
        }
        if (
            this.historyScrubber &&
            this.history[$(this.historyScrubber).slider("value")] !=
                this.editor.getValue()
        ) {
            saveCode = "True";
            this.history.push(this.editor.getValue());
            this.timestamps.push(new Date().toLocaleString());
            $(this.historyScrubber).slider(
                "option",
                "max",
                this.history.length - 1
            );
            $(this.historyScrubber).slider(
                "option",
                "value",
                this.history.length - 1
            );
            this.slideit();
        } else {
            saveCode = "False";
        }
        if (this.historyScrubber == null) {
            saveCode = "False";
        }
        return saveCode;
    }

    async checkCurrentAnswer() {
        try {
            await this.runProg();
        } catch (e) {
            console.log(`error running code ${e}`);
        }
    }

    logCurrentAnswer() {
        this.logRunEvent({
            div_id: this.divid,
            code: this.editor.getValue(),
            lang: this.language,
            errinfo: this.errinfo,
            to_save: this.saveCode,
            prefix: this.pretext,
            suffix: this.suffix,
            partner: this.partner,
        }); // Log the run event
        // If unit tests were run there will be a unit_results
        if (this.unit_results) {
            this.logBookEvent({
                act: this.unit_results,
                div_id: this.divid,
                event: "unittest",
            });
        }
    }

    renderFeedback() {
        // The python unit test code builds the table as it is running the tests
        // In "normal" usage this is displayed immediately.
        // However in exam mode we make a div which is offscreen
        if (this.unit_results_divid) {
            if (this.unit_results_divid.indexOf("_offscreen_") > 0) {
                let urDivid = `${this.divid}_offscreen_unit_results`;
                let unitFeedback = document.getElementById(urDivid);
                let tmp = document.body.removeChild(unitFeedback);
                if ($(this.outerDiv).find(`#${urDivid}`).length > 0) {
                    tmp = $(this.outerDiv).find(`#${urDivid}`)[0];
                } else {
                    this.outerDiv.appendChild(tmp);
                }
                $(tmp).show();
            } else {
                let urDivid = this.divid + "_unit_results";
                if (
                    $(this.outerDiv).find(`#${urDivid}`).length == 0 &&
                    $(this.outerDiv).find(`#${urDivid}_offscreen_unit_results`)
                        .length == 0
                ) {
                    let urResults = document.getElementById(urDivid);
                    this.outerDiv.appendChild(urResults);
                }
            }
        }
    }

    /* runProg has several async elements to it.
     * 1. Skulpt runs the python program asynchronously
     * 2. The history is restored asynchronously
     * 3. Logging is asynchronous
     *
     * This method returns the skulpt Promise and so the promise will resolve when skulpt is finished.
     * when finished this.unit_results will contain the results of any unit tests that have been run.
     * The table of results is constructed and added to the DOM by the python unittest.gui module in skulpt.
     *
     */
    async runProg(noUI, logResults) {
        console.log("starting runProg");
        if (typeof logResults === "undefined") {
            this.logResults = true;
        } else {
            this.logResults = logResults;
        }
        if (typeof noUI !== "boolean") {
            noUI = false;
        }
        var prog = await this.buildProg(true);
        this.saveCode = "True";
        $(this.output).text("");
        while ($(`#${this.divid}_errinfo`).length > 0) {
            $(`#${this.divid}_errinfo`).remove();
        }
        //$(this.eContainer).remove();
        if (this.codelens) {
            this.codelens.style.display = "none";
        }
        if (this.clButton) {
            this.clButton.innerText = $.i18n("msg_activecode_show_in_codelens");
        }
        Sk.configure({
            output: this.outputfun.bind(this),
            read: this.fileReader,
            filewrite: this.filewriter.bind(this),
            __future__: Sk.python3,
            nonreadopen: true,
            //        python3: this.python3,
            imageProxy: "http://image.runestone.academy:8080/320x",
            inputfunTakesPrompt: true,
            jsonpSites: ["https://itunes.apple.com"],
        });
        Sk.divid = this.divid;
        Sk.logResults = logResults;
        if (this.graderactive && this.outerDiv.closest(".loading")) {
            Sk.gradeContainer = this.outerDiv.closest(".loading").id;
        } else {
            Sk.gradeContainer = this.divid;
        }
        this.setTimeLimit();
        (Sk.TurtleGraphics || (Sk.TurtleGraphics = {})).target = this.graphics;
        Sk.canvas = this.graphics.id; //todo: get rid of this here and in image
        if (!noUI) {
            this.saveCode = await this.manage_scrubber(this.saveCode);
            $(this.runButton).attr("disabled", "disabled");
            $(this.historyScrubber).off("slidechange");
            $(this.historyScrubber).slider("disable");
            $(this.outDiv).show({
                duration: 700,
                queue: false,
            });
        }
        try {
            await Sk.misceval.asyncToPromise(function () {
                return Sk.importMainWithBody("<stdin>", false, prog, true);
            });
            if (!noUI) {
                if (this.slideit) {
                    $(this.historyScrubber).on(
                        "slidechange",
                        this.slideit.bind(this)
                    );
                }
                $(this.historyScrubber).slider("enable");
            }
            this.errLastRun = false;
            this.errinfo = "success";
        } catch (err) {
            if (!noUI) {
                $(this.historyScrubber).on(
                    "slidechange",
                    this.slideit.bind(this)
                );
                $(this.historyScrubber).slider("enable");
            }
            this.errinfo = err.toString();
            this.addErrorMessage(err);
        } finally {
            $(this.runButton).removeAttr("disabled");
            if (typeof window.allVisualizers != "undefined") {
                $.each(window.allVisualizers, function (i, e) {
                    e.redrawConnectors();
                });
            }
        }
    }

    disableInteraction() {
        $(this.runButton).hide();
        $(this.codeDiv).addClass("ac-disabled");
    }
}

var languageExtensions = {
    python: "py",
    html: "html",
    javascript: "js",
    java: "java",
    python2: "py",
    python3: "py",
    cpp: "cpp",
    c: "c",
    sql: "sql",
    octave: "m",
};

var errorText = {};

errorText.ParseError = $.i18n("msg_sctivecode_parse_error");
errorText.ParseErrorFix = $.i18n("msg_sctivecode_parse_error_fix");
errorText.TypeError = $.i18n("msg_activecode_type_error");
errorText.TypeErrorFix = $.i18n("msg_activecode_type_error_fix");
errorText.NameError = $.i18n("msg_activecode_name_error");
errorText.NameErrorFix = $.i18n("msg_activecode_name_error_fix");
errorText.ValueError = $.i18n("msg_activecode_value_error");
errorText.ValueErrorFix = $.i18n("msg_activecode_value_error_fix");
errorText.AttributeError = $.i18n("msg_activecode_attribute_error");
errorText.AttributeErrorFix = $.i18n("msg_activecode_attribute_error_fix");
errorText.TokenError = $.i18n("msg_activecode_token_error");
errorText.TokenErrorFix = $.i18n("msg_activecode_token_error_fix");
errorText.TimeLimitError = $.i18n("msg_activecode_time_limit_error");
errorText.TimeLimitErrorFix = $.i18n("msg_activecode_time_limit_error_fix");
errorText.Error = $.i18n("msg_activecode_general_error");
errorText.ErrorFix = $.i18n("msg_activecode_general_error_fix");
errorText.SyntaxError = $.i18n("msg_activecode_syntax_error");
errorText.SyntaxErrorFix = $.i18n("msg_activecode_syntax_error_fix");
errorText.IndexError = $.i18n("msg_activecode_index_error");
errorText.IndexErrorFix = $.i18n("msg_activecode_index_error_fix");
errorText.URIError = $.i18n("msg_activecode_uri_error");
errorText.URIErrorFix = $.i18n("msg_activecode_uri_error_fix");
errorText.ImportError = $.i18n("msg_activecode_import_error");
errorText.ImportErrorFix = $.i18n("msg_activecode_import_error_fix");
errorText.ReferenceError = $.i18n("msg_activecode_reference_error");
errorText.ReferenceErrorFix = $.i18n("msg_activecode_reference_error_fix");
errorText.ZeroDivisionError = $.i18n("msg_activecode_zero_division_error");
errorText.ZeroDivisionErrorFix = $.i18n(
    "msg_activecode_zero_division_error_fix"
);
errorText.RangeError = $.i18n("msg_activecode_range_error");
errorText.RangeErrorFix = $.i18n("msg_activecode_range_error_fix");
errorText.InternalError = $.i18n("msg_activecode_internal_error");
errorText.InternalErrorFix = $.i18n("msg_activecode_internal_error_fix");
errorText.IndentationError = $.i18n("msg_activecode_indentation_error");
errorText.IndentationErrorFix = $.i18n("msg_activecode_indentation_error_fix");
errorText.NotImplementedError = $.i18n("msg_activecode_not_implemented_error");
errorText.NotImplementedErrorFix = $.i18n(
    "msg_activecode_not_implemented_error_fix"
);
errorText.KeyError = $.i18n("msg_activecode_key_error");
errorText.KeyErrorFix = $.i18n("msg_activecode_key_error_fix");
errorText.AssertionError = $.i18n("msg_activecode_assertion_error");
errorText.AssertionErrorFix = $.i18n("msg_activecode_assertion_error_fix");

String.prototype.replaceAll = function (target, replacement) {
    return this.split(target).join(replacement);
};


/***/ }),

/***/ 15033:
/*!****************************************************!*\
  !*** ./runestone/activecode/js/activecode_html.js ***!
  \****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (/* binding */ HTMLActiveCode)
/* harmony export */ });
/* harmony import */ var _activecode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./activecode.js */ 750);


class HTMLActiveCode extends _activecode_js__WEBPACK_IMPORTED_MODULE_0__.ActiveCode {
    constructor(opts) {
        super(opts);
        opts.alignVertical = true;
        this.code = $("<textarea />").html(this.origElem.innerHTML).text();
        $(this.runButton).text("Render");
        this.editor.setValue(this.code);
    }

    async runProg() {
        var prog = await this.buildProg(true);
        let saveCode = "True";
        this.saveCode = await this.manage_scrubber(saveCode);
        $(this.output).text("");
        if (!this.alignVertical) {
            $(this.codeDiv).switchClass("col-md-12", "col-md-6", {
                duration: 500,
                queue: false,
            });
        }
        $(this.outDiv).show({ duration: 700, queue: false });
        prog =
            "<script type=text/javascript>window.onerror = function(msg,url,line) {alert(msg+' on line: '+line);};</script>" +
            prog;
        this.output.srcdoc = prog;
    }

    createOutput() {
        this.alignVertical = true;
        var outDiv = document.createElement("div");
        $(outDiv).addClass("ac_output");
        if (this.alignVertical) {
            $(outDiv).addClass("col-md-12");
        } else {
            $(outDiv).addClass("col-md-5");
        }
        this.outDiv = outDiv;
        this.output = document.createElement("iframe");
        $(this.output).css("background-color", "white");
        $(this.output).css("position", "relative");
        $(this.output).css("height", "400px");
        $(this.output).css("width", "100%");
        outDiv.appendChild(this.output);
        this.outerDiv.appendChild(outDiv);
        var clearDiv = document.createElement("div");
        $(clearDiv).css("clear", "both"); // needed to make parent div resize properly
        this.outerDiv.appendChild(clearDiv);
    }
    enableSaveLoad() {
        $(this.runButton).text($.i18n("msg_activecode_render"));
    }
}


/***/ }),

/***/ 40653:
/*!**************************************************!*\
  !*** ./runestone/activecode/js/activecode_js.js ***!
  \**************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (/* binding */ JSActiveCode)
/* harmony export */ });
/* harmony import */ var _activecode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./activecode.js */ 750);
/* harmony import */ var _skulpt_min_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./skulpt.min.js */ 53098);
/* harmony import */ var _skulpt_min_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_skulpt_min_js__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _skulpt_stdlib_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./skulpt-stdlib.js */ 55409);
/* harmony import */ var _skulpt_stdlib_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_skulpt_stdlib_js__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var vega_embed__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! vega-embed */ 39119);



// Used by Skulpt.

// Adapt for use outside webpack -- see https://github.com/vega/vega-embed.
window.vegaEmbed = vega_embed__WEBPACK_IMPORTED_MODULE_3__.default;

class JSActiveCode extends _activecode_js__WEBPACK_IMPORTED_MODULE_0__.ActiveCode {
    constructor(opts) {
        super(opts);
    }
    outputfun(a) {
        $(this.output).css("visibility", "visible");
        var str = "[";
        if (typeof a == "object" && a.length) {
            for (var i = 0; i < a.length; i++)
                if (typeof a[i] == "object" && a[i].length) {
                    str += (i == 0 ? "" : " ") + "[";
                    for (var j = 0; j < a[i].length; j++)
                        str +=
                            a[i][j] +
                            (j == a[i].length - 1
                                ? "]" + (i == a.length - 1 ? "]" : ",") + "\n"
                                : ", ");
                } else str += a[i] + (i == a.length - 1 ? "]" : ", ");
        } else {
            try {
                str = JSON.stringify(a);
            } catch (e) {
                str = a;
            }
        }
        return str;
    }
    async runProg() {
        var _this = this;
        var prog = await this.buildProg(true);
        var saveCode = "True";
        var write = function (str) {
            _this.output.innerHTML += _this.outputfun(str);
        };
        var writeln = function (str) {
            if (!str) str = "";
            _this.output.innerHTML += _this.outputfun(str) + "<br />";
        };
        this.saveCode = await this.manage_scrubber(saveCode);
        $(this.eContainer).remove();
        $(this.output).text("");
        $(this.outDiv).show({ duration: 700, queue: false });
        try {
            eval(prog);
            this.errinfo = "success";
        } catch (e) {
            this.addErrorMessage(e);
            this.errinfo = e;
        }
    }
}


/***/ }),

/***/ 23538:
/*!***************************************************!*\
  !*** ./runestone/activecode/js/activecode_sql.js ***!
  \***************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (/* binding */ SQLActiveCode)
/* harmony export */ });
/* harmony import */ var _activecode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./activecode.js */ 750);
/* harmony import */ var handsontable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! handsontable */ 36080);
/* harmony import */ var handsontable_dist_handsontable_full_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! handsontable/dist/handsontable.full.css */ 790);
/* harmony import */ var sql_js_dist_sql_wasm_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! sql.js/dist/sql-wasm.js */ 26657);
/* harmony import */ var sql_js_dist_sql_wasm_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(sql_js_dist_sql_wasm_js__WEBPACK_IMPORTED_MODULE_3__);





var allDburls = {};

class SQLActiveCode extends _activecode_js__WEBPACK_IMPORTED_MODULE_0__.ActiveCode {
    constructor(opts) {
        super(opts);
        //  fnprefix sets the path to load the sql-wasm.wasm file
        var bookprefix;
        var fnprefix;
        if (eBookConfig.useRunestoneServices) {
            bookprefix = `${eBookConfig.app}/books/published/${eBookConfig.basecourse}`;
            fnprefix = bookprefix + "/_static";
        } else {
            bookprefix = "";
            fnprefix = "/_static";
        }
        this.config = {
            locateFile: (filename) => `${fnprefix}/${filename}`,
        };
        this.showLast = $(this.origElem).data("showlastsql");
        var self = this;
        sql_js_dist_sql_wasm_js__WEBPACK_IMPORTED_MODULE_3___default()(this.config).then(function (SQL) {
            // set up call to load database asynchronously if given
            if (self.dburl) {
                if (self.dburl.startsWith("/_static")) {
                    self.dburl = `${bookprefix}${self.dburl}`;
                }
                $(self.runButton).attr("disabled", "disabled");
                let buttonText = $(self.runButton).text();
                $(self.runButton).text($.i18n("msg_activecode_load_db"));
                if (!(self.dburl in allDburls)) {
                    allDburls[self.dburl] = {
                        status: "loading",
                        xWaitFor: jQuery.Deferred(),
                    };
                } else {
                    if (allDburls[self.dburl].status == "loading") {
                        allDburls[self.dburl].xWaitFor.done(function () {
                            self.db = new SQL.Database(
                                allDburls[self.dburl].db
                            );
                            $(self.runButton).removeAttr("disabled");
                            $(self.runButton).text(buttonText);
                        });
                        return;
                    }
                    self.db = new SQL.Database(allDburls[self.dburl].db);
                    $(self.runButton).removeAttr("disabled");
                    $(self.runButton).text(buttonText);
                    return;
                }
                var xhr = new XMLHttpRequest();
                // For example: https://github.com/lerocha/chinook-database/raw/master/ChinookDatabase/DataSources/Chinook_Sqlite.sqlite
                xhr.open("GET", self.dburl, true);
                xhr.responseType = "arraybuffer";
                xhr.onload = (e) => {
                    var uInt8Array = new Uint8Array(xhr.response);
                    self.db = new SQL.Database(uInt8Array);
                    $(self.runButton).text(buttonText);
                    $(self.runButton).removeAttr("disabled");
                    allDburls[self.dburl].db = uInt8Array;
                    allDburls[self.dburl].status = "ready";
                    allDburls[self.dburl].xWaitFor.resolve();
                    // contents is now [{columns:['col1','col2',...], values:[[first row], [second row], ...]}]
                };
                xhr.send();
            } else {
                self.db = new SQL.Database();
            }
        });
    }
    async runProg(noUI, logResults) {
        if (typeof logResults === "undefined") {
            this.logResults = true;
        } else {
            this.logResults = logResults;
        }
        if (typeof noUI !== "boolean") {
            noUI = false;
        }
        // Clear any old results
        this.saveCode = "True";
        let divid = this.divid + "_sql_out";
        let respDiv = document.getElementById(divid);
        if (respDiv) {
            respDiv.parentElement.removeChild(respDiv);
        }
        $(this.output).text("");
        // Run this query
        let query = await this.buildProg(false); // false --> Do not include suffix
        if (!this.db) {
            $(this.output).text(
                `Error: Database not initialized! DBURL: ${this.dburl}`
            );
            return;
        }

        let it = this.db.iterateStatements(query);
        this.results = [];
        try {
            for (let statement of it) {
                let columns = statement.getColumnNames();
                if (columns.length > 0) {
                    // data! probably a SELECT
                    let data = [];
                    while (statement.step()) {
                        data.push(statement.get());
                    }
                    this.results.push({
                        status: "success",
                        columns: columns,
                        values: data,
                        rowcount: data.length,
                    });
                } else {
                    let nsql = statement.getNormalizedSQL();
                    let prefix = nsql.substr(0, 6).toLowerCase();
                    statement.step(); // execute the query
                    // Try to detect INSERT/UPDATE/DELETE to give friendly feedback
                    // on rows modified - unfortunately, this won't catch such queries
                    // if they use CTEs.  There seems to be no reliable way of knowing
                    // when a SQLite query actually modified data.
                    if (
                        prefix === "insert" ||
                        prefix === "update" ||
                        prefix === "delete"
                    ) {
                        this.results.push({
                            status: "success",
                            operation: prefix,
                            rowcount: this.db.getRowsModified(),
                        });
                    } else {
                        this.results.push({ status: "success" });
                    }
                }
            }
        } catch (e) {
            this.results.push({
                status: "failure",
                message: e.toString(),
                sql: it.getRemainingSQL(),
            });
        }

        if (this.results.length === 0) {
            this.results.push({
                status: "failure",
                message: "No queries submitted.",
            });
        }

        try {
            this.saveCode = await this.manage_scrubber(this.saveCode);
            if (this.slideit) {
                $(this.historyScrubber).on(
                    "slidechange",
                    this.slideit.bind(this)
                );
            }
            $(this.historyScrubber).slider("enable");
        } catch (e) {
            console.log(`Failed to update scrubber ${e}`);
        }

        respDiv = document.createElement("div");
        respDiv.id = divid;
        this.outDiv.appendChild(respDiv);
        $(this.outDiv).show();
        // Sometimes we don't want to show a bunch of intermediate results
        // like when we are including a bunch of previous statements from
        // other activecodes In that case the showlastsql flag can be set
        // so we only show the last result
        let resultArray = this.results;
        if (this.showLast) {
            resultArray = this.results.slice(-1);
        }
        for (let r of resultArray) {
            let section = document.createElement("div");
            section.setAttribute("class", "ac_sql_result");
            respDiv.appendChild(section);
            if (r.status === "success") {
                if (r.columns) {
                    let tableDiv = document.createElement("div");
                    section.appendChild(tableDiv);
                    let maxHeight = 350;
                    if (resultArray.length > 1) maxHeight = 200; // max height smaller if lots of results
                    createTable(r, tableDiv, maxHeight);
                    let messageBox = document.createElement("pre");
                    let rmsg = r.rowcount !== 1 ? " rows " : " row ";
                    let msg = "" + r.rowcount + rmsg + "returned";
                    if (r.rowcount > 100) {
                        msg = msg + " (only first 100 rows displayed)";
                    }
                    msg = msg + ".";
                    messageBox.textContent = msg;
                    messageBox.setAttribute("class", "ac_sql_result_success");
                    section.appendChild(messageBox);
                } else if (r.rowcount) {
                    let messageBox = document.createElement("pre");
                    let op = r.operation;
                    op = op + (op.charAt(op.length - 1) === "e" ? "d." : "ed.");
                    let rmsg = r.rowcount !== 1 ? " rows " : " row ";
                    messageBox.textContent = "" + r.rowcount + rmsg + op;
                    messageBox.setAttribute("class", "ac_sql_result_success");
                    section.appendChild(messageBox);
                } else {
                    let messageBox = document.createElement("pre");
                    messageBox.textContent = "Operation succeeded.";
                    messageBox.setAttribute("class", "ac_sql_result_success");
                    section.appendChild(messageBox);
                }
            } else {
                let messageBox = document.createElement("pre");
                messageBox.textContent = r.message;
                messageBox.setAttribute("class", "ac_sql_result_failure");
                section.appendChild(messageBox);
            }
        }

        // Now handle autograding
        if (this.suffix) {
            this.testResult = this.autograde(
                this.results[this.results.length - 1]
            );
        } else {
            $(this.output).css("visibility", "hidden");
        }

        return Promise.resolve("done");
    }

    logCurrentAnswer() {
        this.logRunEvent({
            div_id: this.divid,
            code: this.editor.getValue(),
            lang: this.language,
            errinfo: this.results[this.results.length - 1].status,
            to_save: this.saveCode,
            prefix: this.pretext,
            suffix: this.suffix,
            partner: this.partner,
        }); // Log the run event

        if (this.unit_results) {
            this.logBookEvent({
                event: "unittest",
                div_id: this.divid,
                course: eBookConfig.course,
                act: this.unit_results,
            });
        }
    }

    renderFeedback() {
        if (this.testResult) {
            $(this.output).text(this.testResult);
            $(this.output).css("visibility", "visible");
        }
    }

    autograde(result_table) {
        var tests = this.suffix.split(/\n/);
        this.passed = 0;
        this.failed = 0;
        // Tests should be of the form
        // assert row,col oper value for example
        // assert 4,4 == 3
        var result = "";
        tests = tests.filter(function (s) {
            return s.indexOf("assert") > -1;
        });
        for (let test of tests) {
            let wlist = test.split(/\s+/);
            wlist.shift();
            let loc = wlist.shift();
            let oper = wlist.shift();
            let expected = wlist.join(" ");
            let [row, col] = loc.split(",");
            result += this.testOneAssert(
                row,
                col,
                oper,
                expected,
                result_table
            );
            result += "\n";
        }
        let pct = (100 * this.passed) / (this.passed + this.failed);
        pct = pct.toLocaleString(undefined, { maximumFractionDigits: 2 });
        result += `You passed ${this.passed} out of ${
            this.passed + this.failed
        } tests for ${pct}%`;
        this.unit_results = `percent:${pct}:passed:${this.passed}:failed:${this.failed}`;
        return result;
    }
    testOneAssert(row, col, oper, expected, result_table) {
        // make sure row and col are in bounds
        let actual;
        let output = "";
        try {
            actual = result_table.values[row][col];
        } catch (e) {
            output = `Failed Not enough data to check row ${row} or column ${col}`;
            return output;
        }
        const operators = {
            "==": function (operand1, operand2) {
                return operand1 == operand2;
            },
            "!=": function (operand1, operand2) {
                return operand1 != operand2;
            },
            ">": function (operand1, operand2) {
                return operand1 > operand2;
            },
            "<": function (operand1, operand2) {
                return operand1 > operand2;
            },
        };
        let res = operators[oper](actual, expected);
        if (res) {
            output = `Pass: ${actual} ${oper} ${expected} in row ${row} column ${result_table.columns[col]}`;
            this.passed++;
        } else {
            output = `Failed ${actual} ${oper} ${expected} in row ${row} column ${result_table.columns[col]}`;
            this.failed++;
        }
        return output;
    }
}

function createTable(tableData, container, maxHeight) {
    let data = tableData.values;
    let trimRows = undefined;
    if (data.length === 0) {
        // kludge: no column headers will show up unless we do this
        data = [tableData.columns.map((e) => null)];
        trimRows = [0];
    }

    var hot = new handsontable__WEBPACK_IMPORTED_MODULE_1__.default(container, {
        data: data,
        trimRows: trimRows,
        width: "100%",
        height: maxHeight,
        autoRowSize: true,
        autoColumnSize: { useHeaders: true },
        rowHeaders: false,
        colHeaders: tableData.columns,
        editor: false,
        maxRows: 100,
        filters: false,
        dropdownMenu: false,
        licenseKey: "non-commercial-and-evaluation",
    });

    // calculate actual height and resize
    let actualHeight = 40; // header height + small margin
    if (tableData.values.length > 0) {
        for (let i = 0; i < data.length; i++) {
            actualHeight = actualHeight + hot.getRowHeight(i);
            if (actualHeight > maxHeight) break;
        }
    }

    hot.updateSettings({ height: actualHeight });

    return hot;
}


/***/ }),

/***/ 27350:
/*!**********************************************!*\
  !*** ./runestone/activecode/js/audiotour.js ***!
  \**********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (/* binding */ AudioTour)
/* harmony export */ });
/* harmony import */ var _common_js_runestonebase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../common/js/runestonebase.js */ 2568);


// function to display the audio tours
class AudioTour extends _common_js_runestonebase_js__WEBPACK_IMPORTED_MODULE_0__.default {
    constructor(divid, code, bnum, audio_text) {
        // Bug Fix: If a class extends another class, this is undefined UNTIL super is called
        super();
        this.audio_tour = null;
        this.audio_code = null;
        this.windowcode = null;
        this.first_audio = null;
        this.prev_audio = null;
        this.pause_audio = null;
        this.next_audio = null;
        this.last_audio = null;
        this.status = null;
        this.stop_button = null;
        this.tourButtons = [];
        this.elem = null; // current audio element playing
        this.currIndex = null; // current index
        this.len = null; // current length of audio files for tour
        this.buttonCount = null; // number of audio tour buttons
        this.aname = null; // the audio file name
        this.ahash = null; // hash of the audio file name to the lines to highlight
        this.theDivid = null; // div id
        this.afile = null; // file name for audio
        this.playing = false; // flag to say if playing or not
        this.tourName = "";
        // Replacing has been done here to make sure special characters in the code are displayed correctly
        code = code.replaceAll("*doubleq*", '"');
        code = code.replaceAll("*singleq*", "'");
        code = code.replaceAll("*open*", "(");
        code = code.replaceAll("*close*", ")");
        code = code.replaceAll("*nline*", "<br/>");
        var codeArray = code.split("\n");
        var audio_hash = [];
        var bval = [];
        var atype = audio_text.replaceAll("*doubleq*", '"');
        var audio_type = atype.split("*atype*");
        for (let i = 0; i < audio_type.length - 1; i++) {
            audio_hash[i] = audio_type[i];
            var aword = audio_type[i].split(";");
            bval.push(aword[0]);
        }
        var first =
            "<pre><div id='" +
            divid +
            "_l1'>" +
            "1.   " +
            codeArray[0] +
            "</div>";
        var num_lines = codeArray.length;
        for (let i = 1; i < num_lines; i++) {
            if (i < 9) {
                first =
                    first +
                    "<div id='" +
                    divid +
                    "_l" +
                    (i + 1) +
                    "'>" +
                    (i + 1) +
                    ".   " +
                    codeArray[i] +
                    "</div>";
            } else if (i < 99) {
                first =
                    first +
                    "<div id='" +
                    divid +
                    "_l" +
                    (i + 1) +
                    "'>" +
                    (i + 1) +
                    ".  " +
                    codeArray[i] +
                    "</div>";
            } else {
                first =
                    first +
                    "<div id='" +
                    divid +
                    "_l" +
                    (i + 1) +
                    "'>" +
                    (i + 1) +
                    ". " +
                    codeArray[i] +
                    "</div>";
            }
        }
        first = first + "</pre>";
        //laying out the HTML content
        var bcount = 0;
        for (var i = 0; i < audio_type.length - 1; i++) {
            var newButton = document.createElement("button");
            newButton.className = "btn btn-success";
            newButton.innerHTML = bval[i].replace(/\"/g, "");
            this.tourButtons.push(newButton);
            bcount++;
        }
        this.audio_tour = document.createElement("div");
        this.audio_tour.align = "center";
        this.audio_code = document.createElement("p");
        this.windowcode = document.createElement("div");
        this.windowcode.align = "left";
        $(this.windowcode).html(first);
        this.first_audio = document.createElement("button");
        this.prev_audio = document.createElement("button");
        this.pause_audio = document.createElement("button");
        this.next_audio = document.createElement("button");
        this.last_audio = document.createElement("button");
        this.first_audio.className =
            "btn-default glyphicon glyphicon-fast-backward";
        this.prev_audio.className =
            "btn-default glyphicon glyphicon-step-backward";
        this.pause_audio.className = "btn-default glyphicon glyphicon-pause";
        this.next_audio.className =
            "btn-default glyphicon glyphicon-step-forward";
        this.last_audio.className =
            "btn-default glyphicon glyphicon-fast-forward";
        this.first_audio.setAttribute(
            "style",
            "height: 22px; width: 25px; border-radius: 4px; margin-right:2px;"
        );
        this.prev_audio.setAttribute(
            "style",
            "height: 22px; width: 25px; border-radius: 4px; margin-right:2px;"
        );
        this.pause_audio.setAttribute(
            "style",
            "height: 22px; width: 25px; border-radius: 4px; margin-right:2px;"
        );
        this.next_audio.setAttribute(
            "style",
            "height: 22px; width: 25px; border-radius: 4px; margin-right:2px;"
        );
        this.last_audio.setAttribute(
            "style",
            "height: 22px; width: 25px; border-radius: 4px; margin-right:2px;"
        );
        this.first_audio.name = "first_audio";
        this.prev_audio.name = "prev_audio";
        this.pause_audio.name = "pause_audio";
        this.next_audio.name = "next_audio";
        this.last_audio.name = "last_audio";
        this.first_audio.title = "Play first audio in tour";
        this.prev_audio.title = "Play previous audio in tour";
        this.pause_audio.title = "Pause current audio";
        this.next_audio.title = "Play next audio in tour";
        this.last_audio.title = "Play last audio in tour";
        this.first_audio.setAttribute("aria-label", "Play first audio in tour");
        this.prev_audio.setAttribute(
            "aria-label",
            "Play previous audio in tour"
        );
        this.pause_audio.setAttribute("aria-label", "Pause audio");
        this.next_audio.setAttribute("aria-label", "Play next audio in tour");
        this.last_audio.setAttribute("aria-label", "Play last audio in tour");
        this.first_audio.disabled = true;
        this.prev_audio.disabled = true;
        this.pause_audio.disabled = true;
        this.next_audio.disabled = true;
        this.last_audio.disabled = true;
        this.status = document.createElement("div");
        this.status.className = "alert alert-info";
        this.status.setAttribute("style", "display: none;");
        this.stop_button = document.createElement("button");
        this.stop_button.className = "btn btn-default";
        this.stop_button.innerHTML = "Stop tour";
        $(this.audio_tour).append(
            this.audio_code,
            this.windowcode,
            document.createElement("br"),
            this.first_audio,
            this.prev_audio,
            this.pause_audio,
            this.next_audio,
            this.last_audio,
            document.createElement("br"),
            this.status,
            document.createElement("br"),
            this.tourButtons,
            this.stop_button
        );
        $("#" + divid + " .ac_code_div").append(this.audio_tour);
        $("#" + divid + " .ac_code_div").css("width", "100%");
        $("#" + divid + " .CodeMirror.cm-s-default.ui-resizable").hide();
        $("#" + divid + " .ac_opt.btn.btn-default:last-child").hide();
        $(this.stop_button).click(
            function () {
                if (this.playing) {
                    this.elem.pause();
                }
                //log change to db
                this.logBookEvent({
                    event: "Audio",
                    act: "closeWindow",
                    div_id: divid,
                });
                $(this.audio_tour).remove();
                $(
                    "#" + divid + " .CodeMirror.cm-s-default.ui-resizable"
                ).show();
                $("#" + divid + " .ac_opt.btn.btn-default:last-child").show();
                $("#" + divid + " .ac_code_div").css("width", "");
            }.bind(this)
        );
        $(this.tourButtons[0]).click(
            function () {
                this.tour(divid, audio_hash[0], bcount);
            }.bind(this)
        );
        $(this.tourButtons[1]).click(
            function () {
                this.tour(divid, audio_hash[1], bcount);
            }.bind(this)
        );
        $(this.tourButtons[2]).click(
            function () {
                this.tour(divid, audio_hash[2], bcount);
            }.bind(this)
        );
        $(this.tourButtons[3]).click(
            function () {
                this.tour(divid, audio_hash[3], bcount);
            }.bind(this)
        );
        $(this.tourButtons[4]).click(
            function () {
                this.tour(divid, audio_hash[4], bcount);
            }.bind(this)
        );
        // handle the click to go to the next audio
        $(this.first_audio).click(
            function () {
                this.firstAudio();
            }.bind(this)
        );
        // handle the click to go to the next audio
        $(this.prev_audio).click(
            function () {
                this.prevAudio();
            }.bind(this)
        );
        // handle the click to pause or play the audio
        $(this.pause_audio).click(
            function () {
                this.pauseAndPlayAudio(divid);
            }.bind(this)
        );
        // handle the click to go to the next audio
        $(this.next_audio).click(
            function () {
                this.nextAudio();
            }.bind(this)
        );
        // handle the click to go to the next audio
        $(this.last_audio).click(
            function () {
                this.lastAudio();
            }.bind(this)
        );
        // make the image buttons look disabled
        $(this.first_audio).css("opacity", 0.25);
        $(this.prev_audio).css("opacity", 0.25);
        $(this.pause_audio).css("opacity", 0.25);
        $(this.next_audio).css("opacity", 0.25);
        $(this.last_audio).css("opacity", 0.25);
    }
    tour(divid, audio_type, bcount) {
        // set globals
        this.buttonCount = bcount;
        this.theDivid = divid;
        this.status.setAttribute(
            "style",
            "display: inline-block; margin-top: 7px; margin-bottom: 3px;"
        );
        // enable prev, pause/play and next buttons and make visible
        $(this.first_audio).removeAttr("disabled");
        $(this.prev_audio).removeAttr("disabled");
        $(this.pause_audio).removeAttr("disabled");
        $(this.next_audio).removeAttr("disabled");
        $(this.last_audio).removeAttr("disabled");
        $(this.first_audio).css("opacity", 1.0);
        $(this.prev_audio).css("opacity", 1.0);
        $(this.pause_audio).css("opacity", 1.0);
        $(this.next_audio).css("opacity", 1.0);
        $(this.last_audio).css("opacity", 1.0);
        // disable tour buttons
        for (var i = 0; i < bcount; i++)
            $(this.tourButtons[i]).attr("disabled", "disabled");
        var atype = audio_type.split(";");
        var name = atype[0].replaceAll('"', " ");
        this.tourName = name;
        $(this.status).html($.i18n("msg_activecode_starting", name));
        //log tour type to db
        this.logBookEvent({ event: "Audio", act: name, div_id: divid });
        var max = atype.length;
        var str = "";
        this.ahash = [];
        this.aname = [];
        for (i = 1; i < max - 1; i++) {
            var temp = atype[i].split(":");
            var temp_line = temp[0];
            var temp_aname = temp[1];
            var akey = temp_aname.substring(1, temp_aname.length);
            var lnums = temp_line.substring(1, temp_line.length);
            //alert("akey:"+akey+"lnum:"+lnums);
            // str+="<audio id="+akey+" preload='auto'><source src='http://ice-web.cc.gatech.edu/ce21/audio/"+
            // akey+".mp3' type='audio/mpeg'><source src='http://ice-web.cc.gatech.edu/ce21/audio/"+akey+
            // ".ogg' type='audio/ogg'>Your browser does not support the audio tag</audio>";
            //var dir =
            //    "http://media.interactivepython.org/" +
            //    eBookConfig.basecourse.toLowerCase() +
            //    "/audio/";
            var dir = "../_static/audio/"
            str += "<audio id=" + akey + " preload='auto' >";
            str += "<source src='" + dir + akey + ".wav' type='audio/wav'>";
            str += "<source src='" + dir + akey + ".mp3' type='audio/mpeg'>";
            str += "<source src='" + dir + akey + ".wav' type='audio/wav'>";
            str += "<source src='" + dir + akey + ".mp3' type='audio/mpeg'>";
            str += "<br />Your browser does not support the audio tag</audio>";
            this.ahash[akey] = lnums;
            this.aname.push(akey);
        }
        $(this.audio_code).html(str);
        this.len = this.aname.length; // set the number of audio file in the tour
        this.currIndex = 0;
        this.playCurrIndexAudio();
    }
    handlePlaying() {
        this.elem.pause();
        // unbind current ended
        $("#" + this.afile).unbind("ended");
        // unhighlight the prev lines
        this.unhighlightLines(
            this.theDivid,
            this.ahash[this.aname[this.currIndex]]
        );
    }
    firstAudio() {
        // if audio is this.playing handle it
        this.handlePlaying();
        //log change to db
        this.logBookEvent({
            event: "Audio",
            act: "first",
            div_id: this.theDivid,
        });
        // move to the first audio
        this.currIndex = 0;
        // start at the first audio
        this.playCurrIndexAudio();
    }
    prevAudio() {
        // if there is a previous audio
        if (this.currIndex > 0) {
            // if audio is this.playing handle it
            this.handlePlaying();
            //log change to db
            this.logBookEvent({
                event: "Audio",
                act: "prev",
                div_id: this.theDivid,
            });
            // move to previous to the current (but the current index has moved to the next)
            this.currIndex = this.currIndex - 1;
            // start at the prev audio
            this.playCurrIndexAudio();
        }
    }
    nextAudio() {
        // if audio is this.playing handle it
        this.handlePlaying();
        //log change to db
        this.logBookEvent({
            event: "Audio",
            act: "next",
            div_id: this.theDivid,
        });
        // if not at the end
        if (this.currIndex < this.len - 1) {
            // start at the next audio
            this.currIndex = this.currIndex + 1;
            this.playCurrIndexAudio();
        } else if (this.currIndex == this.len - 1) {
            this.handleTourEnd();
        }
    }
    lastAudio() {
        // if audio is this.playing handle it
        this.handlePlaying();
        //log change to db
        this.logBookEvent({
            event: "Audio",
            act: "last",
            div_id: this.theDivid,
        });
        // move to the last audio
        this.currIndex = this.len - 1;
        // start at last
        this.playCurrIndexAudio();
    }
    // play the audio at the current index
    playCurrIndexAudio() {
        // set this.playing to false
        this.playing = false;
        // play the current audio and highlight the lines
        this.playaudio(this.currIndex, this.aname, this.theDivid, this.ahash);
    }
    // handle the end of the tour
    handleTourEnd() {
        $(this.status).html("The " + this.tourName + " has ended.");
        this.pause_audio.className = "btn-default glyphicon glyphicon-pause";
        this.pause_audio.title = "Pause audio";
        this.pause_audio.setAttribute("aria-label", "Pause audio");
        $(this.first_audio).attr("disabled", "disabled");
        $(this.prev_audio).attr("disabled", "disabled");
        $(this.pause_audio).attr("disabled", "disabled");
        $(this.next_audio).attr("disabled", "disabled");
        $(this.last_audio).attr("disabled", "disabled");
        $(this.first_audio).css("opacity", 0.25);
        $(this.prev_audio).css("opacity", 0.25);
        $(this.pause_audio).css("opacity", 0.25);
        $(this.next_audio).css("opacity", 0.25);
        $(this.last_audio).css("opacity", 0.25);
        // enable the tour buttons
        for (var j = 0; j < this.buttonCount; j++)
            $(this.tourButtons[j]).removeAttr("disabled");
    }
    // only call this one after the first time
    outerAudio() {
        // unbind ended
        $("#" + this.afile).unbind("ended");
        // set this.playing to false
        this.playing = false;
        // unhighlight previous lines from the last audio
        this.unhighlightLines(
            this.theDivid,
            this.ahash[this.aname[this.currIndex]]
        );
        // increment the this.currIndex to point to the next one
        this.currIndex++;
        // if the end of the tour reset the buttons
        if (this.currIndex == this.len) {
            this.handleTourEnd();
        }
        // else not done yet so play the next audio
        else {
            // play the audio at the current index
            this.playCurrIndexAudio();
        }
    }
    // play the audio now that it is ready
    playWhenReady(afile, divid, ahash) {
        // unbind current
        $("#" + afile).unbind("canplaythrough");
        this.elem.currentTime = 0;
        this.playing = true;
        //console.log("in playWhenReady " + elem.duration);
        this.highlightLines(divid, ahash[afile]);
        if (
            this.pause_audio.className ===
            "btn-default glyphicon glyphicon-pause"
        ) {
            $(this.status).html(
                $.i18n("msg_activecode_playing", this.tourName)
            );
            $("#" + afile).bind(
                "ended",
                function () {
                    this.outerAudio();
                }.bind(this)
            );
            this.elem.play();
        } else {
            $("#" + afile).bind(
                "ended",
                function () {
                    this.outerAudio();
                }.bind(this)
            );
        }
    }
    // play the audio at the specified index i and set the duration and highlight the lines
    playaudio(i, aname, divid, ahash) {
        this.afile = aname[i];
        this.elem = document.getElementById(this.afile);
        // if this isn't ready to play yet - no duration yet then wait
        //console.log("in playaudio " + elem.duration);
        if (isNaN(this.elem.duration) || this.elem.duration == 0) {
            // set the status
            $(this.status).html($.i18n("msg_activecode_loading_audio"));
            $("#" + this.afile).bind(
                "canplaythrough",
                function () {
                    this.playWhenReady(this.afile, divid, ahash);
                }.bind(this)
            );
        }
        // otherwise it is ready so play it
        else {
            this.playWhenReady(this.afile, divid, ahash);
        }
    }
    // pause if this.playing and play if paused
    pauseAndPlayAudio(divid) {
        var btn = this.pause_audio;
        // if paused and clicked then continue from current
        if (this.elem.paused) {
            // calcualte the time left to play in milliseconds
            let counter = (this.elem.duration - this.elem.currentTime) * 1000;
            this.elem.play(); // start the audio from current spot
            this.pause_audio.className =
                "btn-default glyphicon glyphicon-pause";
            this.pause_audio.title = $.i18n(
                "msg_activecode_pause_current_audio"
            );
            this.pause_audio.setAttribute(
                "aria-label",
                $.i18n("msg_activecode_pause_audio")
            );
            $(this.status).html(
                $.i18n("msg_activecode_playing", this.tourName)
            );
            //log change to db
            this.logBookEvent({
                event: "Audio",
                act: "play",
                div_id: this.theDivid,
            });
        }
        // if audio was this.playing pause it
        else if (this.playing) {
            this.elem.pause(); // pause the audio
            this.pause_audio.className = "btn-default glyphicon glyphicon-play";
            this.pause_audio.title = $.i18n("msg_activecode_play_paused_audio");
            this.pause_audio.setAttribute(
                "aria-label",
                $.i18n("msg_activecode_play_paused_audio")
            );
            $(this.status).html(
                $.i18n("msg_activecode_audio_paused", this.tourName)
            );
            //log change to db
            this.logBookEvent({
                event: "Audio",
                act: "pause",
                div_id: this.theDivid,
            });
        }
    }
    // process the lines
    processLines(divid, lnum, color) {
        var comma = lnum.split(",");
        if (comma.length > 1) {
            for (let i = 0; i < comma.length; i++) {
                this.setBackgroundForLines(divid, comma[i], color);
            }
        } else {
            this.setBackgroundForLines(divid, lnum, color);
        }
    }
    // unhighlight the lines - set the background back to transparent
    unhighlightLines(divid, lnum) {
        this.processLines(divid, lnum, "transparent");
    }
    // highlight the lines - set the background to a yellow color
    highlightLines(divid, lnum) {
        this.processLines(divid, lnum, "#ffff99");
    }
    // set the background to the passed color
    setBackgroundForLines(divid, lnum, color) {
        var hyphen = lnum.split("-");
        var str;
        // if a range of lines
        if (hyphen.length > 1) {
            var start = parseInt(hyphen[0]);
            var end = parseInt(hyphen[1]) + 1;
            for (var k = start; k < end; k++) {
                //alert(k);
                str = "#" + divid + "_l" + k;
                if ($(str).text() != "") {
                    $(str).css("background-color", color);
                }
                //$(str).effect("highlight",{},(dur*1000)+4500);
            }
        } else {
            //alert(lnum);
            str = "#" + divid + "_l" + lnum;
            $(str).css("background-color", color);
            //$(str).effect("highlight",{},(dur*1000)+4500);
        }
    }
}


/***/ }),

/***/ 69902:
/*!*******************************************************!*\
  !*** ./runestone/activecode/js/extractUnitResults.js ***!
  \*******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (/* binding */ JUnitTestParser)
/* harmony export */ });
var testString = `Starting Tests
Expected: Answer                   Actual: Answer                   Message: Checking method printAnswer()                     Passed: true
Expected: 6 line(s) of text        Actual: 0 line(s) of text        Message: Checking main method                              Passed: false
Hello World
Expected: String String            Actual: String String            Message: Checking Instance Variable Type(s)                Passed: true
Expected: Question                 Actual: Question                 Message: Checking method printQuestion()                   Passed: true
Debugging output
More debug output
Expected: 2 Private                Actual: 2 Private                Message: Checking Private Instance Variable(s)             Passed: true
Expected: pass                     Actual: pass                     Message: Checking constructor with parameters              Passed: true
Expected: fail                     Actual: fail                     Message: Checking default constructor                      Passed: true
Ending Tests
You got 6 out of 7 correct. 85.71%`;

class JUnitTestParser {
    constructor(output, parentId) {
        let patt = new RegExp(
            "Expected:\\s+(.*?)Actual:\\s+(.*?)Message:\\s+(.*?)Passed:\\s+(true|false)",
            "g"
        );
        this.textResults = "";
        let matches = output.matchAll(patt);
        let parent = document.createElement("div");
        parent.classList.add("unittest-results");
        let tbl = document.createElement("table");
        tbl.classList.add("ac-feedback");
        parent.appendChild(tbl);
        parent.setAttribute("id", `${parentId}_unit_results`);
        let tr = document.createElement("tr");
        tr.innerHTML =
            '<th class="ac-feedback">Result</th><th class="ac-feedback">Expected</th><th class="ac-feedback">Actual</th><th class="ac-feedback">Notes</th>';
        tbl.appendChild(tr);
        for (const match of matches) {
            let tr = document.createElement("tr");
            let td = document.createElement("td");
            td.classList.add("ac-feedback");
            if (match[match.length - 1] == "true") {
                td.innerHTML = "Pass";
                td.style =
                    "background-color: rgb(131, 211, 130); text-align: center;";
            } else {
                td.innerHTML = "Fail";
                td.style =
                    "background-color: rgb(222, 142, 150); text-align: center;";
            }
            tr.appendChild(td);
            tbl.appendChild(tr);
            for (let i = 1; i < match.length - 1; i++) {
                let td = document.createElement("td");
                td.innerHTML = match[i];
                td.classList.add("ac-feedback");
                tr.appendChild(td);
            }
            tbl.appendChild(tr);
            this.table = parent;
            this.textResults += match[0] + "\n";
            output = output.replace(match[0], "");
        }
        let match = output.match(
            /You got\s+(\d+) out of (\d+) correct.\s+(\d+\.\d+)%/
        );
        if (match) {
            output = output.replace(match[0], "");
            let pctString = document.createElement("span");
            pctString.innerHTML = match[0];
            this.pctString = pctString;
            this.pct = match[3];
            this.passed = match[1];
            this.failed = match[2] - match[1];
        }
        output = output.replace("Starting Tests", "");
        output = output.replace("Ending Tests", "");
        output = output.replace(/\n/g, "<br>");
        output = output.replace(/(<br>)+/g, "<br>");
        output = output.replaceAll("&lt;img", "<img");
        this.stdout = output;
    }
}

// let x = new ResultsToTable(testString);
// console.log(x.stdout);
// console.log(x.table);


/***/ }),

/***/ 45425:
/*!*********************************************!*\
  !*** ./runestone/activecode/js/livecode.js ***!
  \*********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (/* binding */ LiveCode)
/* harmony export */ });
/* harmony import */ var _activecode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./activecode.js */ 750);
/* harmony import */ var _md5_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./md5.js */ 64440);
/* harmony import */ var _extractUnitResults_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./extractUnitResults.js */ 69902);
/* harmony import */ var _codelens_js_pytutor_embed_bundle_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../codelens/js/pytutor-embed.bundle.js */ 71951);
/* harmony import */ var _codelens_js_pytutor_embed_bundle_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_codelens_js_pytutor_embed_bundle_js__WEBPACK_IMPORTED_MODULE_3__);





class LiveCode extends _activecode_js__WEBPACK_IMPORTED_MODULE_0__.ActiveCode {
    constructor(opts) {
        var orig = $(opts.orig).find("textarea")[0];
        super(opts);
        this.stdin = $(orig).data("stdin");
        this.datafile = $(orig).data("datafile");
        this.sourcefile = $(orig).data("sourcefile");
        this.compileargs = unescapeHtml($(orig).data("compileargs"));
        this.linkargs = unescapeHtml($(orig).data("linkargs"));
        this.runargs = unescapeHtml($(orig).data("runargs"));
        this.interpreterargs = unescapeHtml($(orig).data("interpreterargs"));
        this.API_KEY = "67033pV7eUUvqo07OJDIV8UZ049aLEK1";
        this.USE_API_KEY = true;
        this.JOBE_SERVER = eBookConfig.jobehost || eBookConfig.host;
        this.resource = eBookConfig.proxyuri_runs || "/runestone/proxy/jobeRun";
        this.jobePutFiles =
            eBookConfig.proxyuri_files || "/runestone/proxy/jobePushFile/";
        this.jobeCheckFiles =
            eBookConfig.proxyuri_files || "/runestone/proxy/jobeCheckFile/";
        // TODO:  should add a proper put/check in pavement.tmpl as this is misleading and will break on runestone
        this.div2id = {};
        if (this.stdin) {
            this.createInputElement();
        }
        this.createErrorOutput();
    }
    outputfun(a) {}
    createInputElement() {
        var label = document.createElement("label");
        label.for = this.divid + "_stdin";
        $(label).text($.i18n("msg_activecode_input_prg"));
        var input = document.createElement("input");
        input.id = this.divid + "_stdin";
        input.type = "text";
        input.size = "35";
        input.value = this.stdin;
        this.outerDiv.appendChild(label);
        this.outerDiv.appendChild(input);
        this.stdin_el = input;
    }
    createErrorOutput() {}

    /*  Main runProg method for livecode
     *
     */
    async runProg() {
        await this.runSetup();
        try {
            let res = await this.submitToJobe();
            if (!res.ok) {
                this.addJobeErrorMessage(
                    $.i18n(`Server Error: ${res.statusText}`)
                );
                $(this.runButton).removeAttr("disabled");
                return "fail";
            }
            let runResults = await res.json();
            this.processJobeResponse(runResults);
        } catch (e) {
            this.addJobeErrorMessage(
                $.i18n("msg_activecode_server_comm_err") + e.toString()
            );
            $(this.runButton).removeAttr("disabled");
            return `fail: ${e}`;
        }
        return "success";
    }
    /**
     * Note:
     * In order to check for supplemental files in java and deal with asynchronicity
     * I split the original runProg into two functions: runProg and runProg_callback
     */
    async runSetup() {
        var stdin;
        var source;
        var saveCode = "True";
        var sfilemap = {
            java: "",
            cpp: "test.cpp",
            c: "test.c",
            python3: "test.py",
            python2: "test.py",
            octave: "octatest.m",
        };
        var sourcefilename = "";
        var testdrivername = "";
        var file_checkp;

        // extract the class names so files can be named properly
        if (this.suffix && this.language == "java") {
            let classMatch = new RegExp(/public class\s+(\w+)[\s+{]/);
            source = await this.buildProg(false);
            let m = source.match(classMatch);
            if (m) {
                sourcefilename = m[1] + ".java";
            }
            // this will be unit test code
            m = this.suffix.match(classMatch);
            if (m) {
                testdrivername = m[1] + ".java";
            }
        } else {
            source = await this.buildProg(true);
        }
        // Validate the data is convertible to Base64. If not then error out now
        try {
            btoa(source);
        } catch (e) {
            alert(
                "Error: Bad Characters in the activecode window. Likely a quote character that has been copy/pasted. 🙁"
            );
            return;
        }

        this.saveCode = await this.manage_scrubber(saveCode);

        // assemble parameters for JOBE
        var paramlist = [
            "compileargs",
            "linkargs",
            "runargs",
            "interpreterargs",
            "memorylimit",
        ];
        var paramobj = {};
        for (let param of paramlist) {
            if (this[param]) {
                paramobj[param] = eval(this[param]); // needs a list
            }
        }
        if (this.language === "octave") {
            paramobj.memorylimit = 200000;
        }

        if (this.stdin) {
            stdin = $(this.stdin_el).val();
        }
        if (!this.sourcefile) {
            this.sourcefile = sfilemap[this.language];
        }

        $(this.output).html($.i18n("msg_activecode_compiling_running"));
        var files = [];
        var content, base64;
        if (this.datafile != undefined) {
            var ids = this.datafile.split(",");
            for (var i = 0; i < ids.length; i++) {
                let fileName = ids[i].trim();
                let file = document.getElementById(fileName);
                let fileExtension = fileName.substring(
                    fileName.lastIndexOf(".") + 1
                );
                if (file === null || file === undefined) {
                    // console.log("No file with given id");
                    // check to see if file is in db
                    content = this.fileReader(fileName);
                } else {
                    content = file.textContent;
                    // may be undefined at this point if file is an image
                }
                if (fileExtension === "jar") {
                    files = files.concat(this.parseJavaClasses(content));
                } else if (["jpg", "png", "gif"].indexOf(fileExtension) > -1) {
                    if (file) {
                        if (file.toDataURL) {
                            base64 = file.toDataURL("image/" + fileExtension);
                            base64 = base64.substring(base64.indexOf(",") + 1);
                        } else {
                            base64 = file.src.substring(
                                file.src.indexOf(",") + 1
                            );
                        }
                    } else {
                        base64 = content;
                    }
                    files.push({ name: fileName, content: base64 });
                } else {
                    // if no className or un recognized className it is treated as an individual file
                    // this could be any type of file, .txt, .java, .csv, etc
                    files.push({ name: fileName, content: content });
                }
            }
        }
        // If we are running unit tests we need to substitute the test driver for the student
        // code and send the student code as a file.  We'll do that here.
        this.junitDriverCode = `
        import org.junit.runner.JUnitCore;
        import org.junit.runner.Result;
        import org.junit.runner.notification.Failure;

        public class TestRunner {
            public static void main(String[] args) {
                CodeTestHelper.resetFinalResults();
                Result result = JUnitCore.runClasses(${testdrivername.replace(
                    ".java",
                    ".class"
                )});
                System.out.println(CodeTestHelper.getFinalResults());

                int total = result.getRunCount();
                int fails = result.getFailureCount();
                int corr  = total - fails;
                System.out.println("You got " + corr + " out of " + total + " correct. " + String.format("%.2f", (100.0 * corr / total)) + "%");
            }
        }
        `;
        if (this.suffix && this.language == "java") {
            files.push({ name: sourcefilename, content: source });
            files.push({ name: testdrivername, content: this.suffix });
            source = this.junitDriverCode;
            if (paramobj.compileargs) {
                paramobj.compileargs.push(sourcefilename);
            } else {
                paramobj.compileargs = [sourcefilename];
            }
        }
        let runspec = {
            language_id: this.language,
            sourcecode: source,
            parameters: paramobj,
            sourcefilename: this.sourcefile,
        };

        if (stdin) {
            runspec.input = stdin;
        }
        if (files.length === 0) {
            this.json_runspec = JSON.stringify({ run_spec: runspec });
            file_checkp = Promise.resolve("ready");
        } else {
            runspec["file_list"] = [];
            var promises = [];
            var instance = this;

            for (let i = 0; i < files.length; i++) {
                var fileName = files[i].name;
                var fileContent = files[i].content;
                instance.div2id[fileName] =
                    "runestone" + (0,_md5_js__WEBPACK_IMPORTED_MODULE_1__.default)(fileName + fileContent);
                runspec["file_list"].push([
                    instance.div2id[fileName],
                    fileName,
                ]);
                promises.push(
                    new Promise((resolve, reject) => {
                        instance.checkFile(files[i], resolve, reject);
                    })
                );
            }
            this.json_runspec = JSON.stringify({ run_spec: runspec });
            this.div2id = instance.div2id;
            file_checkp = Promise.all(promises).catch(function (err) {
                console.log("Error: " + err);
            });
        }
        return file_checkp;
    }

    /* Submit the assembled job to the JOBE server and await the results.
     *
     */
    async submitToJobe() {
        var data = this.json_runspec;
        let host = this.JOBE_SERVER + this.resource;
        $(this.runButton).attr("disabled", "disabled");
        $(this.outDiv).show({ duration: 700, queue: false });
        $(this.errDiv).remove();
        $(this.output).css("visibility", "visible");

        let headers = new Headers({
            "Content-type": "application/json; charset=utf-8",
            Accept: "application/json",
            "X-API-KEY": this.API_KEY,
        });
        let request = new Request(host, {
            method: "POST",
            headers: headers,
            body: data,
        });
        return fetch(request);

        ///$("#" + divid + "_errinfo").remove();
    }

    processJobeResponse(result) {
        var logresult;
        var odiv = this.output;
        this.parsedOutput = {};
        $(this.runButton).removeAttr("disabled");
        if (result.outcome === 15) {
            logresult = "success";
        } else {
            logresult = result.outcome;
        }
        this.errinfo = logresult;
        switch (result.outcome) {
            case 15: {
                this.parsedOutput = new _extractUnitResults_js__WEBPACK_IMPORTED_MODULE_2__.default(
                    result.stdout,
                    this.divid
                );
                $(odiv).html(this.parsedOutput.stdout);
                if (this.suffix) {
                    if (this.parsedOutput.pct === undefined) {
                        this.parsedOutput.pct = this.parsedOutput.passed = this.parsedOutput.failed = 0;
                    }
                    this.unit_results = `percent:${this.parsedOutput.pct}:passed:${this.parsedOutput.passed}:failed:${this.parsedOutput.failed}`;
                }
                break;
            }
            case 11: // compiler error
                $(odiv).html($.i18n("msg_activecode_were_compiling_err"));
                this.addJobeErrorMessage(result.cmpinfo);
                break;
            case 12: // run time error
                $(odiv).html(result.stdout.replace(/\n/g, "<br>"));
                if (result.stderr) {
                    this.addJobeErrorMessage(result.stderr);
                }
                break;
            case 13: // time limit
                $(odiv).html(result.stdout.replace(/\n/g, "<br>"));
                this.addJobeErrorMessage(
                    $.i18n("msg_activecode_time_limit_exc")
                );
                break;
            default:
                if (result.stderr) {
                    $(odiv).html(result.stderr.replace(/\n/g, "<br>"));
                } else {
                    this.addJobeErrorMessage(
                        $.i18n("msg_activecode_server_err")
                    );
                }
        }
        // todo: handle server busy and timeout errors too
    }

    renderFeedback() {
        let rdiv = document.getElementById(`${this.divid}_unit_results`);
        if (rdiv) {
            rdiv.remove();
        }
        if (this.parsedOutput && this.parsedOutput.table) {
            this.outDiv.appendChild(this.parsedOutput.table);
        }
        rdiv = document.getElementById(`${this.divid}_unit_results`);
        if (rdiv) {
            rdiv.appendChild(this.parsedOutput.pctString);
        }
    }

    addJobeErrorMessage(err) {
        var errHead = $("<h3>").html("Error");
        var eContainer = this.outerDiv.appendChild(
            document.createElement("div")
        );
        this.errDiv = eContainer;
        eContainer.className = "error alert alert-danger";
        eContainer.id = this.divid + "_errinfo";
        eContainer.appendChild(errHead[0]);
        var errText = eContainer.appendChild(document.createElement("pre"));
        errText.innerHTML = err;
    }
    /**
     * Checks to see if file is on server
     * Places it on server if it is not on server
     * @param  {object{name, contents}} file    File to place on server
     * @param  {function} resolve promise resolve function
     * @param  {function} reject  promise reject function
     */
    checkFile(file, resolve, reject) {
        var file_id = this.div2id[file.name];
        var resource = this.jobeCheckFiles + file_id;
        var host = this.JOBE_SERVER + resource;
        var xhr = new XMLHttpRequest();
        xhr.open("HEAD", host, true);
        xhr.setRequestHeader("Content-type", "application/json");
        xhr.setRequestHeader("Accept", "text/plain");
        xhr.setRequestHeader("X-API-KEY", this.API_KEY);
        xhr.onerror = function () {
            // console.log("error sending file" + xhr.responseText);
        };
        xhr.onload = function () {
            switch (xhr.status) {
                case 208:
                case 404:
                    // console.log("File not on Server");
                    this.pushDataFile(file, resolve, reject);
                    break;
                case 400:
                    // console.log("Bad Request");
                    reject();
                    break;
                case 204:
                    // console.log("File already on Server");
                    resolve();
                    break;
                default:
                    //console.log("This case should never happen");
                    reject();
            }
        }.bind(this);
        xhr.send();
    }
    /**
     * Places a file on a server
     */
    pushDataFile(file, resolve, reject) {
        var fileName = file.name;
        var extension = fileName.substring(fileName.indexOf(".") + 1);
        var file_id = this.div2id[fileName];
        var contents = file.content;
        // File types being uploaded that come in already in base64 format
        var extensions = ["jar", "zip", "png", "jpg", "jpeg"];
        var contentsb64;
        if (extensions.indexOf(extension) === -1) {
            contentsb64 = btoa(contents);
        } else {
            contentsb64 = contents;
        }
        var data = JSON.stringify({ file_contents: contentsb64 });
        var resource = this.jobePutFiles + file_id;
        var host = this.JOBE_SERVER + resource;
        var xhr = new XMLHttpRequest();
        xhr.open("PUT", host, true);
        xhr.setRequestHeader("Content-type", "application/json");
        xhr.setRequestHeader("Accept", "text/plain");
        xhr.setRequestHeader("X-API-KEY", this.API_KEY);
        xhr.onload = function () {
            switch (xhr.status) {
                case 403:
                    // console.log("Forbidden");
                    reject();
                    break;
                case 400:
                    // console.log("Bad Request");
                    reject();
                    break;
                case 204:
                    //console.log("successfully sent file " + xhr.responseText);
                    //console.log("File " + fileName +", " + file_id +" placed on server");
                    resolve();
                    break;
                default:
                    // console.log("This case should never happen");
                    reject();
            }
        }.bind(this);
        xhr.onerror = function () {
            // console.log("error sending file" + xhr.responseText);
            reject();
        };
        xhr.send(data);
    }

    async showCodelens() {
        let clMess = "";
        if (this.codelens.style.display == "none") {
            this.codelens.style.display = "block";
            clMess = "Building your visualization";
            this.codelens.innerHTML = clMess;
            this.clButton.innerText = $.i18n("msg_activecode_hide_codelens");
        } else {
            this.codelens.style.display = "none";
            this.clButton.innerText = $.i18n("msg_activecode_show_in_codelens");
            return;
        }
        var cl = this.codelens.firstChild;
        if (cl) {
            this.codelens.removeChild(cl);
            this.codelens.innerHTML = clMess;
        }
        var code = await this.buildProg(false);
        if (code.match(/System.exit/)) {
            alert(
                "Sorry... System.exit breaks the visualizer temporarily removing"
            );
            code = code.replace(/System.exit\(\d+\);/, "");
        }
        var myVars = {};
        myVars.code = code;
        myVars.lang = this.language;
        if (this.stdin) {
            myVars.stdin = $(this.stdin_el).val();
        }
        var targetDiv = this.codelens.id;

        let request = new Request("/runestone/proxy/pytutor_trace", {
            method: "POST",
            body: JSON.stringify(myVars),
            headers: this.jsonHeaders,
        });
        try {
            let response = await fetch(request);
            let data = await response.json();
            let vis = addVisualizerToPage(data, targetDiv, {
                startingInstruction: 0,
                editCodeBaseURL: null,
                hideCode: false,
                lang: myVars.lang,
            });
        } catch (error) {
            let targetDivError = document.getElementById(targetDiv);
            targetDivError.innerHTML =
                "Sorry, an error occurred while creating your visualization.";
            console.log("Get Trace Failed -- ");
            console.log(error);
        }

        this.logBookEvent({
            event: "codelens",
            act: "view",
            div_id: this.divid,
        });
    }

    /**
     * Seperates text into multiple .java files
     * @param  {String} text String with muliple java classes needed to be seperated
     * @return {array of objects}  .name gives the name of the java file with .java extension
     *                   .content gives the contents of the file
     */
    parseJavaClasses(text) {
        text = text.trim();
        var found = false;
        var stack = 0;
        var startIndex = 0;
        var classes = [];
        var importIndex = 0;
        var endOfLastCommentBeforeClassBegins = 0;
        for (var i = 0; i < text.length; i++) {
            var char = text.charAt(i);
            if (char === "/") {
                i++;
                if (text.charAt(i) === "/") {
                    i++;
                    while (text.charAt(i) !== "\n" && i < text.length) {
                        i++;
                    }
                    if (!found) {
                        endOfLastCommentBeforeClassBegins = i;
                    }
                } else if (text.charAt(i) == "*") {
                    i++;
                    while (
                        (text.charAt(i) !== "*" ||
                            text.charAt(i + 1) !== "/") &&
                        i + 1 < text.length
                    ) {
                        i++;
                    }
                    if (!found) {
                        endOfLastCommentBeforeClassBegins = i;
                    }
                }
            } else if (char === '"') {
                i++;
                while (text.charAt(i) !== '"' && i < text.length) {
                    i++;
                }
            } else if (char === "'") {
                while (text.charAt(i) !== "'" && i < text.length) {
                    i++;
                }
            } else if (char === "(") {
                var pCount = 1;
                i++;
                while (pCount > 0 && i < text.length) {
                    if (text.charAt(i) === "(") {
                        pCount++;
                    } else if (text.charAt(i) === ")") {
                        pCount--;
                    }
                    i++;
                }
            }
            if (!found && text.charAt(i) === "{") {
                startIndex = i;
                found = true;
                stack = 1;
            } else if (found) {
                if (text.charAt(i) === "{") {
                    stack++;
                }
                if (text.charAt(i) === "}") {
                    stack--;
                }
            }
            if (found && stack === 0) {
                let endIndex = i + 1;
                var words = text
                    .substring(endOfLastCommentBeforeClassBegins, startIndex)
                    .trim()
                    .split(" ");
                var className = "";
                for (var w = 0; w < words.length; w++) {
                    className = words[w];
                    if (words[w] === "extends" || words[w] === "implements") {
                        className = words[w - 1];
                        w = words.length;
                    }
                }
                className = className.trim() + ".java";
                classes.push({
                    name: className,
                    content: text.substring(importIndex, endIndex),
                });
                found = false;
                importIndex = endIndex;
                endOfLastCommentBeforeClassBegins = endIndex;
            }
        }
        return classes;
    }
}
function unescapeHtml(safe) {
    if (safe) {
        return safe
            .replace(/&amp;/g, "&")
            .replace(/&lt;/g, "<")
            .replace(/&gt;/g, ">")
            .replace(/&quot;/g, '"')
            .replace(/&#x27;/g, "'");
    }
}


/***/ }),

/***/ 64440:
/*!****************************************!*\
  !*** ./runestone/activecode/js/md5.js ***!
  \****************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (/* binding */ MD5)
/* harmony export */ });
/**
 *
 *  MD5 (Message-Digest Algorithm)
 *  http://www.webtoolkit.info/
 *
 **/

function MD5(string) {
    function RotateLeft(lValue, iShiftBits) {
        return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
    }

    function AddUnsigned(lX, lY) {
        var lX4, lY4, lX8, lY8, lResult;
        lX8 = lX & 0x80000000;
        lY8 = lY & 0x80000000;
        lX4 = lX & 0x40000000;
        lY4 = lY & 0x40000000;
        lResult = (lX & 0x3fffffff) + (lY & 0x3fffffff);
        if (lX4 & lY4) {
            return lResult ^ 0x80000000 ^ lX8 ^ lY8;
        }
        if (lX4 | lY4) {
            if (lResult & 0x40000000) {
                return lResult ^ 0xc0000000 ^ lX8 ^ lY8;
            } else {
                return lResult ^ 0x40000000 ^ lX8 ^ lY8;
            }
        } else {
            return lResult ^ lX8 ^ lY8;
        }
    }

    function F(x, y, z) {
        return (x & y) | (~x & z);
    }

    function G(x, y, z) {
        return (x & z) | (y & ~z);
    }

    function H(x, y, z) {
        return x ^ y ^ z;
    }

    function I(x, y, z) {
        return y ^ (x | ~z);
    }

    function FF(a, b, c, d, x, s, ac) {
        a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac));
        return AddUnsigned(RotateLeft(a, s), b);
    }

    function GG(a, b, c, d, x, s, ac) {
        a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac));
        return AddUnsigned(RotateLeft(a, s), b);
    }

    function HH(a, b, c, d, x, s, ac) {
        a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac));
        return AddUnsigned(RotateLeft(a, s), b);
    }

    function II(a, b, c, d, x, s, ac) {
        a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac));
        return AddUnsigned(RotateLeft(a, s), b);
    }

    function ConvertToWordArray(string) {
        var lWordCount;
        var lMessageLength = string.length;
        var lNumberOfWords_temp1 = lMessageLength + 8;
        var lNumberOfWords_temp2 =
            (lNumberOfWords_temp1 - (lNumberOfWords_temp1 % 64)) / 64;
        var lNumberOfWords = (lNumberOfWords_temp2 + 1) * 16;
        var lWordArray = Array(lNumberOfWords - 1);
        var lBytePosition = 0;
        var lByteCount = 0;
        while (lByteCount < lMessageLength) {
            lWordCount = (lByteCount - (lByteCount % 4)) / 4;
            lBytePosition = (lByteCount % 4) * 8;
            lWordArray[lWordCount] =
                lWordArray[lWordCount] |
                (string.charCodeAt(lByteCount) << lBytePosition);
            lByteCount++;
        }
        lWordCount = (lByteCount - (lByteCount % 4)) / 4;
        lBytePosition = (lByteCount % 4) * 8;
        lWordArray[lWordCount] =
            lWordArray[lWordCount] | (0x80 << lBytePosition);
        lWordArray[lNumberOfWords - 2] = lMessageLength << 3;
        lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;
        return lWordArray;
    }

    function WordToHex(lValue) {
        var WordToHexValue = "",
            WordToHexValue_temp = "",
            lByte,
            lCount;
        for (lCount = 0; lCount <= 3; lCount++) {
            lByte = (lValue >>> (lCount * 8)) & 255;
            WordToHexValue_temp = "0" + lByte.toString(16);
            WordToHexValue =
                WordToHexValue +
                WordToHexValue_temp.substr(WordToHexValue_temp.length - 2, 2);
        }
        return WordToHexValue;
    }

    function Utf8Encode(string) {
        string = string.replace(/\r\n/g, "\n");
        var utftext = "";

        for (var n = 0; n < string.length; n++) {
            var c = string.charCodeAt(n);

            if (c < 128) {
                utftext += String.fromCharCode(c);
            } else if (c > 127 && c < 2048) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            } else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }
        }

        return utftext;
    }

    var x = Array();
    var k, AA, BB, CC, DD, a, b, c, d;
    var S11 = 7,
        S12 = 12,
        S13 = 17,
        S14 = 22;
    var S21 = 5,
        S22 = 9,
        S23 = 14,
        S24 = 20;
    var S31 = 4,
        S32 = 11,
        S33 = 16,
        S34 = 23;
    var S41 = 6,
        S42 = 10,
        S43 = 15,
        S44 = 21;

    string = Utf8Encode(string);

    x = ConvertToWordArray(string);

    a = 0x67452301;
    b = 0xefcdab89;
    c = 0x98badcfe;
    d = 0x10325476;

    for (k = 0; k < x.length; k += 16) {
        AA = a;
        BB = b;
        CC = c;
        DD = d;
        a = FF(a, b, c, d, x[k + 0], S11, 0xd76aa478);
        d = FF(d, a, b, c, x[k + 1], S12, 0xe8c7b756);
        c = FF(c, d, a, b, x[k + 2], S13, 0x242070db);
        b = FF(b, c, d, a, x[k + 3], S14, 0xc1bdceee);
        a = FF(a, b, c, d, x[k + 4], S11, 0xf57c0faf);
        d = FF(d, a, b, c, x[k + 5], S12, 0x4787c62a);
        c = FF(c, d, a, b, x[k + 6], S13, 0xa8304613);
        b = FF(b, c, d, a, x[k + 7], S14, 0xfd469501);
        a = FF(a, b, c, d, x[k + 8], S11, 0x698098d8);
        d = FF(d, a, b, c, x[k + 9], S12, 0x8b44f7af);
        c = FF(c, d, a, b, x[k + 10], S13, 0xffff5bb1);
        b = FF(b, c, d, a, x[k + 11], S14, 0x895cd7be);
        a = FF(a, b, c, d, x[k + 12], S11, 0x6b901122);
        d = FF(d, a, b, c, x[k + 13], S12, 0xfd987193);
        c = FF(c, d, a, b, x[k + 14], S13, 0xa679438e);
        b = FF(b, c, d, a, x[k + 15], S14, 0x49b40821);
        a = GG(a, b, c, d, x[k + 1], S21, 0xf61e2562);
        d = GG(d, a, b, c, x[k + 6], S22, 0xc040b340);
        c = GG(c, d, a, b, x[k + 11], S23, 0x265e5a51);
        b = GG(b, c, d, a, x[k + 0], S24, 0xe9b6c7aa);
        a = GG(a, b, c, d, x[k + 5], S21, 0xd62f105d);
        d = GG(d, a, b, c, x[k + 10], S22, 0x2441453);
        c = GG(c, d, a, b, x[k + 15], S23, 0xd8a1e681);
        b = GG(b, c, d, a, x[k + 4], S24, 0xe7d3fbc8);
        a = GG(a, b, c, d, x[k + 9], S21, 0x21e1cde6);
        d = GG(d, a, b, c, x[k + 14], S22, 0xc33707d6);
        c = GG(c, d, a, b, x[k + 3], S23, 0xf4d50d87);
        b = GG(b, c, d, a, x[k + 8], S24, 0x455a14ed);
        a = GG(a, b, c, d, x[k + 13], S21, 0xa9e3e905);
        d = GG(d, a, b, c, x[k + 2], S22, 0xfcefa3f8);
        c = GG(c, d, a, b, x[k + 7], S23, 0x676f02d9);
        b = GG(b, c, d, a, x[k + 12], S24, 0x8d2a4c8a);
        a = HH(a, b, c, d, x[k + 5], S31, 0xfffa3942);
        d = HH(d, a, b, c, x[k + 8], S32, 0x8771f681);
        c = HH(c, d, a, b, x[k + 11], S33, 0x6d9d6122);
        b = HH(b, c, d, a, x[k + 14], S34, 0xfde5380c);
        a = HH(a, b, c, d, x[k + 1], S31, 0xa4beea44);
        d = HH(d, a, b, c, x[k + 4], S32, 0x4bdecfa9);
        c = HH(c, d, a, b, x[k + 7], S33, 0xf6bb4b60);
        b = HH(b, c, d, a, x[k + 10], S34, 0xbebfbc70);
        a = HH(a, b, c, d, x[k + 13], S31, 0x289b7ec6);
        d = HH(d, a, b, c, x[k + 0], S32, 0xeaa127fa);
        c = HH(c, d, a, b, x[k + 3], S33, 0xd4ef3085);
        b = HH(b, c, d, a, x[k + 6], S34, 0x4881d05);
        a = HH(a, b, c, d, x[k + 9], S31, 0xd9d4d039);
        d = HH(d, a, b, c, x[k + 12], S32, 0xe6db99e5);
        c = HH(c, d, a, b, x[k + 15], S33, 0x1fa27cf8);
        b = HH(b, c, d, a, x[k + 2], S34, 0xc4ac5665);
        a = II(a, b, c, d, x[k + 0], S41, 0xf4292244);
        d = II(d, a, b, c, x[k + 7], S42, 0x432aff97);
        c = II(c, d, a, b, x[k + 14], S43, 0xab9423a7);
        b = II(b, c, d, a, x[k + 5], S44, 0xfc93a039);
        a = II(a, b, c, d, x[k + 12], S41, 0x655b59c3);
        d = II(d, a, b, c, x[k + 3], S42, 0x8f0ccc92);
        c = II(c, d, a, b, x[k + 10], S43, 0xffeff47d);
        b = II(b, c, d, a, x[k + 1], S44, 0x85845dd1);
        a = II(a, b, c, d, x[k + 8], S41, 0x6fa87e4f);
        d = II(d, a, b, c, x[k + 15], S42, 0xfe2ce6e0);
        c = II(c, d, a, b, x[k + 6], S43, 0xa3014314);
        b = II(b, c, d, a, x[k + 13], S44, 0x4e0811a1);
        a = II(a, b, c, d, x[k + 4], S41, 0xf7537e82);
        d = II(d, a, b, c, x[k + 11], S42, 0xbd3af235);
        c = II(c, d, a, b, x[k + 2], S43, 0x2ad7d2bb);
        b = II(b, c, d, a, x[k + 9], S44, 0xeb86d391);
        a = AddUnsigned(a, AA);
        b = AddUnsigned(b, BB);
        c = AddUnsigned(c, CC);
        d = AddUnsigned(d, DD);
    }

    var temp = WordToHex(a) + WordToHex(b) + WordToHex(c) + WordToHex(d);

    return temp.toLowerCase();
}


/***/ }),

/***/ 55409:
/*!**************************************************!*\
  !*** ./runestone/activecode/js/skulpt-stdlib.js ***!
  \**************************************************/
/***/ (() => {

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/altair/__init__.py":"import random\n\ntry:\n    from vega_caller import render_graph\nexcept:\n    print(\"Mock render\")\n\n    def render_graph(js):\n        print(js)\n\n\nclass Chart:\n    # TODO allow data to be specified as a URL to a CSV or DB or json\n    def __init__(self, data, title=None):\n        self.title = title\n        self.data_id = random.randrange(1000000, 5000000)\n        self.dsname = \"data-{}\".format(self.data_id)\n        if isinstance(data, dict):\n            self.data = Data(**data)\n        else:\n            self.data = data\n\n        self.json = {}\n        self.json[\"$schema\"] = \"https://vega.github.io/schema/vega-lite/v2.5.json\"\n        self.json[\"data\"] = {}\n        if self.title:\n            self.json[\"title\"] = self.title\n\n        self.json[\"data\"] = {\"values\": self.data.vals}\n        self.is_composite = False\n\n    # mark can be a simple string or a dictionary\n    # \"mark\": {\"color\": \"green\", \"opacity\": 0.2, \"type\": \"rect\"}\n\n    def mark_json(self, mark_type, **kwargs):\n        if kwargs:\n            self.json[\"mark\"] = {}\n            self.json[\"mark\"][\"type\"] = mark_type\n            self.json[\"mark\"].update(kwargs)\n        else:\n            self.json[\"mark\"] = mark_type\n\n        return self\n\n    def mark_bar(self, **kwargs):\n        return self.mark_json(\"bar\", **kwargs)\n\n    def mark_point(self, **kwargs):\n        return self.mark_json(\"point\", **kwargs)\n\n    def mark_line(self, **kwargs):\n        return self.mark_json(\"line\", **kwargs)\n\n    def mark_rect(self, **kwargs):\n        return self.mark_json(\"rect\", **kwargs)\n\n    def mark_area(self, **kwargs):\n        return self.mark_json(\"area\", **kwargs)\n\n    def mark_tick(self, **kwargs):\n        return self.mark_json(\"tick\", **kwargs)\n\n    def encode(self, x=\"\", y=\"\", color=\"\", size=\"\", tooltip=\"\"):\n        self.encoding = {}\n        if x:\n            if isinstance(x, Axis):\n                self.encoding[\"x\"] = x.toJson()\n            else:\n                self.encoding[\"x\"] = Axis(x).toJson()\n        if y:\n            if isinstance(y, Axis):\n                self.encoding[\"y\"] = y.toJson()\n            else:\n                self.encoding[\"y\"] = Axis(y).toJson()\n\n        # \"color\": {\"type\": \"nominal\", \"field\": \"species\"}\n        if color:\n            field, tp = _get_name_type(color)\n            self.encoding[\"color\"] = dict(type=tp, field=field)\n\n        # \"size\": {\"type\": \"quantitative\", \"field\": \"Acceleration\"}\n        if size:\n            field, tp = _get_name_type(size)\n            self.encoding[\"size\"] = dict(type=tp, field=field)\n\n        if tooltip:\n            field, tp = _get_name_type(tooltip)\n            self.encoding[\"tooltip\"] = dict(type=tp, field=field)\n\n        self.json[\"encoding\"] = self.encoding\n        return self\n\n    def interactive(self):\n        iconfig = {\n            \"selector002\": {\n                \"type\": \"interval\",\n                \"bind\": \"scales\",\n                \"encodings\": [\"x\", \"y\"],\n                \"on\": \"[mousedown, window:mouseup] > window:mousemove!\",\n                \"translate\": \"[mousedown, window:mouseup] > window:mousemove!\",\n                \"zoom\": \"wheel!\",\n                \"mark\": {\"fill\": \"#333\", \"fillOpacity\": 0.125, \"stroke\": \"white\"},\n                \"resolve\": \"global\",\n            }\n        }\n        self.json[\"selection\"] = iconfig\n        return self\n\n    def display(self):\n        render_graph(self.json)\n\n    def __add__(self, other):\n        return self.add_layer(other, \"layer\")\n\n    def __and__(self, other):\n        return self.add_layer(other, \"vconcat\")\n\n    def __or__(self, other):\n        return self.add_layer(other, \"hconcat\")\n\n    def add_layer(self, other, lname):\n        # multle layers are added by concatenating the new element to the\n        # existing layer.  If the layer does not exist then initialize\n        # it from self.\n        if lname not in self.json:\n            self.json[lname] = []\n            self.json[\"datasets\"] = {}\n            temp = {}\n            temp[\"data\"] = {\"name\": self.dsname}\n            self.json[\"datasets\"][self.dsname] = self.json[\"data\"][\"values\"]\n            del self.json[\"data\"]\n            temp[\"encoding\"] = self.json[\"encoding\"]\n            del self.json[\"encoding\"]\n            temp[\"mark\"] = self.json[\"mark\"]\n            del self.json[\"mark\"]\n            self.json[lname].append(temp)\n        temp = {}\n        self.json[\"datasets\"][other.dsname] = other.json[\"data\"][\"values\"]\n        temp[\"data\"] = {\"name\": other.dsname}\n        temp[\"encoding\"] = other.json[\"encoding\"]\n        temp[\"mark\"] = other.json[\"mark\"]\n        self.json[lname].append(temp)\n        return self\n\n\n#   \"datasets\": {\n#     \"data-e56e43354d9b8f2ab0d1e90cf27cd47f\": [\n#       {\"a\": 4, \"b\": 1, \"c\": \"r\"},\n#       {\"a\": 5, \"b\": 2, \"c\": \"g\"},\n#       {\"a\": 6, \"b\": 3, \"c\": \"b\"}\n#     ],\n#     \"data-a4c3047a15bf9380c2e615cf87648369\": [\n#       {\"a\": 1, \"b\": 4, \"c\": \"r\"},\n#       {\"a\": 2, \"b\": 5, \"c\": \"g\"},\n#       {\"a\": 3, \"b\": 6, \"c\": \"b\"}\n#     ]\n#   }\n\n# TODO:  add a rect mark type for a heat map\n\n\ndef _get_name_type(name):\n    typed = {\"Q\": \"quantitative\", \"O\": \"ordinal\", \"N\": \"nominal\", \"T\": \"temporal\"}\n    nt = name.split(\":\")\n    tstring = \"quantitative\"\n    if len(nt) == 2:\n        tstring = typed[nt[1]]\n    return nt[0], tstring\n\n\nclass Axis:\n    def __init__(self, name, bin=False):\n        self.aggregate = None\n        self.name, self.type = _get_name_type(name)\n        if \"()\" in self.name:  # aggregate function\n            self.aggregate = self.name.replace(\"()\", \"\")\n            self.name = None\n        self.bin = bin\n\n    def toJson(self):\n        json = {}\n        if self.name:\n            json[\"field\"] = self.name\n        if self.type:\n            json[\"type\"] = self.type\n        if self.bin:\n            json[\"bin\"] = True\n        if self.aggregate:\n            json[\"aggregate\"] = self.aggregate\n\n        return json\n\n\nclass X(Axis):\n    pass\n\n\nclass Y(Axis):\n    pass\n\n\nclass Data:\n    def __init__(self, **kwargs):\n        \"\"\"\n        input can be the form of a series of keyword args where\n        the keyword is the column name, or a single keyword data\n        that is a list of json style records as rows.\n        could also accept a csv file? or keywords columns and rows\n        This accepts a lot more options that \"real altair\" to make it easier\n        to work with non-DataFrame data sets.  Internally:\n        self.keys contains the list of column names\n        self.vals is a list of dictionaries of the form [{col1:val1, col2:val2, ... coln:valn},\n                                                         {col1:val3, col2:val4, ... coln:valn},\n                                                         {col1:val5, col2:val6, ... coln:valn}]\n        \"\"\"\n        # todo: accept a URL as the argument to read a CSV or JSON file\n        if len(kwargs) == 1 and \"data\" in kwargs:\n            self.data = kwargs[\"data\"]\n            self.keys = self.data[0].keys()\n            self.vals = self.data\n        elif len(kwargs) == 2 and (\"columns\" in kwargs) and (\"rows\" in kwargs):\n            self.keys = kwargs[\"columns\"]\n            self.vals = []\n            for r in kwargs[\"rows\"]:\n                self.vals.append(dict(zip(self.keys, r)))\n        else:\n            keys = kwargs.keys()\n            vals = []\n            primary_key = list(keys)[0]\n            for ix in range(len(kwargs[primary_key])):\n                d = {}\n                for key in keys:\n                    d[key] = kwargs[key][ix]\n                vals.append(d)\n            self.vals = vals\n            self.keys = keys\n\n    def __str__(self):\n        # header = \"\\t\".join(self.keys) + \"\\n\"\n        header = \"\"\n        for key in self.keys:\n            header += key.center(10) + \" \"\n        header += \"\\n\"\n        template = \"\"\n        for key in self.keys:\n            template += \"{\" + key + \": <10} \"\n        template += \"\\n\"\n        res = \"\"\n        for row in self.vals:\n            res += template.format(**row)\n\n        return header + res\n\n\nif __name__ == \"__main__\":\n    d = Data(a=[3, 4, 5], b=[1, 2, 3], c=[\"r\", \"g\", \"b\"])\n    print(d)\n    print(\n        type(\n            Chart({\"a\": list(\"abc\"), \"b\": [1, 2, 3]}).mark_bar().encode(x=\"a:N\", y=\"b\")\n        )\n    )\n    aa = (\n        Chart(Data(a=[3, 4, 5], b=[1, 2, 3], c=[\"r\", \"g\", \"b\"]))\n        .mark_point(color=\"red\")\n        .encode(x=\"b\", y=\"a\", color=\"c:O\")\n    )\n    print(\"aa = \", aa)\n    aa.display()\n\n    bb = (\n        Chart(Data(a=[1, 2, 3], b=[4, 5, 6], c=[\"r\", \"g\", \"b\"]))\n        .mark_line()\n        .encode(x=\"b\", y=\"a\", color=\"c:O\")\n    )\n    print(\"bb = \", bb)\n    bb.display()\n    print(\"aa+bb\", (aa + bb).display())\n    # Chart(Data(a=[1,2,3,2,2,4,5,5,6,7,8,8,8,8,8,9,0,0])).mark_bar().encode(Axis('a:Q', bin=True),y='count()')\n\n\n# todo: see if I can work with the repr of an object to get the behavior that altair gets in notebooks\n# todo: implement a Bin object to specifiy maxbins\n","src/lib/altair/vega_caller.js":"var $builtinmodule=function(){var a={__file__:\"/src/lib/vega_caller.js\",__package__:Sk.builtin.none.none$,render_graph:new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs(\"render_graph\",arguments,1,1);let b=\"#\"+Sk.divid+\"_graphics\";try{vegaEmbed(b,Sk.ffi.remapToJs(a),{actions:!0})}catch(a){throw new Sk.builtin.Exception(\"Error in graph specification unable to render the graph\\n\"+a.message)}})};return a};","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":"function $builtinmodule(){const a={};return Sk.misceval.chain(Sk.importModule(\"keyword\",!1,!0),b=>(a._iskeyword=b.$d.iskeyword,Sk.importModule(\"itertools\",!1,!0)),b=>(a._chain=b.$d.chain,a._starmap=b.$d.starmap,a._repeat=b.$d.repeat,Sk.importModule(\"operator\",!1,!0)),b=>{a._itemgetter=b.$d.itemgetter},()=>collections_mod(a))}function collections_mod(a){function counterNumberSlot(b){return function(c){if(void 0!==c&&!(c instanceof a.Counter))return Sk.builtin.NotImplemented.NotImplemented$;const d=new a.Counter;return b.call(this,d,c),d}}function counterInplaceSlot(a,b){return function(c){if(!(c instanceof Sk.builtin.dict))throw new Sk.builtin.TypeError(\"Counter \"+a+\"= \"+Sk.abstr.typeName(c)+\" is not supported\");return b.call(this,c),this.keep$positive()}}function namedtuple(b,c,d,l,m){function _make(a,b){return a.prototype.tp$new(Sk.misceval.arrayFromIterable(b))}function _asdict(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)}function _replace(a,b){a=new Sk.builtin.dict(a);const c=a.tp$getattr(new Sk.builtin.str(\"pop\")),d=Sk.abstr.gattr(b,new Sk.builtin.str(\"_make\")),e=Sk.misceval.callsimArray,f=e(d,[e(Sk.builtin.map_,[c,r,b])]);if(a.sq$length()){const b=a.sk$asarray();throw new Sk.builtin.ValueError(\"Got unexpectd field names: [\"+b.map(a=>\"'\"+a.$jsstr()+\"'\")+\"]\")}return f}if(b=b.tp$str(),Sk.misceval.isTrue(Sk.misceval.callsimArray(a._iskeyword,[b])))throw new Sk.builtin.ValueError(\"Type names and field names cannot be a keyword: '\"+Sk.misceval.objectRepr(b)+\"'\");const n=b.$jsstr();if(e.test(n)||!g.test(n)||!n)throw new Sk.builtin.ValueError(\"Type names and field names must be valid identifiers: '\"+n+\"'\");let o,p;if(Sk.builtin.checkString(c))o=c.$jsstr().replace(h,\" \").split(j),1==o.length&&\"\"===o[0]&&(o=[]),p=o.map(a=>new Sk.builtin.str(a));else{o=[],p=[];for(let a=Sk.abstr.iter(c),b=a.tp$iternext();void 0!==b;b=a.tp$iternext())b=b.tp$str(),p.push(b),o.push(b.$jsstr())}let q=new Set;if(Sk.misceval.isTrue(d))for(i=0;i<o.length;i++)(Sk.misceval.isTrue(Sk.misceval.callsimArray(a._iskeyword,[p[i]]))||f.test(o[i])||!g.test(o[i])||!o[i]||q.has(o[i]))&&(o[i]=\"_\"+i,p[i]=new Sk.builtin.str(\"_\"+i)),q.add(o[i]);else for(i=0;i<o.length;i++){if(Sk.misceval.isTrue(Sk.misceval.callsimArray(a._iskeyword,[p[i]])))throw new Sk.builtin.ValueError(\"Type names and field names cannot be a keyword: '\"+o[i]+\"'\");else if(f.test(o[i]))throw new Sk.builtin.ValueError(\"Field names cannot start with an underscore: '\"+o[i]+\"'\");else if(!g.test(o[i])||!o[i])throw new Sk.builtin.ValueError(\"Type names and field names must be valid identifiers: '\"+o[i]+\"'\");else if(q.has(o[i]))throw new Sk.builtin.ValueError(\"Encountered duplicate field name: '\"+o[i]+\"'\");q.add(o[i])}const r=new Sk.builtin.tuple(p),s=[];let t=[];if(!Sk.builtin.checkNone(l)){if(t=Sk.misceval.arrayFromIterable(l),t.length>o.length)throw new Sk.builtin.TypeError(\"Got more default values than field names\");for(let a=0,b=p.length-t.length;b<p.length;a++,b++)s.push(p[b]),s.push(t[a])}const u=new Sk.builtin.dict(s);_make.co_varnames=[\"_cls\",\"iterable\"],_asdict.co_varnames=[\"self\"],_replace.co_kwargs=1,_replace.co_varnames=[\"_self\"];const v={};for(let e=0;e<o.length;e++)v[p[e].$mangled]=new Sk.builtin.property(new a._itemgetter([new Sk.builtin.int_(e)]),void 0,void 0,new Sk.builtin.str(\"Alias for field number \"+e));return Sk.abstr.buildNativeClass(n,{constructor:function NamedTuple(){},base:Sk.builtin.tuple,slots:{tp$doc:n+\"(\"+o.join(\", \")+\")\",tp$new(a,b){a=Sk.abstr.copyKeywordsToNamedArgs(\"__new__\",o,a,b,t);const c=new this.constructor;return Sk.builtin.tuple.call(c,a),c},$r(){const a=this.v.map((a,b)=>o[b]+\"=\"+Sk.misceval.objectRepr(a));return new Sk.builtin.str(Sk.abstr.typeName(this)+\"(\"+a.join(\", \")+\")\")}},proto:Object.assign({__module__:Sk.builtin.checkNone(m)?Sk.globals.__name__:m,__slots__:new Sk.builtin.tuple,_fields:r,_field_defaults:u,_make:new Sk.builtin.classmethod(new Sk.builtin.func(_make)),_asdict:new Sk.builtin.func(_asdict),_replace:new Sk.builtin.func(_replace)},v)})}a.__all__=new Sk.builtin.list([\"deque\",\"defaultdict\",\"namedtuple\",\"Counter\",\"OrderedDict\"].map(a=>new Sk.builtin.str(a))),a.defaultdict=Sk.abstr.buildNativeClass(\"collections.defaultdict\",{constructor:function defaultdict(a,b){this.default_factory=a,Sk.builtin.dict.call(this,b)},base:Sk.builtin.dict,methods:{copy:{$meth(){return this.$copy()},$flags:{NoArgs:!0}},__copy__:{$meth(){return this.$copy()},$flags:{NoArgs:!0}},__missing__:{$meth(a){if(Sk.builtin.checkNone(this.default_factory))throw new Sk.builtin.KeyError(Sk.misceval.objectRepr(a));else{const b=Sk.misceval.callsimArray(this.default_factory,[]);return this.mp$ass_subscript(a,b),b}},$flags:{OneArg:!0}}},getsets:{default_factory:{$get(){return this.default_factory},$set(a){a=a||Sk.builtin.none.none$,this.default_factory=a}}},slots:{tp$doc:\"defaultdict(default_factory[, ...]) --> dict with default factory\\n\\nThe default factory is called without arguments to produce\\na new value when a key is not present, in __getitem__ only.\\nA defaultdict compares equal to a dict with the same items.\\nAll remaining arguments are treated the same as if they were\\npassed to the dict constructor, including keyword arguments.\\n\",tp$init(a,b){const c=a.shift();if(void 0===c)this.default_factory=Sk.builtin.none.none$;else if(!Sk.builtin.checkCallable(c)&&!Sk.builtin.checkNone(c))throw new Sk.builtin.TypeError(\"first argument must be callable\");else this.default_factory=c;return Sk.builtin.dict.prototype.tp$init.call(this,a,b)},$r(){const a=Sk.misceval.objectRepr(this.default_factory),b=Sk.builtin.dict.prototype.$r.call(this).v;return new Sk.builtin.str(\"defaultdict(\"+a+\", \"+b+\")\")}},proto:{$copy(){const b=[];return Sk.misceval.iterFor(Sk.abstr.iter(this),a=>{b.push(a),b.push(this.mp$subscript(a))}),new a.defaultdict(this.default_factory,b)}}}),a.Counter=Sk.abstr.buildNativeClass(\"Counter\",{constructor:function Counter(){this.$d=new Sk.builtin.dict,Sk.builtin.dict.apply(this)},base:Sk.builtin.dict,methods:{elements:{$flags:{NoArgs:!0},$meth(){const b=a._chain.tp$getattr(new Sk.builtin.str(\"from_iterable\")),c=a._starmap,d=a._repeat,e=Sk.misceval.callsimArray;return e(b,[e(c,[d,e(this.tp$getattr(this.str$items))])])}},most_common:{$flags:{NamedArgs:[\"n\"],Defaults:[Sk.builtin.none.none$]},$meth(a){length=this.sq$length(),Sk.builtin.checkNone(a)?a=length:(a=Sk.misceval.asIndexOrThrow(a),a=a>length?length:0>a?0:a);const b=this.$items().sort((c,a)=>Sk.misceval.richCompareBool(c[1],a[1],\"Lt\")?1:Sk.misceval.richCompareBool(c[1],a[1],\"Gt\")?-1:0);return new Sk.builtin.list(b.slice(0,a).map(a=>new Sk.builtin.tuple(a)))}},update:{$flags:{FastCall:!0},$meth(a,b){return Sk.abstr.checkArgsLen(\"update\",a,0,1),this.counter$update(a,b)}},subtract:{$flags:{FastCall:!0},$meth(a,b){Sk.abstr.checkArgsLen(\"subtract\",a,0,1);const c=a[0];if(void 0!==c)if(c instanceof Sk.builtin.dict)for(let a=Sk.abstr.iter(c),b=a.tp$iternext();void 0!==b;b=a.tp$iternext()){const a=this.mp$subscript(b);this.mp$ass_subscript(b,Sk.abstr.numberBinOp(a,c.mp$subscript(b),\"Sub\"))}else for(iter=Sk.abstr.iter(c),k=iter.tp$iternext();void 0!==k;k=iter.tp$iternext()){const a=this.mp$subscript(k);this.mp$ass_subscript(k,Sk.abstr.numberBinOp(a,this.$one,\"Sub\"))}b=b||[];for(let c=0;c<b.length;c+=2){const a=new Sk.builtin.str(b[c]),d=this.mp$subscript(a);this.mp$ass_subscript(a,Sk.abstr.numberBinOp(d,b[c+1],\"Sub\"))}return Sk.builtin.none.none$}},__missing__:{$meth(){return this.$zero},$flags:{OneArg:!0}},copy:{$meth(){return Sk.misceval.callsimArray(a.Counter,[this])},$flags:{NoArgs:!0}}},getsets:{__dict__:Sk.generic.getSetDict},slots:{tp$doc:\"Dict subclass for counting hashable items.  Sometimes called a bag\\n    or multiset.  Elements are stored as dictionary keys and their counts\\n    are stored as dictionary values.\\n\\n    >>> c = Counter('abcdeabcdabcaba')  # count elements from a string\\n\\n    >>> c.most_common(3)                # three most common elements\\n    [('a', 5), ('b', 4), ('c', 3)]\\n    >>> sorted(c)                       # list all unique elements\\n    ['a', 'b', 'c', 'd', 'e']\\n    >>> ''.join(sorted(c.elements()))   # list elements with repetitions\\n    'aaaaabbbbcccdde'\\n    >>> sum(c.values())                 # total of all counts\\n    15\\n\\n    >>> c['a']                          # count of letter 'a'\\n    5\\n    >>> for elem in 'shazam':           # update counts from an iterable\\n    ...     c[elem] += 1                # by adding 1 to each element's count\\n    >>> c['a']                          # now there are seven 'a'\\n    7\\n    >>> del c['b']                      # remove all 'b'\\n    >>> c['b']                          # now there are zero 'b'\\n    0\\n\\n    >>> d = Counter('simsalabim')       # make another counter\\n    >>> c.update(d)                     # add in the second counter\\n    >>> c['a']                          # now there are nine 'a'\\n    9\\n\\n    >>> c.clear()                       # empty the counter\\n    >>> c\\n    Counter()\\n\\n    Note:  If a count is set to zero or reduced to zero, it will remain\\n    in the counter until the entry is deleted or the counter is cleared:\\n\\n    >>> c = Counter('aaabbc')\\n    >>> c['b'] -= 2                     # reduce the count of 'b' by two\\n    >>> c.most_common()                 # 'b' is still in, but its count is zero\\n    [('a', 3), ('c', 1), ('b', 0)]\\n\\n\",tp$init(a,b){return Sk.abstr.checkArgsLen(this.tpjs_name,a,0,1),this.counter$update(a,b)},$r(){const a=0<this.size?Sk.builtin.dict.prototype.$r.call(this).v:\"\";return new Sk.builtin.str(Sk.abstr.typeName(this)+\"(\"+a+\")\")},tp$as_sequence_or_mapping:!0,mp$ass_subscript(a,b){return void 0===b?this.mp$lookup(a)&&Sk.builtin.dict.prototype.mp$ass_subscript.call(this,a,b):Sk.builtin.dict.prototype.mp$ass_subscript.call(this,a,b)},tp$as_number:!0,nb$positive:counterNumberSlot(function(a){this.$items().forEach(([b,c])=>{Sk.misceval.richCompareBool(c,this.$zero,\"Gt\")&&a.mp$ass_subscript(b,c)})}),nb$negative:counterNumberSlot(function(a){this.$items().forEach(([b,c])=>{Sk.misceval.richCompareBool(c,this.$zero,\"Lt\")&&a.mp$ass_subscript(b,Sk.abstr.numberBinOp(this.$zero,c,\"Sub\"))})}),nb$subtract:counterNumberSlot(function(a,b){this.$items().forEach(([c,d])=>{const e=Sk.abstr.numberBinOp(d,b.mp$subscript(c),\"Sub\");Sk.misceval.richCompareBool(e,this.$zero,\"Gt\")&&a.mp$ass_subscript(c,e)}),b.$items().forEach(([b,c])=>{void 0===this.mp$lookup(b)&&Sk.misceval.richCompareBool(c,this.$zero,\"Lt\")&&a.mp$ass_subscript(b,Sk.abstr.numberBinOp(this.$zero,c,\"Sub\"))})}),nb$add:counterNumberSlot(function(a,b){this.$items().forEach(([c,d])=>{const e=Sk.abstr.numberBinOp(d,b.mp$subscript(c),\"Add\");Sk.misceval.richCompareBool(e,this.$zero,\"Gt\")&&a.mp$ass_subscript(c,e)}),b.$items().forEach(([b,c])=>{void 0===this.mp$lookup(b)&&Sk.misceval.richCompareBool(c,this.$zero,\"Gt\")&&a.mp$ass_subscript(b,c)})}),nb$inplace_add:counterInplaceSlot(\"+\",function(a){a.$items().forEach(([a,b])=>{const c=Sk.abstr.numberInplaceBinOp(this.mp$subscript(a),b,\"Add\");this.mp$ass_subscript(a,c)})}),nb$inplace_subtract:counterInplaceSlot(\"-\",function(a){a.$items().forEach(([a,b])=>{const c=Sk.abstr.numberInplaceBinOp(this.mp$subscript(a),b,\"Sub\");this.mp$ass_subscript(a,c)})}),nb$or:counterNumberSlot(function(a,b){this.$items().forEach(([c,d])=>{const e=b.mp$subscript(c),f=Sk.misceval.richCompareBool(d,e,\"Lt\")?e:d;Sk.misceval.richCompareBool(f,this.$zero,\"Gt\")&&a.mp$ass_subscript(c,f)}),b.$items().forEach(([b,c])=>{void 0===this.mp$lookup(b)&&Sk.misceval.richCompareBool(c,this.$zero,\"Gt\")&&a.mp$ass_subscript(b,c)})}),nb$and:counterNumberSlot(function(a,b){this.$items().forEach(([c,d])=>{const e=b.mp$subscript(c),f=Sk.misceval.richCompareBool(d,e,\"Lt\")?d:e;Sk.misceval.richCompareBool(f,this.$zero,\"Gt\")&&a.mp$ass_subscript(c,f)})}),nb$inplace_and:counterInplaceSlot(\"&\",function(a){this.$items().forEach(([b,c])=>{const d=a.mp$subscript(b);Sk.misceval.richCompareBool(d,c,\"Lt\")&&this.mp$ass_subscript(b,d)})}),nb$inplace_or:counterInplaceSlot(\"|\",function(a){a.$items().forEach(([a,b])=>{Sk.misceval.richCompareBool(b,this.mp$subscript(a),\"Gt\")&&this.mp$ass_subscript(a,b)})}),nb$reflected_and:null,nb$reflected_or:null,nb$reflected_add:null,nb$reflected_subtract:null},proto:{keep$positive(){return this.$items().forEach(([a,b])=>{Sk.misceval.richCompareBool(b,this.$zero,\"LtE\")&&this.mp$ass_subscript(a)}),this},$zero:new Sk.builtin.int_(0),$one:new Sk.builtin.int_(1),str$items:new Sk.builtin.str(\"items\"),counter$update(a,b){const c=a[0];if(void 0!==c)if(!Sk.builtin.checkMapping(c))for(let a=Sk.abstr.iter(c),b=a.tp$iternext();void 0!==b;b=a.tp$iternext()){const a=this.mp$subscript(b);this.mp$ass_subscript(b,Sk.abstr.numberBinOp(a,this.$one,\"Add\"))}else if(!this.sq$length())this.update$common(a,void 0,\"update\");else for(let a=Sk.abstr.iter(c),b=a.tp$iternext();void 0!==b;b=a.tp$iternext()){const a=this.mp$subscript(b);this.mp$ass_subscript(b,Sk.abstr.numberBinOp(a,c.mp$subscript(b),\"Add\"))}if(b&&b.length)if(!this.sq$length())this.update$common([],b,\"update\");else for(let a=0;a<b.length;a+=2){const c=new Sk.builtin.str(b[a]),d=this.mp$subscript(c);this.mp$ass_subscript(c,Sk.abstr.numberBinOp(d,b[a+1],\"Add\"))}return Sk.builtin.none.none$}},classmethods:{fromkeys:{$meth:function fromkeys(){throw new Sk.builtin.NotImplementedError(\"Counter.fromkeys() is undefined.  Use Counter(iterable) instead.\")},$flags:{MinArgs:1,MaxArgs:2}}}});const b=Sk.abstr.buildIteratorClass(\"odict_iterator\",{constructor:function odict_iter_(a){this.$index=0,this.$seq=a.sk$asarray(),this.$orig=a},iternext:Sk.generic.iterNextWithArrayCheckSize,flags:{sk$acceptable_as_base_class:!1}});a.OrderedDict=Sk.abstr.buildNativeClass(\"OrderedDict\",{constructor:function OrderedDict(){return this.orderedkeys=[],Sk.builtin.dict.call(this),this},base:Sk.builtin.dict,slots:{tp$as_sequence_or_mapping:!0,tp$init(a,b){Sk.abstr.checkArgsLen(\"OrderedDict\",a,0,1),a.unshift(this),res=Sk.misceval.callsimArray(this.update,a,b)},tp$doc:\"Dictionary that remembers insertion order\",$r(){let a,b;const c=[];for(let b=this.tp$iter(),d=b.tp$iternext();void 0!==d;d=b.tp$iternext())a=this.mp$subscript(d),void 0===a&&(a=null),c.push(\"(\"+Sk.misceval.objectRepr(d)+\", \"+Sk.misceval.objectRepr(a)+\")\");return b=c.join(\", \"),0<c.length&&(b=\"[\"+b+\"]\"),new Sk.builtin.str(\"OrderedDict(\"+b+\")\")},tp$richcompare(b,c){if(\"Eq\"!=c&&\"Ne\"!=c)return Sk.builtin.NotImplemented.NotImplemented$;const d=\"Eq\"==c;if(!(b instanceof a.OrderedDict))return Sk.builtin.dict.prototype.tp$richcompare.call(this,b,c);const e=this.size,f=b.size;if(e!==f)return!d;for(let a=this.tp$iter(),e=b.tp$iter(),f=a.tp$iternext(),g=e.tp$iternext();void 0!==f;f=a.tp$iternext(),g=e.tp$iternext()){if(!Sk.misceval.isTrue(Sk.misceval.richCompareBool(f,g,\"Eq\")))return!d;const a=this.mp$subscript(f),c=b.mp$subscript(g);if(!Sk.misceval.isTrue(Sk.misceval.richCompareBool(a,c,\"Eq\")))return!d}return d},mp$ass_subscript(a,b){if(void 0===b){const b=this.pop$item(a);if(void 0===b)throw new Sk.builtin.KeyError(a)}else this.set$item(a,b)},tp$iter(){return new b(this)}},methods:{pop:{$flags:{NamedArgs:[\"key\",\"default\"],Defaults:[null]},$meth(a,b){return null===b?Sk.misceval.callsimArray(Sk.builtin.dict.prototype.pop,[this,a]):Sk.misceval.callsimArray(Sk.builtin.dict.prototype.pop,[this,a,b])}},popitem:{$flags:{NamedArgs:[\"last\"],Defaults:[Sk.builtin.bool.true$]},$meth(a){let b,c;if(!this.orderedkeys.length)throw new Sk.builtin.KeyError(\"dictionary is empty\");return b=this.orderedkeys[0],Sk.misceval.isTrue(a)&&(b=this.orderedkeys[this.orderedkeys.length-1]),c=Sk.misceval.callsimArray(this.pop,[this,b]),new Sk.builtin.tuple([b,c])}},move_to_end:{$flags:{NamedArgs:[\"key\",\"last\"],Defaults:[Sk.builtin.bool.true$]},$meth(a,b){let c,d=-1;for(let e=0;e<this.orderedkeys.length;e++)if(c=this.orderedkeys[e],c===a||Sk.misceval.richCompareBool(c,a,\"Eq\")){d=e;break}if(-1!==d)this.orderedkeys.splice(d,1);else throw new Sk.builtin.KeyError(a);return Sk.misceval.isTrue(b)?this.orderedkeys.push(a):this.orderedkeys.unshift(a),Sk.builtin.none.none$}}},proto:{sk$asarray(){return this.orderedkeys.slice(0)},set$item(a,b){const c=this.orderedkeys.indexOf(a);-1==c&&this.orderedkeys.push(a),Sk.builtin.dict.prototype.set$item.call(this,a,b)},pop$item(a){var b=this.orderedkeys.indexOf(a);if(-1!=b)return this.orderedkeys.splice(b,1),Sk.builtin.dict.prototype.pop$item.call(this,a)}}}),a.deque=Sk.abstr.buildNativeClass(\"collections.deque\",{constructor:function deque(a,b,c,d,e){this.head=c||0,this.tail=d||0,this.mask=e||1,this.maxlen=b,this.v=a||[,,]},slots:{tp$doc:\"deque([iterable[, maxlen]]) --> deque object\\n\\nA list-like sequence optimized for data accesses near its endpoints.\",tp$hash:Sk.builtin.none.none$,tp$new:Sk.generic.new,tp$init(a,b){if([iterable,maxlen]=Sk.abstr.copyKeywordsToNamedArgs(\"deque\",[\"iterable\",\"maxlen\"],a,b),void 0!==maxlen&&!Sk.builtin.checkNone(maxlen))if(maxlen=Sk.misceval.asIndexSized(maxlen,Sk.builtin.OverflowError,\"an integer is required\"),0>maxlen)throw new Sk.builtin.ValueError(\"maxlen must be non-negative\");else this.maxlen=maxlen;this.$clear(),void 0!==iterable&&this.$extend(iterable)},tp$getattr:Sk.generic.getAttr,tp$richcompare(b,c){var d=Math.max;if(this===b&&Sk.misceval.opAllowsEquality(c))return!0;if(!(b instanceof a.deque))return Sk.builtin.NotImplemented.NotImplemented$;const e=b,f=this.v;b=b.v;const g=this.tail-this.head&this.mask,h=e.tail-e.head&e.mask;let j,l=d(g,h);if(g===h)for(l=0;l<g&&l<h&&(j=Sk.misceval.richCompareBool(f[this.head+l&this.mask],b[e.head+l&e.mask],\"Eq\"),!!j);++l);if(l>=g||l>=h)switch(c){case\"Lt\":return g<h;case\"LtE\":return g<=h;case\"Eq\":return g===h;case\"NotEq\":return g!==h;case\"Gt\":return g>h;case\"GtE\":return g>=h;}return\"Eq\"!==c&&(\"NotEq\"===c||Sk.misceval.richCompareBool(f[this.head+l&this.mask],b[e.head+l&e.mask],c))},tp$iter(){return new c(this)},$r(){const a=[],b=this.tail-this.head&this.mask;if(this.$entered_repr)return new Sk.builtin.str(\"[...]\");this.$entered_repr=!0;for(let c=0;c<b;c++)a.push(Sk.misceval.objectRepr(this.v[this.head+c&this.mask]));const c=Sk.abstr.typeName(this);return void 0===this.maxlen?(this.$entered_repr=void 0,new Sk.builtin.str(c+\"([\"+a.filter(Boolean).join(\", \")+\"])\")):new Sk.builtin.str(c+\"([\"+a.filter(Boolean).join(\", \")+\"], maxlen=\"+this.maxlen+\")\")},tp$as_number:!0,nb$bool(){return 0!=(this.tail-this.head&this.mask)},tp$as_sequence_or_mapping:!0,sq$contains(a){for(let 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},sq$concat(b){if(!(b instanceof a.deque))throw new Sk.builtin.TypeError(\"can only concatenate deque (not '\"+Sk.abstr.typeName(b)+\"') to deque\");const c=this.$copy();for(let a=b.tp$iter(),d=a.tp$iternext();void 0!==d;d=a.tp$iternext())c.$push(d);return c},sq$length(){return this.tail-this.head&this.mask},sq$repeat(a){a=Sk.misceval.asIndexOrThrow(a,\"can't multiply sequence by non-int of type '{tp$name}'\");const b=this.tail-this.head&this.mask,c=this.$copy();let d;0>=a&&c.$clear();for(let e=1;e<a;e++)for(let a=0;a<b;a++)d=this.head+a&this.mask,c.$push(this.v[d]);return c},mp$subscript(a){a=Sk.misceval.asIndexOrThrow(a);const b=this.tail-this.head&this.mask;if(a>=b||a<-b)throw new Sk.builtin.IndexError(\"deque index out of range\");const c=(0<=a?this.head:this.tail)+a&this.mask;return this.v[c]},mp$ass_subscript(a,b){a=Sk.misceval.asIndexOrThrow(a);const c=this.tail-this.head&this.mask;if(a>=c||a<-c)throw new Sk.builtin.IndexError(\"deque index out of range\");void 0===b?this.del$item(a):this.set$item(a,b)},nb$inplace_add(a){for(this.maxlen=void 0,it=Sk.abstr.iter(a),i=it.tp$iternext();void 0!==i;i=it.tp$iternext())this.$push(i);return this},nb$inplace_multiply(a){a=Sk.misceval.asIndexSized(a,Sk.builtin.OverflowError,\"can't multiply sequence by non-int of type '{tp$name}'\"),0>=a&&this.$clear();const b=this.$copy(),c=this.tail-this.head&this.mask;for(let d=1;d<a;d++)for(let a=0;a<c;a++){const c=this.head+a&this.mask;b.$push(this.v[c])}return this.v=b.v,this.head=b.head,this.tail=b.tail,this.mask=b.mask,this}},methods:{append:{$meth(a){return this.$push(a),Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:null,$doc:\"Add an element to the right side of the deque.\"},appendleft:{$meth(a){return this.$pushLeft(a),Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:null,$doc:\"Add an element to the left side of the deque.\"},clear:{$meth(){return this.$clear(),Sk.builtin.none.none$},$flags:{NoArgs:!0},$textsig:null,$doc:\"Remove all elements from the deque.\"},__copy__:{$meth(){return this.$copy()},$flags:{NoArgs:!0},$textsig:null,$doc:\"Return a shallow copy of a deque.\"},copy:{$meth(){return this.$copy()},$flags:{NoArgs:!0},$textsig:null,$doc:\"Return a shallow copy of a deque.\"},count:{$meth(a){const b=this.tail-this.head&this.mask;let c=0;for(let d=0;d<b;d++)Sk.misceval.richCompareBool(this.v[this.head+d&this.mask],a,\"Eq\")&&c++;return new Sk.builtin.int_(c)},$flags:{OneArg:!0},$textsig:null,$doc:\"D.count(value) -> integer -- return number of occurrences of value\"},extend:{$meth(a){return this.$extend(a),Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:null,$doc:\"Extend the right side of the deque with elements from the iterable\"},extendleft:{$meth(a){for(it=Sk.abstr.iter(a),i=it.tp$iternext();void 0!==i;i=it.tp$iternext())this.$pushLeft(i);return Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:null,$doc:\"Extend the left side of the deque with elements from the iterable\"},index:{$meth(a,b,c){const d=this.$index(a,b,c);if(void 0!==d)return new Sk.builtin.int_(d);throw new Sk.builtin.ValueError(Sk.misceval.objectRepr(a)+\" is not in deque\")},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:\"D.index(value, [start, [stop]]) -> integer -- return first index of value.\\nRaises ValueError if the value is not present.\"},insert:{$meth(a,b){a=Sk.misceval.asIndexOrThrow(a,\"integer argument expected, got {tp$name}\");const c=this.tail-this.head&this.mask;if(void 0!==this.maxlen&&c>=this.maxlen)throw new Sk.builtin.IndexError(\"deque already at its maximum size\");a>c&&(a=c),a<=-c&&(a=0);const d=(0<=a?this.head:this.tail)+a&this.mask;let e=this.tail;for(this.tail=this.tail+1&this.mask;e!==d;){const a=e-1&this.mask;this.v[e]=this.v[a],e=a}return this.v[d]=b,this.head===this.tail&&this.$resize(this.v.length,this.v.length<<1),Sk.builtin.none.none$},$flags:{MinArgs:2,MaxArgs:2},$textsig:null,$doc:\"D.insert(index, object) -- insert object before index\"},pop:{$meth(){return this.$pop()},$flags:{NoArgs:!0},$textsig:null,$doc:\"Remove and return the rightmost element.\"},popleft:{$meth(){return this.$popLeft()},$flags:{NoArgs:!0},$textsig:null,$doc:\"Remove and return the leftmost element.\"},remove:{$meth(a){const b=this.$index(a);if(void 0===b)throw new Sk.builtin.ValueError(Sk.misceval.objectRepr(a)+\" is not in deque\");const c=this.head+b&this.mask;for(let b=c;b!==this.tail;){const a=b+1&this.mask;this.v[b]=this.v[a],b=a}this.tail=this.tail-1&this.mask;var d=this.tail-this.head&this.mask;d<this.mask>>>1&&this.$resize(d,this.v.length>>>1)},$flags:{OneArg:!0},$textsig:null,$doc:\"D.remove(value) -- remove first occurrence of value.\"},__reversed__:{$meth(){return new d(this)},$flags:{NoArgs:!0},$textsig:null,$doc:\"D.__reversed__() -- return a reverse iterator over the deque\"},reverse:{$meth(){const c=this.head,d=this.tail,e=this.mask,f=this.tail-this.head&this.mask;for(let g=0;g<~~(f/2);g++){const f=d-g-1&e,a=c+g&e,b=this.v[f];this.v[f]=this.v[a],this.v[a]=b}return Sk.builtin.none.none$},$flags:{NoArgs:!0},$textsig:null,$doc:\"D.reverse() -- reverse *IN PLACE*\"},rotate:{$meth(a){a=void 0===a?1:Sk.misceval.asIndexSized(a,Sk.builtin.OverflowError);const c=this.head,d=this.tail;if(0===a||c===d)return this;if(this.head=c-a&this.mask,this.tail=d-a&this.mask,0<a)for(let e=1;e<=a;e++){const f=c-e&this.mask,a=d-e&this.mask;this.v[f]=this.v[a],this.v[a]=void 0}else for(let e=0;e>a;e--){const f=d-e&this.mask,a=c-e&this.mask;this.v[f]=this.v[a],this.v[a]=void 0}return Sk.builtin.none.none$},$flags:{MinArgs:0,MaxArgs:1},$textsig:null,$doc:\"Rotate the deque n steps to the right (default n=1).  If n is negative, rotates left.\"}},getsets:{maxlen:{$get(){return void 0===this.maxlen?Sk.builtin.none.none$:new Sk.builtin.int_(this.maxlen)},$doc:\"maximum size of a deque or None if unbounded\"}},proto:{$clear(){this.head=0,this.tail=0,this.mask=1,this.v=[,,]},$copy(){return new a.deque(this.v.slice(0),this.maxlen,this.head,this.tail,this.mask)},$extend(a){for(it=Sk.abstr.iter(a),i=it.tp$iternext();void 0!==i;i=it.tp$iternext())this.$push(i)},set$item(a,b){const c=(0<=a?this.head:this.tail)+a&this.mask;this.v[c]=b},del$item(a){const b=(0<=a?this.head:this.tail)+a&this.mask;for(let c=b;c!==this.tail;){const a=c+1&this.mask;this.v[c]=this.v[a],c=a}const c=this.tail-this.head&this.mask;this.tail=this.tail-1&this.mask,c<this.mask>>>1&&this.$resize(c,this.v.length>>>1)},$push(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);const b=this.tail-this.head&this.mask;return void 0!==this.maxlen&&b>this.maxlen&&this.$popLeft(),this},$pushLeft(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);const b=this.tail-this.head&this.mask;return void 0!==this.maxlen&&b>this.maxlen&&this.$pop(),this},$pop(){if(this.head===this.tail)throw new Sk.builtin.IndexError(\"pop from an empty deque\");this.tail=this.tail-1&this.mask;const a=this.v[this.tail];this.v[this.tail]=void 0;const b=this.tail-this.head&this.mask;return b<this.mask>>>1&&this.$resize(b,this.v.length>>>1),a},$popLeft(){if(this.head===this.tail)throw new Sk.builtin.IndexError(\"pop from an empty deque\");const a=this.v[this.head];this.v[this.head]=void 0,this.head=this.head+1&this.mask;const b=this.tail-this.head&this.mask;return b<this.mask>>>1&&this.$resize(b,this.v.length>>>1),a},$resize(a,b){const 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},$index(a,b,c){const d=this.tail-this.head&this.mask;b=void 0===b?0:Sk.misceval.asIndexOrThrow(b),c=c===void 0?d:Sk.misceval.asIndexOrThrow(c);const e=this.head,f=this.mask,g=this.v,h=0<=b?b:b<-d?0:d+b;c=0<=c?c:c<-d?0:d+c;for(let d=h;d<c;d++)if(g[e+d&f]===a)return d},sk$asarray(){const a=[],b=this.tail-this.head&this.mask;for(let c=0;c<b;++c){const b=this.head+c&this.mask;a.push(this.v[b])}return a}}});const c=Sk.abstr.buildIteratorClass(\"_collections._deque_iterator\",{constructor:function _deque_iterator(a){this.$index=0,this.dq=a.v,this.$length=a.tail-a.head&a.mask,this.$head=a.head,this.$tail=a.tail,this.$mask=a.mask},iternext(){if(!(this.$index>=this.$length)){const a=(0<=this.$index?this.$head:this.$tail)+this.$index&this.$mask;return this.$index++,this.dq[a]}},methods:{__length_hint__:{$meth:function __length_hint__(){return new Sk.builtin.int_(this.$length-this.$index)},$flags:{NoArgs:!0}}}}),d=Sk.abstr.buildIteratorClass(\"_collections._deque_reverse_iterator\",{constructor:function _deque_reverse_iterator(a){this.$index=(a.tail-a.head&a.mask)-1,this.dq=a.v,this.$head=a.head,this.$mask=a.mask},iternext(){if(!(0>this.$index)){const a=this.$head+this.$index&this.$mask;return this.$index--,this.dq[a]}},methods:{__length_hint__:Sk.generic.iterReverseLengthHintMethodDef}}),e=new RegExp(/^[0-9].*/),f=new RegExp(/^[0-9_].*/),g=new RegExp(/^\\w*$/),h=/,/g,j=/\\s+/;return namedtuple.co_argcount=2,namedtuple.co_kwonlyargcount=3,namedtuple.$kwdefs=[Sk.builtin.bool.false$,Sk.builtin.none.none$,Sk.builtin.none.none$],namedtuple.co_varnames=[\"typename\",\"field_names\",\"rename\",\"defaults\",\"module\"],a.namedtuple=new Sk.builtin.func(namedtuple),a}","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\ntry:\n    long\nexcept NameError:\n    long = int\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, str, tuple, type, frozenset, long):\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_frozenset(x, memo):\n    result = frozenset(_deepcopy_set(x,memo)) \n    memo[id(x)] = result \n    return result\nd[frozenset] = _deepcopy_frozenset\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            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):\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)\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):\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):\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.querySelector=new Sk.builtin.func(function(a){var c=document.querySelector(a.v);return c?Sk.misceval.callsimArray(b.Element,[c]):Sk.builtin.none.none$}),b.querySelectorAll=new Sk.builtin.func(function(a){for(var c=document.querySelectorAll(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.getCurrentEditorValue=new Sk.builtin.func(function(){if(void 0!==Sk.divid&&void 0!==window.edList){if(Sk.gradeContainer!=Sk.divid){var a=Sk.gradeContainer+\" \"+Sk.divid;return new Sk.builtin.str(window.edList[a].editor.getValue())}return new Sk.builtin.str(window.edList[Sk.divid].editor.getValue())}throw new Sk.builtin.AttributeError(\"Can't find editor for this div\")}),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\")}),b.currentCourse=new Sk.builtin.func(function(){if(void 0!==eBookConfig)return new Sk.builtin.str(eBookConfig.course);throw new Sk.builtin.AttributeError(\"There is no course\")}),b.currentGradingContainer=new Sk.builtin.func(function(){if(void 0!==Sk.gradeContainer)return new Sk.builtin.str(Sk.gradeContainer);if(null!=Sk.divid)return new Sk.builtin.str(Sk.divid);throw new Sk.builtin.AttributeError(\"There is no value set for grading\")}),a=function(a,c){c.__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\"),Sk.builtin.bool(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))}),c.tp$getattr=Sk.generic.getAttr,c.__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))}),c.appendChild=new Sk.builtin.func(function(a,b){a.v.appendChild(b.v)}),c.removeChild=new Sk.builtin.func(function(a,b){a.v.removeChild(b.v)}),c.closest=new Sk.builtin.func(function(a,c){var d=a.v.closest(c.v);return d?Sk.misceval.callsimArray(b.Element,[d]):Sk.builtin.none.none$}),c.getCSS=new Sk.builtin.func(function(a,b){return new Sk.builtin.str(a.v.style[b.v])}),c.setCSS=new Sk.builtin.func(function(a,b,c){a.v.style[b.v]=c.v}),c.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$}),c.setAttribute=new Sk.builtin.func(function(a,b,c){a.v.setAttribute(b.v,c.v)}),c.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$}),c.__str__=new Sk.builtin.func(function(a){return console.log(a.v.tagName),new Sk.builtin.str(a.v.tagName)}),c.__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":"\"\"\"Heap queue algorithm (a.k.a. priority queue).\n\nHeaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for\nall k, counting elements from 0.  For the sake of comparison,\nnon-existing elements are considered to be infinite.  The interesting\nproperty of a heap is that a[0] is always its smallest element.\n\nUsage:\n\nheap = []            # creates an empty heap\nheappush(heap, item) # pushes a new item on the heap\nitem = heappop(heap) # pops the smallest item from the heap\nitem = heap[0]       # smallest item on the heap without popping it\nheapify(x)           # transforms list into a heap, in-place, in linear time\nitem = heapreplace(heap, item) # pops and returns smallest item, and adds\n                               # new item; the heap size is unchanged\n\nOur API differs from textbook heap algorithms as follows:\n\n- We use 0-based indexing.  This makes the relationship between the\n  index for a node and the indexes for its children slightly less\n  obvious, but is more suitable since Python uses 0-based indexing.\n\n- Our heappop() method returns the smallest item, not the largest.\n\nThese two make it possible to view the heap as a regular Python list\nwithout surprises: heap[0] is the smallest item, and heap.sort()\nmaintains the heap invariant!\n\"\"\"\n\n# Original code by Kevin O'Connor, augmented by Tim Peters and Raymond Hettinger\n\n__about__ = \"\"\"Heap queues\n\n[explanation by François Pinard]\n\nHeaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for\nall k, counting elements from 0.  For the sake of comparison,\nnon-existing elements are considered to be infinite.  The interesting\nproperty of a heap is that a[0] is always its smallest element.\n\nThe strange invariant above is meant to be an efficient memory\nrepresentation for a tournament.  The numbers below are `k', not a[k]:\n\n                                   0\n\n                  1                                 2\n\n          3               4                5               6\n\n      7       8       9       10      11      12      13      14\n\n    15 16   17 18   19 20   21 22   23 24   25 26   27 28   29 30\n\n\nIn the tree above, each cell `k' is topping `2*k+1' and `2*k+2'.  In\na usual binary tournament we see in sports, each cell is the winner\nover the two cells it tops, and we can trace the winner down the tree\nto see all opponents s/he had.  However, in many computer applications\nof such tournaments, we do not need to trace the history of a winner.\nTo be more memory efficient, when a winner is promoted, we try to\nreplace it by something else at a lower level, and the rule becomes\nthat a cell and the two cells it tops contain three different items,\nbut the top cell \"wins\" over the two topped cells.\n\nIf this heap invariant is protected at all time, index 0 is clearly\nthe overall winner.  The simplest algorithmic way to remove it and\nfind the \"next\" winner is to move some loser (let's say cell 30 in the\ndiagram above) into the 0 position, and then percolate this new 0 down\nthe tree, exchanging values, until the invariant is re-established.\nThis is clearly logarithmic on the total number of items in the tree.\nBy iterating over all items, you get an O(n ln n) sort.\n\nA nice feature of this sort is that you can efficiently insert new\nitems while the sort is going on, provided that the inserted items are\nnot \"better\" than the last 0'th element you extracted.  This is\nespecially useful in simulation contexts, where the tree holds all\nincoming events, and the \"win\" condition means the smallest scheduled\ntime.  When an event schedule other events for execution, they are\nscheduled into the future, so they can easily go into the heap.  So, a\nheap is a good structure for implementing schedulers (this is what I\nused for my MIDI sequencer :-).\n\nVarious structures for implementing schedulers have been extensively\nstudied, and heaps are good for this, as they are reasonably speedy,\nthe speed is almost constant, and the worst case is not much different\nthan the average case.  However, there are other representations which\nare more efficient overall, yet the worst cases might be terrible.\n\nHeaps are also very useful in big disk sorts.  You most probably all\nknow that a big sort implies producing \"runs\" (which are pre-sorted\nsequences, which size is usually related to the amount of CPU memory),\nfollowed by a merging passes for these runs, which merging is often\nvery cleverly organised[1].  It is very important that the initial\nsort produces the longest runs possible.  Tournaments are a good way\nto that.  If, using all the memory available to hold a tournament, you\nreplace and percolate items that happen to fit the current run, you'll\nproduce runs which are twice the size of the memory for random input,\nand much better for input fuzzily ordered.\n\nMoreover, if you output the 0'th item on disk and get an input which\nmay not fit in the current tournament (because the value \"wins\" over\nthe last output value), it cannot fit in the heap, so the size of the\nheap decreases.  The freed memory could be cleverly reused immediately\nfor progressively building a second heap, which grows at exactly the\nsame rate the first heap is melting.  When the first heap completely\nvanishes, you switch heaps and start a new run.  Clever and quite\neffective!\n\nIn a word, heaps are useful memory structures to know.  I use them in\na few applications, and I think it is good to keep a `heap' module\naround. :-)\n\n--------------------\n[1] The disk balancing algorithms which are current, nowadays, are\nmore annoying than clever, and this is a consequence of the seeking\ncapabilities of the disks.  On devices which cannot seek, like big\ntape drives, the story was quite different, and one had to be very\nclever to ensure (far in advance) that each tape movement will be the\nmost effective possible (that is, will best participate at\n\"progressing\" the merge).  Some tapes were even able to read\nbackwards, and this was also used to avoid the rewinding time.\nBelieve me, real good tape sorts were quite spectacular to watch!\nFrom all times, sorting has always been a Great Art! :-)\n\"\"\"\n\n__all__ = ['heappush', 'heappop', 'heapify', 'heapreplace',\n           'nlargest', 'nsmallest', 'heappushpop']\n\ndef heappush(heap, item):\n    \"\"\"Push item onto heap, maintaining the heap invariant.\"\"\"\n    heap.append(item)\n    _siftdown(heap, 0, len(heap)-1)\n\ndef heappop(heap):\n    \"\"\"Pop the smallest item off the heap, maintaining the heap invariant.\"\"\"\n    lastelt = heap.pop()    # raises appropriate IndexError if heap is empty\n    if heap:\n        returnitem = heap[0]\n        heap[0] = lastelt\n        _siftup(heap, 0)\n        return returnitem\n    return lastelt\n\ndef heapreplace(heap, item):\n    \"\"\"Pop and return the current smallest value, and add the new item.\n\n    This is more efficient than heappop() followed by heappush(), and can be\n    more appropriate when using a fixed-size heap.  Note that the value\n    returned may be larger than item!  That constrains reasonable uses of\n    this routine unless written as part of a conditional replacement:\n\n        if item > heap[0]:\n            item = heapreplace(heap, item)\n    \"\"\"\n    returnitem = heap[0]    # raises appropriate IndexError if heap is empty\n    heap[0] = item\n    _siftup(heap, 0)\n    return returnitem\n\ndef heappushpop(heap, item):\n    \"\"\"Fast version of a heappush followed by a heappop.\"\"\"\n    if heap and heap[0] < item:\n        item, heap[0] = heap[0], item\n        _siftup(heap, 0)\n    return item\n\ndef heapify(x):\n    \"\"\"Transform list into a heap, in-place, in O(len(x)) time.\"\"\"\n    n = len(x)\n    # Transform bottom-up.  The largest index there's any point to looking at\n    # is the largest with a child index in-range, so must have 2*i + 1 < n,\n    # or i < (n-1)/2.  If n is even = 2*j, this is (2*j-1)/2 = j-1/2 so\n    # j-1 is the largest, which is n//2 - 1.  If n is odd = 2*j+1, this is\n    # (2*j+1-1)/2 = j so j-1 is the largest, and that's again n//2-1.\n    for i in reversed(range(n//2)):\n        _siftup(x, i)\n\ndef _heappop_max(heap):\n    \"\"\"Maxheap version of a heappop.\"\"\"\n    lastelt = heap.pop()    # raises appropriate IndexError if heap is empty\n    if heap:\n        returnitem = heap[0]\n        heap[0] = lastelt\n        _siftup_max(heap, 0)\n        return returnitem\n    return lastelt\n\ndef _heapreplace_max(heap, item):\n    \"\"\"Maxheap version of a heappop followed by a heappush.\"\"\"\n    returnitem = heap[0]    # raises appropriate IndexError if heap is empty\n    heap[0] = item\n    _siftup_max(heap, 0)\n    return returnitem\n\ndef _heapify_max(x):\n    \"\"\"Transform list into a maxheap, in-place, in O(len(x)) time.\"\"\"\n    n = len(x)\n    for i in reversed(range(n//2)):\n        _siftup_max(x, i)\n\n# 'heap' is a heap at all indices >= startpos, except possibly for pos.  pos\n# is the index of a leaf with a possibly out-of-order value.  Restore the\n# heap invariant.\ndef _siftdown(heap, startpos, pos):\n    newitem = heap[pos]\n    # Follow the path to the root, moving parents down until finding a place\n    # newitem fits.\n    while pos > startpos:\n        parentpos = (pos - 1) >> 1\n        parent = heap[parentpos]\n        if newitem < parent:\n            heap[pos] = parent\n            pos = parentpos\n            continue\n        break\n    heap[pos] = newitem\n\n# The child indices of heap index pos are already heaps, and we want to make\n# a heap at index pos too.  We do this by bubbling the smaller child of\n# pos up (and so on with that child's children, etc) until hitting a leaf,\n# then using _siftdown to move the oddball originally at index pos into place.\n#\n# We *could* break out of the loop as soon as we find a pos where newitem <=\n# both its children, but turns out that's not a good idea, and despite that\n# many books write the algorithm that way.  During a heap pop, the last array\n# element is sifted in, and that tends to be large, so that comparing it\n# against values starting from the root usually doesn't pay (= usually doesn't\n# get us out of the loop early).  See Knuth, Volume 3, where this is\n# explained and quantified in an exercise.\n#\n# Cutting the # of comparisons is important, since these routines have no\n# way to extract \"the priority\" from an array element, so that intelligence\n# is likely to be hiding in custom comparison methods, or in array elements\n# storing (priority, record) tuples.  Comparisons are thus potentially\n# expensive.\n#\n# On random arrays of length 1000, making this change cut the number of\n# comparisons made by heapify() a little, and those made by exhaustive\n# heappop() a lot, in accord with theory.  Here are typical results from 3\n# runs (3 just to demonstrate how small the variance is):\n#\n# Compares needed by heapify     Compares needed by 1000 heappops\n# --------------------------     --------------------------------\n# 1837 cut to 1663               14996 cut to 8680\n# 1855 cut to 1659               14966 cut to 8678\n# 1847 cut to 1660               15024 cut to 8703\n#\n# Building the heap by using heappush() 1000 times instead required\n# 2198, 2148, and 2219 compares:  heapify() is more efficient, when\n# you can use it.\n#\n# The total compares needed by list.sort() on the same lists were 8627,\n# 8627, and 8632 (this should be compared to the sum of heapify() and\n# heappop() compares):  list.sort() is (unsurprisingly!) more efficient\n# for sorting.\n\ndef _siftup(heap, pos):\n    endpos = len(heap)\n    startpos = pos\n    newitem = heap[pos]\n    # Bubble up the smaller child until hitting a leaf.\n    childpos = 2*pos + 1    # leftmost child position\n    while childpos < endpos:\n        # Set childpos to index of smaller child.\n        rightpos = childpos + 1\n        if rightpos < endpos and not heap[childpos] < heap[rightpos]:\n            childpos = rightpos\n        # Move the smaller child up.\n        heap[pos] = heap[childpos]\n        pos = childpos\n        childpos = 2*pos + 1\n    # The leaf at pos is empty now.  Put newitem there, and bubble it up\n    # to its final resting place (by sifting its parents down).\n    heap[pos] = newitem\n    _siftdown(heap, startpos, pos)\n\ndef _siftdown_max(heap, startpos, pos):\n    'Maxheap variant of _siftdown'\n    newitem = heap[pos]\n    # Follow the path to the root, moving parents down until finding a place\n    # newitem fits.\n    while pos > startpos:\n        parentpos = (pos - 1) >> 1\n        parent = heap[parentpos]\n        if parent < newitem:\n            heap[pos] = parent\n            pos = parentpos\n            continue\n        break\n    heap[pos] = newitem\n\ndef _siftup_max(heap, pos):\n    'Maxheap variant of _siftup'\n    endpos = len(heap)\n    startpos = pos\n    newitem = heap[pos]\n    # Bubble up the larger child until hitting a leaf.\n    childpos = 2*pos + 1    # leftmost child position\n    while childpos < endpos:\n        # Set childpos to index of larger child.\n        rightpos = childpos + 1\n        if rightpos < endpos and not heap[rightpos] < heap[childpos]:\n            childpos = rightpos\n        # Move the larger child up.\n        heap[pos] = heap[childpos]\n        pos = childpos\n        childpos = 2*pos + 1\n    # The leaf at pos is empty now.  Put newitem there, and bubble it up\n    # to its final resting place (by sifting its parents down).\n    heap[pos] = newitem\n    _siftdown_max(heap, startpos, pos)\n\n\n# Algorithm notes for nlargest() and nsmallest()\n# ==============================================\n#\n# Make a single pass over the data while keeping the k most extreme values\n# in a heap.  Memory consumption is limited to keeping k values in a list.\n#\n# Measured performance for random inputs:\n#\n#                                   number of comparisons\n#    n inputs     k-extreme values  (average of 5 trials)   % more than min()\n# -------------   ----------------  ---------------------   -----------------\n#      1,000           100                  3,317               231.7%\n#     10,000           100                 14,046                40.5%\n#    100,000           100                105,749                 5.7%\n#  1,000,000           100              1,007,751                 0.8%\n# 10,000,000           100             10,009,401                 0.1%\n#\n# Theoretical number of comparisons for k smallest of n random inputs:\n#\n# Step   Comparisons                  Action\n# ----   --------------------------   ---------------------------\n#  1     1.66 * k                     heapify the first k-inputs\n#  2     n - k                        compare remaining elements to top of heap\n#  3     k * (1 + lg2(k)) * ln(n/k)   replace the topmost value on the heap\n#  4     k * lg2(k) - (k/2)           final sort of the k most extreme values\n#\n# Combining and simplifying for a rough estimate gives:\n#\n#        comparisons = n + k * (log(k, 2) * log(n/k) + log(k, 2) + log(n/k))\n#\n# Computing the number of comparisons for step 3:\n# -----------------------------------------------\n# * For the i-th new value from the iterable, the probability of being in the\n#   k most extreme values is k/i.  For example, the probability of the 101st\n#   value seen being in the 100 most extreme values is 100/101.\n# * If the value is a new extreme value, the cost of inserting it into the\n#   heap is 1 + log(k, 2).\n# * The probability times the cost gives:\n#            (k/i) * (1 + log(k, 2))\n# * Summing across the remaining n-k elements gives:\n#            sum((k/i) * (1 + log(k, 2)) for i in range(k+1, n+1))\n# * This reduces to:\n#            (H(n) - H(k)) * k * (1 + log(k, 2))\n# * Where H(n) is the n-th harmonic number estimated by:\n#            gamma = 0.5772156649\n#            H(n) = log(n, e) + gamma + 1 / (2 * n)\n#   http://en.wikipedia.org/wiki/Harmonic_series_(mathematics)#Rate_of_divergence\n# * Substituting the H(n) formula:\n#            comparisons = k * (1 + log(k, 2)) * (log(n/k, e) + (1/n - 1/k) / 2)\n#\n# Worst-case for step 3:\n# ----------------------\n# In the worst case, the input data is reversed sorted so that every new element\n# must be inserted in the heap:\n#\n#             comparisons = 1.66 * k + log(k, 2) * (n - k)\n#\n# Alternative Algorithms\n# ----------------------\n# Other algorithms were not used because they:\n# 1) Took much more auxiliary memory,\n# 2) Made multiple passes over the data.\n# 3) Made more comparisons in common cases (small k, large n, semi-random input).\n# See the more detailed comparison of approach at:\n# http://code.activestate.com/recipes/577573-compare-algorithms-for-heapqsmallest\n\ndef nsmallest(n, iterable, key=None):\n    \"\"\"Find the n smallest elements in a dataset.\n\n    Equivalent to:  sorted(iterable, key=key)[:n]\n    \"\"\"\n\n    # Short-cut for n==1 is to use min()\n    if n == 1:\n        it = iter(iterable)\n        sentinel = object()\n        result = min(it, default=sentinel, key=key)\n        return [] if result is sentinel else [result]\n\n    # When n>=size, it's faster to use sorted()\n    try:\n        size = len(iterable)\n    except (TypeError, AttributeError):\n        pass\n    else:\n        if n >= size:\n            return sorted(iterable, key=key)[:n]\n\n    # When key is none, use simpler decoration\n    if key is None:\n        it = iter(iterable)\n        # put the range(n) first so that zip() doesn't\n        # consume one too many elements from the iterator\n        result = [(elem, i) for i, elem in zip(range(n), it)]\n        if not result:\n            return result\n        _heapify_max(result)\n        top = result[0][0]\n        order = n\n        _heapreplace = _heapreplace_max\n        for elem in it:\n            if elem < top:\n                _heapreplace(result, (elem, order))\n                top, _order = result[0]\n                order += 1\n        result.sort()\n        return [elem for (elem, order) in result]\n\n    # General case, slowest method\n    it = iter(iterable)\n    result = [(key(elem), i, elem) for i, elem in zip(range(n), it)]\n    if not result:\n        return result\n    _heapify_max(result)\n    top = result[0][0]\n    order = n\n    _heapreplace = _heapreplace_max\n    for elem in it:\n        k = key(elem)\n        if k < top:\n            _heapreplace(result, (k, order, elem))\n            top, _order, _elem = result[0]\n            order += 1\n    result.sort()\n    return [elem for (k, order, elem) in result]\n\ndef nlargest(n, iterable, key=None):\n    \"\"\"Find the n largest elements in a dataset.\n\n    Equivalent to:  sorted(iterable, key=key, reverse=True)[:n]\n    \"\"\"\n\n    # Short-cut for n==1 is to use max()\n    if n == 1:\n        it = iter(iterable)\n        sentinel = object()\n        result = max(it, default=sentinel, key=key)\n        return [] if result is sentinel else [result]\n\n    # When n>=size, it's faster to use sorted()\n    try:\n        size = len(iterable)\n    except (TypeError, AttributeError):\n        pass\n    else:\n        if n >= size:\n            return sorted(iterable, key=key, reverse=True)[:n]\n\n    # When key is none, use simpler decoration\n    if key is None:\n        it = iter(iterable)\n        result = [(elem, i) for i, elem in zip(range(0, -n, -1), it)]\n        if not result:\n            return result\n        heapify(result)\n        top = result[0][0]\n        order = -n\n        _heapreplace = heapreplace\n        for elem in it:\n            if top < elem:\n                _heapreplace(result, (elem, order))\n                top, _order = result[0]\n                order -= 1\n        result.sort(reverse=True)\n        return [elem for (elem, order) in result]\n\n    # General case, slowest method\n    it = iter(iterable)\n    result = [(key(elem), i, elem) for i, elem in zip(range(0, -n, -1), it)]\n    if not result:\n        return result\n    heapify(result)\n    top = result[0][0]\n    order = -n\n    _heapreplace = heapreplace\n    for elem in it:\n        k = key(elem)\n        if top < k:\n            _heapreplace(result, (k, order, elem))\n            top, _order, _elem = result[0]\n            order -= 1\n    result.sort(reverse=True)\n    return [elem for (k, order, elem) in result]\n\n# If available, use C implementation\ntry:\n    from _heapq import *\nexcept ImportError:\n    pass\ntry:\n    from _heapq import _heapreplace_max\nexcept ImportError:\n    pass\ntry:\n    from _heapq import _heapify_max\nexcept ImportError:\n    pass\ntry:\n    from _heapq import _heappop_max\nexcept ImportError:\n    pass\n\n\nif __name__ == \"__main__\":\n\n    import doctest # pragma: no cover\n    print(doctest.testmod()) # pragma: no cover\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){let b=Sk.ffi.remapToJs(a);try{let a=Sk.read(b),c=b.substring(b.lastIndexOf(\".\")+1);return`data:image/${c};base64, ${a}`}catch(a){console.log(`${b} is not in the database ${a}`)}var c,d,e=\"function\"==typeof Sk.imageProxy?Sk.imageProxy:function(a){return c=document.createElement(\"a\"),c.href=d,window.location.host===c.host?a:Sk.imageProxy+\"/\"+a};return d=Sk.ffi.remapToJs(a),d=e(d),d},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":"var $builtinmodule=function(){function combinationsNew(a,b,c){let d,e;[d,e]=Sk.abstr.copyKeywordsToNamedArgs(a.tp$name,[\"iterable\",\"r\"],b,c,[]);const f=Sk.misceval.arrayFromIterable(d);if(e=Sk.misceval.asIndexSized(e,Sk.builtin.OverFlowError),0>e)throw new Sk.builtin.ValueError(\"r must be non-negative\");if(this===a)return new a.constructor(f,e);else{const b=new this.constructor;return a.constructor.call(b,f,e),b}}var a={};return a.accumulate=Sk.abstr.buildIteratorClass(\"itertools.accumulate\",{constructor:function accumulate(a,b,c){this.iter=a,this.func=b,this.total=c,this.tp$iternext=()=>(this.total=Sk.builtin.checkNone(this.total)?this.iter.tp$iternext():this.total,this.tp$iternext=this.constructor.prototype.tp$iternext,this.total)},iternext(){let a=this.iter.tp$iternext();if(void 0!==a)return this.total=Sk.misceval.callsimArray(this.func,[this.total,a]),this.total},slots:{tp$doc:\"accumulate(iterable[, func, initial]) --> accumulate object\\n\\nReturn series of accumulated sums (or other binary function results).\",tp$new(b,c){Sk.abstr.checkArgsLen(\"accumulate\",b,0,2);let[d,e,f]=Sk.abstr.copyKeywordsToNamedArgs(\"accumulate\",[\"iterable\",\"func\",\"initial\"],b,c,[Sk.builtin.none.none$,Sk.builtin.none.none$]);if(d=Sk.abstr.iter(d),e=Sk.builtin.checkNone(e)?new Sk.builtin.func((c,a)=>Sk.abstr.numberBinOp(c,a,\"Add\")):e,this===a.accumulate.prototype)return new a.accumulate(d,e,f);else{const b=new this.constructor;return a.accumulate.call(b,d,e,f),b}}}}),a.chain=Sk.abstr.buildIteratorClass(\"itertools.chain\",{constructor:function chain(a){this.iterables=a,this.current_it=null,this.tp$iternext=()=>(this.tp$iternext=this.constructor.prototype.tp$iternext,this.current_it=this.iterables.tp$iternext(),void 0===this.current_it)?void(this.tp$iternext=()=>void 0):(this.current_it=Sk.abstr.iter(this.current_it),this.tp$iternext())},iternext(){for(let a;void 0===a;)if(a=this.current_it.tp$iternext(),void 0===a){if(this.current_it=this.iterables.tp$iternext(),void 0===this.current_it)return void(this.tp$iternext=()=>void 0);this.current_it=Sk.abstr.iter(this.current_it)}else return a},slots:{tp$doc:\"chain(*iterables) --> chain object\\n\\nReturn a chain object whose .__next__() method returns elements from the\\nfirst iterable until it is exhausted, then elements from the next\\niterable, until all of the iterables are exhausted.\",tp$new(b,c){if(Sk.abstr.checkNoKwargs(\"chain\",c),b=new Sk.builtin.tuple(b.slice(0)).tp$iter(),this===a.chain.prototype)return new a.chain(b);else{const c=new this.constructor;return a.chain.call(c,b),c}}},classmethods:{from_iterable:{$meth(b){const c=Sk.abstr.iter(b);return new a.chain(c)},$flags:{OneArg:!0},$doc:\"chain.from_iterable(iterable) --> chain object\\n\\nAlternate chain() constructor taking a single iterable argument\\nthat evaluates lazily.\",$textsig:null}}}),a.combinations=Sk.abstr.buildIteratorClass(\"itertools.combinations\",{constructor:function combinations(a,b){this.pool=a,this.r=b,this.indices=Array(b).fill().map((a,b)=>b),this.n=a.length,this.tp$iternext=()=>{if(!(this.r>this.n))return this.tp$iternext=this.constructor.prototype.tp$iternext,new Sk.builtin.tuple(this.pool.slice(0,this.r))}},iternext(){let a,b=!1;for(a=this.r-1;0<=a;a--)if(this.indices[a]!=a+this.n-this.r){b=!0;break}if(!b)return void(this.r=0);this.indices[a]++;for(let b=a+1;b<this.r;b++)this.indices[b]=this.indices[b-1]+1;const c=this.indices.map(a=>this.pool[a]);return new Sk.builtin.tuple(c)},slots:{tp$doc:\"combinations(iterable, r) --> combinations object\\n\\nReturn successive r-length combinations of elements in the iterable.\\n\\ncombinations(range(4), 3) --> (0,1,2), (0,1,3), (0,2,3), (1,2,3)\",tp$new(b,c){return combinationsNew.call(this,a.combinations.prototype,b,c)}}}),a.combinations_with_replacement=Sk.abstr.buildIteratorClass(\"itertools.combinations_with_replacement\",{constructor:function combinations_with_replacement(a,b){this.pool=a,this.r=b,this.indices=Array(b).fill(0),this.n=a.length,this.tp$iternext=()=>{if(!this.r||this.n){this.tp$iternext=this.constructor.prototype.tp$iternext;const a=this.indices.map(a=>this.pool[a]);return new Sk.builtin.tuple(a)}}},iternext(){let a,b=!1;for(a=this.r-1;0<=a;a--)if(this.indices[a]!=this.n-1){b=!0;break}if(!b)return void(this.r=0);const c=this.indices[a]+1;for(let b=a;b<this.r;b++)this.indices[b]=c;const d=this.indices.map(a=>this.pool[a]);return new Sk.builtin.tuple(d)},slots:{tp$doc:\"combinations_with_replacement(iterable, r) --> combinations_with_replacement object\\n\\nReturn successive r-length combinations of elements in the iterable\\nallowing individual elements to have successive repeats.\\ncombinations_with_replacement('ABC', 2) --> AA AB AC BB BC CC\",tp$new(b,c){return combinationsNew.call(this,a.combinations_with_replacement.prototype,b,c)}}}),a.compress=Sk.abstr.buildIteratorClass(\"itertools.compress\",{constructor:function compress(a,b){this.data=a,this.selectors=b},iternext(){let a=this.data.tp$iternext(),b=this.selectors.tp$iternext();for(;void 0!==a&&void 0!==b;){if(Sk.misceval.isTrue(b))return a;a=this.data.tp$iternext(),b=this.selectors.tp$iternext()}},slots:{tp$doc:\"compress(data, selectors) --> iterator over selected data\\n\\nReturn data elements corresponding to true selector elements.\\nForms a shorter iterator from selected data elements using the\\nselectors to choose the data elements.\",tp$new(b,c){let d,e;if([d,e]=Sk.abstr.copyKeywordsToNamedArgs(\"compress\",[\"data\",\"selectors\"],b,c,[]),d=Sk.abstr.iter(d),e=Sk.abstr.iter(e),this===a.count.prototype)return new a.compress(d,e);else{const b=new this.constructor;return a.compress.call(b,d,e),b}}}}),a.count=Sk.abstr.buildIteratorClass(\"itertools.count\",{constructor:function count(a,b){this.start=a,this.step=b},iternext(){const a=this.start;return this.start=Sk.abstr.numberBinOp(this.start,this.step,\"Add\"),a},slots:{tp$doc:\"count(start=0, step=1) --> count object\\n\\nReturn a count object whose .__next__() method returns consecutive values.\\nEquivalent to:\\n\\n    def count(firstval=0, step=1):\\n        x = firstval\\n        while 1:\\n            yield x\\n            x += step\\n\",tp$new(b,c){const[d,e]=Sk.abstr.copyKeywordsToNamedArgs(\"count\",[\"start\",\"step\"],b,c,[new Sk.builtin.int_(0),new Sk.builtin.int_(1)]);if(!Sk.builtin.checkNumber(d)&&!Sk.builtin.checkComplex(d))throw new Sk.builtin.TypeError(\"a number is required\");if(!Sk.builtin.checkNumber(e)&&!Sk.builtin.checkComplex(e))throw new Sk.builtin.TypeError(\"a number is required\");if(this===a.count.prototype)return new a.count(d,e);else{const b=new this.constructor;return a.count.call(b,d,e),b}},$r(){const a=Sk.misceval.objectRepr(this.start);let b=Sk.misceval.objectRepr(this.step);return b=\"1\"===b?\"\":\", \"+b,new Sk.builtin.str(Sk.abstr.typeName(this)+\"(\"+a+b+\")\")}}}),a.cycle=Sk.abstr.buildIteratorClass(\"itertools.cycle\",{constructor:function cycle(a){this.iter=a,this.saved=[],this.consumed=!1,this.i=0,this.length},iternext(){let a;if(!this.consumed){if(a=this.iter.tp$iternext(),void 0!==a)return this.saved.push(a),a;if(this.consumed=!0,this.length=this.saved.length,!this.length)return}return a=this.saved[this.i],this.i=(this.i+1)%this.length,a},slots:{tp$doc:\"cycle(iterable) --> cycle object\\n\\nReturn elements from the iterable until it is exhausted.\\nThen repeat the sequence indefinitely.\",tp$new(b,c){Sk.abstr.checkOneArg(\"cycle\",b,c);const d=Sk.abstr.iter(b[0]);if(this===a.cycle.prototype)return new a.cycle(d);else{const b=new this.constructor;return a.cycle.call(b,d),b}}}}),a.dropwhile=Sk.abstr.buildIteratorClass(\"itertools.dropwhile\",{constructor:function dropwhile(a,b){this.predicate=a,this.iter=b,this.passed},iternext(){let a=this.iter.tp$iternext();for(;void 0===this.passed&&void 0!==a;){const b=Sk.misceval.callsimArray(this.predicate,[a]);if(!Sk.misceval.isTrue(b))return this.passed=!0,a;a=this.iter.tp$iternext()}return a},slots:{tp$doc:\"dropwhile(predicate, iterable) --> dropwhile object\\n\\nDrop items from the iterable while predicate(item) is true.\\nAfterwards, return every element until the iterable is exhausted.\",tp$new(b,c){Sk.abstr.checkNoKwargs(\"dropwhile\",c),Sk.abstr.checkArgsLen(\"dropwhile\",b,2,2);const d=b[0],e=Sk.abstr.iter(b[1]);if(this===a.dropwhile.prototype)return new a.dropwhile(d,e);else{const b=new this.constructor;return a.dropwhile.call(b,d,e),b}}}}),a.filterfalse=Sk.abstr.buildIteratorClass(\"itertools.filterfalse\",{constructor:function filterfalse(a,b){this.predicate=a,this.iter=b},iternext(){let a=this.iter.tp$iternext();if(void 0!==a){for(let b=Sk.misceval.callsimArray(this.predicate,[a]);Sk.misceval.isTrue(b);){if(a=this.iter.tp$iternext(),void 0===a)return;b=Sk.misceval.callsimArray(this.predicate,[a])}return a}},slots:{tp$doc:\"filterfalse(function or None, sequence) --> filterfalse object\\n\\nReturn those items of sequence for which function(item) is false.\\nIf function is None, return the items that are false.\",tp$new(b,c){Sk.abstr.checkNoKwargs(\"filterfalse\",c),Sk.abstr.checkArgsLen(\"filterfalse\",b,2,2);const d=Sk.builtin.checkNone(b[0])?Sk.builtin.bool:b[0],e=Sk.abstr.iter(b[1]);if(this===a.filterfalse.prototype)return new a.filterfalse(d,e);else{const b=new this.constructor;return a.filterfalse.call(b,d,e),b}}}}),a._grouper=Sk.abstr.buildIteratorClass(\"itertools._grouper\",{constructor:function _grouper(a){this.groupby=a,this.tgtkey=a.tgtkey,this.id=a.id},iternext(){const a=Sk.misceval.richCompareBool(this.groupby.currkey,this.tgtkey,\"Eq\");if(this.groupby.id===this.id&&a){let a=this.groupby.currval;return this.groupby.currval=this.groupby.iter.tp$iternext(),void 0!==this.groupby.currval&&(this.groupby.currkey=Sk.misceval.callsimArray(this.groupby.keyf,[this.groupby.currval])),a}}}),a.groupby=Sk.abstr.buildIteratorClass(\"itertools.groupby\",{constructor:function groupby(a,b){this.iter=a,this.keyf=b,this.currval,this.currkey=this.tgtkey=new Sk.builtin.object,this.id},iternext(){this.id={};for(let a=Sk.misceval.richCompareBool(this.currkey,this.tgtkey,\"Eq\");a;){if(this.currval=this.iter.tp$iternext(),void 0===this.currval)return;this.currkey=Sk.misceval.callsimArray(this.keyf,[this.currval]),a=Sk.misceval.richCompareBool(this.currkey,this.tgtkey,\"Eq\")}this.tgtkey=this.currkey;const b=new a._grouper(this);return new Sk.builtin.tuple([this.currkey,b])},slots:{tp$doc:\"groupby(iterable, key=None) -> make an iterator that returns consecutive\\nkeys and groups from the iterable.  If the key function is not specified or\\nis None, the element itself is used for grouping.\\n\",tp$new(b,c){let d,e;if([d,e]=Sk.abstr.copyKeywordsToNamedArgs(\"groupby\",[\"iterable\",\"key\"],b,c,[Sk.builtin.none.none$]),d=Sk.abstr.iter(d),e=Sk.builtin.checkNone(e)?new Sk.builtin.func(a=>a):e,this===a.groupby.prototype)return new a.groupby(d,e);else{const b=new this.constructor;return a.groupby.call(b,d,e),b}}}}),a.islice=Sk.abstr.buildIteratorClass(\"itertools.islice\",{constructor:function islice(a,b,c,d){this.iter=a,this.previt=b,this.stop=c,this.step=d,this.tp$iternext=()=>{if(this.tp$iternext=this.constructor.prototype.tp$iternext,this.previt>=this.stop){for(let a=0;a<this.stop;a++)this.iter.tp$iternext();return}for(let a=0;a<this.previt;a++)this.iter.tp$iternext();return this.iter.tp$iternext()}},iternext(){if(this.previt+this.step>=this.stop){for(let a=this.previt+1;a<this.stop;a++)this.previt+=this.step,this.iter.tp$iternext();return}for(let a=this.previt+1;a<this.previt+this.step;a++)this.iter.tp$iternext();return this.previt+=this.step,this.iter.tp$iternext()},slots:{tp$doc:\"islice(iterable, stop) --> islice object\\nislice(iterable, start, stop[, step]) --> islice object\\n\\nReturn an iterator whose next() method returns selected values from an\\niterable.  If start is specified, will skip all preceding elements;\\notherwise, start defaults to zero.  Step defaults to one.  If\\nspecified as another value, step determines how many values are \\nskipped between successive calls.  Works like a slice() on a list\\nbut returns an iterator.\",tp$new(b,c){var d=Number.MAX_SAFE_INTEGER;Sk.abstr.checkNoKwargs(\"islice\",c),Sk.abstr.checkArgsLen(\"islice\",b,2,4);const e=Sk.abstr.iter(b[0]);let f=b[1],g=b[2],h=b[3];if(void 0===g?(g=f,f=Sk.builtin.none.none$,h=Sk.builtin.none.none$):void 0===h&&(h=Sk.builtin.none.none$),!(Sk.builtin.checkNone(g)||Sk.misceval.isIndex(g)))throw new Sk.builtin.ValueError(\"Stop for islice() must be None or an integer: 0 <= x <= sys.maxsize.\");else if(g=Sk.builtin.checkNone(g)?d:Sk.misceval.asIndexSized(g),0>g||g>d)throw new Sk.builtin.ValueError(\"Stop for islice() must be None or an integer: 0 <= x <= sys.maxsize.\");if(!(Sk.builtin.checkNone(f)||Sk.misceval.isIndex(f)))throw new Sk.builtin.ValueError(\"Indices for islice() must be None or an integer: 0 <= x <= sys.maxsize.\");else if(f=Sk.builtin.checkNone(f)?0:Sk.misceval.asIndexSized(f),0>f||f>d)throw new Sk.builtin.ValueError(\"Indices for islice() must be None or an integer: 0 <= x <= sys.maxsize.\");if(!(Sk.builtin.checkNone(h)||Sk.misceval.isIndex(h)))throw new Sk.builtin.ValueError(\"Step for islice() must be a positive integer or None\");else if(h=Sk.builtin.checkNone(h)?1:Sk.misceval.asIndexSized(h),0>=h||h>d)throw new Sk.builtin.ValueError(\"Step for islice() must be a positive integer or None.\");if(this===a.islice.prototype)return new a.islice(e,f,g,h);else{const b=new this.constructor;return a.islice.call(b,e,f,g,h),b}}}}),a.permutations=Sk.abstr.buildIteratorClass(\"itertools.permutations\",{constructor:function permutations(a,b){this.pool=a,this.r=b;const c=a.length;this.indices=Array(c).fill().map((a,b)=>b),this.cycles=Array(b).fill().map((a,b)=>c-b),this.n=c,this.tp$iternext=()=>{if(!(this.r>this.n))return this.tp$iternext=this.constructor.prototype.tp$iternext,new Sk.builtin.tuple(this.pool.slice(0,this.r))}},iternext(){for(let a=this.r-1;0<=a;a--)if(this.cycles[a]--,0==this.cycles[a])this.indices.push(this.indices.splice(a,1)[0]),this.cycles[a]=this.n-a;else{j=this.cycles[a],[this.indices[a],this.indices[this.n-j]]=[this.indices[this.n-j],this.indices[a]];const b=this.indices.map(a=>this.pool[a]).slice(0,this.r);return new Sk.builtin.tuple(b)}this.r=0},slots:{tp$doc:\"permutations(iterable[, r]) --> permutations object\\n\\nReturn successive r-length permutations of elements in the iterable.\\n\\npermutations(range(3), 2) --> (0,1), (0,2), (1,0), (1,2), (2,0), (2,1)\",tp$new(b,c){let d,e;[d,e]=Sk.abstr.copyKeywordsToNamedArgs(\"permutations\",[\"iterable\",\"r\"],b,c,[Sk.builtin.none.none$]);const f=Sk.misceval.arrayFromIterable(d);if(e=Sk.builtin.checkNone(e)?f.length:Sk.misceval.asIndexSized(e,Sk.builtin.OverFlowError),0>e)throw new Sk.builtin.ValueError(\"r must be non-negative\");if(this===a.permutations.prototype)return new a.permutations(f,e);else{const b=new this.constructor;return a.permutations.call(b,f,e),b}}}}),a.product=Sk.abstr.buildIteratorClass(\"itertools.product\",{constructor:function product(a){this.pools=a,this.n=a.length,this.indices=Array(a.length).fill(0),this.pool_sizes=a.map(a=>a.length),this.tp$iternext=()=>{this.tp$iternext=this.constructor.prototype.tp$iternext;const a=this.indices.map((a,b)=>this.pools[b][this.indices[b]]);return a.some(a=>void 0===a)?void(this.n=0):new Sk.builtin.tuple(a)}},iternext(){for(let a=this.n-1;0<=a&&a<this.n;)this.indices[a]++,this.indices[a]>=this.pool_sizes[a]?(this.indices[a]=-1,a--):a++;if(!this.n||this.indices.every(a=>-1===a))return void(this.n=0);else{const a=this.indices.map((a,b)=>this.pools[b][this.indices[b]]);return new Sk.builtin.tuple(a)}},slots:{tp$doc:\"product(*iterables, repeat=1) --> product object\\n\\nCartesian product of input iterables.  Equivalent to nested for-loops.\\n\\nFor example, product(A, B) returns the same as:  ((x,y) for x in A for y in B).\\nThe leftmost iterators are in the outermost for-loop, so the output tuples\\ncycle in a manner similar to an odometer (with the rightmost element changing\\non every iteration).\\n\\nTo compute the product of an iterable with itself, specify the number\\nof repetitions with the optional repeat keyword argument. For example,\\nproduct(A, repeat=4) means the same as product(A, A, A, A).\\n\\nproduct('ab', range(3)) --> ('a',0) ('a',1) ('a',2) ('b',0) ('b',1) ('b',2)\\nproduct((0,1), (0,1), (0,1)) --> (0,0,0) (0,0,1) (0,1,0) (0,1,1) (1,0,0) ...\",tp$new(b,c){let[d]=Sk.abstr.copyKeywordsToNamedArgs(\"product\",[\"repeat\"],[],c,[new Sk.builtin.int_(1)]);if(d=Sk.misceval.asIndexSized(d,Sk.builtin.OverFlowError),0>d)throw new Sk.builtin.ValueError(\"repeat argument cannot be negative\");const e=[];for(let a=0;a<b.length;a++)e.push(Sk.misceval.arrayFromIterable(b[a]));const f=[].concat(...Array(d).fill(e));if(this===a.product.prototype)return new a.product(f);else{const b=new this.constructor;return a.product.call(b,f),b}}}}),a.repeat=Sk.abstr.buildIteratorClass(\"itertools.repeat\",{constructor:function repeat(a,b){this.object=a,this.times=b,void 0===b&&(this.tp$iternext=()=>this.object)},iternext(){return 0<this.times--?this.object:void 0},slots:{tp$doc:\"repeat(object [,times]) -> create an iterator which returns the object\\nfor the specified number of times.  If not specified, returns the object\\nendlessly.\",tp$new(b,c){let d,e;if([d,e]=Sk.abstr.copyKeywordsToNamedArgs(\"repeat\",[\"object\",\"times\"],b,c,[null]),e=null===e?void 0:Sk.misceval.asIndexSized(e,Sk.builtin.OverFlowError),this===a.repeat.prototype)return new a.repeat(d,e);else{const b=new this.constructor;return a.repeat.call(b,d,e),b}},$r(){return object_repr=Sk.misceval.objectRepr(this.object),times_repr=void 0===this.times?\"\":\", \"+(0<=this.times?this.times:0),new Sk.builtin.str(Sk.abstr.typeName(this)+\"(\"+object_repr+times_repr+\")\")}},methods:{__lenght_hint__:{$meth(){if(void 0===this.times)throw new Sk.builtin.TypeError(\"len() of unsized object\");return new Sk.builtin.int_(this.times)},$flags:{NoArgs:!0},$textsig:null}}}),a.starmap=Sk.abstr.buildIteratorClass(\"itertools.starmap\",{constructor:function starmap(a,b){this.func=a,this.iter=b},iternext(){const a=this.iter.tp$iternext();if(void 0===a)return;const b=Sk.misceval.arrayFromIterable(a),c=Sk.misceval.callsimArray(this.func,b);return c},slots:{tp$new(b,c){let d,e;if([d,e]=Sk.abstr.copyKeywordsToNamedArgs(\"starmap\",[\"func\",\"iterable\"],b,c,[]),e=Sk.abstr.iter(e),d=Sk.builtin.checkNone(d)?Sk.builtin.bool:d,this===a.starmap.prototype)return new a.starmap(d,e);else{const b=new this.constructor;return a.starmap.call(b,d,e),b}}}}),a.takewhile=Sk.abstr.buildIteratorClass(\"itertools.takewhile\",{constructor:function takewhile(a,b){this.predicate=a,this.iter=b},iternext(){const a=this.iter.tp$iternext();if(void 0!==a){const b=Sk.misceval.callsimArray(this.predicate,[a]);if(Sk.misceval.isTrue(b))return a;this.tp$iternext=()=>void 0}},slots:{tp$doc:\"takewhile(predicate, iterable) --> takewhile object\\n\\nReturn successive entries from an iterable as long as the \\npredicate evaluates to true for each entry.\",tp$new(b,c){Sk.abstr.checkNoKwargs(\"takewhile\",c),Sk.abstr.checkArgsLen(\"takewhile\",b,2,2);const d=b[0],e=Sk.abstr.iter(b[1]);if(this===a.takewhile.prototype)return new a.takewhile(d,e);else{const b=new this.constructor;return a.takewhile.call(b,d,e),b}}}}),a.tee=new Sk.builtin.func(function(){throw new Sk.builtin.NotImplementedError(\"tee is not yet implemented in Skulpt\")}),a.zip_longest=Sk.abstr.buildIteratorClass(\"itertools.zip_longest\",{constructor:function zip_longest(a,b){this.iters=a,this.fillvalue=b,this.active=this.iters.length},iternext(){if(!this.active)return;let b;const c=[];for(let d=0;d<this.iters.length;d++){if(b=this.iters[d].tp$iternext(),void 0===b){if(this.active--,!this.active)return;this.iters[d]=new a.repeat(this.fillvalue),b=this.fillvalue}c.push(b)}return new Sk.builtin.tuple(c)},slots:{tp$doc:\"zip_longest(iter1 [,iter2 [...]], [fillvalue=None]) --> zip_longest object\\n\\nReturn a zip_longest object whose .__next__() method returns a tuple where\\nthe i-th element comes from the i-th iterable argument.  The .__next__()\\nmethod continues until the longest iterable in the argument sequence\\nis exhausted and then it raises StopIteration.  When the shorter iterables\\nare exhausted, the fillvalue is substituted in their place.  The fillvalue\\ndefaults to None or can be specified by a keyword argument.\\n\",tp$new(b,c){const[d]=Sk.abstr.copyKeywordsToNamedArgs(\"zip_longest\",[\"fillvalue\"],[],c,[Sk.builtin.none.none$]),e=[];for(let a=0;a<b.length;a++)e.push(Sk.abstr.iter(b[a]));if(this===a.zip_longest.prototype)return new a.zip_longest(e,d);else{const b=new this.constructor;return a.zip_longest.call(b,e,d),b}}}}),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__.js":"var $builtinmodule=function(){\"use strict\";var a={},b=function(a){Sk.builtin.pyCheckArgs(\"dumps\",arguments,1,1/0,!0,!1);var b,c,d,e=Array.prototype.slice.call(arguments,1),f=new Sk.builtins.dict(a),g=!1;return b={ascii:!0,separators:{item_separator:\", \",key_separator:\": \"}},f=Sk.ffi.remapToJs(f),c=Sk.ffi.remapToJs(e[0]),\"boolean\"==typeof f.ensure_ascii&&!1===f.ensure_ascii&&(b.ascii=!1),\"boolean\"==typeof f.sort_keys&&f.sort_keys&&(g=!0),g||(b.cmp=function(){return 0}),\"object\"==typeof f.separators&&2==f.separators.length&&(b.separators.item_separator=f.separators[0],b.separators.key_separator=f.separators[1]),f.indent&&(b.space=f.indent),f.default,d=stringify(c,b),new Sk.builtin.str(d)};b.co_kwargs=!0,a.dumps=new Sk.builtin.func(b);var c=function(a){Sk.builtin.pyCheckArgs(\"loads\",arguments,1,1/0,!0,!1);var b,c,d=Array.prototype.slice.call(arguments,1),e=new Sk.builtins.dict(a);return e=Sk.ffi.remapToJs(e),b=d[0].v,c=JSON.parse(b),Sk.ffi.remapToPy(c)};return c.co_kwargs=!0,a.loads=new Sk.builtin.func(c),a};(function(){function r(b,d,e){function o(h,i){if(!d[h]){if(!b[h]){var f=\"function\"==typeof require&&require;if(!i&&f)return f(h,!0);if(g)return g(h,!0);var c=new Error(\"Cannot find module '\"+h+\"'\");throw c.code=\"MODULE_NOT_FOUND\",c}var a=d[h]={exports:{}};b[h][0].call(a.exports,function(a){var c=b[h][1][a];return o(c||a)},a,a.exports,r,b,d,e)}return d[h].exports}for(var g=\"function\"==typeof require&&require,a=0;a<e.length;a++)o(e[a]);return o}return r})()({1:[function(a,b){var c=\"undefined\"==typeof JSON?a(\"jsonify\"):JSON;b.exports=function(a,b){b||(b={}),\"function\"==typeof b&&(b={cmp:b});var f=b.cmp&&function(c){return function(d){return function(e,a){var b={key:e,value:d[e]},f={key:a,value:d[a]};return c(b,f)}}}(b.cmp);return function stringify(a){if(\"object\"!=typeof a||null===a)return c.stringify(a);if(d(a)){for(var b=[],g=0;g<a.length;g++)b.push(stringify(a[g]));return\"[\"+b.join(\",\")+\"]\"}for(var h,j=e(a).sort(f&&f(a)),b=[],g=0;g<j.length;g++)h=j[g],b.push(stringify(h)+\":\"+stringify(a[h]));return\"{\"+b.join(\",\")+\"}\"}(a)};var d=Array.isArray||function(a){return\"[object Array]\"==={}.toString.call(a)},e=Object.keys||function(a){var b=Object.prototype.hasOwnProperty||function(){return!0},c=[];for(var d in a)b.call(a,d)&&c.push(d);return c}},{jsonify:2}],2:[function(a,b,c){c.parse=a(\"./lib/parse\"),c.stringify=a(\"./lib/stringify\")},{\"./lib/parse\":3,\"./lib/stringify\":4}],3:[function(a,b){var d,e,f,g,h={'\"':\"\\\"\",\"\\\\\":\"\\\\\",\"/\":\"/\",b:\"\\b\",f:\"\\f\",n:\"\\n\",r:\"\\r\",t:\"\\t\"},j=function(a){throw{name:\"SyntaxError\",message:a,at:d,text:f}},k=function(a){return a&&a!==e&&j(\"Expected '\"+a+\"' instead of '\"+e+\"'\"),e=f.charAt(d),d+=1,e},l=function(){var a,b=\"\";for(\"-\"===e&&(b=\"-\",k(\"-\"));\"0\"<=e&&\"9\">=e;)b+=e,k();if(\".\"===e)for(b+=\".\";k()&&\"0\"<=e&&\"9\">=e;)b+=e;if(\"e\"===e||\"E\"===e)for(b+=e,k(),(\"-\"===e||\"+\"===e)&&(b+=e,k());\"0\"<=e&&\"9\">=e;)b+=e,k();return a=+b,isFinite(a)?a:void j(\"Bad number\")},m=function(){var b,c,d,a=String.fromCharCode,f=\"\";if(\"\\\"\"===e)for(;k();){if(\"\\\"\"===e)return k(),f;if(\"\\\\\"!==e)f+=e;else if(k(),\"u\"===e){for(d=0,c=0;4>c&&(b=parseInt(k(),16),!!isFinite(b));c+=1)d=16*d+b;f+=a(d)}else if(\"string\"==typeof h[e])f+=h[e];else break}j(\"Bad string\")},n=function(){for(;e&&\" \">=e;)k()},o=function(){switch(e){case\"t\":return k(\"t\"),k(\"r\"),k(\"u\"),k(\"e\"),!0;case\"f\":return k(\"f\"),k(\"a\"),k(\"l\"),k(\"s\"),k(\"e\"),!1;case\"n\":return k(\"n\"),k(\"u\"),k(\"l\"),k(\"l\"),null;}j(\"Unexpected '\"+e+\"'\")},p=function(){var a=[];if(\"[\"===e){if(k(\"[\"),n(),\"]\"===e)return k(\"]\"),a;for(;e;){if(a.push(g()),n(),\"]\"===e)return k(\"]\"),a;k(\",\"),n()}}j(\"Bad array\")},q=function(){var a,b={};if(\"{\"===e){if(k(\"{\"),n(),\"}\"===e)return k(\"}\"),b;for(;e;){if(a=m(),n(),k(\":\"),Object.hasOwnProperty.call(b,a)&&j(\"Duplicate key \\\"\"+a+\"\\\"\"),b[a]=g(),n(),\"}\"===e)return k(\"}\"),b;k(\",\"),n()}}j(\"Bad object\")};g=function(){return n(),\"{\"===e?q():\"[\"===e?p():\"\\\"\"===e?m():\"-\"===e?l():\"0\"<=e&&\"9\">=e?l():o()},b.exports=function(a,b){var c;return f=a,d=0,e=\" \",c=g(),n(),e&&j(\"Syntax error\"),\"function\"==typeof b?function walk(a,c){var d,e,f=a[c];if(f&&\"object\"==typeof f)for(d in f)Object.prototype.hasOwnProperty.call(f,d)&&(e=walk(f,d),void 0===e?delete f[d]:f[d]=e);return b.call(a,c,f)}({\"\":c},\"\"):c}},{}],4:[function(a,b){function quote(a){return f.lastIndex=0,f.test(a)?\"\\\"\"+a.replace(f,function(b){var a=g[b];return\"string\"==typeof a?a:\"\\\\u\"+(\"0000\"+b.charCodeAt(0).toString(16)).slice(-4)})+\"\\\"\":\"\\\"\"+a+\"\\\"\"}function str(a,b){var f,g,h,j,l,m=c,n=b[a];switch(n&&\"object\"==typeof n&&\"function\"==typeof n.toJSON&&(n=n.toJSON(a)),\"function\"==typeof e&&(n=e.call(b,a,n)),typeof n){case\"string\":return quote(n);case\"number\":return isFinite(n)?n+\"\":\"null\";case\"boolean\":case\"null\":return n+\"\";case\"object\":if(!n)return\"null\";if(c+=d,l=[],\"[object Array]\"===Object.prototype.toString.apply(n)){for(j=n.length,f=0;f<j;f+=1)l[f]=str(f,n)||\"null\";return h=0===l.length?\"[]\":c?\"[\\n\"+c+l.join(\",\\n\"+c)+\"\\n\"+m+\"]\":\"[\"+l.join(\",\")+\"]\",c=m,h}if(e&&\"object\"==typeof e)for(j=e.length,f=0;f<j;f+=1)g=e[f],\"string\"==typeof g&&(h=str(g,n),h&&l.push(quote(g)+(c?\": \":\":\")+h));else for(g in n)Object.prototype.hasOwnProperty.call(n,g)&&(h=str(g,n),h&&l.push(quote(g)+(c?\": \":\":\")+h));return h=0===l.length?\"{}\":c?\"{\\n\"+c+l.join(\",\\n\"+c)+\"\\n\"+m+\"}\":\"{\"+l.join(\",\")+\"}\",c=m,h;}}var c,d,e,f=/[\\\\\\\"\\x00-\\x1f\\x7f-\\x9f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,g={\"\b\":\"\\\\b\",\"\t\":\"\\\\t\",\"\\n\":\"\\\\n\",\"\f\":\"\\\\f\",\"\\r\":\"\\\\r\",'\"':\"\\\\\\\"\",\"\\\\\":\"\\\\\\\\\"};b.exports=function(a,b,f){var g;if(c=\"\",d=\"\",\"number\"==typeof f)for(g=0;g<f;g+=1)d+=\" \";else\"string\"==typeof f&&(d=f);if(e=b,b&&\"function\"!=typeof b&&(\"object\"!=typeof b||\"number\"!=typeof b.length))throw new Error(\"JSON.stringify\");return str(\"\",{\"\":a})}},{}],5:[function(a,b){function defaultSetTimout(){throw new Error(\"setTimeout has not been defined\")}function defaultClearTimeout(){throw new Error(\"clearTimeout has not been defined\")}function runTimeout(a){if(c===setTimeout)return setTimeout(a,0);if((c===defaultSetTimout||!c)&&setTimeout)return c=setTimeout,setTimeout(a,0);try{return c(a,0)}catch(b){try{return c.call(null,a,0)}catch(b){return c.call(this,a,0)}}}function runClearTimeout(a){if(d===clearTimeout)return clearTimeout(a);if((d===defaultClearTimeout||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(a);try{return d(a)}catch(b){try{return d.call(null,a)}catch(b){return d.call(this,a)}}}function cleanUpNextTick(){h&&f&&(h=!1,f.length?g=f.concat(g):i=-1,g.length&&drainQueue())}function drainQueue(){if(!h){var a=runTimeout(cleanUpNextTick);h=!0;for(var b=g.length;b;){for(f=g,g=[];++i<b;)f&&f[i].run();i=-1,b=g.length}f=null,h=!1,runClearTimeout(a)}}function Item(a,b){this.fun=a,this.array=b}function noop(){}var c,d,e=b.exports={};(function(){try{c=\"function\"==typeof setTimeout?setTimeout:defaultSetTimout}catch(a){c=defaultSetTimout}try{d=\"function\"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(a){d=defaultClearTimeout}})();var f,g=[],h=!1,i=-1;e.nextTick=function(a){var b=Array(arguments.length-1);if(1<arguments.length)for(var c=1;c<arguments.length;c++)b[c-1]=arguments[c];g.push(new Item(a,b)),1!==g.length||h||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},e.title=\"browser\",e.browser=!0,e.env={},e.argv=[],e.version=\"\",e.versions={},e.on=noop,e.addListener=noop,e.once=noop,e.off=noop,e.removeListener=noop,e.removeAllListeners=noop,e.emit=noop,e.prependListener=noop,e.prependOnceListener=noop,e.listeners=function(){return[]},e.binding=function(){throw new Error(\"process.binding is not supported\")},e.cwd=function(){return\"/\"},e.chdir=function(){throw new Error(\"process.chdir is not supported\")},e.umask=function(){return 0}},{}],6:[function(a,b){(function(c){var d=a(\"json-stable-stringify\");c.browser?window.stringify=d:b.exports=d}).call(this,a(\"_process\"))},{_process:5,\"json-stable-stringify\":1}]},{},[6]);","src/lib/json/stringify.js":"(function(){function r(b,d,e){function o(h,i){if(!d[h]){if(!b[h]){var f=\"function\"==typeof require&&require;if(!i&&f)return f(h,!0);if(g)return g(h,!0);var c=new Error(\"Cannot find module '\"+h+\"'\");throw c.code=\"MODULE_NOT_FOUND\",c}var a=d[h]={exports:{}};b[h][0].call(a.exports,function(a){var c=b[h][1][a];return o(c||a)},a,a.exports,r,b,d,e)}return d[h].exports}for(var g=\"function\"==typeof require&&require,a=0;a<e.length;a++)o(e[a]);return o}return r})()({1:[function(a,b){var c=\"undefined\"==typeof JSON?a(\"jsonify\"):JSON;b.exports=function(a,b){b||(b={}),\"function\"==typeof b&&(b={cmp:b});var f=b.cmp&&function(c){return function(d){return function(e,a){var b={key:e,value:d[e]},f={key:a,value:d[a]};return c(b,f)}}}(b.cmp);return function stringify(a){if(\"object\"!=typeof a||null===a)return c.stringify(a);if(d(a)){for(var b=[],g=0;g<a.length;g++)b.push(stringify(a[g]));return\"[\"+b.join(\",\")+\"]\"}for(var h,j=e(a).sort(f&&f(a)),b=[],g=0;g<j.length;g++)h=j[g],b.push(stringify(h)+\":\"+stringify(a[h]));return\"{\"+b.join(\",\")+\"}\"}(a)};var d=Array.isArray||function(a){return\"[object Array]\"==={}.toString.call(a)},e=Object.keys||function(a){var b=Object.prototype.hasOwnProperty||function(){return!0},c=[];for(var d in a)b.call(a,d)&&c.push(d);return c}},{jsonify:2}],2:[function(a,b,c){c.parse=a(\"./lib/parse\"),c.stringify=a(\"./lib/stringify\")},{\"./lib/parse\":3,\"./lib/stringify\":4}],3:[function(a,b){var d,e,f,g,h={'\"':\"\\\"\",\"\\\\\":\"\\\\\",\"/\":\"/\",b:\"\\b\",f:\"\\f\",n:\"\\n\",r:\"\\r\",t:\"\\t\"},j=function(a){throw{name:\"SyntaxError\",message:a,at:d,text:f}},k=function(a){return a&&a!==e&&j(\"Expected '\"+a+\"' instead of '\"+e+\"'\"),e=f.charAt(d),d+=1,e},l=function(){var a,b=\"\";for(\"-\"===e&&(b=\"-\",k(\"-\"));\"0\"<=e&&\"9\">=e;)b+=e,k();if(\".\"===e)for(b+=\".\";k()&&\"0\"<=e&&\"9\">=e;)b+=e;if(\"e\"===e||\"E\"===e)for(b+=e,k(),(\"-\"===e||\"+\"===e)&&(b+=e,k());\"0\"<=e&&\"9\">=e;)b+=e,k();return a=+b,isFinite(a)?a:void j(\"Bad number\")},m=function(){var b,c,d,a=String.fromCharCode,f=\"\";if(\"\\\"\"===e)for(;k();){if(\"\\\"\"===e)return k(),f;if(\"\\\\\"!==e)f+=e;else if(k(),\"u\"===e){for(d=0,c=0;4>c&&(b=parseInt(k(),16),!!isFinite(b));c+=1)d=16*d+b;f+=a(d)}else if(\"string\"==typeof h[e])f+=h[e];else break}j(\"Bad string\")},n=function(){for(;e&&\" \">=e;)k()},o=function(){switch(e){case\"t\":return k(\"t\"),k(\"r\"),k(\"u\"),k(\"e\"),!0;case\"f\":return k(\"f\"),k(\"a\"),k(\"l\"),k(\"s\"),k(\"e\"),!1;case\"n\":return k(\"n\"),k(\"u\"),k(\"l\"),k(\"l\"),null;}j(\"Unexpected '\"+e+\"'\")},p=function(){var a=[];if(\"[\"===e){if(k(\"[\"),n(),\"]\"===e)return k(\"]\"),a;for(;e;){if(a.push(g()),n(),\"]\"===e)return k(\"]\"),a;k(\",\"),n()}}j(\"Bad array\")},q=function(){var a,b={};if(\"{\"===e){if(k(\"{\"),n(),\"}\"===e)return k(\"}\"),b;for(;e;){if(a=m(),n(),k(\":\"),Object.hasOwnProperty.call(b,a)&&j(\"Duplicate key \\\"\"+a+\"\\\"\"),b[a]=g(),n(),\"}\"===e)return k(\"}\"),b;k(\",\"),n()}}j(\"Bad object\")};g=function(){return n(),\"{\"===e?q():\"[\"===e?p():\"\\\"\"===e?m():\"-\"===e?l():\"0\"<=e&&\"9\">=e?l():o()},b.exports=function(a,b){var c;return f=a,d=0,e=\" \",c=g(),n(),e&&j(\"Syntax error\"),\"function\"==typeof b?function walk(a,c){var d,e,f=a[c];if(f&&\"object\"==typeof f)for(d in f)Object.prototype.hasOwnProperty.call(f,d)&&(e=walk(f,d),void 0===e?delete f[d]:f[d]=e);return b.call(a,c,f)}({\"\":c},\"\"):c}},{}],4:[function(a,b){function quote(a){return f.lastIndex=0,f.test(a)?\"\\\"\"+a.replace(f,function(b){var a=g[b];return\"string\"==typeof a?a:\"\\\\u\"+(\"0000\"+b.charCodeAt(0).toString(16)).slice(-4)})+\"\\\"\":\"\\\"\"+a+\"\\\"\"}function str(a,b){var f,g,h,j,l,m=c,n=b[a];switch(n&&\"object\"==typeof n&&\"function\"==typeof n.toJSON&&(n=n.toJSON(a)),\"function\"==typeof e&&(n=e.call(b,a,n)),typeof n){case\"string\":return quote(n);case\"number\":return isFinite(n)?n+\"\":\"null\";case\"boolean\":case\"null\":return n+\"\";case\"object\":if(!n)return\"null\";if(c+=d,l=[],\"[object Array]\"===Object.prototype.toString.apply(n)){for(j=n.length,f=0;f<j;f+=1)l[f]=str(f,n)||\"null\";return h=0===l.length?\"[]\":c?\"[\\n\"+c+l.join(\",\\n\"+c)+\"\\n\"+m+\"]\":\"[\"+l.join(\",\")+\"]\",c=m,h}if(e&&\"object\"==typeof e)for(j=e.length,f=0;f<j;f+=1)g=e[f],\"string\"==typeof g&&(h=str(g,n),h&&l.push(quote(g)+(c?\": \":\":\")+h));else for(g in n)Object.prototype.hasOwnProperty.call(n,g)&&(h=str(g,n),h&&l.push(quote(g)+(c?\": \":\":\")+h));return h=0===l.length?\"{}\":c?\"{\\n\"+c+l.join(\",\\n\"+c)+\"\\n\"+m+\"}\":\"{\"+l.join(\",\")+\"}\",c=m,h;}}var c,d,e,f=/[\\\\\\\"\\x00-\\x1f\\x7f-\\x9f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,g={\"\b\":\"\\\\b\",\"\t\":\"\\\\t\",\"\\n\":\"\\\\n\",\"\f\":\"\\\\f\",\"\\r\":\"\\\\r\",'\"':\"\\\\\\\"\",\"\\\\\":\"\\\\\\\\\"};b.exports=function(a,b,f){var g;if(c=\"\",d=\"\",\"number\"==typeof f)for(g=0;g<f;g+=1)d+=\" \";else\"string\"==typeof f&&(d=f);if(e=b,b&&\"function\"!=typeof b&&(\"object\"!=typeof b||\"number\"!=typeof b.length))throw new Error(\"JSON.stringify\");return str(\"\",{\"\":a})}},{}],5:[function(a,b){function defaultSetTimout(){throw new Error(\"setTimeout has not been defined\")}function defaultClearTimeout(){throw new Error(\"clearTimeout has not been defined\")}function runTimeout(a){if(c===setTimeout)return setTimeout(a,0);if((c===defaultSetTimout||!c)&&setTimeout)return c=setTimeout,setTimeout(a,0);try{return c(a,0)}catch(b){try{return c.call(null,a,0)}catch(b){return c.call(this,a,0)}}}function runClearTimeout(a){if(d===clearTimeout)return clearTimeout(a);if((d===defaultClearTimeout||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(a);try{return d(a)}catch(b){try{return d.call(null,a)}catch(b){return d.call(this,a)}}}function cleanUpNextTick(){h&&f&&(h=!1,f.length?g=f.concat(g):i=-1,g.length&&drainQueue())}function drainQueue(){if(!h){var a=runTimeout(cleanUpNextTick);h=!0;for(var b=g.length;b;){for(f=g,g=[];++i<b;)f&&f[i].run();i=-1,b=g.length}f=null,h=!1,runClearTimeout(a)}}function Item(a,b){this.fun=a,this.array=b}function noop(){}var c,d,e=b.exports={};(function(){try{c=\"function\"==typeof setTimeout?setTimeout:defaultSetTimout}catch(a){c=defaultSetTimout}try{d=\"function\"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(a){d=defaultClearTimeout}})();var f,g=[],h=!1,i=-1;e.nextTick=function(a){var b=Array(arguments.length-1);if(1<arguments.length)for(var c=1;c<arguments.length;c++)b[c-1]=arguments[c];g.push(new Item(a,b)),1!==g.length||h||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},e.title=\"browser\",e.browser=!0,e.env={},e.argv=[],e.version=\"\",e.versions={},e.on=noop,e.addListener=noop,e.once=noop,e.off=noop,e.removeListener=noop,e.removeAllListeners=noop,e.emit=noop,e.prependListener=noop,e.prependOnceListener=noop,e.listeners=function(){return[]},e.binding=function(){throw new Error(\"process.binding is not supported\")},e.cwd=function(){return\"/\"},e.chdir=function(){throw new Error(\"process.chdir is not supported\")},e.umask=function(){return 0}},{}],6:[function(a,b){(function(c){var d=a(\"json-stable-stringify\");c.browser?window.stringify=d:b.exports=d}).call(this,a(\"_process\"))},{_process:5,\"json-stable-stringify\":1}]},{},[6]);","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":"const $builtinmodule=function(){var a=Math.PI,b=Math.sqrt,c=Number.MAX_SAFE_INTEGER,d=Math.E,e=Math.log,f=Math.exp,g=Math.pow,h=Math.log2,i=Number.isFinite,j=Math.floor,k=Math.abs;const l={pi:new Sk.builtin.float_(a),e:new Sk.builtin.float_(d),tau:new Sk.builtin.float_(2*a),nan:new Sk.builtin.float_(NaN),inf:new Sk.builtin.float_(1/0)},n=function(a){return a=a?0>a?-1:1:0>1/a?-1:1,a},o=18;return Sk.abstr.setUpModuleMethods(\"math\",l,{acos:{$meth:function acos(a){var b=Math.acos;return Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(a)),new Sk.builtin.float_(b(Sk.builtin.asnum$(a)))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the arc cosine (measured in radians) of x.\"},acosh:{$meth:function acosh(a){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),a=Sk.builtin.asnum$(a);const c=a+b(a*a-1);return new Sk.builtin.float_(e(c))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the inverse hyperbolic cosine of x.\"},asin:{$meth:function asin(a){var b=Math.asin;return Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(a)),new Sk.builtin.float_(b(Sk.builtin.asnum$(a)))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the arc sine (measured in radians) of x.\"},asinh:{$meth:function asinh(a){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),a=Sk.builtin.asnum$(a);const c=a+b(a*a+1);return new Sk.builtin.float_(e(c))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the inverse hyperbolic sine of x.\"},atan:{$meth:function atan(a){var b=Math.atan;return Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(a)),new Sk.builtin.float_(b(Sk.builtin.asnum$(a)))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the arc tangent (measured in radians) of x.\"},atan2:{$meth:function atan2(a,b){var c=Math.atan2;return 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)))},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, y, x, /)\",$doc:\"Return the arc tangent (measured in radians) of y/x.\\n\\nUnlike atan(y/x), the signs of both x and y are considered.\"},atanh:{$meth:function atanh(a){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_(e(b)/2)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the inverse hyperbolic tangent of x.\"},ceil:{$meth:function ceil(a){var b=Math.ceil;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))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the ceiling of x as an Integral.\\n\\nThis is the smallest integer >= x.\"},copysign:{$meth:function copysign(a,b){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=n(d),f=n(c);return new Sk.builtin.float_(d*(e*f))},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, x, y, /)\",$doc:\"Return a float with the magnitude (absolute value) of x but the sign of y.\\n\\nOn platforms that support signed zeros, copysign(1.0, -0.0)\\nreturns -1.0.\\n\"},cos:{$meth:function cos(a){var b=Math.cos;return Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(a)),new Sk.builtin.float_(b(Sk.builtin.asnum$(a)))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the cosine of x (measured in radians).\"},cosh:{$meth:function cosh(a){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),a=Sk.builtin.asnum$(a);const b=g(d,a);return new Sk.builtin.float_((b+1/b)/2)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the hyperbolic cosine of x.\"},degrees:{$meth:function degrees(b){Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(b));const c=180/a*Sk.builtin.asnum$(b);return new Sk.builtin.float_(c)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Convert angle x from radians to degrees.\"},erf:{$meth:function erf(){throw new Sk.builtin.NotImplementedError(\"math.erf() is not yet implemented in Skulpt\")},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Error function at x.\"},erfc:{$meth:function erfc(){throw new Sk.builtin.NotImplementedError(\"math.erfc() is not yet implemented in Skulpt\")},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Complementary error function at x.\"},exp:{$meth:function exp(a){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));let b=a.v;if(\"number\"!=typeof b&&(b=a.nb$float().v),b==1/0||b==-Infinity||isNaN(b))return new Sk.builtin.float_(f(b));const c=f(b);if(!isFinite(c))throw new Sk.builtin.OverflowError(\"math range error\");return new Sk.builtin.float_(c)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return e raised to the power of x.\"},expm1:{$meth:function expm1(a){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));const b=Sk.builtin.asnum$(a);if(.7>k(b)){const a=f(b);if(1==a)return new Sk.builtin.float_(b);else{const c=(a-1)*b/e(a);return new Sk.builtin.float_(c)}}else{const a=f(b)-1;return new Sk.builtin.float_(a)}},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return exp(x)-1.\\n\\nThis function avoids the loss of precision involved in the direct evaluation of exp(x)-1 for small x.\"},fabs:{$meth:function fabs(a){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));let b=a.v;return JSBI.__isBigInt(b)&&(b=a.nb$float().v),b=k(b),new Sk.builtin.float_(b)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the absolute value of the float x.\"},factorial:{$meth:function factorial(a){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));let b=Sk.builtin.asnum$(a);if(a=j(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<=o;b++)c*=b;if(a<=o)return new Sk.builtin.int_(c);c=JSBI.BigInt(c);for(let b=19;b<=a;b++)c=JSBI.multiply(c,JSBI.BigInt(b));return new Sk.builtin.int_(c)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Find x!.\\n\\nRaise a ValueError if x is negative or non-integral.\"},floor:{$meth:function floor(a){return Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),Sk.__future__.ceil_floor_int?new Sk.builtin.int_(j(Sk.builtin.asnum$(a))):new Sk.builtin.float_(j(Sk.builtin.asnum$(a)))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the floor of x as an Integral.\\n\\nThis is the largest integer <= x.\"},fmod:{$meth:function fmod(a,b){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType(\"y\",\"number\",Sk.builtin.checkNumber(b));let c=a.v,d=b.v;if(\"number\"!=typeof c&&(c=a.nb$float().v),\"number\"!=typeof d&&(d=b.nb$float().v),(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)},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, x, y, /)\",$doc:\"Return fmod(x, y), according to platform C.\\n\\nx % y may differ.\"},frexp:{$meth:function frexp(a){var b=Math.max;Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));const c=Sk.builtin.asnum$(a),d=[c,0];if(0!==c&&i(c)){const a=k(c);let e=b(-1023,j(h(a))+1),f=a*g(2,-e);for(;.5>f;)f*=2,e--;for(;1<=f;)f*=.5,e++;0>c&&(f=-f),d[0]=f,d[1]=e}return d[0]=new Sk.builtin.float_(d[0]),d[1]=new Sk.builtin.int_(d[1]),new Sk.builtin.tuple(d)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the mantissa and exponent of x, as pair (m, e).\\n\\nm is a float and e is an int, such that x = m * 2.**e.\\nIf x is 0, m and e are both 0.  Else 0.5 <= abs(m) < 1.0.\"},fsum:{$meth:function fsum(a){if(!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;let a=f.v;\"number\"!=typeof a&&(a=f.nb$float().v),f=a;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)},$flags:{OneArg:!0},$textsig:\"($module, seq, /)\",$doc:\"Return an accurate floating point sum of values in the iterable seq.\\n\\nAssumes IEEE-754 floating point arithmetic.\"},gamma:{$meth:function gamma(){throw new Sk.builtin.NotImplementedError(\"math.gamma() is not yet implemented in Skulpt\")},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Gamma function at x.\"},gcd:{$meth:function gcd(c,a){function _gcd(c,a){return 0==a?c:_gcd(a,c%a)}function _biggcd(c,a){return JSBI.equal(a,JSBI.__ZERO)?c:_biggcd(a,JSBI.remainder(c,a))}Sk.builtin.pyCheckType(\"a\",\"integer\",Sk.builtin.checkInt(c)),Sk.builtin.pyCheckType(\"b\",\"integer\",Sk.builtin.checkInt(a));let b,d=Sk.builtin.asnum$(c),e=Sk.builtin.asnum$(a);return\"number\"==typeof d&&\"number\"==typeof e?(d=k(d),e=k(e),b=_gcd(d,e),b=0>b?-b:b,new Sk.builtin.int_(b)):(d=JSBI.BigInt(d),e=JSBI.BigInt(e),b=_biggcd(d,e),JSBI.lessThan(b,JSBI.__ZERO)&&(b=JSBI.multiply(b,JSBI.BigInt(-1))),new Sk.builtin.int_(b.toString()))},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, x, y, /)\",$doc:\"greatest common divisor of x and y\"},hypot:{$meth:function hypot(a,c){return Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType(\"y\",\"number\",Sk.builtin.checkNumber(c)),a=Sk.builtin.asnum$(a),c=Sk.builtin.asnum$(c),new Sk.builtin.float_(b(a*a+c*c))},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, x, y, /)\",$doc:\"Return the Euclidean distance, sqrt(x*x + y*y).\"},isclose:{$meth:function isclose(c,d){Sk.abstr.checkArgsLen(\"isclose\",c,2,2),rel_abs_vals=Sk.abstr.copyKeywordsToNamedArgs(\"isclose\",[\"rel_tol\",\"abs_tol\"],[],d,[new Sk.builtin.float_(1e-9),new Sk.builtin.float_(0)]);const e=c[0],a=c[1],b=rel_abs_vals[0],f=rel_abs_vals[1];Sk.builtin.pyCheckType(\"a\",\"number\",Sk.builtin.checkNumber(e)),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(f));const g=Sk.builtin.asnum$(e),h=Sk.builtin.asnum$(a),i=Sk.builtin.asnum$(b),j=Sk.builtin.asnum$(f);if(0>i||0>j)throw new Sk.builtin.ValueError(\"tolerances must be non-negative\");if(g==h)return Sk.builtin.bool.true$;if(g==1/0||g==-Infinity||h==1/0||h==-Infinity)return Sk.builtin.bool.false$;const l=k(h-g),m=l<=k(i*h)||l<=k(i*g)||l<=j;return new Sk.builtin.bool(m)},$flags:{FastCall:!0},$textsig:\"($module, /, a, b, *, rel_tol=1e-09, abs_tol=0.0)\",$doc:\"Determine whether two floating point numbers are close in value.\\n\\n  rel_tol\\n    maximum difference for being considered \\\"close\\\", relative to the\\n    magnitude of the input values\\n  abs_tol\\n    maximum difference for being considered \\\"close\\\", regardless of the\\n    magnitude of the input values\\n\\nReturn True if a is close in value to b, and False otherwise.\\n\\nFor the values to be considered close, the difference between them\\nmust be smaller than at least one of the tolerances.\\n\\n-inf, inf and NaN behave similarly to the IEEE 754 Standard.  That\\nis, NaN is not close to anything, even itself.  inf and -inf are\\nonly close to themselves.\"},isfinite:{$meth:function isfinite(a){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$},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return True if x is neither an infinity nor a NaN, and False otherwise.\"},isinf:{$meth:function isinf(a){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$},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return True if x is a positive or negative infinity, and False otherwise.\"},isnan:{$meth:function isnan(a){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));const b=Sk.builtin.asnum$(a);return isNaN(b)?Sk.builtin.bool.true$:Sk.builtin.bool.false$},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return True if x is a NaN (not a number), and False otherwise.\"},ldexp:{$meth:function ldexp(a,b){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType(\"i\",\"integer\",Sk.builtin.checkInt(b));let c=a.v;\"number\"!=typeof c&&(c=a.nb$float().v);const d=Sk.builtin.asnum$(b);if(c==1/0||c==-Infinity||0==c||isNaN(c))return a;const e=c*g(2,d);if(!isFinite(e))throw new Sk.builtin.OverflowError(\"math range error\");return new Sk.builtin.float_(e)},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, x, i, /)\",$doc:\"Return x * (2**i).\\n\\nThis is essentially the inverse of frexp().\"},lgamma:{$meth:function lgamma(){throw new Sk.builtin.NotImplementedError(\"math.lgamma() is not yet implemented in Skulpt\")},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Natural logarithm of absolute value of Gamma function at x.\"},log:{$meth:function log(a,b){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));let f,g,h=Sk.builtin.asnum$(a);if(0>=h)throw new Sk.builtin.ValueError(\"math domain error\");if(void 0===b?f=d:(Sk.builtin.pyCheckType(\"base\",\"number\",Sk.builtin.checkNumber(b)),f=Sk.builtin.asnum$(b)),0>=f)throw new Sk.builtin.ValueError(\"math domain error\");else if(Sk.builtin.checkFloat(a)||h<c)g=e(h)/e(f);else{h=new Sk.builtin.str(a).$jsstr();const b=h.length,c=parseFloat(\"0.\"+h);g=(b*e(10)+e(c))/e(f)}return new Sk.builtin.float_(g)},$flags:{MinArgs:1,MaxArgs:2},$textsig:null,$doc:\"log(x, [base=e])\\nReturn the logarithm of x to the given base.\\n\\nIf the base not specified, returns the natural logarithm (base e) of x.\"},log10:{$meth:function log10(a){var b=Math.log10;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<c)d=b(e);else{e=new Sk.builtin.str(a).$jsstr();const c=e.length,f=parseFloat(\"0.\"+e);d=c+b(f)}return new Sk.builtin.float_(d)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the base 10 logarithm of x.\"},log1p:{$meth:function log1p(a){var b=Number.EPSILON;Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));let c=a.v;if(\"number\"!=typeof c&&(c=a.nb$float().v),-1>=c)throw new Sk.builtin.ValueError(\"math domain error\");else{if(0==c)return new Sk.builtin.float_(c);if(k(c)<b/2)return new Sk.builtin.float_(c);if(-.5<=c&&1>=c){const a=1+c,b=e(a)-(a-1-c)/a;return new Sk.builtin.float_(b)}else{const a=e(1+c);return new Sk.builtin.float_(a)}}},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the natural logarithm of 1+x (base e).\\n\\nThe result is computed in a way which is accurate for x near zero.\"},log2:{$meth:function log2(a){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));let b,d=Sk.builtin.asnum$(a);if(0>d)throw new Sk.builtin.ValueError(\"math domain error\");else if(Sk.builtin.checkFloat(a)||d<c)b=h(d);else{d=new Sk.builtin.str(a).$jsstr();const c=d.length,e=parseFloat(\"0.\"+d);b=c*h(10)+h(e)}return new Sk.builtin.float_(b)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the base 2 logarithm of x.\"},modf:{$meth:function modf(a){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=n(b);b=k(b);const e=c*j(b),f=c*(b-j(b));return new Sk.builtin.tuple([new Sk.builtin.float_(f),new Sk.builtin.float_(e)])},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the fractional and integer parts of x.\\n\\nBoth results carry the sign of x and are floats.\"},pow:{$meth:function pow(a,b){var c=Number.isInteger;Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType(\"y\",\"number\",Sk.builtin.checkNumber(b));let d=a.v,e=b.v;if(\"number\"!=typeof d&&(d=a.nb$float().v),\"number\"!=typeof e&&(e=b.nb$float().v),0==d&&0>e)throw new Sk.builtin.ValueError(\"math domain error\");else{if(1==d)return new Sk.builtin.float_(1);if(i(d)&&i(e)&&0>d&&!c(e))throw new Sk.builtin.ValueError(\"math domain error\");else if(-1==d&&(e==-Infinity||e==1/0))return new Sk.builtin.float_(1)}const f=g(d,e);if(!i(d)||!i(e))return new Sk.builtin.float_(f);if(f==1/0||f==-Infinity)throw new Sk.builtin.OverflowError(\"math range error\");return new Sk.builtin.float_(f)},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, x, y, /)\",$doc:\"Return x**y (x to the power of y).\"},radians:{$meth:function radians(b){Sk.builtin.pyCheckType(\"deg\",\"number\",Sk.builtin.checkNumber(b));const c=a/180*Sk.builtin.asnum$(b);return new Sk.builtin.float_(c)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Convert angle x from degrees to radians.\"},remainder:{$meth:function remainder(a,b){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType(\"y\",\"number\",Sk.builtin.checkNumber(b));let d=a.v,e=b.v;if(\"number\"!=typeof d&&(d=a.nb$float().v),\"number\"!=typeof e&&(e=b.nb$float().v),isFinite(d)&&isFinite(e)){let a,b,f,c,g;if(0==e)throw new Sk.builtin.ValueError(\"math domain error\");if(a=k(d),b=k(e),c=a%b,f=b-c,c<f)g=c;else if(c>f)g=-f;else{if(c!=f)throw new Sk.builtin.AssertionError;g=c-2*(.5*(a-c)%b)}return new Sk.builtin.float_(n(d)*g)}if(isNaN(d))return a;if(isNaN(e))return b;if(d==1/0||d==-Infinity)throw new Sk.builtin.ValueError(\"math domain error\");if(e!=1/0&&e!=-Infinity)throw new Sk.builtin.AssertionError;return new Sk.builtin.float_(d)},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, x, y, /)\",$doc:\"Difference between x and the closest integer multiple of y.\\n\\nReturn x - n*y where n*y is the closest integer multiple of y.\\nIn the case where x is exactly halfway between two multiples of\\ny, the nearest even value of n is used. The result is always exact.\"},sin:{$meth:function sin(a){var b=Math.sin;return Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(a)),new Sk.builtin.float_(b(Sk.builtin.asnum$(a)))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the sine of x (measured in radians).\"},sinh:{$meth:function sinh(a){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),a=Sk.builtin.asnum$(a);const b=g(d,a);return new Sk.builtin.float_((b-1/b)/2)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the hyperbolic sine of x.\"},sqrt:{$meth:function sqrt(a){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a));const c=Sk.builtin.asnum$(a);if(0>c)throw new Sk.builtin.ValueError(\"math domain error\");return new Sk.builtin.float_(b(c))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the square root of x.\"},tan:{$meth:function tan(a){var b=Math.tan;return Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(a)),new Sk.builtin.float_(b(Sk.builtin.asnum$(a)))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the tangent of x (measured in radians).\"},tanh:{$meth:function tanh(a){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=g(d,b),e=1/c;return new Sk.builtin.float_((c-e)/2/((c+e)/2))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the hyperbolic tangent of x.\"},trunc:{$meth:function trunc(a){return Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(a)),Sk.builtin.checkInt(a)?a:new Sk.builtin.int_(0|Sk.builtin.asnum$(a))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Truncates the Real x to the nearest Integral toward 0.\\n\\nUses the __trunc__ magic method.\"}}),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":"function $builtinmodule(){return operator={__name__:new Sk.builtin.str(\"operator\"),__doc__:new Sk.builtin.str(\"Operator interface.\\n\\nThis module exports a set of functions implemented in javascript corresponding\\nto the intrinsic operators of Python.  For example, operator.add(x, y)\\nis equivalent to the expression x+y.  The function names are those\\nused for special methods; variants without leading and trailing\\n'__' are also provided for convenience.\"),__all__:new Sk.builtin.list([\"abs\",\"add\",\"and_\",\"attrgetter\",\"concat\",\"contains\",\"countOf\",\"delitem\",\"eq\",\"floordiv\",\"ge\",\"getitem\",\"gt\",\"iadd\",\"iand\",\"iconcat\",\"ifloordiv\",\"ilshift\",\"imatmul\",\"imod\",\"imul\",\"index\",\"indexOf\",\"inv\",\"invert\",\"ior\",\"ipow\",\"irshift\",\"is_\",\"is_not\",\"isub\",\"itemgetter\",\"itruediv\",\"ixor\",\"le\",\"length_hint\",\"lshift\",\"lt\",\"matmul\",\"methodcaller\",\"mod\",\"mul\",\"ne\",\"neg\",\"not_\",\"or_\",\"pos\",\"pow\",\"rshift\",\"setitem\",\"sub\",\"truediv\",\"truth\",\"xor\"].map(a=>new Sk.builtin.str(a)))},operator.itemgetter=Sk.abstr.buildNativeClass(\"operator.itemgetter\",{constructor:function itemgetter(a){this.items=a,this.oneitem=1===a.length,this.item=a[0],this.in$repr=!1},slots:{tp$getattr:Sk.generic.getAttr,tp$new(a,b){return Sk.abstr.checkNoKwargs(\"itemgetter\",b),Sk.abstr.checkArgsLen(\"itemgetter\",a,1),new operator.itemgetter(a)},tp$call(a,b){Sk.abstr.checkNoKwargs(\"itemgetter\",b),Sk.abstr.checkArgsLen(\"itemgetter\",a,1,1);const c=a[0];return this.oneitem?Sk.abstr.objectGetItem(c,this.item,!0):new Sk.builtin.tuple(this.items.map(a=>Sk.abstr.objectGetItem(c,a)))},tp$doc:\"Return a callable object that fetches the given item(s) from its operand.\\n            After f = itemgetter(2), the call f(r) returns r[2].\\n            After g = itemgetter(2, 5, 3), the call g(r) returns (r[2], r[5], r[3])\",$r(){if(this.in$repr)return new Sk.builtin.str(this.tp$name+\"(...)\");this.in$repr=!0;const a=this.tp$name+\"(\"+this.items.map(a=>Sk.misceval.objectRepr(a)).join(\", \")+\")\";return this.in$repr=!1,a}}}),operator.attrgetter=Sk.abstr.buildNativeClass(\"operator.attrgetter\",{constructor:function attrgetter(a){this.attrs=a,this.oneattr=1===a.length,this.attr=a[0],this.in$repr=!1},slots:{tp$getattr:Sk.generic.getAttr,tp$new(a,b){Sk.abstr.checkNoKwargs(\"attrgetter\",b),Sk.abstr.checkArgsLen(\"attrgetter\",a,1);const c=[];for(let d=0;d<a.length;d++){const b=a[d];if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError(\"attribute name must be a string\");b.v.includes(\".\")?c.push(b.$jsstr().split(\".\").map(a=>new Sk.builtin.str(a))):c.push([b])}return new operator.attrgetter(c)},tp$call(a,b){Sk.abstr.checkNoKwargs(\"attrgetter\",b),Sk.abstr.checkArgsLen(\"attrgetter\",a,1,1);const c=a[0];if(this.oneattr)return this.attr.reduce((a,b)=>Sk.abstr.gattr(a,b),c);const d=this.attrs.map(a=>a.reduce((a,b)=>Sk.abstr.gattr(a,b),c));return new Sk.builtin.tuple(d)},tp$doc:\"attrgetter(attr, ...) --> attrgetter object\\n\\nReturn a callable object that fetches the given attribute(s) from its operand.\\nAfter f = attrgetter('name'), the call f(r) returns r.name.\\nAfter g = attrgetter('name', 'date'), the call g(r) returns (r.name, r.date).\\nAfter h = attrgetter('name.first', 'name.last'), the call h(r) returns\\n(r.name.first, r.name.last).\",$r(){if(this.in$repr)return new Sk.builtin.str(this.tp$name+\"(...)\");this.in$repr=!0;const a=this.tp$name+\"(\"+this.items.map(a=>Sk.misceval.objectRepr(a)).join(\", \")+\")\";return this.in$repr=!1,a}}}),operator.methodcaller=Sk.abstr.buildNativeClass(\"operator.methodcaller\",{constructor:function methodcaller(a,b,c){this.$name=a,this.args=b,this.kwargs=c||[],this.in$repr=!1},slots:{tp$getattr:Sk.generic.getAttr,tp$new(a,b){Sk.abstr.checkArgsLen(\"methodcaller\",a,1);const c=a[0];if(!Sk.builtin.checkString(c))throw new Sk.builtin.TypeError(\"method name must be a string\");return new operator.methodcaller(c,a.slice(1),b)},tp$call(a,b){Sk.abstr.checkNoKwargs(\"methodcaller\",b),Sk.abstr.checkArgsLen(\"methodcaller\",a,1,1);const c=a[0];return Sk.misceval.chain(Sk.abstr.gattr(c,this.$name,!0),a=>Sk.misceval.callsimOrSuspendArray(a,this.args,this.kwargs))},tp$doc:\"methodcaller(name, ...) --> methodcaller object\\n\\nReturn a callable object that calls the given method on its operand.\\nAfter f = methodcaller('name'), the call f(r) returns r.name().\\nAfter g = methodcaller('name', 'date', foo=1), the call g(r) returns\\nr.name('date', foo=1).\",$r(){if(this.in$repr)return new Sk.builtin.str(this.tp$name+\"(...)\");this.in$repr=!0;let a=[Sk.misceval.objectRepr(this.$name),...this.args.map(a=>Sk.misceval.objectRepr(a))];for(let b=0;b<this.kwargs.length;b+=2)a.push(this.kwargs[b]+\"=\"+Sk.misceval.objectRepr(this.kwargs[b+1]));return a=this.tp$name+\"(\"+a.join(\", \")+\")\",this.in$repr=!1,a}}}),Sk.abstr.setUpModuleMethods(\"operator\",operator,{lt:{$meth:function lt(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,\"Lt\"))},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a < b.\"},le:{$meth:function le(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,\"LtE\"))},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a <= b.\"},eq:{$meth:function eq(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,\"Eq\"))},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a == b.\"},ne:{$meth:function ne(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,\"NotEq\"))},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a != b.\"},ge:{$meth:function ge(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,\"GtE\"))},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a >= b.\"},gt:{$meth:function gt(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,\"Gt\"))},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a > b.\"},not_:{$meth:function not_(a){return Sk.abstr.numberUnaryOp(a,\"Not\")},$flags:{OneArg:!0},$textsig:\"($module, a, /)\",$doc:\"Same as not a.\"},truth:{$meth:function truth(a){return Sk.builtin.bool(a)},$flags:{OneArg:!0},$textsig:\"($module, a, /)\",$doc:\"Return True if a is true, False otherwise.\"},is_:{$meth:function is_(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,\"Is\"))},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a is b.\"},is_not:{$meth:function is_not(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,\"IsNot\"))},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a is not b.\"},abs:{$meth:function abs(a){return Sk.builtin.abs(a)},$flags:{OneArg:!0},$textsig:\"($module, a, /)\",$doc:\"Same as abs(a).\"},add:{$meth:function add(c,a){return Sk.abstr.numberBinOp(c,a,\"Add\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a + b.\"},and_:{$meth:function and_(c,a){return Sk.abstr.numberBinOp(c,a,\"BitAnd\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a & b.\"},floordiv:{$meth:function floordiv(c,a){return Sk.abstr.numberBinOp(c,a,\"FloorDiv\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a // b.\"},index:{$meth:function index(b){return new Sk.builtin.int_(Sk.misceval.asIndexOrThrow(b))},$flags:{OneArg:!0},$textsig:\"($module, a, /)\",$doc:\"Same as a.__index__()\"},inv:{$meth:function inv(a){return Sk.abstr.numberUnaryOp(a,\"Invert\")},$flags:{OneArg:!0},$textsig:\"($module, a, /)\",$doc:\"Same as ~a.\"},invert:{$meth:function invert(a){return Sk.abstr.numberUnaryOp(a,\"Invert\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, /)\",$doc:\"Same as ~a.\"},lshift:{$meth:function lshift(c,a){return Sk.abstr.numberBinOp(c,a,\"LShift\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a << b.\"},mod:{$meth:function mod(c,a){return Sk.abstr.numberBinOp(c,a,\"Mod\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a % b.\"},mul:{$meth:function mul(c,a){return Sk.abstr.numberBinOp(c,a,\"Mult\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a * b.\"},matmul:{$meth:function matmul(c,a){return Sk.abstr.numberBinOp(c,a,\"MatMult\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a @ b.\"},neg:{$meth:function neg(a){return Sk.abstr.numberUnaryOp(a,\"USub\")},$flags:{OneArg:!0},$textsig:\"($module, a, /)\",$doc:\"Same as -a.\"},or_:{$meth:function or_(c,a){return Sk.abstr.numberBinOp(c,a,\"BitOr\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a | b.\"},pos:{$meth:function pos(a){return Sk.abstr.numberUnaryOp(a,\"UAdd\")},$flags:{OneArg:!0},$textsig:\"($module, a, /)\",$doc:\"Same as +a.\"},pow:{$meth:function pow(c,a){return Sk.abstr.numberBinOp(c,a,\"Pow\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a ** b.\"},rshift:{$meth:function rshift(c,a){return Sk.abstr.numberBinOp(c,a,\"RShift\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a >> b.\"},sub:{$meth:function sub(c,a){return Sk.abstr.numberBinOp(c,a,\"Sub\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a - b.\"},truediv:{$meth:function div(c,a){return Sk.abstr.numberBinOp(c,a,\"Div\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a / b.\"},xor:{$meth:function xor(c,a){return Sk.abstr.numberBinOp(c,a,\"BitXor\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a ^ b.\"},concat:{$meth:function concat(c,a){return Sk.abstr.sequenceConcat(c,a)},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a + b, for a and b sequences.\"},contains:{$meth:function contains(c,a){return Sk.builtin.bool(Sk.abstr.sequenceContains(c,a))},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as b in a (note reversed operands).\"},countOf:{$meth:function countOf(c,a){return Sk.abstr.sequenceGetCountOf(c,a)},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Return the number of times b occurs in a.\"},delitem:{$meth:function delitem(c,a){return Sk.misceval.chain(Sk.abstr.objectDelItem(c,a,!0),()=>Sk.builtin.none.none$)},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as del a[b].\"},getitem:{$meth:function getitem(c,a){return Sk.abstr.objectGetItem(c,a)},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a[b].\"},indexOf:{$meth:function indexOf(c,a){return Sk.abstr.sequenceGetIndexOf(c,a)},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Return the first index of b in a.\"},setitem:{$meth:function setitem(d,a,b){return Sk.misceval.chain(Sk.abstr.objectSetItem(d,a,b,!0),()=>Sk.builtin.none.none$)},$flags:{MinArgs:3,MaxArgs:3},$textsig:\"($module, a, b, c, /)\",$doc:\"Same as a[b] = c.\"},length_hint:{$meth:function length_hint(a,b){if(void 0===b)b=new Sk.builtin.int_(0);else if(!Sk.builtin.checkInt(b))throw new Sk.builtin.TypeError(\"'\"+Sk.abstr.typeName(b)+\"' object cannot be interpreted as an integer\");try{return Sk.builtin.len(a)}catch(a){if(!(a instanceof Sk.builtin.TypeError))throw a}const c=Sk.abstr.lookupSpecial(a,Sk.builtin.str.$length_hint);if(void 0!==c){const a=Sk.misceval.callsimArray(c,[]);if(a===Sk.builtin.NotImplemented.NotImplemented$)return b;if(!Sk.builtin.checkInteger(a))throw new Sk.builtin.TypeError(\"__length_hint__ must be an integer, not \"+Sk.abstr.typeName(a));else if(a.nb$isnegative())throw new Sk.builtin.TypeError(\"__length_hint__() should return >= 0\");return a}return b},$flags:{MinArgs:1,MaxArgs:2},$textsig:\"($module, obj, default=0, /)\",$doc:\"Return an estimate of the number of items in obj.\\n\\nThis is useful for presizing containers when building from an iterable.\\n\\nIf the object supports len(), the result will be exact.\\nOtherwise, it may over- or under-estimate by an arbitrary amount.\\nThe result will be an integer >= 0.\"},iadd:{$meth:function iadd(c,a){return Sk.abstr.numberInplaceBinOp(c,a,\"Add\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a += b.\"},iand:{$meth:function iand(c,a){return Sk.abstr.numberInplaceBinOp(c,a,\"BitAnd\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a &= b.\"},iconcat:{$meth:function iconcat(c,a){if(void 0!==c.sq$inplace_concat)return c.sq$inplace_concat(a);if(void 0!==c.sq$concat)return c.sq$concat(a);if(!Sk.builtin.checkSequence(c)||!Sk.builtin.checkSequence(a))throw new Sk.builtin.TypeError(Sk.abstr.typeName(c)+\" object can't be concatenated\");return Sk.abstr.numberInplaceBinOp(c,a,\"Add\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a += b, for a and b sequences.\"},ifloordiv:{$meth:function ifloordiv(c,a){return Sk.abstr.numberInplaceBinOp(c,a,\"FloorDiv\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a //= b.\"},ilshift:{$meth:function ilshift(c,a){return Sk.abstr.numberInplaceBinOp(c,a,\"LShift\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a <<= b.\"},imod:{$meth:function imod(c,a){return Sk.abstr.numberInplaceBinOp(c,a,\"Mod\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a %= b.\"},imul:{$meth:function imul(c,a){return Sk.abstr.numberInplaceBinOp(c,a,\"Mult\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a *= b.\"},imatmul:{$meth:function imatmul(c,a){return Sk.abstr.numberInplaceBinOp(c,a,\"MatMult\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a @= b.\"},ior:{$meth:function ior(c,a){return Sk.abstr.numberInplaceBinOp(c,a,\"BitOr\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a |= b.\"},ipow:{$meth:function ipow(c,a){return Sk.abstr.numberInplaceBinOp(c,a,\"Pow\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a **= b.\"},irshift:{$meth:function irshift(c,a){return Sk.abstr.numberInplaceBinOp(c,a,\"LRhift\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a >>= b.\"},isub:{$meth:function isub(c,a){return Sk.abstr.numberInplaceBinOp(c,a,\"Sub\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a -= b.\"},itruediv:{$meth:function idiv(c,a){return Sk.abstr.numberInplaceBinOp(c,a,\"Div\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a /= b.\"},ixor:{$meth:function ixor(c,a){return Sk.abstr.numberInplaceBinOp(c,a,\"BitXor\")},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, a, b, /)\",$doc:\"Same as a ^= b.\"}}),Object.assign(operator,{__abs__:operator.abs,__add__:operator.add,__and__:operator.and,__concat__:operator.concat,__contains__:operator.contains,__delitem__:operator.delitem,__eq__:operator.eq,__floordiv__:operator.floordiv,__ge__:operator.ge,__getitem__:operator.getitem,__gt__:operator.gt,__iadd__:operator.iadd,__iand__:operator.iand,__iconcat__:operator.iconcat,__ifloordiv__:operator.ifloordiv,__ilshift__:operator.ilshift,__imatmul__:operator.imatmul,__imod__:operator.imod,__imul__:operator.imul,__index__:operator.index,__inv__:operator.inv,__invert__:operator.invert,__ior__:operator.ior,__ipow__:operator.ipow,__irshift__:operator.irshift,__isub__:operator.isub,__itruediv__:operator.itruediv,__ixor__:operator.ixor,__le__:operator.le,__lshift__:operator.lshift,__lt__:operator.lt,__matmul__:operator.matmul,__mod__:operator.mod,__mul__:operator.mul,__ne__:operator.ne,__neg__:operator.neg,__not__:operator.not,__or__:operator.or,__pos__:operator.pos,__pow__:operator.pow,__rshift__:operator.rshift,__setitem__:operator.setitem,__sub__:operator.sub,__truediv__:operator.truediv,__xor__:operator.xor,_abs:Sk.builtins.abs,div:operator.truediv,__div__:operator.truediv}),operator}","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,d){\"undefined\"==typeof d?a.v.set(b.v,c.v):a.v.set(b.v,c.v,d.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.div(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\nfrom .stack import Stack\nfrom .queue import Queue\nfrom .deque import Deque\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\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\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","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":"\nfrom .binaryTree import BinaryTree\nfrom .balance import AVLTree\nfrom .bst import BinarySearchTree\nfrom .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/pythonds3/__init__.py":"#!/usr/bin/env python3\n\"\"\"\npythonds3 import statement\n\"\"\"\n\nfrom pythonds3.basic import Stack, Queue, Deque\nfrom pythonds3.graphs import Graph, Vertex\nfrom pythonds3.searching import HashTable\nfrom pythonds3.trees import (\n    BinaryTree,\n    AVLTree,\n    BinarySearchTree,\n    BinaryHeap,\n    PriorityQueue,\n)\n\n__all__ = [\n    \"Stack\",\n    \"Queue\",\n    \"Deque\",\n    \"Graph\",\n    \"Vertex\",\n    \"HashTable\",\n    \"BinaryTree\",\n    \"AVLTree\",\n    \"BinarySearchTree\",\n    \"BinaryHeap\",\n    \"BinaryTree\",\n    \"PriorityQueue\",\n]\n","src/lib/pythonds3/basic/__init__.py":"#!/usr/bin/env python3\n\"\"\"\npythonds3.basic import statement\n\"\"\"\nfrom pythonds3.basic.stack import Stack\nfrom pythonds3.basic.queue import Queue\nfrom pythonds3.basic.deque import Deque\nfrom pythonds3.basic.linked_list import OrderedList\nfrom pythonds3.basic.linked_list import UnorderedList\n\n__all__ = [\"Stack\", \"Queue\", \"Deque\", \"OrderedList\", \"UnorderedList\"]\n","src/lib/pythonds3/basic/deque.py":"#!/usr/bin/env python3\n\"\"\"\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n\"\"\"\n\n\nclass Deque:\n    \"\"\"Queue implementation as a list\"\"\"\n\n    def __init__(self):\n        \"\"\"Create new deque\"\"\"\n        self._items = []\n\n    def is_empty(self):\n        \"\"\"Check if the deque is empty\"\"\"\n        return not bool(self._items)\n\n    def add_front(self, item):\n        \"\"\"Add an item to the front of the deque\"\"\"\n        self._items.append(item)\n\n    def add_rear(self, item):\n        \"\"\"Add an item to the rear of the deque\"\"\"\n        self._items.insert(0, item)\n\n    def remove_front(self):\n        \"\"\"Remove an item from the front of the deque\"\"\"\n        return self._items.pop()\n\n    def remove_rear(self):\n        \"\"\"Remove an item from the rear of the deque\"\"\"\n        return self._items.pop(0)\n\n    def size(self):\n        \"\"\"Get the number of items in the deque\"\"\"\n        return len(self._items)\n","src/lib/pythonds3/basic/linked_list.py":"#!/usr/bin/env python3\n\"\"\"\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n\"\"\"\n\n\nclass LinkedListNode:\n    \"\"\"A node of a linked list\"\"\"\n\n    def __init__(self, node_data):\n        self._data = node_data\n        self._next = None\n\n    def get_data(self):\n        \"\"\"Get node data\"\"\"\n        return self._data\n\n    def set_data(self, node_data):\n        \"\"\"Set node data\"\"\"\n        self._data = node_data\n\n    data = property(get_data, set_data)\n\n    def get_next(self):\n        \"\"\"Get next node\"\"\"\n        return self._next\n\n    def set_next(self, node_next):\n        \"\"\"Set next node\"\"\"\n        self._next = node_next\n\n    next = property(get_next, set_next)\n\n    def __str__(self):\n        \"\"\"String\"\"\"\n        return str(self._data)\n\n\nclass LinkedList:\n    \"\"\"Linked List class implementation\"\"\"\n\n    def __init__(self):\n        \"\"\"Create a linked list\"\"\"\n        self._head = None\n        self._count = 0\n\n    def is_empty(self):\n        \"\"\"Is the list empty\"\"\"\n        return self._head is None\n\n    def size(self):\n        \"\"\"Size of the list\"\"\"\n        return self._count\n\n    def __len__(self):\n        \"\"\"Size of the list\"\"\"\n        return self._count\n\n    def __str__(self):\n        \"\"\"List as a string\"\"\"\n        list_str = \"[\"\n        current = self._head\n\n        while current:\n            list_str += str(current)\n            if current.next:\n                list_str += \", \"\n            current = current.next\n        list_str += \"]\"\n        return list_str\n\n    def add(self, value):\n        \"\"\"Add a new node\"\"\"\n        pass\n\n    def remove(self, value):\n        \"\"\"Remove a node with a specific value\"\"\"\n        pass\n\n    def search(self, value):\n        \"\"\"Search for a node with a specific value\"\"\"\n        pass\n\n\nclass UnorderedList(LinkedList):\n    \"\"\"Unordered linked list implementation\"\"\"\n\n    def __init__(self):\n        \"\"\"Create an unordered linked list\"\"\"\n        LinkedList.__init__(self)\n\n    def add(self, value):\n        \"\"\"Add a new node\"\"\"\n        new_node = LinkedListNode(value)\n        new_node.set_next(self._head)\n        self._head = new_node\n        self._count = self._count + 1\n\n    def remove(self, value):\n        \"\"\"Remove a node with a specific value\"\"\"\n        current = self._head\n        prev = None\n\n        while current:\n            if current.data == value:\n                if prev is None:\n                    self._head = current.next\n                else:\n                    prev.next = current.next\n                self._count = self._count - 1\n                return\n            prev = current\n            current = current.next\n        raise ValueError(\"{} is not in the list\".format(value))\n\n    def search(self, value):\n        \"\"\"Search for a node with a specific value\"\"\"\n        current = self._head\n\n        while current:\n            if current.data == value:\n                return True\n            current = current.next\n        return False\n\n\nclass OrderedList(LinkedList):\n    \"\"\"Ordered linked list implementation\"\"\"\n\n    def __init__(self):\n        \"\"\"Create an Ordered linked list\"\"\"\n        LinkedList.__init__(self)\n\n    def add(self, value):\n        \"\"\"Add a new node\"\"\"\n        current = self._head\n        prev = None\n        new_node = LinkedListNode(value)\n\n        while current and current.data < value:\n            prev = current\n            current = current.next\n\n        if prev is None:\n            new_node.next = self._head\n            self._head = new_node\n        else:\n            new_node.next = current\n            prev.next = new_node\n        self._count = self._count + 1\n\n    def remove(self, value):\n        \"\"\"Remove a node with a specific value\"\"\"\n        # This is an exercise\n        pass\n\n    def search(self, value):\n        \"\"\"Search for a node with a specific value\"\"\"\n        # This is an exercise\n        pass\n","src/lib/pythonds3/basic/queue.py":"#!/usr/bin/env python3\n\"\"\"\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n\"\"\"\n\n\nclass Queue:\n    \"\"\"Queue implementation as a list\"\"\"\n\n    def __init__(self):\n        \"\"\"Create new queue\"\"\"\n        self._items = []\n\n    def is_empty(self):\n        \"\"\"Check if the queue is empty\"\"\"\n        return not bool(self._items)\n\n    def enqueue(self, item):\n        \"\"\"Add an item to the queue\"\"\"\n        self._items.insert(0, item)\n\n    def dequeue(self):\n        \"\"\"Remove an item from the queue\"\"\"\n        return self._items.pop()\n\n    def size(self):\n        \"\"\"Get the number of items in the queue\"\"\"\n        return len(self._items)\n","src/lib/pythonds3/basic/stack.py":"#!/usr/bin/env python3\n\"\"\"\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n\"\"\"\n\n\nclass Stack:\n    \"\"\"Stack implementation as a list\"\"\"\n\n    def __init__(self):\n        \"\"\"Create new stack\"\"\"\n        self._items = []\n\n    def is_empty(self):\n        \"\"\"Check if the stack is empty\"\"\"\n        return not bool(self._items)\n\n    def push(self, item):\n        \"\"\"Add an item to the stack\"\"\"\n        self._items.append(item)\n\n    def pop(self):\n        \"\"\"Remove an item from the stack\"\"\"\n        return self._items.pop()\n\n    def peek(self):\n        \"\"\"Get the value of the top item in the stack\"\"\"\n        return self._items[-1]\n\n    def size(self):\n        \"\"\"Get the number of items in the stack\"\"\"\n        return len(self._items)\n","src/lib/pythonds3/graphs/__init__.py":"#!/usr/bin/env python3\n\"\"\"\npythonds3.graphs import statement\n\"\"\"\nfrom pythonds3.graphs.adjacency_graph import Graph\nfrom pythonds3.graphs.adjacency_graph import Vertex\n\n__all__ = [\"Graph\"]\n","src/lib/pythonds3/graphs/adjacency_graph.py":"#!/usr/bin/env python3\n\"\"\"\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n\"\"\"\n\nimport heapq\nimport sys\n\n\nclass Vertex:\n    \"\"\"Graph vertex class\"\"\"\n\n    def __init__(self, key):\n        \"\"\"Create new vertex\"\"\"\n        self._key = key\n        self._neighbors = {}\n        self._color = \"white\"\n        self._distance = sys.maxsize\n        self._previous = None\n        self._discovery_time = 0\n        self._closing_time = 0\n\n    def __lt__(self, other):\n        \"\"\"Less than operator required for heapify\"\"\"\n        return self.key < other.key\n\n    def get_key(self):\n        \"\"\"Get vertex key\"\"\"\n        return self._key\n\n    key = property(get_key)\n\n    def get_neighbor(self, other):\n        \"\"\"Get the distance (edge weight) to an adjacent node (neighbor)\"\"\"\n        return self._neighbors.get(other, None)\n\n    def set_neighbor(self, other, weight=0):\n        \"\"\"Set the distance (add an edge) to an adjacent node (neighbor)\"\"\"\n        self._neighbors[other] = weight\n\n    def get_neighbors(self):\n        \"\"\"Get all adjacent nodes (neighbors)\"\"\"\n        return self._neighbors.keys()\n\n    def get_color(self):\n        \"\"\"Get vertex color\"\"\"\n        return self._color\n\n    def set_color(self, color):\n        \"\"\"Set vertex color\"\"\"\n        self._color = color\n\n    color = property(get_color, set_color)\n\n    def get_distance(self):\n        \"\"\"Get distance\"\"\"\n        return self._distance\n\n    def set_distance(self, distance):\n        \"\"\"Set distance\"\"\"\n        self._distance = distance\n\n    distance = property(get_distance, set_distance)\n\n    def get_previous(self):\n        \"\"\"Get previous\"\"\"\n        return self._previous\n\n    def set_previous(self, previous):\n        \"\"\"Set previous\"\"\"\n        self._previous = previous\n\n    previous = property(get_previous, set_previous)\n\n    def get_discovery_time(self):\n        \"\"\"Get discovery time\"\"\"\n        return self._discovery_time\n\n    def set_discovery_time(self, discovery_time):\n        \"\"\"Set discovery time\"\"\"\n        self._discovery_time = discovery_time\n\n    discovery_time = property(get_discovery_time, set_discovery_time)\n\n    def get_closing_time(self):\n        \"\"\"Get closing time\"\"\"\n        return self._closing_time\n\n    def set_closing_time(self, closing_time):\n        \"\"\"Set closing time\"\"\"\n        self._closing_time = closing_time\n\n    closing_time = property(get_closing_time, set_closing_time)\n\n    def __str__(self):\n        return \"{:^8}|{:^8}|{:^8}|{:^8}|{:^8}| {}\".format(\n            self._key,\n            self._color,\n            self._distance,\n            self._discovery_time,\n            self._closing_time,\n            self._previous,\n        )\n\n\nclass Graph:\n    \"\"\"Graph as an adjacency matrix\"\"\"\n\n    def __init__(self):\n        self._vertices = {}\n        self._edges = {}\n        self._time = 0\n\n    def __iter__(self):\n        \"\"\"Iterator\"\"\"\n        return iter(self._vertices.values())\n\n    def size(self):\n        \"\"\"Graph's size\"\"\"\n        return len(self._vertices)\n\n    def __len__(self):\n        \"\"\"Graph's size\"\"\"\n        return len(self._vertices)\n\n    def __contains__(self, key):\n        \"\"\"in operator override\"\"\"\n        return key in self._vertices\n\n    def get_vertex(self, key):\n        \"\"\"Find the vertex in the graph named vert_key\"\"\"\n        return self._vertices.get(key, None)\n\n    def set_vertex(self, key):\n        \"\"\"Add an instance of Vertex to the graph\"\"\"\n        self._vertices[key] = Vertex(key)\n\n    def add_edge(self, from_vertex, to_vertex, weight=0):\n        \"\"\"Add a weighted and directed edge to the graph\"\"\"\n        if from_vertex not in self._vertices:\n            self.set_vertex(from_vertex)\n        if to_vertex not in self._vertices:\n            self.set_vertex(to_vertex)\n        self._vertices[from_vertex].set_neighbor(self._vertices[to_vertex], weight)\n        self._edges[(from_vertex, to_vertex)] = weight\n\n    def get_vertices(self):\n        \"\"\"Return the list of all vertices in the graph\"\"\"\n        return self._vertices.keys()\n\n    def get_edges(self):\n        \"\"\"Return the list of all edges in the graph\"\"\"\n        return self._edges.keys()\n\n    def reset_distances(self, default_distance=sys.maxsize):\n        \"\"\"Reset distances to test Dijkstra's\"\"\"\n        for vertex in self:\n            vertex.distance = default_distance\n\n    def bfs(self, start):\n        \"\"\"Breadth First Search\"\"\"\n        start.distance = 0\n        start.previous = None\n        vert_queue = [start]\n        while vert_queue:\n            current_vert = vert_queue.pop(0)\n            for neigh in current_vert.get_neighbors():\n                if neigh.color == \"white\":\n                    neigh.color = \"gray\"\n                    neigh.distance = current_vert.distance + 1\n                    neigh.previous = current_vert\n                    vert_queue.append(neigh)\n            current_vert.color = \"black\"\n\n    def dfs(self):\n        \"\"\"Depth First search\"\"\"\n        for vertex in self:\n            if vertex.color == \"white\":\n                self.dfs_visit(vertex)\n\n    def dfs_visit(self, start):\n        \"\"\"DFS helper function\"\"\"\n        start.color = \"gray\"\n        self._time = self._time + 1\n        start.discovery_time = self._time\n        for next_vertex in start.get_neighbors():\n            if next_vertex.color == \"white\":\n                next_vertex.set_previous(start)\n                self.dfs_visit(next_vertex)\n        start.color = \"black\"\n        self._time = self._time + 1\n        start.closing_time = self._time\n\n    def traverse(self, src, dst):\n        \"\"\"Traverse a graph\"\"\"\n        path = []\n        current = self.get_vertex(dst)\n        while current:\n            path.append(current)\n            current = current.previous\n        print(\n            \"Path from {} to {} ({}): {}\".format(\n                self.get_vertex(src).key,\n                self.get_vertex(dst).key,\n                self.get_vertex(dst).distance,\n                \" \".join(vertex.key for vertex in reversed(path)),\n            )\n        )\n\n    def dijkstra(self, start):\n        \"\"\"Dijkstra's shortest path algorithm\"\"\"\n        start.distance = 0\n        not_yet_visited = [[start.distance, start]]\n        heapq.heapify(not_yet_visited)\n        while not_yet_visited:\n            current_vertex = heapq.heappop(not_yet_visited)[1]\n            for next_vertex in current_vertex.get_neighbors():\n                new_distance = current_vertex.distance + current_vertex.get_neighbor(\n                    next_vertex\n                )\n                if new_distance < next_vertex.distance:\n                    next_vertex.distance = new_distance\n                    next_vertex.previous = current_vertex\n                    found = False\n                    for vertex in not_yet_visited:\n                        if vertex[1].key == next_vertex.key:\n                            vertex[0] = next_vertex.distance\n                            heapq.heapify(not_yet_visited)\n                            found = True\n                    if not found:\n                        heapq.heappush(\n                            not_yet_visited, [next_vertex.distance, next_vertex]\n                        )\n\n    def bellman_ford(self, start):\n        \"\"\"Bellman-Ford shortest path algorithm\"\"\"\n        start.distance = 0\n        for _ in range(len(self._vertices)):\n            for edge in self._edges:\n                if (\n                    self.get_vertex(edge[0]).distance + self._edges[edge]\n                    < self.get_vertex(edge[1]).distance\n                ):\n                    self.get_vertex(edge[1]).distance = (\n                        self.get_vertex(edge[0]).distance + self._edges[edge]\n                    )\n                    self.get_vertex(edge[1]).previous = self.get_vertex(edge[0])\n        for edge in self._edges:\n            if (\n                self.get_vertex(edge[0]).distance + self._edges[edge]\n                < self.get_vertex(edge[1]).distance\n            ):\n                raise ValueError(\"Graph contains a negative-weight cycle\")\n\n    def prim(self, start):\n        \"\"\"Prim's spanning tree algorithm\"\"\"\n        start.distance = 0\n        not_in_a_tree = [[vertex.distance, vertex] for vertex in self]\n        heapq.heapify(not_in_a_tree)\n        while not_in_a_tree:\n            current_vertex = heapq.heappop(not_in_a_tree)[1]\n            for next_vertex in current_vertex.get_neighbors():\n                new_distance = current_vertex.get_neighbor(next_vertex)\n                if (\n                    any(item[1] == next_vertex for item in not_in_a_tree)\n                    and new_distance < next_vertex.distance\n                ):\n                    next_vertex.previous = current_vertex\n                    next_vertex.distance = new_distance\n                    for item in not_in_a_tree:\n                        if item[1] == next_vertex:\n                            item[0] = new_distance\n                            heapq.heapify(not_in_a_tree)\n                            break\n","src/lib/pythonds3/intro/__init__.py":"#!/usr/bin/env python3\n\"\"\"\npythonds3.intro import statement\n\"\"\"\nfrom pythonds3.intro.oop import Fraction\n\n__all__ = [\"Fraction\"]\n","src/lib/pythonds3/intro/oop.py":"#!/usr/bin/env python3\n\"\"\"\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n\"\"\"\n\n\ndef gcd(number1, number2):\n    \"\"\"Helper function to simplify fractions\"\"\"\n    if not isinstance(number1, int) or not isinstance(number2, int):\n        raise TypeError(\"Numerator and denominator must be integers\")\n    while number1 % number2:\n        number1, number2 = number2, number1 % number2\n    return number2\n\n\nclass Fraction:\n    \"\"\"Fraction class\"\"\"\n\n    def __init__(self, new_numer, new_denom):\n        try:\n            common = gcd(new_numer, new_denom)\n        except TypeError:\n            raise\n        self._numer = new_numer // common\n        self._denom = new_denom // common\n\n    @property\n    def numer(self):\n        \"\"\"Get numerator\"\"\"\n        return self._numer\n\n    @numer.setter\n    def set_numer(self, new_numer):\n        \"\"\"Set numerator\"\"\"\n        self._numer = new_numer\n\n    def get_denom(self):\n        \"\"\"Get deniminator\"\"\"\n        return self._denom\n\n    def set_denom(self, new_denom):\n        \"\"\"Set deniminator\"\"\"\n        self._denom = new_denom\n\n    # Another way to create an attribute\n    denom = property(get_denom, set_denom)\n\n    def __str__(self):\n        \"\"\"Get the string value\"\"\"\n        if self._numer > self._denom:\n            return \"{} {}/{}\".format(\n                self._numer // self._denom, self._numer % self._denom, self._denom\n            )\n        return \"{}/{}\".format(self._numer, self._denom)\n\n    def __repr__(self):\n        \"\"\"Fraction representation\"\"\"\n        return \"Fraction({}, {})\".format(self._numer, self._denom)\n\n    def __eq__(self, other):\n        \"\"\"Equality comparison\"\"\"\n        return self._numer * other.denom == other.numer * self._denom\n\n    def __add__(self, other):\n        \"\"\"Add two fractions\"\"\"\n        new_numer = self._numer * other.denom + self._denom * other.numer\n        new_denom = self._denom * other.denom\n        return Fraction(new_numer, new_denom)\n","src/lib/pythonds3/searching/__init__.py":"#!/usr/bin/env python3\n\"\"\"\npythonds3.search import statement\n\"\"\"\nfrom pythonds3.searching.hash_table import HashTable\n\n__all__ = [\"HashTable\"]\n","src/lib/pythonds3/searching/hash_table.py":"#!/usr/bin/env python3\n\"\"\"\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n\"\"\"\n\n\nclass HashTable:\n    \"\"\"Hash Table implementation\"\"\"\n\n    def __init__(self, size=16):\n        \"\"\"Create a hash table\"\"\"\n        self._size = size\n        self._slots = [None] * self._size\n        self._data = [None] * self._size\n\n    def __getitem__(self, key):\n        \"\"\"Magic __get__\"\"\"\n        return self.get(key)\n\n    def __setitem__(self, key, data):\n        \"\"\"Magic __set__\"\"\"\n        self.put(key, data)\n\n    def __len__(self):\n        \"\"\"Magic __len__\"\"\"\n        return self._size - self._slots.count(None)\n\n    def __contains__(self, key):\n        \"\"\"Magin in\"\"\"\n        return key in self._slots\n\n    def _hash_function(self, key, size):\n        \"\"\"Simple hash function\"\"\"\n        return key % size\n\n    def _rehash(self, old_hash, size, step=1):\n        \"\"\"Simple rehash function\"\"\"\n        return (old_hash + step) % size\n\n    def is_empty(self):\n        \"\"\"Check if the table is empty\"\"\"\n        return self._size == self._slots.count(None)\n\n    def size(self):\n        \"\"\"Get number of items in the table\"\"\"\n        return self._size - self._slots.count(None)\n\n    def put(self, key, data):\n        \"\"\"Add an item to the table\"\"\"\n        hash_value = self._hash_function(key, len(self._slots))\n\n        if self._slots[hash_value] is None:\n            self._slots[hash_value] = key\n            self._data[hash_value] = data\n        else:\n            if self._slots[hash_value] == key:\n                self._data[hash_value] = data  # replace\n            else:\n                j = 0\n                next_slot = self._rehash(hash_value, len(self._slots), j)\n                while (\n                    self._slots[next_slot] is not None\n                    and self._slots[next_slot] != key\n                    and j < self._size\n                ):\n                    j = j + 1\n                    next_slot = self._rehash(hash_value, len(self._slots), j)\n\n                if self._slots[next_slot] is None:\n                    self._slots[next_slot] = key\n                    self._data[next_slot] = data\n                elif j == self._size:\n                    raise Exception(\"Hash Table is full\")\n                else:\n                    self._data[next_slot] = data  # replace\n\n    def get(self, key):\n        \"\"\"Get an item from the table\"\"\"\n        start_slot = self._hash_function(key, len(self._slots))\n        position = start_slot\n        j = 0\n\n        while self._slots[position] is not None and j < self._size:\n            if self._slots[position] == key:\n                return self._data[position]\n            j = j + 1\n            position = self._rehash(start_slot, len(self._slots), j)\n\n        raise KeyError(\"{} is not in the table\".format(key))\n","src/lib/pythonds3/sorting/__init__.py":"#!/usr/bin/env python3\n\"\"\"\npythonds3.sorting import statement\n\"\"\"\nfrom pythonds3.sorting.sorting_algorithms import bubble_sort\nfrom pythonds3.sorting.sorting_algorithms import select_sort\nfrom pythonds3.sorting.sorting_algorithms import insert_sort\nfrom pythonds3.sorting.sorting_algorithms import shell_sort\nfrom pythonds3.sorting.sorting_algorithms import merge_sort\nfrom pythonds3.sorting.sorting_algorithms import quick_sort\nfrom pythonds3.sorting.sorting_algorithms import heap_sort\n","src/lib/pythonds3/sorting/sorting_algorithms.py":"#!/usr/bin/env python3\n\"\"\"\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n\"\"\"\n\nimport heapq\n\n\ndef bubble_sort(lst):\n    \"\"\"Bubble sort\"\"\"\n    for i in range(len(lst) - 1, 0, -1):\n        exchanges = False\n        for j in range(i):\n            if lst[j] > lst[j + 1]:\n                exchanges = True\n                lst[j], lst[j + 1] = lst[j + 1], lst[j]\n        if not exchanges:\n            break\n\n\ndef select_sort(lst):\n    \"\"\"Selection sort\"\"\"\n    for i, item in enumerate(lst):\n        min_idx = len(lst) - 1\n        for j in range(i, len(lst)):\n            if lst[j] < lst[min_idx]:\n                min_idx = j\n        if min_idx != i:\n            lst[min_idx], lst[i] = lst[i], lst[min_idx]\n\n\ndef insert_sort(lst):\n    \"\"\"Insertion sort\"\"\"\n    for i in range(1, len(lst)):\n        cur_val = lst[i]\n        cur_pos = i\n\n        while cur_pos > 0 and lst[cur_pos - 1] > cur_val:\n            lst[cur_pos] = lst[cur_pos - 1]\n            cur_pos = cur_pos - 1\n        lst[cur_pos] = cur_val\n\n\ndef shell_sort(lst):\n    \"\"\"Shell sort\"\"\"\n    sublist_count = len(lst) // 3\n    while sublist_count > 0:\n        for pos_start in range(sublist_count):\n            _gap_insert_sort(lst, pos_start, sublist_count)\n        sublist_count = sublist_count // 2\n\n\ndef _gap_insert_sort(lst, start, gap):\n    \"\"\"Shell sort helper function\"\"\"\n    for i in range(start + gap, len(lst), gap):\n        cur_val = lst[i]\n        cur_pos = i\n        while cur_pos >= gap and lst[cur_pos - gap] > cur_val:\n            lst[cur_pos] = lst[cur_pos - gap]\n            cur_pos = cur_pos - gap\n        lst[cur_pos] = cur_val\n\n\ndef merge_sort(lst):\n    \"\"\"Merge sort\"\"\"\n    if len(lst) > 1:\n        mid = len(lst) // 2\n        left_half = lst[:mid]\n        right_half = lst[mid:]\n\n        merge_sort(left_half)\n        merge_sort(right_half)\n\n        i, j, k = 0, 0, 0\n        while i < len(left_half) and j < len(right_half):\n            if left_half[i] <= right_half[j]:\n                lst[k] = left_half[i]\n                i = i + 1\n            else:\n                lst[k] = right_half[j]\n                j = j + 1\n            k = k + 1\n\n        while i < len(left_half):\n            lst[k] = left_half[i]\n            i = i + 1\n            k = k + 1\n\n        while j < len(right_half):\n            lst[k] = right_half[j]\n            j = j + 1\n            k = k + 1\n\n\ndef quick_sort(lst):\n    \"\"\"Quick sort\"\"\"\n    _quick_sort_help(lst, 0, len(lst) - 1)\n\n\ndef _quick_sort_help(lst, mark_l, mark_r):\n    \"\"\"Quick sort helper\"\"\"\n    if mark_l < mark_r:\n        split = _quick_sort_part(lst, mark_l, mark_r)\n        _quick_sort_help(lst, mark_l, split - 1)\n        _quick_sort_help(lst, split + 1, mark_r)\n\n\ndef _quick_sort_part(lst, mark_l, mark_r):\n    \"\"\"Quick sort partition\"\"\"\n    pivot_val = lst[mark_l]\n    mark_l_cur = mark_l + 1\n    mark_r_cur = mark_r\n    done = False\n\n    while not done:\n        while mark_l_cur <= mark_r_cur and lst[mark_l_cur] <= pivot_val:\n            mark_l_cur = mark_l_cur + 1\n        while mark_l_cur <= mark_r_cur and lst[mark_r_cur] >= pivot_val:\n            mark_r_cur = mark_r_cur - 1\n        if mark_r_cur < mark_l_cur:\n            done = True\n        else:\n            lst[mark_l_cur], lst[mark_r_cur] = lst[mark_r_cur], lst[mark_l_cur]\n    lst[mark_l], lst[mark_r_cur] = lst[mark_r_cur], lst[mark_l]\n\n    return mark_r_cur\n\n\ndef heap_sort(lst):\n    \"\"\"Heap sort\"\"\"\n    res = []\n    heapq.heapify(lst)\n    while lst:\n        res.append(heapq.heappop(lst))\n    for i in res:\n        lst.append(i)\n","src/lib/pythonds3/trees/__init__.py":"#!/usr/bin/env python3\n\"\"\"\npythonds3.trees import statement\n\"\"\"\nfrom pythonds3.trees.avl_tree import AVLTree\nfrom pythonds3.trees.binary_search_tree import BinarySearchTree\nfrom pythonds3.trees.binary_heap import BinaryHeap\nfrom pythonds3.trees.binary_tree import BinaryTree\nfrom pythonds3.trees.priority_queue import PriorityQueue\n\n__all__ = [\"BinaryTree\", \"BinaryHeap\", \"BinarySearchTree\", \"AVLTree\", \"PriorityQueue\"]\n","src/lib/pythonds3/trees/avl_tree.py":"#!/usr/bin/env python3\n\"\"\"\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005, 2010\nUpdated by Roman Yasinovskyy, 2017\n\"\"\"\n\nfrom pythonds3.trees.binary_search_tree import BinarySearchTree\nfrom pythonds3.trees.binary_search_tree import BinaryTreeNode\n\n\nclass AVLTreeNode(BinaryTreeNode):\n    \"\"\"AVL Tree Node\"\"\"\n\n    def __init__(self, key, val, balance_factor, left=None, right=None, parent=None):\n        \"\"\"Create an AVL tree node\"\"\"\n        BinaryTreeNode.__init__(self, key, val, left, right, parent)\n        self._balance_factor = balance_factor\n\n    def get_balance_factor(self):\n        \"\"\"Get the node balance factor\"\"\"\n        return self._balance_factor\n\n    def set_balance_factor(self, value):\n        \"\"\"Set the node balance factor\"\"\"\n        self._balance_factor = value\n\n    balance_factor = property(get_balance_factor, set_balance_factor)\n\n\nclass AVLTree(BinarySearchTree):\n    \"\"\"AVL tree implementation\"\"\"\n\n    def __init__(self):\n        \"\"\"Create a new AVL tree\"\"\"\n        BinarySearchTree.__init__(self)\n\n    def put(self, key, value):\n        \"\"\"Add new node\"\"\"\n        if self._root:\n            self._put(key, value, self._root)\n        else:\n            self._root = AVLTreeNode(key, value, 0)\n        self._size = self._size + 1\n\n    def _put(self, key, value, current_node):\n        \"\"\"Add a new node to the tree (helper function)\"\"\"\n        if key < current_node.key:\n            if current_node.get_child_left():\n                self._put(key, value, current_node.child_left)\n            else:\n                current_node.child_left = AVLTreeNode(\n                    key, value, 0, parent=current_node\n                )\n                self.update_balance(current_node.child_left)\n        else:\n            if current_node.get_child_right():\n                self._put(key, value, current_node.child_right)\n            else:\n                current_node.child_right = AVLTreeNode(\n                    key, value, 0, parent=current_node\n                )\n                self.update_balance(current_node.child_right)\n\n    def update_balance(self, node):\n        \"\"\"Update the tree balance\"\"\"\n        if node.balance_factor > 1 or node.balance_factor < -1:\n            self.rebalance(node)\n            return\n        if node.parent:\n            if node.is_child_left():\n                node.parent.balance_factor += 1\n            elif node.is_child_right():\n                node.parent.balance_factor -= 1\n\n            if node.parent.balance_factor != 0:\n                self.update_balance(node.parent)\n\n    def rebalance(self, node):\n        \"\"\"Rebalance the tree\"\"\"\n        if node.balance_factor < 0:\n            if node.child_right.balance_factor > 0:\n                # Do an LR Rotation\n                self.rotate_right(node.child_right)\n                self.rotate_left(node)\n            else:\n                # single left\n                self.rotate_left(node)\n        elif node.balance_factor > 0:\n            if node.child_left.balance_factor < 0:\n                # Do an RL Rotation\n                self.rotate_left(node.child_left)\n                self.rotate_right(node)\n            else:\n                # single right\n                self.rotate_right(node)\n\n    def rotate_left(self, rotation_root):\n        \"\"\"Left rotation\"\"\"\n        new_root = rotation_root.child_right\n        rotation_root.child_right = new_root.child_left\n        if new_root.child_left:\n            new_root.child_left.parent = rotation_root\n        new_root.parent = rotation_root.parent\n        if rotation_root.is_root():\n            self._root = new_root\n        else:\n            if rotation_root.is_child_left():\n                rotation_root.parent.child_left = new_root\n            else:\n                rotation_root.parent.child_right = new_root\n        new_root.child_left = rotation_root\n        rotation_root.parent = new_root\n        rotation_root.balance_factor = (\n            rotation_root.balance_factor + 1 - min(new_root.balance_factor, 0)\n        )\n        new_root.balance_factor = (\n            new_root.balance_factor + 1 + max(rotation_root.balance_factor, 0)\n        )\n\n    def rotate_right(self, rotation_root):\n        \"\"\"Right rotation\"\"\"\n        new_root = rotation_root.child_left\n        rotation_root.child_left = new_root.child_right\n        if new_root.child_right:\n            new_root.child_right.parent = rotation_root\n        new_root.parent = rotation_root.parent\n        if rotation_root.is_root():\n            self._root = new_root\n        else:\n            if rotation_root.is_child_right():\n                rotation_root.parent.child_right = new_root\n            else:\n                rotation_root.parent.child_left = new_root\n        new_root.child_right = rotation_root\n        rotation_root.parent = new_root\n        rotation_root.balance_factor = (\n            rotation_root.balance_factor - 1 - max(new_root.balance_factor, 0)\n        )\n        new_root.balance_factor = (\n            new_root.balance_factor - 1 + min(rotation_root.balance_factor, 0)\n        )\n","src/lib/pythonds3/trees/binary_heap.py":"#!/usr/bin/env python3\n\"\"\"\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n\"\"\"\n\n\nclass BinaryHeap:\n    \"\"\"Minimal Binary Heap\"\"\"\n\n    def __init__(self):\n        \"\"\"Create a heap\"\"\"\n        self._heap = []\n\n    def _perc_up(self, cur_idx):\n        \"\"\"Move a node up\"\"\"\n        while (cur_idx - 1) // 2 >= 0:\n            parent_idx = (cur_idx - 1) // 2\n            if self._heap[cur_idx] < self._heap[parent_idx]:\n                self._heap[cur_idx], self._heap[parent_idx] = (\n                    self._heap[parent_idx],\n                    self._heap[cur_idx],\n                )\n            cur_idx = parent_idx\n\n    def _perc_down(self, cur_idx):\n        \"\"\"Move a node down\"\"\"\n        while 2 * cur_idx + 1 < len(self._heap):\n            min_child_idx = self._get_min_child(cur_idx)\n            if self._heap[cur_idx] > self._heap[min_child_idx]:\n                self._heap[cur_idx], self._heap[min_child_idx] = (\n                    self._heap[min_child_idx],\n                    self._heap[cur_idx],\n                )\n            else:\n                return\n            cur_idx = min_child_idx\n\n    def _get_min_child(self, parent_idx):\n        \"\"\"Get a smaller child\"\"\"\n        if 2 * parent_idx + 2 > len(self._heap) - 1:\n            return 2 * parent_idx + 1\n        if self._heap[2 * parent_idx + 1] < self._heap[2 * parent_idx + 2]:\n            return 2 * parent_idx + 1\n        return 2 * parent_idx + 2\n\n    def heapify(self, not_a_heap, show_details=False):\n        \"\"\"Build a heap from any list\"\"\"\n        self._heap = not_a_heap[:]\n        cur_idx = len(self._heap) // 2 - 1\n        while cur_idx >= 0:\n            self._perc_down(cur_idx)\n            cur_idx = cur_idx - 1\n            if show_details:\n                print(self._heap)\n\n    def insert(self, item):\n        \"\"\"Add a new item\"\"\"\n        self._heap.append(item)\n        self._perc_up(len(self._heap) - 1)\n\n    def delete(self):\n        \"\"\"Remove an item\"\"\"\n        self._heap[0], self._heap[-1] = self._heap[-1], self._heap[0]\n        result = self._heap.pop()\n        self._perc_down(0)\n        return result\n\n    def is_empty(self):\n        \"\"\"Check if the heap is empty\"\"\"\n        return not bool(self._heap)\n\n    def __len__(self):\n        \"\"\"Get heap size\"\"\"\n        return len(self._heap)\n\n    def __str__(self):\n        \"\"\"Heap as a string\"\"\"\n        return str(self._heap)\n\n    def __contains__(self, item):\n        \"\"\"__contains__in method override\"\"\"\n        return item in self._heap\n","src/lib/pythonds3/trees/binary_search_tree.py":"#!/usr/bin/env python3\n\"\"\"\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005, 2010\nUpdated by Roman Yasinovskyy, 2017\n\"\"\"\n\n\nclass BinaryTreeNode:\n    \"\"\"Binary Tree Node class\"\"\"\n\n    def __init__(self, key, value, left=None, right=None, parent=None):\n        \"\"\"Create new Tree Node\"\"\"\n        self._key = key\n        self._value = value\n        self._child_left = left\n        self._child_right = right\n        self._parent = parent\n\n    def get_child_left(self):\n        \"\"\"Return the node's left child\"\"\"\n        return self._child_left\n\n    def set_child_left(self, node):\n        \"\"\"Assign the node's left child\"\"\"\n        self._child_left = node\n\n    child_left = property(get_child_left, set_child_left)\n\n    def get_child_right(self):\n        \"\"\"Return the node's right child\"\"\"\n        return self._child_right\n\n    def set_child_right(self, node):\n        \"\"\"Assign the node's right child\"\"\"\n        self._child_right = node\n\n    child_right = property(get_child_right, set_child_right)\n\n    def get_parent(self):\n        \"\"\"Return the node's parent\"\"\"\n        return self._parent\n\n    def set_parent(self, node):\n        \"\"\"Assign the node's parent\"\"\"\n        self._parent = node\n\n    parent = property(get_parent, set_parent)\n\n    def is_child_left(self):\n        \"\"\"Check if the node is a left child\"\"\"\n        return self._parent and self._parent.child_left == self\n\n    def is_child_right(self):\n        \"\"\"Check if the node is a right child\"\"\"\n        return self._parent and self._parent.child_right == self\n\n    def is_root(self):\n        \"\"\"Check if the node is a tree root\"\"\"\n        return not self._parent\n\n    def is_leaf(self):\n        \"\"\"Check if the node is a leaf\"\"\"\n        return not (self._child_right or self._child_left)\n\n    def has_a_child(self):\n        \"\"\"Check if the node has any child\"\"\"\n        return self._child_right or self._child_left\n\n    def has_children(self):\n        \"\"\"Check if the node has both children\"\"\"\n        return self._child_right and self._child_left\n\n    def get_key(self):\n        \"\"\"Get node key\"\"\"\n        return self._key\n\n    def set_key(self, key):\n        \"\"\"Set node key\"\"\"\n        self._key = key\n\n    key = property(get_key, set_key)\n\n    def get_value(self):\n        \"\"\"Get node value\"\"\"\n        return self._value\n\n    def set_value(self, value):\n        \"\"\"Set node value\"\"\"\n        self._value = value\n\n    value = property(get_value, set_value)\n\n    def replace_payload(self, key, value, left, right):\n        \"\"\"Change node payload\"\"\"\n        self._key = key\n        self._value = value\n        self._child_left = left\n        self._child_right = right\n        if self.child_left:\n            self._child_left.parent = self\n        if self.child_right:\n            self._child_right.parent = self\n\n    def find_successor(self):\n        \"\"\"Find the node's successor\"\"\"\n        successor = None\n        if self._child_right:\n            successor = self._child_right.find_min()\n        else:\n            if self._parent:\n                if self.is_child_left():\n                    successor = self._parent\n                else:\n                    self._parent.child_right = None\n                    successor = self._parent.find_successor()\n                    self._parent.child_right = self\n        return successor\n\n    def find_min(self):\n        \"\"\"Find the smallest node in the right subtree\"\"\"\n        current = self\n        while current.child_left:\n            current = current.child_left\n        return current\n\n    def splice_out(self):\n        \"\"\"Splice out\"\"\"\n        if self.is_leaf():\n            if self.is_child_left():\n                self._parent.child_left = None\n            else:\n                self._parent.child_right = None\n        elif self.has_a_child():\n            if self.child_left:\n                if self.is_child_left():\n                    self._parent.child_left = self._child_left\n                else:\n                    self._parent.child_right = self._child_left\n                self._child_left.parent = self._parent\n            else:\n                if self.is_child_left():\n                    self._parent.child_left = self._child_right\n                else:\n                    self._parent.child_right = self._child_right\n                self._child_right.parent = self._parent\n\n    def __iter__(self):\n        \"\"\"The standard inorder traversal of a binary tree\"\"\"\n        if self:\n            if self._child_left:\n                for elem in self._child_left:\n                    yield elem\n            yield self._key\n            if self._child_right:\n                for elem in self._child_right:\n                    yield elem\n\n\nclass BinarySearchTree:\n    \"\"\"Binary search tree implementation\"\"\"\n\n    def __init__(self):\n        self._root = None\n        self._size = 0\n\n    def __len__(self):\n        \"\"\"Tree size\"\"\"\n        return self._size\n\n    def size(self):\n        \"\"\"Tree size\"\"\"\n        return self._size\n\n    def __iter__(self):\n        \"\"\"Iterator\"\"\"\n        return self._root.__iter__()\n\n    def __getitem__(self, key):\n        \"\"\"[] getter operator override\"\"\"\n        result = self.get(key)\n        if result:\n            return result\n        raise KeyError(\"Error, key not in tree\")\n\n    def get_root(self):\n        \"\"\"Get tree root\"\"\"\n        return self._root\n\n    def set_root(self, node):\n        \"\"\"Set tree root\"\"\"\n        self._root = node\n\n    root = property(get_root, set_root)\n\n    def get(self, key):\n        \"\"\"Retrieve a value by the key\"\"\"\n        if self._root:\n            result = self._get(key, self._root)\n            if result:\n                return result.value\n            return None\n        else:\n            return None\n\n    def _get(self, key, current_node):\n        \"\"\"Retrieve a value by the key (helper function)\"\"\"\n        if not current_node:\n            return None\n        if current_node.key == key:\n            return current_node\n        elif key < current_node.key:\n            return self._get(key, current_node.child_left)\n        else:\n            return self._get(key, current_node.child_right)\n\n    def __setitem__(self, key, value):\n        \"\"\"[] setter operator override\"\"\"\n        self.put(key, value)\n\n    def put(self, key, value):\n        \"\"\"Add new node\"\"\"\n        if self._root:\n            self._put(key, value, self._root)\n        else:\n            self._root = BinaryTreeNode(key, value)\n        self._size = self._size + 1\n\n    def _put(self, key, value, current_node):\n        \"\"\"Add new node (helper function)\"\"\"\n        if key < current_node.key:\n            if current_node.child_left:\n                self._put(key, value, current_node.child_left)\n            else:\n                current_node.child_left = BinaryTreeNode(\n                    key, value, parent=current_node\n                )\n        else:\n            if current_node.child_right:\n                self._put(key, value, current_node.child_right)\n            else:\n                current_node.child_right = BinaryTreeNode(\n                    key, value, parent=current_node\n                )\n\n    def __contains__(self, key):\n        \"\"\"in operator override\"\"\"\n        return bool(self._get(key, self._root))\n\n    def __delitem__(self, key):\n        \"\"\"del operator override\"\"\"\n        self.delete(key)\n\n    def delete(self, key):\n        \"\"\"Remove a node by its key\"\"\"\n        if self._size > 1:\n            node_to_remove = self._get(key, self._root)\n            if node_to_remove:\n                self._delete(node_to_remove)\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 _delete(self, current_node):\n        \"\"\"Remove a node by its key (helper function)\"\"\"\n        if current_node.is_leaf():  # removing a leaf\n            if current_node == current_node.parent.child_left:\n                current_node.parent.child_left = None\n            else:\n                current_node.parent.child_right = None\n        elif current_node.has_children():  # removing a node with two children\n            successor = current_node.find_successor()\n            successor.splice_out()\n            current_node.key = successor.key\n            current_node.value = successor.value\n        else:  # removing a node with one child\n            if current_node.get_child_left():\n                if current_node.is_child_left():\n                    current_node.child_left.parent = current_node.parent\n                    current_node.parent.child_left = current_node.child_left\n                elif current_node.is_child_right():\n                    current_node.child_left.parent = current_node.parent\n                    current_node.parent.child_right = current_node.child_left\n                else:\n                    current_node.replace_payload(\n                        current_node.child_left.key,\n                        current_node.child_left.value,\n                        current_node.child_left.child_left,\n                        current_node.child_left.child_right,\n                    )\n            else:\n                if current_node.is_child_left():\n                    current_node.child_right.parent = current_node.parent\n                    current_node.parent.child_left = current_node.child_right\n                elif current_node.is_child_right():\n                    current_node.child_right.parent = current_node.parent\n                    current_node.parent.child_right = current_node.child_right\n                else:\n                    current_node.replace_payload(\n                        current_node.child_right.key,\n                        current_node.child_right.value,\n                        current_node.child_right.child_left,\n                        current_node.child_right.child_right,\n                    )\n\n    def inorder(self):\n        \"\"\"In-order tree traversal\"\"\"\n        self._inorder(self._root)\n\n    def _inorder(self, tree):\n        \"\"\"In-order tree traversal (helper function)\"\"\"\n        if tree:\n            self._inorder(tree.child_left)\n            print(tree.key, end=\" \")\n            self._inorder(tree.child_right)\n\n    def postorder(self):\n        \"\"\"Post-order tree traversal\"\"\"\n        self._postorder(self._root)\n\n    def _postorder(self, tree):\n        \"\"\"Post-order tree traversal (helper function)\"\"\"\n        if tree:\n            self._postorder(tree.child_left)\n            self._postorder(tree.child_right)\n            print(tree.key, end=\" \")\n\n    def preorder(self):\n        \"\"\"Pre-order tree traversal\"\"\"\n        self._preorder(self._root)\n\n    def _preorder(self, tree):\n        \"\"\"Pre-order tree traversal (helper function)\"\"\"\n        if tree:\n            print(tree.key, end=\" \")\n            self._preorder(tree.child_left)\n            self._preorder(tree.child_right)\n\n    def clear(self):\n        \"\"\"Remove all nodes\"\"\"\n        while self._root:\n            self.delete(self._root.key)\n","src/lib/pythonds3/trees/binary_tree.py":"#!/usr/bin/env python3\n\"\"\"\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n\"\"\"\n\nimport operator\n\n\nclass BinaryTree:\n    \"\"\"\n    A recursive implementation of Binary Tree\n    Using links and Nodes approach.\n\n    Modified to allow for trees to be constructed from other trees\n    rather than always creating a new tree in the insert_feft or insert_right\n    \"\"\"\n\n    def __init__(self, key):\n        \"\"\"Create new tree\"\"\"\n        self._key = key\n        self._child_left = None\n        self._child_right = None\n\n    def get_root_val(self):\n        \"\"\"Get root key value\"\"\"\n        return self._key\n\n    def set_root_val(self, key):\n        \"\"\"Set root key value\"\"\"\n        self._key = key\n\n    root = property(get_root_val, set_root_val)\n\n    def get_child_left(self):\n        \"\"\"Get left child\"\"\"\n        return self._child_left\n\n    def set_child_left(self, node):\n        \"\"\"Set left child\"\"\"\n        self._child_left = node\n\n    child_left = property(get_child_left, set_child_left)\n\n    def get_child_right(self):\n        \"\"\"Get right child\"\"\"\n        return self._child_right\n\n    def set_child_right(self, node):\n        \"\"\"Set right child\"\"\"\n        self._child_right = node\n\n    child_right = property(get_child_right, set_child_right)\n\n    def is_leaf(self):\n        \"\"\"Check if a node is leaf\"\"\"\n        return (not self._child_left) and (not self._child_right)\n\n    def insert_left(self, new_node):\n        \"\"\"Insert left subtree\"\"\"\n        if isinstance(new_node, BinaryTree):\n            new_subtree = new_node\n        else:\n            new_subtree = BinaryTree(new_node)\n\n        if self._child_left:\n            new_subtree.set_child_left(self._child_left)\n\n        self._child_left = new_subtree\n\n    def insert_right(self, new_node):\n        \"\"\"Insert right subtree\"\"\"\n        if isinstance(new_node, BinaryTree):\n            new_subtree = new_node\n        else:\n            new_subtree = BinaryTree(new_node)\n\n        if self._child_right:\n            new_subtree.set_child_right(self._child_right)\n        self._child_right = new_subtree\n\n    def preorder(self):\n        \"\"\"Pre-order tree traversal\"\"\"\n        print(self._key, end=\" \")\n        if self._child_left:\n            self._child_left.preorder()\n        if self._child_right:\n            self._child_right.preorder()\n\n    def inorder(self):\n        \"\"\"In-order tree traversal\"\"\"\n        if self._child_left:\n            self._child_left.inorder()\n        print(self._key, end=\" \")\n        if self._child_right:\n            self._child_right.inorder()\n\n    def postorder(self):\n        \"\"\"Post-order tree traversal\"\"\"\n        if self._child_left:\n            self._child_left.postorder()\n        if self._child_right:\n            self._child_right.postorder()\n        print(self._key, end=\" \")\n\n    def print_exp(self):\n        \"\"\"Print an expression\"\"\"\n        if self._child_left:\n            print(\"(\", end=\" \")\n            self._child_left.print_exp()\n        print(self._key, end=\" \")\n        if self._child_right:\n            self._child_right.print_exp()\n            print(\")\", end=\" \")\n\n    def postorder_eval(self):\n        \"\"\"Postorder evaluation\"\"\"\n        operations = {\n            \"+\": operator.add,\n            \"-\": operator.sub,\n            \"*\": operator.mul,\n            \"/\": operator.truediv,\n        }\n        result_1 = None\n        result_2 = None\n        if self._child_left:\n            result_1 = self._child_left.postorder_eval()\n        if self._child_right:\n            result_2 = self._child_right.postorder_eval()\n        if result_1 and result_2:\n            return operations[self._key](result_1, result_2)\n        return self._key\n\n    def height(self):\n        \"\"\"Height of a tree\"\"\"\n        if not self._key:\n            return -1\n        if self._child_left:\n            height_left = self._child_left.height()\n        else:\n            height_left = -1\n\n        if self._child_right:\n            height_right = self._child_right.height()\n        else:\n            height_right = -1\n\n        return 1 + max(height_left, height_right)\n\n    def __len__(self):\n        \"\"\"Size of a tree\"\"\"\n        return self.size()\n\n    def size(self):\n        \"\"\"Count nodes in a tree\"\"\"\n        if not self._key:\n            return 0\n        if self._child_left:\n            children_left = self._child_left.size()\n        else:\n            children_left = 0\n\n        if self._child_right:\n            children_right = self._child_right.size()\n        else:\n            children_right = 0\n\n        return 1 + children_left + children_right\n","src/lib/pythonds3/trees/priority_queue.py":"#!/usr/bin/env python3\n\"\"\"\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n\"\"\"\n\nfrom pythonds3.trees.binary_heap import BinaryHeap\n\n\nclass PriorityQueue(BinaryHeap):\n    \"\"\"\n    This implementation of binary heap takes (key, value) pairs where key signifies priority\n    We will assume that the keys are all comparable.\n    \"\"\"\n\n    def change_priority(self, new_priority, value):\n        \"\"\"Change the priority\"\"\"\n        key_to_move = 0\n        for i in range(len(self._heap)):\n            if self._heap[i][1] == value:\n                key_to_move = i\n                break\n        if key_to_move > -1:\n            self._heap[key_to_move] = (new_priority, self._heap[key_to_move][1])\n            self._perc_up(key_to_move)\n","src/lib/pythoned/__init__.py":"","src/lib/pythoned/arboles/__init__.py":"\n\n\nfrom .avl import ArbolAVL\nfrom .abb import ArbolBinarioBusqueda\nfrom .monticuloBinario import MonticuloBinario\n\n\n","src/lib/pythoned/arboles/abb.py":"# Bradley N. Miller, David L. Ranum\n# Solución de problemas con algoritmos y estructuras de datos usando Python\n# Copyright 2014\n#\n#abb.py\n\nclass ArbolBinarioBusqueda:\n\n    def __init__(self):\n        self.raiz = None\n        self.tamano = 0\n\n    def agregar(self,clave,valor):\n        if self.raiz:\n            self._agregar(clave,valor,self.raiz)\n        else:\n            self.raiz = NodoArbol(clave,valor)\n        self.tamano = self.tamano + 1\n\n    def _agregar(self,clave,valor,nodoActual):\n        if clave < nodoActual.clave:\n            if nodoActual.tieneHijoIzquierdo():\n                   self._agregar(clave,valor,nodoActual.hijoIzquierdo)\n            else:\n                   nodoActual.hijoIzquierdo = NodoArbol(clave,valor,padre=nodoActual)\n        else:\n            if nodoActual.tieneHijoDerecho():\n                   self._agregar(clave,valor,nodoActual.hijoDerecho)\n            else:\n                   nodoActual.hijoDerecho = NodoArbol(clave,valor,padre=nodoActual)\n \n    def __setitem__(self,c,v):\n        self.agregar(c,v)\n\n    def obtener(self,clave):\n        if self.raiz:\n            res = self._obtener(clave,self.raiz)\n            if res:\n                return res.cargaUtil\n            else:\n                return None\n        else:\n            return None\n\n    def _obtener(self,clave,nodoActual):\n    \tif not nodoActual:\n    \t    return None\n    \telif nodoActual.clave == clave:\n    \t    return nodoActual\n    \telif clave < nodoActual.clave:\n    \t    return self._obtener(clave,nodoActual.hijoIzquierdo)\n    \telse:\n    \t    return self._obtener(clave,nodoActual.hijoDerecho)        \n\n    def __getitem__(self,clave):\n        res = self.obtener(clave) \n        if res:\n            return res\n        else:\n            raise KeyError('Error, la clave no está en el árbol')\n\n    def __contains__(self,clave):\n    \tif self._obtener(clave,self.raiz):\n    \t    return True\n    \telse:\n    \t    return False\n       \n    def longitud(self):\n        return self.tamano\n\n    def __len__(self):\n        return self.tamano\n\n    def __iter__(self):\n        return self.raiz.__iter__()\n\n    def eliminar(self,clave):\n        if self.tamano > 1:\n           nodoAEliminar = self._obtener(clave,self.raiz)\n    \t   if nodoAEliminar:\n    \t       self.remover(nodoAEliminar)\n    \t       self.tamano = self.tamano-1\n    \t   else:\n    \t       raise KeyError('Error, la clave no está en el árbol')\n        elif self.tamano == 1 and self.raiz.clave == clave:\n    \t    self.raiz = None\n    \t    self.tamano = self.tamano - 1\n        else:\n    \t    raise KeyError('Error, la clave no está en el árbol')\n\n    def __delitem__(self,clave):\n        self.eliminar(clave)\n\n    def remover(self,nodoActual):\n        if nodoActual.esHoja(): #hoja\n            if nodoActual == nodoActual.padre.hijoIzquierdo:\n                nodoActual.padre.hijoIzquierdo = None\n            else:\n                nodoActual.padre.hijoDerecho = None\n        elif nodoActual.tieneAmbosHijos(): #interior\n            suc = nodoActual.encontrarSucesor()\n            suc.empalmar()\n            nodoActual.clave = suc.clave\n            nodoActual.cargaUtil = suc.cargaUtil\n\n        else: # este nodo tiene un (1) hijo\n            if nodoActual.tieneHijoIzquierdo():\n                if nodoActual.esHijoIzquierdo():\n                    nodoActual.hijoIzquierdo.padre = nodoActual.padre\n                    nodoActual.padre.hijoIzquierdo = nodoActual.hijoIzquierdo\n                elif nodoActual.esHijoDerecho():\n                    nodoActual.hijoIzquierdo.padre = nodoActual.padre\n                    nodoActual.padre.hijoDerecho = nodoActual.hijoIzquierdo\n                else:\n                    nodoActual.reemplazarDatoDeNodo(nodoActual.hijoIzquierdo.clave, nodoActual.hijoIzquierdo.cargaUtil, nodoActual.hijoIzquierdo.hijoIzquierdo, nodoActual.hijoIzquierdo.hijoDerecho)\n            else:\n                if nodoActual.esHijoIzquierdo():\n                    nodoActual.hijoDerecho.padre = nodoActual.padre\n                    nodoActual.padre.hijoIzquierdo = nodoActual.hijoDerecho\n                elif nodoActual.esHijoDerecho():\n                    nodoActual.hijoDerecho.padre = nodoActual.padre\n                    nodoActual.padre.hijoDerecho = nodoActual.hijoDerecho\n                else:\n                    nodoActual.reemplazarDatoDeNodo(nodoActual.hijoDerecho.clave, nodoActual.hijoDerecho.cargaUtil, nodoActual.hijoDerecho.hijoIzquierdo, nodoActual.hijoDerecho.hijoDerecho)\n\n    def inorden(self):\n        self._inorden(self.raiz)\n\n    def _inorden(self,arbol):\n        if arbol != None:\n            self._inorden(arbol.hijoIzquierdo)\n            print(arbol.clave)\n            self._inorden(arbol.hijoDerecho)\n\n    def postorden(self):\n        self._postorden(self.raiz)\n\n    def _postorden(self, arbol):\n        if arbol:\n            self._postorden(arbol.hijoDerecho)\n            self._postorden(arbol.hijoIzquierdo)\n            print(arbol.clave)            \n\n    def preorden(self):\n        self._preorden(self,self.raiz)\n\n    def _preorden(self,arbol):\n        if arbol:\n            print(arbol.clave)            \n            self._preorden(arbol.hijoIzquierdo)\n            self._preorden(arbol.hijoDerecho)\n\n\nclass NodoArbol:\n   def __init__(self,clave,valor,izquierdo=None,derecho=None,padre=None):\n        self.clave = clave\n        self.cargaUtil = valor\n        self.hijoIzquierdo = izquierdo\n        self.hijoDerecho = derecho\n        self.padre = padre\n        self.factorEquilibrio = 0\n\n    def tieneHijoIzquierdo(self):\n        return self.hijoIzquierdo\n       \n    def tieneHijoDerecho(self):\n        return self.hijoDerecho\n\n    def esHijoIzquierdo(self):\n        return self.padre and self.padre.hijoIzquierdo == self\n    \n    def esHijoDerecho(self):\n        return self.padre and self.padre.hijoDerecho == self\n\n    def esRaiz(self):\n        return not self.padre\n\n    def esHoja(self):\n        return not (self.hijoDerecho or self.hijoIzquierdo)\n\n    def tieneAlgunHijo(self):\n        return self.hijoDerecho or self.hijoIzquierdo\n\n    def tieneAmbosHijos(self):\n        return self.hijoDerecho and self.hijoIzquierdo\n\n    def reemplazarDatoDeNodo(self,clave,valor,hizq,hder):\n        self.clave = clave\n        self.cargaUtil = valor\n        self.hijoIzquierdo = hizq\n        self.hijoDerecho = hder\n        if self.tieneHijoIzquierdo():\n            self.hijoIzquierdo.padre = self\n        if self.tieneHijoDerecho():\n            self.hijoDerecho.padre = self    \n\n    def encontrarSucesor(self):\n        suc = None\n        if self.tieneHijoDerecho():\n            suc = self.hijoDerecho.encontrarMin()\n        else:\n            if self.padre:\n                if self.esHijoIzquierdo():\n                    suc = self.padre\n                else:\n                    self.padre.hijoDerecho = None\n                    suc = self.padre.encontrarSucesor()\n                    self.padre.hijoDerecho = self\n        return suc\n\n    def empalmar(self):\n        if self.esHoja():\n            if self.esHijoIzquierdo():\n                self.padre.hijoIzquierdo = None\n            else:\n                self.padre.hijoDerecho = None\n        elif self.tieneAlgunHijo():\n            if self.tieneHijoIzquierdo():\n                if self.esHijoIzquierdo():\n                    self.padre.hijoIzquierdo = self.hijoIzquierdo\n                else:\n                    self.padre.hijoDerecho = self.hijoIzquierdo\n                self.hijoIzquierdo.padre = self.padre\n            else:\n                if self.esHijoIzquierdo():\n                    self.padre.hijoIzquierdo = self.hijoDerecho\n                else:\n                    self.padre.hijoDerecho = self.hijoDerecho\n                self.hijoDerecho.padre = self.padre\n\n    def encontrarMin(self):\n        actual = self\n        while actual.tieneHijoIzquierdo():\n            actual = actual.hijoIzquierdo\n        return actual\n\n    def __iter__(self):\n        if self:\n    \t    if self.tieneHijoIzquierdo():\n    \t        for elem in self.hijoIzquierdo:\n    \t\t    yield elem\n            yield self.clave\n    \t    if self.tieneHijoDerecho():\n                for elem in self.hijoDerecho:\n    \t\t    yield elem\n","src/lib/pythoned/arboles/arbolBinario.py":"# Bradley N. Miller, David L. Ranum\n# Solución de problemas con algoritmos y estructuras de datos usando Python\n# Copyright 2014\n# \n#arbolBinario.py\n\nclass ArbolBinario:\n    def __init__(self,objetoRaiz):\n        self.clave = objetoRaiz\n        self.hijoIzquierdo = None\n        self.hijoDerecho = None\n    \n    def insertarIzquierdo(self,nuevoNodo):\n        if self.hijoIzquierdo == None:\n            self.hijoIzquierdo = ArbolBinario(nuevoNodo)\n        else:  \n            t = ArbolBinario(nuevoNodo)\n            t.hijoIzquierdo = self.hijoIzquierdo\n            self.hijoIzquierdo = t\n\n    def insertarDerecho(self,nuevoNodo):\n        if self.hijoDerecho == None:\n            self.hijoDerecho = ArbolBinario(nuevoNodo)\n        else:\n            t = ArbolBinario(nuevoNodo)\n            t.hijoDerecho = self.hijoDerecho\n            self.hijoDerecho = t\n\n    def esHoja(self):\n        return ((not self.hijoIzquierdo) and (not self.hijoDerecho))\n\n    def obtenerHijoDerecho(self):\n        return self.hijoDerecho\n    \n    def obtenerHijoIzquierdo(self):\n        return self.hijoIzquierdo\n    \n    def asignarValorRaiz(self,obj):\n        self.clave = obj\n\n    def obtenerValorRaiz(self):\n        return self.clave\n\n    def inorden(self):\n        if self.hijoIzquierdo:\n            self.hijoIzquierdo.inorden()\n        print(self.clave)\n        if self.hijoDerecho:\n            self.hijoDerecho.inorden()\n\n    def postorden(self):\n        if self.hijoIzquierdo:\n            self.hijoIzquierdo.postorden()\n        if self.hijoDerecho:\n            self.hijoDerecho.postorden()\n        print(self.clave)\n\n    def preorden(self):\n        print(self.clave)\n        if self.hijoIzquierdo:\n            self.hijoIzquierdo.preorden()\n        if self.hijoDerecho:\n            self.hijoDerecho.preorden()\n\n    def imprimirExpresion(self):\n        if self.hijoIzquierdo:\n            print('(', end=' ')\n            self.hijoIzquierdo.imprimirExpresion()\n        print(self.clave, end=' ')\n        if self.hijoDerecho:\n            self.hijoDerecho.imprimirExpresion()\n            print(')', end=' ')\n\n    def evalPostorden(self):\n        opers = {'+':operator.add, '-':operator.sub, '*':operator.mul, '/':operator.truediv}\n        res1 = None\n        res2 = None\n        if self.hijoIzquierdo:\n            res1 = self.hijoIzquierdo.evalPostorden()  #// \\label{peleft}\n        if self.hijoDerecho:\n            res2 = self.hijoDerecho.evalPostorden() #// \\label{peright}\n        if res1 and res2:\n            return opers[self.clave](res1,res2) #// \\label{peeval}\n        else:\n            return self.clave\n\ndef inorden(arbol):\n    if arbol != None:\n        inorden(arbol.obtenerHijoIzquierdo())\n        print(arbol.obtenerValorRaiz())\n        inorden(arbol.obtenerHijoDerecho())\n\ndef imprimirExpresion(arbol):\n    if arbol.hijoIzquierdo:\n        print('(', end=' ')\n        imprimirExpresion(arbol.obtenerHijoIzquierdo())\n    print(arbol.obtenerValorRaiz(), end=' ')\n    if arbol.hijoDerecho:\n        imprimirExpresion(arbol.obtenerHijoDerecho())\n        print(')', end=' ') \n\ndef imprimirExpresion(arbol):\n  valorCadena = \"\"\n  if arbol:\n      valorCadena = '(' + imprimirExpresion(arbol.obtenerHijoIzquierdo())\n      valorCadena = valorCadena + str(arbol.obtenerValorRaiz())\n      valorCadena = valorCadena + imprimirExpresion(arbol.obtenerHijoDerecho())+')'\n  return valorCadena\n\ndef evalPostorden(arbol):\n    operadores = {'+':operator.add, '-':operator.sub, '*':operator.mul, '/':operator.truediv}\n    res1 = None\n    res2 = None\n    if arbol:\n        res1 = evalPostorden(arbol.obtenerHijoIzquierdo()) #// \\label{peleft}\n        res2 = evalPostorden(arbol.obtenerHijoDerecho())  #// \\label{peright}\n        if res1 and res2:\n            return operadores[arbol.obtenerValorRaiz()](res1,res2) #// \\label{peeval}\n        else:\n            return arbol.obtenerValorRaiz()\n\ndef altura(arbol):\n    if arbol == None:\n        return -1\n    else:\n        return 1 + max(altura(arbol.hijoIzquierdo),altura(arbol.hijoDerecho))\n\nt = ArbolBinario(7)\nt.insertarIzquierdo(3)\nt.insertarDerecho(9)\ninorden(t)\nimport operator\nx = ArbolBinario('*')\nx.insertarIzquierdo('+')\nl = x.obtenerHijoIzquierdo()\nl.insertarIzquierdo(4)\nl.insertarDerecho(5)\nx.insertarDerecho(7)\nprint(imprimirExpresion(x))\nprint(evalPostorden(x))\nprint(altura(x))\n","src/lib/pythoned/arboles/avl.py":"# Bradley N. Miller, David L. Ranum\n# Solución de problemas con algoritmos y estructuras de datos usando Python\n# Copyright 2014\n#\n#avl.py\n\nfrom .abb import ArbolBinarioBusqueda, NodoArbol\n\nclass ArbolAVL(ArbolBinarioBusqueda):\n\n    def _agregar(self,clave,valor,nodoActual):\n    \tif clave < nodoActual.clave:\n    \t    if nodoActual.tieneHijoIzquierdo():\n    \t\tself._agregar(clave,valor,nodoActual.hijoIzquierdo)\n    \t    else:\n    \t\tnodoActual.hijoIzquierdo = NodoArbol(clave,valor,padre=nodoActual)\n    \t\tself.actualizarEquilibrio(nodoActual.hijoIzquierdo)\n    \telse:\n    \t    if nodoActual.tieneHijoDerecho():\n    \t\tself._agregar(clave,valor,nodoActual.hijoDerecho)\n    \t    else:\n    \t\tnodoActual.hijoDerecho = NodoArbol(clave,valor,padre=nodoActual)\n    \t\tself.actualizarEquilibrio(nodoActual.hijoDerecho)\n\n    def actualizarEquilibrio(self,nodo):\n    \tif nodo.factorEquilibrio > 1 or nodo.factorEquilibrio < -1:\n    \t    self.reequilibrar(nodo)    \n    \t    return\n    \tif nodo.padre != None:\n    \t    if nodo.esHijoIzquierdo():\n    \t\t    nodo.padre.factorEquilibrio += 1\n    \t    elif nodo.esHijoDerecho():\n    \t\t    nodo.padre.factorEquilibrio -= 1\n\n    \t    if nodo.padre.factorEquilibrio != 0:\n    \t\t    self.actualizarEquilibrio(nodo.padre)\n\n    def reequilibrar(self,nodo):\n        if nodo.factorEquilibrio < 0:\n\t    if nodo.hijoDerecho.factorEquilibrio > 0:\n\t        self.rotarDerecha(nodo.hijoDerecho)\n\t        self.rotarIzquierda(nodo)\n\t    else:\n\t        self.rotarIzquierda(nodo)\n        elif nodo.factorEquilibrio > 0:\n\t    if nodo.hijoIzquierdo.factorEquilibrio < 0:\n\t        self.rotarIzquierda(nodo.hijoIzquierdo)\n\t        self.rotarDerecha(nodo)\n\t     else:\n\t        self.rotarDerecha(nodo)\n           \n    def rotarIzquierda(self,rotRaiz):\n    \tnuevaRaiz = rotRaiz.hijoDerecho\n    \trotRaiz.hijoDerecho = nuevaRaiz.hijoIzquierdo\n    \tif nuevaRaiz.hijoIzquierdo != None:\n    \t    nuevaRaiz.hijoIzquierdo.padre = rotRaiz\n    \tnuevaRaiz.padre = rotRaiz.padre\n    \tif rotRaiz.esRaiz():\n    \t    self.raiz = nuevaRaiz\n    \telse:\n    \t    if rotRaiz.esHijoIzquierdo():\n    \t        rotRaiz.padre.hijoIzquierdo = nuevaRaiz\n    \t    else:\n    \t    \trotRaiz.padre.hijoDerecho = nuevaRaiz\n    \tnuevaRaiz.hijoIzquierdo = rotRaiz\n    \trotRaiz.padre = nuevaRaiz\n    \trotRaiz.factorEquilibrio = rotRaiz.factorEquilibrio + 1 - min(nuevaRaiz.factorEquilibrio, 0)\n    \tnuevaRaiz.factorEquilibrio = nuevaRaiz.factorEquilibrio + 1 + max(rotRaiz.factorEquilibrio, 0)\n\n    def rotarDerecha(self,rotRaiz):\n        nuevaRaiz = rotRaiz.hijoIzquierdo\n        rotRaiz.hijoIzquierdo = nuevaRaiz.hijoDerecho\n        if nuevaRaiz.hijoDerecho != None:\n            nuevaRaiz.hijoDerecho.padre = rotRaiz\n        nuevaRaiz.padre = rotRaiz.padre\n        if rotRaiz.esRaiz():\n            self.raiz = nuevaRaiz\n        else:\n            if rotRaiz.esHijoDerecho():\n                rotRaiz.padre.hijoDerecho = nuevaRaiz\n            else:\n                rotRaiz.padre.hijoIzquierdo = nuevaRaiz\n        nuevaRaiz.hijoDerecho = rotRaiz\n        rotRaiz.padre = nuevaRaiz\n        rotRaiz.factorEquilibrio = rotRaiz.factorEquilibrio - 1 - max(nuevaRaiz.factorEquilibrio, 0)\n        nuevaRaiz.factorEquilibrio = nuevaRaiz.factorEquilibrio - 1 + min(rotRaiz.factorEquilibrio, 0)  \n\n","src/lib/pythoned/arboles/monticuloBinario.py":"# Bradley N. Miller, David L. Ranum\n# Solución de problemas con algoritmos y estructuras de datos usando Python\n# Copyright 2014\n# \n#monticuloBinario.py\n\nclass MonticuloBinario:\n    def __init__(self):\n        self.listaMonticulo = [0]\n        self.tamanoActual = 0\n\n    def construirMonticulo(self,unaLista):\n        i = len(unaLista) // 2\n        self.tamanoActual = len(unaLista)\n        self.listaMonticulo = [0] + unaLista[:]\n        print(len(self.listaMonticulo), i)\n        while (i > 0):\n            print(self.listaMonticulo, i)\n            self.infiltAbajo(i)\n            i = i - 1\n        print(self.listaMonticulo,i)\n                        \n    def infiltAbajo(self,i):\n        while (i * 2) <= self.tamanoActual:\n            hm = self.hijoMin(i)\n            if self.listaMonticulo[i] > self.listaMonticulo[hm]:\n                tmp = self.listaMonticulo[i]\n                self.listaMonticulo[i] = self.listaMonticulo[hm]\n                self.listaMonticulo[hm] = tmp\n            i = hm\n                \n    def hijoMin(self,i):\n        if i * 2 + 1 > self.tamanoActual:\n            return i * 2\n        else:\n            if self.listaMonticulo[i * 2] < self.listaMonticulo[i * 2 + 1]:\n                return i * 2\n            else:\n                return i * 2 + 1\n\n    def infiltArriba(self,i):\n        while i // 2 > 0:\n            if self.listaMonticulo[i] < self.listaMonticulo[i//2]:\n               tmp = self.listaMonticulo[i // 2]\n               self.listaMonticulo[i // 2] = self.listaMonticulo[i]\n               self.listaMonticulo[i] = tmp\n            i = i // 2\n \n    def insertar(self,k):\n        self.listaMonticulo.append(k)\n        self.tamanoActual = self.tamanoActual + 1\n        self.infiltArriba(self.tamanoActual)\n\n    def eliminarMin(self):\n        valorSacado = self.listaMonticulo[1]\n        self.listaMonticulo[1] = self.listaMonticulo[self.tamanoActual]\n        self.tamanoActual = self.tamanoActual - 1\n        self.listaMonticulo.pop()\n        self.infiltAbajo(1)\n        return valorSacado\n        \n    def estaVacio(self):\n        if tamanoActual == 0:\n            return True\n        else:\n            return False\n","src/lib/pythoned/basicas/__init__.py":"\n#__all__ = [\"pila\"]\n\n\nfrom .pila import Pila\nfrom .cola import Cola\nfrom .coladoble import ColaDoble\n\n\n","src/lib/pythoned/basicas/cola.py":"# Bradley N. Miller, David L. Ranum\n# Solución de problemas con algoritmos y estructuras de datos usando Python\n# Copyright 2014\n#\n#cola.py\n\nclass Cola:\n    def __init__(self):\n        self.items = []\n\n    def estaVacia(self):\n        return self.items == []\n\n    def agregar(self, item):\n        self.items.insert(0,item)\n\n    def avanzar(self):\n        return self.items.pop()\n\n    def tamano(self):\n        return len(self.items)\n","src/lib/pythoned/basicas/coladoble.py":"# Bradley N. Miller, David L. Ranum\n# Solución de problemas con algoritmos y estructuras de datos usando Python\n# Copyright 2014\n# \n#coladoble.py\n\nclass ColaDoble:\n    def __init__(self):\n        self.items = []\n\n    def estaVacia(self):\n        return self.items == []\n\n    def agregarFrente(self, item):\n        self.items.append(item)\n\n    def agregarFinal(self, item):\n        self.items.insert(0,item)\n\n    def removerFrente(self):\n        return self.items.pop()\n\n    def removerFinal(self):\n        return self.items.pop(0)\n\n    def tamano(self):\n        return len(self.items)\n","src/lib/pythoned/basicas/pila.py":"# Bradley N. Miller, David L. Ranum\n# Solución de problemas con algoritmos y estructuras de datos usando Python\n# Copyright 2014\n# \n#pila.py\n\nclass Pila:\n    def __init__(self):\n        self.items = []\n\n    def estaVacia(self):\n        return self.items == []\n\n    def incluir(self, item):\n        self.items.append(item)\n\n    def extraer(self):\n        return self.items.pop()\n\n    def inspeccionar(self):\n        return self.items[len(self.items)-1]\n\n    def tamano(self):\n        return len(self.items)\n","src/lib/pythoned/grafos/__init__.py":"\n\nfrom .grafoAdy import Grafo\nfrom .grafoAdy import Vertice\nfrom .colaPrioridad import ColaPrioridad\n","src/lib/pythoned/grafos/colaPrioridad.py":"# Bradley N. Miller, David L. Ranum\n# Solución de problemas con algoritmos y estructuras de datos usando Python\n# Copyright 2014\n# \n#colaPrioridad.py\n\nclass ColaPrioridad:\n    def __init__(self):\n        self.arregloMonticulo = [(0,0)]\n        self.tamanoActual = 0\n\n    def construirMonticulo(self,unaLista):\n        self.tamanoActual = len(unaLista)\n        self.arregloMonticulo = [(0,0)]\n        for i in unaLista:\n            self.arregloMonticulo.append(i)\n        i = len(unaLista) // 2            \n        while (i > 0):\n            self.infiltAbajo(i)\n            i = i - 1\n                        \n    def infiltAbajo(self,i):\n        while (i * 2) <= self.tamanoActual:\n            hm = self.hijoMin(i)\n            if self.arregloMonticulo[i][0] > self.arregloMonticulo[hm][0]:\n                tmp = self.arregloMonticulo[i]\n                self.arregloMonticulo[i] = self.arregloMonticulo[hm]\n                self.arregloMonticulo[hm] = tmp\n            i = hm\n                \n    def hijoMin(self,i):\n        if i*2 > self.tamanoActual:\n            return -1\n        else:\n            if i*2 + 1 > self.tamanoActual:\n                return i*2\n            else:\n                if self.arregloMonticulo[i*2][0] < self.arregloMonticulo[i*2+1][0]:\n                    return i*2\n                else:\n                    return i*2+1\n\n    def infiltArriba(self,i):\n        while i // 2 > 0:\n            if self.arregloMonticulo[i][0] < self.arregloMonticulo[i//2][0]:\n               tmp = self.arregloMonticulo[i//2]\n               self.arregloMonticulo[i//2] = self.arregloMonticulo[i]\n               self.arregloMonticulo[i] = tmp\n            i = i//2\n \n    def insertar(self,k):\n        self.arregloMonticulo.append(k)\n        self.tamanoActual = self.tamanoActual + 1\n        self.infiltArriba(self.tamanoActual)\n\n    def eliminarMin(self):\n        valorSacado = self.arregloMonticulo[1][1]\n        self.arregloMonticulo[1] = self.arregloMonticulo[self.tamanoActual]\n        self.tamanoActual = self.tamanoActual - 1\n        self.arregloMonticulo.pop()\n        self.infiltAbajo(1)\n        return valorSacado\n        \n    def estaVacia(self):\n        if self.tamanoActual == 0:\n            return True\n        else:\n            return False\n\n    def decrementarClave(self,valor,nuevo):\n        hecho = False\n        i = 1\n        miClave = 0\n        while not hecho and i <= self.tamanoActual:\n            if self.arregloMonticulo[i][1] == valor:\n                hecho = True\n                miClave = i\n            else:\n                i = i + 1\n        if miClave > 0:\n            self.arregloMonticulo[miClave] = (nuevo,self.arregloMonticulo[miClave][1])\n            self.infiltArriba(miClave)\n            \n    def __contains__(self,vertice):\n        for pareja in self.arregloMonticulo:\n            if pareja[1] == vertice:\n                return True\n        return False     \n\n","src/lib/pythoned/grafos/grafoAdy.py":"# Bradley N. Miller, David L. Ranum\n# Solución de problemas con algoritmos y estructuras de datos usando Python\n# Copyright 2014\n#\n#grafoAdy.py\n\n\nimport sys\n\nclass Grafo:\n    def __init__(self):\n        self.listaVertices = {}\n        self.numVertices = 0\n        \n    def agregarVertice(self,clave):\n        self.numVertices = self.numVertices + 1\n        nuevoVertice = Vertice(clave)\n        self.listaVertices[clave] = nuevoVertice\n        return nuevoVertice\n    \n    def obtenerVertice(self,n):\n        if n in self.listaVertices:\n            return self.listaVertices[n]\n        else:\n            return None\n\n    def __contains__(self,n):\n        return n in self.listaVertices\n    \n    def agregarArista(self,de,a,costo=0):\n            if de not in self.listaVertices:\n                nv = self.agregarVertice(de)\n            if a not in self.listaVertices:\n                nv = self.agregarVertice(a)\n            self.listaVertices[de].agregarVecino(self.listaVertices[a],costo)\n    \n    def obtenerVertices(self):\n        return list(self.listaVertices.keys())\n        \n    def __iter__(self):\n        return iter(self.listaVertices.values())\n                \nclass Vertice:\n    def __init__(self,clave):\n        self.id = clave\n        self.conectadoA = {}\n        self.color = 'blanco'\n        self.dist = sys.maxsize\n        self.predecesor = None\n        self.desc = 0\n        self.fin = 0\n\n    # def __lt__(self,o):\n    #     return self.id < o.id\n    \n    def  agregarVecino(self,vecino,ponderacion=0):\n        self.conectadoA[vecino] = ponderacion\n        \n    def asignarColor(self,color):\n        self.color = color\n        \n    def asignarDistancia(self,d):\n        self.dist = d\n\n    def asignarPredecesor(self,p):\n        self.predecesor = p\n\n    def asignarDescubrimiento(self,tiempoDescubrimiento):\n        self.desc = tiempoDescubrimiento\n        \n    def asignarFinalizacion(self,tiempoFinalizacion):\n        self.fin = tiempoFinalizacion\n        \n    def obtenerFinalizacion(self):\n        return self.fin\n        \n    def obtenerDescubrimiento(self):\n        return self.desc\n        \n    def obtenerPredecesor(self):\n        return self.predecesor\n        \n    def obtenerDistancia(self):\n        return self.dist\n        \n    def obtenerColor(self):\n        return self.color\n    \n    def obtenerConexiones(self):\n        return self.conectadoA.keys()\n        \n    def obtenerPonderacion(self,vecino):\n        return self.conectadoA[vecino]\n                \n    def __str__(self):\n        return str(self.id) + \":color \" + self.color + \":desc \" + str(self.desc) + \":fin \" + str(self.fin) + \":distancia \" + str(self.dist) + \":predecesor \\n\\t[\" + str(self.predecesor)+ \"]\\n\"\n    \n    def obtenerId(self):\n        return self.id\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.remapToJs(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/requests.py":"# most restricted version\n\"\"\"\nThis solution works in runestone - however it is much more limited.\nAn error does not occur in the same way in the textbook as it does\nfor the command line. Since HTTPError is not currently available in\nRunestone, I had to change the exception.\nDecode and Encode are not available in Runestone, so there might be\nissues with reponses.\nDoes not use the status attribute for urlopen, would be nice to have\nthat back.\nDoes not work on regular web pages (like google or the michigan daily) because of cross-site scripting limits.\n\"\"\"\nfrom urllib.request import urlopen\nimport json\n\nclass Response:\n    def __init__(self, data, url):\n        self.text = data\n        self.url = url\n\n    def json(self):\n        try:\n            return json.loads(self.text)\n        except:\n            return {\"error\": \"Response not interpretable as json. Try printing the .text attribute\"}\n\n    def __str__(self):\n        return \"<A Response object for the following request: {}>\".format(self.url)\n\n\nurl_subs = {\" \": \"+\",\n            \"!\": \"%21\",\n            '\"': \"%22\",\n            \"#\": \"%23\",\n            \"$\": \"%24\",\n            \"'\": \"%27\",\n            \"(\": \"%28\",\n            \")\": \"%29\",\n            \"*\": \"%2A\",\n            \"+\": \"%2B\",\n            \",\": \"%2C\",\n            \"/\": \"%2F\",\n            \":\": \"%3A\",\n            \";\": \"%3B\",\n            \"=\": \"%3D\",\n            \"?\": \"%3F\",\n            \"@\": \"%40\",\n            \"[\": \"%5B\",\n            \"]\": \"%5D\",\n            }\n\ndef _subst(s, substitutions=url_subs):\n    res = \"\"\n    for c in str(s):\n        if c in substitutions:\n            res += substitutions[c]\n        else:\n            res += c\n    return res\n\n\ndef requestURL(baseurl, params={}):\n    try:\n        if len(params) == 0:\n            return baseurl\n        complete_url = baseurl + \"?\"\n        pairs = [\"{}={}\".format(_subst(k), _subst(params[k])) for k in params]\n        complete_url += \"&\".join(pairs)\n        return complete_url\n    except:\n        return None\n\ndef get(baseurl, params={}):\n    full_url = requestURL(baseurl, params)\n    if not full_url:\n        text_data = \"<html><body><h1>invalid request</h1></body></html>\"\n        full_url = \"Couldn’t generate a valid URL\"\n    else:\n        data = urlopen(full_url)\n        text_data = data.read().strip()\n        if len(text_data) == 0:\n            text_data = \"Failed to retrieve that URL\"\n    return Response(text_data, full_url)","src/lib/requests_with_caching.py":"import requests\nimport json\n\nPERMANENT_CACHE_FNAME = \"permanent_cache.txt\"\nTEMP_CACHE_FNAME = \"this_page_cache.txt\"\n\ndef _write_to_file(cache, fname):\n    with open(fname, 'w') as outfile:\n        outfile.write(json.dumps(cache, indent=2))\n\ndef _read_from_file(fname):\n    try:\n        with open(fname, 'r') as infile:\n            res = infile.read()\n            return json.loads(res)\n    except:\n        return {}\n\ndef add_to_cache(cache_file, cache_key, cache_value):\n    temp_cache = _read_from_file(cache_file)\n    temp_cache[cache_key] = cache_value\n    _write_to_file(temp_cache, cache_file)\n\ndef clear_cache(cache_file=TEMP_CACHE_FNAME):\n    _write_to_file({}, cache_file)\n\ndef make_cache_key(baseurl, params_d, private_keys=[\"api_key\", \"apikey\"]):\n    \"\"\"Makes a long string representing the query.\n    Alphabetize the keys from the params dictionary so we get the same order each time.\n    Omit keys with private info.\"\"\"\n    alphabetized_keys = sorted(params_d.keys())\n    res = []\n    for k in alphabetized_keys:\n        if k not in private_keys:\n            res.append(\"{}-{}\".format(k, params_d[k]))\n    return baseurl + \"_\".join(res)\n\ndef get(baseurl, params={}, private_keys_to_ignore=[\"api_key\", \"apikey\"], permanent_cache_file=PERMANENT_CACHE_FNAME, temp_cache_file=TEMP_CACHE_FNAME):\n    full_url = requests.requestURL(baseurl, params)\n    cache_key = make_cache_key(baseurl, params, private_keys_to_ignore)\n    # Load the permanent and page-specific caches from files\n    permanent_cache = _read_from_file(permanent_cache_file)\n    temp_cache = _read_from_file(temp_cache_file)\n    if cache_key in temp_cache:\n        print(\"found in page-specific cache\")\n        # make a Response object containing text from the change, and the full_url that would have been fetched\n        return requests.Response(temp_cache[cache_key], full_url)\n    elif cache_key in permanent_cache:\n        print(\"found in permanent_cache\")\n        # make a Response object containing text from the change, and the full_url that would have been fetched\n        return requests.Response(permanent_cache[cache_key], full_url)\n    else:\n        print(\"new; adding to cache\")\n        # actually request it\n        resp = requests.get(baseurl, params)\n        # save it\n        add_to_cache(temp_cache_file, cache_key, resp.text)\n        return resp","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/statistics.py":"\"\"\"\nBasic statistics module.\n\nThis module provides functions for calculating statistics of data, including\naverages, variance, and standard deviation.\n\nCalculating averages\n--------------------\n\n==================  =============================================\nFunction            Description\n==================  =============================================\nmean                Arithmetic mean (average) of data.\nharmonic_mean       Harmonic mean of data.\nmedian              Median (middle value) of data.\nmedian_low          Low median of data.\nmedian_high         High median of data.\nmedian_grouped      Median, or 50th percentile, of grouped data.\nmode                Mode (most common value) of data.\n==================  =============================================\n\nCalculate the arithmetic mean (\"the average\") of data:\n\n>>> mean([-1.0, 2.5, 3.25, 5.75])\n2.625\n\n\nCalculate the standard median of discrete data:\n\n>>> median([2, 3, 4, 5])\n3.5\n\n\nCalculate the median, or 50th percentile, of data grouped into class intervals\ncentred on the data values provided. E.g. if your data points are rounded to\nthe nearest whole number:\n\n>>> median_grouped([2, 2, 3, 3, 3, 4])  #doctest: +ELLIPSIS\n2.8333333333...\n\nThis should be interpreted in this way: you have two data points in the class\ninterval 1.5-2.5, three data points in the class interval 2.5-3.5, and one in\nthe class interval 3.5-4.5. The median of these data points is 2.8333...\n\n\nCalculating variability or spread\n---------------------------------\n\n==================  =============================================\nFunction            Description\n==================  =============================================\npvariance           Population variance of data.\nvariance            Sample variance of data.\npstdev              Population standard deviation of data.\nstdev               Sample standard deviation of data.\n==================  =============================================\n\nCalculate the standard deviation of sample data:\n\n>>> stdev([2.5, 3.25, 5.5, 11.25, 11.75])  #doctest: +ELLIPSIS\n4.38961843444...\n\nIf you have previously calculated the mean, you can pass it as the optional\nsecond argument to the four \"spread\" functions to avoid recalculating it:\n\n>>> data = [1, 2, 2, 4, 4, 4, 5, 6]\n>>> mu = mean(data)\n>>> pvariance(data, mu)\n2.5\n\n\nExceptions\n----------\n\nA single exception is defined: StatisticsError is a subclass of ValueError.\n\n\"\"\"\n\n__all__ = [ 'StatisticsError',\n            'pstdev', 'pvariance', 'stdev', 'variance',\n            'median',  'median_low', 'median_high', 'median_grouped',\n            'mean', 'mode', 'harmonic_mean',\n          ]\n\nfrom collections import Counter\nfrom math import sqrt\n\ndef mean(data):\n    return sum(data) / len(data)\n\ndef harmonic_mean(data):\n    raise NotImplementedError\n\n\ndef median(data):\n    _data = sorted(data)\n    l = len(_data)\n    if l % 2 == 0:\n        _median = (_data[l//2] + _data[l//2-1]) / 2\n    else:\n        _median = _data[l//2]\n    return _median\n\ndef median_low(data):\n    _data = sorted(data)\n    l = len(_data)\n    if l % 2 == 0:\n        _median = _data[l//2-1]\n    else:\n        _median = _data[l//2]\n    return _median\n\n\ndef median_high(data):\n    _data = sorted(data)\n    l = len(_data)\n    if l % 2 == 0:\n        _median = _data[l//2]\n    else:\n        _median = _data[l//2]\n    return _median\n\n\ndef median_grouped(data):\n    return median(data)\n\ndef mode(data):\n    counter = Counter(data)\n    max_count = max(counter.values())\n    _mode = [k for k,v in counter.items() if v == max_count]\n    if len(_mode) > 1:\n        raise ValueError(\"No Unique Mode, found {} equally common values\".format(len(_mode)))\n    else:\n        return _mode[0]\n\n\ndef variance(data):\n    average=mean(data)\n    _variance=0\n    for d in data:\n        _variance += ((average-d)**2)\n        final_variance=_variance/len(data)\n    return final_variance\n\ndef pvariance(data):\n    average=mean(data)\n    _variance=0\n    for d in data:\n        _variance += ((average-d)**2)\n        final_variance=_variance/len(data)\n    return final_variance\n\ndef variance(data):\n    average=mean(data)\n    _variance=0\n    for d in data:\n        _variance += ((average-d)**2)\n        final_variance=_variance/(len(data) -1)\n    return final_variance\n\ndef pstdev(data):\n    return sqrt(pvariance(data))\n\ndef stdev(data):\n    return sqrt(variance(data))\n\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){return Sk.misceval.callsimArray(Sk.builtin.str.prototype.split,a)}),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, places=5):\n    if isinstance(expected,int):\n        if actual == expected:\n            print('Pass')\n            return True\n    elif isinstance(expected,float):\n        if abs(actual-expected) < 10**(-places):\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/bad_getattr.py":"x = 1\n\n__getattr__ = \"Surprise!\"\n__dir__ = \"Surprise again!\"\n","src/lib/test/bad_getattr2.py":"def __getattr__():\n    \"Bad one\"\n\nx = 1\n\ndef __dir__(bad_sig):\n    return []\n","src/lib/test/bad_getattr3.py":"def __getattr__(name):\n    global __getattr__\n    if name != 'delgetattr':\n        raise AttributeError\n    del __getattr__\n    raise AttributeError\n","src/lib/test/decimaltestdata/__init__.py":"raise NotImplementedError(\"decimaltestdata is not yet implemented in Skulpt\")\n","src/lib/test/good_getattr.py":"x = 1\n\ndef __dir__():\n    return ['a', 'b', 'c']\n\ndef __getattr__(name):\n    if name == \"yolo\":\n        raise AttributeError(\"Deprecated, use whatever instead\")\n    return f\"There is {name}\"\n\ny = 2\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":"\nprint(\"\"\"\nThe Zen of Python, by Tim Peters\n\nBeautiful is better than ugly.\nExplicit is better than implicit.\nSimple is better than complex.\nComplex is better than complicated.\nFlat is better than nested.\nSparse is better than dense.\nReadability counts.\nSpecial cases aren't special enough to break the rules.\nAlthough practicality beats purity.\nErrors should never pass silently.\nUnless explicitly silenced.\nIn the face of ambiguity, refuse the temptation to guess.\nThere should be one-- and preferably only one --obvious way to do it.\nAlthough that way may not be obvious at first unless you're Dutch.\nNow is better than never.\nAlthough never is often better than *right* now.\nIf the implementation is hard to explain, it's a bad idea.\nIf the implementation is easy to explain, it may be a good idea.\nNamespaces are one honking great idea -- let's do more of those!\n\"\"\"\n)\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 from_seconds(a,b){var c=new Date;if(a){Sk.builtin.pyCheckType(\"secs\",\"number\",Sk.builtin.checkNumber(a));var d=Sk.builtin.asnum$(a);c.setTime(1e3*d)}return date_to_struct_time(c,b)}function asctime_f(a){if(Sk.builtin.pyCheckArgsLen(\"asctime\",arguments.length,0,1),!a||Sk.builtin.checkNone(a)?a=from_seconds():!(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(Sk.builtin.pyCheckArgsLen(\"mktime\",arguments.length,1,1),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={__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(function(a){return Sk.builtin.pyCheckArgsLen(\"localtime\",arguments.length,0,1),from_seconds(a,!1)}),a.gmtime=new Sk.builtin.func(function(a){return Sk.builtin.pyCheckArgsLen(\"gmtime\",arguments.length,0,1),from_seconds(a,!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 Sk.builtin.pyCheckArgsLen(\"ctime\",arguments.length,0,1),asctime_f(from_seconds(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=from_seconds(),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),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.\nMappingProxyType = type(type.__dict__)\nWrapperDescriptorType = type(object.__init__)\nMethodWrapperType = type(object().__str__)\nMethodDescriptorType = type(str.join)\nClassMethodDescriptorType = type(dict.__dict__['fromkeys'])\n\nNoneType = type(None)\nTypeType = type\nObjectType = object\nIntType = int\ntry:\n    LongType = long\nexcept: pass\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'''\nimport re\n\nclass _AssertRaisesContext(object):\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(object):\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        return funcName.__func__.__name__\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 assertRegex(self, text, expected_regex, feedback=\"\"):\n        \"\"\"Fail the test unless the text matches the regular expression.\"\"\"\n        if isinstance(expected_regex, (str, )): #bytes\n            assert expected_regex, \"expected_regex must not be empty.\"\n            expected_regex = re.compile(expected_regex)\n        if not expected_regex.search(text):\n            res = False\n            feedback = \"Regex didn't match: %r not found in %r\" % (\n                repr(expected_regex), text)\n        else:\n            res = True\n        self.appendResult(res, text, expected_regex, feedback)\n\n    def assertNotRegex(self, text, unexpected_regex, feedback=\"\"):\n        \"\"\"Fail the test if the text matches the regular expression.\"\"\"\n        if isinstance(unexpected_regex, (str, )): # bytes\n            unexpected_regex = re.compile(unexpected_regex)\n        match = unexpected_regex.search(text)\n        if match:\n            feedback = 'Regex matched: %r matches %r in %r' % (\n                text[match.start() : match.end()],\n                repr(unexpected_regex),\n                text)\n            # _formatMessage ensures the longMessage option is respected\n        self.appendResult(not bool(match), text, unexpected_regex, 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\nfrom urllib.request import urlopen\nfrom time import sleep\n\n\nclass TestCaseGui(TestCase):\n    def __init__(self):\n        TestCase.__init__(self)\n        self.closestDiv = document.currentDiv()\n        self.divid = document.currentGradingContainer()\n        self.mydiv = document.getElementById(self.divid)\n        # If there is no div then create a dummy to avoid errors when running\n        # grading \"off screen\"\n        if self.mydiv is None:\n            self.mydiv = document.createElement(\"div\")\n            self.mydiv.setAttribute(\"id\", self.divid + \"_offscreen_unit_results\")\n            self.mydiv.setCSS(\"display\", \"none\")\n            body = document.getElementsByTagName(\"body\")[0]\n            body.appendChild(self.mydiv)\n            self.unit_results_divid = self.divid + \"_offscreen_unit_results\"\n\n        res = document.getElementById(self.divid + \"_unit_results\")\n        if res:\n            self.resdiv = res\n            res.innerHTML = \"\"\n            self.unit_results_divid = self.divid + \"_unit_results\"\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            self.unit_results_divid = self.divid + \"_unit_results\"\n\n    def main(self):\n        t = document.createElement(\"table\")\n        self.resTable = t\n        x = self.resdiv.closest(\".timedComponent\")\n        if x:\n            self.is_timed = True\n        else:\n            self.is_timed = False\n        self.resdiv.appendChild(self.resTable)\n        if self.is_timed:\n            self.resdiv.setCSS(\"display\", \"none\")\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, str(e).split(\"on line\")[0])\n                self.numFailed += 1\n        self.showSummary()\n\n    def getOutput(self):\n        sleep(0.2)\n        # self.divid will be the gradingWrapper when in grading mode\n        if self.closestDiv != self.divid:\n            output = document.querySelector(\n                \"#{} #{}_stdout\".format(self.divid, self.closestDiv)\n            )\n        else:\n            output = document.getElementById(self.divid + \"_stdout\")\n        return output.innerText\n\n    def getEditorText(self):\n        return document.getCurrentEditorValue()\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        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\n        if trimActual or trimExpected:\n            expandbutton = document.createElement(\"button\")\n            expandbutton.innerHTML = \"Expand Differences\"\n            expandmsg = \"Actual: \" + str(actual) + \"\\nExpected: \" + str(expected)\n            expandbutton.setAttribute(\"value\", expandmsg)\n            expandbutton.setAttribute(\"type\", \"button\")\n            expandbutton.setAttribute(\"onclick\", \"alert(this.value)\")\n            expandbutton.setAttribute(\"class\", \"btn btn-info\")\n            row.appendChild(expandbutton)\n\n        self.resTable.appendChild(row)\n\n    def showSummary(self):\n        pct = float(self.numPassed) / (self.numPassed + self.numFailed) * 100\n        pctcorrect = (\n            \"percent:\"\n            + str(pct)\n            + \":passed:\"\n            + str(self.numPassed)\n            + \":failed:\"\n            + str(self.numFailed)\n        )\n        pTag = document.createElement(\"p\")\n        if not self.is_timed:\n            pTag.innerHTML = \"You passed: \" + str(pct) + \"% of the tests\"\n            self.resdiv.appendChild(pTag)\n        try:\n            jseval(\"window.edList['{}'].pct_correct = {}\".format(self.closestDiv, pct))\n            jseval(\n                \"window.edList['{}'].unit_results = '{}'\".format(\n                    self.closestDiv, pctcorrect\n                )\n            )\n            jseval(\n                \"window.edList['{}'].unit_results_divid = '{}'\".format(\n                    self.closestDiv, self.mydiv.getAttribute(\"id\")\n                )\n            )\n\n        except:\n            print(\n                \"failed to find object to record unittest results! {}\".format(\n                    pctcorrect\n                )\n            )\n","src/lib/urllib/__init__.js":"var $builtinmodule=function(){return{}};","src/lib/urllib/request/__init__.js":"var $builtinmodule=function(){var a={};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\",[]);var b=function(a){var b;if(!Sk.jsonpSites)return!1;for(b=0;b<Sk.jsonpSites.length;b++)if(a.startsWith(Sk.jsonpSites[b]))return!0;return!1};return a.urlopen=new Sk.builtin.func(function(c,d){var e=b(c.v)?new Promise(function(b,d){var e=document.createElement(\"script\");e.src=c.v+\"&callback=Sk.jsonpcallback\",e.onerror=function(){d(\"An error occured getting the data\")},Sk.jsonpcallback=function(c){var d={responseText:JSON.stringify(c)};b(Sk.misceval.callsimArray(a.Response,[d]))};try{document.body.appendChild(e)}catch(a){console.log(\"caught error in urlopen\"+a)}}):new Promise(function(b){var e=new XMLHttpRequest;e.addEventListener(\"loadend\",function(){b(Sk.misceval.callsimArray(a.Response,[e]))}),d?(e.open(\"POST\",c.v),e.setRequestHeader(\"Content-type\",\"application/x-www-form-urlencoded\"),e.send(d.v)):(e.open(\"GET\",c.v),e.send(null))});var f=new Sk.misceval.Suspension;return f.resume=function(){return resolution},f.data={type:\"Sk.promise\",promise:e.then(function(a){return resolution=a,a},function(a){return resolution=\"\",a})},f}),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.generic.getAttr,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"}}

/***/ }),

/***/ 53098:
/*!***********************************************!*\
  !*** ./runestone/activecode/js/skulpt.min.js ***!
  \***********************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

(function(){'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,q,a){m!=Array.prototype&&m!=Object.prototype&&(m[q]=a.value)};$jscomp.getGlobal=function(m){return"undefined"!=typeof window&&window===m?m:"undefined"!=typeof __webpack_require__.g&&null!=__webpack_require__.g?__webpack_require__.g:m};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.polyfill=function(m,q,a,c){if(q){a=$jscomp.global;m=m.split(".");for(c=0;c<m.length-1;c++){var b=m[c];b in a||(a[b]={});a=a[b]}m=m[m.length-1];c=a[m];q=q(c);q!=c&&null!=q&&$jscomp.defineProperty(a,m,{configurable:!0,writable:!0,value:q})}};$jscomp.polyfill("Array.prototype.includes",function(m){return m?m:function(m,a){var c=this;c instanceof String&&(c=String(c));var b=c.length;a=a||0;for(0>a&&(a=Math.max(a+b,0));a<b;a++){var e=c[a];if(e===m||Object.is(e,m))return!0}return!1}},"es7","es3");
$jscomp.owns=function(m,q){return Object.prototype.hasOwnProperty.call(m,q)};$jscomp.polyfill("Object.entries",function(m){return m?m:function(m){var a=[],c;for(c in m)$jscomp.owns(m,c)&&a.push([c,m[c]]);return a}},"es8","es3");
$jscomp.checkStringArgs=function(m,q,a){if(null==m)throw new TypeError("The 'this' value for String.prototype."+a+" must not be null or undefined");if(q instanceof RegExp)throw new TypeError("First argument to String.prototype."+a+" must not be a regular expression");return m+""};$jscomp.stringPadding=function(m,q){m=void 0!==m?String(m):" ";return 0<q&&m?m.repeat(Math.ceil(q/m.length)).substring(0,q):""};
$jscomp.polyfill("String.prototype.padStart",function(m){return m?m:function(m,a){var c=$jscomp.checkStringArgs(this,null,"padStart");return $jscomp.stringPadding(a,m-c.length)+c}},"es8","es3");$jscomp.polyfill("Object.values",function(m){return m?m:function(m){var a=[],c;for(c in m)$jscomp.owns(m,c)&&a.push(m[c]);return a}},"es8","es3");$jscomp.arrayIteratorImpl=function(m){var q=0;return function(){return q<m.length?{done:!1,value:m[q++]}:{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,q){this.$jscomp$symbol$id_=m;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:q})};$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||"")+"_"+q++,a)}var q=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,q){$jscomp.initSymbolIterator();m instanceof String&&(m+="");var a=0,c={next:function(){if(a<m.length){var b=a++;return{value:q(b,m[b]),done:!1}}c.next=function(){return{done:!0,value:void 0}};return c.next()}};c[Symbol.iterator]=function(){return c};return c};$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 q(c){if(a[c])return a[c].exports;var b=a[c]={i:c,l:!1,exports:{}};m[c].call(b.exports,b,b.exports,q);b.l=!0;return b.exports}var a={};q.m=m;q.c=a;q.d=function(a,b,e){q.o(a,b)||Object.defineProperty(a,b,{enumerable:!0,get:e})};q.r=function(a){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"});Object.defineProperty(a,"__esModule",{value:!0})};q.t=function(a,b){b&1&&(a=q(a));if(b&8||b&4&&"object"===typeof a&&a&&a.__esModule)return a;
var c=Object.create(null);q.r(c);Object.defineProperty(c,"default",{enumerable:!0,value:a});if(b&2&&"string"!=typeof a)for(var f in a)q.d(c,f,function(b){return a[b]}.bind(null,f));return c};q.n=function(a){var b=a&&a.__esModule?function(){return a["default"]}:function(){return a};q.d(b,"a",b);return b};q.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};q.p="";return q(q.s=1)})([function(m,q){q=function(){return this}();try{q=q||(new Function("return this"))()}catch(a){"object"===
typeof window&&(q=window)}m.exports=q},function(m,q,a){a(2);Sk.global.strftime=a(3);Sk.global.strptime=a(4);a(5);a(7);a(9);a(10);a(11);a(12);a(13);a(14);a(15);a(16);a(17);a(18);[Sk.builtin.object,Sk.builtin.type].forEach(a=>{Sk.abstr.setUpSlots(a);Sk.abstr.setUpMethods(a);Sk.abstr.setUpGetSets(a)});a(19);a(20);a(21);[Sk.builtin.str,Sk.builtin.none,Sk.builtin.NotImplemented,Sk.builtin.object].forEach(a=>{a=a.prototype;a.__doc__=a.hasOwnProperty("tp$doc")?new Sk.builtin.str(a.tp$doc):Sk.builtin.none.none$});
a(22);a(23);a(24);a(25);a(26);a(27);a(28);a(29);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);a(64);a(65)},function(m,q,a){(function(a){var b={build:{githash:"34847ec75ce21274139382725806501004632819",date:"2021-06-07T15:46:00.804Z"}};b.global="undefined"!==typeof a?a:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{};b.exportSymbol=
function(a,c){a=a.split(".");var e=b.global,f;for(f=0;f<a.length-1;f++){var d=a[f];e=e.hasOwnProperty(d)?e[d]:e[d]={}}"undefined"!==typeof c&&(d=a[f],e[d]=c)};b.isArrayLike=function(a){return a instanceof Array||a&&a.length&&"number"==typeof a.length?!0:!1};b.js_beautify=function(a){return a};b.exportSymbol("Sk",b);b.exportSymbol("Sk.global",b.global);b.exportSymbol("Sk.build",b.build);b.exportSymbol("Sk.exportSymbol",b.exportSymbol);b.exportSymbol("Sk.isArrayLike",b.isArrayLike);b.exportSymbol("Sk.js_beautify",
b.js_beautify)}).call(this,a(0))},function(m,q){(function(){function a(k,n,A){function p(a,d,k,g){for(var y="",n=null,v=!1,L=a.length,G=!1,E=0;E<L;E++){var A=a.charCodeAt(E);if(!0===v)if(45===A)n="";else if(95===A)n=" ";else if(48===A)n="0";else if(58===A)G&&h("[WARNING] detected use of unsupported %:: or %::: modifiers to strftime"),G=!0;else{switch(A){case 37:y+="%";break;case 65:y+=k.days[d.getDay()];break;case 66:y+=k.months[d.getMonth()];break;case 67:y+=c(Math.floor(d.getFullYear()/100),n);
break;case 68:y+=p(k.formats.D,d,k,g);break;case 70:y+=p(k.formats.F,d,k,g);break;case 72:y+=c(d.getHours(),n);break;case 73:y+=c(e(d.getHours()),n);break;case 76:y+=b(Math.floor(g%1E3));break;case 77:y+=c(d.getMinutes(),n);break;case 80:y+=12>d.getHours()?k.am:k.pm;break;case 82:y+=p(k.formats.R,d,k,g);break;case 83:y+=c(d.getSeconds(),n);break;case 84:y+=p(k.formats.T,d,k,g);break;case 85:y+=c(f(d,"sunday"),n);break;case 87:y+=c(f(d,"monday"),n);break;case 88:y+=p(k.formats.X,d,k,g);break;case 89:y+=
d.getFullYear();break;case 90:D&&0===B?y+="GMT":(n=d.toString().match(/\(([\w\s]+)\)/),y+=n&&n[1]||"");break;case 97:y+=k.shortDays[d.getDay()];break;case 98:y+=k.shortMonths[d.getMonth()];break;case 99:y+=p(k.formats.c,d,k,g);break;case 100:y+=c(d.getDate(),n);break;case 101:y+=c(d.getDate(),null==n?" ":n);break;case 104:y+=k.shortMonths[d.getMonth()];break;case 106:n=new Date(d.getFullYear(),0,1);n=Math.ceil((d.getTime()-n.getTime())/864E5);y+=b(n);break;case 107:y+=c(d.getHours(),null==n?" ":n);
break;case 108:y+=c(e(d.getHours()),null==n?" ":n);break;case 109:y+=c(d.getMonth()+1,n);break;case 110:y+="\n";break;case 111:n=d.getDate();y=k.ordinalSuffixes?y+(String(n)+(k.ordinalSuffixes[n-1]||l(n))):y+(String(n)+l(n));break;case 112:y+=12>d.getHours()?k.AM:k.PM;break;case 114:y+=p(k.formats.r,d,k,g);break;case 115:y+=Math.floor(g/1E3);break;case 116:y+="\t";break;case 117:n=d.getDay();y+=0===n?7:n;break;case 118:y+=p(k.formats.v,d,k,g);break;case 119:y+=d.getDay();break;case 120:y+=p(k.formats.x,
d,k,g);break;case 121:y+=(""+d.getFullYear()).slice(2);break;case 122:D&&0===B?y+=G?"+00:00":"+0000":(n=0!==B?B/6E4:-d.getTimezoneOffset(),v=G?":":"",A=Math.abs(n%60),y+=(0>n?"-":"+")+c(Math.floor(Math.abs(n/60)))+v+c(A));break;default:v&&(y+="%"),y+=a[E]}n=null;v=!1}else 37===A?v=!0:y+=a[E]}return y}var v=k||g,B=n||0,D=A||!1,E=0,u,m=function(a,b){if(b){var d=b.getTime();if(D){var c=6E4*(b.getTimezoneOffset()||0);b=new Date(d+c+B);6E4*(b.getTimezoneOffset()||0)!==c&&(b=6E4*(b.getTimezoneOffset()||
0),b=new Date(d+b+B))}}else d=Date.now(),d>E?(E=d,u=new Date(E),d=E,D&&(u=new Date(E+6E4*(u.getTimezoneOffset()||0)+B))):d=E,b=u;return p(a,b,v,d)};m.localize=function(b){return new a(b||v,B,D)};m.localizeByIdentifier=function(a){var b=d[a];return b?m.localize(b):(h('[WARNING] No locale found with identifier "'+a+'".'),m)};m.timezone=function(b){var d=B,c=D,e=typeof b;if("number"===e||"string"===e)c=!0,"string"===e?(d="-"===b[0]?-1:1,e=parseInt(b.slice(1,3),10),b=parseInt(b.slice(3,5),10),d=d*(60*
e+b)*6E4):"number"===e&&(d=6E4*b);return new a(v,d,c)};m.utc=function(){return new a(v,B,!0)};return m}function c(a,b){if(""===b||9<a)return a;null==b&&(b="0");return b+a}function b(a){return 99<a?a:9<a?"0"+a:"00"+a}function e(a){return 0===a?12:12<a?a-12:a}function f(a,b){b=b||"sunday";var d=a.getDay();"monday"===b&&(0===d?d=6:d--);b=Date.UTC(a.getFullYear(),0,1);a=Date.UTC(a.getFullYear(),a.getMonth(),a.getDate());return Math.floor((Math.floor((a-b)/864E5)+7-d)/7)}function l(a){var b=a%10;a%=100;
if(11<=a&&13>=a||0===b||4<=b)return"th";switch(b){case 1:return"st";case 2:return"nd";case 3:return"rd"}}function h(a){"undefined"!==typeof console&&"function"==typeof console.warn&&console.warn(a)}var d={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"}}},g=d.en_US,n=new a(g,0,!1);if("undefined"!==typeof m)var k=m.exports=n;else k=function(){return this||(0,eval)("this")}(),
k.strftime=n;"function"!==typeof Date.now&&(Date.now=function(){return+new Date})})()},function(m,q,a){(function(){var a=function(b,c,f){return a.parse(b,c,f)};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 b(a,c,e,f,h,l){c=String(c);e=String(e);c=c.replace(/^[#_0\^\-!~]+/,"");f=d[c];if(!f)return a;var k=!1;-1===e.indexOf("!")&&1===c.length&&(-1<e.indexOf("~")||-1<"bBf".indexOf(c)&&/%[0\-_]?d[\s]+$/.test(l.substr(0,h)))&&(k=!0);if(("I"===c||"l"===c)&&!/%[pP]/.test(l))throw Error("Undefined AM/PM");switch(typeof f){case "function":return f();case "string":return f;case "object":return b.make.push([f.make,
e,k]),"("+f.reg+")";default:return a}}function c(a,b){a=String(a);b=String(b);return-1!==b.indexOf("#")?a.substr(0,1).toUpperCase()+a.substr(1):-1!==b.indexOf("^")?a.substr(0,1)+a.substr(1).toLowerCase():a}var l=Array.prototype.indexOf||function(a){for(var b=this.length,d=0;d<b;){if(a==this[d])return d;d++}return-1},h=a.locale,d={"%":"\\%",a:"\\S+",A:"\\S+",b:{reg:"\\S+",make:function(a,b,d,e){b=l.call(e?h.bg:h.b,c(b,d));if(-1===b)return!1;a.setUTCMonth(b);return!0}},h:{reg:"\\S+",make:function(a,
b,d,e){b=l.call(e?h.bg:h.b,c(b,d));if(-1===b)return!1;a.setUTCMonth(b);return!0}},B:{reg:"\\S+",make:function(a,b,d,e){b=l.call(e?h.Bg:h.B,c(b,d));if(-1===b)return!1;a.setUTCMonth(b);return!0}},f:{reg:"\\S+",make:function(a,b,d,e){b=l.call(e?h.fg:h.f,c(b,d));if(-1===b)return!1;a.setUTCMonth(b);return!0}},g:{reg:"[\\d\\s]?\\d",make:function(a,b){b=parseInt(b,10);if(0>b||99<b)return!1;b+=100*parseInt((new Date).getUTCFullYear()/100,10);a.setUTCFullYear(b);return!0}},G:{reg:"\\d{4}",make:function(a,
b){b=parseInt(b,10);a.setUTCFullYear(b);return!0}},d:{reg:"[\\d\\s]?\\d",make:function(a,b){b=parseInt(b,10);if(1>b||31<b)return!1;a.setUTCDate(b);return!0}},e:{reg:"[\\d\\s]?\\d",make:function(a,b){b=parseInt(b,10);if(1>b||31<b)return!1;a.setUTCDate(b);return!0}},H:{reg:"[\\d\\s]?\\d",make:function(a,b){b=parseInt(b,10);if(0>b||23<b)return!1;a.setUTCHours(b);return!0}},I:{reg:"[\\d\\s]?\\d",make:function(a,b){b=parseInt(b,10);if(1>b||12<b)return!1;a.setUTCHours(a.getUTCHours()+b);return!0}},m:{reg:"[\\d\\s]?\\d",
make:function(a,b){b=parseInt(b,10);if(1>b||12<b)return!1;a.setUTCMonth(b-1);return!0}},M:{reg:"[\\d\\s]?\\d",make:function(a,b){b=parseInt(b,10);if(0>b||59<b)return!1;a.setUTCMinutes(b);return!0}},n:"\\n",p:{reg:"\\S+",make:function(a,b){b=l.call(h.P,b.toLowerCase());if(-1===b)return!1;1===b&&a.setUTCHours(a.getUTCHours()+12);return!0}},P:{reg:"\\S+",make:function(a,b){b=l.call(h.P,b.toLowerCase());if(-1===b)return!1;1===b&&a.setUTCHours(a.getUTCHours()+12);return!0}},S:{reg:"[\\d\\s]?\\d",make:function(a,
b){b=parseInt(b,10);if(0>b||60<b)return!1;a.setUTCSeconds(b);return!0}},t:"\\t",u:"\\d",U:"[\\d\\s]?\\d",w:"\\d",W:"[\\d\\s]?\\d",y:{reg:"[\\d\\s]?\\d",make:function(a,b){b=parseInt(b,10);if(0>b||99<b)return!1;b+=100*parseInt((new Date).getUTCFullYear()/100,10);a.setUTCFullYear(b);return!0}},Y:{reg:"\\d{4}",make:function(a,b){b=parseInt(b,10);a.setUTCFullYear(b);return!0}},z:{reg:"[+\\-]\\d{4}",make:function(a,b){b=b.match(/^([+\-])(\d{2})(\d{2})$/);if(!b)return!1;var d=6E4*(60*parseInt(b[2],10)+
parseInt(b[3],10));"+"===b[1]&&(d=-d);a.setTime(a.getTime()+d);return!0}},l:{reg:"[\\d\\s]?\\d",make:function(a,b){b=parseInt(b,10);if(1>b||12<b)return!1;a.setUTCHours(a.getUTCHours()+b);return!0}},s:{reg:"\\d+",make:function(a,b){b=parseInt(b,10);a.setTime(1E3*b);return!0}},c:h.c,r:h.r,R:"%H:%M",T:"%H:%M:%S",x:h.x,X:h.X,D:"%m/%d/%y",F:"%Y-%m-%d",Date_iso:"%Y-%m-%dT%H:%M:%S",Date_dBY_year_in_HM:h.Date_dBY_year_in_HM,Date_dBY_year:h.Date_dBY_year,Date_dBY:h.Date_dBY,Date_dBA:h.Date_dBA,Date_AdBY:h.Date_AdBY,
Date_df_in_HM:h.Date_df_in_HM,Date_dfY:h.Date_dfY,Date_dB_in_HM:h.Date_dB_in_HM,Date_dmY__dot:"%d.%m.%Y",Date_df:h.Date_df,Date_FT:"%F %T",Date_dmY__minus:"%d-%m-%Y"};a.parse=function(a,d,c){a=String(a);d=String(d);for(var e=5;/%(Date_[a-zA-Z0-9_]+|[cDFrRTxX])/g.test(d)&&e;)d=d.replace(/%(Date_[a-zA-Z0-9_]+|[cDFrRTxX])/,b),e--;b.make=[];d=d.replace(/%(([#\^!~]{0,2})[aAbBfh]|([0\-_]?)[degHImMSVWyl]|[GnpPtuUwYzZs%])/g,b);a=a.match(new RegExp(d));if(!a||!b.make.length)return null;d=new Date(Date.UTC(0,
0));e=0;for(var k=b.make.length;e<k;e++){var f=b.make[e];if(!f[0](d,a[e+1],f[1],f[2]))return null}c&&d.setTime(d.getTime()+6E4*d.getTimezoneOffset());return d}})(a)})()},function(m,q,a){m=a(6);const c=Sk.global.JSBI=void 0!==Sk.global.BigInt?{}:m;if(void 0===Sk.global.BigInt){const a=c.__isBigInt;c.__isBigInt=a?b=>null!==b&&a(b):a=>a instanceof c;c.powermod=(a,b,l)=>{const e=c.BigInt(1);let d=e;for(b=c.greaterThan(b,c.__ZERO)?b:c.unaryMinus(b);c.greaterThan(b,c.__ZERO);)c.bitwiseAnd(b,e)&&(d=c.remainder(c.multiply(d,
a),l)),b=c.signedRightShift(b,e),a=c.remainder(c.multiply(a,a),l);return d}}else Object.assign(c,{BigInt:Sk.global.BigInt,toNumber:a=>Number(a),toString:a=>a.toString(),__isBigInt:a=>"bigint"===typeof a,unaryMinus:a=>-a,bitwiseNot:a=>~a,bitwiseAnd:(a,c)=>a&c,bitwiseOr:(a,c)=>a|c,bitwiseXor:(a,c)=>a^c,exponentiate:(a,e)=>{const b=c.BigInt(1);let l=b;for(e=e>c.__ZERO?e:-e;e>c.__ZERO;)e&b&&(l*=a),e>>=b,a*=a;return l},powermod:(a,e,f)=>{const b=c.BigInt(1);let h=b;for(e=e>c.__ZERO?e:-e;e>c.__ZERO;)e&
b&&(h=h*a%f),e>>=b,a=a*a%f;return h},multiply:(a,c)=>a*c,divide:(a,c)=>a/c,remainder:(a,c)=>a%c,add:(a,c)=>a+c,subtract:(a,c)=>a-c,leftShift:(a,c)=>a<<c,signedRightShift:(a,c)=>a>>c,unsignedRightShift:(a,c)=>a>>>c,lessThan:(a,c)=>a<c,lessThanOrEqual:(a,c)=>a<=c,greaterThan:(a,c)=>a>c,greaterThanOrEqual:(a,c)=>a>=c,equal:(a,c)=>a===c,notEqual:(a,c)=>a!==c});c.__ZERO=c.BigInt(0);c.__MAX_SAFE=c.BigInt(Number.MAX_SAFE_INTEGER);c.__MIN_SAFE=c.BigInt(-Number.MAX_SAFE_INTEGER);c.numberIfSafe=a=>c.lessThan(a,
c.__MAX_SAFE)&&c.greaterThan(a,c.__MIN_SAFE)?c.toNumber(a):a},function(m,q,a){(function(a,b){m.exports=b()})(this,function(){function a(b){"@babel/helpers - typeof";return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},a(b)}function b(a,b){for(var d,c=0;c<b.length;c++)d=b[c],d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=
!0),Object.defineProperty(a,d.key,d)}function e(a,d,c){return d&&b(a.prototype,d),c&&b(a,c),a}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}});b&&h(a,b)}function l(a){return l=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},l(a)}function h(a,b){return h=Object.setPrototypeOf||function(a,
b){return a.__proto__=b,a},h(a,b)}function d(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(D){return!1}}function g(){return g=d()?Reflect.construct:function(a,b,d){var c=[null];c.push.apply(c,b);a=new (Function.bind.apply(a,c));return d&&h(a,d.prototype),a},g.apply(null,arguments)}function n(a){var b="function"==typeof Map?new Map:void 0;
return n=function(a){function d(){return g(a,arguments,l(this).constructor)}if(null===a||-1===Function.toString.call(a).indexOf("[native code]"))return a;if("function"!=typeof a)throw new TypeError("Super expression must either be null or a function");if("undefined"!=typeof b){if(b.has(a))return b.get(a);b.set(a,d)}return d.prototype=Object.create(a.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),h(d,a)},n(a)}function k(a){var b=d();return function(){var d=l(a);if(b){var c=
l(this).constructor;d=Reflect.construct(d,arguments,c)}else d=d.apply(this,arguments);if(!d||"object"!=typeof d&&"function"!=typeof d){if(void 0===this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");d=this}return d}}function p(a,b){if(a){if("string"==typeof a)return u(a,b);var d=Object.prototype.toString.call(a).slice(8,-1);return"Object"===d&&a.constructor&&(d=a.constructor.name),"Map"===d||"Set"===d?Array.from(a):"Arguments"===d||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d)?
u(a,b):void 0}}function u(a,b){(null==b||b>a.length)&&(b=a.length);for(var d=0,c=Array(b);d<b;d++)c[d]=a[d];return c}function A(a,b){var d;if("undefined"==typeof Symbol||null==a[Symbol.iterator]){if(Array.isArray(a)||(d=p(a))||b&&a&&"number"==typeof a.length){d&&(a=d);var c=0;b=function(){};return{s:b,n:function(){return c>=a.length?{done:!0}:{done:!1,value:a[c++]}},e:function(a){throw a;},f:b}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}var e,k=!0,f=!1;return{s:function(){d=a[Symbol.iterator]()},n:function(){var a=d.next();return k=a.done,a},e:function(a){f=!0;e=a},f:function(){try{k||null==d.return||d.return()}finally{if(f)throw e;}}}}var t=Math.imul,v=Math.clz32,B=function(b){function d(a,b){var c;if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");if(a>d.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return c=h.call(this,a),c.sign=b,c}var c=Math.abs,g=Math.max;f(d,b);var h=k(d);
return e(d,[{key:"toDebugString",value:function(){var a,b=["BigInt["],d=A(this);try{for(d.s();!(a=d.n()).done;){var c=a.value;b.push((c?(c>>>0).toString(16):c)+", ")}}catch(P){d.e(P)}finally{d.f()}return b.push("]"),b.join("")}},{key:"toString",value:function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:10;if(2>a||36<a)throw new RangeError("toString() radix argument must be between 2 and 36");return 0===this.length?"0":0==(a&a-1)?d.__toStringBasePowerOfTwo(this,a):d.__toStringGeneric(this,
a,!1)}},{key:"__copy",value:function(){for(var a=new d(this.length,this.sign),b=0;b<this.length;b++)a[b]=this[b];return a}},{key:"__trim",value:function(){for(var a=this.length,b=this[a-1];0===b;)a--,b=this[a-1],this.pop();return 0===a&&(this.sign=!1),this}},{key:"__initializeDigits",value:function(){for(var a=0;a<this.length;a++)this[a]=0}},{key:"__clzmsd",value:function(){return d.__clz32(this[this.length-1])}},{key:"__inplaceMultiplyAdd",value:function(a,b,c){c>this.length&&(c=this.length);var e=
65535&a;a>>>=16;var k=0,f=65535&b;b>>>=16;for(var g=0;g<c;g++){var h=this.__digit(g),p=65535&h,l=h>>>16;h=d.__imul(p,e);p=d.__imul(p,a);var v=d.__imul(l,e);l=d.__imul(l,a);var y=f+(65535&h);h=b+k+(y>>>16)+(h>>>16)+(65535&p)+(65535&v);f=(p>>>16)+(v>>>16)+(65535&l)+(h>>>16);k=f>>>16;f&=65535;b=l>>>16;this.__setDigit(g,65535&y|h<<16)}if(0!==k||0!==f||0!==b)throw Error("implementation bug");}},{key:"__inplaceAdd",value:function(a,b,d){for(var c,e=0,k=0;k<d;k++)c=this.__halfDigit(b+k)+a.__halfDigit(k)+
e,e=c>>>16,this.__setHalfDigit(b+k,c);return e}},{key:"__inplaceSub",value:function(a,b,d){var c=0;if(1&b){b>>=1;for(var e=this.__digit(b),k=65535&e,f=0;f<d-1>>>1;f++){var g=a.__digit(f);e=(e>>>16)-(65535&g)-c;c=1&e>>>16;this.__setDigit(b+f,e<<16|65535&k);e=this.__digit(b+f+1);k=(65535&e)-(g>>>16)-c;c=1&k>>>16}g=a.__digit(f);var h=(e>>>16)-(65535&g)-c;c=1&h>>>16;this.__setDigit(b+f,h<<16|65535&k);if(b+f+1>=this.length)throw new RangeError("out of bounds");0==(1&d)&&(e=this.__digit(b+f+1),k=(65535&
e)-(g>>>16)-c,c=1&k>>>16,this.__setDigit(b+a.length,4294901760&e|65535&k))}else{b>>=1;for(k=0;k<a.length-1;k++)e=this.__digit(b+k),g=a.__digit(k),f=(65535&e)-(65535&g)-c,c=1&f>>>16,e=(e>>>16)-(g>>>16)-c,c=1&e>>>16,this.__setDigit(b+k,e<<16|65535&f);f=this.__digit(b+k);a=a.__digit(k);e=(65535&f)-(65535&a)-c;c=1&e>>>16;g=0;0==(1&d)&&(g=(f>>>16)-(a>>>16)-c,c=1&g>>>16);this.__setDigit(b+k,g<<16|65535&e)}return c}},{key:"__inplaceRightShift",value:function(a){if(0!==a){for(var b,d=this.__digit(0)>>>a,
c=this.length-1,e=0;e<c;e++)b=this.__digit(e+1),this.__setDigit(e,b<<32-a|d),d=b>>>a;this.__setDigit(c,d)}}},{key:"__digit",value:function(a){return this[a]}},{key:"__unsignedDigit",value:function(a){return this[a]>>>0}},{key:"__setDigit",value:function(a,b){this[a]=0|b}},{key:"__setDigitGrow",value:function(a,b){this[a]=0|b}},{key:"__halfDigitLength",value:function(){var a=this.length;return 65535>=this.__unsignedDigit(a-1)?2*a-1:2*a}},{key:"__halfDigit",value:function(a){return 65535&this[a>>>1]>>>
((1&a)<<4)}},{key:"__setHalfDigit",value:function(a,b){var d=a>>>1,c=this.__digit(d);this.__setDigit(d,1&a?65535&c|b<<16:4294901760&c|65535&b)}}],[{key:"BigInt",value:function(b){var c=Math.floor,e=Number.isFinite;if("number"==typeof b){if(0===b)return d.__zero();if((0|b)===b)return 0>b?d.__oneDigit(-b,!0):d.__oneDigit(b,!1);if(!e(b)||c(b)!==b)throw new RangeError("The number "+b+" cannot be converted to BigInt because it is not an integer");return d.__fromDouble(b)}if("string"==typeof b){c=d.__fromString(b);
if(null===c)throw new SyntaxError("Cannot convert "+b+" to a BigInt");return c}if("boolean"==typeof b)return!0===b?d.__oneDigit(1,!1):d.__zero();if("object"===a(b)){if(b.constructor===d)return b;b=d.__toPrimitive(b);return d.BigInt(b)}throw new TypeError("Cannot convert "+b+" to a BigInt");}},{key:"toNumber",value:function(a){var b=a.length;if(0===b)return 0;if(1===b){var c=a.__unsignedDigit(0);return a.sign?-c:c}var e=a.__digit(b-1),k=d.__clz32(e);c=32*b-k;if(1024<c)return a.sign?-Infinity:1/0;--c;
var f=b-1,g=k+1;k=(32===g?0:e<<g)>>>12;var h=g-12;b=12<=g?0:e<<20+g;g=20+g;0<h&&0<f&&(f--,e=a.__digit(f),k|=e>>>32-h,b=e<<h,g=h);0<g&&0<f&&(f--,e=a.__digit(f),b|=e>>>32-g,g-=32);e=d.__decideRounding(a,g,f,e);if((1===e||0===e&&1==(1&b))&&(b=b+1>>>0,0===b&&(k++,0!=k>>>20&&(k=0,c++,1023<c))))return a.sign?-Infinity:1/0;a=a.sign?-2147483648:0;return c=c+1023<<20,d.__kBitConversionInts[1]=a|c|k,d.__kBitConversionInts[0]=b,d.__kBitConversionDouble[0]}},{key:"unaryMinus",value:function(a){if(0===a.length)return a;
var b=a.__copy();return b.sign=!a.sign,b}},{key:"bitwiseNot",value:function(a){return a.sign?d.__absoluteSubOne(a).__trim():d.__absoluteAddOne(a,!0)}},{key:"exponentiate",value:function(a,b){if(b.sign)throw new RangeError("Exponent must be positive");if(0===b.length)return d.__oneDigit(1,!1);if(0===a.length)return a;if(1===a.length&&1===a.__digit(0))return a.sign&&0==(1&b.__digit(0))?d.unaryMinus(a):a;if(1<b.length)throw new RangeError("BigInt too big");b=b.__unsignedDigit(0);if(1===b)return a;if(b>=
d.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===a.length&&2===a.__digit(0)){var c=1+(b>>>5);a=new d(c,a.sign&&0!=(1&b));a.__initializeDigits();return a.__setDigit(c-1,1<<(31&b)),a}c=null;var e=a;0!=(1&b)&&(c=a);for(b>>=1;0!==b;b>>=1)e=d.multiply(e,e),0!=(1&b)&&(null===c?c=e:c=d.multiply(c,e));return c}},{key:"multiply",value:function(a,b){if(0===a.length)return a;if(0===b.length)return b;var c=a.length+b.length;32<=a.__clzmsd()+b.__clzmsd()&&c--;c=new d(c,a.sign!==b.sign);c.__initializeDigits();
for(var e=0;e<a.length;e++)d.__multiplyAccumulate(b,a.__digit(e),c,e);return c.__trim()}},{key:"divide",value:function(a,b){if(0===b.length)throw new RangeError("Division by zero");if(0>d.__absoluteCompare(a,b))return d.__zero();var c=a.sign!==b.sign,e=b.__unsignedDigit(0);if(1===b.length&&65535>=e){if(1===e)return c===a.sign?a:d.unaryMinus(a);a=d.__absoluteDivSmall(a,e,null)}else a=d.__absoluteDivLarge(a,b,!0,!1);return a.sign=c,a.__trim()}},{key:"remainder",value:function(a,b){if(0===b.length)throw new RangeError("Division by zero");
if(0>d.__absoluteCompare(a,b))return a;var c=b.__unsignedDigit(0);if(1===b.length&&65535>=c){if(1===c)return d.__zero();b=d.__absoluteModSmall(a,c);return 0===b?d.__zero():d.__oneDigit(b,a.sign)}b=d.__absoluteDivLarge(a,b,!1,!0);return b.sign=a.sign,b.__trim()}},{key:"add",value:function(a,b){var c=a.sign;return c===b.sign?d.__absoluteAdd(a,b,c):0<=d.__absoluteCompare(a,b)?d.__absoluteSub(a,b,c):d.__absoluteSub(b,a,!c)}},{key:"subtract",value:function(a,b){var c=a.sign;return c===b.sign?0<=d.__absoluteCompare(a,
b)?d.__absoluteSub(a,b,c):d.__absoluteSub(b,a,!c):d.__absoluteAdd(a,b,c)}},{key:"leftShift",value:function(a,b){return 0===b.length||0===a.length?a:b.sign?d.__rightShiftByAbsolute(a,b):d.__leftShiftByAbsolute(a,b)}},{key:"signedRightShift",value:function(a,b){return 0===b.length||0===a.length?a:b.sign?d.__leftShiftByAbsolute(a,b):d.__rightShiftByAbsolute(a,b)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead");}},{key:"lessThan",
value:function(a,b){return 0>d.__compareToBigInt(a,b)}},{key:"lessThanOrEqual",value:function(a,b){return 0>=d.__compareToBigInt(a,b)}},{key:"greaterThan",value:function(a,b){return 0<d.__compareToBigInt(a,b)}},{key:"greaterThanOrEqual",value:function(a,b){return 0<=d.__compareToBigInt(a,b)}},{key:"equal",value:function(a,b){if(a.sign!==b.sign||a.length!==b.length)return!1;for(var d=0;d<a.length;d++)if(a.__digit(d)!==b.__digit(d))return!1;return!0}},{key:"notEqual",value:function(a,b){return!d.equal(a,
b)}},{key:"bitwiseAnd",value:function(a,b){if(!a.sign&&!b.sign)return d.__absoluteAnd(a,b).__trim();if(a.sign&&b.sign){var c=g(a.length,b.length)+1;a=d.__absoluteSubOne(a,c);b=d.__absoluteSubOne(b);return a=d.__absoluteOr(a,b,a),d.__absoluteAddOne(a,!0,a).__trim()}a.sign&&(b=[b,a],a=b[0],b=b[1]);return d.__absoluteAndNot(a,d.__absoluteSubOne(b)).__trim()}},{key:"bitwiseXor",value:function(a,b){if(!a.sign&&!b.sign)return d.__absoluteXor(a,b).__trim();if(a.sign&&b.sign){var c=g(a.length,b.length);a=
d.__absoluteSubOne(a,c);b=d.__absoluteSubOne(b);return d.__absoluteXor(a,b,a).__trim()}c=g(a.length,b.length)+1;a.sign&&(b=[b,a],a=b[0],b=b[1]);b=d.__absoluteSubOne(b,c);return b=d.__absoluteXor(b,a,b),d.__absoluteAddOne(b,!0,b).__trim()}},{key:"bitwiseOr",value:function(a,b){var c=g(a.length,b.length);if(!a.sign&&!b.sign)return d.__absoluteOr(a,b).__trim();if(a.sign&&b.sign)return a=d.__absoluteSubOne(a,c),b=d.__absoluteSubOne(b),a=d.__absoluteAnd(a,b,a),d.__absoluteAddOne(a,!0,a).__trim();a.sign&&
(b=[b,a],a=b[0],b=b[1]);b=d.__absoluteSubOne(b,c);return b=d.__absoluteAndNot(b,a,b),d.__absoluteAddOne(b,!0,b).__trim()}},{key:"asIntN",value:function(a,b){if(0===b.length)return b;if(0===a)return d.__zero();if(a>=d.__kMaxLengthBits)return b;var c=a+31>>>5;if(b.length<c)return b;var e=b.__unsignedDigit(c-1),k=1<<(31&a-1);if(b.length===c&&e<k)return b;if((e&k)!==k)return d.__truncateToNBits(a,b);if(!b.sign)return d.__truncateAndSubFromPowerOfTwo(a,b,!0);if(0==(e&k-1)){for(var f=c-2;0<=f;f--)if(0!==
b.__digit(f))return d.__truncateAndSubFromPowerOfTwo(a,b,!1);return b.length===c&&e===k?b:d.__truncateToNBits(a,b)}return d.__truncateAndSubFromPowerOfTwo(a,b,!1)}},{key:"asUintN",value:function(a,b){if(0===b.length)return b;if(0===a)return d.__zero();if(b.sign){if(a>d.__kMaxLengthBits)throw new RangeError("BigInt too big");return d.__truncateAndSubFromPowerOfTwo(a,b,!1)}if(a>=d.__kMaxLengthBits)return b;var c=a+31>>>5;if(b.length<c)return b;var e=31&a;return b.length!=c||0!==e&&0!=b.__digit(c-1)>>>
e?d.__truncateToNBits(a,b):b}},{key:"ADD",value:function(a,b){if(a=d.__toPrimitive(a),b=d.__toPrimitive(b),"string"==typeof a)return"string"!=typeof b&&(b=b.toString()),a+b;if("string"==typeof b)return a.toString()+b;if(a=d.__toNumeric(a),b=d.__toNumeric(b),d.__isBigInt(a)&&d.__isBigInt(b))return d.add(a,b);if("number"==typeof a&&"number"==typeof b)return a+b;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions");}},{key:"LT",value:function(a,b){return d.__compare(a,b,
0)}},{key:"LE",value:function(a,b){return d.__compare(a,b,1)}},{key:"GT",value:function(a,b){return d.__compare(a,b,2)}},{key:"GE",value:function(a,b){return d.__compare(a,b,3)}},{key:"EQ",value:function(b,c){for(;;){if(d.__isBigInt(b))return d.__isBigInt(c)?d.equal(b,c):d.EQ(c,b);if("number"==typeof b){if(d.__isBigInt(c))return d.__equalToNumber(c,b);if("object"!==a(c))return b==c;c=d.__toPrimitive(c)}else if("string"==typeof b){if(d.__isBigInt(c))return b=d.__fromString(b),null!==b&&d.equal(b,c);
if("object"!==a(c))return b==c;c=d.__toPrimitive(c)}else if("boolean"==typeof b){if(d.__isBigInt(c))return d.__equalToNumber(c,+b);if("object"!==a(c))return b==c;c=d.__toPrimitive(c)}else if("symbol"===a(b)){if(d.__isBigInt(c))return!1;if("object"!==a(c))return b==c;c=d.__toPrimitive(c)}else if("object"===a(b)){if("object"===a(c)&&c.constructor!==d)return b==c;b=d.__toPrimitive(b)}else return b==c}}},{key:"NE",value:function(a,b){return!d.EQ(a,b)}},{key:"__zero",value:function(){return new d(0,!1)}},
{key:"__oneDigit",value:function(a,b){b=new d(1,b);return b.__setDigit(0,a),b}},{key:"__decideRounding",value:function(a,b,d,c){if(0<b)return-1;if(0>b)b=-b-1;else{if(0===d)return-1;d--;c=a.__digit(d);b=31}b=1<<b;if(0==(c&b))return-1;if(--b,0!=(c&b))return 1;for(;0<d;)if(d--,0!==a.__digit(d))return 1;return 0}},{key:"__fromDouble",value:function(a){d.__kBitConversionDouble[0]=a;var b=(2047&d.__kBitConversionInts[1]>>>20)-1023;var c=(b>>>5)+1;a=new d(c,0>a);var e=1048575&d.__kBitConversionInts[1]|1048576,
k=d.__kBitConversionInts[0];b&=31;if(20>b){var f=20-b;var g=f+32;b=e>>>f;e=e<<32-f|k>>>f;k<<=32-f}else 20===b?(g=32,b=e,e=k):(f=b-20,g=32-f,b=e<<f|k>>>32-f,e=k<<f);a.__setDigit(c-1,b);for(c-=2;0<=c;c--)0<g?(g-=32,b=e,e=k):b=0,a.__setDigit(c,b);return a.__trim()}},{key:"__isWhitespace",value:function(a){return!!(13>=a&&9<=a)||(159>=a?32==a:131071>=a?160==a||5760==a:196607>=a?(a&=131071,10>=a||40==a||41==a||47==a||95==a||4096==a):65279==a)}},{key:"__fromString",value:function(a){var b=1<arguments.length&&
void 0!==arguments[1]?arguments[1]:0,c=0,e=a.length,k=0;if(k===e)return d.__zero();for(var f=a.charCodeAt(k);d.__isWhitespace(f);){if(++k===e)return d.__zero();f=a.charCodeAt(k)}if(43===f){if(++k===e)return null;f=a.charCodeAt(k);c=1}else if(45===f){if(++k===e)return null;f=a.charCodeAt(k);c=-1}if(0===b){if(b=10,48===f){if(++k===e)return d.__zero();if(f=a.charCodeAt(k),88===f||120===f){if(b=16,++k===e)return null;f=a.charCodeAt(k)}else if(79===f||111===f){if(b=8,++k===e)return null;f=a.charCodeAt(k)}else if(66===
f||98===f){if(b=2,++k===e)return null;f=a.charCodeAt(k)}}}else if(16===b&&48===f){if(++k===e)return d.__zero();if(f=a.charCodeAt(k),88===f||120===f){if(++k===e)return null;f=a.charCodeAt(k)}}for(;48===f;){if(++k===e)return d.__zero();f=a.charCodeAt(k)}var g=e-k,h=d.__kMaxBitsPerChar[b],p=d.__kBitsPerCharTableMultiplier-1;if(g>1073741824/h)return null;g=new d((h*g+p>>>d.__kBitsPerCharTableShift)+31>>>5,!1);var l=10>b?b:10,v=10<b?b-10:0;if(0==(b&b-1)){h>>=d.__kBitsPerCharTableShift;var B=[],n=[],A=
!1;do{for(var D,u=p=0;;){if(f-48>>>0<l)D=f-48;else if((32|f)-97>>>0<v)D=(32|f)-87;else{A=!0;break}if(u+=h,p=p<<h|D,++k===e){A=!0;break}if(f=a.charCodeAt(k),32<u+h)break}B.push(p);n.push(u)}while(!A);d.__fillFromParts(g,B,n)}else{g.__initializeDigits();B=!1;n=0;do{A=0;for(D=1;;){if(f-48>>>0<l)p=f-48;else if((32|f)-97>>>0<v)p=(32|f)-87;else{B=!0;break}u=D*b;if(4294967295<u)break;if(D=u,A=A*b+p,n++,++k===e){B=!0;break}f=a.charCodeAt(k)}p=32*d.__kBitsPerCharTableMultiplier-1;g.__inplaceMultiplyAdd(D,
A,h*n+p>>>d.__kBitsPerCharTableShift+5)}while(!B)}if(k!==e){if(!d.__isWhitespace(f))return null;for(k++;k<e;k++)if(f=a.charCodeAt(k),!d.__isWhitespace(f))return null}return 0!==c&&10!==b?null:(g.sign=-1===c,g.__trim())}},{key:"__fillFromParts",value:function(a,b,d){for(var c=0,e=0,k=0,f=b.length-1;0<=f;f--){var g=b[f],h=d[f];e|=g<<k;k+=h;32===k?(a.__setDigit(c++,e),k=0,e=0):32<k&&(a.__setDigit(c++,e),k-=32,e=g>>>h-k)}if(0!==e){if(c>=a.length)throw Error("implementation bug");a.__setDigit(c++,e)}for(;c<
a.length;c++)a.__setDigit(c,0)}},{key:"__toStringBasePowerOfTwo",value:function(a,b){var c=a.length,e=b-1;e=(85&e>>>1)+(85&e);e=(51&e>>>2)+(51&e);e=(15&e>>>4)+(15&e);--b;var k=a.__digit(c-1),f=d.__clz32(k),g=0|(32*c-f+e-1)/e;if(a.sign&&g++,268435456<g)throw Error("string too long");f=Array(g);--g;for(var h=0,p=0,l=0;l<c-1;l++){var v=a.__digit(l);h=(h|v<<p)&b;f[g--]=d.__kConversionChars[h];p=e-p;h=v>>>p;for(p=32-p;p>=e;)f[g--]=d.__kConversionChars[h&b],h>>>=e,p-=e}f[g--]=d.__kConversionChars[(h|k<<
p)&b];for(h=k>>>e-p;0!==h;)f[g--]=d.__kConversionChars[h&b],h>>>=e;if(a.sign&&(f[g--]="-"),-1!==g)throw Error("implementation bug");return f.join("")}},{key:"__toStringGeneric",value:function(a,b,c){var e=a.length;if(0===e)return"";if(1===e)return b=a.__unsignedDigit(0).toString(b),!1===c&&a.sign&&(b="-"+b),b;var k=32*e-d.__clz32(a.__digit(e-1));e=d.__kMaxBitsPerChar[b]-1;k*=d.__kBitsPerCharTableMultiplier;e=(0|(k+(e-1))/e)+1>>1;k=d.exponentiate(d.__oneDigit(b,!1),d.__oneDigit(e,!1));var f=k.__unsignedDigit(0);
if(1===k.length&&65535>=f){k=new d(a.length,!1);k.__initializeDigits();var g=0;for(var h=2*a.length-1;0<=h;h--)g=g<<16|a.__halfDigit(h),k.__setHalfDigit(h,0|g/f),g=0|g%f;f=g.toString(b)}else f=d.__absoluteDivLarge(a,k,!0,!0),k=f.quotient,f=f.remainder.__trim(),f=d.__toStringGeneric(f,b,!0);k.__trim();for(b=d.__toStringGeneric(k,b,!0);f.length<e;)f="0"+f;return!1===c&&a.sign&&(b="-"+b),b+f}},{key:"__unequalSign",value:function(a){return a?-1:1}},{key:"__absoluteGreater",value:function(a){return a?
-1:1}},{key:"__absoluteLess",value:function(a){return a?1:-1}},{key:"__compareToBigInt",value:function(a,b){var c=a.sign;if(c!==b.sign)return d.__unequalSign(c);a=d.__absoluteCompare(a,b);return 0<a?d.__absoluteGreater(c):0>a?d.__absoluteLess(c):0}},{key:"__compareToNumber",value:function(a,b){if(1|b){var e=a.sign,k=0>b;if(e!==k)return d.__unequalSign(e);if(0===a.length){if(k)throw Error("implementation bug");return 0===b?0:-1}if(1<a.length)return d.__absoluteGreater(e);b=c(b);a=a.__unsignedDigit(0);
return a>b?d.__absoluteGreater(e):a<b?d.__absoluteLess(e):0}return d.__compareToDouble(a,b)}},{key:"__compareToDouble",value:function(a,b){if(b!==b)return b;if(b===1/0)return-1;if(-Infinity===b)return 1;var c=a.sign;if(c!==0>b)return d.__unequalSign(c);if(0===b)throw Error("implementation bug: should be handled elsewhere");if(0===a.length)return-1;d.__kBitConversionDouble[0]=b;b=2047&d.__kBitConversionInts[1]>>>20;if(2047==b)throw Error("implementation bug: handled elsewhere");var e=b-1023;if(0>e)return d.__absoluteGreater(c);
b=a.length;var k=a.__digit(b-1),f=d.__clz32(k),g=32*b-f;e+=1;if(g<e)return d.__absoluteLess(c);if(g>e)return d.__absoluteGreater(c);e=1048576|1048575&d.__kBitConversionInts[1];var h=d.__kBitConversionInts[0];f=31-f;if(f!==(g-1)%31)throw Error("implementation bug");if(20>f){var p=20-f;f=p+32;g=e>>>p;e=e<<32-p|h>>>p;h<<=32-p}else 20===f?(f=32,g=e,e=h):(p=f-20,f=32-p,g=e<<p|h>>>32-p,e=h<<p);if(k>>>=0,g>>>=0,k>g)return d.__absoluteGreater(c);if(k<g)return d.__absoluteLess(c);for(b-=2;0<=b;b--){0<f?(f-=
32,g=e>>>0,e=h,h=0):g=0;k=a.__unsignedDigit(b);if(k>g)return d.__absoluteGreater(c);if(k<g)return d.__absoluteLess(c)}if(0!==e||0!==h){if(0===f)throw Error("implementation bug");return d.__absoluteLess(c)}return 0}},{key:"__equalToNumber",value:function(a,b){return b|0===b?0===b?0===a.length:1===a.length&&a.sign===0>b&&a.__unsignedDigit(0)===c(b):0===d.__compareToDouble(a,b)}},{key:"__comparisonResultToBool",value:function(a,b){switch(b){case 0:return 0>a;case 1:return 0>=a;case 2:return 0<a;case 3:return 0<=
a}throw Error("unreachable");}},{key:"__compare",value:function(a,b,c){if(a=d.__toPrimitive(a),b=d.__toPrimitive(b),"string"==typeof a&&"string"==typeof b)switch(c){case 0:return a<b;case 1:return a<=b;case 2:return a>b;case 3:return a>=b}if(d.__isBigInt(a)&&"string"==typeof b)return b=d.__fromString(b),null!==b&&d.__comparisonResultToBool(d.__compareToBigInt(a,b),c);if("string"==typeof a&&d.__isBigInt(b))return a=d.__fromString(a),null!==a&&d.__comparisonResultToBool(d.__compareToBigInt(a,b),c);
if(a=d.__toNumeric(a),b=d.__toNumeric(b),d.__isBigInt(a)){if(d.__isBigInt(b))return d.__comparisonResultToBool(d.__compareToBigInt(a,b),c);if("number"!=typeof b)throw Error("implementation bug");return d.__comparisonResultToBool(d.__compareToNumber(a,b),c)}if("number"!=typeof a)throw Error("implementation bug");if(d.__isBigInt(b))return d.__comparisonResultToBool(d.__compareToNumber(b,a),2^c);if("number"!=typeof b)throw Error("implementation bug");return 0===c?a<b:1===c?a<=b:2===c?a>b:3===c?a>=b:
void 0}},{key:"__absoluteAdd",value:function(a,b,c){if(a.length<b.length)return d.__absoluteAdd(b,a,c);if(0===a.length)return a;if(0===b.length)return a.sign===c?a:d.unaryMinus(a);var e=a.length;(0===a.__clzmsd()||b.length===a.length&&0===b.__clzmsd())&&e++;c=new d(e,c);for(var k=e=0;k<b.length;k++){var f=b.__digit(k),g=a.__digit(k),h=(65535&g)+(65535&f)+e;f=(g>>>16)+(f>>>16)+(h>>>16);e=f>>>16;c.__setDigit(k,65535&h|f<<16)}for(;k<a.length;k++)h=a.__digit(k),b=(65535&h)+e,h=(h>>>16)+(b>>>16),e=h>>>
16,c.__setDigit(k,65535&b|h<<16);return k<c.length&&c.__setDigit(k,e),c.__trim()}},{key:"__absoluteSub",value:function(a,b,c){if(0===a.length)return a;if(0===b.length)return a.sign===c?a:d.unaryMinus(a);c=new d(a.length,c);for(var e=0,k=0;k<b.length;k++){var f=a.__digit(k),g=b.__digit(k),h=(65535&f)-(65535&g)-e;e=1&h>>>16;f=(f>>>16)-(g>>>16)-e;e=1&f>>>16;c.__setDigit(k,65535&h|f<<16)}for(;k<a.length;k++)h=a.__digit(k),b=(65535&h)-e,e=1&b>>>16,h=(h>>>16)-e,e=1&h>>>16,c.__setDigit(k,65535&b|h<<16);
return c.__trim()}},{key:"__absoluteAddOne",value:function(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,e=a.length;null===c?c=new d(e,b):c.sign=b;for(var k,f=!0,g=0;g<e;g++){if(k=a.__digit(g),f)f=-1===k,k=0|k+1;c.__setDigit(g,k)}return f&&c.__setDigitGrow(e,1),c}},{key:"__absoluteSubOne",value:function(a,b){var c=a.length;b=b||c;for(var e,k=new d(b,!1),f=!0,g=0;g<c;g++){if(e=a.__digit(g),f)f=0===e,e=0|e-1;k.__setDigit(g,e)}if(f)throw Error("implementation bug");for(a=c;a<
b;a++)k.__setDigit(a,0);return k}},{key:"__absoluteAnd",value:function(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,e=a.length,k=b.length,f=k;e<k&&(f=e,e=a,a=b,b=e);e=f;null===c?c=new d(e,!1):e=c.length;for(k=0;k<f;k++)c.__setDigit(k,a.__digit(k)&b.__digit(k));for(;k<e;k++)c.__setDigit(k,0);return c}},{key:"__absoluteAndNot",value:function(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,e=a.length,k=b.length,f=k;e<k&&(f=e);k=e;null===c?c=new d(k,!1):
k=c.length;for(var g=0;g<f;g++)c.__setDigit(g,a.__digit(g)&~b.__digit(g));for(;g<e;g++)c.__setDigit(g,a.__digit(g));for(;g<k;g++)c.__setDigit(g,0);return c}},{key:"__absoluteOr",value:function(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,e=a.length,k=b.length,f=k;if(e<k){f=e;var g=a;a=b;e=k;b=g}k=e;null===c?c=new d(k,!1):k=c.length;for(g=0;g<f;g++)c.__setDigit(g,a.__digit(g)|b.__digit(g));for(;g<e;g++)c.__setDigit(g,a.__digit(g));for(;g<k;g++)c.__setDigit(g,0);return c}},
{key:"__absoluteXor",value:function(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,e=a.length,k=b.length,f=k;if(e<k){f=e;var g=a;a=b;e=k;b=g}k=e;null===c?c=new d(k,!1):k=c.length;for(g=0;g<f;g++)c.__setDigit(g,a.__digit(g)^b.__digit(g));for(;g<e;g++)c.__setDigit(g,a.__digit(g));for(;g<k;g++)c.__setDigit(g,0);return c}},{key:"__absoluteCompare",value:function(a,b){var d=a.length-b.length;if(0!=d)return d;for(d=a.length-1;0<=d&&a.__digit(d)===b.__digit(d);)d--;return 0>d?0:a.__unsignedDigit(d)>
b.__unsignedDigit(d)?1:-1}},{key:"__multiplyAccumulate",value:function(a,b,c,e){if(0!==b){for(var k=65535&b,f=b>>>16,g=b=0,h=0,p=0;p<a.length;p++,e++){var l=c.__digit(e),v=65535&l;l>>>=16;var B=a.__digit(p),n=65535&B,A=B>>>16;B=d.__imul(n,k);n=d.__imul(n,f);var D=d.__imul(A,k);A=d.__imul(A,f);v+=g+(65535&B);l+=h+b+(v>>>16)+(B>>>16)+(65535&n)+(65535&D);b=l>>>16;g=(n>>>16)+(D>>>16)+(65535&A)+b;b=g>>>16;g&=65535;h=A>>>16;l=65535&v|l<<16;c.__setDigit(e,l)}for(;0!==b||0!==g||0!==h;e++)k=c.__digit(e),a=
(65535&k)+g,k=(k>>>16)+(a>>>16)+h+b,h=g=0,b=k>>>16,k=65535&a|k<<16,c.__setDigit(e,k)}}},{key:"__internalMultiplyAdd",value:function(a,b,c,e,k){for(var f=0,g=0;g<e;g++){var h=a.__digit(g),p=d.__imul(65535&h,b),l=(65535&p)+f+c;c=l>>>16;f=d.__imul(h>>>16,b);p=(65535&f)+(p>>>16)+c;c=p>>>16;f>>>=16;k.__setDigit(g,p<<16|65535&l)}if(k.length>e)for(k.__setDigit(e++,c+f);e<k.length;)k.__setDigit(e++,0);else if(0!==c+f)throw Error("implementation bug");}},{key:"__absoluteDivSmall",value:function(a,b,c){null===
c&&(c=new d(a.length,!1));for(var e=0,k=2*a.length-1;0<=k;k-=2){e=(e<<16|a.__halfDigit(k))>>>0;var f=0|e/b;e=0|e%b;e=(e<<16|a.__halfDigit(k-1))>>>0;var g=0|e/b;e=0|e%b;c.__setDigit(k>>>1,f<<16|g)}return c}},{key:"__absoluteModSmall",value:function(a,b){var d=0;for(var c=2*a.length-1;0<=c;c--)d=(d<<16|a.__halfDigit(c))>>>0,d=0|d%b;return d}},{key:"__absoluteDivLarge",value:function(a,b,c,e){var k=b.__halfDigitLength(),f=b.length,g=a.__halfDigitLength()-k,h=null;c&&(h=new d(g+2>>>1,!1),h.__initializeDigits());
var p=new d(k+2>>>1,!1);p.__initializeDigits();var l=d.__clz16(b.__halfDigit(k-1));0<l&&(b=d.__specialLeftShift(b,l,0));a=d.__specialLeftShift(a,l,1);for(var v=b.__halfDigit(k-1),B=0;0<=g;g--){var n=65535,A=a.__halfDigit(g+k);if(A!==v){A=(A<<16|a.__halfDigit(g+k-1))>>>0;n=0|A/v;A=0|A%v;for(var D=b.__halfDigit(k-2),u=a.__halfDigit(g+k-2);d.__imul(n,D)>>>0>(A<<16|u)>>>0&&(n--,A+=v,!(65535<A)););}d.__internalMultiplyAdd(b,n,0,f,p);A=a.__inplaceSub(p,g,k+1);0!==A&&(A=a.__inplaceAdd(b,g,k),a.__setHalfDigit(g+
k,a.__halfDigit(g+k)+A),n--);c&&(1&g?B=n<<16:h.__setDigit(g>>>1,B|n))}return e?(a.__inplaceRightShift(l),c?{quotient:h,remainder:a}:a):c?h:void 0}},{key:"__clz16",value:function(a){return d.__clz32(a)-16}},{key:"__specialLeftShift",value:function(a,b,c){var e=a.length,k=new d(e+c,!1);if(0===b){for(b=0;b<e;b++)k.__setDigit(b,a.__digit(b));return 0<c&&k.__setDigit(e,0),k}for(var f,g=0,h=0;h<e;h++)f=a.__digit(h),k.__setDigit(h,f<<b|g),g=f>>>32-b;return 0<c&&k.__setDigit(e,g),k}},{key:"__leftShiftByAbsolute",
value:function(a,b){var c=d.__toShiftAmount(b);if(0>c)throw new RangeError("BigInt too big");b=c>>>5;var e=31&c,k=a.length,f=0!==e&&0!=a.__digit(k-1)>>>32-e,g=k+b+(f?1:0);c=new d(g,a.sign);if(0===e){for(e=0;e<b;e++)c.__setDigit(e,0);for(;e<g;e++)c.__setDigit(e,a.__digit(e-b))}else{for(var h=g=0;h<b;h++)c.__setDigit(h,0);for(var p=0;p<k;p++)h=a.__digit(p),c.__setDigit(p+b,h<<e|g),g=h>>>32-e;if(f)c.__setDigit(k+b,g);else if(0!==g)throw Error("implementation bug");}return c.__trim()}},{key:"__rightShiftByAbsolute",
value:function(a,b){var c=a.length,e=a.sign,k=d.__toShiftAmount(b);if(0>k)return d.__rightShiftByMaximum(e);b=k>>>5;var f=31&k,g=c-b;if(0>=g)return d.__rightShiftByMaximum(e);k=!1;if(e)if(0!=(a.__digit(b)&(1<<f)-1))k=!0;else for(var h=0;h<b;h++)if(0!==a.__digit(h)){k=!0;break}k&&0===f&&0==~a.__digit(c-1)&&g++;e=new d(g,e);if(0===f)for(f=b;f<c;f++)e.__setDigit(f-b,a.__digit(f));else{g=a.__digit(b)>>>f;h=c-b-1;for(var p=0;p<h;p++)c=a.__digit(p+b+1),e.__setDigit(p,c<<32-f|g),g=c>>>f;e.__setDigit(h,g)}return k&&
(e=d.__absoluteAddOne(e,!0,e)),e.__trim()}},{key:"__rightShiftByMaximum",value:function(a){return a?d.__oneDigit(1,!0):d.__zero()}},{key:"__toShiftAmount",value:function(a){if(1<a.length)return-1;a=a.__unsignedDigit(0);return a>d.__kMaxLengthBits?-1:a}},{key:"__toPrimitive",value:function(b){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"default";if("object"!==a(b)||b.constructor===d)return b;var e=b[Symbol.toPrimitive];if(e){c=e(c);if("object"!==a(c))return c;throw new TypeError("Cannot convert object to primitive value");
}if(c=b.valueOf)if(c=c.call(b),"object"!==a(c))return c;if(c=b.toString)if(c=c.call(b),"object"!==a(c))return c;throw new TypeError("Cannot convert object to primitive value");}},{key:"__toNumeric",value:function(a){return d.__isBigInt(a)?a:+a}},{key:"__isBigInt",value:function(b){return"object"===a(b)&&b.constructor===d}},{key:"__truncateToNBits",value:function(a,b){var c=a+31>>>5,e=new d(c,b.sign);--c;for(var k=0;k<c;k++)e.__setDigit(k,b.__digit(k));b=b.__digit(c);0!=(31&a)&&(a=32-(31&a),b=b<<a>>>
a);return e.__setDigit(c,b),e.__trim()}},{key:"__truncateAndSubFromPowerOfTwo",value:function(a,b,c){var e=Math.min,k=a+31>>>5;c=new d(k,c);var f=0;--k;var g=0;for(e=e(k,b.length);f<e;f++){var h=b.__digit(f),p=-(65535&h)-g;g=1&p>>>16;h=-(h>>>16)-g;g=1&h>>>16;c.__setDigit(f,65535&p|h<<16)}for(;f<k;f++)c.__setDigit(f,0|-g);b=k<b.length?b.__digit(k):0;a&=31;0===a?(g=-(65535&b)-g,g=65535&g|-(b>>>16)-(1&g>>>16)<<16):(a=32-a,b=b<<a>>>a,a=1<<32-a,g=(65535&a)-(65535&b)-g,g=(65535&g|(a>>>16)-(b>>>16)-(1&g>>>
16)<<16)&a-1);return c.__setDigit(k,g),c.__trim()}},{key:"__digitPow",value:function(a,b){for(var d=1;0<b;)1&b&&(d*=a),b>>>=1,a*=a;return d}}]),d}(n(Array));return B.__kMaxLength=33554432,B.__kMaxLengthBits=B.__kMaxLength<<5,B.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],B.__kBitsPerCharTableShift=5,B.__kBitsPerCharTableMultiplier=1<<B.__kBitsPerCharTableShift,B.__kConversionChars="0123456789abcdefghijklmnopqrstuvwxyz".split(""),
B.__kBitConversionBuffer=new ArrayBuffer(8),B.__kBitConversionDouble=new Float64Array(B.__kBitConversionBuffer),B.__kBitConversionInts=new Int32Array(B.__kBitConversionBuffer),B.__clz32=v||function(a){var b=Math.LN2,d=Math.log;return 0===a?32:0|31-(0|d(a>>>0)/b)},B.__imul=t||function(a,b){return 0|a*b},B})},function(m,q,a){(function(a,b){(function(a,c){function e(a){delete t[a]}function f(a){if(v)setTimeout(f,0,a);else{var b=t[a];if(b){v=!0;try{var d=b.callback,k=b.args;switch(k.length){case 0:d();
break;case 1:d(k[0]);break;case 2:d(k[0],k[1]);break;case 3:d(k[0],k[1],k[2]);break;default:d.apply(c,k)}}finally{e(a),v=!1}}}}function d(){D=function(a){b.nextTick(function(){f(a)})}}function g(){if(a.postMessage&&!a.importScripts){var b=!0,d=a.onmessage;a.onmessage=function(){b=!1};a.postMessage("","*");a.onmessage=d;return b}}function n(){var b="setImmediate$"+Math.random()+"$",d=function(d){d.source===a&&"string"===typeof d.data&&0===d.data.indexOf(b)&&f(+d.data.slice(b.length))};a.addEventListener?
a.addEventListener("message",d,!1):a.attachEvent("onmessage",d);D=function(d){a.postMessage(b+d,"*")}}function k(){var a=new MessageChannel;a.port1.onmessage=function(a){f(a.data)};D=function(b){a.port2.postMessage(b)}}function p(){var a=B.documentElement;D=function(b){var d=B.createElement("script");d.onreadystatechange=function(){f(b);d.onreadystatechange=null;a.removeChild(d);d=null};a.appendChild(d)}}function u(){D=function(a){setTimeout(f,0,a)}}if(!a.setImmediate){var A=1,t={},v=!1,B=a.document,
D,E=Object.getPrototypeOf&&Object.getPrototypeOf(a);E=E&&E.setTimeout?E:a;"[object process]"==={}.toString.call(a.process)?d():g()?n():a.MessageChannel?k():B&&"onreadystatechange"in B.createElement("script")?p():u();E.setImmediate=function(a){"function"!==typeof a&&(a=new Function(""+a));for(var b=Array(arguments.length-1),d=0;d<b.length;d++)b[d]=arguments[d+1];t[A]={callback:a,args:b};D(A);return A++};E.clearImmediate=e}})("undefined"===typeof self?"undefined"===typeof a?this:a:self)}).call(this,
a(0),a(8))},function(m,q){function a(){throw Error("setTimeout has not been defined");}function c(){throw Error("clearTimeout has not been defined");}function b(b){if(g===setTimeout)return setTimeout(b,0);if((g===a||!g)&&setTimeout)return g=setTimeout,setTimeout(b,0);try{return g(b,0)}catch(v){try{return g.call(null,b,0)}catch(B){return g.call(this,b,0)}}}function e(a){if(n===clearTimeout)return clearTimeout(a);if((n===c||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(a);try{return n(a)}catch(v){try{return n.call(null,
a)}catch(B){return n.call(this,a)}}}function f(){p&&u&&(p=!1,u.length?k=u.concat(k):A=-1,k.length&&l())}function l(){if(!p){var a=b(f);p=!0;for(var d=k.length;d;){u=k;for(k=[];++A<d;)u&&u[A].run();A=-1;d=k.length}u=null;p=!1;e(a)}}function h(a,b){this.fun=a;this.array=b}function d(){}m=m.exports={};try{var g="function"===typeof setTimeout?setTimeout:a}catch(t){g=a}try{var n="function"===typeof clearTimeout?clearTimeout:c}catch(t){n=c}var k=[],p=!1,u,A=-1;m.nextTick=function(a){var d=Array(arguments.length-
1);if(1<arguments.length)for(var c=1;c<arguments.length;c++)d[c-1]=arguments[c];k.push(new h(a,d));1!==k.length||p||b(l)};h.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=d;m.addListener=d;m.once=d;m.off=d;m.removeListener=d;m.removeAllListeners=d;m.emit=d;m.prependListener=d;m.prependOnceListener=d;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,q){Sk.asserts={};Sk.asserts.assert=function(a,c){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,q){Sk.bool_check=function(a,c){if(void 0===a||null===a||"boolean"!==typeof a)throw Error("must specify "+c+" 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.filewriter=a.filewriter||Sk.filewriter;Sk.asserts.assert("function"===typeof Sk.filewriter);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.python3;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(a){Sk.signals.listeners.push(a)},removeEventListener(a){a=Sk.signals.listeners.indexOf(a);0<=a&&Sk.signals.listeners.splice(a,
1)},signal(a,b){for(var c=0;c<Sk.signals.listeners.length;c++)Sk.signals.listeners[c].call(null,a,b)}}: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,b){setTimeout(a,b)}:function(a,b){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(Sk.__future__.python3);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.setupObjects(Sk.__future__.python3);Sk.token.setupTokens(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,Sk.filewriter=Sk.global.write):void 0!==Sk.global.console&&void 0!==Sk.global.console.log?(Sk.output=function(a){Sk.global.console.log(a)},Sk.filewriter=Sk.output):
void 0!==Sk.global.print&&(Sk.output=Sk.global.print,Sk.filewriter=Sk.output);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(){};Sk.setupDictIterators=function(a){};Sk.switch_version=function(a){const c={float_:{method_names:["__round__"],2:[!1],3:[!0]},int_:{method_names:["__round__"],2:[!1],3:[!0]},
list:{method_names:["clear","copy","sort"],2:[!1,!1,!0],3:[!0,!0,!0]},dict:{method_names:["has_key","keys","items","values"],2:[!0,!0,!0,!0],3:[!1,!0,!0,!0]}};for(let l in c){const h=Sk.builtin[l],d=c[l].method_names;var b=c[l][3];if(a&&void 0===h.py3$methods)break;else if(void 0===h.py3$methods){h.py3$methods={};for(var e=0;e<d.length;e++){var f=d[e];b[e]&&(h.py3$methods[f]=h.prototype[f].d$def)}}a?e=h.py3$methods:(b=c[l][2],e=h.py2$methods);for(f=0;f<d.length;f++){const a=d[f];delete h.prototype[a];
b[f]&&(h.prototype[a]=new Sk.builtin.method_descriptor(h,e[a]))}}};Sk.exportSymbol("Sk.__future__",Sk.__future__);Sk.exportSymbol("Sk.inputfun",Sk.inputfun)},function(m,q){function a(a){return this.prototype[a.$mangled]}function c(a){a=a.$mangled;const b=this.prototype.tp$mro;for(let d=0;d<b.length;++d){const c=b[d].prototype;if(c.hasOwnProperty(a))return c[a]}}function b(b,f,h,k){const d=e(h),g=f.prototype;Sk.abstr.setUpInheritance(b,f,d,k);Object.defineProperties(g,{sk$prototypical:{value:!0,writable:!0},
tp$bases:{value:h,writable:!0},tp$mro:{value:null,writable:!0},hp$type:{value:!0,writable:!0}});g.tp$mro=f.$buildMRO();Object.defineProperties(f,{$typeLookup:{value:g.sk$prototypical?a:c,writable:!0},sk$klass:{value:!0,writable:!0}})}function e(a){function b(a){return void 0===a.sk$klass?a:b(a.prototype.tp$base)}0===a.length&&a.push(Sk.builtin.object);let d,c,e,f;for(let k=0;k<a.length;k++){f=a[k];if(!Sk.builtin.checkClass(f))throw new Sk.builtin.TypeError("bases must be 'type' objects");if(!1===
f.sk$acceptable_as_base_class)throw new Sk.builtin.TypeError("type '"+f.prototype.tp$name+"' is not an acceptable base type");e=b(f);if(void 0===c)c=e,d=f;else if(!c.$isSubType(e))if(e.$isSubType(c))c=e,d=f;else throw new Sk.builtin.TypeError("multiple bases have instance layout conflicts");}return d}function f(a){for(;null!==a.prototype.tp$base;){if(void 0===a.sk$klass&&a.prototype.hasOwnProperty("__dict__"))return a=a.prototype.__dict__,Sk.builtin.checkDataDescr(a)?a:void 0;a=a.prototype.tp$base}}
function l(a,b,c){if(void 0===a.sk$klass)throw new Sk.builtin.TypeError("can't set "+a.prototype.tp$name+"."+c.$jsstr());if(void 0===b)throw new Sk.builtin.TypeError("can't delete "+a.prototype.tp$name+"."+c.$jsstr());}void 0===Sk.builtin&&(Sk.builtin={});Sk.builtin.type=function(a){this instanceof Sk.builtin.type&&Sk.asserts.fail("calling new Sk.builtin.type is not safe");return a.ob$type};Object.defineProperties(Sk.builtin.type.prototype,{call:{value:Function.prototype.call},apply:{value:Function.prototype.apply},
tp$slots:{value:{tp$doc:"type(object_or_name, bases, dict)\ntype(object) -> the object's type\ntype(name, bases, dict) -> a new type",tp$call:function(a,b){if(this===Sk.builtin.type){if(1===a.length&&(void 0===b||!b.length))return a[0].ob$type;if(3!==a.length)throw new Sk.builtin.TypeError("type() takes 1 or 3 arguments");}let d=this.prototype.tp$new(a,b);if(d.$isSuspension)return Sk.misceval.chain(d,c=>{d=c;if(d.ob$type.$isSubType(this))return d.tp$init(a,b)},()=>d);if(d.ob$type.$isSubType(this)){const c=
d.tp$init(a,b);return void 0!==c&&c.$isSuspension?Sk.misceval.chain(c,()=>d):d}return d},tp$new:function(a,c){if(3!==a.length){if(1===a.length&&(void 0===c||!c.length))return a[0].ob$type;throw new Sk.builtin.TypeError("type() takes 1 or 3 arguments");}let d;c=a[0];d=a[1];a=a[2];if("dict"!==a.tp$name)throw new Sk.builtin.TypeError("type() argument 3 must be dict, not "+Sk.abstr.typeName(a));if(!Sk.builtin.checkString(c))throw new Sk.builtin.TypeError("type() argument 1 must be str, not "+Sk.abstr.typeName(c));
c=c.$jsstr();if("tuple"!==d.tp$name)throw new Sk.builtin.TypeError("type() argument 2 must be tuple, not "+Sk.abstr.typeName(d));d=d.sk$asarray();const e=function(){this.$d=new Sk.builtin.dict};b(c,e,d,this.constructor);Sk.globals&&(e.prototype.__module__=Sk.globals.__name__);e.prototype.__doc__=Sk.builtin.none.none$;void 0===e.$typeLookup(Sk.builtin.str.$dict)&&(e.prototype.__dict__=new Sk.builtin.getset_descriptor(e,h));a.$items().forEach(([a,b])=>{e.prototype[a.$mangled]=b});e.prototype.hasOwnProperty("__new__")&&
(a=e.prototype.__new__,a instanceof Sk.builtin.func&&(e.prototype.__new__=new Sk.builtin.staticmethod(a)));e.$allocateSlots();return e},tp$getattr:function(a,b){var d=this.ob$type;const c=d.$typeLookup(a);let e;if(void 0!==c&&(e=c.tp$descr_get,void 0!==e&&void 0!==c.tp$descr_set))return b=e.call(c,this,d,b);a=this.$typeLookup(a);if(void 0!==a)return d=a.tp$descr_get,void 0!==d?b=d.call(a,null,this,b):a;if(void 0!==e)return b=e.call(c,this,d,b);if(void 0!==c)return c},tp$setattr:function(a,b,c){if(!this.sk$klass){if(void 0!==
b)throw new Sk.builtin.TypeError("can't set attributes of built-in/extension type '"+this.prototype.tp$name+"'");throw new Sk.builtin.TypeError("can't delete attributes on type object '"+this.prototype.tp$name+"'");}const d=this.ob$type.$typeLookup(a);if(void 0!==d){const a=d.tp$descr_set;if(a)return a.call(d,this,b,c)}c=a.$mangled;if(void 0===b)if(b=this.prototype,b.hasOwnProperty(c))delete b[c],a=Sk.dunderToSkulpt[c],void 0!==a&&(delete this.prototype[a],b.sk$prototypical||this.$allocateGetterSlot(c));
else throw new Sk.builtin.AttributeError("type object '"+this.prototype.tp$name+"' has no attribute '"+a.$jsstr()+"'");else this.prototype[c]=b,c in Sk.dunderToSkulpt&&this.$allocateSlot(c,b)},$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+"'>")}},writable:!0},tp$methods:{value:null,writable:!0},tp$getsets:{value:null,writable:!0},
sk$type:{value:!0},$isSubType:{value:function(a){return this===a||this.prototype instanceof a||!this.prototype.sk$prototypical&&this.prototype.tp$mro.includes(a)}},$allocateSlot:{value:function(a,b){a=Sk.slots[a];const c=a.$slot_name,d=this.prototype;d.hasOwnProperty(c)&&delete d[c];d[c]=a.$slot_func(b)}},$allocateSlots:{value:function(){const a=this.prototype;this.prototype.sk$prototypical?Object.keys(a).forEach(b=>{b in Sk.slots&&this.$allocateSlot(b,a[b])}):Object.keys(Sk.slots).forEach(b=>{a.hasOwnProperty(b)?
this.$allocateSlot(b,a[b]):this.$allocateGetterSlot(b)})}},$allocateGetterSlot:{value:function(a){const b=Sk.slots[a].$slot_name,c=this.prototype;c.hasOwnProperty(b)||Object.defineProperty(c,b,{configurable:!0,get(){const a=c.tp$mro;for(let c=1;c<a.length;c++){const d=Object.getOwnPropertyDescriptor(a[c].prototype,b);if(void 0!==d&&d.value)return d.value}}})}},$typeLookup:{value:function(a){return this.prototype.sk$prototypical?this.prototype[a.$mangled]:c.call(this,a)},writable:!0},$mroMerge:{value:function(a){this.prototype.sk$prototypical=
!0;let b;const c=[];for(;;){for(b=0;b<a.length;++b){var d=a[b];if(0!==d.length)break}if(b===a.length)return c;var e=[];for(b=0;b<a.length;++b)if(d=a[b],0!==d.length){const b=d[0];d=0;a:for(;d<a.length;++d){const c=a[d];for(let a=1;a<c.length;++a)if(c[a]===b)break a}d===a.length&&e.push(b)}if(0===e.length)throw new Sk.builtin.TypeError("Inconsistent precedences in type hierarchy");e=e[0];c.length&&this.prototype.sk$prototypical&&Object.getPrototypeOf(c[c.length-1].prototype)!==e.prototype&&(this.prototype.sk$prototypical=
!1);c.push(e);for(b=0;b<a.length;++b)d=a[b],0<d.length&&d[0]===e&&d.splice(0,1)}}},$buildMRO:{value:function(){const a=[[this]],b=this.prototype.tp$bases;for(var c=0;c<b.length;++c)a.push([...b[c].prototype.tp$mro]);c=[];for(let a=0;a<b.length;++a)c.push(b[a]);a.push(c);return this.$mroMerge(a)}},sk$attrError:{value(){return"type object '"+this.prototype.tp$name+"'"},writable:!0}});Sk.builtin.type.prototype.tp$getsets={__base__:{$get(){return this.prototype.tp$base||Sk.builtin.none.none$}},__bases__:{$get(){void 0===
this.sk$tuple_bases&&(this.sk$tuple_bases=new Sk.builtin.tuple(this.prototype.tp$bases));return this.sk$tuple_bases}},__mro__:{$get(){void 0===this.sk$tuple_mro&&(this.sk$tuple_mro=new Sk.builtin.tuple(this.prototype.tp$mro));return this.sk$tuple_mro}},__dict__:{$get(){return new Sk.builtin.mappingproxy(this.prototype)}},__doc__:{$get(){const a=this.$typeLookup(Sk.builtin.str.$doc);return a?void 0!==a.tp$descr_get?this===Sk.builtin.type?new Sk.builtin.str(this.prototype.tp$doc):a.tp$descr_get(null,
this):this.prototype.__doc__:Sk.builtin.none.none$},$set(a){l(this,a,Sk.builtin.str.$doc);this.prototype.__doc__=a}},__name__:{$get(){return new Sk.builtin.str(this.prototype.tp$name)},$set(a){l(this,a,Sk.builtin.str.$name);if(!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError("can only assign string to "+this.prototype.tp$name+".__name__, not '"+Sk.abstr.typeName(a)+"'");this.prototype.tp$name=a.$jsstr()}},__module__:{$get(){let a=this.prototype.__module__;return a&&a.ob$type!==Sk.builtin.getset_descriptor?
a:new Sk.builtin.str("builtins")},$set(a){l(this,a,Sk.builtin.str.$module);this.prototype.__module__=a}}};Sk.builtin.type.prototype.tp$methods={mro:{$meth(){return new Sk.builtin.list(this.$buildMRO())},$flags:{NoArgs:!0}},__dir__:{$meth:function(){function a(a){a in Sk.reservedWords_||(a=Sk.unfixReserved(a),-1!==a.indexOf("$")||b.has(a)||(b.add(a),c.push(new Sk.builtin.str(a))))}const b=new Set,c=[];if(this.prototype.sk$prototypical)for(var e in this.prototype)a(e);else{e=this.prototype.tp$mro;for(let b=
0;b<e.length;b++){const c=Object.getOwnPropertyNames(e[b].prototype);for(let b=0;b<c.length;b++)a(c[b])}}return new Sk.builtin.list(c)},$flags:{NoArgs:!0},$doc:"Specialized __dir__ implementation for types."}};const h={$get(){const a=f(this.ob$type);return void 0!==a?a.tp$descr_get(this,this.ob$type):Sk.generic.getSetDict.$get.call(this)},$set(a){const b=f(this.ob$type);return void 0!==b?b.tp$descr_set(this,a):Sk.generic.getSetDict.$set.call(this,a)},$doc:"dictionary for instance variables (if defined)",
$name:"__dict__"}},function(m,q){Sk.generic={};Sk.generic.getAttr=function(a,c){let b;const e=this.ob$type,f=e.$typeLookup(a);if(void 0!==f&&(b=f.tp$descr_get,void 0!==b&&void 0!==f.tp$descr_set))return b.call(f,this,e,c);const l=this.$d;if(void 0!==l&&(a=l.quick$lookup(a),void 0!==a))return a;if(void 0!==b)return b.call(f,this,e,c);if(void 0!==f)return f};Sk.exportSymbol("Sk.generic.getAttr",Sk.generic.getAttr);Sk.generic.setAttr=function(a,c,b){var e=this.ob$type.$typeLookup(a);if(void 0!==e&&null!==
e){const a=e.tp$descr_set;if(a)return a.call(e,this,c,b)}b=this.$d;if(void 0!==b)if(b.mp$ass_subscript){if(void 0!==c)return b.mp$ass_subscript(a,c);try{return b.mp$ass_subscript(a)}catch(f){if(f instanceof Sk.builtin.KeyError)throw new Sk.builtin.AttributeError("'"+Sk.abstr.typeName(this)+"' object has no attribute '"+a.$jsstr()+"'");throw f;}}else if("object"===typeof b){e=a.$mangled;if(void 0!==c){b[e]=c;return}if(void 0!==b[e]){delete b[e];return}}throw new Sk.builtin.AttributeError(this.sk$attrError()+
" has no attribute '"+a.$jsstr()+"'");};Sk.exportSymbol("Sk.generic.setAttr",Sk.generic.setAttr);Sk.generic.new=function(a){return function(c,b){if(this.constructor===a)return new this.constructor;c=new this.constructor;a.call(c);return c}};Sk.generic.newMethodDef={$meth(a,c){const b=this.prototype;if(1>a.length)throw a=b.tp$name,new Sk.builtin.TypeError(a+".__new__(): not enough arguments");var e=a.shift();if(void 0===e.sk$type)throw a=b.tp$name,new Sk.builtin.TypeError(a+"__new__(X): X is not a type object ("+
Sk.abstr.typeName(e)+")");if(!e.$isSubType(this))throw a=b.tp$name,e=e.prototype.tp$name,new Sk.builtin.TypeError(a+".__new__("+e+"): "+e+" is not a subtype of "+a);const f=e.prototype.sk$staticNew.prototype;if(f.tp$new!==b.tp$new)throw a=b.tp$name,e=e.prototype.tp$name,new Sk.builtin.TypeError(a+".__new__("+e+") is not safe, use "+f.tp$name+".__new__()");return b.tp$new.call(e.prototype,a,c)},$flags:{FastCall:!0},$textsig:"($type, *args, **kwargs)",$name:"__new__"};Sk.generic.selfIter=function(){return this};
Sk.generic.iterNextWithArrayCheckSize=function(){if(this.$seq.length!==this.$orig.get$size()){const a=this.tp$name.split("_")[0];throw new Sk.builtin.RuntimeError(a+" changed size during iteration");}if(!(this.$index>=this.$seq.length))return this.$seq[this.$index++]};Sk.generic.iterNextWithArray=function(){const a=this.$seq[this.$index++];void 0===a&&(this.tp$iternext=()=>{});return a};Sk.generic.iterLengthHintWithArrayMethodDef={$meth:function(){return new Sk.builtin.int_(this.$seq.length-this.$index)},
$flags:{NoArgs:!0}};Sk.generic.iterReverseLengthHintMethodDef={$meth:function(){return new Sk.builtin.int_(this.$index)},$flags:{NoArgs:!0}};Sk.generic.getSetDict={$get(){return this.$d},$set(a){if(void 0===a)this.$d=new Sk.builtin.dict;else if(a instanceof Sk.builtin.dict)this.$d=a;else throw new Sk.builtin.TypeError("__dict__ must be set to a dictionary, not a '"+Sk.abstr.typeName(a)+"'");},$doc:"dictionary for instance variables (if defined)",$name:"__dict__"};Sk.generic.seqCompare=function(a,
c){if(this===a&&Sk.misceval.opAllowsEquality(c))return!0;if(!(a instanceof this.sk$builtinBase))return Sk.builtin.NotImplemented.NotImplemented$;const b=this.v;a=a.v;let e;if(b.length!==a.length&&("Eq"===c||"NotEq"===c))return"Eq"===c?!1:!0;for(e=0;e<b.length&&e<a.length&&(b[e]===a[e]||Sk.misceval.richCompareBool(b[e],a[e],"Eq"));++e);const f=b.length,l=a.length;if(e>=f||e>=l)switch(c){case "Lt":return f<l;case "LtE":return f<=l;case "Eq":return f===l;case "NotEq":return f!==l;case "Gt":return f>
l;case "GtE":return f>=l;default:Sk.asserts.fail()}return"Eq"===c?!1:"NotEq"===c?!0:Sk.misceval.richCompareBool(b[e],a[e],c)}},function(m,q){Sk.builtin.pyCheckArgs=function(a,c,b,e,f,l){c=c.length;void 0===e&&(e=Infinity);f&&--c;l&&--c;if(c<b||c>e)throw new Sk.builtin.TypeError((b===e?a+"() takes exactly "+b+" arguments":c<b?a+"() takes at least "+b+" arguments":0<b?a+"() takes at most "+e+" arguments":a+"() takes no arguments")+(" ("+c+" given)"));};Sk.exportSymbol("Sk.builtin.pyCheckArgs",Sk.builtin.pyCheckArgs);
Sk.builtin.pyCheckArgsLen=function(a,c,b,e,f,l){void 0===e&&(e=Infinity);f&&--c;l&&--c;if(c<b||c>e)throw new Sk.builtin.TypeError((b===e?a+"() takes exactly "+b+" arguments":c<b?a+"() takes at least "+b+" arguments":a+"() takes at most "+e+" arguments")+(" ("+c+" given)"));};Sk.builtin.pyCheckType=function(a,c,b){if(!b)throw new Sk.builtin.TypeError(a+" must be a "+c);};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){return void 0===a?!1:a.tp$iter?void 0!==a.tp$iter().tp$iternext:void 0!==a.mp$subscript};Sk.exportSymbol("Sk.builtin.checkIterable",Sk.builtin.checkIterable);Sk.builtin.checkCallable=function(a){return null!=a&&void 0!==a.tp$call};Sk.builtin.checkNumber=function(a){return"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 a instanceof Sk.builtin.complex};Sk.exportSymbol("Sk.builtin.checkComplex",Sk.builtin.checkComplex);Sk.builtin.checkInt=function(a){return a instanceof Sk.builtin.int_||"number"===typeof a&&Number.isInteger(a)};Sk.exportSymbol("Sk.builtin.checkInt",Sk.builtin.checkInt);Sk.builtin.checkFloat=function(a){return a instanceof Sk.builtin.float_};Sk.exportSymbol("Sk.builtin.checkFloat",Sk.builtin.checkFloat);Sk.builtin.checkString=function(a){return a instanceof
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 a instanceof Sk.builtin.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.checkDataDescr=function(a){return a&&void 0!==a.tp$descr_set};Sk.exportSymbol("Sk.builtin.checkDataDescr",Sk.builtin.checkDataDescr);Sk.builtin.checkAnySet=function(a){return a instanceof Sk.builtin.set||a instanceof Sk.builtin.frozenset};Sk.builtin.checkMapping=function(a){return a instanceof Sk.builtin.dict||a instanceof Sk.builtin.mappingproxy||
null!=a&&void 0!==a.mp$subscript&&void 0!==Sk.abstr.lookupSpecial(a,Sk.builtin.str.$keys)}},function(m,q){function a(a,b){switch(b){case "Add":return a.nb$add;case "Sub":return a.nb$subtract;case "Mult":return a.nb$multiply;case "MatMult":if(Sk.__future__.python3)return a.nb$matrix_multiply;case "Div":return a.nb$divide;case "FloorDiv":return a.nb$floor_divide;case "Mod":return a.nb$remainder;case "DivMod":return a.nb$divmod;case "Pow":return a.nb$power;case "LShift":return a.nb$lshift;case "RShift":return a.nb$rshift;
case "BitAnd":return a.nb$and;case "BitXor":return a.nb$xor;case "BitOr":return a.nb$or}}function c(a,b){switch(b){case "Add":return a.nb$reflected_add;case "Sub":return a.nb$reflected_subtract;case "Mult":return a.nb$reflected_multiply;case "MatMult":if(Sk.__future__.python3)return a.nb$reflected_matrix_multiply;case "Div":return a.nb$reflected_divide;case "FloorDiv":return a.nb$reflected_floor_divide;case "Mod":return a.nb$reflected_remainder;case "DivMod":return a.nb$reflected_divmod;case "Pow":return a.nb$reflected_power;
case "LShift":return a.nb$reflected_lshift;case "RShift":return a.nb$reflected_rshift;case "BitAnd":return a.nb$reflected_and;case "BitXor":return a.nb$reflected_xor;case "BitOr":return a.nb$reflected_or}}function b(a,b){switch(b){case "Add":return a.nb$inplace_add;case "Sub":return a.nb$inplace_subtract;case "Mult":return a.nb$inplace_multiply;case "MatMult":if(Sk.__future__.python3)return a.nb$inplace_matrix_multiply;case "Div":return a.nb$inplace_divide;case "FloorDiv":return a.nb$inplace_floor_divide;
case "Mod":return a.nb$inplace_remainder;case "Pow":return a.nb$inplace_power;case "LShift":return a.nb$inplace_lshift;case "RShift":return a.nb$inplace_rshift;case "BitAnd":return a.nb$inplace_and;case "BitOr":return a.nb$inplace_or;case "BitXor":return a.nb$inplace_xor}}function e(b,d,e){var k=d.constructor,f=b.constructor;if(k=k!==f&&void 0===k.sk$baseClass&&d instanceof f)if(f=c(d,e),void 0!==f&&f!==c(b,e)&&(f=f.call(d,b),f!==Sk.builtin.NotImplemented.NotImplemented$))return f;f=a(b,e);if(void 0!==
f&&(f=f.call(b,d),f!==Sk.builtin.NotImplemented.NotImplemented$)||!k&&(f=c(d,e),void 0!==f&&(f=f.call(d,b),f!==Sk.builtin.NotImplemented.NotImplemented$)))return f}function f(a){n.forEach(([b,c])=>{a[c]=function(a){return this.tp$richcompare(a,b)}})}function l(a){const b=Sk.reflectedNumberSlots;Object.keys(b).forEach(c=>{if(void 0!==a[c]){const d=b[c],e=d.reflected,f=a[e];void 0!==f?null===f&&delete a[e]:a[e]=d.slot||a[c]}})}function h(a){const b=Sk.sequenceAndMappingSlots;Object.keys(b).forEach(c=>
{void 0!==a[c]&&b[c].forEach(b=>{a[b]=a[c]})})}Sk.abstr={};Sk.abstr.typeName=function(a){return null!=a&&void 0!==a.tp$name?a.tp$name:"<invalid type>"};const d={Add:"+",Sub:"-",Mult:"*",MatMult:"@",Div:"/",FloorDiv:"//",Mod:"%",DivMod:"divmod()",Pow:"** or pow()",LShift:"<<",RShift:">>",BitAnd:"&",BitXor:"^",BitOr:"|"},g={UAdd:"+",USub:"-",Invert:"~"};Sk.abstr.numberBinOp=function(a,b,c){var f;if(!(f=e(a,b,c)))throw a=Sk.abstr.typeName(a),b=Sk.abstr.typeName(b),new Sk.builtin.TypeError("unsupported operand type(s) for "+
d[c]+": '"+a+"' and '"+b+"'");return f};Sk.exportSymbol("Sk.abstr.numberBinOp",Sk.abstr.numberBinOp);Sk.abstr.numberInplaceBinOp=function(a,c,f){a:{var k=b(a,f);if(void 0!==k&&(k=k.call(a,c),k!==Sk.builtin.NotImplemented.NotImplemented$))break a;k=e(a,c,f)}if(!k)throw a=Sk.abstr.typeName(a),c=Sk.abstr.typeName(c),new Sk.builtin.TypeError("unsupported operand type(s) for "+d[f]+"=: '"+a+"' and '"+c+"'");return k};Sk.exportSymbol("Sk.abstr.numberInplaceBinOp",Sk.abstr.numberInplaceBinOp);Sk.abstr.numberUnaryOp=
function(a,b){if("Not"===b)return Sk.misceval.isTrue(a)?Sk.builtin.bool.false$:Sk.builtin.bool.true$;b:{switch(b){case "USub":var c=a.nb$negative;break b;case "UAdd":c=a.nb$positive;break b;case "Invert":c=a.nb$invert;break b}c=void 0}c=void 0!==c?c.call(a):void 0;if(!c)throw a=Sk.abstr.typeName(a),new Sk.builtin.TypeError("bad operand type for unary "+g[b]+": '"+a+"'");return c};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,c);a=Sk.misceval.iterFor(Sk.abstr.iter(a),function(a){return a===b||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);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object can't be concatenated");};Sk.abstr.sequenceGetIndexOf=
function(a,b){if(a.index)return Sk.misceval.callsimArray(a.index,[a,b]);let c=0;for(let d=Sk.abstr.iter(a),e=d.tp$iternext();void 0!==e;e=d.tp$iternext()){if(Sk.misceval.richCompareBool(b,e,"Eq"))return new Sk.builtin.int_(c);c+=1}throw new Sk.builtin.ValueError("sequence.index(x): x not in sequence");};Sk.abstr.sequenceGetCountOf=function(a,b){if(a.count)return Sk.misceval.callsimArray(a.count,[a,b]);let c=0;for(let d=Sk.abstr.iter(a),e=d.tp$iternext();void 0!==e;e=d.tp$iternext())Sk.misceval.richCompareBool(b,
e,"Eq")&&(c+=1);return new Sk.builtin.int_(c)};Sk.abstr.sequenceGetItem=function(a,b,c){"number"===typeof b&&(b=new Sk.builtin.int_(b));return Sk.abstr.objectGetItem(a,b,c)};Sk.abstr.sequenceSetItem=function(a,b,c,d){"number"===typeof b&&(b=new Sk.builtin.int_(b));return Sk.abstr.objectSetItem(a,b,c,d)};Sk.abstr.sequenceDelItem=function(a,b,c){return Sk.abstr.objectDelItem(a,b,c)};Sk.abstr.sequenceGetSlice=function(a,b,c){return Sk.abstr.objectGetItem(a,new Sk.builtin.slice(b,c))};Sk.abstr.sequenceDelSlice=
function(a,b,c){return Sk.abstr.objectDelItem(a,new Sk.builtin.slice(b,c))};Sk.abstr.sequenceSetSlice=function(a,b,c,d){return Sk.abstr.objectSetItem(a,new Sk.builtin.slice(b,c))};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),f=[];let k=0,g;0<b&&(g=Sk.misceval.iterFor(e,a=>{f.push(a);if(++k===b)return new Sk.misceval.Break}));return Sk.misceval.chain(g,
()=>{if(f.length<b)throw new Sk.builtin.ValueError("not enough values to unpack (expected at least "+c+", got "+f.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 f});const a=[];return Sk.misceval.chain(Sk.misceval.iterFor(e,b=>{a.push(b)}),()=>{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)+")");f.push(new Sk.builtin.list(a.slice(0,
d)));f.push(...a.slice(d));return f})})};Sk.abstr.mappingUnpackIntoKeywordArray=function(a,b,c){if(b instanceof Sk.builtin.dict)b.$items().forEach(([b,d])=>{if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError((c.$qualname?c.$qualname+"() ":"")+"keywords must be strings");a.push(b.v);a.push(d)});else{var d=Sk.abstr.lookupSpecial(b,Sk.builtin.str.$keys);if(void 0===d)throw new Sk.builtin.TypeError("Object is not a mapping");return Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(d),d=>Sk.misceval.iterFor(Sk.abstr.iter(d),
d=>{if(!Sk.builtin.checkString(d))throw new Sk.builtin.TypeError((c.$qualname?c.$qualname+"() ":"")+"keywords must be strings");return Sk.misceval.chain(b.mp$subscript(d,!0),b=>{a.push(d.v);a.push(b)})}))}};Sk.abstr.copyKeywordsToNamedArgs=function(a,b,c,d,e){d=d||[];var f=c.length+d.length/2;if(f>b.length)throw new Sk.builtin.TypeError(a+"() expected at most "+b.length+" arguments ("+f+" given)");if(d.length||void 0!==e){if(f===b.length&&!d.length)return c;if(0===f&&b.length===(e&&e.length))return e}else return c;
c=c.slice(0);for(f=0;f<d.length;f+=2){const e=d[f],k=d[f+1],g=b.indexOf(e);if(0<=g){if(void 0!==c[g])throw new Sk.builtin.TypeError(a+"() got multiple values for argument '"+e+"'");c[g]=k}else throw new Sk.builtin.TypeError(a+"() got an unexpected keyword argument '"+e+"'");}if(e){d=b.length;for(f=d-1;0<=f;f--)void 0===c[f]&&(c[f]=e[e.length-1-(d-1-f)]);b=b.filter((a,b)=>void 0===c[b]);if(b.length)throw new Sk.builtin.TypeError(a+"() missing "+b.length+" required positional arguments: "+b.join(", "));
}return c};Sk.exportSymbol("Sk.abstr.copyKeywordsToNamedArgs",Sk.abstr.copyKeywordsToNamedArgs);Sk.abstr.checkNoKwargs=function(a,b){if(b&&b.length)throw new Sk.builtin.TypeError(a+"() takes no keyword arguments");};Sk.exportSymbol("Sk.abstr.checkNoKwargs",Sk.abstr.checkNoKwargs);Sk.abstr.checkNoArgs=function(a,b,c){if(b=b.length+(c?c.length:0))throw new Sk.builtin.TypeError(a+"() takes no arguments ("+b+" given)");};Sk.exportSymbol("Sk.abstr.checkNoArgs",Sk.abstr.checkNoArgs);Sk.abstr.checkOneArg=
function(a,b,c){Sk.abstr.checkNoKwargs(a,c);if(1!==b.length)throw new Sk.builtin.TypeError(a+"() takes exactly one argument ("+b.length+" given)");};Sk.exportSymbol("Sk.abstr.checkOneArg",Sk.abstr.checkOneArg);Sk.abstr.checkArgsLen=function(a,b,c,d){b=b.length;void 0===d&&(d=Infinity);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.abstr.checkArgsLen",
Sk.abstr.checkArgsLen);Sk.abstr.objectFormat=function(a,b){a=Sk.abstr.lookupSpecial(a,Sk.builtin.str.$format);b=Sk.misceval.callsimArray(a,[b]);if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("__format__ must return a str, not "+Sk.abstr.typeName(b));return b};Sk.abstr.objectHash=function(a){const b=a.tp$hash;if(void 0!==b){if(Sk.builtin.checkNone(b))throw new Sk.builtin.TypeError("unhashable type: '"+Sk.abstr.typeName(a)+"'");return a.tp$hash()}throw new Sk.builtin.TypeError("unsupported Javascript type");
};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,c){if(a.mp$ass_subscript)return a.mp$ass_subscript(b,void 0,c);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object does not support item deletion");};Sk.exportSymbol("Sk.abstr.objectDelItem",Sk.abstr.objectDelItem);Sk.abstr.objectGetItem=function(a,b,c){if(a.mp$subscript)return a.mp$subscript(b,c);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' does not support indexing");};Sk.exportSymbol("Sk.abstr.objectGetItem",
Sk.abstr.objectGetItem);Sk.abstr.objectSetItem=function(a,b,c,d){if(a.mp$ass_subscript)return a.mp$ass_subscript(b,c,d);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' does not support item assignment");};Sk.exportSymbol("Sk.abstr.objectSetItem",Sk.abstr.objectSetItem);Sk.abstr.gattr=function(a,b,c){c=a.tp$getattr(b,c);if(void 0===c)throw new Sk.builtin.AttributeError(a.sk$attrError()+" has no attribute '"+b.$jsstr()+"'");return c.$isSuspension?Sk.misceval.chain(c,function(c){if(void 0===
c)throw new Sk.builtin.AttributeError(a.sk$attrError()+" has no attribute '"+b.$jsstr()+"'");return c}):c};Sk.exportSymbol("Sk.abstr.gattr",Sk.abstr.gattr);Sk.abstr.sattr=function(a,b,c,d){return a.tp$setattr(b,c,d)};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){if(a.tp$iter){a=a.tp$iter();if(a.tp$iternext)return a;throw new Sk.builtin.TypeError("iter() returned non-iterator of type '"+
Sk.abstr.typeName(a)+"'");}if(a.mp$subscript)return new Sk.builtin.seq_iter_(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){var c=a.ob$type;if(void 0===c)Sk.asserts.fail("javascript object sent to lookupSpecial");else if(b=c.$typeLookup(b),void 0!==b)return void 0!==b.tp$descr_get&&(b=b.tp$descr_get(a,c)),b};Sk.exportSymbol("Sk.abstr.lookupSpecial",Sk.abstr.lookupSpecial);
Sk.abstr.typeLookup=function(a,b){b=a.$typeLookup(b);return void 0!==b&&b.tp$descr_get?b.tp$descr_get(null,a):b};Sk.abstr.markUnhashable=function(a){a=a.prototype;a.__hash__=Sk.builtin.none.none$;a.tp$hash=Sk.builtin.none.none$};Sk.abstr.setUpInheritance=function(a,b,c,d){d=d||Sk.builtin.type;c=void 0===c?Sk.builtin.object:c;const e=null!==c?c.prototype:null;Object.setPrototypeOf(b,d.prototype);Object.setPrototypeOf(b.prototype,e);Object.defineProperties(b.prototype,{sk$object:{value:b,writable:!0},
ob$type:{value:b,writable:!0},tp$name:{value:a,writable:!0},tp$base:{value:c,writable:!0}})};Sk.abstr.setUpBuiltinMro=function(a){let b=a.prototype.tp$base;const c=null===b?[]:[b];if(b===Sk.builtin.object||null===b)Object.defineProperty(a,"sk$baseClass",{value:!0,writable:!0}),Object.defineProperty(a.prototype,"sk$builtinBase",{value:a,writable:!0});const d=[a];for(;null!==b;)d.push(b),b=b.prototype.tp$base;Object.defineProperties(a.prototype,{sk$prototypical:{value:!0,writable:!0},tp$bases:{value:c,
writable:!0},tp$mro:{value:d,writable:!0}});Object.defineProperty(a,"$typeLookup",{value:function(a){return this.prototype[a.$mangled]},writable:!0})};Sk.abstr.setUpGetSets=function(a,b){if(void 0!==Sk.builtin.getset_descriptor){var c=a.prototype;b=b||c.tp$getsets||{};Object.entries(b).forEach(([b,d])=>{d.$name=b;c[b]=new Sk.builtin.getset_descriptor(a,d)});Object.defineProperty(c,"tp$getsets",{value:null,writable:!0})}};Sk.abstr.setUpMethods=function(a,b){if(void 0!==Sk.builtin.method_descriptor){var c=
a.prototype;b=b||c.tp$methods||{};Object.entries(b).forEach(([b,d])=>{d.$name=b;c[b]=new Sk.builtin.method_descriptor(a,d)});Object.defineProperty(c,"tp$methods",{value:null,writable:!0})}};Sk.abstr.setUpClassMethods=function(a,b){if(void 0!==Sk.builtin.classmethod_descriptor){var c=a.prototype;b=b||c.tp$classmethods||{};Object.entries(b).forEach(([b,d])=>{d.$name=b;c[b]=new Sk.builtin.classmethod_descriptor(a,d)});Object.defineProperty(c,"tp$classmethods",{value:null,writable:!0})}};const n=Object.entries({Eq:"ob$eq",
NotEq:"ob$ne",Gt:"ob$gt",GtE:"ob$ge",Lt:"ob$lt",LtE:"ob$le"});Sk.abstr.setUpSlots=function(a,b){function c(b,c){e[b]=new Sk.builtin.wrapper_descriptor(a,Sk.slots[b],c)}function d(a,b){"string"===typeof a?c(a,b):a.forEach(a=>{c(a,b)})}if(void 0!==Sk.builtin.wrapper_descriptor){var e=a.prototype;b=b||e.tp$slots||{};b.tp$new===Sk.generic.new&&(b.tp$new=Sk.generic.new(a));b.tp$richcompare&&f(b);b.tp$as_number&&l(b);b.tp$as_sequence_or_mapping&&h(b);Object.entries(b).forEach(([a,b])=>{Object.defineProperty(e,
a,{value:b,writable:!0})});b.tp$new&&(e.__new__=new Sk.builtin.sk_method(Sk.generic.newMethodDef,a),Object.defineProperty(e,"sk$staticNew",{value:a,writable:!0}));Sk.subSlots.main_slots.forEach(([a,c])=>{a=b[a];void 0!==a&&d(c,a)});var g=b.tp$hash;void 0!==g&&("function"===typeof g?c("__hash__",g):g===Sk.builtin.none.none$?e.__hash__=g:Sk.asserts.fail("invalid tp$hash"));b.tp$as_number&&Sk.subSlots.number_slots.forEach(([a,c])=>{a=b[a];void 0!==a&&d(c,a)});b.tp$as_sequence_or_mapping&&Sk.subSlots.sequence_and_mapping_slots.forEach(([a,
c])=>{a=b[a];void 0!==a&&d(c,a)});Object.defineProperty(e,"tp$slots",{value:null,writable:!0})}};Sk.abstr.buildNativeClass=function(a,b){b=b||{};Sk.asserts.assert(b.hasOwnProperty("constructor"),"A constructor is required to build a native class");let c=b.constructor;if(a.includes(".")){var d=a.split(".");a=d.pop();d=d.join(".")}Sk.abstr.setUpInheritance(a,c,b.base,b.meta);Sk.abstr.setUpBuiltinMro(c);const e=c.prototype;Object.defineProperties(e,{tp$slots:{value:b.slots,writable:!0},tp$getsets:{value:b.getsets,
writable:!0},tp$methods:{value:b.methods,writable:!0},tp$classmethods:{value:b.classmethods,writable:!0}});Sk.abstr.setUpSlots(c,b.slots||{});Sk.abstr.setUpMethods(c,b.methods);Sk.abstr.setUpGetSets(c,b.getsets);Sk.abstr.setUpClassMethods(c,b.classmethods);void 0!==d&&(e.__module__=new Sk.builtin.str(d));Object.entries(b.proto||{}).forEach(([a,b])=>{Object.defineProperty(e,a,{value:b,writable:!0,enumerable:!(a.includes("$")||a in Object.prototype)})});Object.entries(b.flags||{}).forEach(([a,b])=>
{Object.defineProperty(c,a,{value:b,writable:!0})});void 0!==Sk.builtin.str&&e.hasOwnProperty("tp$doc")&&!e.hasOwnProperty("__doc__")&&(a=e.tp$doc||null,e.__doc__="string"===typeof a?new Sk.builtin.str(a):Sk.builtin.none.none$);return c};Sk.abstr.buildIteratorClass=function(a,b){Sk.asserts.assert(b.hasOwnProperty("constructor"),"must provide a constructor");b.slots=b.slots||{};b.slots.tp$iter=Sk.generic.selfIter;b.slots.tp$iternext=b.slots.tp$iternext||b.iternext;b.slots.tp$getattr=b.slots.tp$getattr||
Sk.generic.getAttr;a=Sk.abstr.buildNativeClass(a,b);Sk.abstr.built$iterators.push(a);return a};Sk.abstr.built$iterators=[];Sk.abstr.setUpModuleMethods=function(a,b,c){Object.entries(c).forEach(([c,d])=>{d.$name=d.$name||c;b[c]=new Sk.builtin.sk_method(d,null,a)})};Sk.abstr.superConstructor=function(a,b,c){var d=Array.prototype.slice.call(arguments,2);a.prototype.tp$base.apply(b,d)}},function(m,q){const a=new Map;Sk.builtin.object=Sk.abstr.buildNativeClass("object",{constructor:function(){Sk.asserts.assert(this instanceof
Sk.builtin.object,"bad call to object, use 'new'")},base:null,slots:{tp$new(a,b){if(a.length||b&&b.length){if(this.tp$new!==Sk.builtin.object.prototype.tp$new)throw new Sk.builtin.TypeError("object.__new__() takes exactly one argument (the type to instantiate)");if(this.tp$init===Sk.builtin.object.prototype.tp$init)throw new Sk.builtin.TypeError(Sk.abstr.typeName(this)+"() takes no arguments");}return new this.constructor},tp$init(a,b){if(a.length||b&&b.length){if(this.tp$init!==Sk.builtin.object.prototype.tp$init)throw new Sk.builtin.TypeError("object.__init__() takes exactly one argument (the instance to initialize)");
if(this.tp$new===Sk.builtin.object.prototype.tp$new)throw new Sk.builtin.TypeError(Sk.abstr.typeName(this)+".__init__() takes exactly one argument (the instance to initialize)");}},tp$getattr:Sk.generic.getAttr,tp$setattr:Sk.generic.setAttr,$r(){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>")},tp$str(){return this.$r()},tp$hash(){let c=a.get(this);if(void 0!==c)return c;
c=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER-Number.MAX_SAFE_INTEGER/2);a.set(this,c);return c},tp$richcompare(a,b){switch(b){case "Eq":a=this===a||Sk.builtin.NotImplemented.NotImplemented$;break;case "NotEq":a=this.tp$richcompare(a,"Eq");a!==Sk.builtin.NotImplemented.NotImplemented$&&(a=!Sk.misceval.isTrue(a));break;default:a=Sk.builtin.NotImplemented.NotImplemented$}return a},tp$doc:"The most base type"},getsets:{__class__:{$get(){return this.ob$type},$set(a){if(void 0===a)throw new Sk.builtin.TypeError("can't delete __class__ attribute");
if(!Sk.builtin.checkClass(a))throw new Sk.builtin.TypeError("__class__ must be set to a class, not '"+Sk.abstr.typeName(a)+"' object");const b=this.ob$type;if(!(b.$isSubType(Sk.builtin.module)&&a.$isSubType(Sk.builtin.module)||void 0!==b.sk$klass&&void 0!==a.sk$klass))throw new Sk.builtin.TypeError(" __class__ assignment only supported for heap types or ModuleType subclasses");if(a.prototype.sk$builtinBase!==this.sk$builtinBase)throw new Sk.builtin.TypeError("__class__ assignment: '"+Sk.abstr.typeName(this)+
"' object layout differs from '"+a.prototype.tp$name+"'");Object.setPrototypeOf(this,a.prototype)},$doc:"the object's class"}},methods:{__dir__:{$meth:function(){let a=[];if(this.$d)if(this.$d instanceof Sk.builtin.dict)a=this.$d.sk$asarray();else for(var b in this.$d)a.push(new Sk.builtin.str(b));b=Sk.misceval.callsimArray(Sk.builtin.type.prototype.__dir__,[this.ob$type]);a.push(...b.v);b.v=a;return b},$flags:{NoArgs:!0},$doc:"Default dir() implementation."},__format__:{$meth(a){if(Sk.builtin.checkString(a)){if(a=
Sk.ffi.remapToJs(a),""!==a)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(a));throw new Sk.builtin.TypeError("format expects arg 2 to be string or unicode, not "+Sk.abstr.typeName(a));}return this.tp$str()},$flags:{OneArg:!0},$doc:"Default object formatter."}},proto:{valueOf:Object.prototype.valueOf,toString:function(){return this.tp$str().v},hasOwnProperty:Object.prototype.hasOwnProperty,
hp$type:void 0,sk$attrError(){return"'"+this.tp$name+"' object"}}});Sk.abstr.setUpInheritance("type",Sk.builtin.type,Sk.builtin.object);Sk.abstr.setUpBuiltinMro(Sk.builtin.type)},function(m,q){function a(a,b,c){Sk.abstr.checkNoArgs(this.$name,b,c);a=this.call(a);return void 0===a?Sk.builtin.none.none$:a}function c(a,b,c){Sk.abstr.checkOneArg(this.$name,b,c);a=this.call(a,b[0]);return void 0===a?Sk.builtin.none.none$:a}function b(a,b,c){Sk.abstr.checkNoKwargs(this.$name,c);Sk.abstr.checkArgsLen(this.$name,
b,1,2);a=this.call(a,...b);return void 0===a?Sk.builtin.none.none$:a}function e(a,b,c){Sk.abstr.checkNoKwargs(this.$name,c);Sk.abstr.checkArgsLen(this.$name,b,2,2);this.call(a,b[0],b[1]);return Sk.builtin.none.none$}function f(a,b,d){a=c.call(this,a,b,d);return a===Sk.builtin.NotImplemented.NotImplemented$?a:new Sk.builtin.bool(a)}function l(a,b){return function(c,d,e){c=a.call(this,c,d,e);return b(c)}}function h(a){return function(){const b=a.tp$descr_get?a.tp$descr_get(this):a;return Sk.misceval.callsimArray(b,
[])}}function d(a,b,c,d){return function(e){return function(){var f=e.tp$descr_get?e.tp$descr_get(this):e;f=Sk.misceval.callsimArray(f,[]);if(!b(f))throw new Sk.builtin.TypeError(a+" should return "+c+" (returned "+Sk.abstr.typeName(f)+")");return void 0!==d?d(f):f}}}function g(a){return function(b){const c=a.tp$descr_get?a.tp$descr_get(this):a;return Sk.misceval.callsimArray(c,[b])}}function n(a,b){let c=this.ob$type.$typeLookup(Sk.builtin.str.$getattribute);if(c instanceof Sk.builtin.wrapper_descriptor)return c.d$wrapped.call(this,
a,b);c.tp$descr_get&&(c=c.tp$descr_get(this));const d=Sk.misceval.tryCatch(()=>Sk.misceval.callsimOrSuspendArray(c,[a]),a=>{if(!(a instanceof Sk.builtin.AttributeError))throw a;});return b?d:Sk.misceval.retryOptionalSuspensionOrThrow(d)}function k(a,b,c){return function(d){return function(d,e,f){let g;void 0===e?(g=b,c=null):g=a;let h=this.ob$type.$typeLookup(new Sk.builtin.str(g));if(h instanceof Sk.builtin.wrapper_descriptor)return h.d$wrapped.call(this,d,e);h.tp$descr_get&&(h=h.tp$descr_get(this));
if(void 0!==h)d=Sk.misceval.callsimOrSuspendArray(h,void 0===e?[d]:[d,e]);else{if(c)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(this)+"' object "+c);throw new Sk.builtin.AttributeError(g);}return f?d:Sk.misceval.retryOptionalSuspensionOrThrow(d)}}}function p(a,b){let c=a.ob$type;for(;c&&void 0!==c.sk$klass;)c=c.prototype.tp$base;if(c&&c.prototype.tp$setattr!==b)throw new Sk.builtin.TypeError("can't apply this "+b.$name+" to "+Sk.abstr.typeName(a)+" object");}Sk.slots=Object.create(null);
m=Sk.slots;Sk.slots.__init__={$name:"__init__",$slot_name:"tp$init",$slot_func:function(a){return function(b,c){const d=a.tp$descr_get?a.tp$descr_get(this):a;b=Sk.misceval.callsimOrSuspendArray(d,b,c);return Sk.misceval.chain(b,a=>{if(!Sk.builtin.checkNone(a)&&void 0!==a)throw new Sk.builtin.TypeError("__init__() should return None, not "+Sk.abstr.typeName(a));})}},$wrapper:function(a,b,c){this.call(a,b,c);return Sk.builtin.none.none$},$textsig:"($self, /, *args, **kwargs)",$flags:{FastCall:!0},$doc:"Initialize self.  See help(type(self)) for accurate signature."};
m.__new__={$name:"__new__",$slot_name:"tp$new",$slot_func:function(a){const b=function(b,c){let d=a;a.tp$descr_get&&(d=a.tp$descr_get(null,this.constructor));return Sk.misceval.callsimOrSuspendArray(d,[this.constructor,...b],c)};b.sk$static_new=!1;return b},$wrapper:null,$textsig:"($self, /, *args, **kwargs)",$flags:{FastCall:!0},$doc:"Create and return a new object."};m.__call__={$name:"__call__",$slot_name:"tp$call",$slot_func:function(a){return function(b,c){const d=a.tp$descr_get?a.tp$descr_get(this):
a;return Sk.misceval.callsimOrSuspendArray(d,b,c)}},$wrapper:function(a,b,c){a=a.tp$call(b,c);return void 0===a?Sk.builtin.none.none$:a},$textsig:"($self, /, *args, **kwargs)",$flags:{FastCall:!0},$doc:"Call self as a function."};m.__repr__={$name:"__repr__",$slot_name:"$r",$slot_func:d("__repr__",Sk.builtin.checkString,"str"),$wrapper:a,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"Return repr(self)."};m.__str__={$name:"__str__",$slot_name:"tp$str",$slot_func:d("__str__",Sk.builtin.checkString,
"str"),$wrapper:a,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"Return str(self)."};var u=d("__hash__",Sk.builtin.checkInt,"int",a=>"number"===typeof a.v?a.v:a.tp$hash());m.__hash__={$name:"__hash__",$slot_name:"tp$hash",$slot_func:function(a){return a===Sk.builtin.none.none$?Sk.builtin.none.none$:u(a)},$wrapper:l(a,a=>new Sk.builtin.int_(a)),$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"Return hash(self)."};m.__getattribute__={$name:"__getattribute__",$slot_name:"tp$getattr",$slot_func:function(a){return function(a,
b){let c=this.ob$type.$typeLookup(Sk.builtin.str.$getattr);if(void 0===c)return n.call(this,a,b);const d=Sk.misceval.chain(n.call(this,a,b),b=>Sk.misceval.tryCatch(()=>{if(void 0!==b)return b;c.tp$descr_get&&(c=c.tp$descr_get(this));return Sk.misceval.callsimOrSuspendArray(c,[a])},function(a){if(!(a instanceof Sk.builtin.AttributeError))throw a;}));return b?d:Sk.misceval.retryOptionalSuspensionOrThrow(d)}},$wrapper:function(a,b,c){Sk.abstr.checkOneArg(this.$name,b,c);b=b[0];if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("attribute name must be string, not '"+
Sk.abstr.typeName(b)+"'");c=this.call(a,b);if(void 0===c)throw new Sk.builtin.AttributeError(Sk.abstr.typeName(a)+" has no attribute "+b.$jsstr());return c},$textsig:"($self, name, /)",$flags:{OneArg:!0},$doc:"Return getattr(self, name)."};m.__getattr__={$name:"__getattr__",$slot_name:"tp$getattr",$slot_func:m.__getattribute__.$slot_func,$wrapper:null,$textsig:"($self, name, /)",$flags:{OneArg:!0},$doc:"Return getattr(self, name)."};m.__setattr__={$name:"__setattr__",$slot_name:"tp$setattr",$slot_func:k("__setattr__",
"__delattr__"),$wrapper:function(a,b,c){Sk.abstr.checkNoKwargs(this.$name,c);Sk.abstr.checkArgsLen(this.$name,b,2,2);p(a,this);this.call(a,b[0],b[1]);return Sk.builtin.none.none$},$textsig:"($self, name, value, /)",$flags:{MinArgs:2,MaxArgs:2},$doc:"Implement setattr(self, name, value)."};m.__delattr__={$name:"__delattr__",$slot_name:"tp$setattr",$slot_func:m.__setattr__.$slot_func,$wrapper:function(a,b,c){Sk.abstr.checkOneArg(this.$name,b,c);p(a,this);this.call(a,b[0]);return Sk.builtin.none.none$},
$textsig:"($self, name, /)",$flags:{OneArg:!0},$doc:"Implement delattr(self, name)."};m.__get__={$name:"__get__",$slot_name:"tp$descr_get",$slot_func:function(a){return function(b,c,d){null===b&&(b=Sk.builtin.none.none$);null==c&&(c=Sk.builtin.none.none$);const e=a.tp$descr_get?a.tp$descr_get(this):a;b=Sk.misceval.callsimOrSuspendArray(e,[b,c]);return d?b:Sk.misceval.retryOptionalSuspensionOrThrow(b)}},$wrapper:function(a,b,c){Sk.abstr.checkNoKwargs(this.$name,c);Sk.abstr.checkArgsLen(this.$name,
b,1,2);c=b[0];b=b[1];c===Sk.builtin.none.none$&&(c=null);b===Sk.builtin.none.none$&&(b=null);if(null===b&&null===c)throw new Sk.builtin.TypeError("__get__(None, None) is invalid");return this.call(a,c,b)},$textsig:"($self, instance, owner, /)",$flags:{MinArgs:2,MaxArgs:2},$doc:"Return an attribute of instance, which is of type owner."};m.__set__={$name:"__set__",$slot_name:"tp$descr_set",$slot_func:k("__set__","__delete__"),$wrapper:e,$textsig:"($self, instance, value, /)",$flags:{MinArgs:2,MaxArgs:2},
$doc:"Set an attribute of instance to value."};m.__delete__={$name:"__delete__",$slot_name:"tp$descr_set",$slot_func:m.__set__.$slot_func,$wrapper:c,$textsig:"($self, instance, /)",$flags:{OneArg:!0},$doc:"Delete an attribute of instance."};m.__eq__={$name:"__eq__",$slot_name:"ob$eq",$slot_func:g,$wrapper:f,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self==value."};m.__ge__={$name:"__ge__",$slot_name:"ob$ge",$slot_func:g,$wrapper:f,$textsig:"($self, value, /)",$flags:{OneArg:!0},
$doc:"Return self>=value."};m.__gt__={$name:"__gt__",$slot_name:"ob$gt",$slot_func:g,$wrapper:f,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self>value."};m.__le__={$name:"__le__",$slot_name:"ob$le",$slot_func:g,$wrapper:f,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self<=value."};m.__lt__={$name:"__lt__",$slot_name:"ob$lt",$slot_func:g,$wrapper:f,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self<value."};m.__ne__={$name:"__ne__",$slot_name:"ob$ne",
$slot_func:g,$wrapper:f,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self!=value."};m.__iter__={$name:"__iter__",$slot_name:"tp$iter",$slot_func:h,$wrapper:a,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"Implement iter(self)."};m.__next__={$name:"__next__",$slot_name:"tp$iternext",$slot_func:function(a){return function(b){const c=a.tp$descr_get?a.tp$descr_get(this):a,d=Sk.misceval.tryCatch(()=>Sk.misceval.callsimOrSuspendArray(c,[]),a=>{if(!(a instanceof Sk.builtin.StopIteration))throw a;
});return b?d:Sk.misceval.retryOptionalSuspensionOrThrow(d)}},$wrapper:function(a,b,c){Sk.abstr.checkNoArgs(this.$name,b,c);return Sk.misceval.chain(a.tp$iternext(!0),a=>{if(void 0===a)throw new Sk.builtin.StopIteration;return a})},$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"Implement next(self)."};m.__len__={$name:"__len__",$slot_name:"sq$length",$slot_func:function(a){return function(b){const c=a.tp$descr_get?a.tp$descr_get(this):a;if(b)return b=Sk.misceval.callsimOrSuspendArray(c,[]),Sk.misceval.chain(b,
a=>Sk.misceval.asIndexOrThrow(a));b=Sk.misceval.callsimArray(c,[]);return Sk.misceval.asIndexOrThrow(b)}},$wrapper:l(a,a=>new Sk.builtin.int_(a)),$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return len(self)."};m.__contains__={$name:"__contains__",$slot_name:"sq$contains",$slot_func:function(a){return function(b,c){const d=a.tp$descr_get?a.tp$descr_get(this):a;b=Sk.misceval.callsimOrSuspendArray(d,[b]);b=Sk.misceval.chain(b,a=>Sk.misceval.isTrue(a));return b.$isSuspension?c?b:Sk.misceval.retryOptionalSuspensionOrThrow(b):
b}},$wrapper:l(c,a=>new Sk.builtin.bool(a)),$textsig:"($self, key, /)",$flags:{OneArg:!0},$doc:"Return key in self."};m.__getitem__={$name:"__getitem__",$slot_name:"mp$subscript",$slot_func:function(a){return function(b,c){const d=a.tp$descr_get?a.tp$descr_get(this):a;b=Sk.misceval.callsimOrSuspendArray(d,[b]);return c?b:Sk.misceval.retryOptionalSuspensionOrThrow(b)}},$wrapper:c,$textsig:"($self, key, /)",$flags:{OneArg:!0},$doc:"Return self[key]."};m.__setitem__={$name:"__setitem__",$slot_name:"mp$ass_subscript",
$slot_func:k("__setitem__","__delitem__","does not support item assignment"),$wrapper:e,$textsig:"($self, key, value, /)",$flags:{MinArgs:2,MaxArgs:2},$doc:"Set self[key] to value."};m.__delitem__={$name:"__delitem__",$slot_name:"mp$ass_subscript",$slot_func:m.__setitem__.$slot_func,$wrapper:c,$textsig:"($self, key, /)",$flags:{OneArg:!0},$doc:"Delete self[key]."};m.__add__={$name:"__add__",$slot_name:"nb$add",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self+value."};
m.__radd__={$name:"__radd__",$slot_name:"nb$reflected_add",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value+self."};m.__iadd__={$name:"__iadd__",$slot_name:"nb$inplace_add",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self+=value."};m.__sub__={$name:"__sub__",$slot_name:"nb$subtract",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self-value."};m.__rsub__={$name:"__rsub__",$slot_name:"nb$reflected_subtract",
$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value-self."};m.__imul__={$name:"__imul__",$slot_name:"nb$inplace_multiply",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self*=value."};m.__mul__={$name:"__mul__",$slot_name:"nb$multiply",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self*value."};m.__rmul__={$name:"__rmul__",$slot_name:"nb$reflected_multiply",$slot_func:g,$wrapper:c,
$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value*self."};m.__isub__={$name:"__isub__",$slot_name:"nb$inplace_subtract",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self-=value."};m.__mod__={$name:"__mod__",$slot_name:"nb$remainder",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self%value."};m.__rmod__={$name:"__rmod__",$slot_name:"nb$reflected_remainder",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",
$flags:{OneArg:!0},$doc:"Return value%self."};m.__imod__={$name:"__imod__",$slot_name:"nb$inplace_remainder",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement value%=self."};m.__divmod__={$name:"__divmod__",$slot_name:"nb$divmod",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return divmod(self, value)."};m.__rdivmod__={$name:"__rdivmod__",$slot_name:"nb$reflected_divmod",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},
$doc:"Return divmod(value, self)"};m.__pos__={$name:"__pos__",$slot_name:"nb$positive",$slot_func:h,$wrapper:a,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"+self"};m.__neg__={$name:"__neg__",$slot_name:"nb$negative",$slot_func:h,$wrapper:a,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"-self"};m.__abs__={$name:"__abs__",$slot_name:"nb$abs",$slot_func:h,$wrapper:a,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"abs(self)"};m.__bool__={$name:"__bool__",$slot_name:"nb$bool",$slot_func:d("__bool__",
Sk.builtin.checkBool,"bool",a=>0!==a.v),$wrapper:l(a,a=>new Sk.builtin.bool(a)),$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"self != 0"};m.__invert__={$name:"__invert__",$slot_name:"nb$invert",$slot_func:h,$wrapper:a,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"~self"};m.__lshift__={$name:"__lshift__",$slot_name:"nb$lshift",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self<<value."};m.__rlshift__={$name:"__rlshift__",$slot_name:"nb$reflected_lshift",$slot_func:g,
$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value<<self."};m.__rshift__={$name:"__rshift__",$slot_name:"nb$rshift",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self>>value."};m.__rrshift__={$name:"__rrshift__",$slot_name:"nb$reflected_rshift",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value>>self."};m.__ilshift__={$name:"__ilshift__",$slot_name:"nb$inplace_lshift",$slot_func:g,$wrapper:c,
$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self<<=value."};m.__irshift__={$name:"__irshift__",$slot_name:"nb$inplace_rshift",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self=>>value."};m.__and__={$name:"__and__",$slot_name:"nb$and",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self&value."};m.__rand__={$name:"__rand__",$slot_name:"nb$refelcted_and",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",
$flags:{OneArg:!0},$doc:"Return value&self."};m.__iand__={$name:"__iand__",$slot_name:"nb$and",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self&=value."};m.__xor__={$name:"__xor__",$slot_name:"nb$xor",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self^value."};m.__rxor__={$name:"__rxor__",$slot_name:"nb$reflected_xor",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value^self."};
m.__ixor__={$name:"__ixor__",$slot_name:"nb$inplace_xor",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self^=value."};m.__or__={$name:"__or__",$slot_name:"nb$or",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self|value."};m.__ror__={$name:"__ror__",$slot_name:"nb$reflected_or",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value|self."};m.__ior__={$name:"__ior__",$slot_name:"nb$inplace_or",
$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self|=value."};m.__int__={$name:"__int__",$slot_name:"nb$int",$slot_func:d("__int__",Sk.builtin.checkInt,"int"),$wrapper:a,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"int(self)"};m.__float__={$name:"__float__",$slot_name:"nb$float",$slot_func:d("__float__",Sk.builtin.checkFloat,"float"),$wrapper:a,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"float(self)"};m.__floordiv__={$name:"__floordiv__",$slot_name:"nb$floor_divide",
$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self//value."};m.__rfloordiv__={$name:"__rfloordiv__",$slot_name:"nb$reflected_floor_divide",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value//self."};m.__ifloordiv__={$name:"__ifloordiv__",$slot_name:"nb$inplace_floor_divide",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self//=value."};m.__truediv__={$name:"__truediv__",$slot_name:"nb$divide",
$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self/value."};m.__rtruediv__={$name:"__rtruediv__",$slot_name:"nb$reflected_divide",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value/self."};m.__itruediv__={$name:"__itruediv__",$slot_name:"nb$inplace_divide",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self/=value."};m.__index__={$name:"__index__",$slot_name:"nb$index",$slot_func:d("__index__",
Sk.builtin.checkInt,"int",a=>a.v),$wrapper:l(a,a=>new Sk.builtin.int_(a)),$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"Return self converted to an integer, if self is suitable for use as an index into a list."};m.__pow__={$name:"__pow__",$slot_name:"nb$power",$slot_func:function(a){return function(b,c){const d=a.tp$descr_get?a.tp$descr_get(this):a;return void 0==c?Sk.misceval.callsimArray(d,[b]):Sk.misceval.callsimArray(d,[b,c])}},$wrapper:b,$textsig:"($self, value, mod=None, /)",$flags:{MinArgs:1,
MaxArgs:2},$doc:"Return pow(self, value, mod)."};m.__rpow__={$name:"__rpow__",$slot_name:"nb$reflected_power",$slot_func:m.__pow__.$slot_func,$wrapper:b,$textsig:"($self, value, mod=None, /)",$flags:{MinArgs:1,MaxArgs:2},$doc:"Return pow(value, self, mod)."};m.__ipow__={$name:"__ipow__",$slot_name:"nb$inplace_power",$slot_func:m.__pow__.$slot_func,$wrapper:b,$textsig:"($self, value, mod=None, /)",$flags:{MinArgs:1,MaxArgs:2},$doc:"Implement **="};m.__matmul__={$name:"__matmul__",$slot_name:"nb$matrix_multiply",
$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self@value."};m.__rmatmul__={$name:"__rmatmul__",$slot_name:"nb$reflected_matrix_multiply",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value@self."};m.__imatmul__={$name:"__imatmul__",$slot_name:"nb$inplace_matrix_multiply",$slot_func:g,$wrapper:c,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self@=value."};m.__long__={$name:"__long__",$slot_name:"nb$long",
$slot_func:d("__long__",Sk.builtin.checkInt,"int"),$wrapper:a,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"int(self)"};var A,t={next:{$name:"next",$slot_name:"tp$iternext",$slot_func:m.__next__.$slot_func,$wrapper:m.__next__.$wrapper,$textsig:m.__next__.$textsig,$flags:m.__next__.$flags},__nonzero__:{$name:"__nonzero__",$slot_name:"nb$bool",$slot_func:d("__nonzero__",Sk.builtin.checkInt,"int",a=>0!==a.v),$wrapper:l(a,a=>new Sk.builtin.bool(a)),$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"x.__nonzero__() <==> x != 0"},
__div__:{$name:"__div__",$slot_name:"nb$divide",$slot_func:g,$wrapper:c,$textsig:"($self, other/)",$flags:{OneArg:!0},$doc:"x.__div__(y) <==> x/y"},__rdiv__:{$name:"__rdiv__",$slot_name:"nb$reflected_divide",$slot_func:g,$wrapper:c,$textsig:"($self, other/)",$flags:{OneArg:!0},$doc:"x.__rdiv__(y) <==> x/y"},__idiv__:{$name:"__idiv__",$slot_name:"nb$inplace_divide",$slot_func:g,$wrapper:c,$textsig:"($self, other/)",$flags:{OneArg:!0},$doc:"implement self /= other"}};Sk.subSlots={main_slots:Object.entries({tp$init:"__init__",
tp$call:"__call__",$r:"__repr__",tp$str:"__str__",tp$getattr:"__getattribute__",tp$setattr:["__setattr__","__delattr__"],ob$eq:"__eq__",ob$ne:"__ne__",ob$lt:"__lt__",ob$le:"__le__",ob$gt:"__gt__",ob$ge:"__ge__",tp$descr_get:"__get__",tp$descr_set:["__set__","__delete__"],tp$iter:"__iter__",tp$iternext:"__next__"}),number_slots:Object.entries({nb$abs:"__abs__",nb$negative:"__neg__",nb$positive:"__pos__",nb$int:"__int__",nb$long:"__long__",nb$float:"__float__",nb$add:"__add__",nb$reflected_add:"__radd__",
nb$inplace_add:"__iadd__",nb$subtract:"__sub__",nb$reflected_subtract:"__rsub__",nb$inplace_subtract:"__isub__",nb$multiply:"__mul__",nb$reflected_multiply:"__rmul__",nb$inplace_multiply:"__imul__",nb$floor_divide:"__floordiv__",nb$reflected_floor_divide:"__rfloordiv__",nb$inplace_floor_divide:"__ifloordiv__",nb$invert:"__invert__",nb$remainder:"__mod__",nb$reflected_remainder:"__rmod__",nb$inplace_remainder:"__imod__",nb$divmod:"__divmod__",nb$reflected_divmod:"__rdivmod__",nb$power:"__pow__",nb$reflected_power:"__rpow__",
nb$inplace_power:"__ipow__",nb$divide:"__truediv__",nb$reflected_divide:"__rtruediv__",nb$inplace_divide:"__itruediv__",nb$bool:"__bool__",nb$and:"__and__",nb$reflected_and:"__rand__",nb$inplace_and:"__iand__",nb$or:"__or__",nb$reflected_or:"__ror__",nb$inplace_or:"__ior__",nb$xor:"__xor__",nb$reflected_xor:"__rxor__",nb$inplace_xor:"__ixor__",nb$lshift:"__lshift__",nb$reflected_lshift:"__rlshift__",nb$rshift:"__rshift__",nb$reflected_rshift:"__rrshift__",nb$inplace_lshift:"__ilshift__",nb$inplace_rshift:"__irshift__",
nb$matrix_multiply:"__matmul__",nb$reflected_matrix_multiply:"__rmatmul__",nb$inplace_matrix_multiply:"__imatmul__"}),sequence_and_mapping_slots:Object.entries({sq$length:"__len__",sq$contains:"__contains__",mp$subscript:"__getitem__",mp$ass_subscript:["__setitem__","__delitem__"],nb$add:"__add__",nb$multiply:"__mul__",nb$reflected_multiply:"__rmul__",nb$inplace_add:"__iadd__",nb$inplace_multiply:"__imul__"})};Sk.reflectedNumberSlots={nb$add:{reflected:"nb$reflected_add"},nb$subtract:{reflected:"nb$reflected_subtract",
slot:function(a){return a instanceof this.constructor?a.nb$subtract(this):Sk.builtin.NotImplemented.NotImplemented$}},nb$multiply:{reflected:"nb$reflected_multiply"},nb$divide:{reflected:"nb$reflected_divide",slot:function(a){return a instanceof this.constructor?a.nb$divide(this):Sk.builtin.NotImplemented.NotImplemented$}},nb$floor_divide:{reflected:"nb$reflected_floor_divide",slot:function(a){return a instanceof this.constructor?a.nb$floor_divide(this):Sk.builtin.NotImplemented.NotImplemented$}},
nb$remainder:{reflected:"nb$reflected_remainder",slot:function(a){return a instanceof this.constructor?a.nb$remainder(this):Sk.builtin.NotImplemented.NotImplemented$}},nb$divmod:{reflected:"nb$reflected_divmod",slot:function(a){return a instanceof this.constructor?a.nb$divmod(this):Sk.builtin.NotImplemented.NotImplemented$}},nb$power:{reflected:"nb$reflected_power",slot:function(a,b){return a instanceof this.constructor?a.nb$power(this,b):Sk.builtin.NotImplemented.NotImplemented$}},nb$and:{reflected:"nb$reflected_and"},
nb$or:{reflected:"nb$reflected_or"},nb$xor:{reflected:"nb$reflected_xor"},nb$lshift:{reflected:"nb$reflected_lshift",slot:function(a){return a instanceof this.constructor?a.nb$lshift(this):Sk.builtin.NotImplemented.NotImplemented$}},nb$rshift:{reflected:"nb$reflected_rshift",slot:function(a){return a instanceof this.constructor?a.nb$rshift(this):Sk.builtin.NotImplemented.NotImplemented$}},nb$matrix_multiply:{reflected:"nb$reflexted_matrix_multiply",slot:function(a){return a instanceof this.constructor?
a.nb$matrix_multiply(this):Sk.builtin.NotImplemented.NotImplemented$}}};Sk.sequenceAndMappingSlots={sq$concat:["nb$add"],sq$repeat:["nb$multiply","nb$reflected_multiply"],mp$length:["sq$length"],sq$inplace_repeat:["nb$inplace_multiply"],sq$inplace_concat:["nb$inplace_add"]};Sk.dunderToSkulpt={__repr__:"$r",__str__:"tp$str",__init__:"tp$init",__new__:"tp$new",__hash__:"tp$hash",__call__:"tp$call",__iter__:"tp$iter",__next__:"tp$iternext",__eq__:"ob$eq",__ne__:"ob$ne",__lt__:"ob$lt",__le__:"ob$le",
__gt__:"ob$gt",__ge__:"ob$ge",__abs__:"nb$abs",__neg__:"nb$negative",__pos__:"nb$positive",__int__:"nb$int",__float__:"nb$float",__add__:"nb$add",__radd__:"nb$reflected_add",__iadd__:"nb$inplace_add",__sub__:"nb$subtract",__rsub__:"nb$reflected_subtract",__isub__:"nb$inplace_subtract",__mul__:"nb$multiply",__rmul__:"nb$reflected_multiply",__imul__:"nb$inplace_multiply",__truediv__:"nb$divide",__rtruediv__:"nb$reflected_divide",__itruediv__:"nb$inplace_divide",__floordiv__:"nb$floor_divide",__rfloordiv__:"nb$reflected_floor_divide",
__ifloordiv__:"nb$inplace_floor_divide",__invert__:"nb$invert",__mod__:"nb$remainder",__rmod__:"nb$reflected_remainder",__imod__:"nb$inplace_remainder",__divmod__:"nb$divmod",__rdivmod__:"nb$reflected_divmod",__pow__:"nb$power",__rpow__:"nb$reflected_power",__ipow__:"nb$inplace_power",__bool__:"nb$bool",__long__:"nb$long",__lshift__:"nb$lshift",__rlshift__:"nb$reflected_lshift",__ilshift__:"nb$inplace_lshift",__rshift__:"nb$rshift",__rrshift__:"nb$reflected_rshift",__irshift__:"nb$inplace_rshift",
__and__:"nb$and",__rand__:"nb$reflected_and",__iand__:"nb$inplace_and",__or__:"nb$or",__ror__:"nb$reflected_or",__ior__:"nb$inplace_or",__xor__:"nb$xor",__rxor__:"nb$reflected_xor",__ixor__:"nb$inplace_xor",__matmul__:"nb$matrix_multiply",__rmatmul__:"nb$reflected_matrix_multiply",__imatmul__:"nb$inplace_matrix_multiply",__get__:"tp$descr_get",__set__:"tp$descr_set",__delete__:"tp$descr_set",__getattribute__:"tp$getattr",__getattr__:"tp$getattr",__setattr__:"tp$setattr",__delattr__:"tp$setattr",__len__:"sq$length",
__contains__:"sq$contains",__getitem__:"mp$subscript",__setitem__:"mp$ass_subscript",__delitem__:"mp$ass_subscript"};Sk.exportSymbol("Sk.setupDunderMethods",Sk.setupDunderMethods);Sk.setupDunderMethods=function(a){function b(a,b,c){for(let d=0;d<a.length;d++){const e=a[d].prototype;e.hasOwnProperty(c)||(e[c]=e[b],delete e[b])}}var c=Sk.slots;if(!a||void 0!==A){var d=Sk.abstr.built$iterators,e=[Sk.builtin.int_,Sk.builtin.lng,Sk.builtin.float_,Sk.builtin.complex],f=Sk.subSlots.number_slots,g=Sk.subSlots.main_slots,
h=g.findIndex(a=>"tp$iternext"===a[0]),k=f.findIndex(a=>"nb$bool"===a[0]),l=Sk.dunderToSkulpt;if(a){l.__bool__="nb$bool";l.__next__="tp$iternext";delete l.__nonzero__;delete l.__div__;delete l.__rdiv__;delete l.__idiv__;delete l.next;for(let a in A)c[a]=A[a];for(let a in t)delete c[a];for(a=0;a<e.length;a++)c=e[a].prototype,delete c.__div__,delete c.__rdiv__;g[h][1]="__next__";f[k][1]="__bool__";b(d,"next","__next__");b(e,"__bool__","__nonzero__")}else{void 0===A&&(c.py3$slots={__next__:c.__next__},
A=c.py3$slots);l.next="tp$iternext";l.__nonzero__="nb$bool";l.__div__="nb$divide";l.__rdiv__="nb$reflected_divide";l.__idiv__="nb$inplace_divide";delete l.__bool__;delete l.__next__;for(let a in t)c[a]=t[a];for(let a in A)delete c[a];g[h][1]="next";f[k][1]="__nonzero__";b(d,"__next__","next");b(e,"__nonzero__","__bool__");for(d=0;d<e.length;d++)f=e[d],g=f.prototype,g.hasOwnProperty("__div__")||(g.__div__=new Sk.builtin.wrapper_descriptor(f,t.__div__,g.nb$divide),g.__rdiv__=new Sk.builtin.wrapper_descriptor(f,
t.__rdiv__,Sk.reflectedNumberSlots.nb$divide.slot))}}}},function(m,q){function a(a,h,d){return Sk.abstr.buildNativeClass(a,{constructor:d.constructor,slots:Object.assign({tp$getattr:Sk.generic.getAttr,$r:e},d.slots),getsets:Object.assign(d.getsets||{},f),proto:Object.assign(d.proto||{},{d$repr_name:h||a,d$check:c,d$set_check:b}),flags:{sk$acceptable_as_base_class:!1}})}function c(a){if(null==a)return this;if(!a.ob$type.$isSubType(this.d$type))throw new Sk.builtin.TypeError("descriptor '"+this.d$name+
"' requires a '"+this.d$type.prototype.tp$name+"' object but received a '"+Sk.abstr.typeName(a)+"' object");}function b(a){if(!a.ob$type.$isSubType(this.d$type))throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' requires a '"+this.d$type.prototype.tp$name+"' object but received a '"+Sk.abstr.typeName(a)+"' object");}function e(){return new Sk.builtin.str("<"+this.d$repr_name+" '"+this.d$name+"' of '"+this.d$type.prototype.tp$name+"' objects>")}const f={__doc__:{$get(){return this.d$def.$doc?
new Sk.builtin.str(this.d$def.$doc):Sk.builtin.none.none$}},__objclass__:{$get(){return this.d$type}},__name__:{$get(){return new Sk.builtin.str(this.d$name)}}};m={__text_signature__:{$get(){return this.d$def.$textsig?new Sk.builtin.str(this.d$def.$textsig):Sk.builtin.none.none$}}};Sk.builtin.getset_descriptor=a("getset_descriptor",void 0,{constructor:function(a,b){this.d$def=b;this.$get=b.$get;this.$set=b.$set;this.d$type=a;this.d$name=b.$name},slots:{tp$descr_get(a,b){if(b=this.d$check(a))return b;
if(void 0!==this.$get)return this.$get.call(a);throw new Sk.builtin.AttributeError("getset_descriptor '"+this.d$name+"' of '"+this.d$type.prototype.tp$name+"' objects is not readable");},tp$descr_set(a,b){this.d$set_check(a);if(void 0!==this.$set)return this.$set.call(a,b);throw new Sk.builtin.AttributeError("attribute '"+this.d$name+"' of '"+this.d$type.prototype.tp$name+"' objects is readonly");}}});Sk.builtin.method_descriptor=a("method_descriptor","method",{constructor:function(a,b){this.d$def=
b;this.$meth=b.$meth;this.d$type=a;this.d$name=b.$name||"<native JS>";this.$flags=a=b.$flags||{};a.FastCall&&a.NoKwargs?this.tp$call=this.$methodFastCallNoKwargs:a.FastCall?this.tp$call=this.$methodFastCall:a.NoArgs?this.tp$call=this.$methodCallNoArgs:a.OneArg?this.tp$call=this.$methodCallOneArg:a.NamedArgs?this.tp$call=this.$methodCallNamedArgs:void 0!==a.MinArgs?this.tp$call=this.$methodCallMinArgs:(this.func_code=b.$meth,this.tp$call=this.$defaultCall,this.$memoiseFlags=Sk.builtin.func.prototype.$memoiseFlags,
this.$resolveArgs=Sk.builtin.func.prototype.$resolveArgs)},slots:{tp$call(a,b){return this.tp$call(a,b)},tp$descr_get(a,b){let c;return(c=this.d$check(a))?c:new Sk.builtin.sk_method(this.d$def,a)}},getsets:m,proto:{$methodFastCall(a,b){const c=a.shift();this.m$checkself(c);return this.$meth.call(c,a,b)},$methodFastCallNoKwargs(a,b){const c=a.shift();this.m$checkself(c);Sk.abstr.checkNoKwargs(this.d$name,b);return this.$meth.call(c,a)},$methodCallNoArgs(a,b){const c=a.shift();this.m$checkself(c);Sk.abstr.checkNoArgs(this.d$name,
a,b);return this.$meth.call(c)},$methodCallOneArg(a,b){const c=a.shift();this.m$checkself(c);Sk.abstr.checkOneArg(this.d$name,a,b);return this.$meth.call(c,a[0])},$methodCallNamedArgs(a,b){const c=a.shift();this.m$checkself(c);a=Sk.abstr.copyKeywordsToNamedArgs(this.d$name,this.$flags.NamedArgs,a,b,this.$flags.Defaults);return this.$meth.call(c,...a)},$methodCallMinArgs(a,b){const c=a.shift();this.m$checkself(c);Sk.abstr.checkNoKwargs(this.d$name,b);Sk.abstr.checkArgsLen(this.d$name,a,this.$flags.MinArgs,
this.$flags.MaxArgs);return this.$meth.call(c,...a)},$defaultCall(a,b){this.m$checkself(a[0]);return Sk.builtin.func.prototype.tp$call.call(this,a,b)},m$checkself(a){if(void 0===a)throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' of '"+this.d$type.prototype.tp$name+"' object needs an argument");this.d$check(a)}}});Sk.builtin.wrapper_descriptor=a("wrapper_descriptor","slot wrapper",{constructor:function(a,b,c){this.d$def=b;this.d$type=a;this.d$name=c.$name=b.$name;this.d$wrapped=c},slots:{tp$descr_get(a,
b){let c;return(c=this.d$check(a))?c:new Sk.builtin.method_wrapper(this,a)},tp$call(a,b){if(1>a.length)throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' of '"+this.d$type.prototype.tp$name+"' object needs an argument");const c=a.shift();if(!c.ob$type.$isSubType(this.d$type))throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' requires a '"+this.d$type.prototype.tp$name+"' object but received a '"+Sk.abstr.typeName(c)+"'");return this.raw$call(c,a,b)}},proto:{raw$call(a,b,c){this.d$wrapped.$name=
this.d$name;return this.d$def.$wrapper.call(this.d$wrapped,a,b,c)}}});Sk.builtin.method_wrapper=a("method_wrapper",void 0,{constructor:function(a,b){this.m$descr=a;this.m$self=b;this.d$def=a.d$def;this.d$name=a.d$name;this.d$type=a.d$type},slots:{tp$call(a,b){return this.m$descr.raw$call(this.m$self,a,b)},tp$richcompare(a,b){if("Eq"!==b&&"NotEq"!==b||!(a instanceof Sk.builtin.method_wrapper))return Sk.builtin.NotImplemented.NotImplemented$;a=this.m$self===a.m$self&&this.m$descr===a.m$descr;return"Eq"===
b?a:!a},$r(){return new Sk.builtin.str("<method-wrapper '"+this.d$name+"' of "+Sk.abstr.typeName(this.m$self)+" object>")}},getsets:{__self__:{$get(){return this.m$self}}}});Sk.builtin.classmethod_descriptor=a("classmethod_descriptor","method",{constructor:function(a,b){this.d$def=b;this.$meth=b.$meth;this.d$type=a;this.d$name=b.$name||"<native JS>"},slots:{tp$call(a,b){if(1>a.length)throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' of '"+this.d$type.prototype.tp$name+"' object needs an argument");
const c=a.shift();return this.tp$descr_get(null,c).tp$call(a,b)},tp$descr_get(a,b,c){if(void 0===b)if(null!==a)b=b||a.ob$type;else throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' for type '"+this.d$type.prototype.tp$name+"' needs an object or a type");if(b.ob$type!==Sk.builtin.type)throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' for type '"+this.d$type.prototype.tp$name+"' needs a type not a '"+Sk.abstr.typeName(b)+"' as arg 2");if(!b.$isSubType(this.d$type))throw new Sk.builtin.TypeError("descriptor '"+
this.d$name+"' requires a '"+this.d$type.prototype.tp$name+"' object but received a '"+Sk.abstr.typeName(b)+"' object");return new Sk.builtin.sk_method(this.d$def,b)}},getsets:m});[Sk.builtin.method_descriptor,Sk.builtin.getset_descriptor,Sk.builtin.wrapper_descriptor,Sk.builtin.method_wrapper,Sk.builtin.classmethod_descriptor].forEach(a=>{Sk.abstr.setUpSlots(a);Sk.abstr.setUpMethods(a);Sk.abstr.setUpGetSets(a)})},function(m,q){Sk.builtin.sk_method=Sk.abstr.buildNativeClass("builtin_function_or_method",
{constructor:function(a,c,b){this.$meth=a.$meth.bind(c);this.$doc=a.$doc;this.$self=c||null;this.$module=b?new Sk.builtin.str(b):null;this.$name=a.$name||a.$meth.name||"<native JS>";this.m$def=a;this.$textsig=a.$textsig;this.$flags=a=a.$flags||{};a.FastCall&&a.NoKwargs?this.tp$call=this.$fastCallNoKwargs:a.FastCall?this.tp$call=this.$meth:a.NoArgs?this.tp$call=this.$callNoArgs:a.OneArg?this.tp$call=this.$callOneArg:a.NamedArgs?this.tp$call=this.$callNamedArgs:void 0!==a.MinArgs?this.tp$call=this.$callMinArgs:
(this.func_code=this.$meth,this.tp$call=this.$defaultCallMethod)},proto:{$fastCallNoKwargs(a,c){Sk.abstr.checkNoKwargs(this.$name,c);return this.$meth(a)},$callNoArgs(a,c){Sk.abstr.checkNoArgs(this.$name,a,c);return this.$meth()},$callOneArg(a,c){Sk.abstr.checkOneArg(this.$name,a,c);return this.$meth(a[0])},$callNamedArgs(a,c){a=Sk.abstr.copyKeywordsToNamedArgs(this.$name,this.$flags.NamedArgs,a,c,this.$flags.Defaults);return this.$meth(...a)},$callMinArgs(a,c){Sk.abstr.checkNoKwargs(this.$name,c);
Sk.abstr.checkArgsLen(this.$name,a,this.$flags.MinArgs,this.$flags.MaxArgs);return this.$meth(...a)},$defaultCallMethod(a,c){return null!==this.$self?Sk.builtin.func.prototype.tp$call.call(this,[this.$self,...a],c):Sk.builtin.func.prototype.tp$call.call(this,a,c)},$memoiseFlags(){return Sk.builtin.func.prototype.$memoiseFlags.call(this)},$resolveArgs(){return Sk.builtin.func.prototype.$resolveArgs.call(this)}},flags:{sk$acceptable_as_base_class:!1},slots:{tp$getattr:Sk.generic.getAttr,$r(){return null===
this.$self?new Sk.builtin.str("<built-in function "+this.$name+">"):new Sk.builtin.str("<built-in method "+this.$name+" of "+Sk.abstr.typeName(this.$self)+" object>")},tp$call(a,c){return this.tp$call(a,c)},tp$richcompare(a,c){if("Eq"!==c&&"NotEq"!==c||!(a instanceof Sk.builtin.sk_method))return Sk.builtin.NotImplemented.NotImplemented$;a=this.$self===a.$self&&this.m$def.$meth===a.m$def.$meth;return"Eq"===c?a:!a}},getsets:{__module__:{$get(){return this.$module||Sk.builtin.none.none$},$set(a){this.$module=
a=a||Sk.builtin.none.none$}},__doc__:{$get(){return this.$doc?new Sk.builtin.str(this.$doc):Sk.builtin.none.none$}},__name__:{$get(){return new Sk.builtin.str(this.$name)}},__text_signature__:{$get(){return new Sk.builtin.str(this.$textsig)}},__self__:{$get(){return this.$self||Sk.sysModules.mp$lookup(this.$module)||Sk.builtin.none.none$}}}})},function(m,q){Sk.builtin.none=Sk.abstr.buildNativeClass("NoneType",{constructor:function(){return Sk.builtin.none.none$},slots:{tp$new(a,c){Sk.abstr.checkNoArgs("NoneType",
a,c);return Sk.builtin.none.none$},$r(){return new Sk.builtin.str("None")},tp$as_number:!0,nb$bool(){return!1}},flags:{sk$acceptable_as_base_class:!1}});Sk.builtin.none.none$=Object.create(Sk.builtin.none.prototype,{v:{value:null,enumerable:!0}});Sk.builtin.NotImplemented=Sk.abstr.buildNativeClass("NotImplementedType",{constructor:function(){return Sk.builtin.NotImplemented.NotImplemented$},slots:{$r(){return new Sk.builtin.str("NotImplemented")},tp$new(a,c){Sk.abstr.checkNoArgs("NotImplementedType",
a,c);return Sk.builtin.NotImplemented.NotImplemented$}},flags:{sk$acceptable_as_base_class:!1}});Sk.builtin.NotImplemented.NotImplemented$=Object.create(Sk.builtin.NotImplemented.prototype,{v:{value:null,enumerable:!0}})},function(m,q){const a=/^(?:(.)?([<>=\^]))?([\+\-\s])?(#)?(0)?(\d+)?(,)?(?:\.(\d+))?([bcdeEfFgGnosxX%])?$/;Sk.formatting={};let c=function(a,b,c,e){Sk.asserts.assert("string"===typeof b);if(a[6]){var d=parseInt(a[6],10);e=a[2]||(a[5]?"=":e?">":"<");let f=d-(b.length+(c?c.length:0));
if(0>=f)return b;d=(a[1]||(a[5]?"0":" ")).repeat(f);switch(e){case "=":if("s"===a[9])throw new Sk.builtin.ValueError("'=' alignment not allowed in string format specifier");return c+d+b;case ">":return d+c+b;case "<":return c+b+d;case "^":return a=Math.floor(f/2),d.substring(0,a)+c+b+d.substring(a)}}return c+b},b=function(a,b){return b?"-":"+"===a[3]?"+":" "===a[3]?" ":""},e=function(a,e,d){Sk.asserts.assert(e instanceof Sk.builtin.int_||e instanceof Sk.builtin.lng);if(a[8])throw new Sk.builtin.ValueError("Precision not allowed in integer format");
let f=e.str$(d,!1);e=e.nb$isnegative();e=b(a,e);a[4]&&(16===d?e+="0x":8===d?e+="0o":2===d&&(e+="0b"));"X"===a[9]&&(f=f.toUpperCase());"n"===a[9]?f=(+f).toLocaleString():a[7]&&(d=f.toString().split("."),d[0]=d[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),f=d.join("."));return c(a,f,e,!0)},f=function(f,h,d){if(!h)return f.str$(10,!0);h=h.match(a);if(!h)throw new Sk.builtin.ValueError("Invalid format specifier");var g=h[9];g||(g=d?"g":"d");if(-1==(d?"fFeEgG%":"bcdoxXnfFeEgG%").indexOf(g))throw new Sk.builtin.ValueError("Unknown format code '"+
h[9]+"' for object of type '"+Sk.abstr.typeName(f)+"'");switch(g){case "d":case "n":return e(h,f,10);case "x":case "X":return e(h,f,16);case "o":return e(h,f,8);case "b":return e(h,f,2);case "c":if(h[3])throw new Sk.builtin.ValueError("Sign not allowed with integer format specifier 'c'");if(h[4])throw new Sk.builtin.ValueError("Alternate form not allowed with integer format specifier 'c'");if(h[7])throw new Sk.builtin.ValueError("Cannot specify ',' with 'c'");if(h[8])throw new Sk.builtin.ValueError("Cannot specify ',' with 'c'");
return c(h,String.fromCodePoint(Sk.builtin.asnum$(f)),"",!0);case "f":case "F":case "e":case "E":case "g":case "G":{if(h[4])throw new Sk.builtin.ValueError("Alternate form (#) not allowed in float format specifier");d=Sk.builtin.asnum$(f);"string"===typeof d&&(d=Number(d));if(Infinity===d)return c(h,"inf","",!0);if(-Infinity===d)return c(h,"inf","-",!0);if(isNaN(d))return c(h,"nan","",!0);f=!1;0>d&&(d=-d,f=!0);var l=["toExponential","toFixed","toPrecision"]["efg".indexOf(g.toLowerCase())];let a=h[8]?
parseInt(h[8],10):6;d=d[l](a);-1!=="EFG".indexOf(g)&&(d=d.toUpperCase());if("g"===g.toLowerCase()||!h[9]){if(l=d.match(/\.(\d*[1-9])?(0+)$/)){let [,a,b]=l;d=d.slice(0,a?-b.length:-(b.length+1))}-1!=d.indexOf(".")||h[9]||(d+=".0")}"e"===g.toLowerCase()&&(d=d.replace(/^([-+]?[0-9]*\.?[0-9]+[eE][-+]?)([0-9])?$/,"$10$2"));h[7]&&(g=d.toString().split("."),g[0]=g[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),d=g.join("."));return c(h,d,b(h,f),!0)}case "%":if(h[4])throw new Sk.builtin.ValueError("Alternate form (#) not allowed with format specifier '%'");
f=Sk.builtin.asnum$(f);"string"===typeof f&&(f=Number(f));if(Infinity===f)return c(h,"inf%","",!0);if(-Infinity===f)return c(h,"inf%","-",!0);if(isNaN(f))return c(h,"nan%","",!0);g=!1;0>f&&(f=-f,g=!0);d=h[8]?parseInt(h[8],10):6;f=(100*f).toFixed(d)+"%";return c(h,f,b(h,g),!0);default:throw new Sk.builtin.ValueError("Unknown format code '"+h[9]+"'");}};Sk.formatting.mkNumber__format__=a=>function(b){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(f(this,b.$jsstr(),a))};Sk.formatting.format=function(a,b){b=b||[];const c={};for(let a=0;a<b.length;a+=2)c[b[a]]=b[a+1];for(let b in a)c[b]=a[b];let e=0;a=this.v.replace(/{(((?:\d+)|(?:\w+))?((?:\.(\w+))|(?:\[((?:\d+)|(?:\w+))\])?))?(?:!([rs]))?(?::([^}]*))?}/g,function(a,b,d,f,g,h,l,B,D,m){let k;if(void 0!==h&&""!==h)a=c[d],k=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)k=Sk.abstr.gattr(c[d||e++],new Sk.builtin.str(g));else if(void 0!==d&&""!==d)k=c[d];else if(void 0===b||""===b)k=c[e],e++;else if(b instanceof Sk.builtin.int_||b instanceof Sk.builtin.float_||b instanceof Sk.builtin.lng||/^\d+$/.test(b))k=c[b],e++;if("s"===l)k=new Sk.builtin.str(k);else if("r"===l)k=Sk.builtin.repr(k);else if(""!==l&&void 0!==l)throw new Sk.builtin.ValueError("Unknown conversion specifier "+l);return Sk.abstr.objectFormat(k,
new Sk.builtin.str(B)).$jsstr()});return new Sk.builtin.str(a)};Sk.formatting.formatString=function(b){if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("format() argument 2 must be str, not "+Sk.abstr.typeName(b));b=b.$jsstr().match(a);if(b[9]&&"s"!==b[9])throw new Sk.builtin.ValueError("Unknown format code '"+b[9]+"' for object of type 'str'");if(b[3])throw new Sk.builtin.ValueError("Sign not allowed in string format specifier");if(b[4])throw new Sk.builtin.ValueError("Alternate form (#) not allowed with string format specifier");
if(b[7])throw new Sk.builtin.ValueError("Cannot specify ',' with 's'");let e=this.v;b[8]&&(e=e.substring(0,b[8]));return new Sk.builtin.str(c(b,e,"",!1))}},function(m,q){function a(a){let b;const c=[];for(let d=0;d<a.length;d++)b=a.charAt(d),k.test(b)?c.push(b):"\\000"===b?c.push("\\000"):c.push("\\"+b);return c.join("")}function c(a,b,c){b=Sk.builtin.checkNone(b)?null:a.get$tgt(b);if(null!==b&&!b.length)throw new Sk.builtin.ValueError("empty separator");a=a.v;var d=0;if(null===b){var e=/[\s\xa0]+/g;
d=a.length;a=a.replace(u,"");d-=a.length}else e=b.replace(p,"\\$1"),e=new RegExp(e,"g");const f=[];let g=0,k=0,h;for(c=0>c?Infinity:c;null!=(h=e.exec(a))&&k<c&&h.index!==e.lastIndex;)f.push(g+d),f.push(h.index+d),g=e.lastIndex,k+=1;if(null!==b||a.length-g)f.push(g+d),f.push(a.length+d);return f}function b(b,c){return function(d){if(void 0===d||Sk.builtin.checkNone(d))d=b;else if(d instanceof Sk.builtin.str)d=a(d.v),d=new RegExp(c(d),"g");else throw new Sk.builtin.TypeError("strip arg must be None or str");
return new Sk.builtin.str(this.v.replace(d,""))}}function e(a){return function(b){b=this.get$tgt(b);const c=this.v;let d;if(a){if(d=c.lastIndexOf(b),0>d)return new Sk.builtin.tuple([new Sk.builtin.str(""),new Sk.builtin.str(""),new Sk.builtin.str(c)])}else if(d=c.indexOf(b),0>d)return new Sk.builtin.tuple([new Sk.builtin.str(c),new Sk.builtin.str(""),new Sk.builtin.str("")]);return new Sk.builtin.tuple([new Sk.builtin.str(c.substring(0,d)),new Sk.builtin.str(b),new Sk.builtin.str(c.substring(d+b.length))])}}
function f(a,b){return function(c,d){c=Sk.misceval.asIndexSized(c,Sk.builtin.OverflowError);if(void 0===d)d=" ";else if(d instanceof Sk.builtin.str&&1===d.sq$length())d=d.v;else throw new Sk.builtin.TypeError("the fill character must be a str of length 1");const e=this.sq$length();let f;if(e>=c)return new Sk.builtin.str(this.v);if(b)return f=d.repeat(Math.floor((c-e)/2)),f=f+this.v+f,(c-e)%2&&(f+=d),new Sk.builtin.str(f);f=d.repeat(c-e);return new Sk.builtin.str(a?f+this.v:this.v+f)}}function l(a,
b,c){({start:b,end:c}=Sk.builtin.slice.startEnd$wrt(a,b,c));if(a.$hasAstralCodePoints()){const d=a.codepoints[b];b=void 0===d?b+a.v.length-a.codepoints.length:d;c=a.codepoints[c];c=void 0===c?a.v.length:c}return{start:b,end:c}}function h(a){return function(b,c,d){b=this.get$tgt(b);({start:c,end:d}=l(this,c,d));if(d<c)return-1;d-=b.length;b=a?this.v.lastIndexOf(b,d):this.v.indexOf(b,c);b=b>=c&&b<=d?b:-1;if(this.codepoints){d=this.sq$length();c=-1;for(let a=0;a<d;a++)b==this.codepoints[a]&&(c=a)}else c=
b;return c}}function d(a,b){return function(c,d,e){if(!(c instanceof Sk.builtin.str||c instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError(a+" first arg must be str or a tuple of str, not "+Sk.abstr.typeName(c));({start:d,end:e}=l(this,d,e));if(d>e)return Sk.builtin.bool.false$;d=this.v.slice(d,e);if(c instanceof Sk.builtin.tuple){for(let e=Sk.abstr.iter(c),f=e.tp$iternext();void 0!==f;f=e.tp$iternext()){if(!(f instanceof Sk.builtin.str))throw new Sk.builtin.TypeError("tuple for "+a+" must only contain str, not "+
Sk.abstr.typeName(f));if(b(d,f.v))return Sk.builtin.bool.true$}return Sk.builtin.bool.false$}return new Sk.builtin.bool(b(d,c.v))}}var g=/^[0-9!#_]/,n=Object.create(null);Sk.builtin.str=Sk.abstr.buildNativeClass("str",{constructor:function(a){Sk.asserts.assert(this instanceof Sk.builtin.str,"bad call to str - use 'new'");if("string"!==typeof a)if(void 0===a)a="";else if(null===a)a="None";else{if(void 0!==a.tp$str)return a.tp$str();if("number"===typeof a)a=Number.isFinite(a)?String(a):String(a).replace("Infinity",
"inf").replace("NaN","nan");else throw new Sk.builtin.TypeError("could not convert object of type '"+Sk.abstr.typeName(a)+"' to str");}var b=n[a];if(void 0!==b)return b;n[a]=this;b=void 0===t[a]?a:a+"_$rw$";this.$mangled=b;this.$savedKeyHash=a.replace(g,"!$&");this.v=a},slots:{tp$getattr:Sk.generic.getAttr,tp$as_sequence_or_mapping:!0,tp$doc:"str(object='') -> str\nstr(bytes_or_buffer[, encoding[, errors]]) -> str\n\nCreate a new string object from the given object. If encoding or\nerrors is specified, then the object must expose a data buffer\nthat will be decoded using the given encoding and error handler.\nOtherwise, returns the result of object.__str__() (if defined)\nor repr(object).\nencoding defaults to sys.getdefaultencoding().\nerrors defaults to 'strict'.",
tp$new(a,b){b=b||[];if(this!==Sk.builtin.str.prototype)return this.$subtype_new(a,b);if(1>=a.length&&!b.length)return new Sk.builtin.str(a[0]);if(Sk.__future__.python3){const [c,d,e]=Sk.abstr.copyKeywordsToNamedArgs("str",["object","encoding","errors"],a,b);if(void 0===c||void 0===d&&void 0===e)return new Sk.builtin.str(c);Sk.builtin.bytes.check$encodeArgs("str",d,e);if(!Sk.builtin.checkBytes(c))throw new Sk.builtin.TypeError("decoding to str: need a bytes-like object, "+Sk.abstr.typeName(c)+" found");
return Sk.builtin.bytes.$decode.call(c,d,e)}throw new Sk.builtin.TypeError("str takes at most one argument ("+(a.length+b.length)+" given)");},$r(){let a="'";-1!==this.v.indexOf("'")&&-1===this.v.indexOf('"')&&(a='"');const b=this.v.length;let c=a;for(let f=0;f<b;f++){var d=this.v.charAt(f);var e=this.v.charCodeAt(f);d===a||"\\"===d?c+="\\"+d:"\t"===d?c+="\\t":"\n"===d?c+="\\n":"\r"===d?c+="\\r":(255<e&&55296>e||57344<=e)&&!Sk.__future__.python3?c+="\\u"+("000"+e.toString(16)).slice(-4):55296<=e&&
!Sk.__future__.python3?(d=this.v.codePointAt(f),f++,d=d.toString(16),e="0000000"+d.toString(16),c=4<d.length?c+("\\U"+e.slice(-8)):c+("\\u"+e.slice(-4))):255<e&&!Sk.__future__.python3?c+="\\ufffd":" ">d||127<=e&&!Sk.__future__.python3?(d=d.charCodeAt(0).toString(16),2>d.length&&(d="0"+d),c+="\\x"+d):c+=d}return new Sk.builtin.str(c+a)},tp$str(){return this.constructor===Sk.builtin.str?this:new Sk.builtin.str(this.v)},tp$iter(){return new A(this)},tp$richcompare(a,b){if(!(a instanceof Sk.builtin.str))return Sk.builtin.NotImplemented.NotImplemented$;
switch(b){case "Lt":return this.v<a.v;case "LtE":return this.v<=a.v;case "Eq":return this.v===a.v;case "NotEq":return this.v!==a.v;case "Gt":return this.v>a.v;case "GtE":return this.v>=a.v}},mp$subscript(a){let b;if(Sk.misceval.isIndex(a)){a=Sk.misceval.asIndexSized(a,Sk.builtin.OverflowError);b=this.sq$length();0>a&&(a+=b);if(0>a||a>=b)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 c="";b=this.sq$length();this.codepoints?a.sssiter$(b,a=>{c+=this.v.substring(this.codepoints[a],this.codepoints[a+1])}):a.sssiter$(b,a=>{c+=this.v.charAt(a)});return new Sk.builtin.str(c)}throw new Sk.builtin.TypeError("string indices must be integers, not "+Sk.abstr.typeName(a));},sq$length(){return this.$hasAstralCodePoints()?this.codepoints.length:this.v.length},sq$concat(a){if(!(a instanceof Sk.builtin.str))throw new Sk.builtin.TypeError("cannot concatenate 'str' and '"+
Sk.abstr.typeName(a)+"' objects");return new Sk.builtin.str(this.v+a.v)},sq$repeat(a){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.asIndexSized(a,Sk.builtin.OverflowError);if(a*this.v.length>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.OverflowError;let b="";for(let c=0;c<a;c++)b+=this.v;return new Sk.builtin.str(b)},sq$contains(a){if(!(a instanceof Sk.builtin.str))throw new Sk.builtin.TypeError("'in <string>' requires string as left operand not "+
Sk.abstr.typeName(a));return-1!==this.v.indexOf(a.v)},tp$as_number:!0,nb$remainder:function(a){var b;const c=this.sk$builtinBase;a.constructor===Sk.builtin.tuple||a instanceof Sk.builtin.dict||a instanceof Sk.builtin.mappingproxy||(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(e,f,g,k,h,l,p){var n,B,A,v,L;k=Sk.builtin.asnum$(k);h=Sk.builtin.asnum$(h);void 0!==f&&""!==f||"%"==p||(n=
d++);""===h&&(h=void 0);var t=B=A=v=L=!1;g&&(-1!==g.indexOf("-")?v=!0:-1!==g.indexOf("0")&&(L=!0),-1!==g.indexOf("+")?B=!0:-1!==g.indexOf(" ")&&(A=!0),t=-1!==g.indexOf("#"));h&&(h=parseInt(h.substr(1),10));g=function(a,b){var c;b=Sk.builtin.asnum$(b);var d=!1;if("number"===typeof a){0>a&&(a=-a,d=!0);var e=a.toString(b)}else a instanceof Sk.builtin.float_?(e=a.str$(b,!1),2<e.length&&".0"===e.substr(-2)&&(e=e.substr(0,e.length-2)),d=a.nb$isnegative()):a instanceof Sk.builtin.int_?(e=a.str$(b,!1),d=
a.nb$isnegative()):a instanceof Sk.builtin.lng&&(e=a.str$(b,!1),d=a.nb$isnegative());Sk.asserts.assert(void 0!==e,"unhandled number format");a=!1;if(h)for(c=e.length;c<h;++c)e="0"+e,a=!0;c="";d?c="-":B?c="+"+c:A&&(c=" "+c);t&&(16===b?c+="0x":8!==b||a||"0"===e||(c+="0"));return[c,e]};e=function(a){var b=a[0];a=a[1];if(k){k=parseInt(k,10);var c=a.length+b.length;if(L)for(;c<k;++c)a="0"+a;else if(v){for(;c<k;++c)a+=" ";Sk.__future__.python3&&(a+=b,b="")}else for(;c<k;++c)b=" "+b}return b+a};if(a.constructor===
Sk.builtin.tuple)f=a.v[n];else if(void 0!==a.mp$subscript&&void 0!==f)f=f.substring(1,f.length-1),f=a.mp$subscript(new c(f));else if(a.constructor===Sk.builtin.dict||a.constructor===Sk.builtin.list)f=a;else throw new Sk.builtin.AttributeError(a.tp$name+" instance has no attribute 'mp$subscript'");if("d"===p||"i"===p){var u=g(f,10);if(void 0===u[1])throw new Sk.builtin.TypeError("%"+p+" format: a number is required, not "+Sk.abstr.typeName(f));p=u[1];u[1]=-1!==p.indexOf(".")?parseInt(p,10).toString():
p;return e(u)}if("o"===p)return e(g(f,8));if("x"===p)return e(g(f,16));if("X"===p)return e(g(f,16)).toUpperCase();if("f"===p||"F"===p||"e"===p||"E"===p||"g"===p||"G"===p){u=Sk.builtin.asnum$(f);"string"===typeof u&&(u=Number(u));if(Infinity===u)return"inf";if(-Infinity===u)return"-inf";if(isNaN(u))return"nan";n=["toExponential","toFixed","toPrecision"]["efg".indexOf(p.toLowerCase())];if(void 0===h||""===h)if("e"===p||"E"===p)h=6;else if("f"===p||"F"===p)h=Sk.__future__.python3?6:7;n=u[n](h);Sk.builtin.checkFloat(f)&&
0===u&&-Infinity===1/u&&(n="-"+n);Sk.__future__.python3&&(7<=n.length&&"0.0000"==n.slice(0,6)&&(b=parseFloat(n),n=b.toExponential()),"-"==n.charAt(n.length-2)&&(n=n.slice(0,n.length-1)+"0"+n.charAt(n.length-1)));-1!=="EFG".indexOf(p)&&(n=n.toUpperCase());return e(["",n])}if("c"===p){if("number"===typeof f)return String.fromCharCode(f);if(f instanceof Sk.builtin.int_||f instanceof Sk.builtin.float_)return String.fromCharCode(f.v);if(f instanceof Sk.builtin.lng)return String.fromCharCode(f.str$(10,
!1)[0]);if(f.constructor===Sk.builtin.str)return f.v.substr(0,1);throw new Sk.builtin.TypeError("an integer is required");}if("r"===p)return p=Sk.builtin.repr(f),h?p.v.substr(0,h):p.v;if("s"===p&&c===Sk.builtin.str){p=new Sk.builtin.str(f);p=p.$jsstr();if(h)return p.substr(0,h);k&&(p=e([" ",p]));return p}if("b"===p||"s"===p){if(c===Sk.builtin.str)throw new Sk.builtin.ValueError("unsupported format character 'b'");if(!(f instanceof Sk.builtin.bytes)&&void 0===(u=Sk.abstr.lookupSpecial(f,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(f)+"'");void 0!==u&&(f=new Sk.builtin.bytes(f));p=f.$jsstr();if(h)return p.substr(0,h);k&&(p=e([" ",p]));return p}if("%"===p)return"%"});return new c(e)}},proto:{toString(){return this.v},$subtype_new(a,b){const c=new this.constructor;a=Sk.builtin.str.prototype.tp$new(a,b);c.$mangled=a.$mangled;c.$savedKeyHash=a.$savedKeyHash;c.v=a.v;return c},$jsstr(){return this.v},$hasAstralCodePoints(){if(null===this.codepoints)return!1;if(void 0!==this.codepoints)return!0;for(var a=0;a<this.v.length;a++){let b=
this.v.charCodeAt(a);if(55296<=b&&57344>b){this.codepoints=[];for(a=0;a<this.v.length;a++)this.codepoints.push(a),b=this.v.charCodeAt(a),55296<=b&&56320>b&&a++;return!0}}this.codepoints=null;return!1},sk$asarray(){const a=[];if(this.$hasAstralCodePoints()){var b=this.codepoints;for(let c=0;c<b.length;c++)a.push(new Sk.builtin.str(this.v.substring(b[c],b[c+1])))}else for(b=0;b<this.v.length;b++)a.push(new Sk.builtin.str(this.v[b]));return a},find$left:h(!1),find$right:h(!0),get$tgt(a){if(a instanceof
Sk.builtin.str)return a.v;throw new Sk.builtin.TypeError("a str instance is required not '"+Sk.abstr.typeName(a)+"'");}},methods:{encode:{$meth:function(a,b){({encoding:a,errors:b}=Sk.builtin.bytes.check$encodeArgs("encode",a,b));a=Sk.builtin.bytes.str$encode(this,a,b);return Sk.__future__.python3?a:new Sk.builtin.str(a.$jsstr())},$flags:{NamedArgs:["encoding","errors"]},$textsig:"($self, /, encoding='utf-8', errors='strict')",$doc:"Encode the string using the codec registered for encoding.\n\n  encoding\n    The encoding in which to encode the string.\n  errors\n    The error handling scheme to use for encoding errors.\n    The default is 'strict' meaning that encoding errors raise a\n    UnicodeEncodeError.  Other possible values are 'ignore', 'replace' and\n    'xmlcharrefreplace' as well as any other name registered with\n    codecs.register_error that can handle UnicodeEncodeErrors."},
replace:{$meth(b,c,d){b=this.get$tgt(b);c=this.get$tgt(c);d=void 0===d?-1:Sk.misceval.asIndexSized(d,Sk.builtin.OverflowError);b=new RegExp(a(b),"g");if(0>d)return new Sk.builtin.str(this.v.replace(b,c));let e=0;b=this.v.replace(b,a=>e++<d?c:a);return new Sk.builtin.str(b)},$flags:{MinArgs:2,MaxArgs:3},$textsig:"($self, old, new, count=-1, /)",$doc:"Return a copy with all occurrences of substring old replaced by new.\n\n  count\n    Maximum number of occurrences to replace.\n    -1 (the default value) means replace all occurrences.\n\nIf the optional argument count is given, only the first count occurrences are\nreplaced."},
split:{$meth:function(a,b){b=Sk.misceval.asIndexSized(b,Sk.builtin.OverflowError);a=c(this,a,b);b=[];for(let c=0;c<a.length;c++)b.push(new Sk.builtin.str(this.v.substring(a[c],a[++c])));return new Sk.builtin.list(b)},$flags:{NamedArgs:["sep","maxsplit"],Defaults:[Sk.builtin.none.none$,-1]},$textsig:"($self, /, sep=None, maxsplit=-1)",$doc:"Return a list of the words in the string, using sep as the delimiter string.\n\n  sep\n    The delimiter according which to split the string.\n    None (the default value) means split according to any whitespace,\n    and discard empty strings from the result.\n  maxsplit\n    Maximum number of splits to do.\n    -1 (the default value) means no limit."},
rsplit:{$meth:function(a,b){b=Sk.misceval.asIndexSized(b,Sk.builtin.OverflowError);a=c(this,a,-1);var d=0>b?0:2*(a.length/2-b);b=[];for(0>=d?d=0:b.push(new Sk.builtin.str(this.v.slice(0,a[d-1])));d<a.length;d++)b.push(new Sk.builtin.str(this.v.substring(a[d],a[++d])));return new Sk.builtin.list(b)},$flags:{NamedArgs:["sep","maxsplit"],Defaults:[Sk.builtin.none.none$,-1]},$textsig:"($self, /, sep=None, maxsplit=-1)",$doc:"Return a list of the words in the string, using sep as the delimiter string.\n\n  sep\n    The delimiter according which to split the string.\n    None (the default value) means split according to any whitespace,\n    and discard empty strings from the result.\n  maxsplit\n    Maximum number of splits to do.\n    -1 (the default value) means no limit.\n\nSplits are done starting at the end of the string and working to the front."},
join:{$meth(a){const b=[];return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(a),a=>{if(!(a instanceof Sk.builtin.str))throw new Sk.builtin.TypeError("sequence item "+b.length+": expected str, "+Sk.abstr.typeName(a)+" found");b.push(a.v)}),()=>new Sk.builtin.str(b.join(this.v)))},$flags:{OneArg:!0},$textsig:"($self, iterable, /)",$doc:"Concatenate any number of strings.\n\nThe string whose method is called is inserted in between each given string.\nThe result is returned as a new string.\n\nExample: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'"},
capitalize:{$meth:function(){return new Sk.builtin.str(this.v.charAt(0).toUpperCase()+this.v.slice(1).toLowerCase())},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return a capitalized version of the string.\n\nMore specifically, make the first character have upper case and the rest lower\ncase."},title:{$meth:function(){const a=this.v.replace(/[a-z][a-z]*/gi,a=>a[0].toUpperCase()+a.substr(1).toLowerCase());return new Sk.builtin.str(a)},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return a version of the string where each word is titlecased.\n\nMore specifically, words start with uppercased characters and all remaining\ncased characters have lower case."},
center:{$meth:f(!1,!0),$flags:{MinArgs:1,MaxArgs:2},$textsig:"($self, width, fillchar=' ', /)",$doc:"Return a centered string of length width.\n\nPadding is done using the specified fill character (default is a space)."},count:{$meth:function(a,b,c){a=this.get$tgt(a);({start:b,end:c}=l(this,b,c));if(c<b)return new Sk.builtin.int_(0);a=a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");a=new RegExp(a,"g");return(b=this.v.slice(b,c).match(a))?new Sk.builtin.int_(b.length):new Sk.builtin.int_(0)},$flags:{MinArgs:1,
MaxArgs:3},$textsig:null,$doc:"S.count(sub[, start[, end]]) -> int\n\nReturn the number of non-overlapping occurrences of substring sub in\nstring S[start:end].  Optional arguments start and end are\ninterpreted as in slice notation."},expandtabs:{$meth:function(a){if(Sk.builtin.checkInt(a))a=Sk.builtin.asnum$(a);else throw new Sk.builtin.TypeError("an integer is required, got type"+Sk.abstr.typeName(a));const b=Array(a+1).join(" "),c=this.v.replace(/([^\r\n\t]*)\t/g,(c,d)=>d+b.slice(d.length%a));
return new Sk.builtin.str(c)},$flags:{NamedArgs:["tabsize"],Defaults:[8]},$textsig:"($self, /, tabsize=8)",$doc:"Return a copy where all tab characters are expanded using spaces.\n\nIf tabsize is not given, a tab size of 8 characters is assumed."},find:{$meth:function(a,b,c){return new Sk.builtin.int_(this.find$left(a,b,c))},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"S.find(sub[, start[, end]]) -> int\n\nReturn the lowest index in S where substring sub is found,\nsuch that sub is contained within S[start:end].  Optional\narguments start and end are interpreted as in slice notation.\n\nReturn -1 on failure."},
partition:{$meth:e(!1),$flags:{OneArg:!0},$textsig:"($self, sep, /)",$doc:"Partition the string into three parts using the given separator.\n\nThis will search for the separator in the string.  If the separator is found,\nreturns a 3-tuple containing the part before the separator, the separator\nitself, and the part after it.\n\nIf the separator is not found, returns a 3-tuple containing the original string\nand two empty strings."},index:{$meth:function(a,b,c){a=this.find$left(a,b,c);if(-1===a)throw new Sk.builtin.ValueError("substring not found");
return new Sk.builtin.int_(a)},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"S.index(sub[, start[, end]]) -> int\n\nReturn the lowest index in S where substring sub is found, \nsuch that sub is contained within S[start:end].  Optional\narguments start and end are interpreted as in slice notation.\n\nRaises ValueError when the substring is not found."},ljust:{$meth:f(!1,!1),$flags:{MinArgs:1,MaxArgs:2},$textsig:"($self, width, fillchar=' ', /)",$doc:"Return a left-justified string of length width.\n\nPadding is done using the specified fill character (default is a space)."},
lower:{$meth(){return new Sk.builtin.str(this.v.toLowerCase())},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return a copy of the string converted to lowercase."},lstrip:{$meth:b(/^\s+/g,a=>"^["+a+"]+"),$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, chars=None, /)",$doc:"Return a copy of the string with leading whitespace removed.\n\nIf chars is given and not None, remove characters in chars instead."},rfind:{$meth(a,b,c){return new Sk.builtin.int_(this.find$right(a,b,c))},$flags:{MinArgs:1,MaxArgs:3},
$textsig:null,$doc:"S.rfind(sub[, start[, end]]) -> int\n\nReturn the highest index in S where substring sub is found,\nsuch that sub is contained within S[start:end].  Optional\narguments start and end are interpreted as in slice notation.\n\nReturn -1 on failure."},rindex:{$meth:function(a,b,c){a=this.find$right(a,b,c);if(-1===a)throw new Sk.builtin.ValueError("substring not found");return new Sk.builtin.int_(a)},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"S.rindex(sub[, start[, end]]) -> int\n\nReturn the highest index in S where substring sub is found,\nsuch that sub is contained within S[start:end].  Optional\narguments start and end are interpreted as in slice notation.\n\nRaises ValueError when the substring is not found."},
rjust:{$meth:f(!0,!1),$flags:{MinArgs:1,MaxArgs:2},$textsig:"($self, width, fillchar=' ', /)",$doc:"Return a right-justified string of length width.\n\nPadding is done using the specified fill character (default is a space)."},rstrip:{$meth:b(/\s+$/g,a=>"["+a+"]+$"),$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, chars=None, /)",$doc:"Return a copy of the string with trailing whitespace removed.\n\nIf chars is given and not None, remove characters in chars instead."},rpartition:{$meth:e(!0),$flags:{OneArg:!0},
$textsig:"($self, sep, /)",$doc:"Partition the string into three parts using the given separator.\n\nThis will search for the separator in the string, starting at the end. If\nthe separator is found, returns a 3-tuple containing the part before the\nseparator, the separator itself, and the part after it.\n\nIf the separator is not found, returns a 3-tuple containing two empty strings\nand the original string."},splitlines:{$meth:function(a){a=Sk.misceval.isTrue(a);const b=this.v,c=[],d=b.length;var e=
0;for(let g=0;g<d;g++){var f=b.charAt(g);if("\n"===b.charAt(g+1)&&"\r"===f)f=g+2,e=b.slice(e,f),a||(e=e.replace(/(\r|\n)/g,"")),c.push(new Sk.builtin.str(e)),e=f;else if("\n"===f&&"\r"!==b.charAt(g-1)||"\r"===f)f=g+1,e=b.slice(e,f),a||(e=e.replace(/(\r|\n)/g,"")),c.push(new Sk.builtin.str(e)),e=f}e<d&&(e=b.slice(e,d),a||(e=e.replace(/(\r|\n)/g,"")),c.push(new Sk.builtin.str(e)));return new Sk.builtin.list(c)},$flags:{NamedArgs:["keepends"],Defaults:[!1]},$textsig:"($self, /, keepends=False)",$doc:"Return a list of the lines in the string, breaking at line boundaries.\n\nLine breaks are not included in the resulting list unless keepends is given and\ntrue."},
strip:{$meth:b(/^\s+|\s+$/g,a=>"^["+a+"]+|["+a+"]+$"),$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, chars=None, /)",$doc:"Return a copy of the string with leading and trailing whitespace remove.\n\nIf chars is given and not None, remove characters in chars instead."},swapcase:{$meth(){const a=this.v.replace(/[a-z]/gi,a=>{const b=a.toLowerCase();return b===a?a.toUpperCase():b});return new Sk.builtin.str(a)},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Convert uppercase characters to lowercase and lowercase characters to uppercase."},
upper:{$meth(){return new Sk.builtin.str(this.v.toUpperCase())},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return a copy of the string converted to uppercase."},startswith:{$meth:d("startswith",(a,b)=>0===a.indexOf(b)),$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"S.startswith(prefix[, start[, end]]) -> bool\n\nReturn True if S starts with the specified prefix, False otherwise.\nWith optional start, test S beginning at that position.\nWith optional end, stop comparing S at that position.\nprefix can also be a tuple of strings to try."},
endswith:{$meth:d("endswith",(a,b)=>-1!==a.indexOf(b,a.length-b.length)),$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"S.endswith(suffix[, start[, end]]) -> bool\n\nReturn True if S ends with the specified suffix, False otherwise.\nWith optional start, test S beginning at that position.\nWith optional end, stop comparing S at that position.\nsuffix can also be a tuple of strings to try."},isascii:{$meth(){return new Sk.builtin.bool(/^[\x00-\x7F]*$/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",
$doc:"Return True if all characters in the string are ASCII, False otherwise.\n\nASCII characters have code points in the range U+0000-U+007F.\nEmpty string is ASCII too."},islower:{$meth:function(){return new Sk.builtin.bool(this.v.length&&/[a-z]/.test(this.v)&&!/[A-Z]/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is a lowercase string, False otherwise.\n\nA string is lowercase if all cased characters in the string are lowercase and\nthere is at least one cased character in the string."},
isupper:{$meth:function(){return new Sk.builtin.bool(this.v.length&&!/[a-z]/.test(this.v)&&/[A-Z]/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is an uppercase string, False otherwise.\n\nA string is uppercase if all cased characters in the string are uppercase and\nthere is at least one cased character in the string."},istitle:{$meth:function(){const a=this.v;let b=!1,c=!1,d;for(let e=0;e<a.length;e++)if(d=a.charAt(e),!/[a-z]/.test(d)&&/[A-Z]/.test(d)){if(c)return Sk.builtin.bool.false$;
b=c=!0}else if(/[a-z]/.test(d)&&!/[A-Z]/.test(d)){if(!c)return Sk.builtin.bool.false$;b=!0}else c=!1;return new Sk.builtin.bool(b)},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is a title-cased string, False otherwise.\n\nIn a title-cased string, upper- and title-case characters may only\nfollow uncased characters and lowercase characters only cased ones."},isspace:{$meth:function(){return new Sk.builtin.bool(/^\s+$/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",
$doc:"Return True if the string is a whitespace string, False otherwise.\n\nA string is whitespace if all characters in the string are whitespace and there\nis at least one character in the string."},isdigit:{$meth:function(){return new Sk.builtin.bool(/^\d+$/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is a digit string, False otherwise.\n\nA string is a digit string if all characters in the string are digits and there\nis at least one character in the string."},
isnumeric:{$meth:function(){return new Sk.builtin.bool(this.v.length&&!/[^0-9]/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is a numeric string, False otherwise.\n\nA string is numeric if all characters in the string are numeric and there is at\nleast one character in the string."},isalpha:{$meth:function(){return new Sk.builtin.bool(this.v.length&&!/[^a-zA-Z]/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is an alphabetic string, False otherwise.\n\nA string is alphabetic if all characters in the string are alphabetic and there\nis at least one character in the string."},
isalnum:{$meth:function(){return new Sk.builtin.bool(this.v.length&&!/[^a-zA-Z0-9]/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is an alpha-numeric string, False otherwise.\n\nA string is alpha-numeric if all characters in the string are alpha-numeric and\nthere is at least one character in the string."},zfill:{$meth:function(a){a=Sk.misceval.asIndexSized(a,Sk.builtin.OverflowError);let b="";a-=this.v.length;const c="+"===this.v[0]||"-"===this.v[0]?1:0;
for(let c=0;c<a;c++)b+="0";return new Sk.builtin.str(this.v.substr(0,c)+b+this.v.substr(c))},$flags:{OneArg:!0},$textsig:"($self, width, /)",$doc:"Pad a numeric string with zeros on the left, to fill a field of the given width.\n\nThe string is never truncated."},format:{$meth:Sk.formatting.format,$flags:{FastCall:!0},$textsig:null,$doc:"S.format(*args, **kwargs) -> str\n\nReturn a formatted version of S, using substitutions from args and kwargs.\nThe substitutions are identified by braces ('{' and '}')."},
__format__:{$meth:Sk.formatting.formatString,$flags:{OneArg:!0},$textsig:"($self, format_spec, /)",$doc:"Return a formatted version of the string as described by format_spec."},__getnewargs__:{$meth(){return new Sk.builtin.tuple(new Sk.builtin.str(this.v))},$flags:{NoArgs:!0},$textsig:null,$doc:null}}});Sk.exportSymbol("Sk.builtin.str",Sk.builtin.str);var k=/^[A-Za-z0-9]+$/,p=/([.*+?=|\\\/()\[\]\{\}^$])/g,u=/^[\s\xa0]+/;Sk.builtin.str.$py2decode=new Sk.builtin.method_descriptor(Sk.builtin.str,{$name:"decode",
$meth(a,b){const c=new Sk.builtin.bytes(this.v);return Sk.builtin.bytes.$decode.call(c,a,b)},$flags:{NamedArgs:["encoding","errors"]}});var A=Sk.abstr.buildIteratorClass("str_iterator",{constructor:function(a){this.$index=0;a.$hasAstralCodePoints()?(this.$seq=a.codepoints,this.tp$iternext=()=>{const b=this.$seq[this.$index];if(void 0!==b)return new Sk.builtin.str(a.v.substring(b,this.$seq[++this.$index]))}):(this.$seq=a.v,this.tp$iternext=()=>{const a=this.$seq[this.$index++];if(void 0!==a)return new Sk.builtin.str(a)})},
iternext(){return this.tp$iternext()},methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},flags:{sk$acceptable_as_base_class:!1}}),t={abstract:!0,as:!0,boolean:!0,break:!0,byte:!0,case:!0,catch:!0,char:!0,class:!0,continue:!0,const:!0,debugger:!0,default:!0,delete:!0,do:!0,double:!0,else:!0,enum:!0,export:!0,extends:!0,false:!0,final:!0,finally:!0,float:!0,for:!0,function:!0,goto:!0,if:!0,implements:!0,import:!0,in:!0,instanceof:!0,int:!0,interface:!0,is:!0,long:!0,namespace:!0,
native:!0,new:!0,null:!0,package:!0,private:!0,protected:!0,public:!0,return:!0,short:!0,static:!0,super:!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,constructor:!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_=t},function(m,q){Sk.builtin.func=Sk.abstr.buildNativeClass("function",{constructor:function(a,c,b,e){Sk.asserts.assert(this instanceof Sk.builtin.func,"builtin func should be called as a class with `new`");this.func_code=a;this.func_globals=c||null;this.$name=a.co_name&&a.co_name.v||a.name||"<native JS>";this.$d=Sk.builtin.dict?new Sk.builtin.dict:void 0;this.$doc=a.$doc;this.$module=Sk.globals&&Sk.globals.__name__||
Sk.builtin.none.none$;this.$qualname=a.co_qualname&&a.co_qualname.v||this.$name;if(void 0!==e)for(let a in e)b[a]=e[a];this.func_closure=b;this.$memoiseFlags();this.memoised=a.co_fastcall||null;this.tp$call=a.co_fastcall?a.bind(this):Sk.builtin.func.prototype.tp$call.bind(this)},slots:{tp$getattr:Sk.generic.getAttr,tp$descr_get(a,c){return null===a?this:new Sk.builtin.method(this,a)},$r(){return new Sk.builtin.str("<function "+this.$qualname+">")},tp$call(a,c){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(c&&0!==c.length)throw new Sk.builtin.TypeError(this.$name+"() takes no keyword arguments");return this.func_code.apply(this.func_globals,a)}a=this.$resolveArgs(a,c);this.func_closure&&a.push(this.func_closure);return this.func_code.apply(this.func_globals,a)}},getsets:{__name__:{$get(){return new Sk.builtin.str(this.$name)},$set(a){if(!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError("__name__ must be set to a string object");
this.$name=a.$jsstr()}},__qualname__:{$get(){return new Sk.builtin.str(this.$qualname)},$set(a){if(!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError("__qualname__ must be set to a string object");this.$qualname=a.$jsstr()}},__dict__:Sk.generic.getSetDict,__defaults__:{$get(){return new Sk.builtin.tuple(this.$defaults)}},__doc__:{$get(){return new Sk.builtin.str(this.$doc)}}},proto:{$memoiseFlags(){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_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||[]},$resolveArgs:function(a,c){var b=this.co_argcount;void 0===b&&(b=this.co_varnames?this.co_varnames.length:a.length);var e=this.co_varnames||[],f=this.co_kwonlyargcount||0;let l=b+
f;if(!(0!==f||this.co_kwargs||c&&0!==c.length||this.co_varargs)){if(a.length==b)return a;if(0===a.length&&this.$defaults&&this.$defaults.length===b){for(e=0;e!=this.$defaults.length;e++)a[e]=this.$defaults[e];return a}}let h;this.co_kwargs&&(h=[]);var d=a.length;let g=a.length<=b?a:a.slice(0,b);if(this.co_varargs)a=a.length>g.length?a.slice(g.length):[],g[l]=new Sk.builtin.tuple(a);else if(d>b)throw new Sk.builtin.TypeError(this.$name+"() takes "+b+" positional argument"+(1==b?"":"s")+" but "+d+(1==
d?" was ":" were ")+" given");if(c){if(this.func_code.no_kw)throw new Sk.builtin.TypeError(this.$name+"() takes no keyword arguments");for(a=0;a<c.length;a+=2){d=c[a];var n=c[a+1],k=e.indexOf(d);if(0<=k){if(void 0!==g[k])throw new Sk.builtin.TypeError(this.$name+"() got multiple values for argument '"+d+"'");g[k]=n}else if(h)h.push(new Sk.builtin.str(d),n);else throw new Sk.builtin.TypeError(this.$name+"() got an unexpected keyword argument '"+d+"'");}}c=this.$defaults||[];a=0;d=[];n=!1;for(k=b-c.length;a<
k;a++)void 0===g[a]&&(d.push(e[a]),void 0===e[a]&&(n=!0));if(0!=d.length&&(this.co_argcount||this.co_varnames))throw new Sk.builtin.TypeError(this.$name+"() missing "+d.length+" required argument"+(1==d.length?"":"s")+(n?"":": "+d.join(", ")));for(;a<b;a++)void 0===g[a]&&(g[a]=c[a-k]);if(0<f){f=[];c=this.$kwdefs;for(a=b;a<l;a++)void 0===g[a]&&(void 0!==c[a-b]?g[a]=c[a-b]:f.push(e[a]));if(0!==f.length)throw new Sk.builtin.TypeError(this.$name+"() missing "+f.length+" required keyword argument"+(1==
f.length?"":"s")+": "+f.join(", "));}if(this.func_closure&&e)for(b=g.length;b<e.length;b++)g.push(void 0);h&&g.unshift(h);return g}}})},function(m,q){Sk.builtin.asnum$=function(a){return void 0===a||null===a||"number"===typeof a?a:a instanceof Sk.builtin.int_?"number"===typeof a.v?a.v:a.v.toString():a instanceof Sk.builtin.float_?a.v:a===Sk.builtin.none.none$?null: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("number"===typeof a)a=a.toString();else if(a instanceof Sk.builtin.int_)a=a.v.toString();else if(a instanceof Sk.builtin.float_)a=a.v.toString();else{if(a===Sk.builtin.none.none$)return null;return}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,c){if(void 0===a)throw new Sk.builtin.TypeError("a float is required");if(!Sk.__future__.dunder_round){if(!Sk.builtin.checkNumber(a))throw new Sk.builtin.TypeError("a float is required");
if(a.round$)return a.round$(c);throw new Sk.builtin.AttributeError(Sk.abstr.typeName(a)+" instance has no attribute '__float__'");}if(void 0!==c&&!Sk.builtin.checkNone(c)&&!Sk.misceval.isIndex(c))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(c)+"' object cannot be interpreted as an index");a=Sk.abstr.lookupSpecial(a,Sk.builtin.str.$round);if(void 0!==a)return void 0!==c?Sk.misceval.callsimArray(a,[c]):Sk.misceval.callsimArray(a,[]);throw new Sk.builtin.TypeError("a float is required");};Sk.builtin.len=
function(a){if(a.sq$length)a=a.sq$length(!0);else throw new Sk.builtin.TypeError("object of type '"+Sk.abstr.typeName(a)+"' has no len()");return Sk.misceval.chain(a,a=>new Sk.builtin.int_(a))};Sk.builtin.min=function(a,c){let b;const e=a.length;if(!e)throw new Sk.builtin.TypeError("min expected 1 argument, got 0");const [h,d]=Sk.abstr.copyKeywordsToNamedArgs("min",["default","key"],[],c,[null,Sk.builtin.none.none$]);if(1<e&&null!==h)throw new Sk.builtin.TypeError("Cannot specify a default for min() with multiple positional arguments");
b=1==e?Sk.abstr.iter(a[0]):Sk.abstr.iter(new Sk.builtin.tuple(a));if(!Sk.builtin.checkNone(d)&&!Sk.builtin.checkCallable(d))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(d)+"' object is not callable");let g;return Sk.misceval.chain(b.tp$iternext(!0),a=>{g=a;if(void 0!==g)return Sk.builtin.checkNone(d)?Sk.misceval.iterFor(b,a=>{Sk.misceval.richCompareBool(a,g,"Lt")&&(g=a)}):Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(d,[g]),a=>Sk.misceval.iterFor(b,b=>Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(d,
[b]),c=>{Sk.misceval.richCompareBool(c,a,"Lt")&&(g=b,a=c)})))},()=>{if(void 0===g){if(null===h)throw new Sk.builtin.ValueError("min() arg is an empty sequence");g=h}return g})};Sk.builtin.max=function(a,c){let b;const e=a.length;if(!e)throw new Sk.builtin.TypeError("max expected 1 argument, got 0");const [h,d]=Sk.abstr.copyKeywordsToNamedArgs("min",["default","key"],[],c,[null,Sk.builtin.none.none$]);if(1<e&&null!==h)throw new Sk.builtin.TypeError("Cannot specify a default for max() with multiple positional arguments");
b=1===e?Sk.abstr.iter(a[0]):Sk.abstr.iter(new Sk.builtin.tuple(a));if(!Sk.builtin.checkNone(d)&&!Sk.builtin.checkCallable(d))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(d)+"' object is not callable");let g;return Sk.misceval.chain(b.tp$iternext(!0),a=>{g=a;if(void 0!==g)return Sk.builtin.checkNone(d)?Sk.misceval.iterFor(b,a=>{Sk.misceval.richCompareBool(a,g,"Gt")&&(g=a)}):Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(d,[g]),a=>Sk.misceval.iterFor(b,b=>Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(d,
[b]),c=>{Sk.misceval.richCompareBool(c,a,"Gt")&&(g=b,a=c)})))},()=>{if(void 0===g){if(null===h)throw new Sk.builtin.ValueError("min() arg is an empty sequence");g=h}return g})};Sk.builtin.min.co_fastcall=Sk.builtin.max.co_fastcall=1;Sk.builtin.any=function(a){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){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,c){function b(){return Sk.misceval.iterFor(d,a=>{if(a.constructor===Sk.builtin.int_)g=g.nb$add(a);else{if(a.constructor===Sk.builtin.float_)return g=g.nb$float().nb$add(a),new Sk.misceval.Break("float");g=Sk.abstr.numberBinOp(g,a,"Add");return new Sk.misceval.Break("slow")}})}function e(){return Sk.misceval.iterFor(d,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 h(){return Sk.misceval.iterFor(d,a=>{g=Sk.abstr.numberBinOp(g,a,"Add")})}const d=Sk.abstr.iter(a);if(void 0===c)var g=new Sk.builtin.int_(0);else{if(Sk.builtin.checkString(c))throw new Sk.builtin.TypeError("sum() can't sum strings [use ''.join(seq) instead]");g=c}a=void 0===c||c.constructor===Sk.builtin.int_?b():c.constructor===Sk.builtin.float_?"float":"slow";return Sk.misceval.chain(a,
a=>"float"===a?e():a,a=>{if("slow"===a)return h()},()=>g)};Sk.builtin.zip=function(){var a,c;if(0===arguments.length)return new Sk.builtin.list([]);var f=[];for(c=0;c<arguments.length;c++)if(Sk.builtin.checkIterable(arguments[c]))f.push(Sk.abstr.iter(arguments[c]));else throw new Sk.builtin.TypeError("argument "+c+" must support iteration");var l=[];for(a=!1;!a;){var h=[];for(c=0;c<arguments.length;c++){var d=f[c].tp$iternext();if(void 0===d){a=!0;break}h.push(d)}a||l.push(new Sk.builtin.tuple(h))}return new Sk.builtin.list(l)};
Sk.builtin.abs=function(a){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){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){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){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(e){if(e instanceof RangeError)throw new Sk.builtin.ValueError(e.message);throw e;}};Sk.builtin.int2str_=function(a,c,f){let b;a.constructor===Sk.builtin.int_||a instanceof Sk.builtin.int_||(a=a.nb$index());b=a.v;let e=b.toString(c);e=a.nb$isnegative()?"-"+f+e.slice(1):f+e;2!==c&&!Sk.__future__.python3&&
(a instanceof Sk.builtin.lng||JSBI.__isBigInt(b))&&(e+="L");return new Sk.builtin.str(e)};Sk.builtin.hex=function(a){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){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){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){if(void 0!==a)return a=Sk.abstr.lookupSpecial(a,Sk.builtin.str.$dir),Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(a,[]),a=>Sk.builtin.sorted(a));throw new Sk.builtin.NotImplementedError("skulpt does not yet support dir with no args");};Sk.builtin.repr=function(a){return a.$r()};Sk.builtin.ascii=
function(a){return Sk.misceval.chain(a.$r(),a=>{let b,c;for(c=0;c<a.v.length;c++)if(127<=a.v.charCodeAt(c)){b=a.v.substr(0,c);break}if(!b)return a;for(;c<a.v.length;c++){var e=a.v.charAt(c),d=a.v.charCodeAt(c);127<d&&255>=d?(e=d.toString(16),2>e.length&&(e="0"+e),b+="\\x"+e):127<d&&55296>d||57344<=d?b+="\\u"+("000"+d.toString(16)).slice(-4):55296<=d?(e=a.v.codePointAt(c),c++,e=e.toString(16),d="0000000"+e.toString(16),b=4<e.length?b+("\\U"+d.slice(-8)):b+("\\u"+d.slice(-4))):b+=e}return new Sk.builtin.str(b)})};
Sk.builtin.open=function(a,c,f){void 0===c&&(c=new Sk.builtin.str("r"));if(/\+/.test(c.v))throw"todo; haven't implemented read/write mode";if(("w"===c.v||"wb"===c.v||"a"===c.v||"ab"===c.v)&&!Sk.nonreadopen)throw"todo; haven't implemented non-read opens";return new Sk.builtin.file(a,c,f)};Sk.builtin.isinstance=function(a,c){if(!(Sk.builtin.checkClass(c)||c instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError("isinstance() arg 2 must be a class, type, or tuple of classes and types");var b=a.ob$type;
if(b===c)return Sk.builtin.bool.true$;if(!(c instanceof Sk.builtin.tuple)){if(b.$isSubType(c))return Sk.builtin.bool.true$;a=a.tp$getattr(Sk.builtin.str.$class);return a!=b&&Sk.builtin.checkClass(a)&&a.$isSubType(c)?Sk.builtin.bool.true$:Sk.builtin.bool.false$}for(b=0;b<c.v.length;++b)if(Sk.misceval.isTrue(Sk.builtin.isinstance(a,c.v[b])))return Sk.builtin.bool.true$;return Sk.builtin.bool.false$};Sk.builtin.hash=function(a){return new Sk.builtin.int_(Sk.abstr.objectHash(a))};Sk.builtin.getattr=function(a,
c,f){if(!Sk.builtin.checkString(c))throw new Sk.builtin.TypeError("attribute name must be string");const b=Sk.misceval.tryCatch(()=>a.tp$getattr(c,!0),a=>{if(!(a instanceof Sk.builtin.AttributeError))throw a;});return Sk.misceval.chain(b,b=>{if(void 0===b){if(void 0!==f)return f;throw new Sk.builtin.AttributeError(a.sk$attrError()+" has no attribute "+Sk.misceval.objectRepr(c));}return b})};Sk.builtin.setattr=function(a,c,f){if(!Sk.builtin.checkString(c))throw new Sk.builtin.TypeError("attribute name must be string");
return Sk.misceval.chain(a.tp$setattr(c,f,!0),()=>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.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(){console.warn("jsmillis is deprecated");return(new Date).valueOf()};Sk.builtin.eval_=function(){throw new Sk.builtin.NotImplementedError("eval is not yet implemented");};Sk.builtin.map=function(a,c){var b=[],e,h;Sk.builtin.pyCheckArgsLen("map",arguments.length,2);if(2<arguments.length){var d=[];var g=Array.prototype.slice.apply(arguments).slice(1);for(h=
0;h<g.length;h++){if(!Sk.builtin.checkIterable(g[h])){var n=parseInt(h,10)+2;throw new Sk.builtin.TypeError("argument "+n+" to map() must support iteration");}g[h]=Sk.abstr.iter(g[h])}for(;;){var k=[];for(h=e=0;h<g.length;h++)n=g[h].tp$iternext(),void 0===n?(k.push(Sk.builtin.none.none$),e++):k.push(n);if(e!==g.length)d.push(k);else break}c=new Sk.builtin.list(d)}if(!Sk.builtin.checkIterable(c))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(c)+"' object is not iterable");return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(c),
function(c){if(a===Sk.builtin.none.none$)c instanceof Array&&(c=new Sk.builtin.tuple(c)),b.push(c);else return c instanceof Array||(c=[c]),Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(a,c),function(a){b.push(a)})}),function(){return new Sk.builtin.list(b)})};Sk.builtin.reduce=function(a,c,f){if(!Sk.builtin.checkIterable(c))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(c)+"' object is not iterable");c=Sk.abstr.iter(c);if(void 0===f&&(f=c.tp$iternext(),void 0===f))throw new Sk.builtin.TypeError("reduce() of empty sequence with no initial value");
var b=f;for(f=c.tp$iternext();void 0!==f;f=c.tp$iternext())b=Sk.misceval.callsimArray(a,[b,f]);return b};Sk.builtin.sorted=function(a,c,f,l){a=Sk.misceval.arrayFromIterable(a,!0);return Sk.misceval.chain(a,a=>{a=new Sk.builtin.list(a);a.list$sort(c,f,l);return a})};Sk.builtin.filter=function(a,c){var b;Sk.builtin.pyCheckArgsLen("filter",arguments.length,2,2);if(!Sk.builtin.checkIterable(c))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(c)+"' object is not iterable");var e=function(){return[]};
var h=function(a,b){a.push(b);return a};var d=function(a){return new Sk.builtin.list(a)};c.ob$type===Sk.builtin.str?(e=function(){return new Sk.builtin.str("")},h=function(a,b){return a.sq$concat(b)},d=function(a){return a}):c.ob$type===Sk.builtin.tuple&&(d=function(a){return new Sk.builtin.tuple(a)});var g=e();var n=Sk.abstr.iter(c);for(b=n.tp$iternext();void 0!==b;b=n.tp$iternext())e=a===Sk.builtin.none.none$?new Sk.builtin.bool(b):Sk.misceval.callsimArray(a,[b]),Sk.misceval.isTrue(e)&&(g=h(g,b));
return d(g)};Sk.builtin.hasattr=function(a,c){if(!Sk.builtin.checkString(c))throw new Sk.builtin.TypeError("hasattr(): attribute name must be string");const b=Sk.misceval.tryCatch(()=>a.tp$getattr(c,!0),a=>{if(!(a instanceof Sk.builtin.AttributeError))throw a;});return Sk.misceval.chain(b,a=>void 0===a?Sk.builtin.bool.false$:Sk.builtin.bool.true$)};Sk.builtin.pow=function(a,c,f){if(void 0===f||Sk.builtin.checkNone(f))return Sk.abstr.numberBinOp(a,c,"Pow");if(!(Sk.builtin.checkInt(a)&&Sk.builtin.checkInt(c)&&
Sk.builtin.checkInt(f))){if(Sk.builtin.checkFloat(a)||Sk.builtin.checkComplex(a))return a.nb$power(c,f);throw new Sk.builtin.TypeError("unsupported operand type(s) for ** or pow(): '"+Sk.abstr.typeName(a)+"', '"+Sk.abstr.typeName(c)+"', '"+Sk.abstr.typeName(f)+"'");}return a.nb$power(c,f)};Sk.builtin.quit=function(a){a=(new Sk.builtin.str(a)).v;throw new Sk.builtin.SystemExit(a);};Sk.builtin.issubclass=function(a,c){if(!Sk.builtin.checkClass(a))throw new Sk.builtin.TypeError("issubclass() arg 1 must be a class");
var b=Sk.builtin.checkClass(c);if(!(b||c instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError("issubclass() arg 2 must be a class or tuple of classes");if(b)return a.$isSubType(c)?Sk.builtin.bool.true$:Sk.builtin.bool.false$;for(b=0;b<c.v.length;++b)if(Sk.misceval.isTrue(Sk.builtin.issubclass(a,c.v[b])))return Sk.builtin.bool.true$;return Sk.builtin.bool.false$};Sk.builtin.globals=function(){var a,c=new Sk.builtin.dict([]);for(a in Sk.globals){var f=Sk.unfixReserved(a);c.mp$ass_subscript(new Sk.builtin.str(f),
Sk.globals[a])}return c};Sk.builtin.divmod=function(a,c){return Sk.abstr.numberBinOp(a,c,"DivMod")};Sk.builtin.format=function(a,c){void 0===c&&(c=Sk.builtin.str.$emptystr);return Sk.abstr.objectFormat(a,c)};const a=new Map;let c=0;Sk.builtin.id=function(b){const e=a.get(b);if(void 0!==e)return new Sk.builtin.int_(e);a.set(b,c);return new Sk.builtin.int_(c++)};Sk.builtin.bytearray=function(){throw new Sk.builtin.NotImplementedError("bytearray is not yet implemented");};Sk.builtin.callable=function(a){return Sk.builtin.checkCallable(a)?
Sk.builtin.bool.true$:Sk.builtin.bool.false$};Sk.builtin.delattr=function(a,c){return Sk.builtin.setattr(a,c,void 0)};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,c){return 1===arguments.length?Sk.abstr.iter(a):Sk.abstr.iter(new Sk.builtin.callable_iter_(a,c))};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,c){if(!a.tp$iternext)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not an iterator");a=a.tp$iternext();if(void 0===a){if(c)return c;throw new Sk.builtin.StopIteration;}return a};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.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,q){Sk.builtin.BaseException=Sk.abstr.buildNativeClass("BaseException",
{constructor:function(...a){Sk.asserts.assert(this instanceof Sk.builtin.BaseException,"bad call to exception constructor, use 'new'");let c=a[0];"string"===typeof c&&(c=new Sk.builtin.str(c));this.args=new Sk.builtin.tuple(c?[c]:[]);this.traceback=[];this.$d=new Sk.builtin.dict;3<=a.length&&this.traceback.push({lineno:a[2],filename:a[1]||"<unknown>"})},slots:{tp$getattr:Sk.generic.getAttr,tp$doc:"Common base class for all exceptions",tp$new(a,c){this.hp$type?(c=new this.constructor,Sk.builtin.BaseException.call(c)):
c=new this.constructor;c.args=new Sk.builtin.tuple(a.slice());return c},tp$init(a,c){Sk.abstr.checkNoKwargs(Sk.abstr.typeName(this),c)},$r(){let a=this.tp$name;a+="("+this.args.v.map(a=>Sk.misceval.objectRepr(a)).join(", ")+")";return new Sk.builtin.str(a)},tp$str(){return 1>=this.args.v.length?new Sk.builtin.str(this.args.v[0]):this.args.$r()}},getsets:{args:{$get(){return this.args}},__dict__:Sk.generic.getSetDict},proto:{toString(){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.exportSymbol("Sk.builtin.BaseException",Sk.builtin.BaseException);Sk.builtin.Exception=Sk.abstr.buildNativeClass("Exception",{constructor:function(...a){Sk.builtin.BaseException.apply(this,a)},base:Sk.builtin.BaseException});Sk.exportSymbol("Sk.builtin.Exception",Sk.builtin.Exception);Sk.builtin.AssertionError=Sk.abstr.buildNativeClass("AssertionError",{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});
Sk.exportSymbol("Sk.builtin.AssertionError",Sk.builtin.AssertionError);Sk.builtin.AttributeError=Sk.abstr.buildNativeClass("AttributeError",{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.builtin.ImportError=Sk.abstr.buildNativeClass("ImportError",{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.builtin.IndentationError=Sk.abstr.buildNativeClass("IndentationError",{constructor:function(...a){Sk.builtin.Exception.apply(this,
a)},base:Sk.builtin.Exception});Sk.builtin.IndexError=Sk.abstr.buildNativeClass("IndexError",{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.builtin.LookupError=Sk.abstr.buildNativeClass("LookupError",{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.builtin.KeyError=Sk.abstr.buildNativeClass("KeyError",{constructor:function(...a){Sk.builtin.LookupError.apply(this,a)},base:Sk.builtin.LookupError});Sk.builtin.NameError=
Sk.abstr.buildNativeClass("NameError",{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.builtin.UnboundLocalError=Sk.abstr.buildNativeClass("UnboundLocalError",{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.builtin.OverflowError=Sk.abstr.buildNativeClass("OverflowError",{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.builtin.SyntaxError=Sk.abstr.buildNativeClass("SyntaxError",
{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.builtin.RuntimeError=Sk.abstr.buildNativeClass("RuntimeError",{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.exportSymbol("Sk.builtin.RuntimeError",Sk.builtin.RuntimeError);Sk.builtin.SuspensionError=Sk.abstr.buildNativeClass("SuspensionError",{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.exportSymbol("Sk.builtin.SuspensionError",
Sk.builtin.SuspensionError);Sk.builtin.SystemExit=Sk.abstr.buildNativeClass("SystemExit",{constructor:function(...a){Sk.builtin.BaseException.apply(this,a)},base:Sk.builtin.BaseException});Sk.exportSymbol("Sk.builtin.SystemExit",Sk.builtin.SystemExit);Sk.builtin.TypeError=Sk.abstr.buildNativeClass("TypeError",{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.exportSymbol("Sk.builtin.TypeError",Sk.builtin.TypeError);Sk.builtin.ValueError=Sk.abstr.buildNativeClass("ValueError",
{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.exportSymbol("Sk.builtin.ValueError",Sk.builtin.ValueError);Sk.builtin.ZeroDivisionError=Sk.abstr.buildNativeClass("ZeroDivisionError",{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.builtin.TimeLimitError=Sk.abstr.buildNativeClass("TimeLimitError",{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.exportSymbol("Sk.builtin.TimeLimitError",
Sk.builtin.TimeLimitError);Sk.builtin.IOError=Sk.abstr.buildNativeClass("IOError",{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.exportSymbol("Sk.builtin.IOError",Sk.builtin.IOError);Sk.builtin.NotImplementedError=Sk.abstr.buildNativeClass("NotImplementedError",{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.exportSymbol("Sk.builtin.NotImplementedError",Sk.builtin.NotImplementedError);Sk.builtin.NegativePowerError=
Sk.abstr.buildNativeClass("NegativePowerError",{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.exportSymbol("Sk.builtin.NegativePowerError",Sk.builtin.NegativePowerError);Sk.builtin.ExternalError=Sk.abstr.buildNativeClass("ExternalError",{constructor:function(...a){this.nativeError=a[0];if(!Sk.builtin.checkString(this.nativeError)&&(a[0]=this.nativeError.toString(),a[0].startsWith("RangeError: Maximum call")))return a[0]="Maximum call stack size exceeded",
new Sk.builtin.RecursionError(...a);Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.exportSymbol("Sk.builtin.ExternalError",Sk.builtin.ExternalError);Sk.builtin.RecursionError=Sk.abstr.buildNativeClass("RecursionError",{constructor:function(...a){Sk.builtin.RuntimeError.apply(this,a)},base:Sk.builtin.Exception});Sk.exportSymbol("Sk.builtin.RecursionError",Sk.builtin.RecursionError);Sk.builtin.OperationError=Sk.abstr.buildNativeClass("OperationError",{constructor:function(...a){Sk.builtin.Exception.apply(this,
a)},base:Sk.builtin.Exception});Sk.exportSymbol("Sk.builtin.OperationError",Sk.builtin.OperationError);Sk.builtin.SystemError=Sk.abstr.buildNativeClass("SystemError",{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.exportSymbol("Sk.builtin.SystemError",Sk.builtin.SystemError);Sk.builtin.UnicodeDecodeError=Sk.abstr.buildNativeClass("UnicodeDecodeError",{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.exportSymbol("Sk.builtin.UnicodeDecodeError",
Sk.builtin.UnicodeDecodeError);Sk.builtin.UnicodeEncodeError=Sk.abstr.buildNativeClass("UnicodeEncodeError",{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base:Sk.builtin.Exception});Sk.exportSymbol("Sk.builtin.UnicodeEncodeError",Sk.builtin.UnicodeEncodeError);Sk.builtin.StopIteration=Sk.abstr.buildNativeClass("StopIteration",{constructor:function(...a){Sk.builtin.Exception.apply(this,a)},base: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,q){Sk.builtin.method=Sk.abstr.buildNativeClass("method",{constructor:function(a,c){Sk.asserts.assert(this instanceof Sk.builtin.method,"bad call to method constructor, use 'new'");this.im_func=a;this.im_self=c;this.im_call=a.tp$call},slots:{$r(){let a=this.im_func.tp$getattr(Sk.builtin.str.$qualname)||this.im_func.tp$getattr(Sk.builtin.str.$name);a=a&&a.v||"?";return new Sk.builtin.str("<bound method "+
a+" of "+Sk.misceval.objectRepr(this.im_self)+">")},tp$hash(){const a=Sk.abstr.objectHash(this.im_self),c=Sk.abstr.objectHash(this.im_func);return a+c},tp$call(a,c){var b=this.im_call;if(void 0===b)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(this.im_func)+"' object is not callable");a=[this.im_self,...a];return b.call(this.im_func,a,c)},tp$new(a,c){Sk.abstr.checkNoKwargs("method",c);Sk.abstr.checkArgsLen("method",a,2,2);c=a[0];a=a[1];if(!Sk.builtin.checkCallable(c))throw new Sk.builtin.TypeError("first argument must be callable");
if(Sk.builtin.checkNone(a))throw new Sk.builtin.TypeError("self must not be None");return new Sk.builtin.method(c,a)},tp$richcompare(a,c){if("Eq"!=c&&"NotEq"!=c||!(a instanceof Sk.builtin.method))return Sk.builtin.NotImplemented.NotImplemented$;let b;try{b=Sk.misceval.richCompareBool(this.im_self,a.im_self,"Eq",!1)&&this.im_func==a.im_func}catch(e){b=!1}return"Eq"==c?b:!b},tp$descr_get(a,c){return this},tp$getattr(a,c){const b=Sk.abstr.lookupSpecial(this,a);return void 0!==b?b:this.im_func.tp$getattr(a,
c)}},getsets:{__func__:{$get(){return this.im_func}},__self__:{$get(){return this.im_self}},__doc__:{$get(){return this.im_func.tp$getattr(Sk.builtin.str.$doc)}}},flags:{sk$suitable_as_base_class:!1}})},function(m,q){function a(a){if(null!==a&&void 0!==a){if(a.nb$index)return a.nb$index();if("number"===typeof a&&Number.isInteger(a))return a}}function c(b,c){const e=a(b);if(void 0!==e)return e;c=(c||"'{tp$name}' object cannot be interpreted as an integer").replace("{tp$name}",Sk.abstr.typeName(b));
throw new Sk.builtin.TypeError(c);}Sk.misceval={};Sk.misceval.Suspension=function(a,c,f){this.$isSuspension=!0;void 0!==a&&void 0!==c&&(this.resume=function(){return a(c.resume())});this.child=c;this.optional=void 0!==c&&c.optional;this.data=void 0===f&&void 0!==c?c.data:f};Sk.exportSymbol("Sk.misceval.Suspension",Sk.misceval.Suspension);Sk.misceval.retryOptionalSuspensionOrThrow=function(a,c){for(;a instanceof Sk.misceval.Suspension;){if(!a.optional)throw new Sk.builtin.SuspensionError(c||"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 null!==a&&void 0!==a&&(void 0!==a.nb$index||"number"===typeof a&&Number.isInteger(a))};Sk.exportSymbol("Sk.misceval.isIndex",Sk.misceval.isIndex);Sk.misceval.asIndex=a;Sk.misceval.asIndexSized=function(a,e,f){f=c(a,f);if("number"===typeof f)return f;if(null==e)return JSBI.lessThan(f,JSBI.__ZERO)?-Number.MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER;
throw new e("cannot fit '"+Sk.abstr.typeName(a)+"' into an index-sized integer");};Sk.misceval.asIndexOrThrow=c;Sk.misceval.applySlice=function(a,c,f,l){return Sk.abstr.objectGetItem(a,new Sk.builtin.slice(c,f,null),l)};Sk.exportSymbol("Sk.misceval.applySlice",Sk.misceval.applySlice);Sk.misceval.assignSlice=function(a,c,f,l,h){c=new Sk.builtin.slice(c,f);return null===l?Sk.abstr.objectDelItem(a,c):Sk.abstr.objectSetItem(a,c,l,h)};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.iterator=Sk.abstr.buildIteratorClass("iterator",{constructor:function(a,c){this.tp$iternext=c?a:function(b){let c=a();return b||!c.$isSuspension?c:Sk.misceval.retryOptionalSuspensionOrThrow(c)}},iternext:function(a){return this.tp$iternext(a)},flags:{sk$acceptable_as_base_class:!1}});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,c,f,l){Sk.asserts.assert(a.sk$object&&c.sk$object,"JS object passed to richCompareBool");var b;var d=a.ob$type;var e=c.ob$type,n=e!==d&&void 0===e.sk$baseClass&&e.$isSubType(d);if(!Sk.__future__.python3&&d!==e&&("GtE"===f||"Gt"===f||"LtE"===f||"Lt"===f)){var k=[Sk.builtin.float_,Sk.builtin.int_,Sk.builtin.lng,Sk.builtin.bool],p=[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 b=k.indexOf(d),g=p.indexOf(d);k=k.indexOf(e);p=p.indexOf(e);if(a===Sk.builtin.none.none$)switch(f){case "Lt":return!0;case "LtE":return!0;case "Gt":return!1;case "GtE":return!1}if(c===Sk.builtin.none.none$)switch(f){case "Lt":return!1;case "LtE":return!1;case "Gt":return!0;case "GtE":return!0}if(-1!==b&&-1!==p)switch(f){case "Lt":return!0;case "LtE":return!0;case "Gt":return!1;case "GtE":return!1}if(-1!==g&&-1!==k)switch(f){case "Lt":return!1;case "LtE":return!1;case "Gt":return!0;
case "GtE":return!0}if(-1!==g&&-1!==p)switch(f){case "Lt":return g<p;case "LtE":return g<=p;case "Gt":return g>p;case "GtE":return g>=p}}if("Is"===f){if(d===e){if(a===c)return!0;if(d===Sk.builtin.float_)return a.v===c.v;if(d===Sk.builtin.int_)return"number"===typeof a.v&&"number"===typeof a.v?a.v===c.v:JSBI.equal(JSBI.BigInt(a.v),JSBI.BigInt(c.v))}return!1}if("IsNot"===f)return d!==e?!0:d===Sk.builtin.float_?a.v!==c.v:d===Sk.builtin.int_?"number"===typeof a.v&&"number"===typeof a.v?a.v!==c.v:JSBI.notEqual(JSBI.BigInt(a.v),
JSBI.BigInt(c.v)):a!==c;if("In"===f)return Sk.misceval.chain(Sk.abstr.sequenceContains(c,a,l),Sk.misceval.isTrue);if("NotIn"===f)return Sk.misceval.chain(Sk.abstr.sequenceContains(c,a,l),function(a){return!Sk.misceval.isTrue(a)});e={Eq:"ob$eq",NotEq:"ob$ne",Gt:"ob$gt",GtE:"ob$ge",Lt:"ob$lt",LtE:"ob$le"};d=e[f];if(n&&(l=e[Sk.misceval.swappedOp_[f]],c[l]!==a[l]&&(b=c[l](a))!==Sk.builtin.NotImplemented.NotImplemented$)||(b=a[d](c))!==Sk.builtin.NotImplemented.NotImplemented$||!n&&(l=e[Sk.misceval.swappedOp_[f]],
(b=c[l](a))!==Sk.builtin.NotImplemented.NotImplemented$))return Sk.misceval.isTrue(b);if(!Sk.__future__.python3){if(n=Sk.abstr.lookupSpecial(a,Sk.builtin.str.$cmp))try{b=Sk.misceval.callsimArray(n,[c]);if(Sk.builtin.checkNumber(b)){b=Sk.builtin.asnum$(b);if("Eq"===f)return 0===b;if("NotEq"===f)return 0!==b;if("Lt"===f)return 0>b;if("Gt"===f)return 0<b;if("LtE"===f)return 0>=b;if("GtE"===f)return 0<=b}if(b!==Sk.builtin.NotImplemented.NotImplemented$)throw new Sk.builtin.TypeError("comparison did not return an int");
}catch(u){throw new Sk.builtin.TypeError("comparison did not return an int");}if(n=Sk.abstr.lookupSpecial(c,Sk.builtin.str.$cmp))try{b=Sk.misceval.callsimArray(n,[a]);if(Sk.builtin.checkNumber(b)){b=Sk.builtin.asnum$(b);if("Eq"===f)return 0===b;if("NotEq"===f)return 0!==b;if("Lt"===f)return 0<b;if("Gt"===f)return 0>b;if("LtE"===f)return 0<=b;if("GtE"===f)return 0>=b}if(b!==Sk.builtin.NotImplemented.NotImplemented$)throw new Sk.builtin.TypeError("comparison did not return an int");}catch(u){throw new Sk.builtin.TypeError("comparison did not return an int");
}if(a===Sk.builtin.none.none$&&c===Sk.builtin.none.none$){if("Eq"===f)return a.v===c.v;if("NotEq"===f)return a.v!==c.v;if("Gt"===f)return a.v>c.v;if("GtE"===f)return a.v>=c.v;if("Lt"===f)return a.v<c.v;if("LtE"===f)return a.v<=c.v}}if("Eq"===f)return a===c;if("NotEq"===f)return a!==c;a=Sk.abstr.typeName(a);c=Sk.abstr.typeName(c);throw new Sk.builtin.TypeError("'"+Sk.misceval.opSymbols[f]+"' not supported between instances of '"+a+"' and '"+c+"'");};Sk.exportSymbol("Sk.misceval.richCompareBool",Sk.misceval.richCompareBool);
Sk.misceval.objectRepr=function(a){Sk.asserts.assert(void 0!==a,"trying to repr undefined");if(null!==a&&a.$r)return a.$r().v;try{return(new Sk.builtin.str(a)).v}catch(e){if(e instanceof Sk.builtin.TypeError)return"<unknown>";throw e;}};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){return!0===
a||a===Sk.builtin.bool.true$?!0:!1===a||a===Sk.builtin.bool.false$||null===a||void 0===a?!1:a.nb$bool?a.nb$bool():a.sq$length?0!==a.sq$length():!!a};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,c){c=c[a];if(void 0!==c)return c;c=Sk.builtins[a];if(void 0!==c)return c;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,c,f,l,h){h=
Array.prototype.slice.call(arguments,4);return Sk.misceval.apply(a,c,f,l,h)};Sk.exportSymbol("Sk.misceval.call",Sk.misceval.call);Sk.misceval.callAsync=function(a,c,f,l,h,d){d=Array.prototype.slice.call(arguments,5);return Sk.misceval.applyAsync(a,c,f,l,h,d)};Sk.exportSymbol("Sk.misceval.callAsync",Sk.misceval.callAsync);Sk.misceval.callOrSuspend=function(a,c,f,l,h){h=Array.prototype.slice.call(arguments,4);return Sk.misceval.applyOrSuspend(a,c,f,l,h)};Sk.exportSymbol("Sk.misceval.callOrSuspend",
Sk.misceval.callOrSuspend);Sk.misceval.callsim=function(a,c){c=Array.prototype.slice.call(arguments,1);return Sk.misceval.apply(a,void 0,void 0,void 0,c)};Sk.exportSymbol("Sk.misceval.callsim",Sk.misceval.callsim);Sk.misceval.callsimArray=function(a,c,f){c=c||[];return Sk.misceval.retryOptionalSuspensionOrThrow(Sk.misceval.callsimOrSuspendArray(a,c,f))};Sk.exportSymbol("Sk.misceval.callsimArray",Sk.misceval.callsimArray);Sk.misceval.callsimAsync=function(a,c,f){f=Array.prototype.slice.call(arguments,
2);return Sk.misceval.applyAsync(a,c,void 0,void 0,void 0,f)};Sk.exportSymbol("Sk.misceval.callsimAsync",Sk.misceval.callsimAsync);Sk.misceval.callsimOrSuspend=function(a,c){c=Array.prototype.slice.call(arguments,1);return Sk.misceval.applyOrSuspend(a,void 0,void 0,void 0,c)};Sk.exportSymbol("Sk.misceval.callsimOrSuspend",Sk.misceval.callsimOrSuspend);Sk.misceval.callsimOrSuspendArray=function(a,c,f){c=c||[];return void 0!==a&&a.tp$call?a.tp$call(c,f):Sk.misceval.applyOrSuspend(a,void 0,void 0,f,
c)};Sk.exportSymbol("Sk.misceval.callsimOrSuspendArray",Sk.misceval.callsimOrSuspendArray);Sk.misceval.apply=function(a,c,f,l,h){a=Sk.misceval.applyOrSuspend(a,c,f,l,h);return a instanceof Sk.misceval.Suspension?Sk.misceval.retryOptionalSuspensionOrThrow(a):a};Sk.exportSymbol("Sk.misceval.apply",Sk.misceval.apply);Sk.misceval.asyncToPromise=function(a,c){return new Promise(function(b,e){try{(function g(a){try{for(var d=function(){try{g(a.resume())}catch(t){e(t)}},f=function(b){try{a.data.result=b,
d()}catch(v){e(v)}},p=function(b){try{a.data.error=b,d()}catch(v){e(v)}};a instanceof Sk.misceval.Suspension;){var l=c&&(c[a.data.type]||c["*"]);if(l){var A=l(a);if(A){A.then(g,e);return}}if("Sk.promise"==a.data.type){a.data.promise.then(f,p);return}if("Sk.yield"==a.data.type){Sk.global.setImmediate(d);return}if("Sk.delay"==a.data.type){Sk.global.setImmediate(d);return}if(a.optional)a=a.resume();else throw new Sk.builtin.SuspensionError("Unhandled non-optional suspension of type '"+a.data.type+"'");
}b(a)}catch(t){e(t)}})(a())}catch(h){e(h)}})};Sk.exportSymbol("Sk.misceval.asyncToPromise",Sk.misceval.asyncToPromise);Sk.misceval.applyAsync=function(a,c,f,l,h,d){return Sk.misceval.asyncToPromise(function(){return Sk.misceval.applyOrSuspend(c,f,l,h,d)},a)};Sk.exportSymbol("Sk.misceval.applyAsync",Sk.misceval.applyAsync);Sk.misceval.chain=function(a,c){for(var b=1,e=a,h,d;;){if(b==arguments.length)return e;if(e&&e.$isSuspension)break;e=arguments[b](e);b++}d=Array(arguments.length-b);for(h=0;h<arguments.length-
b;h++)d[h]=arguments[b+h];h=0;return function k(a){for(;h<d.length;){if(a instanceof Sk.misceval.Suspension)return new Sk.misceval.Suspension(k,a);a=d[h](a);h++}return a}(e)};Sk.exportSymbol("Sk.misceval.chain",Sk.misceval.chain);Sk.misceval.tryCatch=function(a,c){try{var b=a()}catch(l){return c(l)}return b instanceof Sk.misceval.Suspension?(a=new Sk.misceval.Suspension(void 0,b),a.resume=function(){return Sk.misceval.tryCatch(b.resume,c)},a):b};Sk.exportSymbol("Sk.misceval.tryCatch",Sk.misceval.tryCatch);
Sk.misceval.iterFor=function(a,c,f){var b=f,e=function(c){b=c;return c instanceof Sk.misceval.Break?c:a.tp$iternext(!0)};return function n(a){for(;void 0!==a;){if(a instanceof Sk.misceval.Suspension)return new Sk.misceval.Suspension(n,a);if(a===Sk.misceval.Break||a instanceof Sk.misceval.Break)return a.brValue;a=Sk.misceval.chain(c(a,b),e)}return b}(a.tp$iternext(!0))};Sk.exportSymbol("Sk.misceval.iterFor",Sk.misceval.iterFor);Sk.misceval.iterArray=function(a,c,f){Sk.asserts.assert(Array.isArray(a),
"iterArgs requires an array");let b=0;return Sk.misceval.iterFor({tp$iternext:()=>a[b++]},c,f)};Sk.misceval.arrayFromIterable=function(a,c){if(void 0===a)return[];if(void 0===a.hp$type&&void 0!==a.sk$asarray)return a.sk$asarray();const b=[];a=Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(a),a=>{b.push(a)}),()=>b);return c?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,c,f,l,h){var b;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 e=a.tp$call;if(void 0!==e){if(f)for(f=f.tp$iter(),b=f.tp$iternext();void 0!==b;b=f.tp$iternext())h.push(b);if(c)for(f=Sk.abstr.iter(c),b=f.tp$iternext();void 0!==b;b=f.tp$iternext()){if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("Function keywords must be strings");
l.push(b.v);l.push(Sk.abstr.objectGetItem(c,b,!1))}return e.call(a,h,l,c)}e=a.__call__;if(void 0!==e)return h.unshift(a),Sk.misceval.apply(e,c,f,l,h);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,c,f,l,h){var b=Sk.builtin.type,e={};c(a,e,void 0===h?{}:h);a.__name__&&(e.__module__=a.__name__);a=new Sk.builtin.str(f);l=new Sk.builtin.tuple(l);c=[];for(var n in e)e.hasOwnProperty(n)&&(c.push(new Sk.builtin.str(n)),c.push(e[n]));c=new Sk.builtin.dict(c);return Sk.misceval.callsimArray(b,[a,l,c])};Sk.exportSymbol("Sk.misceval.buildClass",Sk.misceval.buildClass)},function(m,q){Sk.builtin.callable_iter_=
Sk.abstr.buildIteratorClass("callable_iterator",{constructor:function(a,c){if(!Sk.builtin.checkCallable(a))throw new Sk.builtin.TypeError("iter(v, w): v must be callable");this.$callable=a;this.$sentinel=c;this.$flag=!1},iternext(a){if(!0!==this.$flag){if(a)return a=Sk.misceval.callsimOrSuspendArray(this.$callable,[]),Sk.misceval.chain(a,a=>{if(Sk.misceval.richCompareBool(a,this.$sentinel,"Eq",!0))this.$flag=!0;else return a});a=Sk.misceval.callsimArray(this.$callable,[]);if(Sk.misceval.richCompareBool(a,
this.$sentinel,"Eq",!1))this.$flag=!0;else return a}},flags:{sk$acceptable_as_base_class:!1}});Sk.builtin.seq_iter_=Sk.abstr.buildIteratorClass("iterator",{constructor:function(a){this.$index=0;this.$seq=a},iternext(a){let c;c=Sk.misceval.tryCatch(()=>this.$seq.mp$subscript(new Sk.builtin.int_(this.$index++),a),a=>{if(!(a instanceof Sk.builtin.IndexError||a instanceof Sk.builtin.StopIteration))throw a;});return a?c:Sk.misceval.retryOptionalSuspensionOrThrow(c)},methods:{__length_hint__:{$flags:{NoArgs:!0},
$meth(){if(this.$seq.sq$length)return this.$seq.sq$length()-this.$index;throw new Sk.builtin.NotImplementedError("len is not implemented for "+Sk.abstr.typeName(this.$seq));}}},flags:{sk$acceptable_as_base_class:!1}});Sk.exportSymbol("Sk.builtin.callable_iter_",Sk.builtin.callable_iter_)},function(m,q){Sk.builtin.list=Sk.abstr.buildNativeClass("list",{constructor:function(a){void 0===a?a=[]:Array.isArray(a)||(a=Sk.misceval.arrayFromIterable(a));Sk.asserts.assert(this instanceof Sk.builtin.list,"bad call to list, use 'new' with an Array of python objects");
this.v=a;this.in$repr=!1},slots:{tp$getattr:Sk.generic.getAttr,tp$as_sequence_or_mapping:!0,tp$hash:Sk.builtin.none.none$,tp$doc:"Built-in mutable sequence.\n\nIf no argument is given, the constructor creates a new empty list.\nThe argument must be an iterable if specified.",tp$new:Sk.generic.new,tp$init(a,c){Sk.abstr.checkNoKwargs("list",c);Sk.abstr.checkArgsLen("list",a,0,1);return Sk.misceval.chain(Sk.misceval.arrayFromIterable(a[0],!0),a=>{this.v=a})},$r(){if(this.in$repr)return new Sk.builtin.str("[...]");
this.in$repr=!0;const a=this.v.map(a=>Sk.misceval.objectRepr(a));this.in$repr=!1;return new Sk.builtin.str("["+a.join(", ")+"]")},tp$richcompare:Sk.generic.seqCompare,tp$iter(){return new a(this)},sq$length(){return this.v.length},sq$concat(a){if(!(a instanceof Sk.builtin.list))throw new Sk.builtin.TypeError("can only concatenate list to list");return new Sk.builtin.list(this.v.concat(a.v))},sq$contains(a){for(let b=this.tp$iter(),c=b.tp$iternext();void 0!==c;c=b.tp$iternext())if(c===a||Sk.misceval.richCompareBool(c,
a,"Eq"))return!0;return!1},sq$repeat(a){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.asIndexSized(a,Sk.builtin.OverflowError);if(a*this.v.length>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.OverflowError;const b=[];for(let c=0;c<a;c++)for(let a=0;a<this.v.length;a++)b.push(this.v[a]);return new Sk.builtin.list(b)},mp$subscript(a){if(Sk.misceval.isIndex(a))return a=Sk.misceval.asIndexSized(a,Sk.builtin.IndexError),
a=this.list$inRange(a,"list index out of range"),this.v[a];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)}throw new Sk.builtin.TypeError("list indices must be integers or slices, not "+Sk.abstr.typeName(a));},mp$ass_subscript(a,c){void 0===c?this.del$subscript(a):this.ass$subscript(a,c)},sq$inplace_concat(a){return a===this?(this.v.push(...this.v),this):Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(a),a=>{this.v.push(a)}),
()=>this)},sq$inplace_repeat(a){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.asIndexSized(a,Sk.builtin.OverflowError);const b=this.v.length;if(0>=a)this.v.length=0;else if(a*b>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.OverflowError;for(let c=1;c<a;c++)for(let a=0;a<b;a++)this.v.push(this.v[a]);return this}},methods:{__reversed__:{$meth(){return new c(this)},$flags:{NoArgs:!0},$textsig:"($self, /)",
$doc:"Return a reverse iterator over the list."},clear:{$meth(){this.v.length=0;return Sk.builtin.none.none$},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Remove all items from list."},copy:{$meth(){return new Sk.builtin.list(this.v.slice(0))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return a shallow copy of the list."},append:{$meth(a){this.v.push(a);return Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:"($self, object, /)",$doc:"Append object to the end of the list."},insert:{$meth(a,
c){a=Sk.misceval.asIndexSized(a,Sk.builtin.OverflowError);({start:a}=Sk.builtin.slice.startEnd$wrt(this,a));this.v.splice(a,0,c);return Sk.builtin.none.none$},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($self, index, object, /)",$doc:"Insert object before index."},extend:{$meth(a){return a===this?(this.v.push(...this.v),Sk.builtin.none.none$):Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(a),a=>{this.v.push(a)}),()=>Sk.builtin.none.none$)},$flags:{OneArg:!0},$textsig:"($self, iterable, /)",$doc:"Extend list by appending elements from the iterable."},
pop:{$meth(a){a=void 0===a?this.v.length-1:Sk.misceval.asIndexSized(a,Sk.builtin.OverflowError);a=this.list$inRange(a,"pop index out of range");const b=this.v[a];this.v.splice(a,1);return b},$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, index=-1, /)",$doc:"Remove and return item at index (default last).\n\nRaises IndexError if list is empty or index is out of range."},remove:{$meth(a){a=this.list$indexOf(a);if(-1===a)throw new Sk.builtin.ValueError("list.remove(x): x not in list");this.v.splice(a,
1);return Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:"($self, value, /)",$doc:"Remove first occurrence of value.\n\nRaises ValueError if the value is not present."},sort:{$meth(a,c){if(a.length)throw new Sk.builtin.TypeError("sort() takes no positional arguments");const [b,e]=Sk.abstr.copyKeywordsToNamedArgs("sort",["key","reverse"],a,c,[Sk.builtin.none.none$,Sk.builtin.bool.false$]);return this.list$sort(void 0,b,e)},$flags:{FastCall:!0},$textsig:"($self, /, *, key=None, reverse=False)",
$doc:"Stable sort *IN PLACE*."},index:{$meth(a,c,f){if(void 0!==c&&!Sk.misceval.isIndex(c)||void 0!==f&&!Sk.misceval.isIndex(f))throw new Sk.builtin.TypeError("slice indices must be integers or have an __index__ method");c=this.list$indexOf(a,c,f);if(-1===c)throw new Sk.builtin.ValueError(Sk.misceval.objectRepr(a)+" is not in list");return new Sk.builtin.int_(c)},$flags:{MinArgs:1,MaxArgs:3},$textsig:"($self, value, start=0, stop=sys.maxsize, /)",$doc:"Return first index of value.\n\nRaises ValueError if the value is not present."},
count:{$meth(a){let b=0;const c=this.v.length;for(let e=0;e<c;e++)if(this.v[e]===a||Sk.misceval.richCompareBool(this.v[e],a,"Eq"))b+=1;return new Sk.builtin.int_(b)},$flags:{OneArg:!0},$textsig:"($self, value, /)",$doc:"Return number of occurrences of value."},reverse:{$meth(){this.list$reverse();return Sk.builtin.none.none$},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Reverse *IN PLACE*."}},proto:{sk$asarray(){return this.v.slice(0)},list$sort:function(a,c,f){const b=null!=c&&c!==Sk.builtin.none.none$;
var e=null!=a&&a!==Sk.builtin.none.none$;let d;if(void 0===f)d=!1;else if(Sk.builtin.checkInt(f))d=Sk.misceval.isTrue(f);else throw new Sk.builtin.TypeError("an integer is required");f=new Sk.builtin.timSort(this);this.v=[];const g=new Sk.builtin.int_(0);if(b){f.lt=e?function(b,c){b=Sk.misceval.callsimArray(a,[b[0],c[0]]);return Sk.misceval.richCompareBool(b,g,"Lt")}:function(a,b){return Sk.misceval.richCompareBool(a[0],b[0],"Lt")};for(let a=0;a<f.listlength;a++){e=f.list.v[a];const b=Sk.misceval.callsimArray(c,
[e]);f.list.v[a]=[b,e]}}else e&&(f.lt=function(b,c){b=Sk.misceval.callsimArray(a,[b,c]);return Sk.misceval.richCompareBool(b,g,"Lt")});d&&f.list.list$reverse();f.sort();d&&f.list.list$reverse();if(b)for(c=0;c<f.listlength;c++)e=f.list.v[c][1],f.list.v[c]=e;c=0<this.sq$length();this.v=f.list.v;if(c)throw new Sk.builtin.ValueError("list modified during sort");return Sk.builtin.none.none$},list$inRange(a,c){0>a&&(a+=this.v.length);if(0<=a&&a<this.v.length)return a;throw new Sk.builtin.IndexError(c);
},list$indexOf(a,c,f){for({start:c,end:f}=Sk.builtin.slice.startEnd$wrt(this,c,f);c<f&&c<this.v.length;c++)if(this.v[c]===a||Sk.misceval.richCompareBool(this.v[c],a,"Eq"))return c;return-1},list$reverse(){this.v.reverse()},ass$subscript(a,c){if(Sk.misceval.isIndex(a))this.ass$index(a,c);else if(a instanceof Sk.builtin.slice){const {start:b,stop:e,step:h}=a.slice$indices(this.v.length);1===h?this.ass$slice(b,e,c):this.ass$ext_slice(a,c)}else throw new Sk.builtin.TypeError("list indices must be integers or slices, not "+
Sk.abstr.typeName(a));},ass$index(a,c){a=Sk.misceval.asIndexSized(a,Sk.builtin.IndexError);a=this.list$inRange(a,"list assignment index out of range");this.v[a]=c},ass$slice(a,c,f){if(!Sk.builtin.checkIterable(f))throw new Sk.builtin.TypeError("can only assign an iterable");f=Sk.misceval.arrayFromIterable(f);this.v.splice(a,c-a,...f)},ass$ext_slice(a,c){const b=[];a.sssiter$(this.v.length,a=>{b.push(a)});if(!Sk.builtin.checkIterable(c))throw new Sk.builtin.TypeError("must assign iterable to extended slice");
a=Sk.misceval.arrayFromIterable(c);if(b.length!==a.length)throw new Sk.builtin.ValueError("attempt to assign sequence of size "+a.length+" to extended slice of size "+b.length);for(c=0;c<b.length;c++)this.v.splice(b[c],1,a[c])},del$subscript(a){if(Sk.misceval.isIndex(a))this.del$index(a);else if(a instanceof Sk.builtin.slice){const {start:b,stop:c,step:l}=a.slice$indices(this.v.length);1===l?this.del$slice(b,c):this.del$ext_slice(a,0<l?1:0)}else throw new Sk.builtin.TypeError("list indices must be integers, not "+
Sk.abstr.typeName(a));},del$index(a){a=Sk.misceval.asIndexSized(a,Sk.builtin.IndexError);a=this.list$inRange(a,"list assignment index out of range");this.v.splice(a,1)},del$slice(a,c){this.v.splice(a,c-a)},del$ext_slice(a,c){let b=0;a.sssiter$(this.v.length,a=>{this.v.splice(a-b,1);b+=c})}}});Sk.exportSymbol("Sk.builtin.list",Sk.builtin.list);Sk.builtin.list.py2$methods={sort:{$name:"sort",$meth(a,c){const [b,e,h]=Sk.abstr.copyKeywordsToNamedArgs("sort",["cmp","key","reverse"],a,c,[Sk.builtin.none.none$,
Sk.builtin.none.none$,Sk.builtin.bool.false$]);return this.list$sort(b,e,h)},$flags:{FastCall:!0},$textsig:"($self, cmp=None, key=None, reverse=False)",$doc:"Stable sort *IN PLACE*."}};var a=Sk.abstr.buildIteratorClass("list_iterator",{constructor:function(a){this.$index=0;this.$seq=a.v},iternext:Sk.generic.iterNextWithArray,methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},flags:{sk$acceptable_as_base_class:!1}}),c=Sk.abstr.buildIteratorClass("list_reverseiterator",{constructor:function(a){this.$index=
a.v.length-1;this.$seq=a.v},iternext(){const a=this.$seq[this.$index--];if(void 0===a)this.tp$iternext=()=>{};else return a},methods:{__length_hint__:Sk.generic.iterReverseLengthHintMethodDef},flags:{sk$acceptable_as_base_class:!1}})},function(m,q,a){function c(a){var b=a.replace(F,"").replace(M,"_").toLowerCase();b=E[b];return void 0===b?a:b}function b(a,b,c){if(void 0===b)b="utf-8";else if(Sk.builtin.checkString(b))b=b.$jsstr();else throw new Sk.builtin.TypeError(a+"() argument "+("bytesstr".includes(a)?
2:1)+" must be str not "+Sk.abstr.typeName(b));if(void 0===c)c="strict";else if(Sk.builtin.checkString(c))c=c.$jsstr();else throw new Sk.builtin.TypeError(a+"() argument "+("bytesstr".includes(a)?3:2)+" must be str not "+Sk.abstr.typeName(c));return{encoding:b,errors:c}}function e(a,b,d){a=a.$jsstr();b=c(b);if("strict"!==d&&"ignore"!==d&&"replace"!==d)throw new Sk.builtin.NotImplementedError("'"+d+"' error handling not implemented in Skulpt");if("ascii"===b){b=[];for(e in a){const c=a.charCodeAt(e);
if(127<c){if("strict"===d)throw d=f(c),new Sk.builtin.UnicodeEncodeError("'ascii' codec can't encode character '"+d+"' in position "+e+": ordinal not in range(128)");"replace"===d&&b.push(63)}else b.push(c)}var e=new Uint8Array(b)}else if("utf-8"===b)e=V.encode(a);else throw new Sk.builtin.LookupError("unknown encoding: "+b);return new Sk.builtin.bytes(e)}function f(a){var b=265>=a?"\\x":"\\u";a=a.toString(16);3===a.length&&(a=a.slice(1,3));return a=1===a.length?b+"0"+a:b+a}function l(a,d){({encoding:a,
errors:d}=b("decode",a,d));a=c(a);if("strict"!==d&&"ignore"!==d&&"replace"!==d)throw new Sk.builtin.NotImplementedError("'"+d+"' error handling not implemented in Skulpt");if("ascii"===a){a=this.v;var e="";for(let b=0;b<a.length;b++){const c=a[b];if(127<c){if("strict"===d)throw new Sk.builtin.UnicodeDecodeError("'ascii' codec can't decode byte 0x"+c.toString(16)+" in position "+b+": ordinal not in range(128)");"replace"===d&&(e+=String.fromCharCode(65533))}else e+=String.fromCharCode(c)}a=e}else if("utf-8"===
a)a:if(a=this.v,e=d,d=y.decode(a),"replace"===e)a=d;else{if("strict"===e){e=d.indexOf("\ufffd");if(-1===e){a=d;break a}throw new Sk.builtin.UnicodeDecodeError("'utf-8' codec can't decode byte 0x"+a[e].toString(16)+" in position "+e+": invalid start byte");}a=d.replace(/\ufffd/g,"")}else throw new Sk.builtin.LookupError("unknown encoding: "+a);return new Sk.builtin.str(a)}function h(a,b){return function(c,d,e){if(!(c instanceof Sk.builtin.bytes||c instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError(a+
" first arg must be bytes or a tuple of bytes, not "+Sk.abstr.typeName(c));({start:d,end:e}=Sk.builtin.slice.startEnd$wrt(this,d,e));if(e<d)return Sk.builtin.bool.false$;d=this.v.subarray(d,e);if(c instanceof Sk.builtin.tuple){for(let a=Sk.abstr.iter(c),e=a.tp$iternext();void 0!==e;e=a.tp$iternext())if(e=this.get$raw(e),b(d,e))return Sk.builtin.bool.true$;return Sk.builtin.bool.false$}return b(d,c.v)?Sk.builtin.bool.true$:Sk.builtin.bool.false$}}function d(a){return function(b,c,d){b=this.get$tgt(b);
({start:c,end:d}=Sk.builtin.slice.startEnd$wrt(this,c,d));return d<c?-1:"number"===typeof b?(b=a?this.v.lastIndexOf(b,d-1):this.v.indexOf(b,c),b>=c&&b<d?b:-1):a?this.find$subright(b,c,d):this.find$subleft(b,c,d)}}function g(a){return function(b){b=this.get$raw(b);let c;if(a){if(c=this.find$subright(b,0,this.v.length),0>c)return new Sk.builtin.tuple([new Sk.builtin.bytes,new Sk.builtin.bytes,this])}else if(c=this.find$subleft(b,0,this.v.length),0>c)return new Sk.builtin.tuple([this,new Sk.builtin.bytes,
new Sk.builtin.bytes]);return new Sk.builtin.tuple([new Sk.builtin.bytes(this.v.subarray(0,c)),new Sk.builtin.bytes(b),new Sk.builtin.bytes(this.v.subarray(c+b.length))])}}function n(a,b){return function(c){var d=void 0===c||c===Sk.builtin.none.none$?new Uint8Array([9,10,11,12,13,32,133]):this.get$raw(c);c=0;var e=this.v.length;if(a)for(;c<e&&d.includes(this.v[c]);)c++;if(b)for(;e>c&&d.includes(this.v[e-1]);)e--;d=new Uint8Array(e-c);for(e=0;e<d.length;e++)d[e]=this.v[e+c];return new Sk.builtin.bytes(d)}}
function k(a,b,c){return function(d,e){if(void 0===e)e=32;else if(e instanceof Sk.builtin.bytes&&1==e.v.length)e=e.v[0];else throw new Sk.builtin.TypeError(a+"() argument 2 must be a byte string of length 1, not "+Sk.abstr.typeName(e));const f=this.v.length;d=Sk.misceval.asIndexSized(d,Sk.builtin.OverflowError);if(d<=f)return new Sk.builtin.bytes(this.v);const g=new Uint8Array(d);let k,h;c?(k=Math.floor((d-f)/2),h=(d-f)%2?k+1:k):b?(k=d-f,h=0):(k=0,h=d-f);g.fill(e,0,k);for(let a=0;a<f;a++)g[a+k]=this.v[a];
g.fill(e,d-h);return new Sk.builtin.bytes(g)}}function p(a){return 9<=a&&13>=a||32===a}function u(a){return 97<=a&&122>=a}function A(a){return 65<=a&&90>=a}function t(a){return 48<=a&&57>=a}function v(a,b){return function(){return 0===this.v.length?b?Sk.builtin.bool.true$:Sk.builtin.bool.false$:this.v.every(b=>a(b))?Sk.builtin.bool.true$:Sk.builtin.bool.false$}}function B(a,b){return function(){let c=!1;for(let d=0;d<this.v.length;d++){if(b(this.v[d]))return Sk.builtin.bool.false$;!c&&a(this.v[d])&&
(c=!0)}return c?Sk.builtin.bool.true$:Sk.builtin.bool.false$}}function D(a){return function(){const b=new Uint8Array(this.v.length);for(let c=0;c<this.v.length;c++)b[c]=a(this.v[c]);return new Sk.builtin.bytes(b)}}a(30);const E={utf:"utf-8",utf8:"utf-8",utf_8:"utf-8",ascii:"ascii"};var F=/\s+/g,M=/[_-]+/g;const V=new TextEncoder,y=new TextDecoder;Sk.builtin.bytes=Sk.abstr.buildNativeClass("bytes",{constructor:function(a){if(!(this instanceof Sk.builtin.bytes))throw new TypeError("bytes is a constructor use 'new'");
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&&255>=a),"bad internal call to bytes with array"),this.v=new Uint8Array(a);else if("string"===typeof a){let b;const c=new Uint8Array(a.length),d=a.length;for(let e=0;e<d;e++){b=a.charCodeAt(e);if(255<b)throw new Sk.builtin.UnicodeDecodeError("invalid string at index "+e+" (possibly contains a unicode character)");c[e]=b}this.v=c}else if("number"===typeof a)this.v=
new Uint8Array(a);else throw new Sk.builtin.TypeError("bad argument to bytes constructor");},slots:{tp$getattr:Sk.generic.getAttr,tp$doc:"bytes(iterable_of_ints) -> bytes\nbytes(string, encoding[, errors]) -> bytes\nbytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer\nbytes(int) -> bytes object of size given by the parameter initialized with null bytes\nbytes() -> empty bytes object\n\nConstruct an immutable array of bytes from:\n  - an iterable yielding integers in range(256)\n  - a text string encoded using the specified encoding\n  - any object implementing the buffer API.\n  - an integer",
tp$new(a,c){if(this!==Sk.builtin.bytes.prototype)return this.$subtype_new(a,c);c=c||[];if(1>=a.length&&0===+c.length)a=a[0];else{[a,d,c]=Sk.abstr.copyKeywordsToNamedArgs("bytes",[null,"pySource","errors"],a,c);({encoding:d,errors:c}=b("bytes",d,c));if(!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError("encoding or errors without a string argument");return e(a,d,c)}if(void 0===a)return new Sk.builtin.bytes;if(void 0!==(c=Sk.abstr.lookupSpecial(a,Sk.builtin.str.$bytes))){var d=Sk.misceval.callsimOrSuspendArray(c,
[]);return Sk.misceval.chain(d,a=>{if(!Sk.builtin.checkBytes(a))throw new Sk.builtin.TypeError("__bytes__ returned non-bytes (type "+Sk.abstr.typeName(a)+")");return a})}if(Sk.misceval.isIndex(a)){d=Sk.misceval.asIndexSized(a,Sk.builtin.OverflowError);if(0>d)throw new Sk.builtin.ValueError("negative count");return new Sk.builtin.bytes(d)}if(Sk.builtin.checkBytes(a))return new Sk.builtin.bytes(a.v);if(Sk.builtin.checkString(a))throw new Sk.builtin.TypeError("string argument without an encoding");if(Sk.builtin.checkIterable(a)){let b=
[];d=Sk.misceval.iterFor(Sk.abstr.iter(a),a=>{a=Sk.misceval.asIndexSized(a);if(0>a||255<a)throw new Sk.builtin.ValueError("bytes must be in range(0, 256)");b.push(a)});return Sk.misceval.chain(d,()=>new Sk.builtin.bytes(b))}throw new Sk.builtin.TypeError("cannot convert '"+Sk.abstr.typeName(d)+"' object into bytes");},$r(){let a,b="'";const c=-1!==this.v.indexOf(34);let d="";for(let e=0;e<this.v.length;e++)if(a=this.v[e],9>a||10<a&&13>a||13<a&&32>a||126<a)d+=f(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:c?d+="\\'":(d+="'",b='"');break;case 92:d+="\\\\"}else d+=String.fromCharCode(a);return new Sk.builtin.str("b"+b+d+b)},tp$str(){return this.$r()},tp$iter(){return new G(this)},tp$richcompare(a,b){if(this===a&&Sk.misceval.opAllowsEquality(b))return!0;if(!(a instanceof Sk.builtin.bytes))return Sk.builtin.NotImplemented.NotImplemented$;const c=this.v;a=a.v;if(c.length!==a.length&&("Eq"===b||"NotEq"===b))return"Eq"===
b?!1:!0;let d;const e=Math.min(c.length,a.length);for(d=0;d<e&&c[d]===a[d];d++);switch(b){case "Lt":return d===e&&c.length<a.length||c[d]<a[d];case "LtE":return d===e&&c.length<=a.length||c[d]<=a[d];case "Eq":return d===e;case "NotEq":return d<e;case "Gt":return d===e&&c.length>a.length||c[d]>a[d];case "GtE":return d===e&&c.length>=a.length||c[d]>=a[d]}},tp$hash(){return(new Sk.builtin.str(this.$jsstr())).tp$hash()},tp$as_sequence_or_mapping:!0,mp$subscript(a){if(Sk.misceval.isIndex(a)){let b=Sk.misceval.asIndexSized(a,
Sk.builtin.IndexError);if(void 0!==b){0>b&&(b=this.v.length+b);if(0>b||b>=this.v.length)throw new Sk.builtin.IndexError("index out of range");return new Sk.builtin.int_(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.bytes(new Uint8Array(b))}throw new Sk.builtin.TypeError("byte indices must be integers or slices, not "+Sk.abstr.typeName(a));},sq$length(){return this.v.length},sq$concat(a){if(!(a instanceof Sk.builtin.bytes))throw new Sk.builtin.TypeError("can't concat "+
Sk.abstr.typeName(a)+" to bytes");const b=new Uint8Array(this.v.length+a.v.length);let c;for(c=0;c<this.v.length;c++)b[c]=this.v[c];for(let d=0;d<a.v.length;d++,c++)b[c]=a.v[d];return new Sk.builtin.bytes(b)},sq$repeat(a){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.asIndexSized(a,Sk.builtin.OverflowError);const b=a*this.v.length;if(b>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.OverflowError;if(0>=
a)return new Sk.builtin.bytes;a=new Uint8Array(b);let c=0;for(;c<b;)for(let b=0;b<this.v.length;b++)a[c++]=this.v[b];return new Sk.builtin.bytes(a)},sq$contains(a){return-1!==this.find$left(a)},tp$as_number:!0,nb$remainder:Sk.builtin.str.prototype.nb$remainder},proto:{$jsstr(){let a="";for(let b=0;b<this.v.length;b++)a+=String.fromCharCode(this.v[b]);return a},get$tgt(a){if(a instanceof Sk.builtin.bytes)return a.v;a=Sk.misceval.asIndexOrThrow(a,"argument should be integer or bytes-like object, not {tp$name}");
if(0>a||255<a)throw new Sk.builtin.ValueError("bytes must be in range(0, 256)");return a},get$raw(a){if(a instanceof Sk.builtin.bytes)return a.v;throw new Sk.builtin.TypeError("a bytes-like object is required, not '"+Sk.abstr.typeName(a)+"'");},get$splitArgs:function(a,b){b=Sk.misceval.asIndexSized(b,Sk.builtin.OverflowError);b=0>b?Infinity:b;a=Sk.builtin.checkNone(a)?null:this.get$raw(a);if(null!==a&&!a.length)throw new Sk.builtin.ValueError("empty separator");return{sep:a,maxsplit:b}},find$left:d(!1),
find$right:d(!0),find$subleft:function(a,b,c){c=c-a.length+1;let d=b;for(;d<c;){if(a.every((a,b)=>a===this.v[d+b]))return d;d++}return-1},find$subright(a,b,c){let d=c-a.length;for(;d>=b;){if(a.every((a,b)=>a===this.v[d+b]))return d;d--}return-1},$subtype_new(a,b){const c=new this.constructor;a=Sk.builtin.bytes.prototype.tp$new(a,b);c.v=a.v;return c},sk$asarray(){const a=[];this.v.forEach(b=>{a.push(new Sk.builtin.int_(b))});return a}},flags:{str$encode:e,$decode:l,check$encodeArgs:b},methods:{__getnewargs__:{$meth(){return new Sk.builtin.tuple(new Sk.builtin.bytes(this.v))},
$flags:{NoArgs:!0},$textsig:null,$doc:null},capitalize:{$meth(){const a=this.v.length;if(0===a)return new Sk.builtin.bytes(this.v);const b=new Uint8Array(a);let c=this.v[0];b[0]=u(c)?c-32:c;for(let d=1;d<a;d++)c=this.v[d],b[d]=A(c)?c+32:c;return new Sk.builtin.bytes(b)},$flags:{NoArgs:!0},$textsig:null,$doc:"B.capitalize() -> copy of B\n\nReturn a copy of B with only its first character capitalized (ASCII)\nand the rest lower-cased."},center:{$meth:k("center",!1,!0),$flags:{MinArgs:1,MaxArgs:2},$textsig:null,
$doc:"B.center(width[, fillchar]) -> copy of B\n\nReturn B centered in a string of length width.  Padding is\ndone using the specified fill character (default is a space)."},count:{$meth(a,b,c){a=this.get$tgt(a);({start:b,end:c}=Sk.builtin.slice.startEnd$wrt(this,b,c));let d=0;if("number"===typeof a)for(;b<c;b++)this.v[b]===a&&d++;else{c=c-a.length+1;for(let e=b;e<c;e++)a.every((a,b)=>a===this.v[e+b])&&(d++,e+=a.length-1)}return new Sk.builtin.int_(d)},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.count(sub[, start[, end]]) -> int\n\nReturn the number of non-overlapping occurrences of subsection sub in\nbytes B[start:end].  Optional arguments start and end are interpreted\nas in slice notation."},
decode:{$meth:l,$flags:{NamedArgs:["encoding","errors"]},$textsig:"($self, /, encoding='utf-8', errors='strict')",$doc:"Decode the bytes using the codec registered for encoding.\n\n  encoding\n    The encoding with which to decode the bytes.\n  errors\n    The error handling scheme to use for the handling of decoding errors.\n    The default is 'strict' meaning that decoding errors raise a\n    UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n    as well as any other name registered with codecs.register_error that\n    can handle UnicodeDecodeErrors."},
endswith:{$meth:h("endswith",(a,b)=>{const c=a.length-b.length;return 0<=c&&b.every((b,d)=>b===a[c+d])}),$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.endswith(suffix[, start[, end]]) -> bool\n\nReturn True if B ends with the specified suffix, False otherwise.\nWith optional start, test B beginning at that position.\nWith optional end, stop comparing B at that position.\nsuffix can also be a tuple of bytes to try."},expandtabs:{$meth(a){a=Sk.misceval.asIndexSized(a,Sk.builtin.OverflowError,"an integer is required (got type {tp$nam})");
const b=[];let c=0;for(let e=0;e<this.v.length;e++){var d=this.v[e];9===d?(d=a-c%a,b.push(...Array(d).fill(32)),c+=d):10===d||13===d?(b.push(d),c=0):(b.push(d),c++)}return new Sk.builtin.bytes(new Uint8Array(b))},$flags:{NamedArgs:["tabsize"],Defaults:[8]},$textsig:null,$doc:"B.expandtabs(tabsize=8) -> copy of B\n\nReturn a copy of B where all tab characters are expanded using spaces.\nIf tabsize is not given, a tab size of 8 characters is assumed."},find:{$meth:function(a,b,c){return new Sk.builtin.int_(this.find$left(a,
b,c))},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.find(sub[, start[, end]]) -> int\n\nReturn the lowest index in B where subsection sub is found,\nsuch that sub is contained within B[start,end].  Optional\narguments start and end are interpreted as in slice notation.\n\nReturn -1 on failure."},hex:{$meth(){let a="";for(let b=0;b<this.v.length;b++)a+=this.v[b].toString(16).padStart(2,"0");return new Sk.builtin.str(a)},$flags:{NoArgs:!0},$textsig:null,$doc:"B.hex() -> string\n\nCreate a string of hexadecimal numbers from a bytes object.\nExample: b'\\xb9\\x01\\xef'.hex() -> 'b901ef'."},
index:{$meth:function(a,b,c){a=this.find$left(a,b,c);if(-1===a)throw new Sk.builtin.ValueError("subsection not found");return new Sk.builtin.int_(a)},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.index(sub[, start[, end]]) -> int\n\nReturn the lowest index in B where subsection sub is found,\nsuch that sub is contained within B[start,end].  Optional\narguments start and end are interpreted as in slice notation.\n\nRaises ValueError when the subsection is not found."},isalnum:{$meth:v(a=>t(a)||
u(a)||A(a)),$flags:{NoArgs:!0},$textsig:null,$doc:"B.isalnum() -> bool\n\nReturn True if all characters in B are alphanumeric\nand there is at least one character in B, False otherwise."},isalpha:{$meth:v(a=>65<=a&&90>=a||97<=a&&122>=a),$flags:{NoArgs:!0},$textsig:null,$doc:"B.isalpha() -> bool\n\nReturn True if all characters in B are alphabetic\nand there is at least one character in B, False otherwise."},isascii:{$meth:v(a=>0<=a&&127>=a,!0),$flags:{NoArgs:!0},$textsig:null,$doc:"B.isascii() -> bool\n\nReturn True if B is empty or all characters in B are ASCII,\nFalse otherwise."},
isdigit:{$meth:v(t),$flags:{NoArgs:!0},$textsig:null,$doc:"B.isdigit() -> bool\n\nReturn True if all characters in B are digits\nand there is at least one character in B, False otherwise."},islower:{$meth:B(u,A),$flags:{NoArgs:!0},$textsig:null,$doc:"B.islower() -> bool\n\nReturn True if all cased characters in B are lowercase and there is\nat least one cased character in B, False otherwise."},isspace:{$meth:v(p),$flags:{NoArgs:!0},$textsig:null,$doc:"B.isspace() -> bool\n\nReturn True if all characters in B are whitespace\nand there is at least one character in B, False otherwise."},
istitle:{$meth:function(){let a=!1,b=!1;for(let c=0;c<this.v.length;c++){const d=this.v[c];if(A(d)){if(a)return Sk.builtin.bool.false$;b=a=!0}else if(u(d)){if(!a)return Sk.builtin.bool.false$;b=!0}else a=!1}return b?Sk.builtin.bool.true$:Sk.builtin.bool.false$},$flags:{NoArgs:!0},$textsig:null,$doc:"B.istitle() -> bool\n\nReturn True if B is a titlecased string and there is at least one\ncharacter in B, i.e. uppercase characters may only follow uncased\ncharacters and lowercase characters only cased ones. Return False\notherwise."},
isupper:{$meth:B(A,u),$flags:{NoArgs:!0},$textsig:null,$doc:"B.isupper() -> bool\n\nReturn True if all cased characters in B are uppercase and there is\nat least one cased character in B, False otherwise."},join:{$meth(a){const b=[];let c=0;return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(a),a=>{if(!(a instanceof Sk.builtin.bytes))throw new Sk.builtin.TypeError("sequence item "+c+": expected a bytes-like object, "+Sk.abstr.typeName(a)+" found");c++;b.length&&b.push(...this.v);b.push(...a.v)}),
()=>new Sk.builtin.bytes(new Uint8Array(b)))},$flags:{OneArg:!0},$textsig:"($self, iterable_of_bytes, /)",$doc:"Concatenate any number of bytes objects.\n\nThe bytes whose method is called is inserted in between each pair.\n\nThe result is returned as a new bytes object.\n\nExample: b'.'.join([b'ab', b'pq', b'rs']) -> b'ab.pq.rs'."},ljust:{$meth:k("ljust",!1,!1),$flags:{MinArgs:1,MaxArgs:2},$textsig:null,$doc:"B.ljust(width[, fillchar]) -> copy of B\n\nReturn B left justified in a string of length width. Padding is\ndone using the specified fill character (default is a space)."},
lower:{$meth:D(a=>A(a)?a+32:a),$flags:{NoArgs:!0},$textsig:null,$doc:"B.lower() -> copy of B\n\nReturn a copy of B with all ASCII characters converted to lowercase."},lstrip:{$meth:n(!0,!1),$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, bytes=None, /)",$doc:"Strip leading bytes contained in the argument.\n\nIf the argument is omitted or None, strip leading  ASCII whitespace."},partition:{$meth:g(!1),$flags:{OneArg:!0},$textsig:"($self, sep, /)",$doc:"Partition the bytes into three parts using the given separator.\n\nThis will search for the separator sep in the bytes. If the separator is found,\nreturns a 3-tuple containing the part before the separator, the separator\nitself, and the part after it.\n\nIf the separator is not found, returns a 3-tuple containing the original bytes\nobject and two empty bytes objects."},
replace:{$meth(a,b,c){a=this.get$raw(a);b=this.get$raw(b);c=void 0===c?-1:Sk.misceval.asIndexSized(c,Sk.builtin.OverflowError);c=0>c?Infinity:c;const d=[];let e=0;for(var f=0;f<this.v.length&&e<c;){const c=this.find$subleft(a,f,this.v.length);if(-1===c)break;for(;f<c;f++)d.push(this.v[f]);d.push(...b);f=c+a.length;e++}for(f;f<this.v.length;f++)d.push(this.v[f]);return new Sk.builtin.bytes(new Uint8Array(d))},$flags:{MinArgs:2,MaxArgs:3},$textsig:"($self, old, new, count=-1, /)",$doc:"Return a copy with all occurrences of substring old replaced by new.\n\n  count\n    Maximum number of occurrences to replace.\n    -1 (the default value) means replace all occurrences.\n\nIf the optional argument count is given, only the first count occurrences are\nreplaced."},
rfind:{$meth(a,b,c){return new Sk.builtin.int_(this.find$right(a,b,c))},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.rfind(sub[, start[, end]]) -> int\n\nReturn the highest index in B where subsection sub is found,\nsuch that sub is contained within B[start,end].  Optional\narguments start and end are interpreted as in slice notation.\n\nReturn -1 on failure."},rindex:{$meth:function(a,b,c){a=this.find$right(a,b,c);if(-1===a)throw new Sk.builtin.ValueError("subsection not found");return new Sk.builtin.int_(a)},
$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.rindex(sub[, start[, end]]) -> int\n\nReturn the highest index in B where subsection sub is found,\nsuch that sub is contained within B[start,end].  Optional\narguments start and end are interpreted as in slice notation.\n\nRaise ValueError when the subsection is not found."},rjust:{$meth:k("rjust",!0,!1),$flags:{MinArgs:1,MaxArgs:2},$textsig:null,$doc:"B.rjust(width[, fillchar]) -> copy of B\n\nReturn B right justified in a string of length width. Padding is\ndone using the specified fill character (default is a space)"},
rpartition:{$meth:g(!0),$flags:{OneArg:!0},$textsig:"($self, sep, /)",$doc:"Partition the bytes into three parts using the given separator.\n\nThis will search for the separator sep in the bytes, starting at the end. If\nthe separator is found, returns a 3-tuple containing the part before the\nseparator, the separator itself, and the part after it.\n\nIf the separator is not found, returns a 3-tuple containing two empty bytes\nobjects and the original bytes object."},rsplit:{$meth:function(a,b){({sep:a,
maxsplit:b}=this.get$splitArgs(a,b));const c=[];let d=0,e=this.v.length;if(null!==a){for(;0<=e&&d<b;){const b=this.find$subright(a,0,e);if(-1===b)break;c.push(new Sk.builtin.bytes(this.v.subarray(b+a.length,e)));e=b;d++}c.push(new Sk.builtin.bytes(this.v.subarray(0,e)))}else{for(e--;d<b;){for(;p(this.v[e]);)e--;if(0>e)break;a=e+1;for(e--;0<=e&&!p(this.v[e]);)e--;c.push(new Sk.builtin.bytes(this.v.subarray(e+1,a)));d++}if(0<=e){for(;p(this.v[e]);)e--;0<=e&&c.push(new Sk.builtin.bytes(this.v.subarray(0,
e+1)))}}return new Sk.builtin.list(c.reverse())},$flags:{NamedArgs:["sep","maxsplit"],Defaults:[Sk.builtin.none.none$,-1]},$textsig:"($self, /, sep=None, maxsplit=-1)",$doc:"Return a list of the sections in the bytes, using sep as the delimiter.\n\n  sep\n    The delimiter according which to split the bytes.\n    None (the default value) means split on ASCII whitespace characters\n    (space, tab, return, newline, formfeed, vertical tab).\n  maxsplit\n    Maximum number of splits to do.\n    -1 (the default value) means no limit.\n\nSplitting is done starting at the end of the bytes and working to the front."},
rstrip:{$meth:n(!1,!0),$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, bytes=None, /)",$doc:"Strip trailing bytes contained in the argument.\n\nIf the argument is omitted or None, strip trailing ASCII whitespace."},split:{$meth:function(a,b){({sep:a,maxsplit:b}=this.get$splitArgs(a,b));const c=[],d=this.v.length;let e=0,f=0;if(null!==a){for(;f<d&&e<b;){const b=this.find$subleft(a,f,d);if(-1===b)break;c.push(new Sk.builtin.bytes(this.v.subarray(f,b)));f=b+a.length;e++}c.push(new Sk.builtin.bytes(this.v.subarray(f,
d)))}else{for(;e<b;){for(;p(this.v[f]);)f++;if(f===d)break;a=f;for(f++;f<d&&!p(this.v[f]);)f++;c.push(new Sk.builtin.bytes(this.v.subarray(a,f)));e++}if(f<d){for(;p(this.v[f]);)f++;f<d&&c.push(new Sk.builtin.bytes(this.v.subarray(f,d)))}}return new Sk.builtin.list(c)},$flags:{NamedArgs:["sep","maxsplit"],Defaults:[Sk.builtin.none.none$,-1]},$textsig:"($self, /, sep=None, maxsplit=-1)",$doc:"Return a list of the sections in the bytes, using sep as the delimiter.\n\n  sep\n    The delimiter according which to split the bytes.\n    None (the default value) means split on ASCII whitespace characters\n    (space, tab, return, newline, formfeed, vertical tab).\n  maxsplit\n    Maximum number of splits to do.\n    -1 (the default value) means no limit."},
splitlines:{$meth(a){a=Sk.misceval.isTrue(a);const b=[];let c=0;let d=0;const e=this.v.length;for(;d<e;){var f=this.v[d];if(13===f){const e=10===this.v[d+1];f=a?e?d+2:d+1:d;b.push(new Sk.builtin.bytes(this.v.subarray(c,f)));d=c=e?d+2:d+1}else 10===f?(f=a?d+1:d,b.push(new Sk.builtin.bytes(this.v.subarray(c,f))),d=c=d+1):d++}c<e&&b.push(new Sk.builtin.bytes(this.v.subarray(c,e)));return new Sk.builtin.list(b)},$flags:{NamedArgs:["keepends"],Defaults:[!1]},$textsig:"($self, /, keepends=False)",$doc:"Return a list of the lines in the bytes, breaking at line boundaries.\n\nLine breaks are not included in the resulting list unless keepends is given and\ntrue."},
startswith:{$meth:h("startswith",(a,b)=>b.length<=a.length&&b.every((b,c)=>b===a[c])),$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.startswith(prefix[, start[, end]]) -> bool\n\nReturn True if B starts with the specified prefix, False otherwise.\nWith optional start, test B beginning at that position.\nWith optional end, stop comparing B at that position.\nprefix can also be a tuple of bytes to try."},strip:{$meth:n(!0,!0),$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, bytes=None, /)",$doc:"Strip leading and trailing bytes contained in the argument.\n\nIf the argument is omitted or None, strip leading and trailing ASCII whitespace."},
swapcase:{$meth:D(a=>A(a)?a+32:u(a)?a-32:a),$flags:{NoArgs:!0},$textsig:null,$doc:"B.swapcase() -> copy of B\n\nReturn a copy of B with uppercase ASCII characters converted\nto lowercase ASCII and vice versa."},title:{$meth(){const a=this.v.length,b=new Uint8Array(a);let c=!1;for(let d=0;d<a;d++){const a=this.v[d];A(a)?(b[d]=c?a+32:a,c=!0):u(a)?(b[d]=c?a:a-32,c=!0):(b[d]=a,c=!1)}return new Sk.builtin.bytes(b)},$flags:{NoArgs:!0},$textsig:null,$doc:"B.title() -> copy of B\n\nReturn a titlecased version of B, i.e. ASCII words start with uppercase\ncharacters, all remaining cased characters have lowercase."},
upper:{$meth:D(a=>u(a)?a-32:a),$flags:{NoArgs:!0},$textsig:null,$doc:"B.upper() -> copy of B\n\nReturn a copy of B with all ASCII characters converted to uppercase."},zfill:{$meth(a){a=Sk.misceval.asIndexSized(a,Sk.builtin.IndexError);const b=a-this.v.length;if(0>=b)return new Sk.builtin.bytes(this.v);const c=new Uint8Array(a);let d=0,e;if(43===this.v[0]||45===this.v[0])c[0]=this.v[0],d++;c.fill(48,d,d+b);e=d;for(d+=b;d<a;d++,e++)c[d]=this.v[e];return new Sk.builtin.bytes(c)},$flags:{OneArg:!0},$textsig:null,
$doc:"B.zfill(width) -> copy of B\n\nPad a numeric string B with zeros on the left, to fill a field\nof the specified width.  B is never truncated."}},classmethods:{fromhex:{$meth:function(a){function b(b){for(let c=f;c<b;c+=2){let b=a.substr(c,2);if(!d.test(b))throw new Sk.builtin.ValueError("non-hexadecimal number found in fromhex() arg at position "+(c+1));e.push(parseInt(b,16))}}if(!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError("fromhex() argument must be str, not "+Sk.abstr.typeName(a));
a=a.$jsstr();const c=/\s+/g,d=/^[abcdefABCDEF0123456789]{2}$/,e=[];let f=0,g;for(;null!==(g=c.exec(a));)b(g.index),f=c.lastIndex;b(a.length);return new this(e)},$flags:{OneArg:!0},$textsig:"($type, string, /)",$doc:"Create a bytes object from a string of hexadecimal numbers.\n\nSpaces between two numbers are accepted.\nExample: bytes.fromhex('B9 01EF') -> b'\\\\xb9\\\\x01\\\\xef'."}}});var G=Sk.abstr.buildIteratorClass("bytes_iterator",{constructor:function(a){this.$index=0;this.$seq=a.v},iternext(){const a=
this.$seq[this.$index++];if(void 0!==a)return new Sk.builtin.int_(a)},methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},flags:{sk$acceptable_as_base_class:!1}});Sk.exportSymbol("Sk.builtin.bytes",Sk.builtin.bytes)},function(m,q,a){(function(a){(function(a){function b(){}function c(){}var l=String.fromCharCode,h={}.toString,d=h.call(a.SharedArrayBuffer),g=h(),n=a.Uint8Array,k=n||Array,p=n?ArrayBuffer:k,u=p.isView||function(a){return a&&"length"in a},A=h.call(p.prototype);p=c.prototype;
var t=a.TextEncoder,m=new (n?Uint16Array:k)(32);b.prototype.decode=function(a){if(!u(a)){var b=h.call(a);if(b!==A&&b!==d&&b!==g)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");a=n?new k(a):a||[]}for(var c=b="",e=0,f=a.length|0,p=f-32|0,B,t,v=0,q=0,P,Q=0,U=-1;e<f;){for(B=e<=p?32:f-e|0;Q<B;e=e+1|0,Q=Q+1|0){t=a[e]&255;switch(t>>4){case 15:P=a[e=e+1|0]&255;if(2!==P>>6||247<t){e=e-1|0;break}v=(t&7)<<6|P&63;q=5;t=256;case 14:P=
a[e=e+1|0]&255,v<<=6,v|=(t&15)<<6|P&63,q=2===P>>6?q+4|0:24,t=t+256&768;case 13:case 12:P=a[e=e+1|0]&255,v<<=6,v|=(t&31)<<6|P&63,q=q+7|0,e<f&&2===P>>6&&v>>q&&1114112>v?(t=v,v=v-65536|0,0<=v&&(U=(v>>10)+55296|0,t=(v&1023)+56320|0,31>Q?(m[Q]=U,Q=Q+1|0,U=-1):(P=U,U=t,t=P))):(t>>=8,e=e-t-1|0,t=65533),v=q=0,B=e<=p?32:f-e|0;default:m[Q]=t;continue;case 11:case 10:case 9:case 8:}m[Q]=65533}c+=l(m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7],m[8],m[9],m[10],m[11],m[12],m[13],m[14],m[15],m[16],m[17],m[18],m[19],m[20],
m[21],m[22],m[23],m[24],m[25],m[26],m[27],m[28],m[29],m[30],m[31]);32>Q&&(c=c.slice(0,Q-32|0));if(e<f){if(m[0]=U,Q=~U>>>31,U=-1,c.length<b.length)continue}else-1!==U&&(c+=l(U));b+=c;c=""}return b};p.encode=function(a){a=void 0===a?"":""+a;var b=a.length|0,c=new k((b<<1)+8|0),d,e=0,f=!n;for(d=0;d<b;d=d+1|0,e=e+1|0){var g=a.charCodeAt(d)|0;if(127>=g)c[e]=g;else{if(2047>=g)c[e]=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){c[e]=240|g>>18;c[e=e+1|0]=128|g>>12&63;c[e=e+1|0]=128|g>>6&63;c[e=e+1|0]=128|g&63;continue}break a}g=65533}else 57343>=g&&(g=65533);!f&&d<<1<e&&d<<1<(e-7|0)&&(f=!0,h=new k(3*b),h.set(c),c=h)}c[e]=224|g>>12;c[e=e+1|0]=128|g>>6&63}c[e=e+1|0]=128|g&63}}return n?c.subarray(0,e):c.slice(0,e)};t||(a.TextDecoder=b,a.TextEncoder=c)})("undefined"==typeof a?"undefined"==typeof self?this:self:a)}).call(this,a(0))},function(m,q){Sk.builtin.tuple=Sk.abstr.buildNativeClass("tuple",{constructor:function(a){void 0===
a?a=[]:Array.isArray(a)||(a=Sk.misceval.arrayFromIterable(a));Sk.asserts.assert(this instanceof Sk.builtin.tuple,"bad call to tuple, use 'new' with an Array of python objects");this.v=a;this.in$repr=!1},slots:{tp$getattr:Sk.generic.getAttr,tp$as_sequence_or_mapping:!0,tp$doc:"Built-in immutable sequence.\n\nIf no argument is given, the constructor returns an empty tuple.\nIf iterable is specified the tuple is initialized from iterable's items.\n\nIf the argument is a tuple, the return value is the same object.",
$r(){if(this.in$repr)return new Sk.builtin.str("(...)");this.in$repr=!0;let a=this.v.map(a=>Sk.misceval.objectRepr(a));this.in$repr=!1;a=a.join(", ");1===this.v.length&&(a+=",");return new Sk.builtin.str("("+a+")")},tp$new(a,b){if(this!==Sk.builtin.tuple.prototype)return this.$subtype_new(a,b);Sk.abstr.checkNoKwargs("tuple",b);Sk.abstr.checkArgsLen("tuple",a,0,1);a=a[0];return void 0===a?new Sk.builtin.tuple([]):a.constructor===Sk.builtin.tuple?a:Sk.misceval.chain(Sk.misceval.arrayFromIterable(a,
!0),a=>new Sk.builtin.tuple(a))},tp$hash(){let a,b=3430008,e=1000003;const f=this.v.length;for(let c=0;c<f;++c){a=Sk.abstr.objectHash(this.v[c]);if(-1===a)return-1;b=(b^a)*e;e+=82520+f+f}b+=97531;-1===b&&(b=-2);return b|0},tp$richcompare:Sk.generic.seqCompare,tp$iter(){return new a(this)},mp$subscript(a){if(Sk.misceval.isIndex(a)){a=Sk.misceval.asIndexSized(a);0>a&&(a=this.v.length+a);if(0>a||a>=this.v.length)throw new Sk.builtin.IndexError("tuple index out of range");return this.v[a]}if(a instanceof
Sk.builtin.slice){const b=[];a.sssiter$(this.v.length,a=>{b.push(this.v[a])});return new Sk.builtin.tuple(b)}throw new Sk.builtin.TypeError("tuple indices must be integers or slices, not "+Sk.abstr.typeName(a));},sq$length(){return this.v.length},sq$repeat(a){a=Sk.misceval.asIndexSized(a,Sk.builtin.OverflowError);if(1===a&&this.constructor===Sk.builtin.tuple)return this;const b=[];for(let c=0;c<a;c++)for(let a=0;a<this.v.length;a++)b.push(this.v[a]);return new Sk.builtin.tuple(b)},sq$concat(a){if(!(a instanceof
Sk.builtin.tuple))throw new Sk.builtin.TypeError("can only concatenate tuple (not '"+Sk.abstr.typeName(a)+"') to tuple");return new Sk.builtin.tuple(this.v.concat(a.v))},sq$contains(a){for(let b=this.tp$iter(),c=b.tp$iternext();void 0!==c;c=b.tp$iternext())if(c===a||Sk.misceval.richCompareBool(c,a,"Eq"))return!0;return!1}},proto:{$subtype_new(a,b){b=new this.constructor;a=Sk.builtin.tuple.prototype.tp$new(a);b.v=a.v;return b},sk$asarray(){return this.v.slice(0)}},methods:{__getnewargs__:{$meth(){return new Sk.builtin.tuple(this.v.slice(0))},
$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:null},index:{$meth(a,b,e){if(void 0!==b&&!Sk.misceval.isIndex(b)||void 0!==e&&!Sk.misceval.isIndex(e))throw new Sk.builtin.TypeError("slice indices must be integers or have an __index__ method");({start:b,end:e}=Sk.builtin.slice.startEnd$wrt(this,b,e));const c=this.v;for(;b<e;b++)if(c[b]===a||Sk.misceval.richCompareBool(c[b],a,"Eq"))return new Sk.builtin.int_(b);throw new Sk.builtin.ValueError("tuple.index(x): x not in tuple");},$flags:{MinArgs:1,MaxArgs:3},
$textsig:"($self, value, start=0, stop=sys.maxsize, /)",$doc:"Return first index of value.\n\nRaises ValueError if the value is not present."},count:{$meth(a){const b=this.v.length,c=this.v;let f=0;for(let e=0;e<b;++e)if(c[e]===a||Sk.misceval.richCompareBool(c[e],a,"Eq"))f+=1;return new Sk.builtin.int_(f)},$flags:{OneArg:!0},$textsig:"($self, value, /)",$doc:"Return number of occurrences of value."}}});Sk.exportSymbol("Sk.builtin.tuple",Sk.builtin.tuple);var a=Sk.abstr.buildIteratorClass("tuple_iterator",
{constructor:function(a){this.$index=0;this.$seq=a.sk$asarray()},iternext:Sk.generic.iterNextWithArray,methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},flags:{sk$acceptable_as_base_class:!1}})},function(m,q){function a(a){let b=a.$savedKeyHash;return void 0!==b?b:b=Sk.abstr.objectHash(a)}function c(a){return new Sk.builtin.set(Sk.misceval.arrayFromIterable(a))}function b(a,b){for(let c=Sk.abstr.iter(a),d=c.tp$iternext();void 0!==d;d=c.tp$iternext())if(!Sk.abstr.sequenceContains(b,
d))return!1;return!0}function e(a,b,d){const e={constructor:function(a){if(1!==arguments.length)throw new Sk.builtin.TypeError("cannot create '"+Sk.abstr.typeName(this)+"' instances");this.dict=a;this.in$repr=!1}};e.slots=Object.assign(b,h);e.methods={isdisjoint:{$meth(a){const b=c(this);return b.isdisjoint.$meth.call(b,a)},$flags:{OneArg:!0},$textsig:null,$doc:"Return True if the view and the given iterable have a null intersection."},__reversed__:{$meth:d,$flags:{NoArgs:!0},$textsig:null,$doc:"Return a reverse iterator over the dict keys."}};
e.flags={sk$acceptable_as_base:!1};"dict_values"===a&&(delete e.slots.tp$as_number,delete e.slots.tp$richcompare);return Sk.abstr.buildNativeClass(a,e)}function f(a,b,c){return Sk.abstr.buildIteratorClass(a,{constructor:function(a){this.$index=0;this.$orig=a;this.tp$iternext=()=>{this.$seq=a.$items();this.$version=a.$version;c&&(this.$seq=this.$seq.reverse());this.tp$iternext=this.constructor.prototype.tp$iternext;return this.tp$iternext()}},iternext:b,methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},
flags:{sk$acceptable_as_base_class:!1},proto:{next$item:l}})}function l(){if(this.$version!==this.$orig.$version){if(this.$len!==this.$orig.get$size())throw new Sk.builtin.RuntimeError("dict changed size during iteration");throw new Sk.builtin.RuntimeError("dictionary keys changed during iteration");}return this.$seq[this.$index++]}Sk.builtin.dict=Sk.abstr.buildNativeClass("dict",{constructor:function(a){void 0===a&&(a=[]);Sk.asserts.assert(Array.isArray(a)&&0===a.length%2&&this instanceof Sk.builtin.dict,
"bad call to dict constructor");this.size=0;this.entries=Object.create(null);this.buckets={};for(let b=0;b<a.length;b+=2)this.set$item(a[b],a[b+1]);this.in$repr=!1;this.$version=0},slots:{tp$getattr:Sk.generic.getAttr,tp$as_sequence_or_mapping:!0,tp$as_number:!0,tp$hash:Sk.builtin.none.none$,tp$doc:"dict() -> new empty dictionary\ndict(mapping) -> new dictionary initialized from a mapping object's\n    (key, value) pairs\ndict(iterable) -> new dictionary initialized as if via:\n    d = {}\n    for k, v in iterable:\n        d[k] = v\ndict(**kwargs) -> new dictionary initialized with the name=value pairs\n    in the keyword argument list.  For example:  dict(one=1, two=2)",
$r(){if(this.in$repr)return new Sk.builtin.str("{...}");this.in$repr=!0;const a=this.$items().map(([a,b])=>Sk.misceval.objectRepr(a)+": "+Sk.misceval.objectRepr(b));this.in$repr=!1;return new Sk.builtin.str("{"+a.join(", ")+"}")},tp$new:Sk.generic.new,tp$init(a,b){return this.update$common(a,b,"dict")},tp$iter(){return new k(this)},tp$richcompare(a,b){let c;if(!(a instanceof Sk.builtin.dict)||"Eq"!==b&&"NotEq"!==b)return Sk.builtin.NotImplemented.NotImplemented$;if(a===this)c=!0;else if(this.size!==
a.size)c=!1;else{let b;c=this.$items().every(([c,d])=>{b=a.mp$lookup(c);return void 0!==b&&(b===d||Sk.misceval.richCompareBool(d,b,"Eq"))})}return"Eq"===b?c:!c},nb$or(a){if(!(a instanceof Sk.builtin.dict))return Sk.builtin.NotImplemented.NotImplemented$;const b=this.dict$copy();b.dict$merge(a);return b},nb$reflected_or(a){if(!(a instanceof Sk.builtin.dict))return Sk.builtin.NotImplemented.NotImplemented$;a=a.dict$copy();a.dict$merge(this);return a},nb$inplace_or(a){return Sk.misceval.chain(this.update$onearg(a),
()=>this)},sq$length(){return this.get$size()},sq$contains(a){return void 0!==this.mp$lookup(a)},mp$subscript(a,b){var c=this.mp$lookup(a);if(void 0!==c)return c;c=Sk.abstr.lookupSpecial(this,Sk.builtin.str.$missing);if(void 0!==c)return a=Sk.misceval.callsimOrSuspendArray(c,[a]),b?a:Sk.misceval.retryOptionalSuspensionOrThrow(a);throw new Sk.builtin.KeyError(a);},mp$ass_subscript(a,b){if(void 0===b){if(void 0===this.pop$item(a))throw new Sk.builtin.KeyError(a);}else this.set$item(a,b)}},methods:{__reversed__:{$meth(){return new A(this)},
$flags:{NoArgs:!0},$textsig:null,$doc:"Return a reverse iterator over the dict keys."},get:{$meth(a,b){return this.mp$lookup(a)||b||Sk.builtin.none.none$},$flags:{MinArgs:1,MaxArgs:2},$textsig:"($self, key, default=None, /)",$doc:"Return the value for key if key is in the dictionary, else default."},setdefault:{$meth(b,c){let d;const e=a(b);d="string"===typeof e?this.entries[e]:this.get$bucket_item(b,e);if(void 0!==d)return d[1];c=c||Sk.builtin.none.none$;"string"===typeof e?this.entries[e]=[b,c]:
this.set$bucket_item(b,c,e);this.size++;this.$version++;return c},$flags:{MinArgs:1,MaxArgs:2},$textsig:"($self, key, default=None, /)",$doc:"Insert key with a value of default if key is not in the dictionary.\n\nReturn the value for key if key is in the dictionary, else default."},pop:{$meth(a,b){const c=this.pop$item(a);if(void 0!==c)return c[1];if(void 0!==b)return b;throw new Sk.builtin.KeyError(a);},$flags:{MinArgs:1,MaxArgs:2},$textsig:null,$doc:"D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\nIf key is not found, d is returned if given, otherwise KeyError is raised"},
popitem:{$meth(){const a=this.get$size();if(0===a)throw new Sk.builtin.KeyError("popitem(): dictionary is empty");const [b,c]=this.$items()[a-1];this.pop$item(b);return new Sk.builtin.tuple([b,c])},$flags:{NoArgs:!0},$textsig:null,$doc:"D.popitem() -> (k, v), remove and return some (key, value) pair as a\n2-tuple; but raise KeyError if D is empty."},keys:{$meth(){return new d(this)},$flags:{NoArgs:!0},$textsig:null,$doc:"D.keys() -> a set-like object providing a view on D's keys"},items:{$meth(){return new n(this)},
$flags:{NoArgs:!0},$textsig:null,$doc:"D.items() -> a set-like object providing a view on D's items"},values:{$meth(){return new g(this)},$flags:{NoArgs:!0},$textsig:null,$doc:"D.values() -> an object providing a view on D's values"},update:{$meth(a,b){return Sk.misceval.chain(this.update$common(a,b,"update"),()=>Sk.builtin.none.none$)},$flags:{FastCall:!0},$textsig:null,$doc:"D.update([E, ]**F) -> None.  Update D from dict/iterable E and F.\nIf E is present and has a .keys() method, then does:  for k in E: D[k] = E[k]\nIf E is present and lacks a .keys() method, then does:  for k, v in E: D[k] = v\nIn either case, this is followed by: for k in F:  D[k] = F[k]"},
clear:{$meth(){this.size=0;this.$version++;this.entries=Object.create(null);this.buckets={}},$flags:{NoArgs:!0},$textsig:null,$doc:"D.clear() -> None.  Remove all items from D."},copy:{$meth(){return this.dict$copy()},$flags:{NoArgs:!0},$textsig:null,$doc:"D.copy() -> a shallow copy of D"}},classmethods:{fromkeys:{$meth:function(a,b){b=b||Sk.builtin.none.none$;let c=this===Sk.builtin.dict?new this:this.tp$call([],[]);return Sk.misceval.chain(c,d=>{c=d;return Sk.misceval.iterFor(Sk.abstr.iter(a),a=>
c.mp$ass_subscript(a,b,!0))},()=>c)},$flags:{MinArgs:1,MaxArgs:2},$textsig:"($type, iterable, value=None, /)",$doc:"Create a new dictionary with keys from iterable and values set to value."}},proto:{quick$lookup:function(a){a=this.entries[a.$savedKeyHash];if(void 0!==a)return a[1]},mp$lookup:function(b){const c=a(b);b="string"===typeof c?this.entries[c]:this.get$bucket_item(b,c);if(void 0!==b)return b[1]},get$size(){return this.size},sk$asarray(){return Object.values(this.entries).map(a=>a[0])},update$common:function(a,
b,c){Sk.abstr.checkArgsLen(c,a,0,1);a=a[0];let d;void 0!==a&&(d=this.update$onearg(a));return Sk.misceval.chain(d,()=>{if(b)for(let a=0;a<b.length;a+=2)this.set$item(new Sk.builtin.str(b[a]),b[a+1])})},update$onearg(a){return a instanceof Sk.builtin.dict||void 0!==Sk.abstr.lookupSpecial(a,Sk.builtin.str.$keys)?this.dict$merge(a):this.dict$merge_seq(a)},dict$copy(){const a=new Sk.builtin.dict([]);a.size=this.size;var b=Object.entries(this.entries);for(var c in b){var d=b[c][1];a.entries[b[c][0]]=[d[0],
d[1]]}for(let e in this.buckets)for(c=this.buckets[e],a.buckets[e]=b=[],d=0;d<c.length;d++)b.push(a.entries["#"+e+"_"+d]);return a},$items(){return Object.values(this.entries)},set$item:function(b,c){const d=a(b);let e;"string"===typeof d?(e=this.entries[d],void 0===e?(this.entries[d]=[b,c],this.size++,this.$version++):e[1]=c):(e=this.get$bucket_item(b,d),void 0===e?(this.set$bucket_item(b,c,d),this.size++,this.$version++):e[1]=c)},get$bucket_item:function(a,b){b=this.buckets[b];if(void 0!==b)for(let d=
0;d<b.length;d++){var c=b[d];if(void 0!==c&&(c[0]===a||Sk.misceval.richCompareBool(a,c[0],"Eq")))return c}},pop$bucket_item:function(a,b){const c=this.buckets[b];let d;if(void 0!==c)for(let e=0;e<c.length;e++)if(d=c[e],void 0!==d&&(d[0]===a||Sk.misceval.richCompareBool(a,d[0],"Eq")))return delete this.entries["#"+b+"_"+e],c[e]=void 0,c.every(a=>void 0===a)&&delete this.buckets[b],d},set$bucket_item:function(a,b,c){let d=this.buckets[c];a=[a,b];void 0===d?(this.buckets[c]=[a],c="#"+c+"_0"):(b=d.indexOf(void 0),
-1!==b?(c="#"+c+"_"+b,d[b]=a):(c="#"+c+"_"+d.length,d.push(a)));this.entries[c]=a},pop$item:function(b){const c=a(b);"string"===typeof c?(b=this.entries[c],delete this.entries[c]):b=this.pop$bucket_item(b,c);if(void 0!==b)return this.size--,this.$version++,b},dict$merge:function(a){if(a.tp$iter===Sk.builtin.dict.prototype.tp$iter){var b=a.tp$iter();for(let c=b.tp$iternext();void 0!==c;c=b.tp$iternext()){const b=a.mp$subscript(c);this.set$item(c,b)}}else return b=Sk.abstr.lookupSpecial(a,Sk.builtin.str.$keys),
Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(b,[]),b=>Sk.misceval.iterFor(Sk.abstr.iter(b),b=>Sk.misceval.chain(a.mp$subscript(b,!0),a=>{this.set$item(b,a)})))},dict$merge_seq:function(a){let b=0;return Sk.misceval.iterFor(Sk.abstr.iter(a),a=>{if(!Sk.builtin.checkIterable(a))throw new Sk.builtin.TypeError("cannot convert dictionary update sequence element #"+b+" to a sequence");a=Sk.misceval.arrayFromIterable(a);if(2!==a.length)throw new Sk.builtin.ValueError("dictionary update sequence element #"+
b+" has length "+a.length+"; 2 is required");this.set$item(a[0],a[1]);b++})}}});const h={tp$getattr:Sk.generic.getAttr,tp$as_number:!0,tp$as_sequence_or_mapping:!0,tp$hash:Sk.builtin.none.none$,$r(){if(this.in$repr)return new Sk.builtin.str("...");this.in$repr=!0;let a=Sk.misceval.arrayFromIterable(this);a=a.map(a=>Sk.misceval.objectRepr(a));this.in$repr=!1;return new Sk.builtin.str(Sk.abstr.typeName(this)+"(["+a.join(", ")+"])")},tp$richcompare(a,c){if(!(Sk.builtin.checkAnySet(a)||a instanceof d||
a instanceof n))return Sk.builtin.NotImplemented.NotImplemented$;const e=this.sq$length(),f=a.sq$length();switch(c){case "NotEq":case "Eq":let d;this===a?d=!0:e===f&&(d=b(this,a));return"NotEq"===c?!d:d;case "Lt":return e<f&&b(this,a);case "LtE":return e<=f&&b(this,a);case "Gt":return e>f&&b(a,this);case "GtE":return e>=f&&b(a,this)}},nb$subtract(a){const b=c(this);return b.difference.$meth.call(b,a)},nb$and(a){const b=c(this);return b.intersection.$meth.call(b,a)},nb$or(a){const b=c(this);return b.union.$meth.call(b,
a)},nb$xor(a){const b=c(this);return b.symmetric_difference.$meth.call(b,a)},sq$length(){return this.dict.get$size()}};var d=e("dict_keys",{sq$contains(a){return void 0!==this.dict.mp$lookup(a)},tp$iter(){return new k(this.dict)}},function(){return new A(this.dict)}),g=e("dict_values",{tp$iter(){return new u(this.dict)}},function(){return new v(this.dict)}),n=e("dict_items",{sq$contains(a){if(!(a instanceof Sk.builtin.tuple&&2===a.sq$length()))return!1;var b=a.mp$subscript(new Sk.builtin.int_(0));
a=a.mp$subscript(new Sk.builtin.int_(1));b=this.dict.mp$lookup(b);return void 0===b?!1:b===a||Sk.misceval.richCompareBool(b,a,"Eq")},tp$iter(){return new p(this.dict)}},function(){return new t(this.dict)}),k=f("dict_keyiterator",function(){const a=this.next$item();return a&&a[0]}),p=f("dict_itemiterator",function(){const a=this.next$item();return a&&new Sk.builtin.tuple([a[0],a[1]])}),u=f("dict_valueiterator",function(){const a=this.next$item();return a&&a[1]}),A=f("dict_reversekeyiterator",k.prototype.tp$iternext,
!0),t=f("dict_reverseitemiterator",p.prototype.tp$iternext,!0),v=f("dict_reversevalueiterator",u.prototype.tp$iternext,!0);Sk.builtin.dict.py2$methods={has_key:{$name:"has_key",$flags:{OneArg:!0},$meth(a){return new Sk.builtin.bool(this.sq$contains(a))},$doc:"D.has_key(k) -> True if D has a key k, else False"},keys:{$name:"keys",$meth(){return new Sk.builtin.list(this.sk$asarray())},$flags:{NoArgs:!0},$textsig:null,$doc:"D.keys() -> a set-like object providing a view on D's keys"},items:{$name:"items",
$meth(){return new Sk.builtin.list(this.$items().map(([a,b])=>new Sk.builtin.tuple([a,b])))},$flags:{NoArgs:!0},$textsig:null,$doc:"D.items() -> a set-like object providing a view on D's items"},values:{$name:"values",$meth(){return new Sk.builtin.list(this.$items().map(([,a])=>a))},$flags:{NoArgs:!0},$textsig:null,$doc:"D.values() -> an object providing a view on D's values"}}},function(m,q){function a(a,b){Object.defineProperties(a,{entries:{get:()=>{const a=Object.create(null);Object.entries(b).forEach(([b,
c])=>{b=Sk.unfixReserved(b);b.includes("$")||(b=new Sk.builtin.str(b),a[b.$savedKeyHash]=[b,c])});return a},configurable:!0},size:{get:()=>Object.keys(b).map(a=>Sk.unfixReserved(a)).filter(a=>!a.includes("$")).length,configurable:!0}})}Sk.builtin.mappingproxy=Sk.abstr.buildNativeClass("mappingproxy",{constructor:function(c){Sk.asserts.assert(this instanceof Sk.builtin.mappingproxy,"bad call to mapping proxy, use 'new'");this.mapping=new Sk.builtin.dict([]);void 0!==c&&a(this.mapping,c)},slots:{tp$getattr:Sk.generic.getAttr,
tp$as_sequence_or_mapping:!0,tp$hash:Sk.builtin.none.none$,tp$new(a,b){Sk.abstr.checkNoKwargs("mappingproxy",b);Sk.abstr.checkOneArg("mappingproxy",a,b);a=a[0];if(!Sk.builtin.checkMapping(a))throw new Sk.builtin.TypeError("mappingproxy() argument must be a mapping, not "+Sk.abstr.typeName(a));b=new Sk.builtin.mappingproxy;b.mapping=a;return b},tp$richcompare(a,b){return Sk.misceval.richCompareBool(this.mapping,a,b)},tp$str(){return this.mapping.tp$str()},$r(){return new Sk.builtin.str("mappingproxy("+
Sk.misceval.objectRepr(this.mapping)+")")},mp$subscript(a,b){return this.mapping.mp$subscript(a,b)},sq$contains(a){return this.mapping.sq$contains(a)},sq$length(){return this.mapping.sq$length()},tp$iter(){return this.mapping.tp$iter()},tp$as_number:!0,nb$or(a){a instanceof Sk.builtin.mappingproxy&&(a=a.mapping);return Sk.abstr.numberBinOp(this.mapping,a,"BitOr")},nb$reflected_or(a){a instanceof Sk.builtin.mappingproxy&&(a=a.mapping);return Sk.abstr.numberBinOp(a,this.mapping,"BitOr")},nb$inplace_or(a){throw new Sk.builtin.TypeError("'|=' is not supported by "+
Sk.abstr.typeName(this)+"; use '|' instead");}},methods:{get:{$meth(a,b){return Sk.misceval.callsimArray(this.mapping.tp$getattr(this.str$get),a,b)},$flags:{FastCall:!0},$textsig:null,$doc:"D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."},keys:{$meth(){return Sk.misceval.callsimArray(this.mapping.tp$getattr(this.str$keys),[])},$flags:{NoArgs:!0},$textsig:null,$doc:"D.keys() -> a set-like object providing a view on D's keys"},items:{$meth(){return Sk.misceval.callsimArray(this.mapping.tp$getattr(this.str$items),
[])},$flags:{NoArgs:!0},$textsig:null,$doc:"D.items() -> a set-like object providing a view on D's items"},values:{$meth(){return Sk.misceval.callsimArray(this.mapping.tp$getattr(this.str$values),[])},$flags:{NoArgs:!0},$textsig:null,$doc:"D.values() -> a set-like object providing a view on D's values"},copy:{$meth(){return Sk.misceval.callsimArray(this.mapping.tp$getattr(this.str$copy),[])},$flags:{NoArgs:!0},$textsig:null,$doc:"D.copy() -> a shallow copy of D"}},proto:{str$get:new Sk.builtin.str("get"),
str$copy:new Sk.builtin.str("copy"),str$keys:new Sk.builtin.str("keys"),str$items:new Sk.builtin.str("items"),str$values:new Sk.builtin.str("values"),mp$lookup(a){return this.mapping.mp$lookup(a)}},flags:{sk$acceptable_as_base_class:!1}})},function(m,q){Sk.builtin.property=Sk.abstr.buildNativeClass("property",{constructor:function(a,c,b,e){this.prop$get=a||Sk.builtin.none.none$;this.prop$set=c||Sk.builtin.none.none$;this.prop$del=b||Sk.builtin.none.none$;this.prop$doc=e||a&&a.$doc||Sk.builtin.none.none$},
slots:{tp$getattr:Sk.generic.getAttr,tp$new:Sk.generic.new,tp$init(a,c){a=Sk.abstr.copyKeywordsToNamedArgs("property",["fget","fset","fdel","doc"],a,c,Array(4).fill(Sk.builtin.none.none$));this.prop$get=a[0];this.prop$set=a[1];this.prop$del=a[2];Sk.builtin.checkNone(a[3])?Sk.builtin.checkNone(a[0])||(this.prop$doc=a[0].$doc||a[3]):this.prop$doc=a[3]},tp$doc:"Property attribute.\n\n  fget\n    function to be used for getting an attribute value\n  fset\n    function to be used for setting an attribute value\n  fdel\n    function to be used for del'ing an attribute\n  doc\n    docstring\n\nTypical use is to define a managed attribute x:\n\nclass C(object):\n    def getx(self): return self._x\n    def setx(self, value): self._x = value\n    def delx(self): del self._x\n    x = property(getx, setx, delx, 'I'm the 'x' property.')\n\nDecorators make defining new properties or modifying existing ones easy:\n\nclass C(object):\n    @property\n    def x(self):\n        'I am the 'x' property.'\n        return self._x\n    @x.setter\n    def x(self, value):\n        self._x = value\n    @x.deleter\n    def x(self):\n        del self._x",
tp$descr_get(a,c){if(null===a)return this;if(void 0===this.prop$get)throw new Sk.builtin.AttributeError("unreadable attribute");return Sk.misceval.callsimOrSuspendArray(this.prop$get,[a])},tp$descr_set(a,c){let b;b=null==c?this.prop$del:this.prop$set;if(Sk.builtin.checkNone(b))throw new Sk.builtin.AttributeError("can't "+(null==c?"delete":"set")+" attribute");if(!b.tp$call)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' is not callable");return null==c?b.tp$call([a]):b.tp$call([a,c])}},
methods:{getter:{$meth(a){return new Sk.builtin.property(a,this.prop$set,this.prop$del,this.prop$doc)},$flags:{OneArg:!0}},setter:{$meth(a){return new Sk.builtin.property(this.prop$get,a,this.prop$del,this.prop$doc)},$flags:{OneArg:!0}},deleter:{$meth(a){return new Sk.builtin.property(this.prop$get,this.prop$set,a,this.prop$doc)},$flags:{OneArg:!0}}},getsets:{fget:{$get(){return this.prop$get}},fset:{$get(){return this.prop$set}},fdel:{$get(){return this.prop$del}},__doc__:{$get(){return this.prop$doc},
$set(a){this.prop$doc=a=a||Sk.builtin.none.none$}}}});Sk.builtin.classmethod=Sk.abstr.buildNativeClass("classmethod",{constructor:function(a){this.cm$callable=a;this.$d=new Sk.builtin.dict},slots:{tp$getattr:Sk.generic.getAttr,tp$new:Sk.generic.new,tp$init(a,c){Sk.abstr.checkNoKwargs("classmethod",c);Sk.abstr.checkArgsLen("classmethod",a,1,1);this.cm$callable=a[0]},tp$doc:"classmethod(function) -> method\n\nConvert a function to be a class method.\n\nA class method receives the class as implicit first argument,\njust like an instance method receives the instance.\nTo declare a class method, use this idiom:\n\n  class C:\n      @classmethod\n      def f(cls, arg1, arg2, ...):\n          ...\n\nIt can be called either on the class (e.g. C.f()) or on an instance\n(e.g. C().f()).  The instance is ignored except for its class.\nIf a class method is called for a derived class, the derived class\nobject is passed as the implied first argument.\n\nClass methods are different than C++ or Java static methods.\nIf you want those, see the staticmethod builtin.",
tp$descr_get(a,c){const b=this.cm$callable;if(void 0===b)throw new Sk.builtin.RuntimeError("uninitialized classmethod object");void 0===c&&(c=a.ob$type);return(a=b.tp$descr_get)?a.call(b,c):new Sk.builtin.method(b,c)}},getsets:{__func__:{$get(){return this.cm$callable}},__dict__:Sk.generic.getSetDict}});Sk.builtin.staticmethod=Sk.abstr.buildNativeClass("staticmethod",{constructor:function(a){this.sm$callable=a;this.$d=new Sk.builtin.dict},slots:{tp$getattr:Sk.generic.getAttr,tp$new:Sk.generic.new,
tp$init(a,c){Sk.abstr.checkNoKwargs("staticmethod",c);Sk.abstr.checkArgsLen("staticmethod",a,1,1);this.sm$callable=a[0]},tp$doc:"staticmethod(function) -> method\n\nConvert a function to be a static method.\n\nA static method does not receive an implicit first argument.\nTo declare a static method, use this idiom:\n\n     class C:\n         @staticmethod\n         def f(arg1, arg2, ...):\n             ...\n\nIt can be called either on the class (e.g. C.f()) or on an instance\n(e.g. C().f()).  The instance is ignored except for its class.\n\nStatic methods in Python are similar to those found in Java or C++.\nFor a more advanced concept, see the classmethod builtin.",
tp$descr_get(a,c){if(void 0===this.sm$callable)throw new Sk.builtin.RuntimeError("uninitialized staticmethod object");return this.sm$callable}},getsets:{__func__:{$get(){return this.sm$callable}},__dict__:Sk.generic.getSetDict}})},function(m,q){function a(a,b){return function(c){if(c instanceof Sk.builtin.int_){let e=this.v;c=c.v;if("number"===typeof e&&"number"===typeof c){const b=a(e,c);if(d(b))return new Sk.builtin.int_(b)}e=n(e);c=n(c);return new Sk.builtin.int_(b(e,c))}return Sk.builtin.NotImplemented.NotImplemented$}}
function c(a,b){return function(c){if(c instanceof Sk.builtin.int_){let d=this.v;c=c.v;if("number"===typeof d&&"number"===typeof c)return a(d,c);d=n(d);c=n(c);return b(d,c)}return Sk.builtin.NotImplemented.NotImplemented$}}function b(a,b){return function(){const c=this.v;return"number"===typeof c?new Sk.builtin.int_(a(c)):new Sk.builtin.int_(b(c))}}function e(){return new Sk.builtin.int_(this.v)}function f(a,b){return function(c){if(c instanceof Sk.builtin.int_){let d=this.v;c=c.v;if(0===c)throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");
if("number"===typeof d&&"number"===typeof c)return new Sk.builtin.int_(a(d,c));d=n(d);c=n(c);return new Sk.builtin.int_(JSBI.numberIfSafe(b(d,c)))}return Sk.builtin.NotImplemented.NotImplemented$}}function l(a,b){return function(c){if(c instanceof Sk.builtin.int_){let d=this.v;c=c.v;if(0===d)return new Sk.builtin.int_(this.v);if("number"===typeof c){if(0>c)throw new Sk.builtin.ValueError("negative shift count");if("number"===typeof d){const b=a(d,c);if(void 0!==b)return new Sk.builtin.int_(b)}c=JSBI.BigInt(c)}else if(JSBI.lessThan(JSBI.BigInt(0)))throw new Sk.builtin.ValueError("negative shift count");
d=n(d);return new Sk.builtin.int_(b(d,c))}return Sk.builtin.NotImplemented.NotImplemented$}}function h(a,b){return function(c){if(c instanceof Sk.builtin.int_){var d=this.v;c=c.v;if("number"===typeof d&&"number"===typeof c)return d=a(d,c),0>d&&(d+=4294967296),new Sk.builtin.int_(d);d=n(d);c=n(c);return new Sk.builtin.int_(JSBI.numberIfSafe(b(d,c)))}return Sk.builtin.NotImplemented.NotImplemented$}}function d(a){return a<=Number.MAX_SAFE_INTEGER&&a>=-Number.MAX_SAFE_INTEGER}function g(a){return a<=
Number.MAX_SAFE_INTEGER&&a>=-Number.MAX_SAFE_INTEGER?+a:JSBI.BigInt(a)}function n(a){return"number"===typeof a?JSBI.BigInt(a):a}Sk.builtin.int_=Sk.abstr.buildNativeClass("int",{constructor:function(a){Sk.asserts.assert(this instanceof Sk.builtin.int_,"bad call to int use 'new'");let b;if("number"===typeof a||JSBI.__isBigInt(a))b=a;else if(void 0===a)b=0;else if("string"===typeof a)b=g(a);else{if(a.nb$int)return a.nb$int();Sk.asserts.fail("bad argument to int constructor")}this.v=b},slots:{tp$as_number:!0,
tp$doc:"int(x=0) -> integer\nint(x, base=10) -> integer\n\nConvert a number or string to an integer, or return 0 if no arguments\nare given.  If x is a number, return x.__int__().  For floating point\nnumbers, this truncates towards zero.\n\nIf x is not a number or if base is given, then x must be a string,\nbytes, or bytearray instance representing an integer literal in the\ngiven base.  The literal can be preceded by '+' or '-' and be surrounded\nby whitespace.  The base defaults to 10.  Valid bases are 0 and 2-36.\nBase 0 means to interpret the base from the string as an integer literal.\n>>> int('0b100', base=0)\n4",
$r(){return new Sk.builtin.str(this.v.toString())},tp$hash(){const a=this.v;return"number"===typeof a?a:JSBI.toNumber(JSBI.remainder(a,JSBI.__MAX_SAFE))},tp$new(a,b){1===a.length+(b?b.length:0)?(b=a[0],a=Sk.builtin.none.none$):(a=Sk.abstr.copyKeywordsToNamedArgs("int",[null,"base"],a,b,[new Sk.builtin.int_(0),Sk.builtin.none.none$]),b=a[0],a=a[1]);a=a!==Sk.builtin.none.none$?Sk.misceval.asIndexOrThrow(a):null;if(b instanceof Sk.builtin.str)null===a&&(a=10),b=new Sk.builtin.int_(Sk.str2number(b.v,
a));else{if(null!==a)throw new Sk.builtin.TypeError("int() can't convert non-string with explicit base");if(b.nb$int)b=b.nb$int();else if(a=Sk.abstr.lookupSpecial(b,Sk.builtin.str.$trunc)){a=Sk.misceval.callsimArray(a,[]);if(!Sk.builtin.checkInt(a))throw new Sk.builtin.TypeError(Sk.builtin.str.$trunc.$jsstr()+" returned non-Integral (type "+Sk.abstr.typeName(b)+")");b=new Sk.builtin.int_(a.v)}else throw new Sk.builtin.TypeError("int() argument must be a string, a bytes-like object or a number, not '"+
Sk.abstr.typeName(b)+"'");}if(this===Sk.builtin.int_.prototype)return b;a=new this.constructor;a.v=b.v;return a},tp$getattr:Sk.generic.getAttr,ob$eq:c((a,b)=>a==b,JSBI.equal),ob$ne:c((a,b)=>a!=b,JSBI.notEqual),ob$gt:c((a,b)=>a>b,JSBI.greaterThan),ob$ge:c((a,b)=>a>=b,JSBI.greaterThanOrEqual),ob$lt:c((a,b)=>a<b,JSBI.lessThan),ob$le:c((a,b)=>a<=b,JSBI.lessThanOrEqual),nb$int:e,nb$index(){return this.v},nb$float(){var a=this.v;if("number"===typeof a)return new Sk.builtin.float_(a);a=parseFloat(JSBI.toNumber(a));
if(Infinity===a||-Infinity===a)throw new Sk.builtin.OverflowError("int too large to convert to float");return new Sk.builtin.float_(a)},nb$isnegative(){const a=this.v;return"number"===typeof a?0>a:JSBI.lessThan(a,JSBI.__ZERO)},nb$ispositive(){const a=this.v;return"number"===typeof a?0>a:JSBI.greaterThanOrEqual(a,JSBI.__ZERO)},nb$bool(){return 0!==this.v},nb$positive:e,nb$negative:b(a=>-a,JSBI.unaryMinus),nb$add:a((a,b)=>a+b,(a,b)=>JSBI.numberIfSafe(JSBI.add(a,b))),nb$subtract:a((a,b)=>a-b,(a,b)=>
JSBI.numberIfSafe(JSBI.subtract(a,b))),nb$multiply:a((a,b)=>a*b,JSBI.multiply),nb$divide(a){return Sk.__future__.division?this.nb$float().nb$divide(a):this.nb$floor_divide(a)},nb$floor_divide:f((a,b)=>Math.floor(a/b),JSBI.divide),nb$remainder:f((a,b)=>a-Math.floor(a/b)*b,JSBI.remainder),nb$divmod(a){const b=this.nb$floor_divide(a);a=this.nb$remainder(a);return b===Sk.builtin.NotImplemented.NotImplemented$||a===Sk.builtin.NotImplemented.NotImplemented$?Sk.builtin.NotImplemented.NotImplemented$:new Sk.builtin.tuple([b,
a])},nb$and:h((a,b)=>a&b,JSBI.bitwiseAnd),nb$or:h((a,b)=>a|b,JSBI.bitwiseOr),nb$xor:h((a,b)=>a^b,JSBI.bitwiseXor),nb$abs:b(Math.abs,a=>JSBI.lessThan(a,JSBI.__ZERO)?JSBI.unaryMinus(a):a),nb$lshift:l((a,b)=>{if(53>b&&(a=2*a*p[b],d(a)))return a},JSBI.leftShift),nb$rshift:l((a,b)=>{const c=a>>b;return 0<a&&0>c?c&Math.pow(2,32-b)-1:c},(a,b)=>JSBI.numberIfSafe(JSBI.signedRightShift(a,b))),nb$invert:b(a=>~a,JSBI.bitwiseNot),nb$power(a,b){let c;void 0!==b&&Sk.builtin.checkNone(b)&&(b=void 0);if(a instanceof
Sk.builtin.int_&&(void 0===b||b instanceof Sk.builtin.int_)){let e=this.v,f=a.v;if("number"===typeof e&&"number"===typeof f){const a=Math.pow(e,f);if(d(a)&&(c=0>f?new Sk.builtin.float_(a):new Sk.builtin.int_(a),void 0===b))return c}if(void 0!==b){if(a.nb$isnegative())throw new Sk.builtin.ValueError("pow() 2nd argument cannot be negative when 3rd argument specified");if(0===b.v)throw new Sk.builtin.ValueError("pow() 3rd argument cannot be 0");return void 0!==c?c.nb$remainder(b):new Sk.builtin.int_(JSBI.powermod(n(e),
n(f),n(b.v)))}return new Sk.builtin.int_(JSBI.exponentiate(n(e),n(f)))}return Sk.builtin.NotImplemented.NotImplemented$},nb$long(){return new Sk.builtin.lng(this.v)}},getsets:{real:{$get:e,$doc:"the real part of a complex number"},imag:{$get(){return new Sk.builtin.int_(0)},$doc:"the imaginary part of a complex number"}},methods:{conjugate:{$meth:e,$flags:{NoArgs:!0},$textsig:null,$doc:"Returns self, the complex conjugate of any int."},bit_length:{$meth(){return new Sk.builtin.int_(Sk.builtin.bin(this).sq$length()-
2)},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Number of bits necessary to represent self in binary.\n\n>>> bin(37)\n'0b100101'\n>>> (37).bit_length()\n6"},to_bytes:{$meth(){throw new Sk.builtin.NotImplementedError("Not yet implemented in Skulpt");},$flags:{FastCall:!0},$textsig:"($self, /, length, byteorder, *, signed=False)",$doc:"Return an array of bytes representing an integer.\n\n  length\n    Length of bytes object to use.  An OverflowError is raised if the\n    integer is not representable with the given number of bytes.\n  byteorder\n    The byte order used to represent the integer.  If byteorder is 'big',\n    the most significant byte is at the beginning of the byte array.  If\n    byteorder is 'little', the most significant byte is at the end of the\n    byte array.  To request the native byte order of the host system, use\n    `sys.byteorder' as the byte order value.\n  signed\n    Determines whether two's complement is used to represent the integer.\n    If signed is False and a negative integer is given, an OverflowError\n    is raised."},
__trunc__:{$meth:e,$flags:{NoArgs:!0},$textsig:null,$doc:"Truncating an Integral returns itself."},__floor__:{$meth:e,$flags:{NoArgs:!0},$textsig:null,$doc:"Flooring an Integral returns itself."},__ceil__:{$meth:e,$flags:{NoArgs:!0},$textsig:null,$doc:"Ceiling of an Integral returns itself."},__round__:{$meth(a){return this.round$(a)},$flags:{MinArgs:0,MaxArgs:1},$textsig:null,$doc:"Rounding an Integral returns itself.\nRounding with an ndigits argument also returns an integer."},__getnewargs__:{$meth(){return new Sk.builtin.tuple([new Sk.builtin.int_(this.v)])},
$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:Sk.builtin.none.none$},__format__:{$meth:Sk.formatting.mkNumber__format__(!1),$flags:{OneArg:!0},$textsig:"($self, format_spec, /)",$doc:Sk.builtin.none.none$}},proto:{str$(a,b){a=void 0===a||10===a?this.v.toString():this.v.toString(a);b||void 0===b||"-"===a[0]&&(a=a.substring(1));return a},round$(a){a=void 0===a?0:Sk.misceval.asIndexSized(a);var b=this.v,c=Math.pow(10,-a);if(0<a)return new Sk.builtin.int_(b);if("number"===typeof b&&Sk.__future__.bankers_rounding)return a=
b/c,b=Math.round(a),new Sk.builtin.int_((.5===(0<a?a:-a)%1?0===b%2?b:b-1:b)*c);if("number"===typeof b)return new Sk.builtin.int_(Math.round(b/c)*c);{c=JSBI.BigInt(10*c);a=JSBI.BigInt(10);b=JSBI.divide(b,c);const d=JSBI.divide(b,a),e=JSBI.subtract(b,JSBI.multiply(a,d));5>JSBI.toNumber(e)?b=JSBI.multiply(JSBI.multiply(d,a),c):JSBI.multiply(JSBI.multiply(JSBI.add(d,JSBI.BigInt(1),a),c));return new Sk.builtin.int_(b)}}}});Sk.exportSymbol("Sk.builtin.int_",Sk.builtin.int_);const k=/_(?=[^_])/g;Sk.str2number=
function(a,b){var c=a,e=!1,f;a=a.replace(/^\s+|\s+$/g,"");"-"===a.charAt(0)&&(e=!0,a=a.substring(1));"+"===a.charAt(0)&&(a=a.substring(1));if(null===b||void 0===b)b=10;if((2>b||36<b)&&0!==b)throw new Sk.builtin.ValueError("int() base must be >= 2 and <= 36");"string"===typeof b&&(b=Number(b));if("0x"===a.substring(0,2).toLowerCase())if(16===b||0===b)a=a.substring(2),b=16;else{if(34>b)throw new Sk.builtin.ValueError("invalid literal for int() with base "+b+": '"+c+"'");}else if("0b"===a.substring(0,
2).toLowerCase())if(2===b||0===b)a=a.substring(2),b=2;else{if(12>b)throw new Sk.builtin.ValueError("invalid literal for int() with base "+b+": '"+c+"'");}else if("0o"===a.substring(0,2).toLowerCase())if(8===b||0===b)a=a.substring(2),b=8;else{if(25>b)throw new Sk.builtin.ValueError("invalid literal for int() with base "+b+": '"+c+"'");}else if("0"===a.charAt(0)){if("0"===a)return 0;if(8===b||0===b)b=8}0===b&&(b=10);if(-1!==a.indexOf("_")){if(-1!==a.indexOf("__"))throw new Sk.builtin.ValueError("invalid literal for int() with base "+
b+": '"+c+"'");a=10!==b?a.replace(k,""):a.charAt(0)+a.substring(1).replace(k,"")}if(0===a.length)throw new Sk.builtin.ValueError("invalid literal for int() with base "+b+": '"+c+"'");for(f=0;f<a.length;f+=1){var g=a.charCodeAt(f);var h=b;48<=g&&57>=g?h=g-48:65<=g&&90>=g?h=g-65+10:97<=g&&122>=g&&(h=g-97+10);if(h>=b)throw new Sk.builtin.ValueError("invalid literal for int() with base "+b+": '"+c+"'");}e&&(a="-"+a);h=parseInt(a,b);if(d(h))return h;c=!1;"-"===a[0]&&(c=!0,a=a.substring(1));b=JSBI.BigInt(b);
e=JSBI.BigInt(1);f=JSBI.BigInt(0);for(g=a.length-1;0<=g;g--)h=a.charCodeAt(g),48<=h&&57>=h?h-=48:65<=h&&90>=h?h=h-65+10:97<=h&&122>=h&&(h=h-97+10),h=JSBI.multiply(JSBI.BigInt(h),e),f=JSBI.add(f,h),e=JSBI.multiply(e,b);c&&(f=JSBI.multiply(f,JSBI.BigInt(-1)));return a=f};Sk.builtin.int_.py2$methods={};Sk.longFromStr=function(a,b){if(Sk.__future__.python3)return new Sk.builtin.int_(g(a));a=Sk.str2number(a,b);return new Sk.builtin.lng(a)};Sk.exportSymbol("Sk.longFromStr",Sk.longFromStr);Sk.builtin.int_.withinThreshold=
d;Sk.builtin.int_.stringToNumberOrBig=g;const p=[.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.builtin.lng=Sk.abstr.buildNativeClass("long",{base:Sk.builtin.int_,constructor:function(a){Sk.builtin.int_.call(this,a)},slots:{$r(){return new Sk.builtin.str(this.v.toString()+"L")},tp$as_number:!0,nb$negative(){return new Sk.builtin.lng(u.nb$negative.call(this).v)},nb$positive(){return new Sk.builtin.lng(u.nb$positive.call(this).v)}}});const u=Sk.builtin.int_.prototype},function(m,q){const a=Sk.builtin.int_.prototype;Sk.builtin.bool=Sk.abstr.buildNativeClass("bool",
{constructor:function(a){return Sk.misceval.isTrue(a)?Sk.builtin.bool.true$:Sk.builtin.bool.false$},base:Sk.builtin.int_,slots:{tp$doc:"bool(x) -> bool\n\nReturns True when the argument x is true, False otherwise.\nThe builtins True and False are the only two instances of the class bool.\nThe class bool is a subclass of the class int, and cannot be subclassed.",tp$new(a,b){Sk.abstr.checkNoKwargs("bool",b);Sk.abstr.checkArgsLen("bool",a,0,1);return new Sk.builtin.bool(a[0])},$r(){return this.v?this.str$True:
this.str$False},tp$as_number:!0,nb$and(c){return c.ob$type===Sk.builtin.bool?new Sk.builtin.bool(this.v&c.v):a.nb$and.call(this,c)},nb$or(c){return c.ob$type===Sk.builtin.bool?new Sk.builtin.bool(this.v|c.v):a.nb$or.call(this,c)},nb$xor(c){return c.ob$type===Sk.builtin.bool?new Sk.builtin.bool(this.v^c.v):a.nb$xor.call(this,c)}},flags:{sk$acceptable_as_base_class:!1},methods:{__format__:{$meth(){return this.$r()},$flags:{OneArg:!0}}},proto:{str$False:new Sk.builtin.str("False"),str$True:new Sk.builtin.str("True")}});
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,q){function a(){return new Sk.builtin.float_(this.v)}function c(a){return function(b){const c=this.v;b=b.v;if("number"!==typeof b)if(JSBI.__isBigInt(b)){if(b=parseFloat(JSBI.toNumber(b)),Infinity==b||-Infinity==b)throw new Sk.builtin.OverflowError("int too large to convert to float");
}else return Sk.builtin.NotImplemented.NotImplemented$;return a(c,b)}}function b(a){const b=c(a);return function(a,c){if(void 0!==c&&!Sk.builtin.checkNone(c))throw new Sk.builtin.TypeError("pow() 3rd argument not allowed unless all arguments are integers");return b.call(this,a)}}function e(a,b){if(0===b)throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");return Infinity===a?Infinity===b||-Infinity===a?new Sk.builtin.float_(NaN):0>b?new Sk.builtin.float_(-Infinity):new Sk.builtin.float_(Infinity):
-Infinity===a?Infinity===b||-Infinity===a?new Sk.builtin.float_(NaN):0>b?new Sk.builtin.float_(Infinity):new Sk.builtin.float_(-Infinity):new Sk.builtin.float_(a/b)}function f(a,b){if(Infinity===a||-Infinity===a)return new Sk.builtin.float_(NaN);if(0===b)throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");return Infinity===b?0>a?new Sk.builtin.float_(-1):new Sk.builtin.float_(0):-Infinity===b?0>a||0!==a?new Sk.builtin.float_(0):new Sk.builtin.float_(-1):new Sk.builtin.float_(Math.floor(a/
b))}function l(a,b){if(0===b)throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");if(0===a)return new Sk.builtin.float_(0);if(Infinity===b)return Infinity===a||-Infinity===this.v?new Sk.builtin.float_(NaN):0<a?new Sk.builtin.float_(a):new Sk.builtin.float_(Infinity);let c=a%b;0>a?0<b&&0>c&&(c+=b):0>b&&0!==c&&(c+=b);0===c&&(0>b?c=-0:-Infinity===Infinity/c&&(c=0));return new Sk.builtin.float_(c)}function h(a,b){if(0>a&&0!==b%1)throw new Sk.builtin.ValueError("negative number cannot be raised to a fractional power");
if(0===a&&0>b)throw new Sk.builtin.ZeroDivisionError("0.0 cannot be raised to a negative power");const c=Math.pow(a,b);if(Infinity===Math.abs(c)&&Infinity!==Math.abs(a)&&Infinity!==Math.abs(b))throw new Sk.builtin.OverflowError("Numerical result out of range");return new Sk.builtin.float_(c)}const d=Object.create(null,{Infinity:{value:314159},"-Infinity":{value:-314159},NaN:{value:0}});Sk.builtin.float_=Sk.abstr.buildNativeClass("float",{constructor:function(a){Sk.asserts.assert(this instanceof Sk.builtin.float_,
"bad call to float use 'new'");if("number"===typeof a)this.v=a;else if(void 0===a)this.v=0;else if("string"===typeof a)this.v=parseFloat(a);else{if(a.nb$float)return a.nb$float();Sk.asserts.fail("bad argument to float constructor")}},slots:{tp$gettattr:Sk.generic.getAttr,tp$as_number:!0,tp$doc:"Convert a string or number to a floating point number, if possible.",tp$hash(){const a=this.v;let b=d[a];if(void 0!==b)return b;b=Number.isInteger(a)?this.nb$int().tp$hash():Math.floor(Math.random()*Number.MAX_SAFE_INTEGER-
Number.MAX_SAFE_INTEGER/2);return d[this.v]=b},$r(){return new Sk.builtin.str(this.str$(10,!0))},tp$new(a,b){if(b&&b.length)throw new Sk.builtin.TypeError("float() takes no keyword arguments");if(a&&1<a.length)throw new Sk.builtin.TypeError("float expected at most 1 arguments, got "+a.length);a=a[0];if(void 0===a)var c=new Sk.builtin.float_(0);else if(a.nb$float)c=a.nb$float();else if(Sk.builtin.checkString(a)){c=a.v;a=c;if(-1!==c.indexOf("_")){if(g.test(c))throw new Sk.builtin.ValueError("could not convert string to float: '"+
c+"'");a=c.charAt(0)+c.substring(1).replace(n,"")}if(c.match(/^-inf$/i))var d=-Infinity;else c.match(/^[+]?inf$/i)?d=Infinity:c.match(/^[-+]?nan$/i)?d=NaN:isNaN(a)||(d=parseFloat(a),Number.isNaN(d)&&(d=void 0));if(void 0===d)throw new Sk.builtin.ValueError("could not convert string to float: "+Sk.misceval.objectRepr(new Sk.builtin.str(c)));c=new Sk.builtin.float_(d)}if(void 0===c)throw new Sk.builtin.TypeError("float() argument must be a string or a number");if(this===Sk.builtin.float_.prototype)return c;
d=new this.constructor;d.v=c.v;return d},nb$int(){let a=this.v;a=0>a?Math.ceil(a):Math.floor(a);if(!Number.isInteger(a))throw new Sk.builtin.ValueError("cannot convert float "+Sk.misceval.objectRepr(this)+" to integer");return Sk.builtin.int_.withinThreshold(a)?new Sk.builtin.int_(a):new Sk.builtin.int_(JSBI.BigInt(a))},nb$float:a,nb$long(){return new Sk.builtin.lng(this.nb$int().v)},nb$add:c((a,b)=>new Sk.builtin.float_(a+b)),nb$subtract:c((a,b)=>new Sk.builtin.float_(a-b)),nb$reflected_subtract:c((a,
b)=>new Sk.builtin.float_(b-a)),nb$multiply:c((a,b)=>new Sk.builtin.float_(a*b)),nb$divide:c(e),nb$reflected_divide:c((a,b)=>e(b,a)),nb$floor_divide:c(f),nb$reflected_floor_divide:c((a,b)=>f(b,a)),nb$remainder:c(l),nb$reflected_remainder:c((a,b)=>l(b,a)),nb$divmod:c((a,b)=>new Sk.builtin.tuple([f(a,b),l(a,b)])),nb$reflected_divmod:c((a,b)=>new Sk.builtin.tuple([f(b,a),l(b,a)])),nb$power:b(h),nb$reflected_power:b((a,b)=>h(b,a)),nb$abs(){return new Sk.builtin.float_(Math.abs(this.v))},nb$negative(){return new Sk.builtin.float_(-this.v)},
nb$positive(){return new Sk.builtin.float_(this.v)},nb$bool(){return 0!==this.v},nb$isnegative(){return 0>this.v},nb$ispositive(){return 0<=this.v},ob$eq:c((a,b)=>a==b),ob$ne:c((a,b)=>a!=b),ob$gt:c((a,b)=>a>b),ob$ge:c((a,b)=>a>=b),ob$lt:c((a,b)=>a<b),ob$le:c((a,b)=>a<=b)},getsets:{real:{$get:a,$doc:"the real part of a complex number"},imag:{$get(){return new Sk.builtin.float_(0)},$doc:"the imaginary part of a complex number"}},methods:{conjugate:{$meth:a,$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return self, the complex conjugate of any float."},
__trunc__:{$meth(){return this.nb$int()},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return the Integral closest to x between 0 and x."},__round__:{$meth(a){return this.round$(a)},$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, ndigits=None, /)",$doc:"Return the Integral closest to x, rounding half toward even.\n\nWhen an argument is passed, work like built-in round(x, ndigits)."},is_integer:{$meth(){return new Sk.builtin.bool(Number.isInteger(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",
$doc:"Return True if the float is an integer."},__getnewargs__:{$meth(){return new Sk.builtin.tuple([this])},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:Sk.builtin.none.none$},__format__:{$meth:Sk.formatting.mkNumber__format__(!0),$flags:{OneArg:!0},$textsig:"($self, format_spec, /)",$doc:Sk.builtin.none.none$}}});const g=/_[eE]|[eE]_|\._|_\.|[+-]_|__/,n=/_(?=[^_])/g;Sk.builtin.float_.PyFloat_Check=function(a){return void 0===a?!1:Sk.builtin.checkNumber(a)||Sk.builtin.checkFloat(a)||a.ob$type.$isSubType(Sk.builtin.float_)?
!0:!1};Sk.builtin.float_.prototype.toFixed=function(a){a=Sk.builtin.asnum$(a);return this.v.toFixed(a)};Sk.builtin.float_.prototype.round$=function(a){var b=Sk.builtin.asnum$(this);var c=void 0===a?0:Sk.misceval.asIndexSized(a);if(Sk.__future__.bankers_rounding){b*=Math.pow(10,c);var d=Math.round(b);c=(.5===(0<b?b:-b)%1?0===d%2?d:d-1:d)/Math.pow(10,c);return void 0===a?new Sk.builtin.int_(c):new Sk.builtin.float_(c)}a=Math.pow(10,c);c=Math.round(b*a)/a;return new Sk.builtin.float_(c)};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};Sk.builtin.float_.py2$methods={}},function(m,q){function a(a){let b=a.v;if("number"===typeof b)return b;a.nb$float&&(b=a.nb$float());if(void 0===b)throw new Sk.builtin.TypeError("a float is required");
return b.v}function c(a,b,c){if(c===Sk.builtin.complex.prototype)return new Sk.builtin.complex(a,b);c=new c.constructor;Sk.builtin.complex.call(c,a,b);return c}function b(a,b){return function(c){const d=this.real,e=this.imag;var f=c.real;const g=c.v;if("number"===typeof f)c=c.imag;else if("number"===typeof g)f=g,c=0;else if(JSBI.__isBigInt(g)){if(void 0===b){if(f=parseFloat(JSBI.toNumber(g)),Infinity==f||-Infinity==f)throw new Sk.builtin.OverflowError("int too large to convert to float");}else f=
g.toString();c=0}else return Sk.builtin.NotImplemented.NotImplemented$;return a(d,e,f,c)}}function e(a,b,c,d){var e=Math.abs(c);const f=Math.abs(d);if(e>=f){if(0===e)throw new Sk.builtin.ZeroDivisionError("complex division by zero");e=d/c;c+=d*e;d=(a+b*e)/c;a=(b-a*e)/c}else f>=e?(e=c/d,c=c*e+d,Sk.asserts.assert(0!==d),d=(a*e+b)/c,a=(b*e-a)/c):a=d=NaN;return new Sk.builtin.complex(d,a)}function f(a,b,c,d){if(0===c&&0===d){d=1;var e=0}else if(0===a&&0===b){if(0!==d||0>c)throw new Sk.builtin.ZeroDivisionError("complex division by zero");
e=d=0}else{const f=Math.hypot(a,b);e=Math.pow(f,c);a=Math.atan2(b,a);c*=a;0!==d&&(e/=Math.exp(a*d),c+=d*Math.log(f));d=e*Math.cos(c);e*=Math.sin(c)}return new Sk.builtin.complex(d,e)}function l(a,b,c){let d=1;var e=new Sk.builtin.complex(1,0);for(a=new Sk.builtin.complex(a,b);0<d&&c>=d;)c&d&&(e=new Sk.builtin.complex(e.real*a.real-e.imag*a.imag,e.real*a.imag+a.real*e.imag)),d<<=1,a=new Sk.builtin.complex(a.real*a.real-a.imag*a.imag,2*a.real*a.imag);return e}function h(a,b,c,d,e){e=!1;switch(b){case "e":case "f":case "g":break;
case "E":e=!0;b="e";break;case "F":e=!0;b="f";break;case "r":if(0!==c)throw Error("Bad internall call");c=17;b="g";break;default:throw Error("Bad internall call");}if(isNaN(a))a="nan";else if(Infinity===a)a="inf";else if(-Infinity===a)a="-inf";else{d&h.Py_DTSF_ADD_DOT_0&&(b="g");var f="%"+(d&h.Py_DTSF_ALT?"#":"");null!=c&&(f=f+"."+c);f=new Sk.builtin.str(f+b);a=f.nb$remainder(new Sk.builtin.float_(a));a=a.v}d&h.Py_DTSF_SIGN&&"-"!==a[0]&&(a="+"+a);e&&(a=a.toUpperCase());return a}Sk.builtin.complex=
Sk.abstr.buildNativeClass("complex",{constructor:function(a,b){Sk.asserts.assert(this instanceof Sk.builtin.complex,"bad call to complex constructor, use 'new'");this.real=a;this.imag=b},slots:{tp$as_number:!0,tp$doc:"Create a complex number from a real part and an optional imaginary part.\n\nThis is equivalent to (real + imag*1j) where imag defaults to 0.",tp$hash(){var a=(new Sk.builtin.float_(this.real)).tp$hash();a=1003*(new Sk.builtin.float_(this.imag)).tp$hash()+a;return Sk.builtin.int_.withinThreshold(a)?
a:(new Sk.builtin.int_(JSBI.BigInt(a))).tp$hash()},tp$getattr:Sk.generic.getAttr,tp$new(b,e){b=Sk.abstr.copyKeywordsToNamedArgs("complex",["real","imag"],b,e,[null,null]);{var f=b[1],g;let k=e=!1;var h=b[0];if(null!=h&&h.constructor===Sk.builtin.complex&&null==f)e=h;else if(Sk.builtin.checkString(h)){if(null!=f)throw new Sk.builtin.TypeError("complex() can't take second arg if first is a string");e=Sk.builtin.complex.complex_subtype_from_string(h,this)}else{if(null!=f&&Sk.builtin.checkString(f))throw new Sk.builtin.TypeError("complex() second arg can't be a string");
null==h?b=null:(b=Sk.abstr.lookupSpecial(h,Sk.builtin.str.$complex),b=void 0!==b?Sk.misceval.callsimArray(b,[]):null);if(null!=b&&b!==Sk.builtin.NotImplemented.NotImplemented$){if(!d(b))throw new Sk.builtin.TypeError("__complex__ should return a complex object");h=b}if(null!=h&&void 0===h.nb$float)throw new Sk.builtin.TypeError("complex() first argument must be a string or a number, not '"+Sk.abstr.typeName(h)+"'");if(null!=f&&void 0===f.nb$float)throw new Sk.builtin.TypeError("complex() second argument must be a number, not '"+
Sk.abstr.typeName(h)+"'");null==h?h=b=0:d(h)?(b=h.real,h=h.imag,e=!0):(b=a(h),h=0);null==f?f=g=0:d(f)?(g=f.real,f=f.imag,k=!0):(g=a(f),f=0);!0===k&&(b-=f);!0===e&&(g+=h);e=c(b,g,this)}}return e},tp$richcompare(a,c){if("Eq"!==c&&"NotEq"!==c){if(Sk.builtin.checkNumber(a)||d(a))throw new Sk.builtin.TypeError("no ordering relation is defined for complex numbers");return Sk.builtin.NotImplemented.NotImplemented$}return b(function(a,b,d,e){a=a==d&&b==e;return"Eq"===c?a:!a},!0).call(this,a)},$r(){{var a,
b;let e=a="";var c=this.real;var d=this.imag;if(b=0===c)b=1==(c?0>c?-1:1:0>1/c?-1:1);b?(c="",b=h(d,"g",null,0,null)):(c=a=h(c,"g",null,0,null),b=h(d,"g",null,h.Py_DTSF_SIGN,null),0===d&&-Infinity===1/d&&b&&"-"!==b[0]&&(b="-"+b),a="(",e=")");d=new Sk.builtin.str(""+a+c+b+"j"+e)}return d},nb$int(){throw new Sk.builtin.TypeError("can't convert complex to int");},nb$long(){throw new Sk.builtin.TypeError("can't convert complex to long");},nb$float(){throw new Sk.builtin.TypeError("can't convert complex to float");
},nb$positive(){return new Sk.builtin.complex(this.real,this.imag)},nb$negative(){return new Sk.builtin.complex(-this.real,-this.imag)},nb$bool(){return this.real||this.imag},nb$add:b((a,b,c,d)=>new Sk.builtin.complex(a+c,b+d)),nb$subtract:b((a,b,c,d)=>new Sk.builtin.complex(a-c,b-d)),nb$reflected_subtract:b((a,b,c,d)=>new Sk.builtin.complex(c-a,d-b)),nb$multiply:b((a,b,c,d)=>new Sk.builtin.complex(c*a-d*b,a*d+b*c)),nb$divide:b(e),nb$reflected_divide:b((a,b,c,d)=>e(c,d,a,b)),nb$floor_divide(a){throw new Sk.builtin.TypeError("can't take floor of complex number.");
},nb$reflected_floor_divide(a){throw new Sk.builtin.TypeError("can't take floor of complex number.");},nb$remainder(a){throw new Sk.builtin.TypeError("can't mod complex numbers.");},nb$reflected_remainder(a){throw new Sk.builtin.TypeError("can't mod complex numbers.");},nb$divmod(a){throw new Sk.builtin.TypeError("can't take floor or mod of complex number.");},nb$power(a,b){if(null!=b&&!Sk.builtin.checkNone(b))throw new Sk.builtin.ValueError("complex modulo");return k.call(this,a)},nb$abs(){var a=
this.real;const b=this.imag;if(!Number.isFinite(a)||!Number.isFinite(b))return Infinity===a||-Infinity===a?new Sk.builtin.float_(Math.abs(a)):Infinity===b||-Infinity===b?new Sk.builtin.float_(Math.abs(b)):new Sk.builtin.float_(NaN);a=Math.hypot(a,b);if(!Number.isFinite(a))throw new Sk.builtin.OverflowError("absolute value too large");return new Sk.builtin.float_(a)}},getsets:{real:{$get(){return new Sk.builtin.float_(this.real)},$doc:"the real part of a complex number"},imag:{$get(){return new Sk.builtin.float_(this.imag)},
$doc:"the imaginary part of a complex number"}},methods:{conjugate:{$meth(){return new Sk.builtin.complex(this.real,-this.imag)},$flags:{NoArgs:!0},$textsig:null,$doc:"complex.conjugate() -> complex\n\nReturn the complex conjugate of its argument. (3-4j).conjugate() == 3+4j."},__getnewargs__:{$meth(){return new Sk.builtin.tuple([new Sk.builtin.float_(this.real),new Sk.builtin.float_(this.imag)])},$flags:{NoArgs:!0},$textsig:null,$doc:Sk.builtin.none.none$},__format__:{$meth(a){if(Sk.builtin.checkString(a))throw new Sk.builtin.NotImplementedError("__format__ is not implemented for complex type.");
throw new Sk.builtin.TypeError("__format__ requires str");},$flags:{OneArg:!0},$textsig:null,$doc:"complex.__format__() -> str\n\nConvert to a string according to format_spec."}}});Sk.exportSymbol("Sk.builtin.complex",Sk.builtin.complex);const d=Sk.builtin.checkComplex,g=/_[eE]|[eE]_|\._|_\.|[+-]_|_j|j_/,n=/_(?=[^_])/g;Sk.builtin.complex.complex_subtype_from_string=function(a,b){b=b||Sk.builtin.complex.prototype;var d=0,e=0,f=!1;if(Sk.builtin.checkString(a))a=Sk.ffi.remapToJs(a);else if("string"!==
typeof a)throw new TypeError("provided unsupported string-alike argument");if(-1!==a.indexOf("\x00")||0===a.length||""===a)throw new Sk.builtin.ValueError("complex() arg is a malformed string");var h=0;a=a.replace(/inf|infinity/gi,"Infinity");for(a=a.replace(/nan/gi,"NaN");" "===a[h];)h++;if("("===a[h])for(f=!0,h++;" "===a[h];)h++;if(-1!==a.indexOf("_")){if(g.test(a))throw new Sk.builtin.ValueError("could not convert string to complex: '"+a+"'");a=a.charAt(0)+a.substring(1).replace(n,"")}var k=/^(?:[+-]?(?:(?:(?:\d*\.\d+)|(?:\d+\.?))(?:[eE][+-]?\d+)?|NaN|Infinity))/;
var l=a.substr(h);var p=l.match(k);if(null!==p)if(h+=p[0].length,"j"===a[h]||"J"===a[h])e=parseFloat(p[0]),h++;else if("+"===a[h]||"-"===a[h]){d=parseFloat(p[0]);p=a.substr(h).match(k);null!==p?(e=parseFloat(p[0]),h+=p[0].length):(e="+"===a[h]?1:-1,h++);if("j"!==a[h]&&"J"!==a[h])throw new Sk.builtin.ValueError("complex() arg is malformed string");h++}else d=parseFloat(p[0]);else p=p=l.match(/^([+-]?[jJ])/),null!==p&&(e=1===p[0].length?1:"+"===p[0][0]?1:-1,h+=p[0].length);for(;" "===a[h];)h++;if(f){if(")"!==
a[h])throw new Sk.builtin.ValueError("complex() arg is malformed string");for(h++;" "===a[h];)h++}if(a.length!==h)throw new Sk.builtin.ValueError("complex() arg is malformed string");return c(d,e,b)};const k=b((a,b,c,d)=>{const g=c|0;return 0===d&&c===g?(100<g||-100>g?a=f(a,b,g,0):0<g?a=l(a,b,g):(a=l(a,b,-g),a=e(1,0,a.real,a.imag)),a):f(a,b,c,d)});h.Py_DTSF_SIGN=1;h.Py_DTSF_ADD_DOT_0=2;h.Py_DTSF_ALT=4;h.Py_DTST_FINITE=0;h.Py_DTST_INFINITE=1;h.Py_DTST_NAN=2},function(m,q){Sk.builtin.slice=Sk.abstr.buildNativeClass("slice",
{constructor:function(a,c,b){void 0===c&&void 0===b&&(c=a,a=Sk.builtin.none.none$);void 0===c&&(c=Sk.builtin.none.none$);void 0===b&&(b=Sk.builtin.none.none$);this.start=a;this.stop=c;this.step=b},slots:{tp$getattr:Sk.generic.getAttr,tp$doc:"slice(stop)\nslice(start, stop[, step])\n\nCreate a slice object.  This is used for extended slicing (e.g. a[0:10:2]).",tp$hash:Sk.builtin.none.none$,tp$new(a,c){Sk.abstr.checkNoKwargs("slice",c);Sk.abstr.checkArgsLen("slice",a,1,3);return new Sk.builtin.slice(...a)},
$r(){const a=Sk.misceval.objectRepr(this.start),c=Sk.misceval.objectRepr(this.stop),b=Sk.misceval.objectRepr(this.step);return new Sk.builtin.str("slice("+a+", "+c+", "+b+")")},tp$richcompare(a,c){if(a.ob$type!==Sk.builtin.slice)return Sk.builtin.NotImplemented.NotImplemented$;const b=new Sk.builtin.tuple([this.start,this.stop,this.step]);a=new Sk.builtin.tuple([a.start,a.stop,a.step]);return b.tp$richcompare(a,c)}},getsets:{start:{$get(){return this.start}},step:{$get(){return this.step}},stop:{$get(){return this.stop}}},
methods:{indices:{$meth:function(a){a=Sk.misceval.asIndexSized(a,Sk.builtin.OverflowError);if(0>a)throw new Sk.builtin.TypeError("length should not be negative");const {start:c,stop:b,step:e}=this.slice$indices(a);return new Sk.builtin.tuple([new Sk.builtin.int_(c),new Sk.builtin.int_(b),new Sk.builtin.int_(e)])},$doc:"S.indices(len) -> (start, stop, stride)\n\nAssuming a sequence of length len, calculate the start and stop\nindices, and the stride length of the extended slice described by\nS. Out of bounds indices are clipped in a manner consistent with the\nhandling of normal slices.",
$textsig:null,$flags:{OneArg:!0}}},proto:{slice$as_indices(a){let c;var b=a?a=>Sk.misceval.asIndexSized(a,null,"slice indices must be integers or None or have an __index__ method"):a=>Sk.misceval.asIndexOrThrow(a,"slice indices must be integers or None or have an __index__ method");if(Sk.builtin.checkNone(this.step))c=1;else if(c=b(this.step),0===c)throw new Sk.builtin.ValueError("slice step cannot be zero");a=Sk.builtin.checkNone(this.start)?null:b(this.start);b=Sk.builtin.checkNone(this.stop)?null:
b(this.stop);return{start:a,stop:b,step:c}},$wrt(a,c,b,e,f){f=f?b=>JSBI.__isBigInt(b)?JSBI.add(b,JSBI.BigInt(a)):b+a:b=>b+a;0<e?(null===c?c=0:0>c&&(c=f(c),0>c&&(c=0)),null===b?b=a:b>a?b=a:0>b&&(b=f(b))):(null===c?c=a-1:c>=a?c=a-1:0>c&&(c=f(c)),null===b?b=-1:0>b&&(b=f(b),0>b&&(b=-1)));return{start:c,stop:b,step:e}},slice$indices(a,c){let {start:b,stop:e,step:f}=this.slice$as_indices(!0,c);return this.$wrt(a,b,e,f,c)},sssiter$(a,c){let {start:b,stop:e,step:f}=this.slice$indices(a,!0);if(0<f)for(a=b;a<
e;a+=f)c(a);else for(a=b;a>e;a+=f)c(a)}},flags:{sk$acceptable_as_base_class:!1}});Sk.builtin.slice.startEnd$wrt=function(a,c,b){a=a.sq$length();void 0===c||Sk.builtin.checkNone(c)?c=0:(c=Sk.misceval.asIndexSized(c,null,"slice indices must be integers or have an __index__ method"),0>c&&(c+=a,0>c&&(c=0)));void 0===b||Sk.builtin.checkNone(b)?b=a:(b=Sk.misceval.asIndexSized(b,null,"slice indices must be integers or have an __index__ method"),0>b?(b+=a,0>b&&(b=0)):b>a&&(b=a));return{start:c,end:b}}},function(m,
q){function a(a){return function(b){return Sk.builtin.checkAnySet(b)?a.call(this,b):Sk.builtin.NotImplemented.NotImplemented$}}function c(a){a instanceof Sk.builtin.set&&a.tp$hash===Sk.builtin.none.none$&&(a=new Sk.builtin.frozenset(Sk.misceval.arrayFromIterable(a)));return a}m={};Sk.builtin.set=Sk.abstr.buildNativeClass("set",{constructor:function(a){void 0===a?a=[]:Array.isArray(a)||(a=Sk.misceval.arrayFromIterable(a));Sk.asserts.assert(this instanceof Sk.builtin.set,"Bad call to set - must be called with an Array and 'new'");
const b=[];for(let c=0;c<a.length;c++)b.push(a[c]),b.push(!0);this.v=new Sk.builtin.dict(b);this.in$repr=!1},slots:{tp$getattr:Sk.generic.getAttr,tp$as_number:!0,tp$as_sequence_or_mapping:!0,tp$hash:Sk.builtin.none.none$,tp$doc:"set() -> new empty set object\nset(iterable) -> new set object\n\nBuild an unordered collection of unique elements.",tp$init(a,b){Sk.abstr.checkNoKwargs("set",b);Sk.abstr.checkArgsLen("set",a,0,1);this.set$clear();return(a=a[0])&&this.set$update(a)},tp$new:Sk.generic.new,
$r(){if(this.in$repr)return new Sk.builtin.str(Sk.abstr.typeName(this)+"(...)");this.in$repr=!0;const a=this.sk$asarray().map(a=>Sk.misceval.objectRepr(a));this.in$repr=!1;return Sk.__future__.python3?0===a.length?new Sk.builtin.str(Sk.abstr.typeName(this)+"()"):this.ob$type!==Sk.builtin.set?new Sk.builtin.str(Sk.abstr.typeName(this)+"({"+a.join(", ")+"})"):new Sk.builtin.str("{"+a.join(", ")+"}"):new Sk.builtin.str(Sk.abstr.typeName(this)+"(["+a.join(", ")+"])")},tp$iter(){return new b(this)},tp$richcompare(a,
b){if(!Sk.builtin.checkAnySet(a))return Sk.builtin.NotImplemented.NotImplemented$;switch(b){case "NotEq":case "Eq":return a=this===a?!0:this.get$size()!==a.get$size()?!1:Sk.misceval.isTrue(this.set$issubset(a)),"Eq"===b?a:!a;case "LtE":return this===a||Sk.misceval.isTrue(this.set$issubset(a));case "GtE":return this===a||Sk.misceval.isTrue(a.set$issubset(this));case "Lt":return this.get$size()<a.get$size()&&Sk.misceval.isTrue(this.set$issubset(a));case "Gt":return this.get$size()>a.get$size()&&Sk.misceval.isTrue(a.set$issubset(this))}},
nb$subtract:a(function(a){return this.difference.$meth.call(this,a)}),nb$and:a(function(a){return this.intersection.$meth.call(this,a)}),nb$or:a(function(a){return this.union.$meth.call(this,a)}),nb$xor:a(function(a){return this.symmetric_difference.$meth.call(this,a)}),nb$inplace_subtract:a(function(a){a===this&&(a=a.set$copy());return Sk.misceval.chain(this.difference_update.$meth.call(this,a),()=>this)}),nb$inplace_and:a(function(a){return Sk.misceval.chain(this.intersection_update.$meth.call(this,
a),()=>this)}),nb$inplace_or:a(function(a){return Sk.misceval.chain(this.update.$meth.call(this,a),()=>this)}),nb$inplace_xor:a(function(a){a===this&&(a=a.set$copy());return Sk.misceval.chain(this.symmetric_difference_update.$meth.call(this,a),()=>this)}),sq$length(){return this.get$size()},sq$contains(a){a=c(a);return this.v.sq$contains(a)}},methods:{add:{$meth(a){this.set$add(a);return Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:null,$doc:"Add an element to a set.\n\nThis has no effect if the element is already present."},
clear:{$meth(){this.set$clear();return Sk.builtin.none.none$},$flags:{NoArgs:!0},$textsig:null,$doc:"Remove all elements from this set."},copy:{$meth(){return this.set$copy()},$flags:{NoArgs:!0},$textsig:null,$doc:"Return a shallow copy of a set."},discard:{$meth(a){a=c(a);this.set$discard(a);return Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:null,$doc:"Remove an element from a set if it is a member.\n\nIf the element is not a member, do nothing."},difference:{$meth(...a){const b=this.set$copy();
return Sk.misceval.chain(Sk.misceval.iterArray(a,a=>b.set$difference_update(a)),()=>b)},$flags:{MinArgs:0},$textsig:null,$doc:"Return the difference of two or more sets as a new set.\n\n(i.e. all elements that are in this set but not the others.)"},difference_update:{$meth(...a){return Sk.misceval.chain(Sk.misceval.iterArray(a,a=>this.set$difference_update(a)),()=>Sk.builtin.none.none$)},$flags:{MinArgs:0},$textsig:null,$doc:"Remove all elements of another set from this set."},intersection:{$meth(...a){return this.set$intersection_multi(...a)},
$flags:{MinArgs:0},$textsig:null,$doc:"Return the intersection of two sets as a new set.\n\n(i.e. all elements that are in both sets.)"},intersection_update:{$meth(...a){return Sk.misceval.chain(this.set$intersection_multi(...a),a=>{this.swap$bodies(a);return Sk.builtin.none.none$})},$flags:{MinArgs:0},$textsig:null,$doc:"Update a set with the intersection of itself and another."},isdisjoint:{$meth(a){return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(a),a=>{if(this.sq$contains(a))return new Sk.misceval.Break(Sk.builtin.bool.false$)}),
a=>a||Sk.builtin.bool.true$)},$flags:{OneArg:!0},$textsig:null,$doc:"Return True if two sets have a null intersection."},issubset:{$meth(a){Sk.builtin.checkAnySet(a)||(a=this.set$make_basetype(a));return Sk.misceval.chain(a,a=>this.set$issubset(a))},$flags:{OneArg:!0},$textsig:null,$doc:"Report whether another set contains this set."},issuperset:{$meth(a){Sk.builtin.checkAnySet(a)||(a=this.set$make_basetype(a));return Sk.misceval.chain(a,a=>a.set$issubset(this))},$flags:{OneArg:!0},$textsig:null,
$doc:"Report whether this set contains another set."},pop:{$meth(){if(0===this.get$size())throw new Sk.builtin.KeyError("pop from an empty set");return Sk.misceval.callsimArray(this.v.popitem,[this.v]).v[0]},$flags:{NoArgs:!0},$textsig:null,$doc:"Remove and return an arbitrary set element.\nRaises KeyError if the set is empty."},remove:{$meth(a){const b=c(a);if(this.v.mp$lookup(b))return this.v.mp$ass_subscript(b),Sk.builtin.none.none$;throw new Sk.builtin.KeyError(a);},$flags:{OneArg:!0},$textsig:null,
$doc:"Remove an element from a set; it must be a member.\n\nIf the element is not a member, raise a KeyError."},symmetric_difference:{$meth(a){let b;return Sk.misceval.chain(this.set$make_basetype(a),a=>{b=a;return b.set$symmetric_diff_update(this)},()=>b)},$flags:{OneArg:!0},$textsig:null,$doc:"Return the symmetric difference of two sets as a new set.\n\n(i.e. all elements that are in exactly one of the sets.)"},symmetric_difference_update:{$meth(a){Sk.builtin.checkAnySet(a)||(a=this.set$make_basetype(a));
return Sk.misceval.chain(a,a=>this.set$symmetric_diff_update(a),()=>Sk.builtin.none.none$)},$flags:{OneArg:!0},$textsig:null,$doc:"Update a set with the symmetric difference of itself and another."},union:{$meth(...a){const b=this.set$copy();return Sk.misceval.chain(Sk.misceval.iterArray(a,a=>b.set$update(a)),()=>b)},$flags:{MinArgs:0},$textsig:null,$doc:"Return the union of sets as a new set.\n\n(i.e. all elements that are in either set.)"},update:{$meth(...a){return Sk.misceval.chain(Sk.misceval.iterArray(a,
a=>this.set$update(a)),()=>Sk.builtin.none.none$)},$flags:{MinArgs:0},$textsig:null,$doc:"Update a set with the union of itself and others."}},proto:Object.assign(m,{sk$asarray(){return this.v.sk$asarray()},get$size(){return this.v.sq$length()},set$add(a){this.v.mp$ass_subscript(a,!0)},set$make_basetype(a){return Sk.misceval.chain(Sk.misceval.arrayFromIterable(a,!0),a=>new this.sk$builtinBase(a))},set$discard(a){return this.v.pop$item(a)},set$clear(){this.v=new Sk.builtin.dict([])},set$copy(){const a=
new this.sk$builtinBase;a.v=this.v.dict$copy();return a},set$difference_update(a){return Sk.misceval.iterFor(Sk.abstr.iter(a),a=>{this.set$discard(a)})},set$intersection(a){const b=new this.sk$builtinBase;return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(a),a=>{this.sq$contains(a)&&b.set$add(a)}),()=>b)},set$intersection_multi(...a){if(!a.length)return this.set$copy();let b=this;return Sk.misceval.chain(Sk.misceval.iterArray(a,a=>Sk.misceval.chain(b.set$intersection(a),a=>{b=a})),()=>b)},
set$issubset(a){const b=this.get$size(),c=a.get$size();if(b>c)return Sk.builtin.bool.false$;for(let b=this.tp$iter(),c=b.tp$iternext();void 0!==c;c=b.tp$iternext())if(!a.sq$contains(c))return Sk.builtin.bool.false$;return Sk.builtin.bool.true$},set$symmetric_diff_update(a){return Sk.misceval.iterFor(Sk.abstr.iter(a),a=>{void 0===this.set$discard(a)&&this.set$add(a)})},set$update(a){return Sk.misceval.iterFor(Sk.abstr.iter(a),a=>{this.set$add(a)})},swap$bodies(a){this.v=a.v}})});Sk.exportSymbol("Sk.builtin.set",
Sk.builtin.set);q=Sk.builtin.set.prototype;Sk.builtin.frozenset=Sk.abstr.buildNativeClass("frozenset",{constructor:function(a){void 0===a&&(a=[]);Sk.asserts.assert(Array.isArray(a)&&this instanceof Sk.builtin.frozenset,"bad call to frozen set - must be called with an Array and 'new'");const b=[];for(let c=0;c<a.length;c++)b.push(a[c]),b.push(!0);this.v=new Sk.builtin.dict(b);this.in$repr=!1},slots:{tp$getattr:Sk.generic.getAttr,tp$as_number:!0,tp$as_sequence_or_mapping:!0,tp$doc:"frozenset() -> empty frozenset object\nfrozenset(iterable) -> frozenset object\n\nBuild an immutable unordered collection of unique elements.",
tp$hash(){let a=1927868237;const b=this.sk$asarray();a*=b.length+1;for(let c=0;c<b.length;c++){const e=Sk.abstr.objectHash(b[c]);a^=3644798167*(e^e<<16^89869747)}return 69069*a+907133923},tp$new(a,b){if(this!==Sk.builtin.frozenset.prototype)return this.$subtype_new(a,b);Sk.abstr.checkNoKwargs("frozenset",b);Sk.abstr.checkArgsLen("frozenset",a,0,1);a=a[0];return void 0!==a&&a.ob$type===Sk.builtin.frozenset?a:Sk.misceval.chain(Sk.misceval.arrayFromIterable(a,!0),a=>a.length?new Sk.builtin.frozenset(a):
Sk.builtin.frozenset.$emptyset)},$r:q.$r,tp$iter:q.tp$iter,tp$richcompare:q.tp$richcompare,nb$subtract:q.nb$subtract,nb$and:q.nb$and,nb$or:q.nb$or,nb$xor:q.nb$xor,sq$length:q.sq$length,sq$contains:q.sq$contains},methods:{copy:Object.assign({},q.copy.d$def,{$meth(){return this.constructor===this.sk$builtinBase?this:new Sk.builtin.frozenset(this.sk$asarray())}}),difference:q.difference.d$def,intersection:q.intersection.d$def,isdisjoint:q.isdisjoint.d$def,issubset:q.issubset.d$def,issuperset:q.issuperset.d$def,
symmetric_difference:q.symmetric_difference.d$def,union:q.union.d$def},proto:Object.assign({$subtype_new(a,b){const c=new this.constructor;return Sk.misceval.chain(Sk.builtin.frozenset.prototype.tp$new(a),a=>{c.v=a.v;return c})}},m)});Sk.builtin.frozenset.$emptyset=Object.create(Sk.builtin.frozenset.prototype,{v:{value:new Sk.builtin.dict([]),enumerable:!0},in$repr:{value:!1,enumerable:!0}});Sk.exportSymbol("Sk.builtin.frozenset",Sk.builtin.frozenset);var b=Sk.abstr.buildIteratorClass("set_iterator",
{constructor:function(a){this.$index=0;this.$seq=a.sk$asarray();this.$orig=a},iternext:Sk.generic.iterNextWithArrayCheckSize,methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},flags:{sk$acceptable_as_base_class:!1}})},function(m,q){Sk.builtin.print=function(a,c){let [b,e,f]=Sk.abstr.copyKeywordsToNamedArgs("print",["sep","end","file","flush"],[],c);if(void 0===b||Sk.builtin.checkNone(b))b=" ";else if(Sk.builtin.checkString(b))b=b.$jsstr();else throw new Sk.builtin.TypeError("sep must be None or a string, not "+
Sk.abstr.typeName(b));if(void 0===e||Sk.builtin.checkNone(e))e="\n";else if(Sk.builtin.checkString(e))e=e.$jsstr();else throw new Sk.builtin.TypeError("end must be None or a string, not "+Sk.abstr.typeName(e));let l;if(void 0!==f&&!Sk.builtin.checkNone(f)&&(l=Sk.abstr.lookupSpecial(f,Sk.builtin.str.$write),void 0===l))throw new Sk.builtin.AttributeError("'"+Sk.abstr.typeName(f)+"' object has no attribute 'write'");const h=new Sk.builtin.str(a.map(a=>(new Sk.builtin.str(a)).toString()).join(b)+e);
if(void 0!==l)Sk.misceval.callsimArray(l,[h]);else return Sk.misceval.chain(Sk.importModule("sys",!1,!0),a=>(l=Sk.abstr.lookupSpecial(a.$d.stdout,Sk.builtin.str.$write))&&Sk.misceval.callsimOrSuspendArray(l,[h]))};Sk.builtin.print.co_fastcall=1},function(m,q){Sk.builtin.module=Sk.abstr.buildNativeClass("module",{constructor:function(){this.$d={}},slots:{tp$doc:"Create a module object.\n\nThe name must be a string; the optional doc argument can have any type.",tp$getattr(a,c){var b=this.$d[a.$mangled];
if(void 0!==b)return b;b=this.ob$type.$typeLookup(a);if(void 0!==b){const a=b.tp$descr_get;return a?a.call(b,this,this.ob$type,c):b}const e=this.$d.__getattr__;if(void 0!==e)return b=Sk.misceval.tryCatch(()=>Sk.misceval.callsimOrSuspendArray(e,[a]),a=>{if(!(a instanceof Sk.builtin.AttributeError))throw a;}),c?b:Sk.misceval.retryOptionalSuspensionOrThrow(b)},tp$setattr:Sk.generic.setAttr,tp$new:Sk.generic.new,tp$init(a,c){const [b,e]=Sk.abstr.copyKeywordsToNamedArgs("module",["name","doc"],a,c,[Sk.builtin.none.none$]);
Sk.builtin.pyCheckType("module","string",b);this.init$dict(b,e)},$r(){let a=this.get$name();if(void 0!==a){var c=this.get$mod_reprf();if(void 0!==c)return Sk.misceval.callsimOrSuspendArray(c,[this])}a=void 0===a?"'?'":a;c=this.from$file();c=void 0===c?this.empty_or$loader():c;return new Sk.builtin.str("<module "+a+c+">")}},getsets:{__dict__:{$get(){return new Sk.builtin.mappingproxy(this.$d)}}},methods:{__dir__:{$meth(){const a=this.tp$getattr(Sk.builtin.str.$dict);if(!Sk.builtin.checkMapping(a))throw new Sk.builtin.TypeError("__dict__ is not a dictionary");
const c=a.mp$lookup(Sk.builtin.str.$dir);return void 0!==c?Sk.misceval.callsimOrSuspendArray(c,[]):new Sk.builtin.list(Sk.misceval.arrayFromIterable(a))},$flags:{NoArgs:!0},$doc:"__dir__() -> list\nspecialized dir() implementation"}},proto:{init$dict(a,c){this.$d.__name__=a;this.$d.__doc__=c;this.$d.__package__=Sk.builtin.none.none$;this.$d.__spec__=Sk.builtin.none.none$;this.$d.__loader__=Sk.builtin.none.none$},sk$attrError(){const a=this.get$name();return void 0===a?"module":"module "+a},get$name(){const a=
this.tp$getattr(Sk.builtin.str.$name);return a&&Sk.misceval.objectRepr(a)},from$file(){const a=this.tp$getattr(Sk.builtin.str.$file);return a&&" from "+Sk.misceval.objectRepr(a)},empty_or$loader(){if(this.$js&&this.$js.includes("$builtinmodule"))return" (built-in)";const a=this.tp$getattr(Sk.builtin.str.$loader);return void 0===a||Sk.builtin.checkNone(a)?"":" ("+Sk.misceval.objectRepr(a)+")"},get$mod_reprf(){const a=this.tp$getattr(Sk.builtin.str.$loader);return a&&a.tp$getattr(this.str$mod_repr)},
str$mod_repr:new Sk.builtin.str("module_repr")}});Sk.exportSymbol("Sk.builtin.module",Sk.builtin.module)},function(m,q){Sk.builtin.structseq_types={};Sk.builtin.make_structseq=function(a,c,b,e){const f=a+"."+c,l=[];a=[];for(let c in b)l.push(c),a.push(b[c]);b={};for(let c=0;c<l.length;c++)b[l[c]]={$get(){return this.v[c]},$doc:a[c]};var h=Sk.abstr.buildNativeClass(f,{constructor:function(a){Sk.asserts.assert((Array.isArray(a)||void 0===a)&&this instanceof h);Sk.builtin.tuple.call(this,a)},base:Sk.builtin.tuple,
slots:{tp$new(a,b){Sk.abstr.checkOneArg(f,a,b);b=[];a=a[0];for(let c=Sk.abstr.iter(a),d=c.tp$iternext();void 0!==d;d=c.tp$iternext())b.push(d);if(b.length!=l.length)throw new Sk.builtin.TypeError(f+"() takes a "+l.length+"-sequence ("+b.length+"-sequence given)");return new h(b)},tp$doc:e?e:Sk.builtin.none.none$,$r(){var a;if(0===this.v.length)return new Sk.builtin.str(f+"()");var b=[];for(a=0;a<this.v.length;++a)b[a]=l[a]+"="+Sk.misceval.objectRepr(this.v[a]);a=b.join(", ");1===this.v.length&&(a+=
",");return new Sk.builtin.str(f+"("+a+")")}},methods:{__reduce__:{$meth(){throw new Sk.builtin.NotImplementedError("__reduce__ is not implemented");},$flags:{NoArgs:!0}}},getsets:b,proto:{num_sequence_fields:new Sk.builtin.int_(l.length)}});return h};Sk.exportSymbol("Sk.builtin.make_structseq",Sk.builtin.make_structseq)},function(m,q){Sk.builtin.generator=Sk.abstr.buildIteratorClass("generator",{constructor:function(a,c,b,e,f){var l;if(a){if(!(this instanceof Sk.builtin.generator))throw new TypeError("bad internal call to generator, use 'new'");
this.func_code=a;this.func_globals=c||null;this.gi$running=!1;this.gi$resumeat=0;this.gi$sentvalue=void 0;this.gi$locals={};this.gi$cells={};if(0<b.length)for(c=0;c<a.co_varnames.length;++c)this.gi$locals[a.co_varnames[c]]=b[c];if(void 0!==f)for(l in f)e[l]=f[l];this.func_closure=e}},slots:{$r(){return new Sk.builtin.str("<generator object "+this.func_code.co_name.v+">")}},iternext(a,c){var b=this;this.gi$running=!0;void 0===c&&(c=Sk.builtin.none.none$);this.gi$sentvalue=c;c=[this];this.func_closure&&
c.push(this.func_closure);return function l(c){if(c instanceof Sk.misceval.Suspension){if(a)return new Sk.misceval.Suspension(l,c);c=Sk.misceval.retryOptionalSuspensionOrThrow(c)}b.gi$running=!1;Sk.asserts.assert(void 0!==c);if(c!==Sk.builtin.none.none$)return b.gi$resumeat=c[0],c=c[1]}(this.func_code.apply(this.func_globals,c))},methods:{send:{$meth(a){return this.tp$iternext(!0,a)},$flags:{OneArg:!0},$doc:"send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration."}}});
Sk.exportSymbol("Sk.builtin.generator",Sk.builtin.generator);Sk.builtin.makeGenerator=function(a,c){var b,e=new Sk.builtin.generator(null,null,null);e.tp$iternext=a;for(b in c)c.hasOwnProperty(b)&&(e[b]=c[b]);return e};Sk.exportSymbol("Sk.builtin.makeGenerator",Sk.builtin.makeGenerator)},function(m,q){Sk.builtin.file=function(a,c,b){var e;if(!(this instanceof Sk.builtin.file))return new Sk.builtin.file(a,c,b);this.mode=c;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("w"===Sk.ffi.remapToJs(this.mode))this.fileno=Sk.builtin.file.currentFileno++;else for(e in this.fileno=Sk.inBrowser?10:11,this.data$=Sk.read(a.v),this.lineList=this.data$.split("\n"),this.lineList=this.lineList.slice(0,-1),this.lineList)this.lineList[e]+="\n";this.currentLine=0}this.pos$=0;Sk.fileopen&&10<=this.fileno&&Sk.fileopen(this);return this};Sk.builtin.file.currentFileno=
12;Sk.abstr.setUpInheritance("file",Sk.builtin.file,Sk.builtin.object);Sk.abstr.setUpBuiltinMro(Sk.builtin.file);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.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.abstr.setUpSlots(Sk.builtin.file);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.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,c){var b=a.data$.length;if(a.closed)throw new Sk.builtin.ValueError("I/O operation on closed file");var e=void 0===c?b:Sk.ffi.remapToJs(c);e=new Sk.builtin.str(a.data$.substr(a.pos$,e));a.pos$=void 0===c?b:a.pos$+Sk.ffi.remapToJs(c);a.pos$>=b&&(a.pos$=b);return e});Sk.builtin.file.$readline=function(a,c,b){if(0===a.fileno){a=Sk.ffi.remapToJs(b);a=Sk.inputfun(a?
a:"");if(a instanceof Promise||a&&"function"===typeof a.then){var e=new Sk.misceval.Suspension;e.resume=function(){if(e.data.error)throw e.data.error;return new Sk.builtin.str(e.data.result)};e.data={type:"Sk.promise",promise:a};return e}return new Sk.builtin.str(a)}c="";a.currentLine<a.lineList.length&&(c=a.lineList[a.currentLine],a.currentLine++);return new Sk.builtin.str(c)};Sk.builtin.file.prototype.readline=new Sk.builtin.func(function(a,c){return Sk.builtin.file.$readline(a,c,void 0)});Sk.builtin.file.prototype.readlines=
new Sk.builtin.func(function(a,c){if(0===a.fileno)return new Sk.builtin.NotImplementedError("readlines ins't implemented because the web doesn't support Ctrl+D");var b=[];for(c=a.currentLine;c<a.lineList.length;c++)b.push(new Sk.builtin.str(a.lineList[c]));return new Sk.builtin.list(b)});Sk.builtin.file.prototype.seek=new Sk.builtin.func(function(a,c,b){c=Sk.ffi.remapToJs(c);void 0===b&&(b=0);0===b?a.pos$=c:1==b?a.pos$=a.data$.length+c:2==b&&(a.pos$=a.data$.length+c);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,c){Sk.asserts.fail()});Sk.builtin.file.prototype.write=new Sk.builtin.func(function(a,c){var b=Sk.ffi.remapToJs(a.mode);Sk.ffi.remapToJs(c);if("w"===b||"wb"===b||"a"===b||"ab"===b)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(c)):Sk.filewrite(a,c)}else 1===
a.fileno?Sk.output(Sk.ffi.remapToJs(c)):Sk.asserts.fail();return Sk.builtin.none.none$});Sk.exportSymbol("Sk.builtin.file",Sk.builtin.file)},function(m,q){Sk.ffi=Sk.ffi||{};Sk.ffi.remapToPy=function(a){var c;if(null===a||"undefined"===typeof a)return Sk.builtin.none.none$;if(a.ob$type||a instanceof Sk.misceval.Suspension)return a;if("[object Array]"===Object.prototype.toString.call(a)){var b=[];for(c=0;c<a.length;++c)b.push(Sk.ffi.remapToPy(a[c]));return new Sk.builtin.list(b)}if("object"===typeof a){b=
[];for(c in a)b.push(Sk.ffi.remapToPy(c)),b.push(Sk.ffi.remapToPy(a[c]));return new Sk.builtin.dict(b)}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 c,
b;if(a instanceof Sk.builtin.dict){var e={};a.$items().forEach(([a,c])=>{b=Sk.ffi.remapToJs(a);e[b]=Sk.ffi.remapToJs(c)});return e}if(a instanceof Sk.builtin.list||a instanceof Sk.builtin.tuple){e=[];for(c=0;c<a.v.length;++c)e.push(Sk.ffi.remapToJs(a.v[c]));return e}if(a instanceof Sk.builtin.bool)return a.v?!0:!1;if(a instanceof Sk.builtin.int_||a instanceof Sk.builtin.float_||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,c){a=new a;a.v=c;return a};Sk.exportSymbol("Sk.ffi.stdwrap",Sk.ffi.stdwrap);Sk.ffi.basicwrap=function(a){if(a instanceof Sk.builtin.int_||a instanceof Sk.builtin.float_||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,q){function a(a,b,e){a=void 0===a?a:Sk.misceval.asIndexOrThrow(a);b=void 0===
b?b:Sk.misceval.asIndexOrThrow(b);e=void 0===e?e:Sk.misceval.asIndexOrThrow(e);if(void 0===b&&void 0===e)b=a,a=0,e=1;else if(void 0===e)e=1;else if(0===e)throw new Sk.builtin.ValueError("range() step argument must not be zero");const d=[];if("number"===typeof a&&"number"===typeof b&&"number"===typeof e)if(0<e)for(var f=a;f<b;f+=e)d.push(new Sk.builtin.int_(f));else for(f=a;f>b;f+=e)d.push(new Sk.builtin.int_(f));else{a=f=JSBI.BigInt(a);e=JSBI.BigInt(e);b=JSBI.BigInt(b);if(JSBI.greaterThan(e,JSBI.__ZERO))for(;JSBI.lessThan(f,
b);)d.push(new Sk.builtin.int_(c(f))),f=JSBI.add(f,e);else for(;JSBI.greaterThan(f,b);)d.push(new Sk.builtin.int_(c(f))),f=JSBI.add(f,e);a=c(a);e=c(e);b=c(b)}return new Sk.builtin.range_(a,b,e,d)}function c(a){return JSBI.lessThan(a,JSBI.__MAX_SAFE)&&JSBI.greaterThan(a,JSBI.__MIN_SAFE)?JSBI.toNumber(a):a}Sk.builtin.range_=Sk.abstr.buildNativeClass("range",{constructor:function(a,b,c,d){this.start=a;this.stop=b;this.step=c;this.v=d},slots:{tp$getattr:Sk.generic.getAttr,tp$as_sequence_or_mapping:!0,
tp$doc:"range(stop) -> range object\nrange(start, stop[, step]) -> range object\n\nReturn an object that produces a sequence of integers from start (inclusive)\nto stop (exclusive) by step.  range(i, j) produces i, i+1, i+2, ..., j-1.\nstart defaults to 0, and stop is omitted!  range(4) produces 0, 1, 2, 3.\nThese are exactly the valid indices for a list of 4 elements.\nWhen step is given, it specifies the increment (or decrement).",tp$new(b,c){Sk.abstr.checkNoKwargs("range",c);Sk.abstr.checkArgsLen("range",
b,1,3);return a(b[0],b[1],b[2])},$r(){let a="range("+this.start+", "+this.stop;1!=this.step&&(a+=", "+this.step);return new Sk.builtin.str(a+")")},tp$richcompare(a,b){if("Eq"!==b&&"NotEq"!==b||a.ob$type!==Sk.builtin.range_)return Sk.builtin.NotImplemented.NotImplemented$;a=new Sk.builtin.list(a.v);return(new Sk.builtin.list(this.v)).tp$richcompare(a,b)},tp$iter(){return new b(this)},nb$bool(){return 0!==this.v.length},sq$contains(a){const b=this.v;for(let c=0;c<b.length;c++)if(Sk.misceval.richCompareBool(a,
b[c],"Eq"))return!0;return!1},sq$length(){return this.v.length},mp$subscript(a){if(Sk.misceval.isIndex(a)){a=Sk.misceval.asIndexSized(a);0>a&&(a=this.v.length+a);if(0>a||a>=this.v.length)throw new Sk.builtin.IndexError("range object index out of range");return this.v[a]}if(a.constructor===Sk.builtin.slice){const b=[],c=this.v;a.sssiter$(c.length,a=>{b.push(c[a])});let {start:d,stop:e,step:f}=a.slice$indices(c.length);d=Sk.misceval.asIndex(c[d])||this.start;e=Sk.misceval.asIndex(c[e])||this.stop;f=
"number"===typeof this.step?f*this.step:JSBI.multiply(this.step,JSBI.BigInt(f));return new Sk.builtin.range_(d,e,f,b)}throw new Sk.builtin.TypeError("range indices must be integers or slices, not "+Sk.abstr.typeName(a));}},getsets:{start:{$get(){return new Sk.builtin.int_(this.start)}},step:{$get(){return new Sk.builtin.int_(this.step)}},stop:{$get(){return new Sk.builtin.int_(this.stop)}}},methods:{__reversed__:{$meth(){return new e(this)},$flags:{NoArgs:!0},$textsig:null,$doc:"Return a reverse iterator."},
count:{$meth(a){let b=0;for(let c=0;c<this.v.length;c++)Sk.misceval.richCompareBool(a,this.v[c],"Eq")&&b++;return new Sk.builtin.int_(b)},$flags:{OneArg:!0},$textsig:null,$doc:"rangeobject.count(value) -> integer -- return number of occurrences of value"},index:{$meth(a){for(let b=0;b<this.v.length;b++)if(Sk.misceval.richCompareBool(a,this.v[b],"Eq"))return new Sk.builtin.int_(b);throw new Sk.builtin.ValueError(Sk.misceval.objectRepr(a)+"is not in range");},$flags:{OneArg:!0},$textsig:null,$doc:"rangeobject.index(value, [start, [stop]]) -> integer -- return index of value.\nRaise ValueError if the value is not present."}},
proto:{sk$asarray(){return this.v.slice(0)}},flags:{sk$acceptable_as_base_class:!1}});var b=Sk.abstr.buildIteratorClass("range_iterator",{constructor:function(a){this.$index=0;this.$seq=a.v},iternext(){return this.$seq[this.$index++]},methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},flags:{sk$acceptable_as_base_class:!1}}),e=Sk.abstr.buildIteratorClass("range_reverseiterator",{constructor:function(a){this.$seq=a.v;this.$index=this.$seq.length-1},iternext(){return this.$seq[this.$index--]},
methods:{__length_hint__:Sk.generic.iterReverseLengthHintMethodDef},flags:{sk$acceptable_as_base_class:!1}});Sk.builtin.range=Sk.builtin.xrange=function(b,c,e){b=a(b,c,e);return new Sk.builtin.list(b.v)}},function(m,q){Sk.builtin.enumerate=Sk.abstr.buildIteratorClass("enumerate",{constructor:function(a,c){if(!(this instanceof Sk.builtin.enumerate))throw TypeError("Failed to construct 'enumerate': Please use the 'new' operator");this.$iterable=a;this.$index=c;return this},iternext(a){const c=Sk.misceval.chain(this.$iterable.tp$iternext(a),
a=>{if(void 0!==a)return new Sk.builtin.tuple([new Sk.builtin.int_(this.$index++),a])});return a?c:Sk.misceval.retryOptionalSuspensionOrThrow(c)},slots:{tp$doc:"Return an enumerate object.\n\n  iterable\n    an object supporting iteration\n\nThe enumerate object yields pairs containing a count (from start, which\ndefaults to zero) and a value yielded by the iterable argument.\n\nenumerate is useful for obtaining an indexed list:\n    (0, seq[0]), (1, seq[1]), (2, seq[2]), ...",tp$new(a,c){let [b,
e]=Sk.abstr.copyKeywordsToNamedArgs("enumerate",["iterable","start"],a,c,[new Sk.builtin.int_(0)]);b=Sk.abstr.iter(b);e=Sk.misceval.asIndexOrThrow(e);if(this===Sk.builtin.enumerate.prototype)return new Sk.builtin.enumerate(b,e);a=new this.constructor;Sk.builtin.enumerate.call(a,b,e);return a}}});Sk.exportSymbol("Sk.builtin.enumerate",Sk.builtin.enumerate)},function(m,q){Sk.builtin.filter_=Sk.abstr.buildIteratorClass("filter",{constructor:function(a,c){this.$func=a;this.$iterable=c},iternext(a){const c=
Sk.misceval.iterFor(this.$iterable,a=>Sk.misceval.chain(this.check$filter(a),a=>a?new Sk.misceval.Break(a):void 0));return a?c:Sk.misceval.retryOptionalSuspensionOrThrow(c)},slots:{tp$doc:"Return an iterator yielding those items of iterable for which function(item)\nis true. If function is None, return the items that are true.",tp$new(a,c){let [b,e]=Sk.abstr.copyKeywordsToNamedArgs("filter",["predicate","iterable"],a,c,[]);b=Sk.builtin.checkNone(b)?null:b;e=Sk.abstr.iter(e);if(this===Sk.builtin.filter_.prototype)return new Sk.builtin.filter_(b,
e);a=new this.constructor;Sk.builtin.filter_.call(a,b,e);return a}},proto:{check$filter(a){let c;c=null===this.$func?a:Sk.misceval.callsimOrSuspendArray(this.$func,[a]);return Sk.misceval.chain(c,b=>Sk.misceval.isTrue(b)?a:void 0)}}});Sk.exportSymbol("Sk.builtin.filter_",Sk.builtin.filter_)},function(m,q){Sk.builtin.map_=Sk.abstr.buildIteratorClass("map",{constructor:function(a,c){this.$func=a;this.$iters=c},iternext(a){const c=[],b=Sk.misceval.chain(Sk.misceval.iterArray(this.$iters,b=>Sk.misceval.chain(b.tp$iternext(a),
a=>{if(void 0===a)return new Sk.misceval.Break(!0);c.push(a)})),a=>a?void 0:Sk.misceval.callsimOrSuspendArray(this.$func,c));return a?b:Sk.misceval.retryOptionalSuspensionOrThrow(b)},slots:{tp$doc:"map(func, *iterables) --\x3e map object\n\nMake an iterator that computes the function using arguments from\neach of the iterables.  Stops when the shortest iterable is exhausted.",tp$new(a,c){this===Sk.builtin.map_.prototype&&Sk.abstr.checkNoKwargs("map",c);Sk.abstr.checkArgsLen("map",a,2);c=a[0];const b=
[];for(let c=1;c<a.length;c++)b.push(Sk.abstr.iter(a[c]));if(this===Sk.builtin.map_.prototype)return new Sk.builtin.map_(c,b);a=new this.constructor;Sk.builtin.map_.call(a,c,b);return a}}});Sk.exportSymbol("Sk.builtin.map_",Sk.builtin.map_)},function(m,q){Sk.builtin.reversed=Sk.abstr.buildIteratorClass("reversed",{constructor:function(a){this.$idx=a.sq$length()-1;this.$seq=a;return this},iternext(a){if(!(0>this.$idx)){var c=Sk.misceval.tryCatch(()=>Sk.abstr.objectGetItem(this.$seq,new Sk.builtin.int_(this.$idx--),
a),a=>{if(a instanceof Sk.builtin.IndexError)this.$idx=-1;else throw a;});return a?c:Sk.misceval.retryOptionalSuspensionOrThrow(c)}},slots:{tp$doc:"Return a reverse iterator over the values of the given sequence.",tp$new(a,c){this===Sk.builtin.reversed.prototype&&Sk.abstr.checkNoKwargs("reversed",c);Sk.abstr.checkArgsLen("reversed",a,1,1);a=a[0];c=Sk.abstr.lookupSpecial(a,Sk.builtin.str.$reversed);if(void 0!==c)return Sk.misceval.callsimArray(c,[]);if(!Sk.builtin.checkSequence(a)||void 0===Sk.abstr.lookupSpecial(a,
Sk.builtin.str.$len))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not a sequence");if(this===Sk.builtin.reversed.prototype)return new Sk.builtin.reversed(a);c=new this.constructor;Sk.builtin.reversed.call(c,a);return c}},methods:{__length_hint__:{$meth:function(){return 0<=this.$idx?new Sk.builtin.int_(this.$idx):new Sk.builtin.int_(0)},$flags:{NoArgs:!0}}}})},function(m,q){Sk.builtin.zip_=Sk.abstr.buildIteratorClass("zip",{constructor:function(a){this.$iters=a;0===a.length&&
(this.tp$iternext=()=>{})},iternext(a){const c=[],b=Sk.misceval.chain(Sk.misceval.iterArray(this.$iters,b=>Sk.misceval.chain(b.tp$iternext(a),a=>{if(void 0===a)return new Sk.misceval.Break(!0);c.push(a)})),a=>a?void 0:new Sk.builtin.tuple(c));return a?b:Sk.misceval.retryOptionalSuspensionOrThrow(b)},slots:{tp$doc:"zip(iter1 [,iter2 [...]]) --\x3e zip object\n\nReturn a zip object whose .__next__() method returns a tuple where\nthe i-th element comes from the i-th iterable argument.  The .__next__()\nmethod continues until the shortest iterable in the argument sequence\nis exhausted and then it raises StopIteration.",
tp$new(a,c){this===Sk.builtin.zip_.prototype&&Sk.abstr.checkNoKwargs("zip",c);c=[];for(let b=0;b<a.length;b++)try{c.push(Sk.abstr.iter(a[b]))}catch(e){if(e instanceof Sk.builtin.TypeError)throw new Sk.builtin.TypeError("zip argument #"+(b+1)+" must support iteration");throw e;}if(this===Sk.builtin.zip_.prototype)return new Sk.builtin.zip_(c);a=new this.constructor;Sk.builtin.zip_.call(a,c);return a}}});Sk.exportSymbol("Sk.builtin.zip_",Sk.builtin.zip_)},function(m,q){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.T_NOTEQUAL,"%":a.T_PERCENT,"%=":a.T_PERCENTEQUAL,"&":a.T_AMPER,"&=":a.T_AMPEREQUAL,"(":a.T_LPAR,")":a.T_RPAR,"*":a.T_STAR,"**":a.T_DOUBLESTAR,"**=":a.T_DOUBLESTAREQUAL,"*=":a.T_STAREQUAL,"+":a.T_PLUS,"+=":a.T_PLUSEQUAL,
",":a.T_COMMA,"-":a.T_MINUS,"-=":a.T_MINEQUAL,"->":a.T_RARROW,".":a.T_DOT,"...":a.T_ELLIPSIS,"/":a.T_SLASH,"//":a.T_DOUBLESLASH,"//=":a.T_DOUBLESLASHEQUAL,"/=":a.T_SLASHEQUAL,":":a.T_COLON,";":a.T_SEMI,"<":a.T_LESS,"<<":a.T_LEFTSHIFT,"<<=":a.T_LEFTSHIFTEQUAL,"<=":a.T_LESSEQUAL,"=":a.T_EQUAL,"==":a.T_EQEQUAL,">":a.T_GREATER,">=":a.T_GREATEREQUAL,">>":a.T_RIGHTSHIFT,">>=":a.T_RIGHTSHIFTEQUAL,"@":a.T_AT,"@=":a.T_ATEQUAL,"[":a.T_LSQB,"]":a.T_RSQB,"^":a.T_CIRCUMFLEX,"^=":a.T_CIRCUMFLEXEQUAL,"{":a.T_LBRACE,
"|":a.T_VBAR,"|=":a.T_VBAREQUAL,"}":a.T_RBRACE,"~":a.T_TILDE};var c={};(function(){for(var b in a)c[a[b]]=b})();["tok_name","ISTERMINAL","ISNONTERMINAL","ISEOF"].concat(Object.keys(c).map(function(a){return c[a]}));Sk.token={};Sk.token.tokens=a;Sk.token.tok_name=c;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,q){function a(a,b,c,d,e){this.type=a;this.string=b;this.start=c;this.end=d;this.line=e}function c(a){return"("+Array.prototype.slice.call(arguments).join("|")+")"}function b(a){return c.apply(null,arguments)+
"?"}function e(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1}function f(){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(" ")}function l(a){a?delete Sk.token.EXACT_TOKEN_TYPES["<>"]:Sk.token.EXACT_TOKEN_TYPES["<>"]=Sk.token.tokens.T_NOTEQUAL;t=Object.keys(Sk.token.EXACT_TOKEN_TYPES).sort();v=c.apply(this,t.reverse().map(function(a){return a&&k.test(a)?a.replace(n,"\\$&"):a}));B=c("\\r?\\n",v)}var h=Sk.token.tokens;const d=Sk.builtin.SyntaxError,g=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 n=/[\\^$.*+?()[\]{}|]/g,k=RegExp(n.source);const p=function(){var a=c("[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]"),b=c(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+"+"+b+"*$","u");a=c("[A-Z]","[a-z]","_");b=c(a,"[0-9]");return new RegExp("^"+a+"+"+b+"*$")}();(function(a){return c.apply(null,arguments)+"*"})("\\\\\\r?\\n[ \\f\\t]*");b("#[^\\r\\n]*");m=c("[0-9](?:_?[0-9])*\\.(?:[0-9](?:_?[0-9])*)?","\\.[0-9](?:_?[0-9])*")+b("[eE][-+]?[0-9](?:_?[0-9])*");var u=c(m,"[0-9](?:_?[0-9])*[eE][-+]?[0-9](?:_?[0-9])*"),A=c("[0-9](?:_?[0-9])*[jJ]",
u+"[jJ]");m=c.apply(null,f());q=c(m+"'''",m+'"""');c(m+"'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*'",m+'"[^\\n"\\\\]*(?:\\\\.[^\\n"\\\\]*)*"');var t,v,B;l(!0);Sk.token.setupTokens=l;var D=c(m+"'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*"+c("'","\\\\\\r?\\n"),m+'"[^\\n"\\\\]*(?:\\\\.[^\\n"\\\\]*)*'+c('"',"\\\\\\r?\\n")),E=c("\\\\\\r?\\n|$","#[^\\r\\n]*",q),F={};m=f();for(let a of m)F[a+"'"]="^[^'\\\\]*(?:\\\\.[^'\\\\]*)*'",F[a+'"']='^[^"\\\\]*(?:\\\\.[^"\\\\]*)*"',F[a+"'''"]="^[^'\\\\]*(?:(?:\\\\.|'(?!''))[^'\\\\]*)*'''",
F[a+'"""']='^[^"\\\\]*(?:(?:\\\\.|"(?!""))[^"\\\\]*)*"""';let M=[],V=[];for(let a of m)M.push(a+'"'),M.push(a+"'"),V.push(a+'"""'),V.push(a+"'''");Sk._tokenize=function(b,f,k,n){var l=Sk.__future__.python3?"":"(?:L?)";l=c("0[xX](?:_?[0-9a-fA-F])+"+l,"0[bB](?:_?[01])+"+l,Sk.__future__.silent_octal_literal?"0([oO]?)(?:_?[0-7])+"+l:"0([oO])(?:_?[0-7])+"+l,"(?:0(?:_?0)*|[1-9](?:_?[0-9])*)"+l);l=c(A,u,l);l="[ \\f\\t]*"+c(E,l,B,D,"\\w+");l=new RegExp(l);var m=0,t=0,q=0,v="",y=0,G=null,L=[0],H,T=void 0,
X=void 0,I,R;void 0!==k&&("utf-8-sig"==k&&(k="utf-8"),n(new a(h.T_ENCODING,k,[0,0],[0,0],"")));for(var C=k="";;){try{k=C,C=f()}catch(O){C=""}m+=1;var w=0,N=C.length;if(v){if(!C)throw new d("EOF in multi-line string",b,X[0],X[1]);T.lastIndex=0;var r=T.exec(C);if(r)w=I=r[0].length,n(new a(h.T_STRING,v+C.substring(0,I),X,[m,I],G+C)),v="",y=0,G=null;else{y&&"\\\n"!==C.substring(C.length-2)&&"\\\r\n"!==C.substring(C.length-3)?(n(new a(h.T_ERRORTOKEN,v+C,X,[m,C.length],G)),v="",G=null):(v+=C,G+=C);continue}}else if(0!=
t||q){if(!C)throw new d("EOF in multi-line statement",b,m,0);q=0}else{if(!C)break;for(H=0;w<N;){if(" "==C[w])H+=1;else if("\t"==C[w])H=8*Math.floor(H/8+1);else if("\f"==C[w])H=0;else break;w+=1}if(w==N)break;if(e("#\r\n",C[w])){if("#"==C[w]){H=C.substring(w);for(N=H.length;0<N&&-1!=="\r\n".indexOf(H.charAt(N-1));--N);N=H.substring(0,N);n(new a(h.T_COMMENT,N,[m,w],[m,w+N.length],C));w+=N.length}n(new a(h.T_NL,C.substring(w),[m,w],[m,C.length],C));continue}H>L[L.length-1]&&(L.push(H),n(new a(h.T_INDENT,
C.substring(w),[m,0],[m,w],C)));for(;H<L[L.length-1];){if(!e(L,H))throw new g("unindent does not match any outer indentation level",b,m,w);L=L.slice(0,-1);n(new a(h.T_DEDENT,"",[m,w],[m,w],C))}}for(;w<N;){for(H=C.charAt(w);" "===H||"\f"===H||"\t"===H;)w+=1,H=C.charAt(w);if(R=l.exec(C.substring(w))){if(H=w,I=H+R[1].length,R=[m,H],r=[m,I],w=I,H!=I){I=C.substring(H,I);var z=C[H];if(e("0123456789",z)||"."==z&&"."!=I&&"..."!=I)n(new a(h.T_NUMBER,I,R,r,C));else if(e("\r\n",z))0<t?n(new a(h.T_NL,I,R,r,C)):
n(new a(h.T_NEWLINE,I,R,r,C));else if("#"==z)n(new a(h.T_COMMENT,I,R,r,C));else if(e(V,I))if(T=RegExp(F[I]),r=T.exec(C.substring(w)))w=r[0].length+w,I=C.substring(H,w),n(new a(h.T_STRING,I,R,[m,w],C));else{X=[m,H];v=C.substring(H);G=C;break}else if(e(M,z)||e(M,I.substring(0,2))||e(M,I.substring(0,3)))if("\n"==I[I.length-1]){X=[m,H];T=RegExp(F[z]||F[I[1]]||F[I[2]]);v=C.substring(H);y=1;G=C;break}else n(new a(h.T_STRING,I,R,r,C));else H=z.normalize("NFKC"),p.test(H)?n(new a(h.T_NAME,I,R,r,C)):"\\"==
z?q=1:(e("([{",z)?t+=1:e(")]}",z)&&--t,n(new a(h.T_OP,I,R,r,C)))}}else n(new a(h.T_ERRORTOKEN,C[w],[m,w],[m,w+1],C)),w+=1}}k&&!e("\r\n",k[k.length-1])&&n(new a(h.T_NEWLINE,"",[m-1,k.length],[m-1,k.length+1],""));for(var Z in L.slice(1))n(new a(h.T_DEDENT,"",[m,0],[m,0],""));n(new a(h.T_ENDMARKER,"",[m,0],[m,0],""))};Sk.exportSymbol("Sk._tokenize",Sk._tokenize)},function(m,q){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,q){function a(a,c){this.filename=a;this.grammar=c;this.p_flags=0;return this}function c(b,c){void 0===c&&(c="file_input");b=new a(b,Sk.ParseTables);"file_input"===c?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,c,f){var b,e=this.classify(a,c,f);a:for(;;){var d=this.stack[this.stack.length-1];var g=d.dfa[0];var n=g[d.state];for(b=0;b<n.length;++b){var k=n[b][0];var p=n[b][1];var m=this.grammar.labels[k][0];if(e===k){Sk.asserts.assert(256>m);this.shift(a,c,p,f);for(f=p;1===g[f].length&&0===g[f][0][0]&&g[f][0][1]===f;){this.pop();if(0===this.stack.length)return!0;d=this.stack[this.stack.length-1];f=d.state;g=d.dfa[0]}return!1}if(256<=m&&(k=this.grammar.dfas[m],k=k[1],k.hasOwnProperty(e))){this.push(m,
this.grammar.dfas[m],p,f);continue a}}b:{g=[0,d.state];for(d=n.length;d--;)if(n[d][0]===g[0]&&n[d][1]===g[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=f[0][0],new Sk.builtin.SyntaxError("bad input",this.filename,a,f);}};a.prototype.classify=function(b,c,f){if(b===Sk.token.tokens.T_NAME){this.used_names[c]=!0;var e=this.grammar.keywords.hasOwnProperty(c)&&this.grammar.keywords[c];"print"===c&&(this.p_flags&
a.CO_FUTURE_PRINT_FUNCTION||!0===Sk.__future__.print_function)&&(e=!1);if(e)return e}e=this.grammar.tokens.hasOwnProperty(b)&&this.grammar.tokens[b];if(!e){c="#"+b;for(let a in Sk.token.tokens)if(Sk.token.tokens[a]==b){c=a;break}throw new Sk.builtin.SyntaxError("bad token "+c,this.filename,f[0][0],f);}return e};a.prototype.shift=function(a,c,f,l){var b=this.stack[this.stack.length-1].dfa,d=this.stack[this.stack.length-1].node;d.children.push({type:a,value:c,lineno:l[0][0],col_offset:l[0][1],children:null});
this.stack[this.stack.length-1]={dfa:b,state:f,node:d}};a.prototype.push=function(a,c,f,l){a={type:a,value:null,lineno:l[0][0],col_offset:l[0][1],children:[]};this.stack[this.stack.length-1]={dfa:this.stack[this.stack.length-1].dfa,state:f,node:this.stack[this.stack.length-1].node};this.stack.push({dfa:c,state:0,node:a})};a.prototype.pop=function(){var a=this.stack.pop().node;if(a)if(0!==this.stack.length){var c=this.stack[this.stack.length-1].node;c.children.push(a)}else this.rootnode=a,this.rootnode.used_names=
this.used_names};Sk.parse=function(a,e){var b=Sk.token.tokens.T_COMMENT,l=Sk.token.tokens.T_NL,h=Sk.token.tokens.T_OP,d=Sk.token.tokens.T_ENDMARKER,g=Sk.token.tokens.T_ENCODING,n=!1,k=c(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()}}(e),"utf-8",function(a){var c=null;a.type!==b&&a.type!==l&&a.type!==g&&(a.type===h&&(c=Sk.OpMap[a.string]),k.addtoken(c||a.type,a.string,
[a.start,a.end,a.line]),a.type===d&&(n=!0))});if(!n)throw new Sk.builtin.SyntaxError("incomplete input",this.filename);return{cst:k.rootnode,flags:k.p_flags}};Sk.parseTreeDump=function(a,c){var b;c=c||"";var e=""+c;if(256<=a.type)for(e+=Sk.ParseTables.number2symbol[a.type]+"\n",b=0;b<a.children.length;++b)e+=Sk.parseTreeDump(a.children[b],c+"  ");else e+=Sk.token.tok_name[a.type]+": "+(new Sk.builtin.str(a.value)).$r().v+"\n";return e};Sk.exportSymbol("Sk.Parser",a);Sk.exportSymbol("Sk.parse",Sk.parse);
Sk.exportSymbol("Sk.parseTreeDump",Sk.parseTreeDump)},function(m,q){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,c){this.body=a;this.docstring=c;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,c,b,e,f,l,h,d){Sk.asserts.assert(null!==h&&void 0!==h);Sk.asserts.assert(null!==d&&void 0!==
d);this.name=a;this.args=c;this.body=b;this.decorator_list=e;this.returns=f;this.docstring=l;this.lineno=h;this.col_offset=d;return this};Sk.astnodes.AsyncFunctionDef=function(a,c,b,e,f,l,h,d){Sk.asserts.assert(null!==h&&void 0!==h);Sk.asserts.assert(null!==d&&void 0!==d);this.name=a;this.args=c;this.body=b;this.decorator_list=e;this.returns=f;this.docstring=l;this.lineno=h;this.col_offset=d;return this};Sk.astnodes.ClassDef=function(a,c,b,e,f,l,h,d){Sk.asserts.assert(null!==h&&void 0!==h);Sk.asserts.assert(null!==
d&&void 0!==d);this.name=a;this.bases=c;this.keywords=b;this.body=e;this.decorator_list=f;this.docstring=l;this.lineno=h;this.col_offset=d;return this};Sk.astnodes.Return=function(a,c,b){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==b&&void 0!==b);this.value=a;this.lineno=c;this.col_offset=b;return this};Sk.astnodes.Delete=function(a,c,b){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==b&&void 0!==b);this.targets=a;this.lineno=c;this.col_offset=b;return this};Sk.astnodes.Assign=
function(a,c,b,e){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==e&&void 0!==e);this.targets=a;this.value=c;this.lineno=b;this.col_offset=e;return this};Sk.astnodes.AugAssign=function(a,c,b,e,f){Sk.asserts.assert(null!==e&&void 0!==e);Sk.asserts.assert(null!==f&&void 0!==f);this.target=a;this.op=c;this.value=b;this.lineno=e;this.col_offset=f;return this};Sk.astnodes.AnnAssign=function(a,c,b,e,f,l){Sk.asserts.assert(null!==f&&void 0!==f);Sk.asserts.assert(null!==l&&void 0!==l);this.target=
a;this.annotation=c;this.value=b;this.simple=e;this.lineno=f;this.col_offset=l;return this};Sk.astnodes.For=function(a,c,b,e,f,l){Sk.asserts.assert(null!==f&&void 0!==f);Sk.asserts.assert(null!==l&&void 0!==l);this.target=a;this.iter=c;this.body=b;this.orelse=e;this.lineno=f;this.col_offset=l;return this};Sk.astnodes.AsyncFor=function(a,c,b,e,f,l){Sk.asserts.assert(null!==f&&void 0!==f);Sk.asserts.assert(null!==l&&void 0!==l);this.target=a;this.iter=c;this.body=b;this.orelse=e;this.lineno=f;this.col_offset=
l;return this};Sk.astnodes.While=function(a,c,b,e,f){Sk.asserts.assert(null!==e&&void 0!==e);Sk.asserts.assert(null!==f&&void 0!==f);this.test=a;this.body=c;this.orelse=b;this.lineno=e;this.col_offset=f;return this};Sk.astnodes.If=function(a,c,b,e,f){Sk.asserts.assert(null!==e&&void 0!==e);Sk.asserts.assert(null!==f&&void 0!==f);this.test=a;this.body=c;this.orelse=b;this.lineno=e;this.col_offset=f;return this};Sk.astnodes.With=function(a,c,b,e){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==
e&&void 0!==e);this.items=a;this.body=c;this.lineno=b;this.col_offset=e;return this};Sk.astnodes.AsyncWith=function(a,c,b,e){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==e&&void 0!==e);this.items=a;this.body=c;this.lineno=b;this.col_offset=e;return this};Sk.astnodes.Raise=function(a,c,b,e,f,l){Sk.asserts.assert(null!==f&&void 0!==f);Sk.asserts.assert(null!==l&&void 0!==l);this.exc=a;this.cause=c;this.inst=b;this.tback=e;this.lineno=f;this.col_offset=l;return this};Sk.astnodes.Try=
function(a,c,b,e,f,l){Sk.asserts.assert(null!==f&&void 0!==f);Sk.asserts.assert(null!==l&&void 0!==l);this.body=a;this.handlers=c;this.orelse=b;this.finalbody=e;this.lineno=f;this.col_offset=l;return this};Sk.astnodes.Assert=function(a,c,b,e){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==e&&void 0!==e);this.test=a;this.msg=c;this.lineno=b;this.col_offset=e;return this};Sk.astnodes.Import=function(a,c,b){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==b&&void 0!==
b);this.names=a;this.lineno=c;this.col_offset=b;return this};Sk.astnodes.ImportFrom=function(a,c,b,e,f){Sk.asserts.assert(null!==e&&void 0!==e);Sk.asserts.assert(null!==f&&void 0!==f);this.module=a;this.names=c;this.level=b;this.lineno=e;this.col_offset=f;return this};Sk.astnodes.Global=function(a,c,b){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==b&&void 0!==b);this.names=a;this.lineno=c;this.col_offset=b;return this};Sk.astnodes.Nonlocal=function(a,c,b){Sk.asserts.assert(null!==
c&&void 0!==c);Sk.asserts.assert(null!==b&&void 0!==b);this.names=a;this.lineno=c;this.col_offset=b;return this};Sk.astnodes.Expr=function(a,c,b){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==b&&void 0!==b);this.value=a;this.lineno=c;this.col_offset=b;return this};Sk.astnodes.Pass=function(a,c){Sk.asserts.assert(null!==a&&void 0!==a);Sk.asserts.assert(null!==c&&void 0!==c);this.lineno=a;this.col_offset=c;return this};Sk.astnodes.Break=function(a,c){Sk.asserts.assert(null!==a&&void 0!==
a);Sk.asserts.assert(null!==c&&void 0!==c);this.lineno=a;this.col_offset=c;return this};Sk.astnodes.Continue=function(a,c){Sk.asserts.assert(null!==a&&void 0!==a);Sk.asserts.assert(null!==c&&void 0!==c);this.lineno=a;this.col_offset=c;return this};Sk.astnodes.Print=function(a,c,b,e,f){Sk.asserts.assert(null!==e&&void 0!==e);Sk.asserts.assert(null!==f&&void 0!==f);this.dest=a;this.values=c;this.nl=b;this.lineno=e;this.col_offset=f;return this};Sk.astnodes.Debugger=function(a,c){Sk.asserts.assert(null!==
a&&void 0!==a);Sk.asserts.assert(null!==c&&void 0!==c);this.lineno=a;this.col_offset=c;return this};Sk.astnodes.BoolOp=function(a,c,b,e){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==e&&void 0!==e);this.op=a;this.values=c;this.lineno=b;this.col_offset=e;return this};Sk.astnodes.BinOp=function(a,c,b,e,f){Sk.asserts.assert(null!==e&&void 0!==e);Sk.asserts.assert(null!==f&&void 0!==f);this.left=a;this.op=c;this.right=b;this.lineno=e;this.col_offset=f;return this};Sk.astnodes.UnaryOp=
function(a,c,b,e){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==e&&void 0!==e);this.op=a;this.operand=c;this.lineno=b;this.col_offset=e;return this};Sk.astnodes.Lambda=function(a,c,b,e){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==e&&void 0!==e);this.args=a;this.body=c;this.lineno=b;this.col_offset=e;return this};Sk.astnodes.IfExp=function(a,c,b,e,f){Sk.asserts.assert(null!==e&&void 0!==e);Sk.asserts.assert(null!==f&&void 0!==f);this.test=a;this.body=c;this.orelse=
b;this.lineno=e;this.col_offset=f;return this};Sk.astnodes.Dict=function(a,c,b,e){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==e&&void 0!==e);this.keys=a;this.values=c;this.lineno=b;this.col_offset=e;return this};Sk.astnodes.Set=function(a,c,b){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==b&&void 0!==b);this.elts=a;this.lineno=c;this.col_offset=b;return this};Sk.astnodes.ListComp=function(a,c,b,e){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==
e&&void 0!==e);this.elt=a;this.generators=c;this.lineno=b;this.col_offset=e;return this};Sk.astnodes.SetComp=function(a,c,b,e){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==e&&void 0!==e);this.elt=a;this.generators=c;this.lineno=b;this.col_offset=e;return this};Sk.astnodes.DictComp=function(a,c,b,e,f){Sk.asserts.assert(null!==e&&void 0!==e);Sk.asserts.assert(null!==f&&void 0!==f);this.key=a;this.value=c;this.generators=b;this.lineno=e;this.col_offset=f;return this};Sk.astnodes.GeneratorExp=
function(a,c,b,e){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==e&&void 0!==e);this.elt=a;this.generators=c;this.lineno=b;this.col_offset=e;return this};Sk.astnodes.Await=function(a,c,b){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==b&&void 0!==b);this.value=a;this.lineno=c;this.col_offset=b;return this};Sk.astnodes.Yield=function(a,c,b){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==b&&void 0!==b);this.value=a;this.lineno=c;this.col_offset=
b;return this};Sk.astnodes.YieldFrom=function(a,c,b){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==b&&void 0!==b);this.value=a;this.lineno=c;this.col_offset=b;return this};Sk.astnodes.Compare=function(a,c,b,e,f){Sk.asserts.assert(null!==e&&void 0!==e);Sk.asserts.assert(null!==f&&void 0!==f);this.left=a;this.ops=c;this.comparators=b;this.lineno=e;this.col_offset=f;return this};Sk.astnodes.Call=function(a,c,b,e,f){Sk.asserts.assert(null!==e&&void 0!==e);Sk.asserts.assert(null!==f&&
void 0!==f);this.func=a;this.args=c;this.keywords=b;this.lineno=e;this.col_offset=f;return this};Sk.astnodes.Num=function(a,c,b){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==b&&void 0!==b);this.n=a;this.lineno=c;this.col_offset=b;return this};Sk.astnodes.Str=function(a,c,b){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==b&&void 0!==b);this.s=a;this.lineno=c;this.col_offset=b;return this};Sk.astnodes.FormattedValue=function(a,c,b,e,f){Sk.asserts.assert(null!==
e&&void 0!==e);Sk.asserts.assert(null!==f&&void 0!==f);this.value=a;this.conversion=c;this.format_spec=b;this.lineno=e;this.col_offset=f;return this};Sk.astnodes.JoinedStr=function(a,c,b){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==b&&void 0!==b);this.values=a;this.lineno=c;this.col_offset=b;return this};Sk.astnodes.Bytes=function(a,c,b){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==b&&void 0!==b);this.s=a;this.lineno=c;this.col_offset=b;return this};Sk.astnodes.NameConstant=
function(a,c,b){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==b&&void 0!==b);this.value=a;this.lineno=c;this.col_offset=b;return this};Sk.astnodes.Ellipsis=function(a,c){Sk.asserts.assert(null!==a&&void 0!==a);Sk.asserts.assert(null!==c&&void 0!==c);this.lineno=a;this.col_offset=c;return this};Sk.astnodes.Constant=function(a,c,b){Sk.asserts.assert(null!==c&&void 0!==c);Sk.asserts.assert(null!==b&&void 0!==b);this.value=a;this.lineno=c;this.col_offset=b;return this};Sk.astnodes.Attribute=
function(a,c,b,e,f){Sk.asserts.assert(null!==e&&void 0!==e);Sk.asserts.assert(null!==f&&void 0!==f);this.value=a;this.attr=c;this.ctx=b;this.lineno=e;this.col_offset=f;return this};Sk.astnodes.Subscript=function(a,c,b,e,f){Sk.asserts.assert(null!==e&&void 0!==e);Sk.asserts.assert(null!==f&&void 0!==f);this.value=a;this.slice=c;this.ctx=b;this.lineno=e;this.col_offset=f;return this};Sk.astnodes.Starred=function(a,c,b,e){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==e&&void 0!==e);
this.value=a;this.ctx=c;this.lineno=b;this.col_offset=e;return this};Sk.astnodes.Name=function(a,c,b,e){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==e&&void 0!==e);this.id=a;this.ctx=c;this.lineno=b;this.col_offset=e;return this};Sk.astnodes.List=function(a,c,b,e){Sk.asserts.assert(null!==b&&void 0!==b);Sk.asserts.assert(null!==e&&void 0!==e);this.elts=a;this.ctx=c;this.lineno=b;this.col_offset=e;return this};Sk.astnodes.Tuple=function(a,c,b,e){Sk.asserts.assert(null!==b&&void 0!==
b);Sk.asserts.assert(null!==e&&void 0!==e);this.elts=a;this.ctx=c;this.lineno=b;this.col_offset=e;return this};Sk.astnodes.Slice=function(a,c,b){this.lower=a;this.upper=c;this.step=b;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,c,b,e){this.target=a;this.iter=c;this.ifs=b;this.is_async=e;return this};Sk.astnodes.ExceptHandler=function(a,c,b,e,f){Sk.asserts.assert(null!==e&&void 0!==
e);Sk.asserts.assert(null!==f&&void 0!==f);this.type=a;this.name=c;this.body=b;this.lineno=e;this.col_offset=f;return this};Sk.astnodes.arguments_=function(a,c,b,e,f,l){this.args=a;this.vararg=c;this.kwonlyargs=b;this.kw_defaults=e;this.kwarg=f;this.defaults=l;return this};Sk.astnodes.arg=function a(a,c){this.arg=a;this.annotation=c;return this};Sk.astnodes.keyword=function(a,c){this.arg=a;this.value=c;return this};Sk.astnodes.alias=function(a,c){this.name=a;this.asname=c;return this};Sk.astnodes.withitem=
function(a,c){this.context_expr=a;this.optional_vars=c;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,q){function a(a,b,c){this.c_encoding=a;this.c_filename=b;this.c_flags=
c||0}function c(a){Sk.asserts.assert(void 0!==a,"node must be defined");return null===a.children?0:a.children.length}function b(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 e(a,b){Sk.asserts.assert(a.type===b,"node wasn't expected type")}function f(a,b,c){throw new Sk.builtin.SyntaxError(c,a.c_filename,b.lineno);}function l(a){Sk.asserts.assert("string"===typeof a,"expecting string, got "+typeof a);
return new Sk.builtin.str(a)}function h(a){var d,e;switch(a.type){case r.single_input:if(b(a,0).type===z.T_NEWLINE)break;else return h(b(a,0));case r.file_input:for(d=e=0;d<c(a);++d){var f=b(a,d);f.type===r.stmt&&(e+=h(f))}return e;case r.stmt:return h(b(a,0));case r.compound_stmt:return 1;case r.simple_stmt:return Math.floor(c(a)/2);case r.suite:if(1===c(a))return h(b(a,0));e=0;for(d=2;d<c(a)-1;++d)e+=h(b(a,d));return e;default:Sk.asserts.fail("Non-statement found")}return 0}function d(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 g(a,b,c,e){var f;Sk.asserts.assert(c!==Sk.astnodes.AugStore&&c!==Sk.astnodes.AugLoad,"context not AugStore or AugLoad");var h=f=null;switch(b.constructor){case Sk.astnodes.Attribute:case Sk.astnodes.Name:c===Sk.astnodes.Store&&d(a,e,b.attr,e.lineno);b.ctx=c;break;
case Sk.astnodes.Starred:b.ctx=c;g(a,b.value,c,e);break;case Sk.astnodes.Subscript:b.ctx=c;break;case Sk.astnodes.List:b.ctx=c;f=b.elts;break;case Sk.astnodes.Tuple:if(0===b.elts.length)throw new Sk.builtin.SyntaxError("can't assign to ()",a.c_filename,e.lineno);b.ctx=c;f=b.elts;break;case Sk.astnodes.Lambda:h="lambda";break;case Sk.astnodes.Call:h="function call";break;case Sk.astnodes.BoolOp:case Sk.astnodes.BinOp:case Sk.astnodes.UnaryOp:h="operator";break;case Sk.astnodes.GeneratorExp:h="generator expression";
break;case Sk.astnodes.Yield:h="yield expression";break;case Sk.astnodes.ListComp:h="list comprehension";break;case Sk.astnodes.SetComp:h="set comprehension";break;case Sk.astnodes.DictComp:h="dict comprehension";break;case Sk.astnodes.Dict:case Sk.astnodes.Set:case Sk.astnodes.Num:case Sk.astnodes.Str:h="literal";break;case Sk.astnodes.NameConstant:h="True, False or None";break;case Sk.astnodes.Compare:h="comparison";break;case Sk.astnodes.Repr:h="repr";break;case Sk.astnodes.IfExp:h="conditional expression";
break;default:Sk.asserts.fail("unhandled expression in assignment")}if(h)throw new Sk.builtin.SyntaxError("can't "+(c===Sk.astnodes.Store?"assign to":"delete")+" "+h,a.c_filename,e.lineno);if(f)for(b=0;b<f.length;++b)g(a,f[b],c,e)}function n(a){if(void 0===O[a.type])throw new Sk.builtin.SyntaxError("invalid syntax",a.type,a.lineno);return O[a.type]}function k(a,b){return a.value?new Sk.builtin.str(a.value):new Sk.builtin.str(a)}function p(a,d){e(d,r.comp_op);if(1===c(d))switch(d=b(d,0),d.type){case z.T_LESS:return Sk.astnodes.Lt;
case z.T_GREATER:return Sk.astnodes.Gt;case z.T_EQEQUAL:return Sk.astnodes.Eq;case z.T_LESSEQUAL:return Sk.astnodes.LtE;case z.T_GREATEREQUAL:return Sk.astnodes.GtE;case z.T_NOTEQUAL:return Sk.astnodes.NotEq;case z.T_NAME:if("in"===d.value)return Sk.astnodes.In;if("is"===d.value)return Sk.astnodes.Is}else if(2===c(d)&&b(d,0).type===z.T_NAME){if("in"===b(d,1).value)return Sk.astnodes.NotIn;if("is"===b(d,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 A(a,d){var e,f=[];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(e=0;e<c(d);e+=2)Sk.asserts.assert(b(d,e).type===r.test||b(d,e).type===r.old_test||b(d,e).type===r.star_expr),f[e/2]=w(a,b(d,e));return f}function t(a,d){var f;e(d,r.suite);
var g=[];var k=0;if(b(d,0).type===r.simple_stmt){d=b(d,0);var x=c(d)-1;b(d,x-1).type===z.T_SEMI&&--x;for(f=0;f<x;f+=2)g[k++]=N(a,b(d,f))}else for(f=2;f<c(d)-1;++f){x=b(d,f);e(x,r.stmt);var n=h(x);if(1===n)g[k++]=N(a,x);else for(x=b(x,0),e(x,r.simple_stmt),n=0;n<c(x);n+=2){if(0===c(b(x,n))){Sk.asserts.assert(n+1===c(x));break}g[k++]=N(a,b(x,n))}}Sk.asserts.assert(k===h(d));return g}function v(a,d,f){var h;e(d,r.exprlist);var k=[];for(h=0;h<c(d);h+=2){var x=w(a,b(d,h));k[h/2]=x;f&&g(a,x,f,b(d,h))}return k}
function B(a,d){a:for(;;)switch(d.type){case r.import_as_name:a=null;var e=l(b(d,0).value);3===c(d)&&(a=b(d,2).value);return new Sk.astnodes.alias(e,null==a?null:l(a));case r.dotted_as_name:if(1===c(d)){d=b(d,0);continue a}else return a=B(a,b(d,0)),Sk.asserts.assert(!a.asname),a.asname=l(b(d,2).value),a;case r.dotted_name:if(1===c(d))return new Sk.astnodes.alias(l(b(d,0).value),null);a="";for(e=0;e<c(d);e+=2)a+=b(d,e).value+".";return new Sk.astnodes.alias(l(a.substr(0,a.length-1)),null);case z.T_STAR:return new Sk.astnodes.alias(l("*"),
null);default:throw new Sk.builtin.SyntaxError("unexpected import name",a.c_filename,d.lineno);}}function D(a,b){Sk.asserts.assert(b.type==r.testlist_comp||b.type==r.argument);return aa(a,b,0)}function E(a,d){if(b(d,0).type===z.T_MINUS&&2===c(d)){var e=b(d,1);if(e.type===r.factor&&1===c(e)&&(e=b(e,0),e.type===r.power&&1===c(e))){var f=b(e,0);if(f.type===r.atom&&(e=b(f,0),e.type===z.T_NUMBER))return e.value="-"+e.value,R(a,f)}}a=w(a,b(d,1));switch(b(d,0).type){case z.T_PLUS:return new Sk.astnodes.UnaryOp(Sk.astnodes.UAdd,
a,d.lineno,d.col_offset);case z.T_MINUS:return new Sk.astnodes.UnaryOp(Sk.astnodes.USub,a,d.lineno,d.col_offset);case z.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,h,k){var x,n,l;e(g,r.arglist);for(x=l=n=0;x<c(g);x++){var p=b(g,x);p.type==r.argument&&(1==c(p)?n++:b(p,1).type==r.comp_for?(n++,k||f(a,p,"invalid syntax"),1<c(g)&&f(a,p,"Generator expression must be parenthesized")):b(p,0).type==z.T_STAR?n++:l++)}var S=
[];var m=[];for(x=k=l=n=0;x<c(g);x++)if(p=b(g,x),p.type==r.argument){var J=b(p,0);if(1==c(p)){l&&(k?f(a,J,"positional argument follows keyword argument unpacking"):f(a,J,"positional argument follows keyword argument"));var K=w(a,J);if(!K)return null;S[n++]=K}else if(J.type==z.T_STAR){if(k)return f(a,J,"iterable argument unpacking follows keyword argument unpacking"),null;K=w(a,b(p,1));if(!K)return null;p=new Sk.astnodes.Starred(K,Sk.astnodes.Load,J.lineno,J.col_offset);S[n++]=p}else if(J.type==z.T_DOUBLESTAR){x++;
K=w(a,b(p,1));if(!K)return null;p=new Sk.astnodes.keyword(null,K);m[l++]=p;k++}else if(b(p,1).type==r.comp_for){K=D(a,p);if(!K)return null;S[n++]=K}else{var u;K=w(a,J);if(!K)return null;if(K.constructor===Sk.astnodes.Lambda)return f(a,J,"lambda cannot contain assignment"),null;if(K.constructor!==Sk.astnodes.Name)return f(a,J,"keyword can't be an expression"),null;if(d(a,K.id,p,1))return null;var A=K.id;for(u=0;u<l;u++)if((K=m[u].arg)&&K===A)return f(a,J,"keyword argument repeated"),null;K=w(a,b(p,
2));if(!K)return null;p=new Sk.astnodes.keyword(A,K);m[l++]=p}}return new Sk.astnodes.Call(h,S,m,h.lineno,h.col_offset)}function M(a,d,f){e(d,r.trailer);if(b(d,0).type==z.T_LPAR)return 2==c(d)?new Sk.astnodes.Call(f,null,null,d.lineno,d.col_offset):F(a,b(d,1),f,!0);if(b(d,0).type==z.T_DOT){var g=k(b(d,1));return g?new Sk.astnodes.Attribute(f,g,Sk.astnodes.Load,d.lineno,d.col_offset):null}e(b(d,0),z.T_LSQB);e(b(d,2),z.T_RSQB);d=b(d,1);if(1==c(d))return(g=I(a,b(d,0)))?new Sk.astnodes.Subscript(f,g,
Sk.astnodes.Load,d.lineno,d.col_offset):null;var h,n=1,x=[];for(h=0;h<c(d);h+=2){g=I(a,b(d,h));if(!g)return null;g.kind!=Z.Index_kind&&(n=0);x[h/2]=g}if(!n)return new Sk.astnodes.Subscript(f,new Sk.astnodes.ExtSlice(x),Sk.astnodes.Load,d.lineno,d.col_offset);a=[];for(h=0;h<x.length;++h)g=x[h],Sk.asserts.assert(g.kind==Z.Index_kind&&g.v.Index.value),a[h]=g.v.Index.value;g=new Sk.astnodes.Tuple(a,Sk.astnodes.Load,d.lineno,d.col_offset);return new Sk.astnodes.Subscript(f,new Sk.astnodes.Index(g),Sk.astnodes.Load,
d.lineno,d.col_offset)}function V(a,d){e(d,r.flow_stmt);var g=b(d,0);switch(g.type){case r.break_stmt:return new Sk.astnodes.Break(d.lineno,d.col_offset,d.end_lineno,d.end_col_offset);case r.continue_stmt:return new Sk.astnodes.Continue(d.lineno,d.col_offset,d.end_lineno,d.end_col_offset);case r.yield_stmt:return(a=w(a,b(g,0)))?new Sk.astnodes.Expr(a,d.lineno,d.col_offset,d.end_lineno,d.end_col_offset):null;case r.return_stmt:if(1==c(g))return new Sk.astnodes.Return(null,d.lineno,d.col_offset,d.end_lineno,
d.end_col_offset);var h=W(a,b(g,1));return h?new Sk.astnodes.Return(h,d.lineno,d.col_offset,d.end_lineno,d.end_col_offset):null;case r.raise_stmt:if(1==c(g))return new Sk.astnodes.Raise(null,null,null,null,d.lineno,d.col_offset,d.end_lineno,d.end_col_offset);if(2<=c(g)){var k=null;h=w(a,b(g,1));var n=null,x=null;4==c(g)&&"from"==b(g,2).value?(Sk.__future__.python3||f(a,b(g,2),"raise ... from ... is not available in Python 2"),k=w(a,b(g,3))):4<=c(g)&&","==b(g,2).value&&(Sk.__future__.python3&&f(a,
d,"Old raise syntax is not available in Python 3"),n=w(a,b(g,3)),6==c(g)&&(x=w(a,b(g,5))));return new Sk.astnodes.Raise(h,k,n,x,d.lineno,d.col_offset,d.end_lineno,d.end_col_offset)}default:return Sk.asserts.fail("unexpected flow_stmt: ",g.type),null}}function y(a,e){var f=null;Sk.asserts.assert(e.type===r.tfpdef||e.type===r.vfpdef);var g=b(e,0);d(a,g,g.value,g.lineno);g=l(g.value);3==c(e)&&b(e,1).type===z.T_COLON&&(f=w(a,b(e,2)));return new Sk.astnodes.arg(g,f,e.lineno,e.col_offset)}function G(a,
e,g,h,k){var n=g,x=0;h||f(a,b(e,g),"named arguments must follow bare *");for(Sk.asserts.assert(k);n<c(e);){var p=b(e,n);switch(p.type){case r.vfpdef:case r.tfpdef:n+1<c(e)&&b(e,n+1).type==z.T_EQUAL?(k[x]=w(a,b(e,n+2)),n+=2):k[x]=null;var m=3==c(p)?w(a,b(p,2)):null;p=b(p,0);d(a,p,p.value,p.lineno);g=l(p.value);h[x++]=new Sk.astnodes.arg(g,m,p.lineno,p.col_offset);n+=2;break;case z.T_DOUBLESTAR:return n;default:f(a,p,"unexpected node")}}return n}function L(a,d){var e,f,g,h=[],k=[],n=[],x=[],l=null,
p=null;if(d.type===r.parameters){if(2===c(d))return new Sk.astnodes.arguments_([],null,[],[],null,[]);d=b(d,1)}Sk.asserts.assert(d.type===r.varargslist||d.type===r.typedargslist);for(e=f=g=0;g<c(d);){var m=b(d,g);switch(m.type){case r.tfpdef:case r.vfpdef:if(g+1<c(d)&&b(d,g+1).type==z.T_EQUAL){k[f++]=w(a,b(d,g+2));g+=2;var J=1}else if(J)throw new Sk.builtin.SyntaxError("non-default argument follows default argument",a.c_filename,d.lineno);h[e++]=y(a,m);g+=2;break;case z.T_STAR:if(g+1>=c(d)||g+2==
c(d)&&b(d,g+1).type==z.T_COMMA)throw new Sk.builtin.SyntaxError("named arguments must follow bare *",a.c_filename,d.lineno);m=b(d,g+1);m.type==z.T_COMMA?(g+=2,g=G(a,d,g,n,x)):(l=y(a,m),g+=3,g<c(d)&&(b(d,g).type==r.tfpdef||b(d,g).type==r.vfpdef)&&(g=G(a,d,g,n,x)));break;case z.T_DOUBLESTAR:m=b(d,g+1);Sk.asserts.assert(m.type==r.tfpdef||m.type==r.vfpdef);p=y(a,m);g+=3;break;default:Sk.asserts.fail("unexpected node in varargslist");return}}return new Sk.astnodes.arguments_(h,l,n,x,p,k)}function T(a,
g,h,n){var x=n?b(g,1):g,l=null,p=1,m=null;if(n&&5>a.c_feature_version)return f(a,x,"Async functions are only supported in Python 3.5 and greater"),null;e(x,r.funcdef);var S=k(b(x,p));if(d(a,S,b(x,p),0))return null;var J=L(a,b(x,p+1));if(!J)return null;if(b(x,p+2).type==z.T_RARROW){l=w(a,b(x,p+3));if(!l)return null;p+=2}if(b(x,p+3).type==z.T_TYPE_COMMENT){m=z.T_NEW_TYPE_COMMENT(b(x,p+3));if(!m)return null;p+=1}var K=t(a,b(x,p+3));if(!K)return null;if(1<c(b(x,p+3))&&(p=b(b(x,p+3),1),p.type==z.T_TYPE_COMMENT)){if(null!=
m)return f(a,x,"Cannot have two type comments on def"),null;m=z.T_NEW_TYPE_COMMENT(p);if(!m)return null}return n?new Sk.astnodes.AsyncFunctionDef(S,J,K,h,l,m,g.lineno,g.col_offset,void 0,void 0):new Sk.astnodes.FunctionDef(S,J,K,h,l,m,x.lineno,x.col_offset,void 0,void 0)}function P(a,f,g){e(f,r.classdef);if(4==c(f)){var h=t(a,b(f,3));var n=k(b(f,1).value);d(a,b(f,3),n,f.lineno);return new Sk.astnodes.ClassDef(n,[],[],h,g,null,f.lineno,f.col_offset)}if(b(f,3).type===z.T_RPAR)return h=t(a,b(f,5)),n=
k(b(f,1).value),d(a,b(f,3),n,b(f,3).lineno),new Sk.astnodes.ClassDef(n,[],[],h,g,null,f.lineno,f.col_offset);n=k(b(f,1));n=new Sk.astnodes.Name(n,Sk.astnodes.Load,f.lineno,f.col_offset);var l=F(a,b(f,3),n,!1);h=t(a,b(f,6));n=k(b(f,1).value);d(a,b(f,1),n,b(f,1).lineno);return new Sk.astnodes.ClassDef(n,l.args,l.keywords,h,g,null,f.lineno,f.col_offset)}function Q(a,d){function f(a,d){for(a=0;;){e(d,r.comp_iter);if(b(d,0).type===r.comp_for)return a;d=b(d,0);e(d,r.comp_if);a++;if(2===c(d))return a;d=
b(d,2)}}var g;var h=function(a,d){a=0;a:for(;;){a++;e(d,r.comp_for);if(5===c(d))d=b(d,4);else return a;b:for(;;){e(d,r.comp_iter);d=b(d,0);if(d.type===r.comp_for)continue a;else if(d.type===r.comp_if)if(3===c(d)){d=b(d,2);continue b}else return a;break}break}Sk.asserts.fail("logic error in countCompFors")}(a,d);var k=[];for(g=0;g<h;++g){e(d,r.comp_for);var n=b(d,1);var l=v(a,n,Sk.astnodes.Store);var p=w(a,b(d,3));var x=1===c(n)?new Sk.astnodes.comprehension(l[0],p,[]):new Sk.astnodes.comprehension(new Sk.astnodes.Tuple(l,
Sk.astnodes.Store,d.lineno,d.col_offset),p,[]);if(5===c(d)){d=b(d,4);var m=f(a,d);n=[];for(l=0;l<m;++l)e(d,r.comp_iter),d=b(d,0),e(d,r.comp_if),p=w(a,b(d,1)),n[l]=p,3===c(d)&&(d=b(d,2));d.type===r.comp_iter&&(d=b(d,0));x.ifs=n}k[g]=x}return k}function U(a,d){var f=[];a:{var g=d;var h=0;b:for(;;){var k=0;h++;e(g,r.comp_for);b(g,0).type==z.T_ASYNC&&(k=1);if(c(g)==5+k)g=b(g,4+k);else break a;c:for(;;){e(g,r.comp_iter);g=b(g,0);if(g.type===r.comp_for)continue b;else if(g.type===r.comp_if)if(3===c(g)){g=
b(g,2);continue c}else break a;break}break}h=void 0}for(g=0;g<h;g++){var n=0;b(d,0).type==z.T_ASYNC&&(n=1);var l=b(d,1+n);var p=v(a,l,Sk.astnodes.Store);if(!p)return null;k=w(a,b(d,3+n));if(!k)return null;var x=p[0];p=1==c(l)?new Sk.astnodes.comprehension(x,k,null,n):new Sk.astnodes.comprehension(new Sk.astnodes.Tuple(p,Sk.astnodes.Store,x.lineno,x.col_offset,l.end_lineno,l.end_col_offset),k,null,n);if(c(d)==5+n){x=[];d=b(d,4+n);a:for(k=d,n=0;;){e(k,r.comp_iter);if(b(k,0).type==r.comp_for){l=n;break a}k=
b(k,0);e(k,r.comp_if);n++;if(2==c(k)){l=n;break a}k=b(k,2)}if(-1==l)return null;for(n=0;n<l;n++){e(d,r.comp_iter);d=b(d,0);e(d,r.comp_if);k=w(a,b(d,1));if(!k)return null;x[n]=k;3==c(d)&&(d=b(d,2))}d.type==r.comp_iter&&(d=b(d,0));p.ifs=x}f[g]=p}return f}function aa(a,d,e){Sk.asserts.assert(1<c(d));var g=b(d,0);var h=w(a,g);if(h.constructor===Sk.astnodes.Starred)return f(a,g,"iterable unpacking cannot be used in comprehension"),null;a=U(a,b(d,1));return 0==e?new Sk.astnodes.GeneratorExp(h,a,d.lineno,
d.col_offset,d.end_lineno,d.end_col_offset):1==e?new Sk.astnodes.ListComp(h,a,d.lineno,d.col_offset,d.end_lineno,d.end_col_offset):2==e?new Sk.astnodes.SetComp(h,a,d.lineno,d.col_offset,d.end_lineno,d.end_col_offset):null}function ca(a,c){e(c,r.augassign);c=b(c,0);switch(c.value.charAt(0)){case "+":return Sk.astnodes.Add;case "-":return Sk.astnodes.Sub;case "/":return"/"===c.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"*"===c.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 W(a,d){Sk.asserts.assert(0<c(d));d.type===r.testlist_comp?1<c(d)&&Sk.asserts.assert(b(d,1).type!==r.comp_for):Sk.asserts.assert(d.type===r.testlist||d.type===r.testlist_star_expr);return 1===c(d)?w(a,b(d,0)):new Sk.astnodes.Tuple(A(a,
d),Sk.astnodes.Load,d.lineno,d.col_offset)}function da(a,f){e(f,r.expr_stmt);if(1===c(f))return new Sk.astnodes.Expr(W(a,b(f,0)),f.lineno,f.col_offset);if(b(f,1).type===r.augassign){var h=b(f,0);var k=W(a,h);g(a,k,Sk.astnodes.Store,h);switch(k.constructor){case Sk.astnodes.Name:var n=k.id;d(a,h,n,f.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,
f.lineno);case Sk.astnodes.Yield:throw new Sk.builtin.SyntaxError("augmented assignment to yield expression not possible",a.c_filename,f.lineno);default:throw new Sk.builtin.SyntaxError("illegal expression for augmented assignment",a.c_filename,f.lineno);}h=b(f,2);n=h.type===r.testlist?W(a,h):w(a,h);return new Sk.astnodes.AugAssign(k,ca(a,b(f,1)),n,f.lineno,f.col_offset)}if(b(f,1).type===r.annassign){if(!Sk.__future__.python3)throw new Sk.builtin.SyntaxError("Annotated assignment is not supported in Python 2",
a.c_filename,f.lineno);h=b(f,0);var l=b(f,1);var p=1;for(k=h;1==c(k);)k=b(k,0);0<c(k)&&b(k,0).type==z.T_LPAR&&(p=0);k=W(a,h);switch(k.constructor){case Sk.astnodes.Name:n=k.id;d(a,h,n,f.lineno);g(a,k,Sk.astnodes.Store,h);break;case Sk.astnodes.Attribute:n=k.attr;d(a,h,n,f.lineno);g(a,k,Sk.astnodes.Store,h);break;case Sk.astnodes.Subscript:g(a,k,Sk.astnodes.Store,h);break;case Sk.astnodes.List:throw new Sk.builtin.SyntaxError("only single target (not list) can be annotated",a.c_filename,f.lineno);
case Sk.astnodes.Tuple:throw new Sk.builtin.SyntaxError("only single target (not tuple) can be annotated",a.c_filename,f.lineno);default:throw new Sk.builtin.SyntaxError("illegal target for annotation",a.c_filename,f.lineno);}k.constructor!=Sk.astnodes.Name&&(p=0);h=b(l,1);n=w(a,h);if(2==c(l))return new Sk.astnodes.AnnAssign(k,n,null,p,f.lineno,f.col_offset);h=b(l,3);a=w(a,h);return new Sk.astnodes.AnnAssign(k,n,a,p,f.lineno,f.col_offset)}e(b(f,1),z.T_EQUAL);p=[];for(k=0;k<c(f)-2;k+=2){h=b(f,k);if(h.type===
r.yield_expr)throw new Sk.builtin.SyntaxError("assignment to yield expression not possible",a.c_filename,f.lineno);h=W(a,h);g(a,h,Sk.astnodes.Store,b(f,k));p[k/2]=h}h=b(f,c(f)-1);a=h.type===r.testlist_star_expr?W(a,h):w(a,h);return new Sk.astnodes.Assign(p,a,f.lineno,f.col_offset)}function ea(a,b,c,d,e){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)&&f(d,e,"f-string: empty expression not allowed");
try{let b=Sk.parse("<fstring>","("+a+")");var g=Sk.astFromParse(b.cst,"<fstring>",b.flags)}catch(Y){throw Y.traceback&&Y.traceback[0]&&(g=Y.traceback[0],g.lineno=(g.lineno||1)-1+e.lineno,g.filename=d.c_filename),Y;}Sk.asserts.assert(1==g.body.length&&g.body[0].constructor===Sk.astnodes.Expr);return g.body[0].value}function H(a,b,c,d,e,g,h){Sk.asserts.assert("{"==a.charAt(b));b++;var k=b;let n=null,l=0,p=0,m,x,S=()=>f(g,h,"f-string: expecting '}'");for(Sk.asserts.assert(b<=c);b<c;b++){let d=a.charAt(b);
"\\"==d&&f(g,h,"f-string expression part cannot include a backslash");if(n)d==n&&(3==l?b+2<c&&a.charAt(b+1)==d&&a.charAt(b+2)==d&&(b+=2,n=l=0):l=n=0);else if("'"==d||'"'==d)b+2<c&&a.charAt(b+1)==d&&a.charAt(b+2)==d?(l=3,b+=2):l=1,n=d;else if("["==d||"{"==d||"("==d)p++;else if(0!=p&&("]"==d||"}"==d||")"==d))p--;else if("#"==d)f(g,h,"f-string expression part cannot include '#'");else if(!(0!=p||"!"!=d&&":"!=d&&"}"!=d||"!"==d&&b+1<c&&"="==a.charAt(b+1)))break}n&&f(g,h,"f-string: unterminated string");
p&&f(g,h,"f-string: mismatched '(', '{', or '['");k=ea(a,k,b,g,h);"!"==a.charAt(b)&&(b++,b>=c&&S(),x=a.charAt(b),b++,"s"!=x&&"r"!=x&&"a"!=x&&f(g,h,"f-string: invalid conversion character: expected 's', 'r', or 'a'"));b>=c&&S();":"==a.charAt(b)&&(b++,b>=c&&S(),[m,b]=ba(a,b,c,d,e+1,g,h));(b>=c||"}"!=a.charAt(b))&&S();b++;return[new Sk.astnodes.FormattedValue(k,x,m,h.lineno,h.col_offset),b]}function ba(a,b,c,d,e,f,g){let h=[],k=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,"}")}h.push(new Sk.astnodes.Str(new Sk.builtin.str(a),g.lineno,g.col_offset,f.end_lineno,g.end_col_offset))};for(;b<c;){let n=a.indexOf("{",b);if(0!==e){let d=a.indexOf("}",b);-1!==d&&(-1===n?c=d:n>d&&(n=-1,c=d))}if(-1===n){k(a.substring(b,c));b=c;break}else if(n+1<c&&"{"===a.charAt(n+1))k(a.substring(b,n+1)),b=n+2;else{k(a.substring(b,n));b=n;let [l,p]=H(a,n,c,d,e,f,g);h.push(l);b=p}}return[new Sk.astnodes.JoinedStr(h,g.lineno,g.col_offset),b]}function X(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>Number.MAX_SAFE_INTEGER&&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 I(a,d){var f,g;e(d,r.subscript);var h=b(d,0);var k=f=g=null;if(h.type===z.T_DOT)return new Sk.astnodes.Ellipsis;if(1===c(d)&&h.type===r.test)return new Sk.astnodes.Index(w(a,h));h.type===r.test&&(g=w(a,h));h.type===z.T_COLON?1<c(d)&&(h=b(d,1),h.type===r.test&&(f=w(a,h))):2<c(d)&&(h=b(d,2),h.type===r.test&&(f=w(a,h)));h=b(d,c(d)-1);h.type===r.sliceop&&(1===c(h)?(h=b(h,0),k=new Sk.astnodes.NameConstant(Sk.builtin.none.none$,
Sk.astnodes.Load,h.lineno,h.col_offset)):(h=b(h,1),h.type===r.test&&(k=w(a,h))));return new Sk.astnodes.Slice(g,f,k)}function R(a,d){var g=b(d,0);switch(g.type){case z.T_NAME:var h=g.value;if(4<=h.length&&5>=h.length){if("None"===h)return new Sk.astnodes.NameConstant(Sk.builtin.none.none$,d.lineno,d.col_offset);if("True"===h)return new Sk.astnodes.NameConstant(Sk.builtin.bool.true$,d.lineno,d.col_offset);if("False"===h)return new Sk.astnodes.NameConstant(Sk.builtin.bool.false$,d.lineno,d.col_offset)}a=
k(h,a);return new Sk.astnodes.Name(a,Sk.astnodes.Load,d.lineno,d.col_offset,d.end_lineno,d.end_col_offset);case z.T_STRING:g=[];for(var n=0;n<c(d);++n){var p=b(d,n).value;var m=a;var x=b(d,n);var t=p;var q=t.charAt(0);for(var J=!1,v=p=!1;;){if("u"!==q&&"U"!==q)if("r"===q||"R"===q)J=!0;else if("b"===q||"B"===q)v=!0;else if("f"===q||"F"===q)p=!0;else break;t=t.substr(1);q=t.charAt(0)}Sk.asserts.assert("'"===q||'"'===q&&t.charAt(t.length-1)===q);t=t.substr(1,t.length-2);4<=t.length&&t.charAt(0)===q&&
t.charAt(1)===q&&(Sk.asserts.assert(t.charAt(t.length-1)===q&&t.charAt(t.length-2)===q),t=t.substr(2,t.length-4));if(J||-1===t.indexOf("\\")){if(v)for(q=0;q<t.length;q++)127<t.charCodeAt(q)&&f(m,x,"bytes can only contain ASCII literal characters");m=[l(t),p,v]}else{J=t;var B=J.length,y="";for(t=0;t<B;++t)q=J.charAt(t),"\\"===q?(++t,q=J.charAt(t),"n"===q?y+="\n":"\\"===q?y+="\\":"t"===q?y+="\t":"r"===q?y+="\r":"b"===q?y+="\b":"f"===q?y+="\f":"v"===q?y+="\v":"0"===q?y+="\x00":'"'===q?y+='"':"'"===q?
y+="'":"\n"!==q&&("x"===q?(t+2>=B&&f(m,x,"Truncated \\xNN escape"),y+=String.fromCharCode(parseInt(J.substr(t+1,2),16)),t+=2):v||"u"!==q?v||"U"!==q?y+="\\"+q:(t+8>=B&&f(m,x,"Truncated \\UXXXXXXXX escape"),y+=String.fromCodePoint(parseInt(J.substr(t+1,8),16)),t+=8):(t+4>=B&&f(m,x,"Truncated \\uXXXX escape"),y+=String.fromCharCode(parseInt(J.substr(t+1,4),16)),t+=4))):v&&127<q.charCodeAt(0)?f(m,x,"bytes can only contain ASCII literal characters"):y+=q;m=y;m=[l(m),p,v]}p=m;m=p[0];x=p[1];p=p[2];0!=n&&
h!==p&&f(a,d,"cannot mix bytes and nonbytes literals");h=p;if(x){if(!Sk.__future__.python3)throw new Sk.builtin.SyntaxError("invalid string (f-strings are not supported in Python 2)",a.c_filename,b(d,n).lineno);var F=m.$jsstr();[F]=ba(F,0,F.length,!1,0,a,b(d,n));g.push.apply(g,F.values);F=null}else F?F.s=F.s.sq$concat(m):(F=new (h?Sk.astnodes.Bytes:Sk.astnodes.Str)(m,d.lineno,d.col_offset,a.end_lineno,d.end_col_offset),g.push(F))}d=1===g.length&&g[0].constructor===Sk.astnodes.Str?g[0]:new Sk.astnodes.JoinedStr(g,
d.lineno,d.col_offset,a.end_lineno,d.end_col_offset);return d;case z.T_NUMBER:return new Sk.astnodes.Num(X(a,g.value,d.lineno),d.lineno,d.col_offset);case z.T_ELLIPSIS:return new Sk.astnodes.Ellipsis(d.lineno,d.col_offset,d.end_lineno,d.end_col_offset);case z.T_LPAR:return g=b(d,1),g.type==z.T_RPAR?new Sk.astnodes.Tuple([],Sk.astnodes.Load,d.lineno,d.col_offset,d.end_lineno,d.end_col_offset):g.type==r.yield_expr?w(a,g):1==c(g)?W(a,g):b(g,1).type==r.comp_for?u(D(a,g),d):u(W(a,g),d);case z.T_LSQB:g=
b(d,1);if(g.type==z.T_RSQB)return new Sk.astnodes.List([],Sk.astnodes.Load,d.lineno,d.col_offset,d.end_lineno,d.end_col_offset);e(g,r.testlist_comp);if(1==c(g)||b(g,1).type==z.T_COMMA)return(a=A(a,g))?new Sk.astnodes.List(a,Sk.astnodes.Load,d.lineno,d.col_offset,d.end_lineno,d.end_col_offset):null;h=g;Sk.asserts.assert(h.type==r.testlist_comp);a=aa(a,h,1);return u(a,d);case z.T_LBRACE:g=b(d,1);if(g.type==z.T_RBRACE)return new Sk.astnodes.Dict(null,null,d.lineno,d.col_offset,d.end_lineno,d.end_col_offset);
h=b(g,0).type==z.T_DOUBLESTAR;if(1==c(g)||1<c(g)&&b(g,1).type==z.T_COMMA){h=g;n=[];Sk.asserts.assert(h.type===r.dictorsetmaker);for(g=0;g<c(h);g+=2)F=w(a,b(h,g)),n[g/2]=F;a=new Sk.astnodes.Set(n,h.lineno,h.col_offset)}else if(1<c(g)&&b(g,1).type==r.comp_for)h=g,Sk.asserts.assert(h.type===r.dictorsetmaker),Sk.asserts.assert(1<c(h)),g=w(a,b(h,0)),a=Q(a,b(h,1)),a=new Sk.astnodes.SetComp(g,a,h.lineno,h.col_offset);else if(c(g)>3-h&&b(g,3-h).type==r.comp_for){if(h)return f(a,d,"dict unpacking cannot be used in dict comprehension"),
null;h=g;Sk.asserts.assert(3<c(h));e(b(h,1),z.T_COLON);g=w(a,b(h,0));n=w(a,b(h,2));a=Q(a,b(h,3));a=new Sk.astnodes.DictComp(g,n,a,h.lineno,h.col_offset)}else{h=g;n=[];F=[];for(p=g=0;p<c(h);p++)m=a,x=h,v=p,b(x,v).type==z.T_DOUBLESTAR?(Sk.asserts.assert(2<=c(x)-v),p=w(m,b(x,v+1)),m={key:null,value:p,i:v+2}):(Sk.asserts.assert(3<=c(x)-v),(p=w(m,b(x,v)))?(t=p,e(b(x,v+1),z.T_COLON),m=(p=w(m,b(x,v+2)))?{key:t,value:p,i:v+3}:!1):m=0),p=m.i,n[g]=m.key,F[g]=m.value,g++;a=new Sk.astnodes.Dict(n,F,h.lineno,
h.col_offset,h.end_lineno,h.end_col_offset)}return u(a,d);default:return Sk.asserts.fail("unhandled atom "+g.type),null}}function C(a,d){var g,f=0;e(d,r.atom_expr);var h=c(d);b(d,0).type===z.T_AWAIT&&(f=1,Sk.asserts.assert(1<h));var k=R(a,b(d,f));if(!k)return null;if(1===h)return k;if(f&&2===h)return new Sk.astnodes.Await(k,d.lineno,d.col_offset);for(g=f+1;g<h;g++){var n=b(d,g);if(n.type!==r.trailer)break;n=M(a,n,k);if(!n)return null;n.lineno=k.lineno;n.col_offset=k.col_offset;k=n}return f?new Sk.astnodes.Await(k,
d.line,d.col_offset):k}function w(a,d){a:for(;;){switch(d.type){case r.test:case r.test_nocond:if(b(d,0).type===r.lambdef||b(d,0).type===r.lambdef_nocond){var g=b(d,0);3===c(g)?(d=new Sk.astnodes.arguments_([],null,null,[]),a=w(a,b(g,2))):(d=L(a,b(g,1)),a=w(a,b(g,3)));return new Sk.astnodes.Lambda(d,a,g.lineno,g.col_offset)}if(1<c(d))return Sk.asserts.assert(5===c(d)),new Sk.astnodes.IfExp(w(a,b(d,2)),w(a,b(d,0)),w(a,b(d,4)),d.lineno,d.col_offset);case r.or_test:case r.and_test:if(1===c(d)){d=b(d,
0);continue a}var f=[];for(g=0;g<c(d);g+=2)f[g/2]=w(a,b(d,g));if("and"===b(d,1).value)return new Sk.astnodes.BoolOp(Sk.astnodes.And,f,d.lineno,d.col_offset);Sk.asserts.assert("or"===b(d,1).value);return new Sk.astnodes.BoolOp(Sk.astnodes.Or,f,d.lineno,d.col_offset);case r.not_test:if(1===c(d)){d=b(d,0);continue a}else return new Sk.astnodes.UnaryOp(Sk.astnodes.Not,w(a,b(d,1)),d.lineno,d.col_offset);case r.comparison:if(1===c(d)){d=b(d,0);continue a}else{var h=[];f=[];for(g=1;g<c(d);g+=2)h[(g-1)/2]=
p(a,b(d,g)),f[(g-1)/2]=w(a,b(d,g+1));return new Sk.astnodes.Compare(w(a,b(d,0)),h,f,d.lineno,d.col_offset)}case r.star_expr:return e(d,r.star_expr),new Sk.astnodes.Starred(w(a,b(d,1)),Sk.astnodes.Load,d.lineno,d.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===c(d)){d=b(d,0);continue a}var k=d,l=new Sk.astnodes.BinOp(w(a,b(k,0)),n(b(k,1)),w(a,b(k,2)),k.lineno,k.col_offset),m=(c(k)-1)/2;for(d=1;d<m;++d)g=b(k,2*d+1),f=n(g),h=w(a,b(k,2*d+
2)),l=new Sk.astnodes.BinOp(l,f,h,g.lineno,g.col_offset);return l;case r.yield_expr:return f=!1,h=null,1<c(d)&&(g=b(d,1)),g&&(h=b(g,c(g)-1),2==c(g)?(f=!0,h=w(a,h)):h=W(a,h)),f?new Sk.astnodes.YieldFrom(h,d.lineno,d.col_offset):new Sk.astnodes.Yield(h,d.lineno,d.col_offset);case r.factor:if(1===c(d)){d=b(d,0);continue a}return E(a,d);case r.power:return g=d,e(g,r.power),d=C(a,b(g,0)),1!==c(g)&&b(g,c(g)-1).type===r.factor&&(a=w(a,b(g,c(g)-1)),d=new Sk.astnodes.BinOp(d,Sk.astnodes.Pow,a,g.lineno,g.col_offset)),
d;default:Sk.asserts.fail("unhandled expr","n.type: %d",d.type)}break}}function N(a,d){d.type===r.stmt&&(Sk.asserts.assert(1===c(d)),d=b(d,0));d.type===r.simple_stmt&&(Sk.asserts.assert(1===h(d)),d=b(d,0));if(d.type===r.small_stmt)switch(d=b(d,0),d.type){case r.expr_stmt:return da(a,d);case r.del_stmt:var k=d;e(k,r.del_stmt);return new Sk.astnodes.Delete(v(a,b(k,1),Sk.astnodes.Del),k.lineno,k.col_offset);case r.pass_stmt:return new Sk.astnodes.Pass(d.lineno,d.col_offset);case r.flow_stmt:return V(a,
d);case r.import_stmt:var n=d,p;e(n,r.import_stmt);var m=n.lineno;d=n.col_offset;n=b(n,0);if(n.type===r.import_name){n=b(n,1);e(n,r.dotted_as_names);var q=[];for(p=0;p<c(n);p+=2)q[p/2]=B(a,b(n,p));a=new Sk.astnodes.Import(q,m,d)}else if(n.type===r.import_from){var u=null;k=0;for(q=1;q<c(n);++q)if(b(n,q).type===r.dotted_name){u=B(a,b(n,q));q++;break}else if(b(n,q).type===z.T_DOT)k++;else if(b(n,q).type===z.T_ELLIPSIS)k+=3;else break;++q;switch(b(n,q).type){case z.T_STAR:n=b(n,q);break;case z.T_LPAR:n=
b(n,q+1);c(n);break;case r.import_as_names:n=b(n,q);q=c(n);if(0===q%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);}q=[];if(n.type===z.T_STAR)q[0]=B(a,n);else for(p=0;p<c(n);p+=2)q[p/2]=B(a,b(n,p));a=u?u.name.v:"";a=new Sk.astnodes.ImportFrom(l(a),q,k,m,d)}else throw new Sk.builtin.SyntaxError("unknown import statement",
a.c_filename,n.lineno);return a;case r.global_stmt:a=d;d=[];e(a,r.global_stmt);for(k=1;k<c(a);k+=2)d[(k-1)/2]=l(b(a,k).value);return new Sk.astnodes.Global(d,a.lineno,a.col_offset);case r.nonlocal_stmt:f(a,d,"Not implemented: nonlocal");break;case r.assert_stmt:return k=d,e(k,r.assert_stmt),2===c(k)?a=new Sk.astnodes.Assert(w(a,b(k,1)),null,k.lineno,k.col_offset):4===c(k)?a=new Sk.astnodes.Assert(w(a,b(k,1)),w(a,b(k,3)),k.lineno,k.col_offset):(Sk.asserts.fail("improper number of parts to assert stmt"),
a=void 0),a;case r.print_stmt:k=d;Sk.__future__.print_function&&f(a,k,"Missing parentheses in call to 'print'");n=1;m=null;e(k,r.print_stmt);2<=c(k)&&b(k,1).type===z.T_RIGHTSHIFT&&(m=w(a,b(k,2)),n=4);d=[];for(u=0;n<c(k);n+=2,++u)d[u]=w(a,b(k,n));a=b(k,c(k)-1).type===z.T_COMMA?!1:!0;return new Sk.astnodes.Print(m,d,a,k.lineno,k.col_offset);case r.debugger_stmt:return new Sk.astnodes.Debugger(d.lineno,d.col_offset);default:Sk.asserts.fail("unhandled small_stmt")}else switch(k=b(d,0),e(d,r.compound_stmt),
k.type){case r.if_stmt:e(k,r.if_stmt);if(4===c(k))a=new Sk.astnodes.If(w(a,b(k,1)),t(a,b(k,3)),[],k.lineno,k.col_offset);else if(d=b(k,4).value.charAt(2),"s"===d)a=new Sk.astnodes.If(w(a,b(k,1)),t(a,b(k,3)),t(a,b(k,6)),k.lineno,k.col_offset);else if("i"===d){m=c(k)-4;n=!1;d=[];b(k,m+1).type===z.T_NAME&&"s"===b(k,m+1).value.charAt(2)&&(n=!0,m-=3);m/=4;n&&(d=[new Sk.astnodes.If(w(a,b(k,c(k)-6)),t(a,b(k,c(k)-4)),t(a,b(k,c(k)-1)),b(k,c(k)-6).lineno,b(k,c(k)-6).col_offset)],m--);for(u=0;u<m;++u)n=5+4*
(m-u-1),d=[new Sk.astnodes.If(w(a,b(k,n)),t(a,b(k,n+2)),d,b(k,n).lineno,b(k,n).col_offset)];a=new Sk.astnodes.If(w(a,b(k,1)),t(a,b(k,3)),d,k.lineno,k.col_offset)}else Sk.asserts.fail("unexpected token in 'if' statement"),a=void 0;return a;case r.while_stmt:return e(k,r.while_stmt),4===c(k)?a=new Sk.astnodes.While(w(a,b(k,1)),t(a,b(k,3)),[],k.lineno,k.col_offset):7===c(k)?a=new Sk.astnodes.While(w(a,b(k,1)),t(a,b(k,3)),t(a,b(k,6)),k.lineno,k.col_offset):(Sk.asserts.fail("wrong number of tokens for 'while' stmt"),
a=void 0),a;case r.for_stmt:return d=[],e(k,r.for_stmt),9===c(k)&&(d=t(a,b(k,8))),n=b(k,1),m=v(a,n,Sk.astnodes.Store),m=1===c(n)?m[0]:new Sk.astnodes.Tuple(m,Sk.astnodes.Store,k.lineno,k.col_offset),new Sk.astnodes.For(m,W(a,b(k,3)),t(a,b(k,5)),d,k.lineno,k.col_offset);case r.try_stmt:d=[];p=c(k);m=(p-3)/3;u=[];q=null;e(k,r.try_stmt);n=t(a,b(k,2));if(b(k,p-3).type===z.T_NAME)"finally"===b(k,p-3).value?(9<=p&&b(k,p-6).type===z.T_NAME&&(u=t(a,b(k,p-4)),m--),q=t(a,b(k,p-1))):u=t(a,b(k,p-1)),m--;else if(b(k,
p-3).type!==r.except_clause)throw new Sk.builtin.SyntaxError("malformed 'try' statement",a.c_filename,k.lineno);if(0<m)for(p=0;p<m;p++){var A=p;var x=a,y=b(k,3+3*p),D=b(k,5+3*p);e(y,r.except_clause);e(D,r.suite);if(1===c(y))var E=new Sk.astnodes.ExceptHandler(null,null,t(x,D),y.lineno,y.col_offset);else 2===c(y)?E=new Sk.astnodes.ExceptHandler(w(x,b(y,1)),null,t(x,D),y.lineno,y.col_offset):4===c(y)?(Sk.__future__.python3&&","==b(y,2).value&&f(x,y,"Old-style 'except' clauses are not supported in Python 3"),
w(x,b(y,1)),E=w(x,b(y,3)),g(x,E,Sk.astnodes.Store,b(y,3)),E=new Sk.astnodes.ExceptHandler(w(x,b(y,1)),E,t(x,D),y.lineno,y.col_offset)):(Sk.asserts.fail("wrong number of children for except clause"),E=void 0);d[A]=E}Sk.asserts.assert(!!q||0!=d.length);return new Sk.astnodes.Try(n,d,u,q,k.lineno,k.col_offset);case r.with_stmt:d=[];e(k,r.with_stmt);for(m=1;m<c(k)-2;m+=2)n=void 0,q=a,p=b(k,m),e(p,r.with_item),u=w(q,b(p,0)),3==c(p)&&(n=w(q,b(p,2)),g(q,n,Sk.astnodes.Store,p)),n=new Sk.astnodes.withitem(u,
n),d[(m-1)/2]=n;a=t(a,b(k,c(k)-1));a=new Sk.astnodes.With(d,a,k.lineno,k.col_offset);return a;case r.funcdef:return T(a,k,[],!1);case r.classdef:return P(a,k,[]);case r.decorated:m=null;e(k,r.decorated);n=b(k,0);e(n,r.decorators);d=[];for(u=0;u<c(n);++u){q=d;p=u;A=a;E=b(n,u);e(E,r.decorator);e(b(E,0),z.T_AT);e(b(E,c(E)-1),z.T_NEWLINE);var C,G=b(E,1);e(G,r.dotted_name);x=G.lineno;y=G.col_offset;D=l(b(G,0).value);var M=new Sk.astnodes.Name(D,Sk.astnodes.Load,x,y);for(C=2;C<c(G);C+=2)D=l(b(G,C).value),
M=new Sk.astnodes.Attribute(M,D,Sk.astnodes.Load,x,y);x=M;A=3===c(E)?x:5===c(E)?new Sk.astnodes.Call(x,[],[],null,null,E.lineno,E.col_offset):F(A,b(E,3),x);q[p]=A}Sk.asserts.assert(b(k,1).type==r.funcdef||b(k,1).type==r.async_funcdef||b(k,1).type==r.classdef);b(k,1).type==r.funcdef?(m=b(k,1),m=T(a,m,d,!1)):b(k,1).type==r.classdef?m=P(a,b(k,1),d):b(k,1).type==r.async_funcdef&&(m=b(k,1),e(m,r.async_funcdef),e(b(m,0),z.T_NAME),Sk.asserts.assert(("async"===b(m,0)).value),e(b(m,1),r.funcdef),m=T(a,m,d,
!0));m&&(m.lineno=k.lineno,m.col_offset=k.col_offset);return m;case r.async_stmt:f(a,k,"Not implemented: async");break;default:Sk.asserts.assert("unhandled compound_stmt")}}var r=Sk.ParseTables.sym,z=Sk.token.tokens,Z={Slice_kind:1,ExtSlice_kind:2,Index_kind:3},O={};O[z.T_VBAR]=Sk.astnodes.BitOr;O[z.T_CIRCUMFLEX]=Sk.astnodes.BitXor;O[z.T_AMPER]=Sk.astnodes.BitAnd;O[z.T_LEFTSHIFT]=Sk.astnodes.LShift;O[z.T_RIGHTSHIFT]=Sk.astnodes.RShift;O[z.T_PLUS]=Sk.astnodes.Add;O[z.T_MINUS]=Sk.astnodes.Sub;O[z.T_STAR]=
Sk.astnodes.Mult;O[z.T_SLASH]=Sk.astnodes.Div;O[z.T_DOUBLESLASH]=Sk.astnodes.FloorDiv;O[z.T_PERCENT]=Sk.astnodes.Mod;Sk.setupOperators=function(a){a?O[z.T_AT]=Sk.astnodes.MatMult:O[z.T_AT]&&delete O[z.T_AT]};Sk.exportSymbol("Sk.setupOperators",Sk.setupOperators);const fa=/_[eE]|[eE]_|\._|j_/,ha=/_\.|[+-]_|^0_\D|_j/,ia=/_(?=[^_])/g;Sk.astFromParse=function(d,g,f){var k,n=new a("utf-8",g,f),p=[],l=0;switch(d.type){case r.file_input:for(k=0;k<c(d)-1;++k){var m=b(d,k);if(d.type!==z.T_NEWLINE)if(e(m,r.stmt),
f=h(m),1===f)p[l++]=N(n,m);else for(m=b(m,0),e(m,r.simple_stmt),g=0;g<f;++g)p[l++]=N(n,b(m,2*g))}return new Sk.astnodes.Module(p);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,d){var e;if(null===a)return d+"None";if(a.prototype&&void 0!==a.prototype._astname&&a.prototype._isenum)return d+a.prototype._astname+"()";if(void 0!==
a._astname){var g=b(a._astname.length+1);var f=[];for(e=0;e<a._fields.length;e+=2){var h=a._fields[e];var k=a._fields[e+1](a);var n=b(h.length+1);f.push([h,c(k,d+g+n)])}k=[];for(e=0;e<f.length;++e)n=f[e],k.push(n[0]+"="+n[1].replace(/^\s+/,""));e=k.join(",\n"+d+g);return d+a._astname+"("+e+")"}if(Sk.isArrayLike(a)){g=[];for(e=0;e<a.length;++e)f=a[e],g.push(c(f,d+" "));a=g.join(",\n");return d+"["+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 d+a};return c(a,"")};Sk.exportSymbol("Sk.astFromParse",Sk.astFromParse);Sk.exportSymbol("Sk.astDump",Sk.astDump)},function(m,q){function a(a,b,c){this.__name=a;this.__flags=b;this.__scope=b>>11&7;this.__namespaces=c||[]}function c(a,b,c,e,f){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=f;this.table=a;a.cur&&
(a.cur.nested||"function"===a.cur.blockType)&&(this.isNested=!0);e.scopeId=l++;a.stss[e.scopeId]=this;this.symbols={}}function b(a){this.filename=a;this.top=this.cur=null;this.stack=[];this.curClass=this.global=null;this.tmpname=0;this.stss={}}function e(a,b){var c;for(c=0;c<b.length;c++)a(b[c])}function f(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 l=0;c.prototype.get_type=
function(){return this.blockType};c.prototype.get_name=function(){return this.name};c.prototype.get_lineno=function(){return this.lineno};c.prototype.is_nested=function(){return this.isNested};c.prototype.has_children=function(){return 0<this.children.length};c.prototype.get_identifiers=function(){return this._identsMatching(function(){return!0})};c.prototype.lookup=function(b){if(this.symbols.hasOwnProperty(b))b=this.symbols[b];else{var c=this.symFlags[b];var e=this.__check_children(b);b=this.symbols[b]=
new a(b,c,e)}return b};c.prototype.__check_children=function(a){var b,c=[];for(b=0;b<this.children.length;++b){var e=this.children[b];e.name===a&&c.push(e)}return c};c.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};c.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};c.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};c.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};
c.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};c.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};
c.prototype.getScope=function(a){a=this.symFlags[a];return void 0===a?0:a>>11&7};b.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};b.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 e=a.length;for(c=0;c<e;++c)(b=a[c])&&this.visitStmt(b)}};b.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 e=a.length;for(c=0;c<e;++c)(b=a[c])&&this.visitExpr(b)}};b.prototype.enterBlock=function(a,b,e,f){a=Sk.fixReserved(a);var d=null;this.cur&&(d=this.cur,this.stack.push(this.cur));this.cur=new c(this,a,b,e,f);"top"===a&&(this.global=this.cur.symFlags);d&&d.children.push(this.cur)};b.prototype.exitBlock=function(){this.cur=null;0<this.stack.length&&(this.cur=this.stack.pop())};b.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);};b.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)};b.prototype.newTmpname=function(a){this.addDef(new Sk.builtin.str("_["+
++this.tmpname+"]"),2,a)};b.prototype.addDef=function(a,b,c){var d=Sk.mangleName(this.curClass,a).v;d=Sk.fixReserved(d);var e=this.cur.symFlags[d];if(void 0!==e){if(b&4&&e&4)throw new Sk.builtin.SyntaxError("duplicate argument '"+a.v+"' in function definition",this.filename,c);e|=b}else e=b;this.cur.symFlags[d]=e;b&4?this.cur.varnames.push(d):b&1&&(e=b,a=this.global[d],void 0!==a&&(e|=a),this.global[d]=e)};b.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)}};b.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 f=Sk.mangleName(this.curClass,c.id).v;f=Sk.fixReserved(f);c=this.cur.symFlags[f];if(c&2049&&this.global!=this.cur.symFlags&&a.simple)throw new Sk.builtin.SyntaxError("annotated name '"+f+"' can't be global",this.filename,a.lineno);a.simple?this.addDef(new Sk.builtin.str(f),
4098,a.lineno):a.value&&this.addDef(new Sk.builtin.str(f),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 k=
a.names.length;for(b=0;b<k;++b){f=Sk.mangleName(this.curClass,a.names[b]).v;f=Sk.fixReserved(f);c=this.cur.symFlags[f];if(c&10){if(c&2)throw new Sk.builtin.SyntaxError("name '"+f+"' is assigned to before global declaration",this.filename,a.lineno);throw new Sk.builtin.SyntaxError("name '"+f+"' is used prior to global declaration",this.filename,a.lineno);}this.addDef(new Sk.builtin.str(f),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:e(this.visit_withitem.bind(this),a.items);e(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")}};b.prototype.visit_withitem=function(a){this.visitExpr(a.context_expr);a.optional_vars&&this.visitExpr(a.optional_vars)};b.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")}};b.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)};b.prototype.visitAlias=function(a,b){var c,d;for(d=0;d<a.length;++d){var e=a[d];var f=c=null===e.asname?e.name.v:e.asname.v;e=c.indexOf(".");-1!==e&&(f=c.substr(0,e));if("*"!==c)this.addDef(new Sk.builtin.str(f),1024,b);else if("module"!==this.cur.blockType)throw new Sk.builtin.SyntaxError("import * only allowed at module level",
this.filename);}};b.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()};b.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)};b.prototype.analyzeBlock=
function(a,b,c,e){var d={};var g={},h={},n={},l={};"class"==a.blockType&&(f(h,e),b&&f(n,b));for(q in a.symFlags){var m=a.symFlags[q];this.analyzeName(a,g,q,m,b,d,c,e)}"class"!==a.blockType&&("function"===a.blockType&&f(n,d),b&&f(n,b),f(h,e));d={};var q=a.children.length;for(m=0;m<q;++m)if(e=a.children[m],this.analyzeChildBlock(e,n,l,h,d),e.hasFree||e.childHasFree)a.childHasFree=!0;f(l,d);"function"===a.blockType&&this.analyzeCells(g,l);b=this.updateSymbols(a.symFlags,g,b,l,"class"===a.blockType);
a.hasFree=a.hasFree||b;f(c,l)};b.prototype.analyzeChildBlock=function(a,b,c,e,k){var d={};f(d,b);b={};f(b,c);c={};f(c,e);this.analyzeBlock(a,d,b,c);f(k,b)};b.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])}};b.prototype.updateSymbols=function(a,b,c,e,f){var d,g=!1;for(d in a){var k=a[d];var h=b[d];k|=h<<11;a[d]=k}for(d in e)b=a[d],void 0!==b?f&&b&1031&&(b|=512,a[d]=b):void 0!==c[d]&&(a[d]=8192,g=!0);return g};b.prototype.analyzeName=function(a,
b,c,e,f,p,l,m){if(e&1){if(e&4)throw new Sk.builtin.SyntaxError("name '"+c+"' is local and global",this.filename,a.lineno);b[c]=2;m[c]=null;f&&void 0!==f[c]&&delete f[c]}else e&1030?(b[c]=1,p[c]=null,delete m[c]):f&&void 0!==f[c]?(b[c]=4,a.hasFree=!0,l[c]=null):(m&&void 0!==m[c]||!a.isNested||(a.hasFree=!0),b[c]=3)};b.prototype.analyze=function(){this.analyzeBlock(this.top,null,{},{})};Sk.symboltable=function(a,c){var d=new b(c);d.enterBlock("top","module",a,0);d.top=d.cur;for(c=0;c<a.body.length;++c)d.visitStmt(a.body[c]);
d.exitBlock();d.analyze();return d};Sk.dumpSymtab=function(a){var b=function(a){return a?"True":"False"},c=function(a){var b,c=[];for(b=0;b<a.length;++b)c.push((new Sk.builtin.str(a[b])).$r().v);return"["+c.join(", ")+"]"},e=function(a,d){var f,g;void 0===d&&(d="");var k=d+"Sym_type: "+a.get_type()+"\n";k+=d+"Sym_name: "+a.get_name()+"\n";k+=d+"Sym_lineno: "+a.get_lineno()+"\n";k+=d+"Sym_nested: "+b(a.is_nested())+"\n";k+=d+"Sym_haschildren: "+b(a.has_children())+"\n";"class"===a.get_type()?k+=d+
"Class_methods: "+c(a.get_methods())+"\n":"function"===a.get_type()&&(k+=d+"Func_params: "+c(a.get_parameters())+"\n",k+=d+"Func_locals: "+c(a.get_locals())+"\n",k+=d+"Func_globals: "+c(a.get_globals())+"\n",k+=d+"Func_frees: "+c(a.get_frees())+"\n");k+=d+"-- Identifiers --\n";var h=a.get_identifiers();var n=h.length;for(g=0;g<n;++g){var l=a.lookup(h[g]);k+=d+"name: "+l.get_name()+"\n";k+=d+"  is_referenced: "+b(l.is_referenced())+"\n";k+=d+"  is_imported: "+b(l.is_imported())+"\n";k+=d+"  is_parameter: "+
b(l.is_parameter())+"\n";k+=d+"  is_global: "+b(l.is_global())+"\n";k+=d+"  is_declared_global: "+b(l.is_declared_global())+"\n";k+=d+"  is_local: "+b(l.is_local())+"\n";k+=d+"  is_free: "+b(l.is_free())+"\n";k+=d+"  is_assigned: "+b(l.is_assigned())+"\n";k+=d+"  is_namespace: "+b(l.is_namespace())+"\n";var m=l.get_namespaces();var p=m.length;k+=d+"  namespaces: [\n";var q=[];for(f=0;f<p;++f)l=m[f],q.push(e(l,d+"    "));k+=q.join("\n");k+=d+"  ]\n"}return k};return e(a.top,"")};Sk.exportSymbol("Sk.symboltable",
Sk.symboltable);Sk.exportSymbol("Sk.dumpSymtab",Sk.dumpSymtab)},function(m,q){function a(a,b,c,e,f){this.filename=a;this.st=b;this.flags=c;this.canSuspend=e;this.interactive=!1;this.nestlevel=0;this.u=null;this.stack=[];this.result=[];this.allUnits=[];this.source=f?f.split("\n"):!1}function c(){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 b(a){return void 0===h[a]?a:a+"_$rw$"}function e(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 f(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 l;Sk.gensymcount=0;c.prototype.activateScope=function(){var a=this;l=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;l("\n//\n// line ",c,":\n// ",this.getSourceLine(c),"\n// ");for(b=0;b<d;++b)l(" ");l("^\n//\n");Sk.asserts.assert(void 0!==a.lineno&&void 0!==a.col_offset);l("$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 h=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);l("var ",d,"=");for(c=1;c<arguments.length;++c)l(arguments[c]);l(";");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,"))");l("if(",a,"){/*test failed */$blk=",b,";continue;}")};a.prototype._jumpundef=function(a,b){l("if(",a,"===undefined){$blk=",b,";continue;}")};a.prototype._jumpnotundef=function(a,b){l("if(",a,"!==undefined){$blk=",b,";continue;}")};a.prototype._jumptrue=function(a,b){a=this._gr("jtrue","(",a,"===true||Sk.misceval.isTrue(",a,"))");l("if(",a,"){/*test passed */$blk=",
b,";continue;}")};a.prototype._jump=function(a){null===this.u.blocks[this.u.curblock]._next&&(l("$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"};l("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 l("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?l(b,
".push(",this.vexpr(c),");"):(l("$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 e=!1;for(d=0;d<a.elts.length;d++)if(a.elts[d].constructor===Sk.astnodes.Starred){e=!0;var f=d;break}if(a.ctx===Sk.astnodes.Store){if(e){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=f+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=e?f:a.elts.length;l("$ret = Sk.abstr.sequenceUnpack("+b+","+c+","+(e?a.elts.length-1:c)+", "+e+");");this._checkSuspension();b=this._gr("items","$ret");for(d=0;d<a.elts.length;++d)d===f?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(e){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){e=!0;b=[];for(d=0;d<a.elts.length;++d)f=this.vexpr(a.elts[d]),e&&-1==f.indexOf("$const")&&(e=!1),b.push(f);if(e)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,e,f,h,m){var d=this.newBlock(a+" comp start"),g=this.newBlock(a+" comp skip"),k=this.newBlock(a+" comp anchor"),n=c[e],p=this.vexpr(n.iter);p=this._gr("iter","Sk.abstr.iter(",p,")");var q;this._jump(d);this.setBlock(d);l("$ret = Sk.abstr.iternext(",p,", true);");this._checkSuspension(m);p=this._gr("next","$ret");this._jumpundef(p,k);this.vexpr(n.target,p);var u=n.ifs?n.ifs.length:0;for(q=0;q<u;++q)p=this.vexpr(n.ifs[q]),this._jumpfalse(p,d);++e<c.length&&
this.ccompgen(a,b,c,e,f,h,m);e>=c.length&&(c=this.vexpr(f),"dict"===a?(a=this.vexpr(h),l(b,".mp$ass_subscript(",a,",",c,");")):"list"===a?l(b,".v.push(",c,");"):"set"===a&&l(b,".v.mp$ass_subscript(",c,", true);"),this._jump(g),this.setBlock(g));this._jump(d);this.setBlock(k);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");l("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 e=this.newBlock("done");var f=this._gr("compareres","null");for(b=0;b<d;++b){var h=this.vexpr(a.comparators[b]);l("$ret = Sk.builtin.bool(Sk.misceval.richCompareBool(",c,",",h,",'",a.ops[b].prototype._astname,"', true));");this._checkSuspension(a);
l(f,"=$ret;");this._jumpfalse("$ret",e);c=h}this._jump(e);this.setBlock(e);return f};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||(l("$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&&(l('if (typeof self === "undefined" || self.toString().indexOf("Window") > 0) { throw new Sk.builtin.RuntimeError("super(): no arguments") };'),c="[$gbl.__class__,self]");l("$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,e){a=this.vslicesub(a);return this.chandlesubscr(b,c,a,e)};a.prototype.chandlesubscr=function(a,b,c,e){if(a===Sk.astnodes.Load||a===Sk.astnodes.AugLoad)return l("$ret = Sk.abstr.objectGetItem(",b,",",c,", true);"),this._checkSuspension(),this._gr("lsubscr","$ret");a===Sk.astnodes.Store||a===Sk.astnodes.AugStore?(l("$ret = Sk.abstr.objectSetItem(",
b,",",c,",",e,", true);"),this._checkSuspension()):a===Sk.astnodes.Del?l("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 e=this.newBlock("end of boolop");var f=a.values;var h=f.length;for(b=0;b<h;++b)a=this.vexpr(f[b]),0===b&&(c=this._gr("boolopsucc",a)),l(c,"=",a,";"),d.call(this,a,e);this._jump(e);this.setBlock(e);
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?l(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,k){var d;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.lng)return this.makeConstant("new Sk.builtin.lng('"+a.n.v.toString()+"')");if(a.n instanceof Sk.builtin.int_)return"number"===typeof a.n.v?this.makeConstant("new Sk.builtin.int_("+a.n.v+")"):this.makeConstant("new Sk.builtin.int_('"+a.n.v.toString()+"')");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.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(",
f(a.s.$jsstr()),")");case Sk.astnodes.Attribute:a.ctx!==Sk.astnodes.AugLoad&&a.ctx!==Sk.astnodes.AugStore&&(d=this.vexpr(a.value));k=a.attr.$r().v;k=k.substring(1,k.length-1);k=e(this.u.private_,new Sk.builtin.str(k)).v;k=this.makeConstant("new Sk.builtin.str('"+k+"')");switch(a.ctx){case Sk.astnodes.AugLoad:return l("$ret = ",c,".tp$getattr(",k,", true);"),this._checkSuspension(a),l("\nif ($ret === undefined) {"),l("\nthrow new Sk.builtin.AttributeError(",c,'.sk$attrError() + " has no attribute \'" + ',
k,'.$jsstr() + "\'");'),l("\n};"),this._gr("lattr","$ret");case Sk.astnodes.Load:return l("$ret = ",d,".tp$getattr(",k,", true);"),this._checkSuspension(a),l("\nif ($ret === undefined) {"),l("\nthrow new Sk.builtin.AttributeError(",d,'.sk$attrError() + " has no attribute \'" + ',k,'.$jsstr() + "\'");'),l("\n};"),this._gr("lattr","$ret");case Sk.astnodes.AugStore:l("$ret = undefined;");l("if(",b,"!==undefined){");l("$ret = ",c,".tp$setattr(",k,",",b,", true);");l("}");this._checkSuspension(a);break;
case Sk.astnodes.Store:l("$ret = ",d,".tp$setattr(",k,",",b,", true);");this._checkSuspension(a);break;case Sk.astnodes.Del:l("$ret = ",d,".tp$setattr(",k,", undefined, true);");this._checkSuspension(a);break;default:Sk.asserts.fail("invalid attribute expression")}break;case Sk.astnodes.Subscript:switch(a.ctx){case Sk.astnodes.AugLoad:return l("$ret = Sk.abstr.objectGetItem(",c,",",k,", 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:l("$ret=undefined;");l("if(",b,"!==undefined){");l("$ret=Sk.abstr.objectSetItem(",c,",",k,",",b,", true)");l("}");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 e=this.vexpr(a.value);a=this._gr("inplbinopattr","Sk.abstr.numberInplaceBinOp(",d,",",e,",'",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 f=
this.vslicesub(b.slice);b=new Sk.astnodes.Subscript(b.value,f,Sk.astnodes.AugLoad,b.lineno,b.col_offset);d=this.vexpr(b,void 0,c,f);e=this.vexpr(a.value);a=this._gr("inplbinopsubscr","Sk.abstr.numberInplaceBinOp(",d,",",e,",'",a.op.prototype._astname,"')");b.ctx=Sk.astnodes.AugStore;return this.vexpr(b,a,c,f);case Sk.astnodes.Name:return c=this.nameop(b.id,Sk.astnodes.Load),e=this.vexpr(a.value),a=this._gr("inplbinop","Sk.abstr.numberInplaceBinOp(",c,",",e,",'",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){l("$exc.push(",a,");")};a.prototype.endExcept=
function(){l("$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 e=a.localnames[b];void 0===c[e]&&(d.push(e),c[e]=!0)}return 0<d.length?"var "+d.join(",")+"; /* locals */":""};a.prototype.outputSuspensionHelpers=function(a){var b,c=[],d=a.localnames.concat(a.tempsToSave),e={},f=a.ste.blockType===Sk.SYMTAB_CONSTS.FunctionBlock&&a.ste.childHasFree,h=(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();"+(f?"$cell=susp.$cell;":"");for(b=0;b<d.length;b++){var l=d[b];void 0===e[l]&&(h+=l+"=susp.$tmps."+l+";",e[l]=!0)}h+="try { $ret=susp.child.resume(); } catch(err) { if (!(err instanceof Sk.builtin.BaseException)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: $currLineNo, colno: $currColNo, filename: '"+
this.filename+"'}); if($exc.length>0) { $err=err; $blk=$exc.pop(); } else { throw err; } }};";h+="var $saveSuspension = function($child, $filename, $lineno, $colno) {var susp = new Sk.misceval.Suspension(); susp.child=$child;susp.resume=function(){"+a.scopename+".$wakingSuspension=susp; return "+a.scopename+"("+(a.ste.generator?"$gen":"")+"); };susp.data=susp.child.data;susp.$blk=$blk;susp.$loc=$loc;susp.$gbl=$gbl;susp.$exc=$exc;susp.$err=$err;susp.$postfinally=$postfinally;susp.$filename=$filename;susp.$lineno=$lineno;susp.$colno=$colno;susp.optional=susp.child.optional;"+
(f?"susp.$cell=$cell;":"");e={};for(b=0;b<d.length;b++)l=d[b],void 0===e[l]&&(c.push('"'+l+'":'+l),e[l]=!0);return h+="susp.$tmps={"+c.join(",")+"};return susp;};"};a.prototype.outputAllUnits=function(){var a,b,c="";for(b=0;b<this.allUnits.length;++b){var e=this.allUnits[b];c+=e.prefixCode;c+=this.outputLocals(e);e.doesSuspend&&(c+=this.outputSuspensionHelpers(e));c+=e.varDeclsCode;c+=e.switchCode;var f=e.blocks;var h=Object.create(null);for(a=0;a<f.length;++a){var l=a;if(!(l in h))for(;;)if(h[l]=
!0,c+="case "+l+": /* --- "+f[l]._name+" --- */",c+=f[l].join(""),null!==f[l]._next)if(f[l]._next in h){c+="/* jump */ continue;";break}else c+="/* allowing case fallthrough */",l=f[l]._next;else{c+="throw new Sk.builtin.SystemError('internal error: unterminated block');";break}}c+=e.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 e=this.newBlock("while body");this.annotateSource(a);this._jumpfalse(this.vexpr(a.test),d?d:c);this._jump(e);this.pushBreakBlock(c);this.pushContinueBlock(b);this.setBlock(e);(Sk.debugging||Sk.killableWhile)&&this.u.canSuspend&&(e=this.newBlock("debug breakpoint for line "+a.lineno),l("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.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 e=this.vexpr(a.iter);if(this.u.ste.generator){var f="$loc."+this.gensym("iter");l(f,"=Sk.abstr.iter(",e,");")}else f=this._gr("iter","Sk.abstr.iter(",e,")"),this.u.tempsToSave.push(f);this._jump(b);this.setBlock(b);l("$ret = Sk.abstr.iternext(",f,this.u.canSuspend?", true":", false",");");this._checkSuspension(a);f=this._gr("next","$ret");this._jumpundef(f,c);this.vexpr(a.target,f);(Sk.debugging||Sk.killableFor)&&this.u.canSuspend&&(f=this.newBlock("debug breakpoint for line "+a.lineno),l("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.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)),l("if(!(",d," instanceof Sk.builtin.tuple)) {",d,"= new Sk.builtin.tuple([",d,"]);","}"),l("$ret = Sk.misceval.callsimOrSuspendArray(",b,",",d,".v);")):l("$ret = Sk.misceval.callsimOrSuspend(",b,");");this._checkSuspension(a);l(b,"=$ret;");this._jump(c);this.setBlock(c);l("if (",b,
" instanceof Sk.builtin.BaseException) {throw ",b,";} else {throw new Sk.builtin.TypeError('exceptions must derive from BaseException');};")}else l("throw $err;")};a.prototype.outputFinallyCascade=function(a){if(0==this.u.finallyBlocks.length)l("if($postfinally!==undefined) { if ($postfinally.returning) { return $postfinally.returning; } else { $blk=$postfinally.gotoBlock; $postfinally=undefined; continue; } }");else{var b=this.peekFinallyBlock();l("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 e=this.newBlock("finalexh");var f=this._gr("finally_reraise","undefined");this.u.tempsToSave.push(f);this.pushFinallyBlock(d);var h=this.peekFinallyBlock();this.setupExcept(e)}var m=[];for(b=0;b<c;++b)m.push(this.newBlock("except_"+
b+"_"));var q=this.newBlock("unhandled");var B=this.newBlock("orelse");var D=this.newBlock("end");0!=m.length&&this.setupExcept(m[0]);this.vseqstmt(a.body);0!=m.length&&this.endExcept();this._jump(B);for(b=0;b<c;++b){this.setBlock(m[b]);var E=a.handlers[b];if(!E.type&&b<c-1)throw new Sk.builtin.SyntaxError("default 'except:' must be last",this.filename,E.lineno);if(E.type){var F=this.vexpr(E.type);var M=b==c-1?q:m[b+1];F=this._gr("instance","Sk.misceval.isTrue(Sk.builtin.isinstance($err, ",F,"))");
this._jumpfalse(F,M)}E.name&&this.vexpr(E.name,"$err");this.vseqstmt(E.body);this._jump(D)}this.setBlock(q);l("throw $err;");this.setBlock(B);this.vseqstmt(a.orelse);this._jump(D);this.setBlock(D);a.finalbody&&(this.endExcept(),this._jump(d),this.setBlock(e),l(f,"=$err;"),this._jump(d),this.setBlock(d),this.popFinallyBlock(),this.vseqstmt(a.finalbody),l("if(",f,"!==undefined) { throw ",f,";}"),this.outputFinallyCascade(h))};a.prototype.cwith=function(a,b){var c=this.newBlock("withexh"),d=this.newBlock("withtidyup"),
e=this.newBlock("withcarryon");var f=this._gr("mgr",this.vexpr(a.items[b].context_expr));l("$ret = Sk.abstr.lookupSpecial(",f,",Sk.builtin.str.$exit);");this._checkSuspension(a);var g=this._gr("exit","$ret");this.u.tempsToSave.push(g);l("$ret = Sk.abstr.lookupSpecial(",f,",Sk.builtin.str.$enter);");this._checkSuspension(a);l("$ret = Sk.misceval.callsimOrSuspendArray($ret);");this._checkSuspension(a);f=this._gr("value","$ret");this.pushFinallyBlock(d);var h=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,f);b+1<a.items.length?this.cwith(a,b+1):this.vseqstmt(a.body);this.endExcept();this._jump(d);this.setBlock(c);l("$ret = Sk.misceval.applyOrSuspend(",g,",undefined,Sk.builtin.getExcInfo($err),undefined,[]);");this._checkSuspension(a);this._jumptrue("$ret",e);l("throw $err;");this.setBlock(d);this.popFinallyBlock();l("$ret = Sk.misceval.callsimOrSuspendArray(",g,",[Sk.builtin.none.none$,Sk.builtin.none.none$,Sk.builtin.none.none$]);");
this._checkSuspension(a);this.outputFinallyCascade(h);this._jump(e);this.setBlock(e)};a.prototype.cassert=function(a){var b=this.vexpr(a.test),c=this.newBlock("end");this._jumptrue(b,c);l("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];l("$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 c,d=a.names.length;var e=[];var f=a.level;0!=f||Sk.__future__.absolute_import||(f=-1);for(c=0;c<d;++c)e[c]="'"+b(a.names[c].name.v)+"'";l("$ret = Sk.builtin.__import__(",a.module.$r().v,",$gbl,$loc,[",e,"],",f,");");this._checkSuspension(a);f=this._gr("module","$ret");for(c=0;c<d;++c){e=a.names[c];var h="'"+e.name.v+"'";if(0===c&&"*"===e.name.v){Sk.asserts.assert(1===d);l("Sk.importStar(",f,",$loc, $gbl);");break}var m=this._gr("item","Sk.abstr.gattr(",f,", new Sk.builtin.str(",h,
"), undefined)");h=e.name;e.asname&&(h=e.asname);this.nameop(h,Sk.astnodes.Store,m)}};a.prototype.buildcodeobj=function(a,c,f,k,h,m){var d=[],g=[],n=[],p=[],q=null,u=null;f&&(g=this.vseqexpr(f));k&&k.defaults&&(n=this.vseqexpr(k.defaults));k&&k.kw_defaults&&(p=k.kw_defaults.map(a=>a?this.vexpr(a):"undefined"));k&&k.vararg&&(q=k.vararg);k&&k.kwarg&&(u=k.kwarg);if(!Sk.__future__.python3&&k&&k.kwonlyargs&&0!=k.kwonlyargs.length)throw new Sk.builtin.SyntaxError("Keyword-only arguments are not supported in Python 2");
var F=this.enterScope(c,a,a.lineno,this.canSuspend);f=this.u.ste.generator;var M=this.u.ste.hasFree;var V=this.u.ste.childHasFree;var y=this.newBlock("codeobj entry");this.u.prefixCode="var "+F+"=(function "+this.niceName(c.v)+"$(";var G=[];if(f){if(u)throw new Sk.builtin.SyntaxError(c.v+"(): keyword arguments in generators not supported",this.filename,a.lineno);if(q)throw new Sk.builtin.SyntaxError(c.v+"(): variable number of arguments in generators not supported",this.filename,a.lineno);G.push("$gen")}else{u&&
(G.push("$kwa"),this.u.tempsToSave.push("$kwa"));for(a=0;k&&a<k.args.length;++a)G.push(this.nameop(k.args[a].arg,Sk.astnodes.Param));for(a=0;k&&k.kwonlyargs&&a<k.kwonlyargs.length;++a)G.push(this.nameop(k.kwonlyargs[a].arg,Sk.astnodes.Param));q&&G.push(this.nameop(k.vararg.arg,Sk.astnodes.Param))}let L=!f;M&&(L||G.push("$free"),this.u.tempsToSave.push("$free"));this.u.prefixCode=L?this.u.prefixCode+"$posargs,$kwargs":this.u.prefixCode+G.join(",");this.u.prefixCode+="){";f&&(this.u.prefixCode+="\n// generator\n");
M&&(this.u.prefixCode+="\n// has free\n");V&&(this.u.prefixCode+="\n// has cell\n");L&&(this.u.prefixCode+="\n// fast call\n");var T="{}";f&&(y="$gen.gi$resumeat",T="$gen.gi$locals");a=",$cell={}";V&&f&&(a=",$cell=$gen.gi$cells");this.u.varDeclsCode+="var $blk="+y+",$exc=[],$loc="+T+a+",$gbl="+(L?"this && this.func_globals":"this")+(L&&M?",$free=this && 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(L){this.u.varDeclsCode=u||q||k&&k.kwonlyargs&&0!==k.kwonlyargs.length?this.u.varDeclsCode+"\nvar $args = this.$resolveArgs($posargs,$kwargs)\n":this.u.varDeclsCode+("var $args = ((!$kwargs || $kwargs.length===0) && $posargs.length==="+
G.length+") ? $posargs : this.$resolveArgs($posargs,$kwargs)");for(a=0;a<G.length;a++)this.u.varDeclsCode+=","+G[a]+"=$args["+a+"]";this.u.varDeclsCode+=";\n"}if(f&&0<n.length)for(y=k.args.length-n.length,a=0;a<n.length;++a)G=this.nameop(k.args[a+y].arg,Sk.astnodes.Param),this.u.varDeclsCode+="if("+G+"===undefined)"+G+"="+F+".$defaults["+a+"];";for(a=0;k&&a<k.args.length;++a)G=k.args[a].arg,this.isCell(G)&&(G=b(e(this.u.private_,G).v),this.u.varDeclsCode+="$cell."+G+"="+G+";");for(a=0;k&&k.kwonlyargs&&
a<k.kwonlyargs.length;++a)G=k.kwonlyargs[a].arg,this.isCell(G)&&(G=b(e(this.u.private_,G).v),this.u.varDeclsCode+="$cell."+G+"="+G+";");q&&this.isCell(q.arg)&&(a=b(e(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=b(e(this.u.private_,u.arg).v),this.u.varDeclsCode+="$cell."+a+"="+a+";"));this.u.varDeclsCode+="}";Sk.__future__.python3&&m&&(this.u.varDeclsCode+=
"$gbl.__class__=$gbl."+m.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; }} }});";h.call(this,F);if(k){for(let a of k.args)d.push(a.arg.v);
for(let a of k.kwonlyargs||[])d.push(a.arg.v);this.u.argnames=d}this.exitScope();0<n.length&&l(F,".$defaults=[",n.join(","),"];");k&&k.kwonlyargs&&0<k.kwonlyargs.length&&(l(F,".co_argcount=",k.args.length,";"),l(F,".co_kwonlyargcount=",k.kwonlyargs.length,";"),l(F,".$kwdefs=[",p.join(","),"];"));0<d.length?l(F,".co_varnames=['",d.join("','"),"'];"):l(F,".co_varnames=[];");u&&l(F,".co_kwargs=1;");q&&l(F,".co_varargs=1;");f||l(F,".co_fastcall=1;");h="";M&&(h=",$cell",(m=this.u.ste.hasFree)&&(h+=",$free"));
if(f)return k&&0<k.args.length?this._gr("gener","new Sk.builtins['function']((function(){var $origargs=Array.prototype.slice.call(arguments);Sk.builtin.pyCheckArgsLen(\"",c.v,'",arguments.length,',k.args.length-n.length,",",k.args.length,");return new Sk.builtins['generator'](",F,",$gbl,$origargs",h,");}))"):this._gr("gener","new Sk.builtins['function']((function(){Sk.builtin.pyCheckArgsLen(\"",c.v,"\",arguments.length,0,0);return new Sk.builtins['generator'](",F,",$gbl,[]",h,");}))");if(0<g.length){l("$ret = new Sk.builtins['function'](",
F,",$gbl",h,");");for(let a of g.reverse())l("$ret = Sk.misceval.callsimOrSuspendArray(",a,",[$ret]);"),this._checkSuspension();return this._gr("funcobj","$ret")}return this._gr("funcobj","new Sk.builtins['function'](",F,",$gbl",h,")")};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);l("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);l("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);l(d,"=",this.vexpr(a.body),";");this._jump(c);this.setBlock(b);l(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 h="$loc.$iter0";else{var m=this.vexpr(g.iter);h="$loc."+this.gensym("iter");l(h,"=","Sk.abstr.iter(",m,");")}this._jump(d);this.setBlock(d);this.annotateSource(c);l("$ret = Sk.abstr.iternext(",h,this.u.canSuspend?", true":", false",");");this._checkSuspension(c);m=this._gr("next","$ret");this._jumpundef(m,f);this.vexpr(g.target,
m);var n=g.ifs?g.ifs.length:0;for(h=0;h<n;++h)this.annotateSource(g.ifs[h]),m=this.vexpr(g.ifs[h]),this._jumpfalse(m,d);++b<a.length&&this.cgenexpgen(a,b,c);b>=a.length&&(this.annotateSource(c),a=this.vexpr(c),l("return [",e,"/*resume*/,",a,"/*ret*/];"),this.setBlock(e));this._jump(d);this.setBlock(f);1===b&&l("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,");");l(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);l("return;");this.exitScope();l("$ret = Sk.misceval.buildClass($gbl,",d,",",a.name.$r().v,
",[",c,"], $cell);");for(let a of b)l("$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?
l("$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?l("$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);l("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?l("return ",c,";"):(l("$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:l("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=b(e(this.u.private_,a).v);return this.u.ste.getScope(a)===Sk.SYMTAB_CONSTS.CELL};a.prototype.nameop=function(a,c,f){if((c===Sk.astnodes.Store||c===Sk.astnodes.AugStore||c===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 d=e(this.u.private_,
a).v;d=b(d);var g=3;var h=this.u.ste.getScope(d);var m=null;switch(h){case Sk.SYMTAB_CONSTS.FREE:m="$free";g=2;break;case Sk.SYMTAB_CONSTS.CELL:m="$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(h||"_"===a.v.charAt(1));a=d;this.u.ste.generator||this.u.ste.blockType!==
Sk.SYMTAB_CONSTS.FunctionBlock?d="$loc."+d:(0===g||3===g)&&this.u.localnames.push(d);switch(g){case 0:switch(c){case Sk.astnodes.Load:case Sk.astnodes.Param:return l("if (",d," === undefined) { throw new Sk.builtin.UnboundLocalError('local variable \\'",d,"\\' referenced before assignment'); }\n"),d;case Sk.astnodes.Store:l(d,"=",f,";");break;case Sk.astnodes.Del:l("delete ",d,";");break;default:Sk.asserts.fail("unhandled")}break;case 3:switch(c){case Sk.astnodes.Load:return this._gr("loadname",d,
"!==undefined?",d,":Sk.misceval.loadname('",a,"',$gbl);");case Sk.astnodes.Store:l(d,"=",f,";");break;case Sk.astnodes.Del:l("delete ",d,";");break;case Sk.astnodes.Param:return d;default:Sk.asserts.fail("unhandled")}break;case 1:switch(c){case Sk.astnodes.Load:return this._gr("loadgbl","Sk.misceval.loadname('",a,"',$gbl)");case Sk.astnodes.Store:l("$gbl.",a,"=",f,";");break;case Sk.astnodes.Del:l("delete $gbl.",a);break;default:Sk.asserts.fail("unhandled case in name op_global")}break;case 2:switch(c){case Sk.astnodes.Load:return m+
"."+a;case Sk.astnodes.Store:l(m,".",a,"=",f,";");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,b,e,f){var d=new c;d.ste=this.st.getStsForAst(b);d.name=a;d.firstlineno=e;d.canSuspend=f||!1;this.u&&this.u.private_&&(d.private_=this.u.private_);this.stack.push(this.u);this.allUnits.push(d);a=this.gensym("scope");d.scopename=a;this.u=d;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);l(a.scopename,".co_name=new Sk.builtins['str']('",b,"');");this.stack.length&&"class"==this.u.ste.blockType&&l(a.scopename,".co_qualname=new Sk.builtins['str']('"+this.u.name.v+"."+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)l("$ret = Sk.misceval.print_(","new Sk.builtins['str'](",this.vexpr(a.values[b]),").v);"),this._checkSuspension(a);a.nl&&(l("$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);l("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,e,f){e=Sk.__future__;Sk.__future__=Object.create(Sk.__future__);var d=Sk.parse(c,b),g=Sk.astFromParse(d.cst,c,d.flags);d=d.flags;var h=Sk.symboltable(g,c);b=new a(c,h,d,f,b);c=b.cmod(g);Sk.__future__=e;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=b;Sk.exportSymbol("Sk.fixReserved",Sk.fixReserved);Sk.unfixReserved=function(a){return a.replace(/_\$rw\$$/,"")};Sk.exportSymbol("Sk.unfixReserved",Sk.unfixReserved);Sk.mangleName=e;Sk.exportSymbol("Sk.mangleName",Sk.mangleName);Sk.reservedWords_=h;Sk.exportSymbol("Sk.reservedWords_",Sk.reservedWords_)},function(m,q){Sk.sysmodules=new Sk.builtin.dict([]);Sk.realsyspath=void 0;Sk.importSearchPathForName=
function(a,c,b){var e=a.replace(/\./g,"/"),f=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===b&&(b=Sk.realsyspath);return Sk.misceval.iterFor(b.tp$iter(),function(a){return Sk.misceval.chain(f(a.v+"/"+e+c,!1),function(b){return b?b:f(a.v+"/"+e+"/__init__"+c,a.v+"/"+e)})})};Sk.importSetUpPath=function(a){if(!Sk.realsyspath){var c=[new Sk.builtin.str("src/builtin"),
new Sk.builtin.str("src/lib"),new Sk.builtin.str(".")];for(a=0;a<Sk.syspath.length;++a)c.push(new Sk.builtin.str(Sk.syspath[a]));Sk.realsyspath=new Sk.builtin.list(c)}};Sk.importModuleInternal_=function(a,c,b,e,f,l,h){var d,g,m,k,p=null,q=void 0!==f?f.tp$getattr(Sk.builtin.str.$name):void 0,A=void 0!==q?q.v+".":"",t=void 0!==f?f.tp$getattr(Sk.builtin.str.$path):void 0;Sk.importSetUpPath(h);if(f&&!q){if(l)return;throw new Sk.builtin.ValueError("Attempted to import relative to invalid package (no name)");
}void 0===b&&(b=A+a);var v=a.split(".");if(1<v.length){var B=v.slice(0,v.length-1).join(".");p=Sk.importModuleInternal_(B,c,void 0,void 0,f,l,h)}var D=Sk.misceval.chain(p,function(n){p=n;g=Sk.sysmodules.quick$lookup(new Sk.builtin.str(b));return void 0!==g?p||g:Sk.misceval.chain(void 0,function(){var b=a;if(1<v.length){if(!p)return;m=Sk.sysmodules.mp$subscript(new Sk.builtin.str(A+B));b=v[v.length-1];t=m.tp$getattr(Sk.builtin.str.$path)}k=new Sk.builtin.module;if("string"===typeof e){d=a+".py";var c=
Sk.compile(e,d,"exec",h)}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",t)},function(a){return a?{funcname:"$builtinmodule",code:a.code,filename:a.filename,packagePath:a.packagePath}:Sk.misceval.chain(Sk.importSearchPathForName(b,
".py",t),function(b){if(a=b)return Sk.compile(a.code,a.filename,"exec",h)},function(b){if(b)return b.packagePath=a.packagePath,b})});return c},function(a){if(a){Sk.sysmodules.mp$ass_subscript(new Sk.builtin.str(b),k);var e=k.$js=a.code;null==d&&(d=a.filename);null!=Sk.dateSet&&Sk.dateSet||(e="Sk.execStart = Sk.lastYield = new Date();\n"+a.code,Sk.dateSet=!0);if(c){var f=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")};e=f(e);Sk.debugout(e)}e+="\n"+a.funcname+";";e=Sk.global.eval(e);k.$d={__name__:new Sk.builtin.str(b),__doc__:Sk.builtin.none.none$,__package__:a.packagePath?new Sk.builtin.str(b):B?new Sk.builtin.str(A+B):q?q:Sk.builtin.none.none$};a.packagePath&&(k.$d.__path__=new Sk.builtin.tuple([new Sk.builtin.str(a.packagePath)]));return e(k.$d)}},function(b){var c;if(void 0===b){if(l&&!p)return;throw new Sk.builtin.ImportError("No module named "+a);}if(b!==k.$d){for(c in k.$d)b[c]||
(b[c]=k.$d[c]);k.$d=b}if(Sk.onAfterImport&&"function"===typeof Sk.onAfterImport)try{Sk.onAfterImport(a)}catch(V){}if(p)return m.tp$setattr(new Sk.builtin.str(v[v.length-1]),k),p;f&&f.tp$setattr(new Sk.builtin.str(a),k);return k})});return h?D:Sk.misceval.retryOptionalSuspensionOrThrow(D)};Sk.importModule=function(a,c,b){return Sk.importModuleInternal_(a,c,void 0,void 0,void 0,!1,b)};Sk.importMain=function(a,c,b){Sk.dateSet=!1;Sk.filesLoaded=!1;Sk.sysmodules=new Sk.builtin.dict([]);Sk.realsyspath=
void 0;Sk.resetCompiler();return Sk.importModuleInternal_(a,c,"__main__",void 0,void 0,!1,b)};Sk.importMainWithBody=function(a,c,b,e){Sk.dateSet=!1;Sk.filesLoaded=!1;Sk.sysmodules=new Sk.builtin.dict([]);Sk.realsyspath=void 0;Sk.resetCompiler();return Sk.importModuleInternal_(a,c,"__main__",b,void 0,!1,e)};Sk.importBuiltinWithBody=function(a,c,b,e){return Sk.importModuleInternal_(a,c,"__builtin__."+a,b,void 0,!1,e)};Sk.builtin.__import__=function(a,c,b,e,f){var l=Sk.globals,h;void 0===f&&(f=Sk.__future__.absolute_import?
0:-1);if(0!==f&&c.__package__&&c.__package__!==Sk.builtin.none.none$){if((h=c.__package__.v)&&0<f){c=h.split(".");if(f-1>=c.length)throw new Sk.builtin.ValueError("Attempted relative import beyond toplevel package");c.length-=f-1;h=c.join(".")}var d=Sk.sysmodules.quick$lookup(new Sk.builtin.str(h))}if(0<f&&void 0===d)throw new Sk.builtin.ValueError("Attempted relative import in non-package");a.split(".");return Sk.misceval.chain(void 0,function(){if(0!==f&&void 0!==d)return""===a?d:Sk.importModuleInternal_(a,
void 0,h+"."+a,void 0,d,-1==f,!0)},function(b){return void 0===b?(h=d=void 0,Sk.importModuleInternal_(a,void 0,void 0,void 0,void 0,!1,!0)):b},function(b){if(e&&0!==e.length){var c;var d=Sk.sysmodules.mp$subscript(new Sk.builtin.str((h||"")+(h&&a?".":"")+a));for(b=0;b<e.length;b++){var f=e[b];"*"!=f&&void 0===d.tp$getattr(new Sk.builtin.str(f))&&(c=Sk.misceval.chain(c,Sk.importModuleInternal_.bind(null,f,void 0,void 0,void 0,d,!0,!0)))}return Sk.misceval.chain(c,function(){Sk.asserts.assert(d);return d})}return b},
function(a){l!==Sk.globals&&(Sk.globals=l);return a})};Sk.importStar=function(a,c,b){if(b=a.tp$getattr(new Sk.builtin.str("__all__")))for(let e=Sk.abstr.iter(b),f=e.tp$iternext();void 0!==f;f=e.tp$iternext())c[f.v]=Sk.abstr.gattr(a,f);else{b=Object.getOwnPropertyNames(a.$d);for(let e in b)"_"!=b[e].charAt(0)&&(c[b[e]]=a.$d[b[e]])}};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,q){Sk.builtin.timSort=function(a,c){this.list=new Sk.builtin.list(a.v);this.MIN_GALLOP=7;this.listlength=c?c:a.sq$length()};Sk.builtin.timSort.prototype.lt=function(a,c){return Sk.misceval.richCompareBool(a,c,"Lt")};Sk.builtin.timSort.prototype.le=function(a,c){return!this.lt(c,a)};Sk.builtin.timSort.prototype.setitem=function(a,c){this.list.v[a]=c};Sk.builtin.timSort.prototype.binary_sort=
function(a,c){var b;for(b=a.base+c;b<a.base+a.len;b++){var e=a.base;var f=b;for(c=a.getitem(f);e<f;){var l=e+(f-e>>1);this.lt(c,a.getitem(l))?f=l:e=l+1}Sk.asserts.assert(e===f);for(l=b;l>e;l--)a.setitem(l,a.getitem(l-1));a.setitem(e,c)}};Sk.builtin.timSort.prototype.count_run=function(a){var c;if(1>=a.len){var b=a.len;var e=!1}else if(b=2,this.lt(a.getitem(a.base+1),a.getitem(a.base)))for(e=!0,c=a.base+2;c<a.base+a.len;c++)if(this.lt(a.getitem(c),a.getitem(c-1)))b++;else break;else for(e=!1,c=a.base+
2;c<a.base+a.len&&!this.lt(a.getitem(c),a.getitem(c-1));c++)b++;return{run:new Sk.builtin.listSlice(a.list,a.base,b),descending:e}};Sk.builtin.timSort.prototype.sort=function(){var a,c=new Sk.builtin.listSlice(this.list,0,this.listlength);if(!(2>c.len)){this.merge_init();for(a=this.merge_compute_minrun(c.len);0<c.len;){var b=this.count_run(c);b.descending&&b.run.reverse();if(b.run.len<a){var e=b.run.len;b.run.len=a<c.len?a:c.len;this.binary_sort(b.run,e)}c.advance(b.run.len);this.pending.push(b.run);
this.merge_collapse()}Sk.asserts.assert(c.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,c,b,e){var f;Sk.asserts.assert(0<=b&&b<c.len);var l=this;e=e?function(a,b){return l.le(a,b)}:function(a,b){return l.lt(a,b)};var h=c.base+b;var d=0;var g=1;if(e(c.getitem(h),a)){for(f=c.len-b;g<f;)if(e(c.getitem(h+g),
a)){d=g;try{g=(g<<1)+1}catch(n){g=f}}else break;g>f&&(g=f);d+=b;g+=b}else{for(f=b+1;g<f&&!e(c.getitem(h-g),a);){d=g;try{g=(g<<1)+1}catch(n){g=f}}g>f&&(g=f);h=b-d;d=b-g;g=h}Sk.asserts.assert(-1<=d<g<=c.len);for(d+=1;d<g;)b=d+(g-d>>1),e(c.getitem(c.base+b),a)?d=b+1:g=b;Sk.asserts.assert(d==g);return g};Sk.builtin.timSort.prototype.merge_init=function(){this.min_gallop=this.MIN_GALLOP;this.pending=[]};Sk.builtin.timSort.prototype.merge_lo=function(a,c){var b,e,f;Sk.asserts.assert(0<a.len&&0<c.len&&a.base+
a.len==c.base);var l=this.min_gallop;var h=a.base;a=a.copyitems();try{if(this.setitem(h,c.popleft()),h++,1!=a.len&&0!==c.len)for(;;){for(e=b=0;;)if(this.lt(c.getitem(c.base),a.getitem(a.base))){this.setitem(h,c.popleft());h++;if(0===c.len)return;e++;b=0;if(e>=l)break}else{this.setitem(h,a.popleft());h++;if(1==a.len)return;b++;e=0;if(b>=l)break}for(l+=1;;){this.min_gallop=l-=1<l;b=this.gallop(c.getitem(c.base),a,0,!0);for(f=a.base;f<a.base+b;f++)this.setitem(h,a.getitem(f)),h++;a.advance(b);if(1>=
a.len)return;this.setitem(h,c.popleft());h++;if(0===c.len)return;e=this.gallop(a.getitem(a.base),c,0,!1);for(f=c.base;f<c.base+e;f++)this.setitem(h,c.getitem(f)),h++;c.advance(e);if(0===c.len)return;this.setitem(h,a.popleft());h++;if(1==a.len)return;if(b<this.MIN_GALLOP&&e<this.MIN_GALLOP)break;l++;this.min_gallop=l}}}finally{Sk.asserts.assert(0<=a.len&&0<=c.len);for(f=c.base;f<c.base+c.len;f++)this.setitem(h,c.getitem(f)),h++;for(f=a.base;f<a.base+a.len;f++)this.setitem(h,a.getitem(f)),h++}};Sk.builtin.timSort.prototype.merge_hi=
function(a,c){var b,e,f;Sk.asserts.assert(0<a.len&&0<c.len&&a.base+a.len==c.base);var l=this.min_gallop;var h=c.base+c.len;c=c.copyitems();try{if(h--,this.setitem(h,a.popright()),0!==a.len&&1!=c.len)for(;;){for(e=b=0;;){var d=a.getitem(a.base+a.len-1);var g=c.getitem(c.base+c.len-1);if(this.lt(g,d)){h--;this.setitem(h,d);a.len--;if(0===a.len)return;b++;e=0;if(b>=l)break}else{h--;this.setitem(h,g);c.len--;if(1==c.len)return;e++;b=0;if(e>=l)break}}for(l+=1;;){this.min_gallop=l-=1<l;g=c.getitem(c.base+
c.len-1);var m=this.gallop(g,a,a.len-1,!0);b=a.len-m;for(f=a.base+a.len-1;f>a.base+m-1;f--)h--,this.setitem(h,a.getitem(f));a.len-=b;if(0===a.len)return;h--;this.setitem(h,c.popright());if(1==c.len)return;d=a.getitem(a.base+a.len-1);m=this.gallop(d,c,c.len-1,!1);e=c.len-m;for(f=c.base+c.len-1;f>c.base+m-1;f--)h--,this.setitem(h,c.getitem(f));c.len-=e;if(1>=c.len)return;h--;this.setitem(h,a.popright());if(0===a.len)return;if(b<this.MIN_GALLOP&&e<this.MIN_GALLOP)break;l++;this.min_gallop=l}}}finally{Sk.asserts.assert(0<=
a.len&&0<=c.len);for(f=a.base+a.len-1;f>a.base-1;f--)h--,this.setitem(h,a.getitem(f));for(f=c.base+c.len-1;f>c.base-1;f--)h--,this.setitem(h,c.getitem(f))}};Sk.builtin.timSort.prototype.merge_at=function(a){0>a&&(a=this.pending.length+a);var c=this.pending[a];var b=this.pending[a+1];Sk.asserts.assert(0<c.len&&0<b.len);Sk.asserts.assert(c.base+c.len==b.base);this.pending[a]=new Sk.builtin.listSlice(this.list,c.base,c.len+b.len);this.pending.splice(a+1,1);a=this.gallop(b.getitem(b.base),c,0,!0);c.advance(a);
0!==c.len&&(b.len=this.gallop(c.getitem(c.base+c.len-1),b,b.len-1,!1),0!==b.len&&(c.len<=b.len?this.merge_lo(c,b):this.merge_hi(c,b)))};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 c=0;64<=a;)c|=a&1,a>>=1;return a+c};Sk.builtin.listSlice=function(a,c,b){this.list=a;this.base=c;this.len=b};Sk.builtin.listSlice.prototype.copyitems=function(){var a=this.base,c=this.base+this.len;Sk.asserts.assert(0<=a<=c);return new Sk.builtin.listSlice(new Sk.builtin.list(this.list.v.slice(a,c)),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,c){this.list.v[a]=c};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,
c,b=this.list,e=this.base,f=e+this.len-1;e<f;)a=b.v[f],c=b.v[e],b.v[e]=a,b.v[f]=c,e++,f--};Sk.exportSymbol("Sk.builtin.listSlice",Sk.builtin.listSlice);Sk.exportSymbol("Sk.builtin.timSort",Sk.builtin.timSort)},function(m,q){Sk.builtin.super_=Sk.abstr.buildNativeClass("super",{constructor:function(a,c){Sk.asserts.assert(this instanceof Sk.builtin.super_,"bad call to super, use 'new'");this.type=a;this.obj=c;if(void 0!==a&&!Sk.builtin.checkClass(a))throw new Sk.builtin.TypeError("must be type, not "+
Sk.abstr.typeName(a));this.obj_type=void 0!==this.obj?this.$supercheck(a,this.obj):null},slots:{tp$doc:"super() -> same as super(__class__, <first argument>)\nsuper(type) -> unbound super object\nsuper(type, obj) -> bound super object; requires isinstance(obj, type)\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().meth(arg)\nThis works for class methods too:\nclass C(B):\n    @classmethod\n    def cmeth(cls, arg):\n        super().cmeth(arg)\n",
tp$new:Sk.generic.new,tp$init(a,c){Sk.abstr.checkNoKwargs("super",c);Sk.abstr.checkArgsLen("super",a,1,2);c=a[0];a=a[1];if(!Sk.builtin.checkClass(c))throw new Sk.builtin.TypeError("must be type, not "+Sk.abstr.typeName(c));this.obj=a;this.type=c;null!=this.obj&&(this.obj_type=this.$supercheck(c,this.obj))},$r(){return this.obj?new Sk.builtin.str("<super: <class '"+this.type.prototype.tp$name+"'>, <"+Sk.abstr.typeName(this.obj)+" object>>"):new Sk.builtin.str("<super: <class '"+this.type.prototype.tp$name+
"'>, NULL>")},tp$getattr(a,c){let b=this.obj_type;if(null==b)return Sk.generic.getAttr.call(this,a,c);var e=b.prototype.tp$mro;const f=e.length;if(a===Sk.builtin.str.$class)return Sk.generic.getAttr.call(this,a,c);let l;for(l=0;l+1<f&&this.type!==e[l];l++);l++;if(l>=f)return Sk.generic.getAttr.call(this,a,c);a=a.$mangled;let h;for(;l<f;){c=e[l].prototype;c.hasOwnProperty(a)&&(h=c[a]);if(void 0!==h)return e=h.tp$descr_get,void 0!==e&&(h=e.call(h,this.obj===b?null:this.obj,b)),h;l++}},tp$descr_get(a,
c){if(null===a||null!=this.obj)return this;if(this.ob$type!==Sk.builtin.super_)return Sk.misceval.callsimOrSuspendArray(this.ob$type,[this.type,a]);{c=this.$supercheck(this.type,a);const b=new Sk.builtin.super_;b.type=this.type;b.obj=a;b.obj_type=c;return b}}},getsets:{__thisclass__:{$get(){return this.type},$doc:"the class invoking super()"},__self__:{$get(){return this.obj||Sk.builtin.none.none$},$doc:"the instance invoking super(); may be None"},__self_class__:{$get(){return this.obj_type||Sk.builtin.none.none$},
$doc:"the type of the instance invoking super(); may be None"}},proto:{$supercheck(a,c){if(Sk.builtin.checkClass(c)&&c.$isSubType(a))return c;if(c.ob$type.$isSubType(a))return c.ob$type;{const b=c.tp$getattr(Sk.builtin.str.$class);if(void 0!==b&&b!==c.ob$type&&Sk.builtin.checkClass(b)&&b.$isSubType(a))return b}throw new Sk.builtin.TypeError("super(type, obj): obj must be an instance or subtype of type");}}})},function(m,q){Sk.builtins={round:null,len:null,min:null,max:null,sum:null,abs:null,fabs:null,
ord:null,chr:null,hex:null,oct:null,bin:null,dir:null,repr:null,open:null,isinstance:null,hash:null,getattr:null,hasattr:null,id:null,reduce:new Sk.builtin.func(Sk.builtin.reduce),sorted:null,any:null,all:null,enumerate:Sk.builtin.enumerate,filter:Sk.builtin.filter_,map:Sk.builtin.map_,range:Sk.builtin.range_,reversed:Sk.builtin.reversed,zip:Sk.builtin.zip_,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,LookupError:Sk.builtin.LookupError,KeyError:Sk.builtin.KeyError,TypeError:Sk.builtin.TypeError,UnicodeDecodeError:Sk.builtin.UnicodeDecodeError,UnicodeEncodeError:Sk.builtin.UnicodeEncodeError,NameError:Sk.builtin.NameError,IOError:Sk.builtin.IOError,NotImplementedError:Sk.builtin.NotImplementedError,
SystemExit:Sk.builtin.SystemExit,OverflowError:Sk.builtin.OverflowError,OperationError:Sk.builtin.OperationError,NegativePowerError:Sk.builtin.NegativePowerError,RuntimeError:Sk.builtin.RuntimeError,RecursionError:Sk.builtin.RecursionError,StopIteration:Sk.builtin.StopIteration,SyntaxError:Sk.builtin.SyntaxError,SystemError:Sk.builtin.SystemError,float_$rw$:Sk.builtin.float_,int_$rw$:Sk.builtin.int_,bool:Sk.builtin.bool,complex:Sk.builtin.complex,dict:Sk.builtin.dict,file:Sk.builtin.file,frozenset:Sk.builtin.frozenset,
"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:null,raw_input:new Sk.builtin.func(Sk.builtin.raw_input),setattr:null,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:null,divmod:null,format:null,
globals:null,issubclass:null,iter:null,execfile:Sk.builtin.execfile,help:Sk.builtin.help,memoryview:Sk.builtin.memoryview,reload:Sk.builtin.reload,super_$rw$:Sk.builtin.super_,unichr:Sk.builtin.unichr,vars:Sk.builtin.vars,apply_$rw$:Sk.builtin.apply_,buffer:Sk.builtin.buffer,coerce:Sk.builtin.coerce,intern:Sk.builtin.intern,property:Sk.builtin.property,classmethod:Sk.builtin.classmethod,staticmethod:Sk.builtin.staticmethod};Sk.abstr.setUpModuleMethods("builtins",Sk.builtins,{__import__:{$meth:Sk.builtin.__import__,
$flags:{NamedArgs:["name","globals","locals","fromlist","level"]},$textsig:null,$doc:"__import__(name, globals=None, locals=None, fromlist=(), level=0) -> module\n\nImport a module. Because this function is meant for use by the Python\ninterpreter and not for general use, it is better to use\nimportlib.import_module() to programmatically import a module.\n\nThe globals argument is only used to determine the context;\nthey are not modified.  The locals argument is unused.  The fromlist\nshould be a list of names to emulate ``from name import ...'', or an\nempty list to emulate ``import name''.\nWhen importing a module from a package, note that __import__('A.B', ...)\nreturns package A when fromlist is empty, but its submodule B when\nfromlist is not empty.  The level argument is used to determine whether to\nperform absolute or relative imports: 0 is absolute, while a positive number\nis the number of parent directories to search relative to the current module."},
abs:{$meth:Sk.builtin.abs,$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the absolute value of the argument."},all:{$meth:Sk.builtin.all,$flags:{OneArg:!0},$textsig:"($module, iterable, /)",$doc:"Return True if bool(x) is True for all values x in the iterable.\n\nIf the iterable is empty, return True."},any:{$meth:Sk.builtin.any,$flags:{OneArg:!0},$textsig:"($module, iterable, /)",$doc:"Return True if bool(x) is True for any x in the iterable.\n\nIf the iterable is empty, return False."},
ascii:{$meth:Sk.builtin.ascii,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return an ASCII-only representation of an object.\n\nAs repr(), return a string containing a printable representation of an\nobject, but escape the non-ASCII characters in the string returned by\nrepr() using \\\\x, \\\\u or \\\\U escapes. This generates a string similar\nto that returned by repr() in Python 2."},bin:{$meth:Sk.builtin.bin,$flags:{OneArg:!0},$textsig:"($module, number, /)",$doc:"Return the binary representation of an integer.\n\n   >>> bin(2796202)\n   '0b1010101010101010101010'"},
callable:{$meth:Sk.builtin.callable,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return whether the object is callable (i.e., some kind of function).\n\nNote that classes are callable, as are instances of classes with a\n__call__() method."},chr:{$meth:Sk.builtin.chr,$flags:{OneArg:!0},$textsig:"($module, i, /)",$doc:"Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff."},delattr:{$meth:Sk.builtin.delattr,$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, obj, name, /)",
$doc:"Deletes the named attribute from the given object.\n\ndelattr(x, 'y') is equivalent to ``del x.y''"},dir:{$meth:Sk.builtin.dir,$flags:{MinArgs:0,MaxArgs:1},$textsig:null,$doc:"dir([object]) -> list of strings\n\nIf called without an argument, return the names in the current scope.\nElse, return an alphabetized list of names comprising (some of) the attributes\nof the given object, and of attributes reachable from it.\nIf the object supplies a method named __dir__, it will be used; otherwise\nthe default dir() logic is used and returns:\n  for a module object: the module's attributes.\n  for a class object:  its attributes, and recursively the attributes\n    of its bases.\n  for any other object: its attributes, its class's attributes, and\n    recursively the attributes of its class's base classes."},
divmod:{$meth:Sk.builtin.divmod,$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, x, y, /)",$doc:"Return the tuple (x//y, x%y).  Invariant: div*y + mod == x."},eval_$rw$:{$name:"eval",$meth:Sk.builtin.eval_,$flags:{MinArgs:1,MaxArgs:3},$textsig:"($module, source, globals=None, locals=None, /)",$doc:"Evaluate the given source in the context of globals and locals.\n\nThe source may be a string representing a Python expression\nor a code object as returned by compile().\nThe globals must be a dictionary and locals can be any mapping,\ndefaulting to the current globals and locals.\nIf only globals is given, locals defaults to it."},
format:{$meth:Sk.builtin.format,$flags:{MinArgs:1,MaxArgs:2},$textsig:"($module, value, format_spec='', /)",$doc:"Return value.__format__(format_spec)\n\nformat_spec defaults to the empty string.\nSee the Format Specification Mini-Language section of help('FORMATTING') for\ndetails."},getattr:{$meth:Sk.builtin.getattr,$flags:{MinArgs:2,MaxArgs:3},$textsig:null,$doc:"getattr(object, name[, default]) -> value\n\nGet a named attribute from an object; getattr(x, 'y') is equivalent to x.y.\nWhen a default argument is given, it is returned when the attribute doesn't\nexist; without it, an exception is raised in that case."},
globals:{$meth:Sk.builtin.globals,$flags:{NoArgs:!0},$textsig:"($module, /)",$doc:"Return the dictionary containing the current scope's global variables.\n\nNOTE: Updates to this dictionary *will* affect name lookups in the current\nglobal scope and vice-versa."},hasattr:{$meth:Sk.builtin.hasattr,$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, obj, name, /)",$doc:"Return whether the object has an attribute with the given name.\n\nThis is done by calling getattr(obj, name) and catching AttributeError."},
hash:{$meth:Sk.builtin.hash,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return the hash value for the given object.\n\nTwo objects that compare equal must also have the same hash value, but the\nreverse is not necessarily true."},hex:{$meth:Sk.builtin.hex,$flags:{OneArg:!0},$textsig:"($module, number, /)",$doc:"Return the hexadecimal representation of an integer.\n\n   >>> hex(12648430)\n   '0xc0ffee'"},id:{$meth:Sk.builtin.id,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return the identity of an object.\n\nThis is guaranteed to be unique among simultaneously existing objects.\n(CPython uses the object's memory address.)"},
input:{$meth:Sk.builtin.input,$flags:{MinArgs:0,MaxArgs:1},$textsig:"($module, prompt=None, /)",$doc:"Read a string from standard input.  The trailing newline is stripped.\n\nThe prompt string, if given, is printed to standard output without a\ntrailing newline before reading input.\n\nIf the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.\nOn *nix systems, readline is used if available."},isinstance:{$meth:Sk.builtin.isinstance,$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, obj, class_or_tuple, /)",
$doc:"Return whether an object is an instance of a class or of a subclass thereof.\n\nA tuple, as in ``isinstance(x, (A, B, ...))``, may be given as the target to\ncheck against. This is equivalent to ``isinstance(x, A) or isinstance(x, B)\nor ...`` etc."},issubclass:{$meth:Sk.builtin.issubclass,$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, cls, class_or_tuple, /)",$doc:"Return whether 'cls' is a derived from another class or is the same class.\n\nA tuple, as in ``issubclass(x, (A, B, ...))``, may be given as the target to\ncheck against. This is equivalent to ``issubclass(x, A) or issubclass(x, B)\nor ...`` etc."},
iter:{$meth:Sk.builtin.iter,$flags:{MinArgs:1,MaxArgs:2},$textsig:"($module, iterable /)",$doc:"iter(iterable) -> iterator\niter(callable, sentinel) -> iterator\n\nGet an iterator from an object.  In the first form, the argument must\nsupply its own iterator, or be a sequence.\nIn the second form, the callable is called until it returns the sentinel."},len:{$meth:Sk.builtin.len,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return the number of items in a container."},locals:{$meth:Sk.builtin.locals,
$flags:{NoArgs:!0},$textsig:"($module, /)",$doc:"Return a dictionary containing the current scope's local variables.\n\nNOTE: Whether or not updates to this dictionary will affect name lookups in\nthe local scope and vice-versa is *implementation dependent* and not\ncovered by any backwards compatibility guarantees."},max:{$meth:Sk.builtin.max,$flags:{FastCall:!0},$textsig:null,$doc:"max(iterable, *[, default=obj, key=func]) -> value\nmax(arg1, arg2, *args, *[, key=func]) -> value\n\nWith a single iterable argument, return its biggest item. The\ndefault keyword-only argument specifies an object to return if\nthe provided iterable is empty.\nWith two or more arguments, return the largest argument."},
min:{$meth:Sk.builtin.min,$flags:{FastCall:!0},$textsig:null,$doc:"min(iterable, *[, default=obj, key=func]) -> value\nmin(arg1, arg2, *args, *[, key=func]) -> value\n\nWith a single iterable argument, return its smallest item. The\ndefault keyword-only argument specifies an object to return if\nthe provided iterable is empty.\nWith two or more arguments, return the smallest argument."},next:{$name:"next",$meth:Sk.builtin.next_,$flags:{MinArgs:1,MaxArgs:2},$textsig:null,$doc:"next(iterator[, default])\n\nReturn the next item from the iterator. If default is given and the iterator\nis exhausted, it is returned instead of raising StopIteration."},
oct:{$meth:Sk.builtin.oct,$flags:{OneArg:!0},$textsig:"($module, number, /)",$doc:"Return the octal representation of an integer.\n\n   >>> oct(342391)\n   '0o1234567'"},open:{$meth:Sk.builtin.open,$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"open(name[, mode[, buffering]]) -> file object\n\nOpen a file using the file() type, returns a file object.  This is the\npreferred way to open a file.  See file.__doc__ for further information."},ord:{$meth:Sk.builtin.ord,$flags:{OneArg:!0},$textsig:"($module, c, /)",
$doc:"Return the Unicode code point for a one-character string."},pow:{$meth:Sk.builtin.pow,$flags:{MinArgs:2,MaxArgs:3},$textsig:"($module, x, y, z=None, /)",$doc:"Equivalent to x**y (with two arguments) or x**y % z (with three arguments)\n\nSome types, such as ints, are able to use a more efficient algorithm when\ninvoked using the three argument form."},print:{$meth:Sk.builtin.print,$flags:{FastCall:!0},$textsig:null,$doc:"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."},
repr:{$meth:Sk.builtin.repr,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return the canonical string representation of the object.\n\nFor many object types, including most builtins, eval(repr(obj)) == obj."},round:{$meth:Sk.builtin.round,$flags:{NamedArgs:["number","ndigits"]},$textsig:"($module, /, number, ndigits=None)",$doc:"Round a number to a given precision in decimal digits.\n\nThe return value is an integer if ndigits is omitted or None.  Otherwise\nthe return value has the same type as the number.  ndigits may be negative."},
setattr:{$meth:Sk.builtin.setattr,$flags:{MinArgs:3,MaxArgs:3},$textsig:"($module, obj, name, value, /)",$doc:"Sets the named attribute on the given object to the specified value.\n\nsetattr(x, 'y', v) is equivalent to ``x.y = v''"},sorted:{$meth:Sk.builtin.sorted,$flags:{NamedArgs:[null,"cmp","key","reverse"],Defaults:[Sk.builtin.none.none$,Sk.builtin.none.none$,Sk.builtin.bool.false$]},$textsig:"($module, iterable, /, *, key=None, reverse=False)",$doc:"Return a new list containing all items from the iterable in ascending order.\n\nA custom key function can be supplied to customize the sort order, and the\nreverse flag can be set to request the result in descending order."},
sum:{$meth:Sk.builtin.sum,$flags:{NamedArgs:[null,"start"],Defaults:[new Sk.builtin.int_(0)]},$textsig:"($module, iterable, /, start=0)",$doc:"Return the sum of a 'start' value (default: 0) plus an iterable of numbers\n\nWhen the iterable is empty, return the start value.\nThis function is intended specifically for use with numeric values and may\nreject non-numeric types."},vars:{$meth:Sk.builtin.vars,$flags:{MinArgs:0,MaxArgs:1},$textsig:null,$doc:"vars([object]) -> dictionary\n\nWithout arguments, equivalent to locals().\nWith an argument, equivalent to object.__dict__."}});
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.range=Sk.builtin.range_,delete Sk.builtins.xrange,delete Sk.builtins.StandardError,delete Sk.builtins.unicode,delete Sk.builtins.basestring,delete Sk.builtins.long_$rw$,Sk.builtin.int_.prototype.$r=function(){return new Sk.builtin.str(this.v.toString())},delete Sk.builtin.int_.prototype.tp$str,delete Sk.builtin.bool.prototype.tp$str,delete Sk.builtins.raw_input,
delete Sk.builtin.str.prototype.decode,Sk.builtins.bytes=Sk.builtin.bytes,Sk.builtins.ascii=new Sk.builtin.sk_method({$meth:Sk.builtin.ascii,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return an ASCII-only representation of an object.\n\nAs repr(), return a string containing a printable representation of an\nobject, but escape the non-ASCII characters in the string returned by\nrepr() using \\\\x, \\\\u or \\\\U escapes. This generates a string similar\nto that returned by repr() in Python 2."},
null,"builtins")):(Sk.builtins.range=new Sk.builtin.sk_method({$meth:Sk.builtin.range,$name:"range",$flags:{MinArgs:1,MaxArgs:3}},void 0,"builtins"),Sk.builtins.xrange=new Sk.builtin.sk_method({$meth:Sk.builtin.xrange,$name:"xrange",$flags:{MinArgs:1,MaxArgs:3}},null,"builtins"),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.StandardError=Sk.builtin.Exception,Sk.builtins.unicode=
Sk.builtin.str,Sk.builtins.basestring=Sk.builtin.str,Sk.builtins.long_$rw$=Sk.builtin.lng,Sk.builtin.int_.prototype.$r=function(){const a=this.v;return"number"===typeof a?new Sk.builtin.str(a.toString()):new Sk.builtin.str(a.toString()+"L")},Sk.builtin.int_.prototype.tp$str=function(){return new Sk.builtin.str(this.v.toString())},Sk.builtin.bool.prototype.tp$str=function(){return this.$r()},Sk.builtins.raw_input=new Sk.builtin.func(Sk.builtin.raw_input),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,q){Sk.builtin.str.$empty=new Sk.builtin.str("");Sk.builtin.str.$emptystr=Sk.builtin.str.$empty;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.$class=new Sk.builtin.str("__class__");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.$doc=new Sk.builtin.str("__doc__");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.$file=new Sk.builtin.str("__file__");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.$keys=new Sk.builtin.str("keys");Sk.builtin.str.$le=new Sk.builtin.str("__le__");Sk.builtin.str.$len=new Sk.builtin.str("__len__");
Sk.builtin.str.$length_hint=new Sk.builtin.str("__length_hint__");Sk.builtin.str.$loader=new Sk.builtin.str("__loader__");Sk.builtin.str.$lt=new Sk.builtin.str("__lt__");Sk.builtin.str.$module=new Sk.builtin.str("__module__");Sk.builtin.str.$missing=new Sk.builtin.str("__missing__");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.$qualname=new Sk.builtin.str("__qualname__");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}}]);}).call(this || window)

//# sourceMappingURL=skulpt.min.js.map

/***/ }),

/***/ 12797:
/*!*****************************************************!*\
  !*** ./runestone/activecode/js/timed_activecode.js ***!
  \*****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "TimedLiveCode": () => (/* binding */ TimedLiveCode),
/* harmony export */   "TimedActiveCode": () => (/* binding */ TimedActiveCode),
/* harmony export */   "TimedJSActiveCode": () => (/* binding */ TimedJSActiveCode),
/* harmony export */   "TimedHTMLActiveCode": () => (/* binding */ TimedHTMLActiveCode),
/* harmony export */   "TimedSQLActiveCode": () => (/* binding */ TimedSQLActiveCode)
/* harmony export */ });
/* harmony import */ var _livecode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./livecode */ 45425);
/* harmony import */ var _activecode__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./activecode */ 750);
/* harmony import */ var _activecode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./activecode_js */ 40653);
/* harmony import */ var _activecode_html__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./activecode_html */ 15033);
/* harmony import */ var _activecode_sql__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./activecode_sql */ 23538);
/*
The TimedActivecode classes are a great example of where multiple inheritance would be useful
But since Javascript does not support multiple inheritance we use the mixin pattern.

*/






var TimedActiveCodeMixin = {
    timedInit: async function (opts) {
        this.isTimed = true;
        this.hideButtons();
        await this.addHistoryScrubber(true); // position last
        this.needsReinitialization = true; // the run button click listener needs to be reinitialized
        this.containerDiv.classList.add("timedComponent");
        window.edList[this.divid] = this;
        return true;
    },

    hideButtons: function () {
        var buttonList = [
            this.saveButton,
            this.loadButton,
            this.gradeButton,
            this.showHideButt,
            this.coachButton,
            this.atButton,
        ];
        for (var i = 0; i < buttonList.length; i++) {
            if (buttonList[i] !== undefined && buttonList[i] !== null)
                $(buttonList[i]).hide();
        }
    },

    // bje - not needed anymore
    renderTimedIcon: function (component) {
        // renders the clock icon on timed components.    The component parameter
        // is the element that the icon should be appended to.
        var timeIconDiv = document.createElement("div");
        var timeIcon = document.createElement("img");
        $(timeIcon).attr({
            src: "../_static/clock.png",
            style: "width:15px;height:15px",
        });
        timeIconDiv.className = "timeTip";
        timeIconDiv.title = "";
        timeIconDiv.appendChild(timeIcon);
        $(component).prepend(timeIconDiv);
    },

    checkCorrectTimed: function () {
        // pct_correct is set by the unittest/gui.py module in skulpt.
        // it relies on finding this object in the edList
        if (this.isAnswered) {
            if (this.pct_correct >= 100.0) {
                return "T";
            } else {
                return "F";
            }
        } else {
            return "I"; // we ignore this in the grading if no unittests
        }
    },

    hideFeedback: function () {
        $(this.output).css("visibility", "hidden");
    },

    reinitializeListeners: function (taken) {
        if (!this.runButton.onclick) {
            console.log("reattaching runbuttonhandler");
            this.runButton.onclick = this.runButtonHander.bind(this);
        }
        $(this.codeDiv).show();
        this.runButton.disabled = false;
        $(this.codeDiv).removeClass("ac-disabled");
        this.editor.refresh();
        $(this.histButton).click(this.addHistoryScrubber.bind(this));
        if (this.historyScrubber !== null) {
            $(this.historyScrubber).slider({
                max: this.history.length - 1,
                value: this.history.length - 1,
                slide: this.slideit.bind(this),
                change: this.slideit.bind(this),
            });
        }
        if (taken) {
            $(`#${this.divid}_unit_results`).show();
        }
    },
};

class TimedLiveCode extends _livecode__WEBPACK_IMPORTED_MODULE_0__.default {
    constructor(opts) {
        super(opts);
        this.timedInit(opts);
    }
}

Object.assign(TimedLiveCode.prototype, TimedActiveCodeMixin);

class TimedActiveCode extends _activecode__WEBPACK_IMPORTED_MODULE_1__.ActiveCode {
    constructor(opts) {
        super(opts);
        this.timedInitComplete = this.timedInit(opts);
    }

    // for timed exams we need to call runProg and tell it that there is
    // no GUI for sliders or other things.
    // the answers.
    async checkCurrentAnswer() {
        let noUI = true;
        const result = await this.timedInitComplete;
        if (this.isAnswered) {
            await this.runProg(noUI, false);
        }
    }
}

Object.assign(TimedActiveCode.prototype, TimedActiveCodeMixin);

class TimedJSActiveCode extends _activecode_js__WEBPACK_IMPORTED_MODULE_2__.default {
    constructor(opts) {
        super(opts);
        this.timedInit(opts);
    }
}
Object.assign(TimedJSActiveCode.prototype, TimedActiveCodeMixin);

class TimedHTMLActiveCode extends _activecode_html__WEBPACK_IMPORTED_MODULE_3__.default {
    constructor(opts) {
        super(opts);
        this.timedInit(opts);
    }
}
Object.assign(TimedHTMLActiveCode.prototype, TimedActiveCodeMixin);

class TimedSQLActiveCode extends _activecode_sql__WEBPACK_IMPORTED_MODULE_4__.default {
    constructor(opts) {
        super(opts);
        this.timedInit(opts);
    }
}
Object.assign(TimedSQLActiveCode.prototype, TimedActiveCodeMixin);


/***/ }),

/***/ 33194:
/*!*************************************************!*\
  !*** ./runestone/common/js/jquery.highlight.js ***!
  \*************************************************/
/***/ (() => {

/*

highlight v4

Highlights arbitrary terms.

<http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html>

MIT license.

Johann Burkard
<http://johannburkard.de>
<mailto:jb@eaio.com>

*/

jQuery.fn.highlight = function(pat) {
 function innerHighlight(node, pat) {
  var skip = 0;
  if (node.nodeType == 3) {
   var pos = node.data.toUpperCase().indexOf(pat);
   if (pos >= 0) {
    var spannode = document.createElement('span');
    spannode.className = 'highlight';
    var middlebit = node.splitText(pos);
    var endbit = middlebit.splitText(pat.length);
    var middleclone = middlebit.cloneNode(true);
    spannode.appendChild(middleclone);
    middlebit.parentNode.replaceChild(spannode, middlebit);
    skip = 1;
   }
  }
  else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
   for (var i = 0; i < node.childNodes.length; ++i) {
    i += innerHighlight(node.childNodes[i], pat);
   }
  }
  return skip;
 }
 return this.length && pat && pat.length ? this.each(function() {
  innerHighlight(this, pat.toUpperCase());
 }) : this;
};

jQuery.fn.removeHighlight = function() {
 return this.find("span.highlight").each(function() {
  this.parentNode.firstChild.nodeName;
  with (this.parentNode) {
   replaceChild(this.firstChild, this);
   normalize();
  }
 }).end();
};


/***/ }),

/***/ 63906:
/*!************************!*\
  !*** crypto (ignored) ***!
  \************************/
/***/ (() => {

/* (ignored) */

/***/ }),

/***/ 12993:
/*!********************!*\
  !*** fs (ignored) ***!
  \********************/
/***/ (() => {

/* (ignored) */

/***/ }),

/***/ 78352:
/*!****************************!*\
  !*** node-fetch (ignored) ***!
  \****************************/
/***/ (() => {

/* (ignored) */

/***/ }),

/***/ 1386:
/*!**********************!*\
  !*** path (ignored) ***!
  \**********************/
/***/ (() => {

/* (ignored) */

/***/ })

}]);
//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 2004720 characters]