|
|
var __BRYTHON__=__BRYTHON__||{};!function(e){var t;e.isWebWorker="undefined"!=typeof WorkerGlobalScope&&"function"==typeof importScripts&&navigator instanceof WorkerNavigator,e.isNode="undefined"!=typeof process&&"node"===process.release.name;var r,n=(t=e.isNode?{location:{href:"",origin:"",pathname:""},navigator:{userLanguage:""}}:self).location.href;if(e.protocol=n.split(":")[0],void 0===e.brython_path){var s;if(e.isWebWorker)(s=t.location.href).startsWith("blob:")&&(s=s.substr(5));else{var a=document.getElementsByTagName("script");s=a[a.length-1].src}var i=s.split("/");i.pop(),r=e.brython_path=i.join("/")+"/"}else e.brython_path.endsWith("/")||(e.brython_path+="/"),r=e.brython_path;var o=(t.location.origin+t.location.pathname).split("/");o.pop();var _=e.script_dir=o.join("/");if(e.__ARGV=[],e.webworkers={},e.$py_module_path={},e.file_cache={},e.$py_src={},e.path=[r+"Lib",r+"libs",_,r+"Lib/site-packages"],e.async_enabled=!1,e.async_enabled&&(e.block={}),e.imported={},e.precompiled={},e.frames_stack=[],e.builtins={},e.builtins_scope={id:"__builtins__",module:"__builtins__",binding:{}},e.builtin_funcs={},e.builtin_classes=[],e.__getattr__=function(e){return this[e]},e.__setattr__=function(t,r){if(!(["debug","stdout","stderr"].indexOf(t)>-1))throw e.builtins.AttributeError.$factory("__BRYTHON__ object has no attribute "+t);e[t]=r},e.language=t.navigator.userLanguage||t.navigator.language,e.locale="C",e.isWebWorker?e.charset="utf-8":e.charset=document.characterSet||document.inputEncoding||"utf-8",e.max_int=Math.pow(2,53)-1,e.min_int=-e.max_int,e.$py_next_hash=Math.pow(2,53)-1,e.$py_UUID=0,e.lambda_magic=Math.random().toString(36).substr(2,8),e.set_func_names=function(t,r){if(t.$infos){var n=t.$infos.__name__;t.$infos.__module__=r,t.$infos.__qualname__=n}else{n=t.__name__;console.log("bizarre",t),t.$infos={__name__:n,__module__:r,__qualname__:n}}for(var s in t.__module__=r,t)"function"==typeof t[s]&&(t[s].$infos={__doc__:t[s].__doc__||"",__module__:r,__qualname__:n+"."+s,__name__:s},"classmethod"==t[s].$type&&(t[s].__class__=e.method))},"undefined"!=typeof Storage){e.has_local_storage=!1;try{localStorage&&(e.local_storage=localStorage,e.has_local_storage=!0)}catch(e){}e.has_session_storage=!1;try{sessionStorage&&(e.session_storage=sessionStorage,e.has_session_storage=!0)}catch(e){}}else e.has_local_storage=!1,e.has_session_storage=!1;e.globals=function(){return e.frames_stack[e.frames_stack.length-1][3]},e.scripts={},e.$options={},e.update_VFS=function(t){e.VFS=e.VFS||{};var r=t.$timestamp;for(var n in void 0!==r&&delete t.$timestamp,t)e.VFS.hasOwnProperty(n)&&console.warn("Virtual File System: duplicate entry "+n),e.VFS[n]=t[n],e.VFS[n].timestamp=r},e.add_files=function(t){for(var r in e.files=e.files||{},t)e.files[r]=t[r]},e.python_to_js=function(t,r){e.meta_path=e.$meta_path.slice(),e.use_VFS||e.meta_path.shift(),void 0===r&&(r="__main__");var n=__BRYTHON__.py2js(t,r,r).to_js();return n="(function() {\n var $locals_"+r+" = {}\n"+n+"\n}())"},t.py=function(t){var r=e.py2js(t[0],"script","script").to_js();e.set_import_paths(),new Function("$locals_script",r)({})}}(__BRYTHON__),__BRYTHON__.implementation=[3,8,9,"dev",0],__BRYTHON__.__MAGIC__="3.8.9",__BRYTHON__.version_info=[3,8,0,"final",0],__BRYTHON__.compiled_date="2020-05-17 18:04:24.130207",__BRYTHON__.timestamp=1589731464130,__BRYTHON__.builtin_module_names=["_aio","_ajax","_base64","_binascii","_io_classes","_jsre","_locale","_multiprocessing","_posixsubprocess","_profile","_sre_utils","_string","_strptime","_svg","_warnings","_webcomponent","_webworker","_zlib_utils","array","builtins","dis","hashlib","long_int","marshal","math","math1","math_kozh","modulefinder","posix","random","unicodedata"],function($B){var js,$pos,res,$op;Number.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},Number.isSafeInteger=Number.isSafeInteger||function(e){return Number.isInteger(e)&&Math.abs(e)<=Number.MAX_SAFE_INTEGER};var _b_=$B.builtins,_window;_window=$B.isNode?{location:{href:"",origin:"",pathname:""}}:self,$B.parser={};var clone=$B.clone=function(e){var t={};for(var r in e)t[r]=e[r];return t};$B.last=function(e){return e[e.length-1]},$B.list2obj=function(e,t){var r={},n=e.length;for(void 0===t&&(t=!0);n-- >0;)r[e[n]]=t;return r},$B.op2method={operations:{"**":"pow","//":"floordiv","<<":"lshift",">>":"rshift","+":"add","-":"sub","*":"mul","/":"truediv","%":"mod","@":"matmul"},augmented_assigns:{"//=":"ifloordiv",">>=":"irshift","<<=":"ilshift","**=":"ipow","+=":"iadd","-=":"isub","*=":"imul","/=":"itruediv","%=":"imod","&=":"iand","|=":"ior","^=":"ixor","@=":"imatmul"},binary:{"&":"and","|":"or","~":"invert","^":"xor"},comparisons:{"<":"lt",">":"gt","<=":"le",">=":"ge","==":"eq","!=":"ne"},boolean:{or:"or",and:"and",in:"in",not:"not",is:"is",not_in:"not_in",is_not:"is_not"},subset:function(){var e={},t=[];if("all"==arguments[0])(t=Object.keys($B.op2method)).splice(t.indexOf("subset"),1);else for(var r=0,n=arguments.length;r<n;r++)t.push(arguments[r]);for(r=0,n=t.length;r<n;r++){var s=t[r],a=$B.op2method[s];if(void 0===a)throw Error(s);for(var i in a)e[i]=a[i]}return e}};var $operators=$B.op2method.subset("all"),$augmented_assigns=$B.augmented_assigns=$B.op2method.augmented_assigns,noassign=$B.list2obj(["True","False","None","__debug__"]),$op_order=[["or"],["and"],["not"],["in","not_in"],["<","<=",">",">=","!=","==","is","is_not"],["|"],["^"],["&"],[">>","<<"],["+"],["-"],["*","@","/","//","%"],["unary_neg","unary_inv","unary_pos"],["**"]],$op_weight={},$weight=1;$op_order.forEach(function(e){e.forEach(function(e){$op_weight[e]=$weight}),$weight++});var $loop_num=0,create_temp_name=$B.parser.create_temp_name=function(e){return(e||"$temp")+$loop_num++},replace_node=$B.parser.replace_node=function(e,t){var r=e.parent,n=get_rank_in_parent(e);r.children[n]=t,t.parent=r,t.bindings=e.bindings},get_rank_in_parent=$B.parser.get_rank_in_parent=function(e){return e.parent.children.indexOf(e)},add_identnode=$B.parser.add_identnode=function(e,t,r,n){var s=new $Node;s.parent=e,s.locals=e.locals,s.module=e.module;var a=new $NodeCtx(s),i=new $ExprCtx(a,"id",!0),o=(new $IdCtx(i,r),new $AssignCtx(i));return-1===t?e.add(s):e.insert(t,s),o.tree[1]=n,s},$add_yield_from_code=$B.parser.$add_yield_from_code=function(e){var t=$get_node(e),r=$get_scope(e).C.tree[0];t.yield_atoms.splice(t.yield_atoms.indexOf(this),1),r.yields.splice(r.yields.indexOf(this),1);var n=" ".repeat(t.indent),s=n+"import sys\n"+n+"try:\n"+n+" _y = next(_i)\n"+n+"except StopIteration as _e:\n"+n+" _r = _e.value\n"+n+"else:\n"+n+" while 1:\n"+n+" try:\n"+n+" _s = yield _y\n"+n+" except GeneratorExit as _e:\n"+n+" try:\n"+n+" _m = _i.close\n"+n+" except AttributeError:\n"+n+" pass\n"+n+" else:\n"+n+" _m()\n"+n+" raise _e\n"+n+" except BaseException as _e:\n"+n+" _x = sys.exc_info()\n"+n+" try:\n"+n+" _m = _i.throw\n"+n+" except AttributeError:\n"+n+" raise _e\n"+n+" else:\n"+n+" try:\n"+n+" _y = _m(*_x)\n"+n+" except StopIteration as _e:\n"+n+" _r = _e.value\n"+n+" break\n"+n+" else:\n"+n+" try:\n"+n+" if _s is None:\n"+n+" _y = next(_i)\n"+n+" else:\n"+n+" _y = _i.send(_s)\n"+n+" except StopIteration as _e:\n"+n+" _r = _e.value\n"+n+" break\n",a={_i:create_temp_name("__i"),_y:create_temp_name("__y"),_r:create_temp_name("__r"),_e:create_temp_name("__e"),_s:create_temp_name("__s"),_m:create_temp_name("__m")};for(attr in t.bindings=t.bindings||{},a)s=s.replace(new RegExp("\\b"+attr+"\\b","g"),a[attr]),t.bindings[a[attr]]=!0;$tokenize(t,s);var i={iter_name:a._i,result_var_name:a._r,yield_expr:e};"assign"===e.parent.type&&(i.save_result=!0,i.assign_ctx=e.parent,i.save_result_rank=t.parent.children.length-t.parent.children.indexOf(t));var o=new $YieldFromMarkerNode(i);replace_node(t,o)},chained_comp_num=0,$_SyntaxError=$B.parser.$_SyntaxError=function(e,t,r){for(var n=e;"node"!==n.type;)n=n.parent;for(var s=n.node,a=s;void 0!==a.parent;)a=a.parent;var i=s.module,o=a.src,_=s.line_num;if(o&&(_=o.substr(0,$pos).split("\n").length),a.line_info&&(_=a.line_info),void 0!==r&&"number"==typeof r)throw $B.$IndentationError(i,t,o,$pos,_,a);Array.isArray(t)&&$B.$SyntaxError(i,t[0],o,$pos,_,a),"Triple string end not found"===t&&$B.$SyntaxError(i,"invalid syntax : triple string end not found",o,$pos,_,a);var l="invalid syntax";t.startsWith("token ")||(l+=" ("+t+")"),$B.$SyntaxError(i,l,o,$pos,_,a)};function check_assignment(e){for(var t=e,r=["assert","del","import","raise","return"];t;)r.indexOf(t.type)>-1?$_SyntaxError(e,"invalid syntax - assign"):"expr"==t.type&&"op"==t.tree[0].type&&(void 0!==$B.op2method.comparisons[t.tree[0].op]?$_SyntaxError(e,["cannot assign to comparison"]):$_SyntaxError(e,["cannot assign to operator"])),t=t.parent}var $Node=$B.parser.$Node=function(e){this.type=e,this.children=[],this.yield_atoms=[],this.add=function(e){this.children[this.children.length]=e,e.parent=this,e.module=this.module},this.insert=function(e,t){this.children.splice(e,0,t),t.parent=this,t.module=this.module},this.toString=function(){return"<object 'Node'>"},this.show=function(e){var t="";return"module"===this.type?(this.children.forEach(function(r){t+=r.show(e)}),t):(t+=" ".repeat(e=e||0),t+=this.C,this.children.length>0&&(t+="{"),t+="\n",this.children.forEach(function(r){t+="["+i+"] "+r.show(e+4)}),this.children.length>0&&(t+=" ".repeat(e),t+="}\n"),t)},this.to_js=function(e){if(void 0!==this.js)return this.js;if(this.res=[],this.unbound=[],"module"===this.type)return this.children.forEach(function(e){this.res.push(e.to_js())},this),this.js=this.res.join(""),this.js;e=e||0;var t=this.C.to_js();return t&&(this.res.push(" ".repeat(e)),this.res.push(t),this.children.length>0&&this.res.push("{"),this.res.push("\n"),this.children.forEach(function(t){this.res.push(t.to_js(e+4))},this),this.children.length>0&&(this.res.push(" ".repeat(e)),this.res.push("}\n"))),this.js=this.res.join(""),this.js},this.transform=function(e){if(this.yield_atoms.length>0){if(this.C&&this.C.tree&&"condition"==this.C.tree[0].type&&"while"==this.C.tree[0].token){!0;var t=this.C.tree[0].tree.pop();new $RawJSCtx(this.C.tree[0],"true");var r=new $Node,n=new $NodeCtx(r),s=new $ConditionCtx(n,"if");return new $NotCtx(s).tree=[t],r.yield_atoms=this.yield_atoms.slice(),this.insert(0,r),r.add(new $NodeJS('locals["no_break'+$loop_num+'"] = true')),this.yield_atoms=[],0}this.parent.children.splice(e,1);var a=0;return this.yield_atoms.forEach(function(t){var r=new $Node,n=$loop_num,s="$yield_value"+n,i="var "+s;i+=" = "+(t.to_js()||"None"),new $NodeJSCtx(r,i),this.parent.insert(e+a,r);var o=new $Node;this.parent.insert(e+a+1,o);var _=new $YieldCtx(new $NodeCtx(o));new $StringCtx(_,s);var l,c=new $Node;c.line_num=this.line_num,c.indent=this.indent,c.is_set_yield_value=!0,c.after_yield=!0,new $NodeJSCtx(c,i=n),this.parent.insert(e+a+2,c),t.to_js=(l=n,function(){return"$yield_value"+l}),$loop_num++,a+=3},this),this.parent.insert(e+a,this),this.yield_atoms=[],a}if("module"!==this.type){var i,o=this.C.tree[0];void 0===o&&console.log(this),void 0!==o.transform&&(i=o.transform(this,e));for(b=0;b<this.children.length;){void 0===(a=this.children[b].transform(b))&&(a=1),b+=a}if(void 0===i&&(i=1),this.C&&void 0!==this.C.tree&&"generator"==this.C.tree[0].type){for(var _=this.C.tree[0],l=[],c=this.parent_block,u=c.is_comp;;){var f=c.id.replace(/\./g,"_"),p='"$locals_'+f+'": ';if(p+=u?"$B.clone($locals_"+f+")":"$locals_"+f,l.push(p),void 0===(c=c.parent_block)||"__builtins__"==c.id)break}l="{"+l+"}";for(var d=this.parent;void 0!==d&&void 0===d.id;)d=d.parent;var h=$B.$BRgenerator(_.name,l,_.id,this),$=d.id.replace(/\./g,"_"),m=(_.decorated?_.alias:(_.name,_.num),"var "+_.name+_.num+" = $locals_"+$+'["'+_.name+'"] = $B.genfunc("'+_.name+'", '+_.async+", "+l+",["+h+"],"+_.default_str+")");(r=$NodeJS(m)).bindings=this.bindings,this.parent.children.splice(e,1),this.parent.insert(e+a-1,r)}return i}this.__doc__=$get_docstring(this);for(var b=0;b<this.children.length;){void 0===(a=this.children[b].transform(b))&&(a=1),b+=a}},this.clone=function(){var e=new $Node(this.type);for(var t in this)e[t]=this[t];return e},this.clone_tree=function(){var e=new $Node(this.type);for(var t in this)e[t]=this[t];e.children=[];for(var r=0,n=this.children.length;r<n;r++)e.add(this.children[r].clone_tree());return e}},$YieldFromMarkerNode=$B.parser.$YieldFromMarkerNode=function(e){$Node.apply(this,["marker"]),new $NodeCtx(this),this.params=e,this.tree,this.transform=function(t){if(add_identnode(this.parent,t,e.iter_name,new $JSCode("$B.$iter("+e.yield_expr.tree[0].to_js()+")")),e.save_result){var r=e.assign_ctx;r.tree.pop();var n=new $ExprCtx(r,"id",!0);new $IdCtx(n,e.result_var_name);r.tree[1]=n;var s=new $Node;s.C=r,r.node=s;var a=e.save_result_rank+t+1;this.parent.insert(a,s),r.transform(s,a)}return 2}},$MarkerNode=$B.parser.$MarkerNode=function(e){$Node.apply(this,["marker"]),new $NodeCtx(this),this._name=e,this.transform=function(e){return 1},this.to_js=function(){return""}},$AbstractExprCtx=$B.parser.$AbstractExprCtx=function(e,t){this.type="abstract_expr",this.with_commas=t,this.parent=e,this.tree=[],e.tree[e.tree.length]=this,this.toString=function(){return"(abstract_expr "+t+") "+this.tree},this.transition=function(e,t){var r=this,n=r.packed,s=r.is_await,a=r.assign;if(!a)switch(e){case"id":case"imaginary":case"int":case"float":case"str":case"bytes":case"[":case"(":case"{":case".":case"not":case"lambda":case"yield":r.parent.tree.pop();var i=r.with_commas;(r=r.parent).packed=n,r.is_await=s,a&&(console.log("set assign to parent",r),r.assign=a)}switch(e){case"await":return new $AwaitCtx(r);case"id":return new $IdCtx(new $ExprCtx(r,"id",i),t);case"str":return new $StringCtx(new $ExprCtx(r,"str",i),t);case"bytes":return new $StringCtx(new $ExprCtx(r,"bytes",i),t);case"int":return new $NumberCtx("int",new $ExprCtx(r,"int",i),t);case"float":return new $NumberCtx("float",new $ExprCtx(r,"float",i),t);case"imaginary":return new $NumberCtx("imaginary",new $ExprCtx(r,"imaginary",i),t);case"(":return new $ListOrTupleCtx(new $ExprCtx(r,"tuple",i),"tuple");case"[":return new $ListOrTupleCtx(new $ExprCtx(r,"list",i),"list");case"{":return new $DictOrSetCtx(new $ExprCtx(r,"dict_or_set",i));case".":return new $EllipsisCtx(new $ExprCtx(r,"ellipsis",i));case"not":return"op"==r.type&&"is"==r.op?(r.op="is_not",r):new $NotCtx(new $ExprCtx(r,"not",i));case"lambda":return new $LambdaCtx(new $ExprCtx(r,"lambda",i));case"op":var o=t;switch(o){case"*":r.parent.tree.pop();i=r.with_commas;return r=r.parent,new $PackedCtx(new $ExprCtx(r,"expr",i));case"-":case"~":case"+":r.parent.tree.pop();var _=new $UnaryCtx(r.parent,o);if("-"==o)var l=new $OpCtx(_,"unary_neg");else if("+"==o)l=new $OpCtx(_,"unary_pos");else l=new $OpCtx(_,"unary_inv");return new $AbstractExprCtx(l,!1);case"not":r.parent.tree.pop();i=r.with_commas;return r=r.parent,new $NotCtx(new $ExprCtx(r,"not",i))}$_SyntaxError(r,"token "+e+" after "+r);case"=":$_SyntaxError(r,"token "+e+" after "+r);case"yield":return new $AbstractExprCtx(new $YieldCtx(r),!0);case":":return"sub"==r.parent.type||"list_or_tuple"==r.parent.type&&"sub"==r.parent.parent.type?new $AbstractExprCtx(new $SliceCtx(r.parent),!1):$transition(r.parent,e,t);case")":case",":switch(r.parent.type){case"slice":case"list_or_tuple":case"call_arg":case"op":case"yield":break;case"annotation":$_SyntaxError(r,"empty annotation");default:$_SyntaxError(r,e)}}return $transition(r.parent,e,t)},this.to_js=function(){return this.js_processed=!0,"list"===this.type?"["+$to_js(this.tree)+"]":$to_js(this.tree)}},$AliasCtx=$B.parser.$AliasCtx=function(e){this.type="ctx_manager_alias",this.parent=e,this.tree=[],e.tree[e.tree.length-1].alias=this,this.transition=function(e,t){var r=this;switch(e){case",":case":":return r.parent.set_alias(r.tree[0].tree[0]),$transition(r.parent,e,t)}$_SyntaxError(r,"token "+e+" after "+r)}},$AnnotationCtx=$B.parser.$AnnotationCtx=function(e){this.type="annotation",this.parent=e,this.tree=[],e.annotation=this;var t=$get_scope(e);if(void 0===t.binding.__annotations__&&(t.binding.__annotations__=!0,e.create_annotations=!0),"def"==t.ntype&&e.tree&&e.tree.length>0&&"id"==e.tree[0].type){var r=e.tree[0].value;t.globals&&t.globals.has(r)>-1&&$_SyntaxError(e,["annotated name '"+r+"' can't be global"]),t.annotations=t.annotations||new Set,t.annotations.add(r),e.$in_parens||(t.binding=t.binding||{},t.binding[r]=!0)}this.toString=function(){return"(annotation) "+this.tree},this.transition=function(e,t){var r=this;return"eol"==e&&1==r.tree.length&&0==r.tree[0].tree.length?$_SyntaxError(r,"empty annotation"):":"==e&&"def"!=r.parent.type?$_SyntaxError(r,"more than one annotation"):"augm_assign"==e?$_SyntaxError(r,"augmented assign as annotation"):"op"==e&&$_SyntaxError(r,"operator as annotation"),$transition(r.parent,e)},this.to_js=function(){return $to_js(this.tree)}},$AssertCtx=$B.parser.$AssertCtx=function(e){this.type="assert",this.parent=e,this.tree=[],e.tree[e.tree.length]=this,this.toString=function(){return"(assert) "+this.tree},this.transition=function(e,t){if("eol"==e)return $transition(this.parent,e);$_SyntaxError(this,e)},this.transform=function(e,t){if("list_or_tuple"==this.tree[0].type)var r=this.tree[0].tree[0],n=this.tree[0].tree[1];else r=this.tree[0],n=null;var s=new $ConditionCtx(e.C,"if");new $NotCtx(s).tree=[r],e.C=s;var a=new $Node,i='throw AssertionError.$factory("AssertionError")';null!==n&&(i="throw AssertionError.$factory(str.$factory("+n.to_js()+"))"),new $NodeJSCtx(a,i),e.add(a)}},$AssignCtx=$B.parser.$AssignCtx=function(e,t){check_assignment(e),"expr"==e.type&&"lambda"==e.tree[0].type&&$_SyntaxError(e,["cannot assign to lambda"]),this.type="assign","expression"==t&&(this.expression=!0,console.log("parent of assign expr",e.parent)),e.parent.tree.pop(),e.parent.tree[e.parent.tree.length]=this,this.parent=e.parent,this.tree=[e];var r=$get_scope(this);if("expr"==e.type&&"call"==e.tree[0].type)$_SyntaxError(e,["cannot assign to function call "]);else if("list_or_tuple"==e.type||"expr"==e.type&&"list_or_tuple"==e.tree[0].type)"expr"==e.type&&(e=e.tree[0]),e.bind_ids(r);else if("assign"==e.type)e.tree.forEach(function(e){var t=e.tree[0];"id"==t.type&&$bind(t.value,r,this)},this);else{var n=e.tree[0];if(n&&"id"==n.type)if(!0===noassign[n.value]&&$_SyntaxError(e,["cannot assign to keyword"]),n.bound=!0,r.globals&&r.globals.has(n.value)){var s=$get_module(e);$bind(n.value,s,this)}else{$get_node(this).bound_before=Object.keys(r.binding),$bind(n.value,r,this)}else["str","int","float","complex"].indexOf(n.type)>-1?$_SyntaxError(e,["cannot assign to literal"]):"unary"==n.type&&$_SyntaxError(e,["cannot assign to operator"])}this.guess_type=function(){},this.toString=function(){return"(assign) "+this.tree[0]+"="+this.tree[1]},this.transition=function(e,t){var r=this;if("eol"==e)return"abstract_expr"==r.tree[1].type&&$_SyntaxError(r,"token "+e+" after "+r),r.guess_type(),$transition(r.parent,"eol");$_SyntaxError(r,"token "+e+" after "+r)},this.transform=function(e,t){for(var r=$get_scope(this),n=this.tree[0],s=this.tree[1],a=[];"assign"==n.type;)a.push(n.tree[1]),n=n.tree[0];if(a.length>0){a.push(n);var i=e.C;i.tree=[];var o=new $RawJSCtx(i,"var $temp"+$loop_num);return o.tree=i.tree,new $AssignCtx(o).tree[1]=s,a.forEach(function(r){"expr"==r.type&&"list_or_tuple"==r.tree[0].type&&"tuple"==r.tree[0].real&&1==r.tree[0].tree.length&&(r=r.tree[0].tree[0]);var n=new $Node,s=new $NodeCtx(n);n.locals=e.locals,n.line_num=e.line_num,e.parent.insert(t+1,n),r.parent=s;var a=new $AssignCtx(r);new $RawJSCtx(a,"$temp"+$loop_num)}),$loop_num++,void(this.tree[0]=n)}var _=null;switch(n.type){case"expr":if(n.tree.length>1)_=n.tree;else if("list_or_tuple"==n.tree[0].type||"target_list"==n.tree[0].type)_=n.tree[0].tree;else if("id"==n.tree[0].type){var l=n.tree[0].value;r.globals&&r.globals.has(l)||(n.tree[0].bound=!0)}break;case"target_list":case"list_or_tuple":_=n.tree}s=this.tree[1];if(null!==_){var c=null;if(("list"==s.type||"tuple"==s.type||"expr"==s.type&&s.tree.length>1)&&(c=s.tree),null!==c){if(c.length>_.length)throw Error("ValueError : too many values to unpack (expected "+_.length+")");if(c.length<_.length)throw Error("ValueError : need more than "+c.length+" to unpack");var u=[],f=0;($=new $Node).line_num=e.line_num,new $NodeJSCtx($,"void(0)"),u[f++]=$;var p="$temp"+$loop_num;($=new $Node).line_num=e.line_num,new $NodeJSCtx($,"var "+p+" = [], $pos = 0"),u[f++]=$,c.forEach(function(t){var r=p+"[$pos++] = "+t.to_js(),n=new $Node;n.line_num=e.line_num,new $NodeJSCtx(n,r),u[f++]=n});var d=$get_node(this);_.forEach(function(t){var r=new $Node;r.id=d.module,r.locals=d.locals,r.line_num=e.line_num;var n=new $NodeCtx(r);t.parent=n,new $AssignCtx(t,!1).tree[1]=new $JSCode(p+"["+h+"]"),u[f++]=r},this),e.parent.children.splice(t,1);for(var h=u.length-1;h>=0;h--)e.parent.insert(t,u[h]);$loop_num++}else{e.parent.children.splice(t,1);var $,m=create_temp_name("$right"),b=create_temp_name("$rlist");($=$NodeJS("var "+m+" = $B.$getattr($B.$iter("+s.to_js()+'), "__next__");')).line_num=e.line_num,e.parent.insert(t++,$),e.parent.insert(t++,$NodeJS("var "+b+"=[], $pos=0;while(1){try{"+b+"[$pos++] = "+m+"()}catch(err){break}}"));var g=null,y=_.length;for(h=0;h<_.length;h++){var v=_[h];if("packed"==v.type||"expr"==v.type&&"packed"==v.tree[0].type){g=h,y--;break}}e.parent.insert(t++,$NodeJS("if("+b+".length<"+y+'){throw ValueError.$factory("need more than " +'+b+'.length + " value" + ('+b+'.length > 1 ? "s" : "") + " to unpack")}')),null==g&&e.parent.insert(t++,$NodeJS("if("+b+".length>"+y+'){throw ValueError.$factory("too many values to unpack (expected '+_.length+')")}')),_.forEach(function(n,s){var a=new $Node;a.id=r.id,a.line_num=e.line_num,e.parent.insert(t++,a);var i=new $NodeCtx(a);n.parent=i;var o=new $AssignCtx(n,!1),l=b;l+=null==g||s<g?"["+s+"]":s==g?".slice("+s+","+b+".length-"+(_.length-s-1)+")":"["+b+".length-"+(_.length-s)+"]",o.tree[1]=new $JSCode(l)}),$loop_num++}}else n.tree[0].bound&&"expr"==s.type&&"int"==s.name&&(e.bindings=e.bindings||{},e.bindings[n.tree[0].value]="int")},this.to_js=function(){if(this.js_processed=!0,"call"==this.parent.type)return'{$nat:"kw",name:'+this.tree[0].to_js()+",value:"+this.tree[1].to_js()+"}";for(var e=this.tree[0];"expr"==e.type;)e=e.tree[0];var t=this.tree[1];if("attribute"==e.type||"sub"==e.type){var r=t.to_js(),n="",s="",a="$temp"+$loop_num;if("expr"!=t.type||void 0===t.tree[0]||"call"!=t.tree[0].type||"eval"!=t.tree[0].func.value&&"exec"!=t.tree[0].func.value?"expr"==t.type&&void 0!==t.tree[0]&&"sub"==t.tree[0].type?(n+="var "+a+" = "+r+";\n",s=a):s=r:(n+="var "+a+" = "+r+";\n",s=a),"attribute"==e.type){$loop_num++,e.func="setattr";var i=e.to_js();return e.func="getattr",e.assign_self?n+i[0]+s+i[1]+s+")":(n=(n+=i).substr(0,n.length-1))+","+s+");None;"}if("sub"==e.type){var o,_=e.value.to_js(),l="$temp"+$loop_num;"id"==e.value.type&&(o=$get_node(this).locals[e.value.value]),$loop_num++;n="var "+l+" = "+_+"\n";return"list"!==o&&(n+="if(Array.isArray("+l+") && !"+l+".__class__){"),1==e.tree.length?n+="$B.set_list_key("+l+","+(e.tree[0].to_js()+""||"null")+","+t.to_js()+")":2==e.tree.length?n+="$B.set_list_slice("+l+","+(e.tree[0].to_js()+""||"null")+","+(e.tree[1].to_js()+""||"null")+","+t.to_js()+")":3==e.tree.length&&(n+="$B.set_list_slice_step("+l+","+(e.tree[0].to_js()+""||"null")+","+(e.tree[1].to_js()+""||"null")+","+(e.tree[2].to_js()+""||"null")+","+t.to_js()+")"),"list"==o?n:(n+="\n}else{",1==e.tree.length?n+="$B.$setitem("+e.value.to_js()+","+e.tree[0].to_js()+","+r+")};None;":(e.func="setitem",n=(n+=e.to_js()).substr(0,n.length-1),e.func="getitem",n+=","+r+")};None;"),n)}}return e.to_js()+" = "+t.to_js()}},$AsyncCtx=$B.parser.$AsyncCtx=function(e){this.type="async",this.parent=e,e.async=!0,this.toString=function(){return"(async)"},this.transition=function(e,t){var r=this;if("def"==e)return $transition(r.parent,e,t);if("for"==e||"with"==e){var n=$get_scope(r).ntype;"def"!==n&&"generator"!=n&&$_SyntaxError(r,["'async "+e+"' outside async function"]);var s=$transition(r.parent,e,t);return s.parent.async=!0,s}$_SyntaxError(r,"token "+e+" after "+r)}},$AttrCtx=$B.parser.$AttrCtx=function(e){this.type="attribute",this.value=e.tree[0],this.parent=e,e.tree.pop(),e.tree[e.tree.length]=this,this.tree=[],this.func="getattr",this.toString=function(){return"(attr) "+this.value+"."+this.name},this.transition=function(e,t){var r=this;if("id"===e){var n=t;return!0===noassign[n]&&$_SyntaxError(r,["cannot assign to "+n]),n=$mangle(n,r),r.name=n,r.parent}$_SyntaxError(r,e)},this.to_js=function(){this.js_processed=!0;var e=this.value.to_js();if("setattr"==this.func&&"id"==this.value.type){var t=$get_scope(this),r=t.parent;if("def"==t.ntype&&"class"==r.ntype){var n=t.C.tree[0].positional_list;if(this.value.value==n[0]&&r.C&&void 0===r.C.tree[0].args)return this.assign_self=!0,[e+".__class__ && "+e+".__dict__ && !"+e+".__class__.$has_setattr && ! "+e+".$is_class ? _b_.dict.$setitem("+e+".__dict__, '"+this.name+"', ",") : $B.$setattr("+e+', "'+this.name+'", ']}}return"setattr"==this.func?"$B.$setattr("+e+',"'+this.name+'")':"$B.$getattr("+e+',"'+this.name+'")'}},$AugmentedAssignCtx=$B.parser.$AugmentedAssignCtx=function(e,t){check_assignment(e),this.type="augm_assign",this.parent=e.parent,e.parent.tree.pop(),e.parent.tree[e.parent.tree.length]=this,this.op=t,this.tree=[e];var r=this.scope=$get_scope(this);if("expr"==e.type){var n=e.tree[0];if("id"==n.type){var s=n.value;!0===noassign[s]?$_SyntaxError(e,["cannot assign to keyword"]):"def"!=r.ntype&&"generator"!=r.ntype||void 0!==r.binding[s]||void 0!==r.globals&&r.globals.has(s)||(n.unbound=!0)}else["str","int","float","complex"].indexOf(n.type)>-1&&$_SyntaxError(e,["cannot assign to literal"])}$get_node(this).bound_before=Object.keys(r.binding),this.module=r.module,this.toString=function(){return"(augm assign) "+this.tree},this.transition=function(e,t){var r=this;if("eol"==e)return"abstract_expr"==r.tree[1].type&&$_SyntaxError(r,"token "+e+" after "+r),$transition(r.parent,"eol");$_SyntaxError(r,"token "+e+" after "+r)},this.transform=function(r,n){var s="__"+$operators[t]+"__",a=0,i=r.parent,o=r.line_num,_=!1;i.children.splice(n,1);var l="expr"==this.tree[0].type&&"id"==this.tree[0].tree[0].type;if(l){var c="int"==this.tree[0].tree[0].bindingType(this.scope);if(this.tree[0].tree[0].augm_assign=!0,$B.debug>0){var u=$NodeJS("if("+this.tree[0].to_js()+" === undefined){throw NameError.$factory(\"name '"+this.tree[0].tree[0].value+"' is not defined\")}");r.parent.insert(n,u),a++}var f=this.tree[0].tree[0].value,p=void 0!==this.scope.binding[f],d=this.tree[0].tree[0].unbound}var h="expr"==this.tree[1].type&&"int"==this.tree[1].tree[0].type,$=h?this.tree[1].tree[0].to_js():"$temp";if(!h){(k=new $Node).line_num=o,_=!0,new $NodeJSCtx(k,"var $temp,$left;"),i.insert(n,k),a++,(k=new $Node).id=this.scope.id;var m=new $NodeCtx(k),b=new $ExprCtx(m,"js",!1),g=new $RawJSCtx(b,"$temp"),y=new $AssignCtx(b);y.tree[1]=this.tree[1],g.parent=y,i.insert(n+a,k),a++}var v="",x=!1;switch(t){case"+=":case"-=":case"*=":case"/=":if(l){var w=this.scope,B="$local_"+w.module.replace(/\./g,"_");switch(w.ntype){case"module":v=B;break;case"def":case"generator":v=w.globals&&w.globals.has(e.tree[0].value)?B:"$locals";break;case"class":var k=new $Node;_||(k.line_num=o,_=!0),new $NodeJSCtx(k,"var $left = "+e.to_js()),i.insert(n+a,k),x=!0,a++}}}var j=e.tree[0].to_js();if("id"==e.tree[0].type){var E=e.tree[0].firstBindingScopeId(),N=e.tree[0].value;j=E?"$locals_"+E.replace(/\./g,"_")+'["'+N+'"]':'$locals["'+N+'"]'}if(c&&h)return i.insert(n+a,$NodeJS(j+" "+t+" "+$)),a++;v=v&&!e.tree[0].unknown_binding&&!d;var S=t.charAt(0);if(v){var C=x?"$left":j;k=new $Node;_||(k.line_num=o,_=!0),A=h?"if(":'if(typeof $temp.valueOf() == "number" && ',A+=C+".constructor === Number",A+=" && Number.isSafeInteger("+j+S+$+")){"+(h?"(":'(typeof $temp == "number" && ')+"typeof "+C+' == "number") ? ',A+=j+t+$,new $NodeJSCtx(k,A+=" : "+j+" = new Number("+j+S+(h?$:$+".valueOf()")+")}"),i.insert(n+a,k),a++}if("sub"==e.tree[0].type&&("+="==t||"-="==t||"*="==t)&&1==e.tree[0].tree.length){var O="$B.augm_item_"+{"+=":"add","-=":"sub","*=":"mul"}[t]+"("+e.tree[0].value.to_js()+","+e.tree[0].tree[0].to_js()+","+$+");None;";k=new $Node;return _||(k.line_num=o,_=!0),new $NodeJSCtx(k,O),i.insert(n+a,k),void a++}k=new $Node;_||(k.line_num=o,_=!0);var A="";v&&(A+="else "),A+="if(!hasattr("+e.to_js()+',"'+s+'"))',new $NodeJSCtx(k,A),i.insert(n+a,k),a++;var I=new $Node;I.id=this.scope.id,I.line_num=r.line_num,k.add(I);var T=new $NodeCtx(I),R=new $ExprCtx(T,"clone",!1);d?new $RawJSCtx(R,j):(R.tree=e.tree,R.tree.forEach(function(e){e.parent=R}));var F=new $AssignCtx(R),J=new $OpCtx(R,t.substr(0,t.length-1));J.parent=F,new $RawJSCtx(J,$),F.tree.push(J),R.parent.tree.pop(),R.parent.tree.push(F);var M=$NodeJS("else");i.insert(n+a,M);var L=new $Node;L.line_num=r.line_num,M.add(L);var D=new $NodeCtx(L),q=new $ExprCtx(D,"clone",!1);if(d){A=j;E||(A='$B.$local_search("'+N+'");'+j),new $RawJSCtx(q,A)}else q.tree=e.tree,q.tree.forEach(function(e){e.parent=q});var P=new $AssignCtx(q);return P.tree.push($NodeJS("$B.$getattr("+e.to_js()+',"'+s+'")('+$+")")),q.parent.tree.pop(),q.parent.tree.push(P),!l||p||this.scope.blurred||(this.scope.binding[f]=void 0),a},this.to_js=function(){return""}},$AwaitCtx=$B.parser.$AwaitCtx=function(e){this.type="await",this.parent=e,this.tree=[],e.tree.push(this);for(var t=e;t;)"list_or_tuple"==t.type&&(t.is_await=!0),t=t.parent;this.transition=function(e,t){return this.parent.is_await=!0,$transition(this.parent,e,t)},this.to_js=function(){return"await ($B.promise("+$to_js(this.tree)+"))"}},$BodyCtx=$B.parser.$BodyCtx=function(e){for(var t=e.parent;"node"!==t.type;)t=t.parent;var r=t.node,n=new $Node;return n.is_body_node=!0,n.line_num=r.line_num,r.insert(0,n),new $NodeCtx(n)},set_loop_context=$B.parser.set_loop_context=function(e,t){for(var r=e;"node"!==r.type;)r=r.parent;for(var n=r.node.parent,s=!1;;)if("module"==n.type)$_SyntaxError(e,t+" outside of a loop");else{var a=n.C.tree[0];if("condition"==a.type&&"while"==a.token){this.loop_ctx=a,a["has_"+t]=!0;break}switch(a.type){case"for":this.loop_ctx=a,a["has_"+t]=!0,s=!0;break;case"def":case"generator":case"class":$_SyntaxError(e,t+" outside of a loop");default:n=n.parent}if(s)break}},$BreakCtx=$B.parser.$BreakCtx=function(e){this.type="break",this.parent=e,e.tree[e.tree.length]=this,set_loop_context.apply(this,[e,"break"]),this.toString=function(){return"break "},this.transition=function(e,t){if("eol"==e)return $transition(this.parent,"eol");$_SyntaxError(this,e)},this.to_js=function(){this.js_processed=!0;var e=";$locals_"+$get_scope(this).id.replace(/\./g,"_")+'["$no_break'+this.loop_ctx.loop_num+'"] = false';return"asyncfor"!=this.loop_ctx.type?e+=";break":e+=";throw StopIteration.$factory("+this.loop_ctx.loop_num+")",e}},$CallArgCtx=$B.parser.$CallArgCtx=function(e){this.type="call_arg",this.parent=e,this.start=$pos,this.tree=[],e.tree.push(this),this.expect="id",this.toString=function(){return"call_arg "+this.tree},this.transition=function(e,t){var r=this;switch(e){case"await":case"id":case"imaginary":case"int":case"float":case"str":case"bytes":case"[":case"(":case"{":case".":case"not":case"lambda":if("id"==r.expect){r.expect=",";var n=new $AbstractExprCtx(r,!1);return $transition(n,e,t)}break;case"=":if(","==r.expect)return new $ExprCtx(new $KwArgCtx(r),"kw_value",!1);break;case"for":var s=new $ListOrTupleCtx(r,"gen_expr");s.vars=r.vars,s.locals=r.locals,s.intervals=[r.start],r.tree.pop(),s.expression=r.tree,r.tree=[s],s.tree=[];var a=new $ComprehensionCtx(s);return new $TargetListCtx(new $CompForCtx(a));case"op":if("id"==r.expect){var i=t;switch(r.expect=",",i){case"+":case"-":case"~":return $transition(new $AbstractExprCtx(r,!1),e,i);case"*":return new $StarArgCtx(r);case"**":return new $DoubleStarArgCtx(r)}}$_SyntaxError(r,"token "+e+" after "+r);case")":if(r.parent.kwargs&&$B.last(r.parent.tree).tree[0]&&-1==["kwarg","star_arg","double_star_arg"].indexOf($B.last(r.parent.tree).tree[0].type)&&$_SyntaxError(r,["non-keyword argument after keyword argument"]),r.tree.length>0){var o=r.tree[r.tree.length-1];"list_or_tuple"==o.type&&"gen_expr"==o.real&&o.intervals.push($pos)}return $transition(r.parent,e);case":":if(","==r.expect&&"lambda"==r.parent.parent.type)return $transition(r.parent.parent,e);break;case",":if(","==r.expect)return r.parent.kwargs&&-1==["kwarg","star_arg","double_star_arg"].indexOf($B.last(r.parent.tree).tree[0].type)&&$_SyntaxError(r,["non-keyword argument after keyword argument"]),$transition(r.parent,e,t)}$_SyntaxError(r,"token "+e+" after "+r)},this.to_js=function(){return this.js_processed=!0,$to_js(this.tree)}},$CallCtx=$B.parser.$CallCtx=function(e){this.type="call",this.func=e.tree[0],void 0!==this.func&&(this.func.parent=this),this.parent=e,"class"!=e.type?(e.tree.pop(),e.tree[e.tree.length]=this):e.args=this,this.expect="id",this.tree=[],this.start=$pos,this.toString=function(){return"(call) "+this.func+"("+this.tree+")"},this.func&&"attribute"==this.func.type&&"wait"==this.func.name&&"id"==this.func.value.type&&"time"==this.func.value.value&&(console.log("call",this.func),$get_node(this).blocking={type:"wait",call:this}),this.func&&"input"==this.func.value&&($get_node(this).blocking={type:"input"}),this.transition=function(e,t){var r=this;switch(e){case",":return"id"==r.expect&&$_SyntaxError(r,e),r.expect="id",r;case"await":case"id":case"imaginary":case"int":case"float":case"str":case"bytes":case"[":case"(":case"{":case".":case"not":case"lambda":return r.expect=",",$transition(new $CallArgCtx(r),e,t);case")":return r.end=$pos,r.parent;case"op":switch(r.expect=",",t){case"-":case"~":case"+":return r.expect=",",$transition(new $CallArgCtx(r),e,t);case"*":return r.has_star=!0,new $StarArgCtx(r);case"**":return r.has_dstar=!0,new $DoubleStarArgCtx(r)}$_SyntaxError(r,e)}return $transition(r.parent,e,t)},this.to_js=function(){this.js_processed=!0,this.tree.length>0&&0==this.tree[this.tree.length-1].tree.length&&this.tree.pop();var e=this.func.to_js();if(void 0!==this.func){switch(this.func.value){case"classmethod":return"classmethod.$factory("+$to_js(this.tree)+")";case"$$super":var t;if(0==this.tree.length)if("def"==(t=$get_scope(this)).ntype||"generator"==t.ntype){var r=$get_scope(t.C.tree[0]);"class"==r.ntype&&new $IdCtx(this,r.C.tree[0].name)}if(1==this.tree.length)if("def"==(t=$get_scope(this)).ntype||"generator"==t.ntype){var n=t.C.tree[0].args;if(n.length>0)new $IdCtx(this,n[0]).to_js=function(){return"[$locals['"+n[0]+"']]"}}break;default:if("unary"==this.func.type){var s="$B.$getattr("+$to_js(this.tree);switch(this.func.op){case"+":return s+',"__pos__")()';case"-":return s+',"__neg__")()';case"~":return s+',"__invert__")()'}}}var a,i=[],o=[],_=!1,l=[];if(this.tree.forEach(function(e){switch(e.type){case"star_arg":_=!0,i.push([e.tree[0].tree[0].to_js(),"*"]);break;case"double_star_arg":l.push(e.tree[0].tree[0].to_js());break;case"id":i.push([e.to_js(),"s"]);break;default:switch(e.tree[0].type){case"expr":i.push([e.to_js(),"s"]);break;case"kwarg":o.push(e.tree[0].tree[0].value+":"+e.tree[0].tree[1].to_js());break;case"list_or_tuple":case"op":i.push([e.to_js(),"s"]);break;case"star_arg":_=!0,i.push([e.tree[0].tree[0].to_js(),"*"]);break;case"double_star_arg":l.push(e.tree[0].tree[0].to_js());break;default:i.push([e.to_js(),"s"])}}}),_){for(var c=[],u=0,f=i.length;u<f;u++)if(arg=i[u],"*"==arg[1])c.push("_b_.list.$factory("+arg[0]+")");else{var p=[i[u][0]];for(u++;u<f&&"s"==i[u][1];)p.push(i[u][0]),u++;u--,c.push("["+p.join(",")+"]")}a=c[0];for(u=1;u<c.length;u++)a+=".concat("+c[u]+")"}else{for(u=0,f=i.length;u<f;u++)i[u]=i[u][0];a=i.join(", ")}var d="{"+o.join(", ")+"}";d=l.length?'{$nat:"kw",kw:['+d+","+l.join(", ")+"]}":"{}"!=d?'{$nat:"kw",kw:'+d+"}":"",_&&d?a+=".concat(["+d+"])":a&&d?a+=","+d:a||(a=d);var h="$B.$call("+e+")"+(a=_?".apply(null,"+a+")":"("+a+")");if(this.tree.length>-1&&"id"==this.func.type&&this.func.is_builtin){if(void 0!==$B.builtin_funcs[this.func.value])return-1==["complex","bytes","bytearray","object","memoryview","int","float","str","list","tuple","dict","set","frozenset","range","slice","zip","bool","type","classmethod","staticmethod","enumerate","reversed","property","$$super","zip","map","filter"].indexOf(this.func.value)?e+a:e+".$factory"+a}return h}}},$ClassCtx=$B.parser.$ClassCtx=function(e){this.type="class",this.parent=e,this.tree=[],e.tree[e.tree.length]=this,this.expect="id";var t=this.scope=$get_scope(this);this.parent.node.parent_block=t,this.parent.node.bound={},this.parent.node.binding={__annotations__:!0},this.toString=function(){return"(class) "+this.name+" "+this.tree+" args "+this.args},this.transition=function(e,t){var r=this;switch(e){case"id":if("id"==r.expect)return r.set_name(t),r.expect="(:",r;break;case"(":return new $CallCtx(r);case":":return $BodyCtx(r)}$_SyntaxError(r,"token "+e+" after "+r)},this.set_name=function(r){this.random=$B.UUID(),this.name=r,this.id=e.node.module+"_"+r+"_"+this.random,this.binding={},this.parent.node.id=this.id;for(var n=t;n.C&&"class"==n.C.tree[0].type;)n=n.parent;for(;n.C&&"def"!=n.C.tree[0].type&&"generator"!=n.C.tree[0].type;)n=n.parent;this.parent.node.parent_block=n,$bind(r,this.scope,this),t.is_function&&-1==t.C.tree[0].locals.indexOf(r)&&t.C.tree[0].locals.push(r)},this.transform=function(e,t){this.doc_string=$get_docstring(e),this.module=$get_module(this).module.replace(/\./g,"_");var r="\n"+" ".repeat(e.indent+12),n=new $Node,s="$locals_"+this.id.replace(/\./g,"_");new $NodeJSCtx(n,o="var "+s+" = {__annotations__: _b_.dict.$factory()}, "+r+"$locals = "+s+", "+r+'$local_name = "'+s+'"'),e.insert(0,n);for(var a=this.scope;"__builtins__"!==a.parent_block.id;)a=a.parent_block;var i="$locals_"+a.id.replace(/\./g,"_"),o=" ".repeat(e.indent+4)+'$locals.$name = "'+this.name+'"'+r+'$locals.$line_info = "'+e.line_num+","+this.module+'";'+r+'var $top_frame = [$local_name, $locals,"'+a.id+'", '+i+"]"+r+"$locals.$f_trace = $B.enter_frame($top_frame);"+r+"if($locals.$f_trace !== _b_.None){$locals.$f_trace = $B.trace_line()}";e.insert(1,$NodeJS(o)),e.add($NodeJS("if($locals.$f_trace !== _b_.None){$B.trace_return(_b_.None)}")),e.add($NodeJS("$B.leave_frame()"));var _=new $Node;new $NodeJSCtx(_,"return "+s+";"),e.insert(e.children.length,_);var l=new $Node;new $NodeJSCtx(l,")();"),e.parent.insert(t+1,l);var c="$locals_"+this.module+".__name__";t++,e.parent.insert(t+1,$NodeJS("$"+this.name+"_"+this.random+".__module__ = "+c));var u=$get_scope(this),f=";$locals_"+u.id.replace(/\./g,"_"),p=1;if((o=[(f+='["'+this.name+'"]')+' = $B.$class_constructor("'+this.name])[p++]='", $'+this.name+"_"+this.random,void 0!==this.args){var d=this.args.tree,h=[],$=[];d.forEach(function(e){"kwarg"==e.tree[0].type?$.push(e.tree[0]):h.push(e.to_js())}),o[p++]=",tuple.$factory(["+h.join(",")+"]),[";var m=new RegExp('"',"g"),b=[],g=0;h.forEach(function(e){b[g++]='"'+e.replace(m,'\\"')+'"'}),o[p++]=b.join(",")+"]",b=[],g=0,$.forEach(function(e){b[g++]='["'+e.tree[0].value+'",'+e.tree[1].to_js()+"]"}),o[p++]=",["+b.join(",")+"]"}else o[p++]=",tuple.$factory([]),[],[]";o[p++]=")";var y=new $Node;new $NodeJSCtx(y,o.join("")),t++,e.parent.insert(t+1,y),t++;var v=new $Node;if(o=f+".__doc__ = "+(this.doc_string||"None")+";",new $NodeJSCtx(v,o),e.parent.insert(t+1,v),"module"==u.ntype){var x=new $Node;new $NodeJSCtx(x,'$locals["'+this.name+'"] = '+this.name)}e.parent.insert(t+2,$NodeJS("None;")),this.transformed=!0},this.to_js=function(){return this.js_processed=!0,"var $"+this.name+"_"+this.random+" = (function()"}},$CompIfCtx=$B.parser.$CompIfCtx=function(e){this.type="comp_if",e.parent.intervals.push($pos),this.parent=e,this.tree=[],e.tree[e.tree.length]=this,this.toString=function(){return"(comp if) "+this.tree},this.transition=function(e,t){return $transition(this.parent,e,t)},this.to_js=function(){return this.js_processed=!0,$to_js(this.tree)}},$ComprehensionCtx=$B.parser.$ComprehensionCtx=function(e){this.type="comprehension",this.parent=e,this.tree=[],e.tree[e.tree.length]=this,this.toString=function(){return"(comprehension) "+this.tree},this.transition=function(e,t){var r=this;switch(e){case"if":return new $AbstractExprCtx(new $CompIfCtx(r),!1);case"for":return new $TargetListCtx(new $CompForCtx(r))}return $transition(r.parent,e,t)},this.to_js=function(){this.js_processed=!0;var e=[];return this.tree.forEach(function(t){e.push(t.start)}),e}},$CompForCtx=$B.parser.$CompForCtx=function(e){this.type="comp_for",e.parent.intervals.push($pos),this.parent=e,this.tree=[],this.expect="in",e.tree[e.tree.length]=this,this.toString=function(){return"(comp for) "+this.tree},this.transition=function(e,t){var r=this;return"in"==e&&"in"==r.expect?(r.expect=null,new $AbstractExprCtx(new $CompIterableCtx(r),!0)):null===r.expect?$transition(r.parent,e,t):void $_SyntaxError(r,"token "+e+" after "+r)},this.to_js=function(){return this.js_processed=!0,$to_js(this.tree)}},$CompIterableCtx=$B.parser.$CompIterableCtx=function(e){this.type="comp_iterable",this.parent=e,this.tree=[],e.tree[e.tree.length]=this,this.toString=function(){return"(comp iter) "+this.tree},this.transition=function(e,t){return $transition(this.parent,e,t)},this.to_js=function(){return this.js_processed=!0,$to_js(this.tree)}},$ConditionCtx=$B.parser.$ConditionCtx=function(e,t){this.type="condition",this.token=t,this.parent=e,this.tree=[],this.scope=$get_scope(this),"while"==t&&(this.loop_num=$loop_num++,$get_node(this).loop_start=this.loop_num),e.tree[e.tree.length]=this,this.toString=function(){return this.token+" "+this.tree},this.transition=function(e,t){var r=this;if(":"==e)return"abstract_expr"==r.tree[0].type&&0==r.tree[0].tree.length&&$_SyntaxError(r,"token "+e+" after "+r),$BodyCtx(r);$_SyntaxError(r,"token "+e+" after "+r)},this.transform=function(e,t){$get_scope(this);if("while"==this.token){e.parent.insert(t,$NodeJS('$locals["$no_break'+this.loop_num+'"] = true'));var r=$get_module(this).module;if("return"!=$B.last(e.children).C.tree[0].type){var n='$locals.$line_info = "'+e.line_num+","+r+'";if($locals.$f_trace !== _b_.None){$B.trace_line()};None;';e.add($NodeJS(n))}return 2}},this.to_js=function(){this.js_processed=!0;var e=this.token;"elif"==e&&(e="else if");var t=[e+"($B.$bool("];if("while"==e)t.push('$locals["$no_break'+this.loop_num+'"] && ');else if("else if"==e){var r=$get_node(this).line_num+","+$get_scope(this).id;t.push('($B.set_line("'+r+'")) && ')}return 1==this.tree.length?t.push($to_js(this.tree)+"))"):(t.push(this.tree[0].to_js()+"))"),this.tree[1].tree.length>0&&t.push("{"+this.tree[1].to_js()+"}")),t.join("")}},$ContinueCtx=$B.parser.$ContinueCtx=function(e){this.type="continue",this.parent=e,$get_node(this).is_continue=!0,e.tree[e.tree.length]=this,set_loop_context.apply(this,[e,"continue"]),this.toString=function(){return"(continue)"},this.transition=function(e,t){var r=this;if("eol"==e)return r.parent;$_SyntaxError(r,"token "+e+" after "+r)},this.to_js=function(){return this.js_processed=!0,"continue"}},$DebuggerCtx=$B.parser.$DebuggerCtx=function(e){this.type="continue",this.parent=e,e.tree[e.tree.length]=this,this.toString=function(){return"(debugger)"},this.transition=function(e,t){},this.to_js=function(){return this.js_processed=!0,"debugger"}},$DecoratorCtx=$B.parser.$DecoratorCtx=function(e){this.type="decorator",this.parent=e,e.tree[e.tree.length]=this,this.tree=[],this.toString=function(){return"(decorator) "+this.tree},this.transition=function(e,t){var r=this;return"id"==e&&0==r.tree.length?$transition(new $DecoratorExprCtx(r),e,t):"eol"==e?$transition(r.parent,e):void $_SyntaxError(r,"token "+e+" after "+r)},this.transform=function(t,r){for(var n=r+1,s=t.parent.children,a=[this.tree];;)if(n>=s.length)$_SyntaxError(e,["decorator expects function"]);else if("node_js"==s[n].C.type)n++;else{if("decorator"!=s[n].C.tree[0].type)break;a.push(s[n].C.tree[0].tree),s.splice(n,1)}this.dec_ids=[];a.forEach(function(){this.dec_ids.push("$id"+$B.UUID())},this);var i=s[n].C.tree[0];"def"==i.type&&(i.decorated=!0,i.alias="$dec"+$B.UUID());var o="",_=$get_scope(this),l='$locals["';_.globals&&_.globals.has(i.name)&&(l="$locals_"+$get_module(this).id+'["');var c=(l+=i.name+'"]')+" = ";a.forEach(function(e,t){c+="$B.$call("+this.dec_ids[t]+")(",o+=")"},this),c+=(i.decorated?i.alias:l)+o+";",$bind(i.name,_,this),t.parent.insert(n+1,$NodeJS(c)),this.decorators=a},this.to_js=function(){this.js_processed=!0;var e=[];return this.decorators.forEach(function(t,r){e.push("var "+this.dec_ids[r]+" = "+$to_js(t)+";")},this),e.join("")}},$DecoratorExprCtx=$B.parser.$DecoratorExprCtx=function(e){this.type="decorator_expression",this.parent=e,e.tree[e.tree.length]=this,this.names=[],this.tree=[],this.is_call=!1,this.toString=function(){return"(decorator expression)"},this.transition=function(e,t){var r=this;if(void 0===r.expects){if("id"==e)return r.names.push(t),r.expects=".",r;$_SyntaxError(r,"token "+e+" after "+r)}else if(r.is_call&&"eol"!==e)$_SyntaxError(r,"token "+e+" after "+r);else{if("id"==e&&"id"==r.expects)return r.names.push(t),r.expects=".",r;if("."==e&&"."==r.expects)return r.expects="id",r;if("("==e&&"."==r.expects){if(!r.is_call)return r.is_call=!0,new $CallCtx(r)}else if("eol"==e)return $transition(r.parent,e)}$_SyntaxError(r,"token "+e+" after "+r)},this.to_js=function(){this.js_processed=!0;var e=new $IdCtx(this,this.names[0]).to_js();return this.names.slice(1).forEach(function(t){e="_b_.getattr("+e+", '"+t+"')"}),this.tree.length>1?(this.tree[0].func={to_js:function(){return e}},this.tree[0].to_js()):e}},$DefCtx=$B.parser.$DefCtx=function(e){this.type="def",this.name=null,this.parent=e,this.tree=[],this.async=e.async,this.locals=[],this.yields=[],e.tree[e.tree.length]=this,this.enclosing=[];var t=this.scope=$get_scope(this);t.C&&"class"==t.C.tree[0].type&&(this.class_name=t.C.tree[0].name),e.node.binding={};for(var r=t;r.C&&"class"==r.C.tree[0].type;)r=r.parent;for(;r.C&&"def"!=r.C.tree[0].type&&"generator"!=r.C.tree[0].type;)r=r.parent;this.parent.node.parent_block=r;for(var n=r;n&&n.C;){if("def"==n.C.tree[0].type){this.inside_function=!0;break}n=n.parent_block}this.module=t.module,this.root=$get_module(this),this.num=$loop_num,$loop_num++,this.positional_list=[],this.default_list=[],this.other_args=null,this.other_kw=null,this.after_star=[],this.set_name=function(e){try{e=$mangle(e,this.parent.tree[0])}catch(e){throw console.log(e),console.log("parent",this.parent),e}var r=new $IdCtx(this,e);this.name=e,this.id=this.scope.id+"_"+e,this.id=this.id.replace(/\./g,"_"),this.id+="_"+$B.UUID(),this.parent.node.id=this.id,this.parent.node.module=this.module,this.binding={},void 0!==this.scope.globals&&this.scope.globals.has(e)?$bind(e,this.root,this):$bind(e,this.scope,this),r.bound=!0,t.is_function&&-1==t.C.tree[0].locals.indexOf(e)&&t.C.tree[0].locals.push(e)},this.toString=function(){return"def "+this.name+"("+this.tree+")"},this.transition=function(e,t){var r=this;switch(e){case"id":return r.name&&$_SyntaxError(r,"token "+e+" after "+r),r.set_name(t),r;case"(":return null==r.name&&$_SyntaxError(r,"missing name in function definition"),r.has_args=!0,new $FuncArgs(r);case"annotation":return new $AbstractExprCtx(new $AnnotationCtx(r),!0);case":":if(r.has_args)return $BodyCtx(r);$_SyntaxError(r,"missing function parameters");case"eol":r.has_args&&$_SyntaxError(r,"missing colon")}$_SyntaxError(r,"token "+e+" after "+r)},this.transform=function(e,t){if(void 0===this.transformed){var r=this.scope;this.doc_string=$get_docstring(e),this.rank=t;var n=e.indent+12;if(this.name.substr(0,15)=="lambda_"+$B.lambda_magic){var s=r.parent_block;s.C&&"def"==s.C.tree[0].type&&this.enclosing.push(s)}for(var a=this.parent.node;a.parent&&a.parent.is_def_func;)this.enclosing.push(a.parent.parent),a=a.parent.parent;var i=[],o=[],_=!1;this.argcount=0,this.kwonlyargcount=0,this.kwonlyargsdefaults=[],this.otherdefaults=[],this.varnames={},this.args=[],this.__defaults__=[],this.slots=[];var l=[],c=[],u=[];this.annotation&&u.push('"return":'+this.annotation.to_js()),this.func_name=this.tree[0].to_js();var f=this.func_name;this.decorated&&(this.func_name="var "+this.alias,f=this.alias),this.tree[1].tree.forEach(function(e){"end_positional"==e.type?(this.args.push("/"),l.push('"/"'),_=!0):(this.args.push(e.name),this.varnames[e.name]=!0),"func_arg_id"==e.type?(this.star_arg?(this.kwonlyargcount++,e.has_default&&this.kwonlyargsdefaults.push(e.name)):(this.argcount++,e.has_default&&this.otherdefaults.push(e.name)),this.slots.push(e.name+":null"),l.push('"'+e.name+'"'),c.push(e.name+":"+e.name),e.tree.length>0&&(i.push('"'+e.name+'"'),o.push(e.name+":"+$to_js(e.tree)),this.__defaults__.push($to_js(e.tree)))):"func_star_arg"==e.type&&("*"==e.op?this.star_arg=e.name:"**"==e.op&&(this.kw_arg=e.name)),e.annotation&&u.push(e.name+": "+e.annotation.to_js())},this),c="{"+c.join(", ")+"}";var p=67;this.star_arg&&(p|=4),this.kw_arg&&(p|=8),"generator"==this.type&&(p|=32),this.async&&(p|=128);for(var d=[],h=r;h.parent_block&&"__builtins__"!==h.parent_block.id;)h=h.parent_block;var $="$locals_"+h.id.replace(/\./g,"_"),m=this.name+this.num,b="$locals_"+this.id;v="var "+b+" = {},"+(D="\n"+" ".repeat(n))+'$local_name = "'+this.id+'",'+D+"$locals = "+b+";",(x=new $Node).locals_def=!0,x.func_node=e,new $NodeJSCtx(x,v),d.push(x);var g=[$NodeJS('$locals.$line_info = "'+e.line_num+","+this.module+'"'),$NodeJS('var $top_frame = [$local_name, $locals,"'+h.id+'", '+$+", "+m+"]"),$NodeJS("$locals.$f_trace = $B.enter_frame($top_frame)"),$NodeJS("var $stack_length = $B.frames_stack.length;")];this.async&&g.push($NodeJS("var $stack = $B.frames_stack.slice()")),g.forEach(function(e){e.enter_frame=!0}),d.push($NodeJS("var $nb_defaults = Object.keys($defaults).length,")),d.push($NodeJS(" $parent = $locals.$parent")),this.env=[];var y=[],v="def"==this.type?b+" = $locals":"var $ns";v+=' = $B.args("'+this.name+'", '+this.argcount+", {"+this.slots.join(", ")+"}, ["+l.join(", ")+"], arguments, $defaults, "+this.other_args+", "+this.other_kw+");";var x=new $Node;new $NodeJSCtx(x,v),y.push(x),"generator"==this.type&&(v="for(var $var in $ns){$locals[$var] = $ns[$var]};",y.push($NodeJS(v)));var w=!1;if(null!==this.other_args||null!==this.other_kw||0!=this.after_star.length||_)d.push(y[0]),y.length>1&&d.push(y[1]);else{w=!0,d.push($NodeJS("var $len = arguments.length;"));x=new $Node;new $NodeJSCtx(x,v="if($len > 0 && arguments[$len - 1].$nat !== undefined)"),d.push(x),y.forEach(function(e){x.add(e)});var B=new $Node;new $NodeJSCtx(B,"else"),d.push(B);var k=this.slots.length,j=$NodeJS("if($len == "+k+")");B.add(j),"generator"==this.type?0==this.args.length?j.add($NodeJS("//")):this.args.forEach(function(e){j.add($NodeJS('$locals["'+e+'"] = '+e))}):j.add($NodeJS(b+" = $locals = "+c)),B.add($NodeJS("else if($len > "+k+'){$B.wrong_nb_args("'+this.name+'", $len, '+k+", ["+l+"])}")),k>0&&(B.add($NodeJS("else if($len + $nb_defaults < "+k+'){$B.wrong_nb_args("'+this.name+'", $len, '+k+", ["+l+"])}")),subelse_node=$NodeJS("else"),B.add(subelse_node),"generator"==this.type?this.args.forEach(function(e){subelse_node.add($NodeJS('$locals["'+e+'"] = '+e))}):subelse_node.add($NodeJS(b+" = $locals = "+c)),subelse_node.add($NodeJS("var defparams = ["+l+"]")),subelse_node.add($NodeJS("for(var i=$len; i < defparams.length;i++){$locals[defparams[i]] = $defaults[defparams[i]]}")))}if((d=d.concat(g)).push($NodeJS("$locals.__annotations__ = _b_.dict.$factory()")),d.push($NodeJS("$top_frame[1] = $locals")),d.push($NodeJS("$locals.$parent = $parent")),d.push($NodeJS('$locals.$name = "'+this.name+'"')),"class"==r.ntype){var E=r.C.tree[0].name,N="$locals_"+r.parent_block.id.replace(/\./g,"_")+'["'+E+'"]';this.parent.node.binding.__class__=!0,d.push($NodeJS("$locals.__class__ = "+N))}if(d.push($NodeJS("$B.js_this = this;")),"generator"==this.type){var S=$NodeJS("// suspension");S.is_set_yield_value=!0,S.parent=e,S.num=e.num,S.line_num=e.line_num,d.push(S)}for(var C=d.length-1;C>=0;C--)e.children.splice(0,0,d[C]);var O=new $Node;this.params="",w&&(this.params=Object.keys(this.varnames).join(", ")),new $NodeJSCtx(O,""),O.is_def_func=!0,O.module=this.module,"return"!=e.children[e.children.length-1].C.tree[0].type&&"generator"!=this.type&&(v="if($locals.$f_trace !== _b_.None){\n"+" ".repeat(n+4)+"$B.trace_return(_b_.None)\n"+" ".repeat(n)+"}\n"+" ".repeat(n),v+="$B.leave_frame","$exec"==this.id.substr(0,5)&&(v+="_exec"),v+="();return _b_.None",e.add($NodeJS(v))),e.add(O);var A=1;n=e.indent;e.parent.insert(t+A++,$NodeJS(m+".$is_func = true")),e.parent.insert(t+A++,$NodeJS(m+".$infos = {"));var I=this.name;"$$"==this.name.substr(0,2)&&(I=I.substr(2)),I.substr(0,15)=="lambda_"+$B.lambda_magic&&(I="<lambda>"),v=' __name__:"'+I+'",',e.parent.insert(t+A++,$NodeJS(v));var T=I;if(this.class_name&&(T=this.class_name+"."+I),v=' __qualname__:"'+T+'",',e.parent.insert(t+A++,$NodeJS(v)),"generator"!=this.type){if(this.otherdefaults.length>0){var R=[];this.otherdefaults.forEach(function(e){R.push("$defaults."+e)}),e.parent.insert(t+A++,$NodeJS(" __defaults__ : $B.fast_tuple(["+R.join(", ")+"]),"))}else e.parent.insert(t+A++,$NodeJS(" __defaults__ : _b_.None,"));if(this.kwonlyargsdefaults.lengh>0){R=[];this.kwonlyargsdefaults.forEach(function(e){R.push("$defaults."+e)}),e.parent.insert(t+A++,$NodeJS(" __kwdefaults__ : $B.fast_tuple(["+R.join(", ")+"]),"))}else e.parent.insert(t+A++,$NodeJS(" __kwdefaults__ : _b_.None,"))}e.parent.insert(t+A++,$NodeJS(" __annotations__: {"+u.join(",")+"},")),e.parent.insert(t+A++,$NodeJS(" __dict__: _b_.dict.__new__(_b_.dict),")),e.parent.insert(t+A++,$NodeJS(" __doc__: "+(this.doc_string||"None")+","));var F=$get_module(this);for(var J in e.parent.insert(t+A++,$NodeJS(' __module__ : "'+F.module+'",')),this.binding)this.varnames[J]=!0;var M=[];for(var J in this.varnames)M.push('"'+$B.from_alias(J)+'"');var L=[];if(this.parent.node.referenced)for(var J in this.parent.node.referenced)this.parent.node.binding[J]||L.push('"'+J+'"');var D,q="___%%%-CODE-%%%___"+this.name+this.num;v=" __code__:{"+(D="\n"+" ".repeat(n+8))+" co_argcount:"+this.argcount;var P=","+D+" ".repeat(4);if(v+=P+"co_filename:$locals_"+$get_module(this).module.replace(/\./g,"_")+'["__file__"]'+P+"co_firstlineno:"+e.line_num+P+"co_flags:"+p+P+"co_freevars: ["+L+"]"+P+"co_kwonlyargcount:"+this.kwonlyargcount+P+'co_name: "'+this.name+'"'+P+"co_nlocals: "+M.length+P+"co_posonlyargcount: "+(this.pos_only||0)+P+"co_varnames: $B.fast_tuple(["+M.join(", ")+"]"+D+")}\n"+" ".repeat(n+4)+"};",v+="None;",e.parent.insert(t+A++,$NodeJS(v)),this.default_str="{"+o.join(", ")+"}","def"==this.type){e.parent.insert(t+A++,new $MarkerNode("func_end:"+q));var z="return "+m;this.async&&(z="return $B.make_async("+m+")"),e.parent.insert(t+A++,$NodeJS(z+"}")),e.parent.insert(t+A++,$NodeJS(this.func_name+" = "+this.name+"$"+this.num+"("+this.default_str+")")),e.parent.insert(t+A++,$NodeJS(f+".$set_defaults = function(value){return "+f+" = "+this.name+"$"+this.num+"(value)}"))}if("def"==this.type){for(var U=e,V=0;V<U.children.length&&U.children[V]!==$B.last(g);V++);var W=$NodeJS("try"),G=U.children.slice(V+1);U.insert(V+1,W),G.forEach(function(e){e.is_def_func?e.children.forEach(function(e){W.add(e)}):W.add(e)}),U.children.splice(V+2,U.children.length);var Y=$NodeJS("catch(err)");this.async&&Y.add($NodeJS("err.$stack = $stack")),Y.add($NodeJS("$B.set_exc(err)")),Y.add($NodeJS("if($locals.$f_trace !== _b_.None){$locals.$f_trace = $B.trace_exception()}")),Y.add($NodeJS("$B.leave_frame();throw err")),U.add(Y)}return this.transformed=!0,A}},this.to_js=function(e){return this.js_processed=!0,e=e||this.tree[0].to_js(),this.decorated&&(e="var "+this.alias),"var "+this.name+"$"+this.num+" = function($defaults){"+(this.async?"async ":"")+"function "+this.name+this.num+"("+this.params+")"}},$DelCtx=$B.parser.$DelCtx=function(e){this.type="del",this.parent=e,e.tree[e.tree.length]=this,this.tree=[],this.toString=function(){return"del "+this.tree},this.transition=function(e,t){var r=this;if("eol"==e)return $transition(r.parent,e);$_SyntaxError(r,"token "+e+" after "+r)},this.to_js=function(){if(this.js_processed=!0,"list_or_tuple"==this.tree[0].type){var t=[];return this.tree[0].tree.forEach(function(r){var n=new $DelCtx(e);n.tree=[r],t.push(n.to_js()),e.tree.pop()}),this.tree=[],t.join(";")}if("expr"==this.tree[0].type&&"list_or_tuple"==this.tree[0].tree[0].type)return this.tree[0]=this.tree[0].tree[0],this.to_js();var r=this.tree[0].tree[0];switch(r.type){case"id":var n=$get_scope(this),s=!1;if(("def"==n.ntype||"generator"==n.ntype)&&n.globals&&n.globals.has(r.value)){for(n=n.parent;n.parent&&"__builtins__"!==n.parent.id;)n=n.parent;s=!0}t='$B.$delete("'+r.value+'"'+(s?', "global"':"")+");";return delete n.binding[r.value],t;case"list_or_tuple":t=[];return r.tree.forEach(function(e){t.push("delete "+e.to_js())}),t.join(";");case"sub":return r.func="delitem",js=r.to_js(),r.func="getitem",js;case"op":$_SyntaxError(this,["cannot delete operator"]);case"call":$_SyntaxError(this,["cannot delete function call"]);case"attribute":return"_b_.delattr("+r.value.to_js()+',"'+r.name+'")';default:$_SyntaxError(this,["cannot delete "+r.type])}}},$DictOrSetCtx=$B.parser.$DictOrSetCtx=function(e){this.type="dict_or_set",this.real="dict_or_set",this.expect="id",this.closed=!1,this.start=$pos,this.parent=e,this.tree=[],e.tree[e.tree.length]=this,this.toString=function(){switch(this.real){case"dict":return"(dict) {"+this.items+"}";case"set":return"(set) {"+this.tree+"}"}return"(dict_or_set) {"+this.tree+"}"},this.transition=function(e,t){var r=this;if(r.closed){switch(e){case"[":return new $AbstractExprCtx(new $SubCtx(r.parent),!1);case"(":return new $CallArgCtx(new $CallCtx(r.parent))}return $transition(r.parent,e,t)}if(","==r.expect){switch(e){case"}":switch(r.real){case"dict_or_set":if(1!=r.tree.length)break;r.real="set";case"set":case"set_comp":case"dict_comp":return r.items=r.tree,r.tree=[],r.closed=!0,r;case"dict":if(r.nb_dict_items()%2==0)return r.items=r.tree,r.tree=[],r.closed=!0,r}$_SyntaxError(r,"token "+e+" after "+r);case",":return"dict_or_set"==r.real&&(r.real="set"),"dict"==r.real&&r.nb_dict_items()%2&&$_SyntaxError(r,"token "+e+" after "+r),r.expect="id",r;case":":if("dict_or_set"==r.real&&(r.real="dict"),"dict"==r.real)return r.expect=",",new $AbstractExprCtx(r,!1);$_SyntaxError(r,"token "+e+" after "+r);case"for":"dict_or_set"==r.real?r.real="set_comp":r.real="dict_comp";var n=new $ListOrTupleCtx(r,"dict_or_set_comp");n.intervals=[r.start+1],n.vars=r.vars,r.tree.pop(),n.expression=r.tree,r.tree=[n],n.tree=[];var s=new $ComprehensionCtx(n);return new $TargetListCtx(new $CompForCtx(s))}$_SyntaxError(r,"token "+e+" after "+r)}else if("id"==r.expect){switch(e){case"}":return 0==r.tree.length?(r.items=[],r.real="dict"):r.items=r.tree,r.tree=[],r.closed=!0,r;case"id":case"imaginary":case"int":case"float":case"str":case"bytes":case"[":case"(":case"{":case".":case"not":case"lambda":r.expect=",";var a=new $AbstractExprCtx(r,!1);return $transition(a,e,t);case"op":switch(t){case"*":case"**":return r.expect=",",(a=new $AbstractExprCtx(r,!1)).packed=t.length,"dict_or_set"==r.real?r.real="*"==t?"set":"dict":("set"==r.real&&"**"==t||"dict"==r.real&&"*"==t)&&$_SyntaxError(r,"token "+e+" after "+r),a;case"+":return r;case"-":case"~":r.expect=",";var i=new $UnaryCtx(r,t);if("-"==t)var o=new $OpCtx(i,"unary_neg");else if("+"==t)o=new $OpCtx(i,"unary_pos");else o=new $OpCtx(i,"unary_inv");return new $AbstractExprCtx(o,!1)}$_SyntaxError(r,"token "+e+" after "+r)}$_SyntaxError(r,"token "+e+" after "+r)}return $transition(r.parent,e,t)},this.nb_dict_items=function(){var e=0;return this.tree.forEach(function(t){t.packed?e+=2:e++}),e},this.packed_indices=function(){var e=[];return this.items.forEach(function(t,r){"expr"==t.type&&t.packed&&e.push(r)}),e},this.unpack_dict=function(e){for(var t,r,n,s="",a=0;a<this.items.length;)r=0==a,"expr"==(n=this.items[a]).type&&n.packed?(t="_b_.list.$factory(_b_.dict.items("+n.to_js()+"))",a++):(t="[["+n.to_js()+","+this.items[a+1].to_js()+"]]",a+=2),r||(t=".concat("+t+")"),s+=t;return s},this.unpack_set=function(e){var t,r="";return this.items.forEach(function(n,s){t=e.indexOf(s)>-1?"_b_.list.$factory("+n.to_js()+")":"["+n.to_js()+"]",s>0&&(t=".concat("+t+")"),r+=t}),r},this.to_js=function(){switch(this.js_processed=!0,this.real){case"dict":if((r=this.packed_indices()).length>0)return"_b_.dict.$factory("+this.unpack_dict(r)+")"+$to_js(this.tree);for(var e=[],t=0;t<this.items.length;t+=2)e.push("["+this.items[t].to_js()+","+this.items[t+1].to_js()+"]");return"_b_.dict.$factory(["+e.join(",")+"])"+$to_js(this.tree);case"set_comp":return"_b_.set.$factory("+$to_js(this.items)+")"+$to_js(this.tree);case"dict_comp":return"_b_.dict.$factory("+$to_js(this.items)+")"+$to_js(this.tree)}var r;return(r=this.packed_indices()).length>0?"set.$factory("+this.unpack_set(r)+")":"set.$factory(["+$to_js(this.items)+"])"+$to_js(this.tree)}},$DoubleStarArgCtx=$B.parser.$DoubleStarArgCtx=function(e){this.type="double_star_arg",this.parent=e,this.tree=[],e.tree[e.tree.length]=this,this.toString=function(){return"**"+this.tree},this.transition=function(e,t){var r=this;switch(e){case"id":case"imaginary":case"int":case"float":case"str":case"bytes":case"[":case"(":case"{":case".":case"not":case"lambda":return $transition(new $AbstractExprCtx(r,!1),e,t);case",":case")":return $transition(r.parent,e);case":":if("lambda"==r.parent.parent.type)return $transition(r.parent.parent,e)}$_SyntaxError(r,"token "+e+" after "+r)},this.to_js=function(){return this.js_processed=!0,'{$nat:"pdict",arg:'+$to_js(this.tree)+"}"}},$EllipsisCtx=$B.parser.$EllipsisCtx=function(e){this.type="ellipsis",this.parent=e,this.nbdots=1,this.start=$pos,e.tree[e.tree.length]=this,this.toString=function(){return"ellipsis"},this.transition=function(e,t){var r=this;return"."==e?(r.nbdots++,3==r.nbdots&&$pos-r.start==2&&(r.$complete=!0),r):r.$complete?$transition(r.parent,e,t):($pos--,void $_SyntaxError(r,"token "+e+" after "+r))},this.to_js=function(){return this.js_processed=!0,'$B.builtins["Ellipsis"]'}},$EndOfPositionalCtx=$B.parser.$EndOfConditionalCtx=function(e){this.type="end_positional",this.parent=e,e.has_end_positional=!0,e.parent.pos_only=e.tree.length,e.tree.push(this),this.transition=function(e,t){var r=this;if(","==e||")"==e)return $transition(r.parent,e,t);$_SyntaxError(r,"token "+e+" after "+r)},this.to_js=function(){return"/"}},$ExceptCtx=$B.parser.$ExceptCtx=function(e){this.type="except",this.parent=e,e.tree[e.tree.length]=this,this.tree=[],this.expect="id",this.scope=$get_scope(this),this.toString=function(){return"(except) "},this.transition=function(e,t){var r=this;switch(e){case"id":case"imaginary":case"int":case"float":case"str":case"bytes":case"[":case"(":case"{":case"not":case"lambda":if("id"==r.expect)return r.expect="as",$transition(new $AbstractExprCtx(r,!1),e,t);case"as":if("as"==r.expect&&void 0===r.has_alias)return r.expect="alias",r.has_alias=!0,r;case"id":if("alias"==r.expect)return r.expect=":",r.set_alias(t),r;break;case":":var n=r.expect;if("id"==n||"as"==n||":"==n)return $BodyCtx(r);break;case"(":if("id"==r.expect&&0==r.tree.length)return r.parenth=!0,r;break;case")":if(","==r.expect||"as"==r.expect)return r.expect="as",r;case",":if(void 0!==r.parenth&&void 0===r.has_alias&&("as"==r.expect||","==r.expect))return r.expect="id",r}$_SyntaxError(r,"token "+e+" after "+r.expect)},this.set_alias=function(e){this.tree[0].alias=$mangle(e,this),$bind(e,this.scope,this)},this.transform=function(e,t){var r=$NodeJS("void(0)");r.line_num=e.line_num,e.insert(0,r);var n=$B.last(e.children);n.C.tree&&n.C.tree[0]&&"return"==n.C.tree[0].type||e.add($NodeJS("$B.del_exc()"))},this.to_js=function(){switch(this.js_processed=!0,this.tree.length){case 0:return"else";case 1:if("Exception"==this.tree[0].name)return"else if(1)"}var e=[];this.tree.forEach(function(t){e.push(t.to_js())});var t="";if($B.debug>0){var r=$get_module(this);t='($locals.$line_info = "'+$get_node(this).line_num+","+r.id+'") && '}return"else if("+t+"$B.is_exc("+this.error_name+",["+e.join(",")+"]))"}},$ExprCtx=$B.parser.$ExprCtx=function(e,t,r){this.type="expr",this.name=t,this.with_commas=r,this.expect=",",this.parent=e,e.packed&&(this.packed=e.packed),e.is_await&&(this.is_await=e.is_await),e.assign&&(this.assign=e.assign),this.tree=[],e.tree[e.tree.length]=this,this.toString=function(){return"(expr "+r+") "+this.tree},this.transition=function(e,t){var r=this;switch(e){case"bytes":case"float":case"id":case"imaginary":case"int":case"lambda":case"pass":case"str":$_SyntaxError(r,"token "+e+" after "+r);break;case"{":return"id"==r.tree[0].type&&-1!=["print","exec"].indexOf(r.tree[0].value)||$_SyntaxError(r,"token "+e+" after "+r),new $DictOrSetCtx(r);case"[":case"(":case".":case"not":if("expr"==r.expect)return r.expect=",",$transition(new $AbstractExprCtx(r,!1),e,t)}switch(e){case"not":if(","==r.expect)return new $ExprNot(r);break;case"in":if("target_list"==r.parent.type)return $transition(r.parent,e);if(","==r.expect)return $transition(r,"op","in");break;case",":if(","==r.expect&&(r.with_commas||["assign","return"].indexOf(r.parent.type)>-1)){$parent_match(r,{type:"yield",from:!0})&&$_SyntaxError(r,"no implicit tuple for yield from"),r.parent.tree.pop();var n=new $ListOrTupleCtx(r.parent,"tuple");return n.implicit=!0,n.has_comma=!0,n.tree=[r],r.parent=n,n}return $transition(r.parent,e);case".":return new $AttrCtx(r);case"[":return new $AbstractExprCtx(new $SubCtx(r),!0);case"(":return new $CallCtx(r);case"op":var s=r.parent,a=t;if("ternary"==s.type&&s.in_else){var i=new $OpCtx(r,a);return new $AbstractExprCtx(i,!1)}for(var o=r.parent,_=null;;)if("expr"==o.type)o=o.parent;else if("op"==o.type&&$op_weight[o.op]>=$op_weight[a]&&("**"!=o.op||"**"!=a))_=o,o=o.parent;else{if(!("not"==o.type&&$op_weight.not>$op_weight[a]))break;_=o,o=o.parent}if(null===_){for(;r.parent!==o;)s=(r=r.parent).parent;var l;r.parent.tree.pop(),(l=new $ExprCtx(s,"operand",r.with_commas)).expect=",",r.parent=l;i=new $OpCtx(r,a);return new $AbstractExprCtx(i,!1)}if("and"===a||"or"===a)for(;"not"==_.parent.type||"expr"==_.parent.type&&"not"==_.parent.parent.type;)s=(_=_.parent).parent;if("op"==_.type){var c=!1;switch(_.op){case"<":case"<=":case"==":case"!=":case"is":case">=":case">":c=!0}if(c)switch(a){case"<":case"<=":case"==":case"!=":case"is":case">=":case">":var u=_.tree[1],f=u.to_js(),p=new Object;for(var d in u)p[d]=u[d];var h="$c"+chained_comp_num;for(u.to_js=function(){return h},p.to_js=function(){return h},chained_comp_num++;_.parent&&"op"==_.parent.type&&$op_weight[_.parent.op]<$op_weight[_.op];)_=_.parent;_.parent.tree.pop();var $=new $OpCtx(_,"and");$.wrap={name:h,js:f},p.parent=$,$.tree.push("xxx");i=new $OpCtx(p,a);return new $AbstractExprCtx(i,!1)}}_.parent.tree.pop(),(l=new $ExprCtx(_.parent,"operand",!1)).tree=[o],_.parent=l;i=new $OpCtx(_,a);return new $AbstractExprCtx(i,!1);case"augm_assign":for(var m=r.parent;m;)"assign"==m.type||"augm_assign"==m.type?$_SyntaxError(r,"augmented assignment inside assignment"):"op"==m.type&&$_SyntaxError(r,["cannot assign to operator"]),m=m.parent;return","==r.expect?new $AbstractExprCtx(new $AugmentedAssignCtx(r,t),!0):$transition(r.parent,e,t);case":":if("sub"==r.parent.type||"list_or_tuple"==r.parent.type&&"sub"==r.parent.parent.type)return new $AbstractExprCtx(new $SliceCtx(r.parent),!1);if("slice"==r.parent.type)return $transition(r.parent,e,t);if("node"==r.parent.type){if(1==r.tree.length){var b=r.tree[0];if(["id","sub","attribute"].indexOf(b.type)>-1)return new $AbstractExprCtx(new $AnnotationCtx(r),!1);if("tuple"==b.real&&","==b.expect&&1==b.tree.length)return new $AbstractExprCtx(new $AnnotationCtx(b.tree[0]),!1)}$_SyntaxError(r,"invalid target for annotation")}break;case"=":;var g;if(","==r.expect){if("call_arg"==r.parent.type)return"id"!=r.tree[0].type&&$_SyntaxError(r,["keyword can't be an expression"]),new $AbstractExprCtx(new $KwArgCtx(r),!0);if(g=function(e,t){for(;e.parent;){if(e.parent.type==t)return e.parent;e=e.parent}return!1}(r,"annotation"))return $transition(g,e,t);if("op"==r.parent.type)$_SyntaxError(r,["cannot assign to operator"]);else if("list_or_tuple"==r.parent.type)for(var y=0;y<r.parent.tree.length;y++){var v=r.parent.tree[y];"expr"==v.type&&"operand"==v.name&&$_SyntaxError(r,["cannot assign to operator"])}else"expr"==r.parent.type&&"target list"==r.parent.name&&$_SyntaxError(r,"token "+e+" after "+r);for(;void 0!==r.parent;)"condition"==(r=r.parent).type?$_SyntaxError(r,"token "+e+" after "+r):"augm_assign"==r.type&&$_SyntaxError(r,"assignment inside augmented assignment");return r=r.tree[0],new $AbstractExprCtx(new $AssignCtx(r),!0)}break;case":=":var x=r.parent.type;if(["node","assign","kwarg","annotation"].indexOf(x)>-1?$_SyntaxError(r,":= invalid, parent "+x):"func_arg_id"==x&&r.parent.tree.length>0?$_SyntaxError(r,":= invalid, parent "+x):"call_arg"==x&&"call"==r.parent.parent.type&&"lambda"==r.parent.parent.parent.type&&$_SyntaxError(r,":= invalid inside function arguments"),1==r.tree.length&&"id"==r.tree[0].type){for(var w=$get_scope(r),B=r.tree[0].value;w.is_comp;)w=w.parent_block;$bind(B,w,r),(m=r.parent).tree.pop();var k=new $AbstractExprCtx(m,!1);return k.assign=r.tree[0],k}$_SyntaxError(r,"token "+e+" after "+r);case"if":for(var j=!1,E=r.parent;"list_or_tuple"!=E.type;){if("comp_for"==E.type||"comp_if"==E.type){j=!0;break}if("call_arg"==E.type)break;if(void 0===E.parent)break;E=E.parent}if(j)break;for(E=r;E.parent&&("op"==E.parent.type||"expr"==E.parent.type&&"operand"==E.parent.name);)E=E.parent;return new $AbstractExprCtx(new $TernaryCtx(E),!0);case"eol":if(2==r.tree.length&&"id"==r.tree[0].type&&["print","exec"].indexOf(r.tree[0].value)>-1&&$_SyntaxError(r,["Missing parentheses in call to '"+r.tree[0].value+"'."]),-1==["dict_or_set","list_or_tuple"].indexOf(r.parent.type)){var N=r.tree[0];("packed"==N.type||"call"==N.type&&"packed"==N.func.type)&&$_SyntaxError(r,["can't use starred expression here"])}}return $transition(r.parent,e)},this.to_js=function(e){var t;if(this.js_processed=!0,t="list"==this.type?"["+$to_js(this.tree)+"]":1==this.tree.length?this.tree[0].to_js(e):"_b_.tuple.$factory(["+$to_js(this.tree)+"])",this.is_await&&(t="await ($B.promise("+t+"))"),this.assign){for(var r=$get_scope(this);r.is_comp;)r=r.parent_block;if(r.globals&&r.globals.has(this.assign.value))for(;r.parent_block&&"__builtins__"!==r.parent_block.id;)r=r.parent_block;else r.nonlocals&&r.nonlocals[this.assign.value]&&(r=r.parent_block);t="($locals_"+r.id.replace(/\./g,"_")+'["'+this.assign.value+'"] = '+t+")"}return t}},$ExprNot=$B.parser.$ExprNot=function(e){this.type="expr_not",this.parent=e,this.tree=[],e.tree[e.tree.length]=this,this.transition=function(e,t){var r=this;if("in"==e)return r.parent.tree.pop(),new $AbstractExprCtx(new $OpCtx(r.parent,"not_in"),!1);$_SyntaxError(r,"token "+e+" after "+r)},this.toString=function(){return"(expr_not)"}},$ForExpr=$B.parser.$ForExpr=function(e){this.type="for",this.parent=e,this.tree=[],e.tree[e.tree.length]=this,this.loop_num=$loop_num,this.module=$get_scope(this).module,$loop_num++,this.toString=function(){return"(for) "+this.tree},this.transition=function(e,t){var r=this;switch(e){case"in":return 0==r.tree[0].tree.length&&$_SyntaxError(r,"missing target between 'for' and 'in'"),new $AbstractExprCtx(new $ExprCtx(r,"target list",!0),!1);case":":return(r.tree.length<2||"abstract_expr"==r.tree[1].tree[0].type)&&$_SyntaxError(r,"token "+e+" after "+r),$BodyCtx(r)}$_SyntaxError(r,"token "+e+" after "+r)},this.transform=function(e,t){if(this.async)return this.transform_async(e,t);var r=$get_scope(this),n=this.tree[0],s=1==n.tree.length&&"id"==n.expect,a=this.tree[1],i=this.loop_num,o="$locals_"+r.id.replace(/\./g,"_"),_="\n"+" ".repeat(e.indent+4),l=!1;if(1==n.tree.length&&!r.blurred&&"id"!=n.expct&&"expr"==a.type&&"expr"==a.tree[0].type&&"call"==a.tree[0].tree[0].type){var c=a.tree[0].tree[0];if("id"==c.func.type)"range"==c.func.value&&c.tree.length<3&&c.tree.length>0&&(l=c)}var u=[],f=0,p=e.children;if(l&&"generator"!=r.ntype){this.has_break&&(O=new $Node,new $NodeJSCtx(O,o+'["$no_break'+i+'"] = true'),u[f++]=O);for(var d,h=$get_scope(this),$=[];h.binding.range&&$.push(h.id),h.parent_block;)h=h.parent_block;d=1==$.length&&"__builtins__"==$[0];var m=new $Node;m.module=e.parent.module,new $NodeJSCtx(m,d?"if(1)":"if("+c.func.to_js()+" === $B.builtins.range)"),u[f++]=m;var b=n.to_js(),g=!1;if(1==l.tree.length){if("int"==(x=l.tree[0].tree[0]).tree[0].type&&0<(x=parseInt(x.to_js()))<$B.max_int){g=!0;var y="$i"+$B.UUID();(B=$NodeJS("for (var "+y+" = 0; "+y+" < "+x+"; "+y+"++)")).add($NodeJS(b+" = "+y))}var v=0,x=l.tree[0].to_js()}else v=l.tree[0].to_js(),x=l.tree[1].to_js();if(!g){var w="var $stop_"+i+" = $B.int_or_bool("+x+"),"+_+" $next"+i+" = "+v+","+_+" $safe"+i+" = typeof $next"+i+' == "number" && typeof $stop_'+i+' == "number";'+_+" while(true)",B=new $Node;new $NodeJSCtx(B,w),B.add($NodeJS("if($safe"+i+" && $next"+i+">= $stop_"+i+"){break}")),B.add($NodeJS("else if(!$safe"+i+" && $B.ge($next"+i+", $stop_"+i+")){break}")),B.add($NodeJS(b+" = $next"+i)),B.add($NodeJS("if($safe"+i+"){$next"+i+" += 1}")),B.add($NodeJS("else{$next"+i+" = $B.add($next"+i+",1)}"))}if(p.forEach(function(e){B.add(e.clone_tree())}),"return"!=$B.last(e.children).C.tree[0].type){w='$locals.$line_info = "'+e.line_num+","+this.module+'";if($locals.$f_trace !== _b_.None){$B.trace_line()};None;';B.add($NodeJS(w))}var k=!1;if("module"==r.ntype)for(var j=e.parent;j;){if(j.for_wrapper){k=!0;break}j=j.parent}if("module"!=r.ntype||k)m.add(B);else{var E=new $Node;E.for_wrapper=!0,w="function $f"+i+"(",this.has_break&&(w+="$no_break"+i),new $NodeJSCtx(E,w+=")"),m.add(E),E.add(B),this.has_break&&E.add($NodeJS("return $no_break"+i)),m.add($NodeJS("var $res"+i+" = $f"+i+"();")),this.has_break&&m.add($NodeJS("var $no_break"+i+" = $res"+i))}if(d){e.parent.children.splice(t,1);var N=0;return this.has_break&&(e.parent.insert(t,u[0]),N++),u[N].children.forEach(function(r){e.parent.insert(t+N,r)}),e.parent.children[t].line_num=e.line_num,e.parent.children[t].bindings=e.bindings,e.children=[],0}var S=$NodeJS("else");u[f++]=S;for(var C=u.length-1;C>=0;C--)e.parent.insert(t+1,u[C]);this.test_range=!0,u=[],f=0}var O=new $Node;O.line_num=$get_node(this).line_num;var A=a.to_js(),I="$iter"+i;new $NodeJSCtx(O,w="var "+I+" = "+A+';$locals["$next'+i+'"] = $B.$getattr($B.$iter('+I+'),"__next__")'),u[f++]=O,this.has_break&&(u[f++]=$NodeJS(o+'["$no_break'+i+'"] = true;'));var T=new $Node;if(w=this.has_break?"while("+o+'["$no_break'+i+'"])':"while(true)",new $NodeJSCtx(T,w),T.C.loop_num=i,T.C.type="for","generator"==r.ntype&&(T.loop_start=i),u[f++]=T,e.parent.children.splice(t,1),this.test_range)for(C=u.length-1;C>=0;C--)S.insert(0,u[C]);else for(C=u.length-1;C>=0;C--)e.parent.insert(t,u[C]),u.length;var R=$NodeJS("try");R.bindings=e.bindings,T.add(R);var F=new $Node;F.id=this.module;var J=new $NodeCtx(F),M=new $ExprCtx(J,"left",!0);if(s){var L=new $ListOrTupleCtx(M);L.real="tuple",L.tree=n.tree}else M.tree=n.tree;if(new $AssignCtx(M).tree[1]=new $JSCode('$locals["$next'+i+'"]()'),R.add(F),T.add($NodeJS("catch($err){if($B.is_exc($err, [StopIteration])){break;}else{throw($err)}}")),p.forEach(function(e){T.add(e.clone())}),"return"!=$B.last(e.children).C.tree[0].type){w='$locals.$line_info = "'+e.line_num+","+this.module+'";if($locals.$f_trace !== _b_.None){$B.trace_line()};None;';T.add($NodeJS(w))}return e.children=[],0},this.transform_async=function(e,t){var r=$get_scope(this),n=this.tree[0],s=(1==n.tree.length&&n.expect,this.tree[1]),a=this.loop_num,i=(r.id.replace(/\./g,"_")," ".repeat(e.indent+4),[]),o="$iter"+a,_="$type"+a,l="$running"+a,c="$anext"+a,u="var "+o+" = "+s.to_js();i.push($NodeJS(u)),i.push($NodeJS("var "+_+" = _b_.type.$factory( "+o+")")),u=o+" = $B.$call($B.$getattr("+_+', "__aiter__"))('+o+")",i.push($NodeJS(u)),i.push($NodeJS("var "+l+" = true")),i.push($NodeJS("var "+c+" = $B.$call($B.$getattr("+_+', "__anext__"))'));var f=$NodeJS("while("+l+")");i.push(f);var p=$NodeJS("try");if(f.add(p),1==n.tree.length){u=n.to_js()+" = await ($B.promise("+c+"("+o+")))";p.add($NodeJS(u))}else{var d=new $Node,h=new $NodeCtx(d),$=new $ExprCtx(h,"left",!1);$.tree.push(n),n.parent=$;var m=new $AssignCtx($);new $RawJSCtx(m,"await ($B.promise("+c+"("+o+")))"),p.add(d)}var b=$NodeJS("catch(err)");f.add(b);u="if(err.__class__ === _b_.StopAsyncIteration){"+l+" = false; continue}else{throw err}";b.add($NodeJS(u)),e.children.forEach(function(e){f.add(e)}),e.parent.children.splice(t,1);for(var g=i.length-1;g>=0;g--)e.parent.insert(t,i[g]);return e.children=[],0},this.to_js=function(){this.js_processed=!0;var e=this.tree.pop();return"for ("+$to_js(this.tree)+" in "+e.to_js()+")"}},$FromCtx=$B.parser.$FromCtx=function(e){this.type="from",this.parent=e,this.module="",this.names=[],e.tree[e.tree.length]=this,this.expect="module",this.scope=$get_scope(this),this.add_name=function(e){this.names[this.names.length]=e,"*"==e&&(this.scope.blurred=!0)},this.bind_names=function(){var e=$get_scope(this);this.names.forEach(function(t){Array.isArray(t)&&(t=t[1]),$bind(t,e,this)},this)},this.transition=function(e,t){var r=this;switch(e){case"id":if("id"==r.expect)return r.add_name(t),r.expect=",",r;if("alias"==r.expect)return r.names[r.names.length-1]=[$B.last(r.names),t],r.expect=",",r;case".":if("module"==r.expect)return r.module+="id"==e?t:".",r;case"import":if("module"==r.expect)return r.expect="id",r;case"op":if("*"==t&&"id"==r.expect&&0==r.names.length)return"module"!==$get_scope(r).ntype&&$_SyntaxError(r,["import * only allowed at module level"]),r.add_name("*"),r.expect="eol",r;case",":if(","==r.expect)return r.expect="id",r;case"eol":switch(r.expect){case",":case"eol":return r.bind_names(),$transition(r.parent,e);case"id":$_SyntaxError(r,["trailing comma not allowed without surrounding parentheses"]);default:$_SyntaxError(r,["invalid syntax"])}case"as":if(","==r.expect||"eol"==r.expect)return r.expect="alias",r;case"(":if("id"==r.expect)return r.expect="id",r;case")":if(","==r.expect||"id"==r.expect)return r.expect="eol",r}$_SyntaxError(r,"token "+e+" after "+r)},this.toString=function(){return"(from) "+this.module+" (import) "+this.names},this.to_js=function(){this.js_processed=!0;var e=$get_scope(this),t=$get_module(this),r=t.module,n=[],s=0,a=$get_node(this).indent,i=" ".repeat(a);if(r.startsWith("$exec")){var o=$B.last($B.frames_stack)[1];o.module&&o.module.__name__&&(r=o.module.__name__)}for(var _=this.module.split("."),l=0;l<_.length;l++)t.imports[_.slice(0,l+1).join(".")]=!0;for(var c,u=this.module.replace(/\$/g,""),f=[];u.length>0&&"."==u.charAt(0);){if(void 0===c?void 0!==$B.imported[r]&&(f=(c=$B.imported[r].__package__).split(".")):(c=$B.imported[c],f.pop()),void 0===c)return"throw SystemError.$factory(\"Parent module '' not loaded, cannot perform relative import\")";"None"==c&&console.log("package is None !"),u=u.substr(1)}u&&f.push(u),this.module=f.join(".");var p=this.module.replace(/\$/g,"");n[s++]='var module = $B.$import("',n[s++]=p+'",["';for(var d=[],h=(l=0,this.names.length);l<h;l++)Array.isArray(this.names[l])?d.push(this.names[l][0]):d.push(this.names[l]);n[s++]=d.join('","')+'"], {';var $="";for(var m in this.aliases)n[s++]=$+'"'+m+'": "'+this.aliases[m]+'"',$=",";return n[s++]="}, {}, true);","*"==this.names[0]?(e.blurred=!0,n[s++]="\n"+i+"$B.import_all($locals, module);"):this.names.forEach(function(e){var r=e;Array.isArray(e)&&(r=e[1],e=e[0]),t.imports[this.module+"."+e]=!0,n[s++]="\n"+i+'$locals["'+r+'"] = $B.$getattr($B.imported["'+p+'"], "'+e+'");'},this),n[s++]="\n"+i+"None;",n.join("")}},$FuncArgs=$B.parser.$FuncArgs=function(e){this.type="func_args",this.parent=e,this.tree=[],this.names=[],e.tree[e.tree.length]=this,this.expect="id",this.has_default=!1,this.has_star_arg=!1,this.has_kw_arg=!1,this.toString=function(){return"func args "+this.tree},this.transition=function(e,t){var r=this;switch(e){case"id":return r.has_kw_arg&&$_SyntaxError(r,"duplicate keyword argument"),"id"==r.expect&&(r.expect=",",r.names.indexOf(t)>-1&&$_SyntaxError(r,["duplicate argument "+t+" in function definition"])),new $FuncArgIdCtx(r,t);case",":if(","==r.expect)return r.expect="id",r;$_SyntaxError(r,"token "+e+" after "+r);case")":var n=$B.last(r.tree);return n&&"func_star_arg"==n.type&&"*"==n.name&&("*"==r.op?$_SyntaxError(r,["named arguments must follow bare *"]):$_SyntaxError(r,"invalid syntax")),r.parent;case"op":r.has_kw_arg&&$_SyntaxError(r,"duplicate keyword argument");var s=t;if(r.expect=",","*"==s)return r.has_star_arg&&$_SyntaxError(r,"duplicate star argument"),new $FuncStarArgCtx(r,"*");if("**"==s)return new $FuncStarArgCtx(r,"**");if("/"==s)return r.has_end_positional?$_SyntaxError(r,["duplicate / in function parameters"]):r.has_star_arg&&$_SyntaxError(r,["/ after * in function parameters"]),new $EndOfPositionalCtx(r);$_SyntaxError(r,"token "+s+" after "+r);case":":if("lambda"==r.parent.type)return $transition(r.parent,e)}$_SyntaxError(r,"token "+e+" after "+r)},this.to_js=function(){return this.js_processed=!0,$to_js(this.tree)}},$FuncArgIdCtx=$B.parser.$FuncArgIdCtx=function(e,t){this.type="func_arg_id",this.name=t,this.parent=e,e.has_star_arg?e.parent.after_star.push(t):e.parent.positional_list.push(t);var r=$get_node(this);r.binding[t]&&$_SyntaxError(e,["duplicate argument '"+t+"' in function definition"]),$bind(t,r,this),this.tree=[],e.tree[e.tree.length]=this;for(var n=e;void 0!==n.parent;){if("def"==n.type){n.locals.push(t);break}n=n.parent}this.expect="=",this.toString=function(){return"func arg id "+this.name+"="+this.tree},this.transition=function(e,t){var r=this;switch(e){case"=":if("="==r.expect){r.has_default=!0;var n=r.parent.parent;return r.parent.has_star_arg?n.default_list.push(n.after_star.pop()):n.default_list.push(n.positional_list.pop()),new $AbstractExprCtx(r,!1)}break;case",":case")":if(!r.parent.has_default||0!=r.tree.length||void 0!==r.parent.has_star_arg)return $transition(r.parent,e);$pos-=r.name.length,$_SyntaxError(r,["non-default argument follows default argument"]);case":":return"lambda"==r.parent.parent.type?$transition(r.parent.parent,":"):(r.has_default&&$_SyntaxError(r,"token "+e+" after "+r),new $AbstractExprCtx(new $AnnotationCtx(r),!1))}$_SyntaxError(r,"token "+e+" after "+r)},this.to_js=function(){return this.js_processed=!0,this.name+$to_js(this.tree)}},$FuncStarArgCtx=$B.parser.$FuncStarArgCtx=function(e,t){this.type="func_star_arg",this.op=t,this.parent=e,this.node=$get_node(this),e.has_star_arg="*"==t,e.has_kw_arg="**"==t,e.tree[e.tree.length]=this,this.toString=function(){return"(func star arg "+this.op+") "+this.name},this.transition=function(e,t){var r=this;switch(e){case"id":return void 0===r.name&&r.parent.names.indexOf(t)>-1&&$_SyntaxError(r,["duplicate argument "+t+" in function definition"]),r.set_name(t),r.parent.names.push(t),r;case",":case")":return void 0===r.name&&(r.set_name("*"),r.parent.names.push("*")),$transition(r.parent,e);case":":return"lambda"==r.parent.parent.type?$transition(r.parent.parent,":"):(void 0===r.name&&$_SyntaxError(r,"annotation on an unnamed parameter"),new $AbstractExprCtx(new $AnnotationCtx(r),!1))}$_SyntaxError(r,"token "+e+" after "+r)},this.set_name=function(r){this.name=r,this.node.binding[r]&&$_SyntaxError(e,["duplicate argument '"+r+"' in function definition"]),$bind(r,this.node,this);for(var n=e;void 0!==n.parent;){if("def"==n.type){n.locals.push(r);break}n=n.parent}"*"==t?n.other_args='"'+r+'"':n.other_kw='"'+r+'"'}},$GlobalCtx=$B.parser.$GlobalCtx=function(e){this.type="global",this.parent=e,this.tree=[],e.tree[e.tree.length]=this,this.expect="id",this.scope=$get_scope(this),this.scope.globals=this.scope.globals||new Set,this.module=$get_module(this),this.module.binding=this.module.binding||{},this.toString=function(){return"global "+this.tree},this.transition=function(e,t){var r=this;switch(e){case"id":if("id"==r.expect)return new $IdCtx(r,t),r.add(t),r.expect=",",r;break;case",":if(","==r.expect)return r.expect="id",r;break;case"eol":if(","==r.expect)return $transition(r.parent,e)}$_SyntaxError(r,"token "+e+" after "+r)},this.add=function(t){this.scope.annotations&&this.scope.annotations.has(t)&&$_SyntaxError(e,["annotated name '"+t+"' can't be global"]),this.scope.globals.add(t),this.module.binding[t]=!0},this.to_js=function(){return this.js_processed=!0,""}},$IdCtx=$B.parser.$IdCtx=function(e,t){this.type="id",this.value=$mangle(t,e),this.parent=e,this.tree=[],e.tree[e.tree.length]=this;var r=this.scope=$get_scope(this);this.blurred_scope=this.scope.blurred,this.env=clone(this.scope.binding),"def"!=r.ntype&&"generator"!=r.ntype||(r.referenced=r.referenced||{},$B.builtins[this.value]||(r.referenced[this.value]=!0)),"call_arg"==e.parent.type&&(this.call_arg=!0);for(var n=e;void 0!==n.parent;){switch(n.type){case"ctx_manager_alias":$bind(t,r,this);break;case"list_or_tuple":case"dict_or_set":case"call_arg":case"def":case"lambda":void 0===n.vars?n.vars=[t]:-1==n.vars.indexOf(t)&&n.vars.push(t),this.call_arg&&"lambda"==n.type&&(void 0===n.locals?n.locals=[t]:n.locals.push(t))}n=n.parent}if($parent_match(e,{type:"target_list"})&&(this.no_bindings=!0,$bind(t,r,this),this.bound=!0),"def"==r.ntype||"generator"==r.ntype){for(var s=this.parent;s;){if("list_or_tuple"==s.type&&s.is_comp()){this.in_comp=!0;break}s=s.parent}"expr"==e.type&&"comp_if"==e.parent.type||"global"==e.type&&(void 0===r.globals?r.globals=new Set([t]):r.globals.add(t))}this.toString=function(){return"(id) "+this.value+":"+(this.tree||"")},this.transition=function(e,t){var r=this;switch(e){case"=":return"expr"==r.parent.type&&void 0!==r.parent.parent&&"call_arg"==r.parent.parent.type?new $AbstractExprCtx(new $KwArgCtx(r.parent),!1):$transition(r.parent,e,t);case"op":return $transition(r.parent,e,t);case"id":case"str":case"int":case"float":case"imaginary":["print","exec"].indexOf(r.value)>-1&&$_SyntaxError(r,["missing parenthesis in call to '"+r.value+"'"]),$_SyntaxError(r,"token "+e+" after "+r)}var n=$parent_match(r,{type:"packed"});return n&&-1==[".","[","("].indexOf(e)?n.transition(e,t):$transition(r.parent,e,t)},this.firstBindingScopeId=function(){for(var e=this.scope,t=0;e&&t++<20;){if(e.globals&&e.globals.has(this.value))return $get_module(this).id;if(e.binding&&e.binding[this.value])return e.id;e=e.parent}},this.boundBefore=function(e){var t=$get_node(this);for(0;t.parent;){var r=t.parent;if(r.bindings&&r.bindings[this.value])return r.bindings[this.value];for(var n=0;n<r.children.length;n++){var s=r.children[n];if(s===t)break;if(s.bindings&&s.bindings[this.value])return s.bindings[this.value]}if(r===e)break;t=r}return!1},this.bindingType=function(e){for(var t,r,n=0,s=$get_node(this),a=!1;!a&&s.parent&&n++<100;){var i=s.parent;if(i.bindings&&i.bindings[this.value])return i.bindings[this.value];for(var o=0;o<i.children.length;o++){var _=i.children[o];if(_===s)break;_.bindings&&_.bindings[this.value]&&(a=_.bindings[this.value],r=o)}if(a){for(var l=r+1;l<i.children.length;l++){if((_=i.children[l]).children.length>0){t=!0;break}if(_===s)break}return t||a}if(i===e)break;s=i}return a},this.to_js=function(e){if(void 0!==this.result&&"generator"==this.scope.ntype)return this.result;this.js_processed=!0;var t=this.value,r=void 0!==this.scope.binding[t],n=$get_node(this),s=n.bound_before;if(this.nonlocal=this.scope.nonlocals&&void 0!==this.scope.nonlocals[t],this.unbound=this.unbound||r&&!this.bound&&s&&-1==s.indexOf(t),!this.bound&&this.scope.C&&"class"==this.scope.ntype&&this.scope.C.tree[0].name==t)return'$B.$search("'+t+'")';if(this.unbound&&!this.nonlocal)return"def"==this.scope.ntype||"generator"==this.scope.ntype?'$B.$local_search("'+t+'")':'$B.$search("'+t+'")';if("__BRYTHON__"==t||"$B"==t)return t;var a=$get_scope(this),i=a,o=[],_=['"'+a.id+'"'],l=a;for(0;;){if(l.parent_block){if(l.parent_block==$B.builtins_scope)break;if(void 0===l.parent_block.id)break;l=l.parent_block}_.push('"'+l.id+'"')}if(_="["+_.join(", ")+"]",a.globals&&a.globals.has(t)&&(_=['"'+l.id+'"'],a=l),this.nonlocal||this.bound){var c=this.firstBindingScopeId();if(void 0!==c)return"$locals_"+c.replace(/\./g,"_")+'["'+t+'"]';if(this.bound)return"$locals_"+a.id.replace(/\./g,"_")+'["'+t+'"]'}for(var u="$locals_"+l.id.replace(/\./g,"_");;){if(void 0!==i.globals&&i.globals.has(t))return this.boundBefore(l)?u+'["'+t+'"]':this.augm_assign?u+'["'+t+'"]':'$B.$global_search("'+t+'", '+_+")";if(i===a){if(s)s.indexOf(t)>-1?o.push(i):i.C&&"def"==i.C.tree[0].type&&i.C.tree[0].env.indexOf(t)>-1&&o.push(i);else if(i.binding[t]){if(void 0!==n.locals[t]){o.push(i);break}i.is_comp||i.parent_block&&i.parent_block.is_comp||o.push(i)}}else void 0===i.binding&&console.log("scope",i,t,"no binding",a),i.binding[t]&&o.push(i);if(!i.parent_block)break;i=i.parent_block}if(this.found=o,this.nonlocal&&o[0]===a&&o.shift(),o.length>0){if(o[0].C&&o[0]===a&&"$"!=t.charAt(0)){var f=n.locals||{},p=a.nonlocals;try{if(void 0===f[t]&&("def"!=a.type||"generator"!=a.type)&&"class"!=a.ntype&&a.C.tree[0].args&&-1==a.C.tree[0].args.indexOf(t)&&(void 0===p||void 0===p[t]))return this.result='$B.$local_search("'+t+'")',this.result}catch(e){throw console.log("error",t,a),e}}if(o.length>1&&o[0].C&&"class"==o[0].C.tree[0].type){var d="$locals_"+o[0].id.replace(/\./g,"_"),h="$locals_"+o[1].id.replace(/\./g,"_");if(s)return s.indexOf(t)>-1?(this.found=o[0].binding[t],$=d):(this.found=o[1].binding[t],$=h),this.result=$+'["'+t+'"]',this.result;this.found=!1;var $=d+'["'+t+'"] !== undefined ? ';return $+=d+'["'+t+'"] : ',this.result="("+$+h+'["'+t+'"])',this.result}i=o[0];this.found=i.binding[t];var m="$locals_"+i.id.replace(/\./g,"_");if(void 0===i.C)if("__builtins__"==i.id)l.blurred?t="("+u+'["'+t+'"] || '+t+")":("__builtins__"!==t&&(t="$B.builtins."+t),this.is_builtin=!0);else if(this.bound||this.augm_assign)t=m+'["'+t+'"]';else{if(i===a&&void 0===this.env[t])return this.result='$B.$search("'+t+'")',this.result;t=this.boundBefore(i)?m+'["'+t+'"]':'$B.$check_def("'+t+'",'+m+'["'+t+'"])'}else if(i===a)t=i.globals&&i.globals.has(t)?u+'["'+t+'"]':this.bound||this.augm_assign?'$locals["'+t+'"]':this.boundBefore(i)?'$locals["'+t+'"]':'$B.$check_def_local("'+t+'",$locals["'+t+'"])';else if(this.augm_assign)t=m+'["'+t+'"]';else if("generator"==i.ntype){for(var b=a;b!==i;)0,b=b.parent_block;t='$B.$check_def_free1("'+t+'", "'+i.id.replace(/\./g,"_")+'")'}else t='$B.$check_def_free("'+t+'",'+m+'["'+t+'"])';return this.result=t+$to_js(this.tree,""),this.result}return this.unknown_binding=!0,this.result='$B.$global_search("'+t+'", '+_+")",this.result}},$ImportCtx=$B.parser.$ImportCtx=function(e){this.type="import",this.parent=e,this.tree=[],e.tree[e.tree.length]=this,this.expect="id",this.toString=function(){return"import "+this.tree},this.transition=function(e,t){var r=this;switch(e){case"id":if("id"==r.expect)return new $ImportedModuleCtx(r,t),r.expect=",",r;if("qual"==r.expect)return r.expect=",",r.tree[r.tree.length-1].name+="."+t,r.tree[r.tree.length-1].alias+="."+t,r;if("alias"==r.expect)return r.expect=",",r.tree[r.tree.length-1].alias=t,r;break;case".":if(","==r.expect)return r.expect="qual",r;break;case",":if(","==r.expect)return r.expect="id",r;break;case"as":if(","==r.expect)return r.expect="alias",r;break;case"eol":if(","==r.expect)return r.bind_names(),$transition(r.parent,e)}$_SyntaxError(r,"token "+e+" after "+r)},this.bind_names=function(){var e=$get_scope(this);this.tree.forEach(function(t){if(t.name==t.alias){var r=t.name,n=r.split("."),s=r;n.length>1&&(s=n[0])}else s=t.alias;$bind(s,e,this)},this)},this.to_js=function(){this.js_processed=!0;var e=$get_scope(this),t=[],r=$get_module(this);return this.tree.forEach(function(n){for(var s=n.name,a=n.name==n.alias?"{}":'{"'+s+'" : "'+n.alias+'"}',i="$locals_"+e.id.replace(/\./g,"_"),o=n.name.split("."),_=0;_<o.length;_++)r.imports[o.slice(0,_+1).join(".")]=!0;var l='$B.$import("'+s+'", [],'+a+","+i+", true);";t.push(l)}),t.join("")+"None;"}},$ImportedModuleCtx=$B.parser.$ImportedModuleCtx=function(e,t){this.type="imported module",this.parent=e,this.name=t,this.alias=t,e.tree[e.tree.length]=this,this.toString=function(){return" (imported module) "+this.name},this.transition=function(e,t){},this.to_js=function(){return this.js_processed=!0,'"'+this.name+'"'}},$JSCode=$B.parser.$JSCode=function(e){this.js=e,this.toString=function(){return this.js},this.transition=function(e,t){},this.to_js=function(){return this.js_processed=!0,this.js}},$KwArgCtx=$B.parser.$KwArgCtx=function(e){this.type="kwarg",this.parent=e.parent,this.tree=[e.tree[0]],e.parent.tree.pop(),e.parent.tree.push(this),e.parent.parent.has_kw=!0;var t=this.tree[0].value,r=e.parent.parent;void 0===r.kwargs?r.kwargs=[t]:-1==r.kwargs.indexOf(t)?r.kwargs.push(t):$_SyntaxError(e,["keyword argument repeated"]),this.toString=function(){return"kwarg "+this.tree[0]+"="+this.tree[1]},this.transition=function(e,t){return","==e?new $CallArgCtx(this.parent.parent):$transition(this.parent,e)},this.to_js=function(){this.js_processed=!0;var e=this.tree[0].value;return"$$"==e.substr(0,2)&&(e=e.substr(2)),'{$nat:"kw",name:"'+e+'",'+"value:"+$to_js(this.tree.slice(1,this.tree.length))+"}"}},$LambdaCtx=$B.parser.$LambdaCtx=function(e){this.type="lambda",this.parent=e,e.tree[e.tree.length]=this,this.tree=[],this.args_start=$pos+6,this.vars=[],this.locals=[],this.node=$get_node(this),this.node.binding={},this.positional_list=[],this.default_list=[],this.other_args=null,this.other_kw=null,this.after_star=[],this.toString=function(){return"(lambda) "+this.args_start+" "+this.body_start},this.transition=function(e,t){var r=this;return":"==e&&void 0===r.args?(r.args=r.tree,r.tree=[],r.body_start=$pos,new $AbstractExprCtx(r,!1)):void 0!==r.args?(r.body_end=$pos,$transition(r.parent,e)):void 0===r.args&&"("!=e?$transition(new $FuncArgs(r),e,t):void $_SyntaxError(r,"token "+e+" after "+r)},this.to_js=function(){this.js_processed=!0;var t=this.node,r=$get_module(this),n=$get_src(e),s=n.substring(this.args_start,this.body_start),a=n.substring(this.body_start+1,this.body_end);a=(a=a.replace(/\\\n/g," ")).replace(/\n/g," ");var i=$get_scope(this),o=$B.UUID(),_="lambda_"+$B.lambda_magic+"_"+o,l="def "+_+"("+s+"):\n";l+=" return "+a;var c="lambda"+o,u=r.id.replace(/\./g,"_"),f=$B.py2js(l,u,c,i,t.line_num).to_js();return f="(function($locals_"+c+"){\n"+f+"\nreturn $locals."+_+"\n})({})",$B.clear_ns(c),$B.$py_src[c]=null,delete $B.$py_src[c],f}},$ListOrTupleCtx=$B.parser.$ListOrTupleCtx=function(e,t){this.type="list_or_tuple",this.start=$pos,this.real=t,this.expect="id",this.closed=!1,this.parent=e,this.tree=[],e.tree[e.tree.length]=this,this.toString=function(){switch(this.real){case"list":return"(list) ["+this.tree+"]";case"list_comp":case"gen_expr":return"("+this.real+") ["+this.intervals+"-"+this.tree+"]";default:return"(tuple) ("+this.tree+")"}},this.transition=function(e,t){var r=this;if(r.closed)return"["==e?new $AbstractExprCtx(new $SubCtx(r.parent),!1):"("==e?new $CallCtx(r.parent):$transition(r.parent,e,t);if(","==r.expect){switch(r.real){case"tuple":case"gen_expr":if(")"==e){for(var n=!0;"list_or_tuple"==r.type&&"tuple"==r.real&&"expr"==r.parent.type&&"node"==r.parent.parent.type&&1==r.tree.length;){n=!1;var s=r.parent.parent,a=s.tree.indexOf(r.parent);(o=r.tree[0]).parent=s,o.$in_parens=!0,s.tree.splice(a,1,o),r=o.tree[0]}return n&&r.close(),"gen_expr"==r.real&&r.intervals.push($pos),"packed"==r.parent.type?r.parent.parent:r.parent}break;case"list":case"list_comp":if("]"==e)return r.close(),"list_comp"==r.real&&r.intervals.push($pos),"packed"==r.parent.type?r.parent.tree.length>0?r.parent.tree[0]:r.parent.parent:r.parent;break;case"dict_or_set_comp":if("}"==e)return r.intervals.push($pos),$transition(r.parent,e)}switch(e){case",":return"tuple"==r.real&&(r.has_comma=!0),r.expect="id",r;case"for":"list"==r.real?r.real="list_comp":r.real="gen_expr",r.intervals=[r.start+1],r.expression=r.tree,r.tree=[];var i=new $ComprehensionCtx(r);return new $TargetListCtx(new $CompForCtx(i))}return $transition(r.parent,e,t)}if("id"!=r.expect)return $transition(r.parent,e,t);switch(r.real){case"tuple":if(")"==e)return r.close(),r.parent;if("eol"==e&&!0===r.implicit)return r.close(),$transition(r.parent,e);break;case"gen_expr":if(")"==e)return r.close(),$transition(r.parent,e);break;case"list":if("]"==e)return r.close(),r}switch(e){case"=":if("tuple"==r.real&&!0===r.implicit)return r.close(),r.parent.tree.pop(),(o=new $ExprCtx(r.parent,"tuple",!1)).tree=[r],r.parent=o,$transition(r.parent,e);break;case")":break;case"]":if("tuple"==r.real&&!0===r.implicit)return $transition(r.parent,e,t);break;case",":$_SyntaxError(r,"unexpected comma inside list");default:r.expect=",";var o=new $AbstractExprCtx(r,!1);return $transition(o,e,t)}},this.close=function(){this.closed=!0;for(var e=0,t=this.tree.length;e<t;e++){var r=this.tree[e];"expr"==r.type&&"list_or_tuple"==r.tree[0].type&&"tuple"==r.tree[0].real&&1==r.tree[0].tree.length&&","==r.tree[0].expect&&(this.tree[e]=r.tree[0].tree[0],this.tree[e].parent=this)}},this.is_comp=function(){switch(this.real){case"list_comp":case"gen_expr":case"dict_or_set_comp":return!0}return!1},this.get_src=function(){var e=$get_module(this).src,t=$get_scope(this);return void 0===t.comments?e:(t.comments.forEach(function(t){var r=t[0],n=t[1];e=e.substr(0,r)+" ".repeat(n+1)+e.substr(r+n+1)}),e)},this.bind_ids=function(e){this.tree.forEach(function(t){if("id"==t.type)$bind(t.value,e,this),t.bound=!0;else if("expr"==t.type&&"id"==t.tree[0].type)$bind(t.tree[0].value,e,this),t.tree[0].bound=!0;else if("expr"==t.type&&"packed"==t.tree[0].type){var r=t.tree[0].tree[0];"expr"==r.type&&"id"==r.tree[0].type&&($bind(r.tree[0].value,e,this),r.tree[0].bound=!0)}else("list_or_tuple"==t.type||"expr"==t.type&&"list_or_tuple"==t.tree[0].type)&&("expr"==t.type&&(t=t.tree[0]),t.bind_ids(e))},this)},this.packed_indices=function(){for(var e=[],t=0;t<this.tree.length;t++){var r=this.tree[t];"expr"==r.type&&("packed"==(r=r.tree[0]).type||"call"==r.type&&"packed"==r.func.type)&&e.push(t)}return e},this.unpack=function(e){for(var t,r="",n=0;n<this.tree.length;n++)t=e.indexOf(n)>-1?"_b_.list.$factory("+this.tree[n].to_js()+")":"["+this.tree[n].to_js()+"]",n>0&&(t=".concat("+t+")"),r+=t;return r},this.to_js=function(){this.js_processed=!0;var e=$get_scope(this),t=(e.id.replace(/\//g,"_"),0),r=(w=$get_module(this)).module;switch(this.real){case"list":return(k=this.packed_indices()).length>0?"$B.$list("+this.unpack(k)+")":"$B.$list(["+$to_js(this.tree)+"])";case"list_comp":case"gen_expr":case"dict_or_set_comp":for(var n=this.get_src(),s=[],a=[],i=new RegExp('"',"g"),o=w.comments,_=1;_<this.intervals.length;_++){for(var l=this.intervals[_-1],c=this.intervals[_],u=n.substring(l,c),f=o.length-1;f>=0;f--){var p=o[f];if(p[0]>l&&p[0]<c){t=p[0]-l;u=u.substr(0,t)+" ".repeat(p[1])+u.substr(t+p[1]+1)}}u=u.replace(/\\\n/g," "),a.push(u);var d=u.split("\n"),h=[];d.forEach(function(e){0!=e.replace(/ /g,"").length&&(e=(e=(e=e.replace(/\n/g," ")).replace(/\\/g,"\\\\")).replace(i,'\\"'),h.push('"'+e+'"'))}),s.push("["+h.join(",")+"]")}var $=$get_node(this).line_num;switch(this.real){case"list_comp":var m=$B.$list_comp(a),b=m[0],g=m[1],y="lc"+g,v=$pos,x=$+","+r,w=$B.py2js({src:b,is_comp:!0,line_info:x},r,y,e,1);$pos=v;var B=w.to_js();return w=null,$B.clear_ns(y),delete $B.$py_src[y],B="function($locals_"+y+"){"+(B+="return $locals_lc"+g+'["x'+g+'"]')+"})({$list_comp: true})",this.is_await&&(B="async "+B),"("+B;case"dict_or_set_comp":return 1==this.expression.length?$B.$gen_expr(r,e,a,$,!0):$B.$dict_comp(r,e,a,$)}return $B.$gen_expr(r,e,a,$);case"tuple":var k;return(k=this.packed_indices()).length>0?"$B.fast_tuple("+this.unpack(k)+")":1==this.tree.length&&void 0===this.has_comma?this.tree[0].to_js():"$B.fast_tuple(["+$to_js(this.tree)+"])"}}},$NodeCtx=$B.parser.$NodeCtx=function(e){this.node=e,e.C=this,this.tree=[],this.type="node";for(var t=null,r=e;r.parent&&"module"!=r.parent.type;){var n=!1;switch(r.parent.C.tree[0].type){case"def":case"class":case"generator":t=r.parent,n=!0}if(n)break;r=r.parent}null===t&&(t=r.parent||r),this.node.locals=clone(t.binding),this.scope=t,this.toString=function(){return"node "+this.tree},this.transition=function(e,t){var r=this;switch(e){case"id":case"imaginary":case"int":case"float":case"str":case"bytes":case"[":case"(":case"{":case"not":case"lambda":case".":var n=new $AbstractExprCtx(r,!0);return $transition(n,e,t);case"op":switch(t){case"*":case"+":case"-":case"~":n=new $AbstractExprCtx(r,!0);return $transition(n,e,t)}break;case"async":return new $AsyncCtx(r);case"await":return new $AbstractExprCtx(new $AwaitCtx(r),!0);case"class":return new $ClassCtx(r);case"continue":return new $ContinueCtx(r);case"__debugger__":return new $DebuggerCtx(r);case"break":return new $BreakCtx(r);case"def":return new $DefCtx(r);case"for":return new $TargetListCtx(new $ForExpr(r));case"if":case"while":return new $AbstractExprCtx(new $ConditionCtx(r,e),!1);case"elif":var s=$previous(r);return-1!=["condition"].indexOf(s.type)&&"while"!=s.token||$_SyntaxError(r,"elif after "+s.type),new $AbstractExprCtx(new $ConditionCtx(r,e),!1);case"else":s=$previous(r);return-1==["condition","except","for"].indexOf(s.type)&&$_SyntaxError(r,"else after "+s.type),new $SingleKwCtx(r,e);case"finally":s=$previous(r);return-1!=["try","except"].indexOf(s.type)||"single_kw"==s.type&&"else"==s.token||$_SyntaxError(r,"finally after "+s.type),new $SingleKwCtx(r,e);case"try":return new $TryCtx(r);case"except":s=$previous(r);return-1==["try","except"].indexOf(s.type)&&$_SyntaxError(r,"except after "+s.type),new $ExceptCtx(r);case"assert":return new $AbstractExprCtx(new $AssertCtx(r),"assert",!0);case"from":return new $FromCtx(r);case"import":return new $ImportCtx(r);case"global":return new $GlobalCtx(r);case"nonlocal":return new $NonlocalCtx(r);case"lambda":return new $LambdaCtx(r);case"pass":return new $PassCtx(r);case"raise":return new $AbstractExprCtx(new $RaiseCtx(r),!0);case"return":return new $AbstractExprCtx(new $ReturnCtx(r),!0);case"with":return new $AbstractExprCtx(new $WithCtx(r),!1);case"yield":return new $AbstractExprCtx(new $YieldCtx(r),!0);case"del":return new $AbstractExprCtx(new $DelCtx(r),!0);case"@":return new $DecoratorCtx(r);case"eol":return 0==r.tree.length?(r.node.parent.children.pop(),r.node.parent.C):r}$_SyntaxError(r,"token "+e+" after "+r)},this.to_js=function(){if(void 0!==this.js)return this.js;if(this.js_processed=!0,this.tree.length>1){var t=new $Node;new $NodeCtx(t).tree=[this.tree[1]],t.indent=e.indent+4,this.tree.pop(),e.add(t)}if(this.js="",this.tree[0]){var r="def"!=this.scope.ntype;if(this.tree[0].annotation)if(r){if("expr"==this.tree[0].type&&!this.tree[0].$in_parens&&"id"==this.tree[0].tree[0].type){var n="";return this.create_annotations&&(n+="$locals.__annotations__ = _b_.dict.$factory();"),n+"_b_.dict.$setitem($locals.__annotations__, '"+this.tree[0].tree[0].value+"', "+this.tree[0].annotation.to_js()+");"}"def"==this.tree[0].type?this.js=this.tree[0].annotation.to_js()+";":(this.js="",this.tree=[])}else"def"!=this.tree[0].type&&(this.tree=[]);else if("assign"==this.tree[0].type&&!this.tree[0].tree[0].$in_parens&&this.tree[0].tree[0].annotation){var s=this.tree[0].tree[0],a=this.tree[0].tree[1];if(this.create_annotations&&(this.js+="$locals.__annotations__ = _b_.dict.$factory();"),this.js+="var $value = "+a.to_js()+";",this.tree[0].tree.splice(1,1),new $RawJSCtx(this.tree[0],"$value"),!s.tree[0]||"id"!=s.tree[0].type||!r)return this.js+=$to_js(this.tree)+";",r&&(this.js+=s.annotation.to_js()),this.js;this.js+="_b_.dict.$setitem($locals.__annotations__, '"+s.tree[0].value+"', "+s.annotation.to_js()+");"}}return 0==e.children.length?this.js+=$to_js(this.tree)+";":this.js+=$to_js(this.tree),this.js}},$NodeJS=$B.parser.$NodeJS=function(e){var t=new $Node;return new $NodeJSCtx(t,e),t},$NodeJSCtx=$B.parser.$NodeJSCtx=function(e,t){this.node=e,e.C=this,this.type="node_js",this.tree=[t],this.toString=function(){return"js "+t},this.to_js=function(){return this.js_processed=!0,t}},$NonlocalCtx=$B.parser.$NonlocalCtx=function(e){this.type="nonlocal",this.parent=e,this.tree=[],this.names={},e.tree[e.tree.length]=this,this.expect="id",this.scope=$get_scope(this),this.scope.nonlocals=this.scope.nonlocals||{},void 0===this.scope.C&&$_SyntaxError(e,["nonlocal declaration not allowed at module level"]),this.toString=function(){return"nonlocal "+this.tree},this.add=function(t){"arg"==this.scope.binding[t]&&$_SyntaxError(e,["name '"+t+"' is parameter and nonlocal"]),this.names[t]=[!1,$pos],this.scope.nonlocals[t]=!0},this.transition=function(e,t){var r=this;switch(e){case"id":if("id"==r.expect)return new $IdCtx(r,t),r.add(t),r.expect=",",r;break;case",":if(","==r.expect)return r.expect="id",r;break;case"eol":if(","==r.expect)return $transition(r.parent,e)}$_SyntaxError(r,"token "+e+" after "+r)},this.transform=function(t,r){var n=this.scope.parent_block;if(void 0===n.C)$_SyntaxError(e,["no binding for nonlocal '"+$B.last(Object.keys(this.names))+"' found"]);else{for(;void 0!==n&&void 0!==n.C;){for(var s in this.names)void 0!==n.binding[s]&&(this.names[s]=[!0]);n=n.parent_block}for(var s in this.names)this.names[s][0]||(console.log("nonlocal error, C "+e),$pos=this.names[s][1],$_SyntaxError(e,["no binding for nonlocal '"+s+"' found"]))}},this.to_js=function(){return this.js_processed=!0,""}},$NotCtx=$B.parser.$NotCtx=function(e){this.type="not",this.parent=e,this.tree=[],e.tree[e.tree.length]=this,this.toString=function(){return"not ("+this.tree+")"},this.transition=function(e,t){var r=this;switch(e){case"in":return r.parent.parent.tree.pop(),new $ExprCtx(new $OpCtx(r.parent,"not_in"),"op",!1);case"id":case"imaginary":case"int":case"float":case"str":case"bytes":case"[":case"(":case"{":case".":case"not":case"lambda":var n=new $AbstractExprCtx(r,!1);return $transition(n,e,t);case"op":if("+"==t||"-"==t||"~"==t){n=new $AbstractExprCtx(r,!1);return $transition(n,e,t)}}return $transition(r.parent,e)},this.to_js=function(){return this.js_processed=!0,"!$B.$bool("+$to_js(this.tree)+")"}},$NumberCtx=$B.parser.$NumberCtx=function(e,t,r){this.type=e,this.value=r,this.parent=t,this.tree=[],t.tree[t.tree.length]=this,this.toString=function(){return e+" "+this.value},this.transition=function(e,t){var r=this;switch(e){case"id":case"imaginary":case"int":case"float":case"str":case"bytes":case"[":case"(":case"{":case"not":case"lambda":$_SyntaxError(r,"token "+e+" after "+r)}return $transition(r.parent,e,t)},this.to_js=function(){if(this.js_processed=!0,"int"==e){var t=parseInt(r[1],r[0]);return t>$B.min_int&&t<$B.max_int?t:'$B.long_int.$factory("'+r[1]+'", '+r[0]+")"}return"float"==e?/^\d+$/.exec(this.value)||/^\d+\.\d*$/.exec(this.value)?"(new Number("+this.value+"))":"_b_.float.$factory("+this.value+")":"imaginary"==e?"$B.make_complex(0,"+this.value+")":void 0}},$OpCtx=$B.parser.$OpCtx=function(e,t){if(this.type="op",this.op=t,this.parent=e.parent,this.tree=[e],this.scope=$get_scope(this),"expr"==e.type)if(["int","float","str"].indexOf(e.tree[0].type)>-1)this.left_type=e.tree[0].type;else if("id"==e.tree[0].type){var r=this.scope.binding[e.tree[0].value];r&&(this.left_type=r.type)}e.parent.tree.pop(),e.parent.tree.push(this),this.toString=function(){return"(op "+this.op+") ["+this.tree+"]"},this.transition=function(e,t){var r=this;if(void 0===r.op&&$_SyntaxError(r,["C op undefined "+r]),"unary"==r.op.substr(0,5)&&"eol"!=e&&("assign"==r.parent.type||"return"==r.parent.type)){r.parent.tree.pop();var n=new $ListOrTupleCtx(r.parent,"tuple");return n.tree.push(r),r.parent=n,n}switch(e){case"id":case"imaginary":case"int":case"float":case"str":case"bytes":case"[":case"(":case"{":case".":case"not":case"lambda":return $transition(new $AbstractExprCtx(r,!1),e,t);case"op":switch(t){case"+":case"-":case"~":return new $UnaryCtx(r,t)}default:"abstract_expr"==r.tree[r.tree.length-1].type&&$_SyntaxError(r,"token "+e+" after "+r)}return $transition(r.parent,e)},this.to_js=function(){this.js_processed=!0;var e={"==":"eq","!=":"ne",">=":"ge","<=":"le","<":"lt",">":"gt"};if(void 0!==e[this.op]){var t=e[this.op];if("expr"==this.tree[0].type&&"expr"==this.tree[1].type){var r=this.tree[0].tree[0],n=this.tree[1].tree[0],s=r.to_js(),a=n.to_js();switch(n.type){case"int":switch(r.type){case"int":return Number.isSafeInteger(r.value)&&Number.isSafeInteger(n.value)?s+this.op+a:"$B.$getattr("+this.tree[0].to_js()+',"__'+t+'__")('+this.tree[1].to_js()+")";case"str":switch(this.op){case"==":return"false";case"!=":return"true";default:return'$B.$TypeError("unorderable types: int() '+this.op+' str()")'}case"id":return"(typeof "+s+' == "number" ? '+s+this.op+a+' : $B.rich_comp("__'+t+'__",'+this.tree[0].to_js()+","+this.tree[1].to_js()+"))"}break;case"str":switch(r.type){case"str":return s+this.op+a;case"int":switch(this.op){case"==":return"false";case"!=":return"true";default:return'$B.$TypeError("unorderable types: str() '+this.op+' int()")'}case"id":return"(typeof "+s+' == "string" ? '+s+this.op+a+' : $B.rich_comp("__'+t+'__",'+this.tree[0].to_js()+","+this.tree[1].to_js()+"))"}break;case"id":if("id"==r.type)return"typeof "+s+'!="object" && typeof '+s+'!="function" && typeof '+s+" == typeof "+a+" ? "+s+this.op+a+' : $B.rich_comp("__'+t+'__",'+this.tree[0].to_js()+","+this.tree[1].to_js()+")"}}}switch(this.op){case"and":var i=this.tree[0].to_js(),o=this.tree[1].to_js();return void 0!==this.wrap?"(function(){var "+this.wrap.name+" = "+this.wrap.js+";return $B.$test_expr($B.$test_item("+i+") && $B.$test_item("+o+"))})()":"$B.$test_expr($B.$test_item("+i+")&&$B.$test_item("+o+"))";case"or":return(y="$B.$test_expr($B.$test_item("+this.tree[0].to_js()+")||")+"$B.$test_item("+this.tree[1].to_js()+"))";case"in":return"$B.$is_member("+$to_js(this.tree)+")";case"not_in":return"!$B.$is_member("+$to_js(this.tree)+")";case"unary_neg":case"unary_pos":case"unary_inv":if("unary_neg"==this.op?(c="-",t="__neg__"):"unary_pos"==this.op?(c="+",t="__pos__"):(c="~",t="__invert__"),"expr"==this.tree[1].type){var _=this.tree[1].tree[0];switch(_.type){case"int":var l=parseInt(_.value[1],_.value[0]);return Number.isSafeInteger(l)?c+l:"$B.$getattr("+_.to_js()+', "'+t+'")()';case"float":return"float.$factory("+c+_.value+")";case"imaginary":return"$B.make_complex(0,"+c+_.value+")"}}return"$B.$getattr("+this.tree[1].to_js()+',"'+t+'")()';case"is":return"$B.$is("+this.tree[0].to_js()+", "+this.tree[1].to_js()+")";case"is_not":return this.tree[0].to_js()+"!=="+this.tree[1].to_js();case"+":return"$B.add("+this.tree[0].to_js()+", "+this.tree[1].to_js()+")";case"*":case"-":var c=this.op,u=[],f=!1,p=$get_scope(this);function d(e,t){var r;return["int","float","str"].indexOf(t.type)>-1?r=t.type:"id"==t.type&&e[t.value]&&(r=e[t.value].type),r}var h=this.tree[0],$=this.tree[1];if(function e(t){if("expr"==t.type&&"int"==t.tree[0].type)return!0;if("expr"==t.type&&"float"==t.tree[0].type)return f=!0,!0;if("expr"==t.type&&"list_or_tuple"==t.tree[0].type&&"tuple"==t.tree[0].real&&1==t.tree[0].tree.length&&"expr"==t.tree[0].tree[0].type)return e(t.tree[0].tree[0].tree[0]);if("expr"==t.type&&"id"==t.tree[0].type){var r=t.tree[0].to_js();return-1==u.indexOf(r)&&u.push(r),!0}if("op"==t.type&&["*","+","-"].indexOf(t.op)>-1){for(var n=0;n<t.tree.length;n++)if(!e(t.tree[n]))return!1;return!0}return!1}(this)){var m=this.tree[0].tree[0],b=this.tree[1].tree[0];if(0!=u.length||f){if(0==u.length)return"new Number("+this.simple_js()+")";var g=p.binding;r=d(g,m),n=d(g,b);if("float"==r&&"float"==n||"+"==this.op&&"str"==r&&"str"==n)return this.result_type=r,m.to_js()+this.op+b.to_js();if(["int","float"].indexOf(r)>-1&&["int","float"].indexOf(n)>-1)switch(this.result_type="int"==r&&"int"==n?"int":"float",this.op){case"-":return"$B.sub("+m.to_js()+","+b.to_js()+")";case"*":return"$B.mul("+m.to_js()+","+b.to_js()+")"}var y,v=[],x=[];u.forEach(function(e){v.push("typeof "+e+'.valueOf() == "number"'),x.push("typeof "+e+' == "number"')}),(y=[v.join(" && ")+" ? "]).push("("+x.join(" && ")+" ? "),y.push(this.simple_js()),y.push(" : new Number("+this.simple_js()+")"),y.push(")");r=this.tree[0].to_js(),n=this.tree[1].to_js();return"+"==this.op&&y.push(" : (typeof "+r+' == "string" && typeof '+n+' == "string") ? '+r+"+"+n),y.push(': $B.rich_op("'+$operators[this.op]+'",'+r+","+n+")"),"("+y.join("")+")"}return this.simple_js()}return void 0!==e[this.op]?'$B.rich_comp("__'+$operators[this.op]+'__",'+h.to_js()+","+$.to_js()+")":'$B.rich_op("'+$operators[this.op]+'", '+h.to_js()+", "+$.to_js()+")";default:return void 0!==e[this.op]?'$B.rich_comp("__'+$operators[this.op]+'__",'+this.tree[0].to_js()+","+this.tree[1].to_js()+")":'$B.rich_op("'+$operators[this.op]+'", '+this.tree[0].to_js()+", "+this.tree[1].to_js()+")"}},this.simple_js=function(){function e(e){return"op"==e.type?e.simple_js():"expr"==e.type&&"list_or_tuple"==e.tree[0].type&&"tuple"==e.tree[0].real&&1==e.tree[0].tree.length&&"expr"==e.tree[0].tree[0].type?"("+e.tree[0].tree[0].tree[0].simple_js()+")":e.tree[0].to_js()}return"+"==t?"$B.add("+e(this.tree[0])+","+e(this.tree[1])+")":"-"==t?"$B.sub("+e(this.tree[0])+","+e(this.tree[1])+")":"*"==t?"$B.mul("+e(this.tree[0])+","+e(this.tree[1])+")":"/"==t?"$B.div("+e(this.tree[0])+","+e(this.tree[1])+")":e(this.tree[0])+t+e(this.tree[1])}},$PackedCtx=$B.parser.$PackedCtx=function(e){if(this.type="packed","list_or_tuple"==e.parent.type&&"node"==e.parent.parent.type)for(var t=0;t<e.parent.tree.length;t++){var r=e.parent.tree[t];"expr"==r.type&&r.tree.length>0&&"packed"==r.tree[0].type&&$_SyntaxError(e,["two starred expressions in assignment"])}this.parent=e,this.tree=[],e.tree[e.tree.length]=this,this.toString=function(){return"(packed) "+this.tree},this.transition=function(e,t){var r=this;if(r.tree.length>0&&"["==e)return $transition(r.tree[0],e,t);if("id"==e){var n=new $AbstractExprCtx(r,!1);return n.packed=!0,r.parent.expect=",",$transition(n,e,t)}return"["==e?(r.parent.expect=",",new $ListOrTupleCtx(r,"list")):"("==e?(r.parent.expect=",",new $ListOrTupleCtx(r,"tuple")):"]"==e?$transition(r.parent,e,t):"{"==e?(r.parent.expect=",",new $DictOrSetCtx(r)):r.parent.transition(e,r)},this.to_js=function(){return this.js_processed=!0,$to_js(this.tree)}},$PassCtx=$B.parser.$PassCtx=function(e){this.type="pass",this.parent=e,this.tree=[],e.tree[e.tree.length]=this,this.toString=function(){return"(pass)"},this.transition=function(e,t){var r=this;if("eol"==e)return r.parent;$_SyntaxError(r,"token "+e+" after "+r)},this.to_js=function(){return this.js_processed=!0,"void(0)"}},$RaiseCtx=$B.parser.$RaiseCtx=function(e){this.type="raise",this.parent=e,this.tree=[],e.tree[e.tree.length]=this,this.toString=function(){return" (raise) "+this.tree},this.transition=function(e,t){var r=this;switch(e){case"id":if(0==r.tree.length)return new $IdCtx(new $ExprCtx(r,"exc",!1),t);break;case"from":if(r.tree.length>0)return new $AbstractExprCtx(r,!1);break;case"eol":return $transition(r.parent,e)}$_SyntaxError(r,"token "+e+" after "+r)},this.to_js=function(){this.js_processed=!0;return 0==this.tree.length?"$B.$raise()":"$B.$raise("+this.tree[0].to_js()+")"}},$RawJSCtx=$B.parser.$RawJSCtx=function(e,t){this.type="raw_js",e.tree[e.tree.length]=this,this.parent=e,this.toString=function(){return"(js) "+t},this.transition=function(e,t){},this.to_js=function(){return this.js_processed=!0,t}},$ReturnCtx=$B.parser.$ReturnCtx=function(e){this.type="return",this.parent=e,this.tree=[],e.tree[e.tree.length]=this,this.scope=$get_scope(this),-1==["def","generator"].indexOf(this.scope.ntype)&&$_SyntaxError(e,["'return' outside function"]);for(var t=this.node=$get_node(this);t.parent;){if(t.parent.C){var r=t.parent.C.tree[0];if("for"==r.type){r.has_return=!0;break}"try"==r.type?r.has_return=!0:"single_kw"==r.type&&"finally"==r.token&&(r.has_return=!0)}t=t.parent}this.toString=function(){return"return "+this.tree},this.transition=function(e,t){return $transition(this.parent,e)},this.to_js=function(){this.js_processed=!0,1==this.tree.length&&"abstract_expr"==this.tree[0].type&&(this.tree.pop(),new $IdCtx(new $ExprCtx(this,"rvalue",!1),"None"));var e=this.scope;if("generator"==e.ntype)return"return [$B.generator_return("+$to_js(this.tree)+")]";var t=" ".repeat(this.node.indent+1),r="var $res = "+$to_js(this.tree)+";\n"+t+"if($locals.$f_trace !== _b_.None){$B.trace_return($res)}\n"+t+"$B.leave_frame";return"$exec_"==e.id.substr(0,6)&&(r+="_exec"),r+='("'+e.id+'");\n'+t+"return $res"}},$SingleKwCtx=$B.parser.$SingleKwCtx=function(e,t){if(this.type="single_kw",this.token=t,this.parent=e,this.tree=[],e.tree[e.tree.length]=this,"else"==t){for(var r=e.node,n=r.parent,s=0;s<n.children.length&&n.children[s]!==r;s++);var a=n.children[s-1].C;if(a.tree.length>0){var i=a.tree[0];("for"==i.type||"asyncfor"==i.type||"condition"==i.type&&"while"==i.token)&&(i.has_break=!0,i.else_node=$get_node(this),this.loop_num=i.loop_num)}}this.toString=function(){return this.token},this.transition=function(e,t){var r=this;if(":"==e)return $BodyCtx(r);$_SyntaxError(r,"token "+e+" after "+r)},this.transform=function(e,t){if("finally"==this.token){var r=$get_scope(this);if("generator"!=r.ntype){e.insert(0,$NodeJS("var $exit;if($B.frames_stack.length<$stack_length){$exit = true;$B.frames_stack.push($top_frame)}"));r.id.replace(/\./g,"_");"return"!=e.children[e.children.length-1].C.tree[0].type&&e.add($NodeJS("if($exit){$B.leave_frame()}"))}}},this.to_js=function(){return this.js_processed=!0,"finally"==this.token?this.token:void 0!==this.loop_num?"if($locals_"+$get_scope(this).id.replace(/\./g,"_")+'["$no_break'+this.loop_num+'"])':this.token}},$SliceCtx=$B.parser.$SliceCtx=function(e){this.type="slice",this.parent=e,this.tree=e.tree.length>0?[e.tree.pop()]:[],e.tree.push(this),this.transition=function(e,t){return":"==e?new $AbstractExprCtx(this,!1):$transition(this.parent,e,t)},this.to_js=function(){for(var e=0;e<this.tree.length;e++)"abstract_expr"==this.tree[e].type&&(this.tree[e].to_js=function(){return"None"});return"slice.$factory("+$to_js(this.tree)+")"}},$StarArgCtx=$B.parser.$StarArgCtx=function(e){this.type="star_arg",this.parent=e,this.tree=[],e.tree[e.tree.length]=this,this.toString=function(){return"(star arg) "+this.tree},this.transition=function(e,t){var r=this;switch(e){case"id":return"target_list"==r.parent.type?(r.tree.push(t),r.parent.expect=",",r.parent):$transition(new $AbstractExprCtx(r,!1),e,t);case"imaginary":case"int":case"float":case"str":case"bytes":case"[":case"(":case"{":case"not":case"lambda":return $transition(new $AbstractExprCtx(r,!1),e,t);case",":case")":return 0==r.tree.length&&$_SyntaxError(r,"unnamed star argument"),$transition(r.parent,e);case":":if("lambda"==r.parent.parent.type)return $transition(r.parent.parent,e)}$_SyntaxError(r,"token "+e+" after "+r)},this.to_js=function(){return this.js_processed=!0,'{$nat:"ptuple",arg:'+$to_js(this.tree)+"}"}},$StringCtx=$B.parser.$StringCtx=function(e,t){this.type="str",this.parent=e,this.tree=[t],e.tree[e.tree.length]=this,this.raw=!1,this.toString=function(){return"string "+(this.tree||"")},this.transition=function(e,t){var r=this;switch(e){case"[":return new $AbstractExprCtx(new $SubCtx(r.parent),!1);case"(":return r.parent.tree[0]=r,new $CallCtx(r.parent);case"str":return r.tree.push(t),r}return $transition(r.parent,e,t)},this.to_js=function(){this.js_processed=!0;var e="",t=null,r=$get_scope(this),n=!1;function s(e){for(var t=0;t<e.length;t++){try{code=e.charCodeAt(t)}catch(t){throw console.log("err for s",e),t}if(code>=55296&&code<=56319)return!0}return!1}function a(e){for(var t=[],i=0;i<e.length;i++)if("expression"==e[i].type){for(var o=e[i].expression,_=0,l=[],c=[o];_<o.length;){var u=o.charAt(_);if(":"==u&&0==l.length){c=[o.substr(0,_),o.substr(_+1)];break}"{[(".indexOf(u)>-1?l.push(u):")]}".indexOf(u)>-1&&l.pop(),_++}o=c[0];var f=$pos,p=$B.py2js(o,r.module,r.id,r);p.to_js(),$pos=f;for(var d=0;d<p.children.length;d++){var h=p.children[d];if(h.C.tree&&1==h.C.tree.length&&"try"==h.C.tree[0]){for(var $=0;$<h.children.length;$++)if(!h.children[$].is_line_num){for(var m=h.children[$].js;"\n;".indexOf(m.charAt(m.length-1))>-1;)m=m.substr(0,m.length-1);break}break}}switch(e[i].conversion){case"a":m="$B.builtins.ascii("+m+")";break;case"r":m="$B.builtins.repr("+m+")";break;case"s":m="$B.builtins.str.$factory("+m+")"}var b=c[1];if(void 0!==b){var g=$B.parse_fstring(b),y="$B.builtins.str.format('{0:' + "+(b=g.length>1?a(g):"'"+b+"'")+" + '}', "+m+")";t.push(y)}else null===e[i].conversion&&(m="$B.builtins.str.$factory("+m+")"),t.push(m)}else{var v=new RegExp("'","g"),x=e[i].replace(v,"\\'").replace(/\n/g,"\\n");n=n||s(x),t.push("'"+x+"'")}return t.join(" + ")}function i(e){return e=(e=e.replace(/\n/g,"\\n\\\n")).replace(/\\U([A-Fa-f0-9]{8})/gm,function(e){return String.fromCharCode("0x"+e.slice(2))})}for(var o=0;o<this.tree.length;o++){if("call"==this.tree[o].type){return"(function(){throw TypeError.$factory(\"'str' object is not callable\")}())"}var _=this.tree[o],l=Array.isArray(_),c=!1;if(l||(c="b"==_.charAt(0)),null==t)t=c,c&&(e+="bytes.$factory(");else if(t!=c)return'$B.$TypeError("can\'t concat bytes to str")';c?e+=i(_.substr(1)):l?e+=a(_):(n=n||s(_),e+=i(_)),o<this.tree.length-1&&(e+="+")}return c&&(e+=',"ISO-8859-1")'),0==e.length&&(e='""'),n&&(e="_b_.str.$surrogate.$factory("+e+")"),e}},$SubCtx=$B.parser.$SubCtx=function(e){this.type="sub",this.func="getitem",this.value=e.tree[0],e.tree.pop(),e.tree[e.tree.length]=this,this.parent=e,this.tree=[],this.toString=function(){return"(sub) (value) "+this.value+" (tree) "+this.tree},this.transition=function(e,t){var r=this;switch(e){case"id":case"imaginary":case"int":case"float":case"str":case"bytes":case"[":case"(":case"{":case".":case"not":case"lambda":var n=new $AbstractExprCtx(r,!1);return $transition(n,e,t);case"]":if(r.parent.packed)return r.parent.tree[0];if(r.tree[0].tree.length>0)return r.parent;break;case":":return new $AbstractExprCtx(new $SliceCtx(r),!1);case",":return new $AbstractExprCtx(r,!1)}$_SyntaxError(r,"token "+e+" after "+r)},this.to_js=function(){if(this.js_processed=!0,"getitem"==this.func&&"id"==this.value.type){var e=$get_node(this).locals[this.value.value],t=this.value.to_js();if("list"==e||"tuple"==e){if(1==this.tree.length)return"$B.list_key("+t+", "+this.tree[0].to_js()+")";if(2==this.tree.length)return"$B.list_slice("+t+", "+(this.tree[0].to_js()||"null")+","+(this.tree[1].to_js()||"null")+")";if(3==this.tree.length)return"$B.list_slice_step("+t+", "+(this.tree[0].to_js()||"null")+","+(this.tree[1].to_js()||"null")+","+(this.tree[2].to_js()||"null")+")"}}if("getitem"==this.func&&1==this.tree.length)return"$B.$getitem("+this.value.to_js()+","+this.tree[0].to_js()+")";var r="",n=!1;if("delitem"!==this.func&&1==this.tree.length&&!this.in_sub){var s="",a=this;for(n=!0;"sub"==a.value.type;)s+="["+a.tree[0].to_js()+"]",a.value.in_sub=!0,a=a.value;var i=a.value.to_js()+"["+a.tree[0].to_js()+"]((Array.isArray("+a.value.to_js()+") || typeof "+a.value.to_js()+' == "string") && '+i+" !== undefined ?"+i+s+" : "}if(r+="$B.$getattr("+(t=this.value.to_js())+',"__'+this.func+'__")(',1==this.tree.length)r+=this.tree[0].to_js()+")";else{var o=[];this.tree.forEach(function(e){"abstract_expr"==e.type?o.push("None"):o.push(e.to_js())}),r+="tuple.$factory(["+o.join(",")+"]))"}return n?r+")":r}},$TargetListCtx=$B.parser.$TargetListCtx=function(e){this.type="target_list",this.parent=e,this.tree=[],this.expect="id",e.tree[e.tree.length]=this,this.toString=function(){return"(target list) "+this.tree},this.transition=function(e,t){var r=this;switch(e){case"id":if("id"==r.expect)return r.expect=",",new $IdCtx(new $ExprCtx(r,"target",!1),t);case"op":if("id"==r.expect&&"*"==t)return new $PackedCtx(r);case"(":case"[":if("id"==r.expect)return r.expect=",",new $ListOrTupleCtx(r,"("==e?"tuple":"list");case")":case"]":if(","==r.expect)return r.parent;case",":if(","==r.expect)return r.expect="id",r}return","==r.expect?$transition(r.parent,e,t):"in"==e?$transition(r.parent,e,t):void $_SyntaxError(r,"token "+e+" after "+r)},this.to_js=function(){return this.js_processed=!0,$to_js(this.tree)}},$TernaryCtx=$B.parser.$TernaryCtx=function(e){this.type="ternary",this.parent=e.parent,e.parent.tree.pop(),e.parent.tree.push(this),e.parent=this,this.tree=[e],this.toString=function(){return"(ternary) "+this.tree},this.transition=function(e,t){var r=this;if("else"==e)return r.in_else=!0,new $AbstractExprCtx(r,!1);if(r.in_else){if(","==e&&["assign","augm_assign","node","return"].indexOf(r.parent.type)>-1){r.parent.tree.pop();var n=new $ListOrTupleCtx(r.parent,"tuple");return n.implicit=!0,n.tree[0]=r,r.parent=n,n.expect="id",n}}else $_SyntaxError(r,"token "+e+" after "+r);return $transition(r.parent,e,t)},this.to_js=function(){this.js_processed=!0;var e="$B.$bool("+this.tree[1].to_js()+") ? ";return(e+=this.tree[0].to_js()+" : ")+this.tree[2].to_js()}},$TryCtx=$B.parser.$TryCtx=function(e){this.type="try",this.parent=e,e.tree[e.tree.length]=this,this.toString=function(){return"(try) "},this.transition=function(e,t){var r=this;if(":"==e)return $BodyCtx(r);$_SyntaxError(r,"token "+e+" after "+r)},this.transform=function(t,r){if(t.parent.children.length==r+1)$_SyntaxError(e,["unexpected EOF while parsing"]);else switch(t.parent.children[r+1].C.tree[0].type){case"except":case"finally":case"single_kw":break;default:$_SyntaxError(e,"no clause after try")}var n=$get_scope(this),s=create_temp_name("$err"),a="$locals."+create_temp_name("$failed"),i=a+" = false;\n"+" ".repeat(t.indent+4)+"try";new $NodeJSCtx(t,i),t.is_try=!0,t.has_return=this.has_return;var o=$NodeJS("catch("+s+")");o.is_catch=!0,t.parent.insert(r+1,o),o.add($NodeJS("$B.set_exc("+s+")")),o.add($NodeJS("if($locals.$f_trace !== _b_.None){$locals.$f_trace = $B.trace_exception()}")),o.add($NodeJS(a+" = true;$B.pmframe = $B.last($B.frames_stack);if(false){}"));for(var _=r+2,l=!1,c=!1,u=!1;_!=t.parent.children.length;){if(void 0===($=t.parent.children[_].C.tree[0]))break;if("except"==$.type){if(c&&$_SyntaxError(e,"'except' or 'finally' after 'else'"),u&&$_SyntaxError(e,"'except' after 'finally'"),$.error_name=s,$.tree.length>0&&null!==$.tree[0].alias&&void 0!==$.tree[0].alias){var f=$.tree[0].alias;t.parent.children[_].insert(0,$NodeJS('$locals["'+f+'"] = $B.exception('+s+")"))}o.insert(o.children.length,t.parent.children[_]),0==$.tree.length&&(l&&$_SyntaxError(e,"more than one except: line"),l=!0),t.parent.children.splice(_,1)}else if("single_kw"==$.type&&"finally"==$.token){u=!0;var p=t.parent.children[_];_++}else{if("single_kw"!=$.type||"else"!=$.token)break;c&&$_SyntaxError(e,"more than one 'else'"),u&&$_SyntaxError(e,"'else' after 'finally'"),c=!0;var d=t.parent.children[_];t.parent.children.splice(_,1)}}if(!l){var h=new $Node,$=new $NodeCtx(h);o.insert(o.children.length,h),new $SingleKwCtx($,"else"),h.add($NodeJS("throw "+s))}if(c){var m=new $Node;m.module=n.module,new $NodeJSCtx(m,"if(!"+a+")"),d.children.forEach(function(e){m.add(e)}),u?p.insert(0,m):t.parent.insert(_,m),_++}$loop_num++},this.to_js=function(){return this.js_processed=!0,"try"}},$UnaryCtx=$B.parser.$UnaryCtx=function(e,t){this.type="unary",this.op=t,this.parent=e,e.tree[e.tree.length]=this,this.toString=function(){return"(unary) "+this.op},this.transition=function(e,t){var r=this;switch(e){case"int":case"float":case"imaginary":var n=r.parent;return r.parent.parent.tree.pop(),"-"==r.op?t="-"+t:"~"==r.op&&(t=~t),$transition(r.parent.parent,e,t);case"id":r.parent.parent.tree.pop();n=new $ExprCtx(r.parent.parent,"call",!1);var s=new $ExprCtx(n,"id",!1);new $IdCtx(s,t);var a=new $AttrCtx(n);return"+"==r.op?a.name="__pos__":"-"==r.op?a.name="__neg__":a.name="__invert__",s;case"op":if("+"==t||"-"==t)return r.op===t?r.op="+":r.op="-",r}return $transition(r.parent,e,t)},this.to_js=function(){return this.js_processed=!0,this.op}},$WithCtx=$B.parser.$WithCtx=function(e){this.type="with",this.parent=e,e.tree[e.tree.length]=this,this.tree=[],this.expect="as",this.scope=$get_scope(this),this.toString=function(){return"(with) "+this.tree},this.transition=function(e,t){var r=this;switch(e){case"id":if("id"==r.expect)return r.expect="as",$transition(new $AbstractExprCtx(r,!1),e,t);$_SyntaxError(r,"token "+e+" after "+r);case"as":return new $AbstractExprCtx(new $AliasCtx(r));case":":switch(r.expect){case"id":case"as":case":":return $BodyCtx(r)}break;case"(":if("id"==r.expect&&0==r.tree.length)return r.parenth=!0,r;if("alias"==r.expect)return r.expect=":",new $TargetListCtx(r,!1);break;case")":if(","==r.expect||"as"==r.expect)return r.expect=":",r;break;case",":if(void 0!==r.parenth&&void 0===r.has_alias&&(","==r.expect||"as"==r.expect))return r.expect="id",r;if("as"==r.expect)return r.expect="id",r;if(":"==r.expect)return r.expect="id",r}$_SyntaxError(r,"token "+e+" after "+r.expect)},this.set_alias=function(e){var t=[];"id"==e.type?t=[e]:"list_or_tuple"==e.type&&e.tree.forEach(function(e){"expr"==e.type&&"id"==e.tree[0].type&&t.push(e.tree[0])});for(var r=0,n=t.length;r<n;r++){var s=t[r];$bind(s.value,this.scope,this),s.bound=!0,"module"!==this.scope.ntype&&this.scope.C.tree[0].locals.push(s.value)}},this.transform=function(t,r){for(;this.tree.length>1;){var n=t.children,s=this.tree.pop(),a=new $Node,i=new $NodeCtx(a),o=new $WithCtx(i);s.parent=o,o.tree=[s],o.async=this.async,n.forEach(function(e){a.add(e)}),t.children=[a]}if(!this.transformed){if(this.prefix="","generator"==this.scope.ntype&&(this.prefix="$locals."),this.tree.length>1){var _=new $Node;i=new $NodeCtx(_);_.parent=t,_.module=t.module,_.indent=t.indent+4;var l=new $WithCtx(i);return l.async=this.async,l.tree=this.tree.slice(1),t.children.forEach(function(e){_.add(e)}),t.children=[_],void(this.transformed=!0)}if(this.async)return this.transform_async(t,r);var c=$NodeJS("try");c.is_try=!0,t.parent.insert(r+1,c);var u=this.num=$loop_num++;if(c.ctx_manager_num=u,this.cm_name=this.prefix+"$ctx_manager"+u,this.cmexit_name=this.prefix+"$ctx_manager_exit"+u,this.exc_name=this.prefix+"$exc"+u,this.err_name="$err"+u,this.val_name="$value"+u,this.yield_name=this.prefix+"$yield"+u,null===this.tree[0].alias&&(this.tree[0].alias="$temp"),"expr"==this.tree[0].type&&"list_or_tuple"==this.tree[0].tree[0].type){"expr"==this.tree[1].type&&"list_or_tuple"==this.tree[1].tree[0].type||$_SyntaxError(e),this.tree[0].tree[0].tree.length!=this.tree[1].tree[0].tree.length&&$_SyntaxError(e,["wrong number of alias"]);var f=this.tree[0].tree[0].tree,p=this.tree[1].tree[0].tree;this.tree.shift(),this.tree.shift();for(var d=f.length-1;d>=0;d--)f[d].alias=p[d].value,this.tree.splice(0,0,f[d])}var h=t.children;t.children=[];var $=new $Node;if($.is_try=!0,new $NodeJSCtx($,"try"),c.add($),this.tree[0].alias){p=this.tree[0].alias.tree[0].tree[0].value;$.add($NodeJS('$locals["'+p+'"] = '+this.val_name))}h.forEach(function(e){$.add(e)}),"generator"==this.scope.ntype&&$.add($NodeJS(this.yield_name+" = false"));var m=new $Node;m.is_catch=!0,new $NodeJSCtx(m,"catch("+this.err_name+")");var b=this.exc_name+" = false;"+this.err_name+" = $B.exception("+this.err_name+", true)\n"+" ".repeat(t.indent+4)+"var $b = "+this.cmexit_name+"("+this.err_name+".__class__,"+this.err_name+",$B.$getattr("+this.err_name+', "__traceback__"));';"generator"==this.scope.ntype&&(b+="$B.set_cm_in_generator("+this.cmexit_name+");"),b+="if(!$B.$bool($b)){throw "+this.err_name+"}",m.add($NodeJS(b)),c.add(m);var g=new $Node;new $NodeJSCtx(g,"finally"),g.C.type="single_kw",g.C.token="finally",g.C.in_ctx_manager=!0,g.is_except=!0,g.in_ctx_manager=!0;b="if("+this.exc_name;"generator"==this.scope.ntype&&(b+=" && (!"+this.yield_name+") && "+this.cmexit_name),b+="){"+this.cmexit_name+"(None,None,None);","generator"==this.scope.ntype&&(b+="delete "+this.cmexit_name),b+="};",g.add($NodeJS(b)),t.parent.insert(r+2,g),this.transformed=!0}},this.transform_async=function(e,t){$get_scope(this);var r=this.tree[0],n=this.tree[0].alias,s=[],a=this.num=$loop_num++;this.cm_name="$ctx_manager"+a,this.cmexit_name="$ctx_manager_exit"+a,this.exc_name="$exc"+a;var i="$ctx_mgr_type"+a,o="$ctx_manager_enter"+a,_="$err"+a,l="var "+this.cm_name+" = "+r.to_js()+",";if(s.push($NodeJS(l)),s.push($NodeJS(" "+i+" = _b_.type.$factory("+this.cm_name+"),")),s.push($NodeJS(" "+this.cmexit_name+" = $B.$call($B.$getattr("+i+', "__aexit__")),')),s.push($NodeJS(" "+o+" = $B.$call($B.$getattr("+i+', "__aenter__"))('+this.cm_name+"),")),s.push($NodeJS(" "+this.exc_name+" = false")),l="",n)if("list_or_tuple"!=n.tree[0].tree[0].type){l=n.tree[0].to_js()+" = await ($B.promise("+o+"))";s.push($NodeJS(l))}else{var c=new $Node,u=new $NodeCtx(c);(r=new $ExprCtx(u,"left",!1)).tree.push(n.tree[0].tree[0]),n.tree[0].tree[0].parent=r;var f=new $AssignCtx(r);new $RawJSCtx(f,"await ($B.promise("+o+"))"),s.push(c)}else s.push($NodeJS("await ($B.promise("+o+"))"));var p=new $NodeJS("try");e.children.forEach(function(e){p.add(e)}),s.push(p);var d=new $NodeJS("catch(err)");s.push(d),d.add($NodeJS(this.exc_name+" = true")),d.add($NodeJS("var "+_+' = $B.imported["_sys"].exc_info()'));var h=$NodeJS("if(! await ($B.promise("+this.cmexit_name+"("+this.cm_name+", "+_+"[0], "+_+"[1], "+_+"[2]))))");d.add(h),h.add($NodeJS("$B.$raise()"));var $=$NodeJS("if(! "+this.exc_name+")");s.push($),$.add($NodeJS("await ($B.promise("+this.cmexit_name+"("+this.cm_name+", _b_.None, _b_.None, _b_.None)))")),e.parent.children.splice(t,1);for(var m=s.length-1;m>=0;m--)e.parent.insert(t,s[m]);return e.children=[],0},this.to_js=function(){this.js_processed=!0;var e=$get_node(this).indent,t=" ".repeat(e),r=this.num,n=""==this.prefix?"var ":this.prefix,s="$ctx_manager"+r,a=n+"$ctx_manager_exit"+r,i=n+"$exc"+r,o="$value"+r;return"var "+s+" = "+this.tree[0].to_js()+"\n"+t+a+" = $B.$getattr("+s+',"__exit__")\n'+t+"var "+o+" = $B.$getattr("+s+',"__enter__")()\n'+t+i+" = true\n"}},$YieldCtx=$B.parser.$YieldCtx=function(e,t){this.type="yield",this.parent=e,this.tree=[],e.tree[e.tree.length]=this;for(var r=!1,n=e;n;){if("lambda"==n.type){r=!0;break}n=n.parent}if(!r)switch(e.type){case"node":break;case"assign":case"list_or_tuple":$get_node(e).yield_atoms.push(this);break;default:$_SyntaxError(e,"yield atom must be inside ()")}var s=this.scope=$get_scope(this,!0);if(!r){var a=s.is_function,i=s;if(!a&&s.is_comp){for(n=s.parent_block;n.is_comp;)n=parent_block;a=n.is_function,i=n}a||$_SyntaxError(e,["'yield' outside function"])}if(!r){var o=i.C.tree[0];t||(o.type="generator",i.ntype="generator"),o.yields.push(this)}this.toString=function(){return"(yield) "+(this.from?"(from) ":"")+this.tree},this.transition=function(e,t){var r=this;return"from"==e?("abstract_expr"!=r.tree[0].type&&$_SyntaxError(r,"'from' must follow 'yield'"),r.from=!0,$add_yield_from_code(r),r.tree[0]):$transition(r.parent,e)},this.transform=function(e,t){var r=$NodeJS("// placeholder for generator sent value");r.is_set_yield_value=!0,r.line_num=e.line_num,r.after_yield=!0,r.indent=e.indent,e.parent.insert(t+1,r);for(var n=e.parent;n;){if(void 0!==n.ctx_manager_num){e.parent.insert(t+1,$NodeJS("$top_frame[1].$has_yield_in_cm = true"));break}n=n.parent}},this.to_js=function(){return this.js_processed=!0,void 0===this.from?$to_js(this.tree)||"None":$to_js(this.tree)}},$add_profile=$B.parser.$add_profile=function(e,t){if("module"!=e.type){for(var r=e.C.tree[0],n=1,s=!0,a=e;void 0!==a.parent;)a=a.parent;var i=a.id;if(void 0===e.line_num&&(s=!1),"condition"==r.type&&"elif"==r.token?s=!1:"except"==r.type?s=!1:"single_kw"==r.type&&(s=!1),s){var o=new $Node;new $NodeJSCtx(o,';$B.$profile.count("'+i+'",'+e.line_num+");"),e.parent.insert(t,o),n=2}for(_=0;_<e.children.length;)_+=$add_profile(e.children[_],_);return n}for(var _=0;_<e.children.length;)_+=$add_profile(e.children[_],_)},$add_line_num=$B.parser.$add_line_num=function(e,t,r){if("module"!=e.type){if("marker"!==e.type){for(var n=e.C.tree[0],s=1,a=!0,i=e;void 0!==i.parent;)i=i.parent;var o=i.id,_=e.line_num;if(void 0===_&&(a=!1),"condition"==n.type&&"elif"==n.token?a=!1:"except"==n.type?a=!1:"single_kw"==n.type&&(a=!1),a){var l=';$locals.$line_info = "'+(void 0===r?_+","+o:r)+'";if($locals.$f_trace !== _b_.None){$B.trace_line()};_b_.None;',c=new $Node;c.is_line_num=!0,new $NodeJSCtx(c,l),e.parent.insert(t,c),s=2}for(u=0;u<e.children.length;)u+=$add_line_num(e.children[u],u,r);return s}return 1}for(var u=0;u<e.children.length;)u+=$add_line_num(e.children[u],u,r)};$B.$add_line_num=$add_line_num;var $bind=$B.parser.$bind=function(e,t,r){if(!t.nonlocals||!t.nonlocals[e])if(t.globals&&t.globals.has(e)){$get_module(r).binding[e]=!0}else{if(!r.no_bindings){var n=$get_node(r);n.bindings=n.bindings||{},n.bindings[e]=!0}t.binding=t.binding||{},void 0===t.binding[e]&&(t.binding[e]=!0)}};function $parent_match(e,t){for(var r;e.parent;){for(var n in r=!0,t)if(e.parent[n]!=t[n]){r=!1;break}if(r)return e.parent;e=e.parent}return!1}var $previous=$B.parser.$previous=function(e){var t=e.node.parent.children[e.node.parent.children.length-2];return t&&t.C||$_SyntaxError(e,"keyword not following correct keyword"),t.C.tree[0]},$get_docstring=$B.parser.$get_docstring=function(e){var t="";if(e.children.length>0){var r=e.children[0];if(r.C.tree&&r.C.tree.length>0&&"expr"==r.C.tree[0].type){var n=r.C.tree[0].tree[0];"str"!=n.type||Array.isArray(n.tree[0])||(t=r.C.tree[0].tree[0].to_js())}}return t},$get_scope=$B.parser.$get_scope=function(e,t){for(var r=e.parent;"node"!==r.type;)r=r.parent;for(var n=r.node,s=null;n.parent&&"module"!==n.parent.type;){var a=n.parent.C.tree[0].type;switch(a){case"def":case"class":case"generator":return(s=n.parent).ntype=a,s.is_function="class"!=a,s}n=n.parent}return(s=n.parent||n).ntype="module",s},$get_line_num=$B.parser.$get_line_num=function(e){var t=$get_node(e),r=t.line_num;if(void 0===t.line_num){for(t=t.parent;t&&void 0===t.line_num;)t=t.parent;t&&t.line_num&&(r=t.line_num)}return r},$get_module=$B.parser.$get_module=function(e){for(var t=e.parent;"node"!==t.type;)t=t.parent;var r=t.node;if("module"==r.ntype)return r;for(var n=null;"module"!=r.parent.type;)r=r.parent;return(n=r.parent).ntype="module",n},$get_src=$B.parser.$get_src=function(e){for(var t=$get_node(e);void 0!==t.parent;)t=t.parent;return t.src},$get_node=$B.parser.$get_node=function(e){for(var t=e;t.parent;)t=t.parent;return t.node},$to_js_map=$B.parser.$to_js_map=function(e){if(void 0!==e.to_js)return e.to_js();throw Error("no to_js() for "+e)},$to_js=$B.parser.$to_js=function(e,t){return void 0===t&&(t=","),e.map($to_js_map).join(t)},$mangle=$B.parser.$mangle=function(e,t){if("__"!=e.substr(0,2)||"__"===e.substr(e.length-2))return e;for(var r=$get_scope(t);;){if("module"==r.ntype)return e;if("class"==r.ntype){for(var n=r.C.tree[0].name;"_"==n.charAt(0);)n=n.substr(1);return"_"+n+e}if(!r.parent||!r.parent.C)return e;r=$get_scope(r.C.tree[0])}},$transition=$B.parser.$transition=function(e,t,r){return e.transition(t,r)};$B.forbidden=["alert","arguments","case","catch","const","constructor","Date","debugger","delete","default","do","document","enum","export","eval","extends","Error","history","function","instanceof","keys","length","location","Math","message","new","null","Number","RegExp","String","super","switch","this","throw","typeof","var","window","toLocaleString","toString","void"],$B.aliased_names=$B.list2obj($B.forbidden);for(var s_escaped="abfnrtvxuU\"0123456789'\\",is_escaped={},i=0;i<s_escaped.length;i++)is_escaped[s_escaped.charAt(i)]=!0;var $tokenize=$B.parser.$tokenize=function(root,src){for(var br_close={")":"(","]":"[","}":"{"},br_stack="",br_pos=[],kwdict=["class","return","break","for","lambda","try","finally","raise","def","from","nonlocal","while","del","global","with","as","elif","else","if","yield","assert","import","except","raise","in","pass","with","continue","__debugger__","async","await"],unsupported=[],$indented=["class","def","for","condition","single_kw","try","except","with"],int_pattern=/^(\d[0-9_]*)(j|J)?/,float_pattern1=/^(\d[\d_]*)\.(\d+(_\d+)*)?([eE][+-]?\d+(_\d+)*)?(j|J)?/,float_pattern2=/^(\d[\d_]*)([eE][+-]?\d+(_\d+)*)(j|J)?/,hex_pattern=/^0[xX]([\da-fA-F_]+)/,octal_pattern=/^0[oO]([0-7_]+)/,binary_pattern=/^0[bB]([01_]+)/,C=null,new_node=new $Node,current=root,name="",_type=null,pos=0,indent=null,string_modifier=!1,module=root.module,lnum=root.line_num||1;pos<src.length;){var car=src.charAt(pos);if(null!==indent)if("#"!=car)if('"'!=car&&"'"!=car){if(""==name&&"$"!=car){if($B.unicode_tables.XID_Start[car.charCodeAt(0)]){name=car;var p0=pos;for(pos++;pos<src.length&&$B.unicode_tables.XID_Continue[src.charCodeAt(pos)];)name+=src.charAt(pos),pos++}if(name){if(kwdict.indexOf(name)>-1)$pos=pos-name.length,unsupported.indexOf(name)>-1&&$_SyntaxError(C,"Unsupported Python keyword '"+name+"'"),C=$transition(C,name);else if("string"==typeof $operators[name]&&-1==["is_not","not_in"].indexOf(name))if("is"==name){var re=/^\s+not\s+/,res=re.exec(src.substr(pos));null!==res?(pos+=res[0].length,$pos=pos-name.length,C=$transition(C,"op","is_not")):($pos=pos-name.length,C=$transition(C,"op",name))}else if("not"==name){var re=/^\s+in\s+/,res=re.exec(src.substr(pos));null!==res?(pos+=res[0].length,$pos=pos-name.length,C=$transition(C,"op","not_in")):($pos=pos-name.length,C=$transition(C,name))}else $pos=pos-name.length,C=$transition(C,"op",name);else{if(('"'==src.charAt(pos)||"'"==src.charAt(pos))&&-1!==["r","b","u","rb","br","f","fr","rf"].indexOf(name.toLowerCase())){string_modifier=name.toLowerCase(),name="";continue}$B.forbidden.indexOf(name)>-1&&(name="$$"+name),$pos=pos-name.length,C=$transition(C,"id",name)}name="";continue}}switch(car){case" ":case"\t":pos++;break;case".":if(pos<src.length-1&&/^\d$/.test(src.charAt(pos+1))){for(var j=pos+1;j<src.length&&src.charAt(j).search(/\d|e|E|_/)>-1;)j++;"j"==src.charAt(j)?(C=$transition(C,"imaginary","0"+rmu(src.substr(pos,j-pos))),j++):C=$transition(C,"float","0"+rmu(src.substr(pos,j-pos))),pos=j;break}$pos=pos,C=$transition(C,"."),pos++;break;case"0":var res=hex_pattern.exec(src.substr(pos));if(res){rmuf(res[1]),C=$transition(C,"int",[16,rmu(res[1])]),pos+=res[0].length;break}var res=octal_pattern.exec(src.substr(pos));if(res){C=$transition(C,"int",[8,rmuf(res[1])]),pos+=res[0].length;break}var res=binary_pattern.exec(src.substr(pos));if(res){C=$transition(C,"int",[2,rmuf(res[1])]),pos+=res[0].length;break}if(src.charAt(pos+1).search(/\d/)>-1){if(0===parseInt(src.substr(pos))){res=int_pattern.exec(src.substr(pos)),$pos=pos,check_int(res[0]),C=$transition(C,"int",[10,rmu(res[0])]),pos+=res[0].length;break}$_SyntaxError(C,"invalid literal starting with 0")}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":var res=float_pattern1.exec(src.substr(pos));res?(check_int(res[1]),res[2]&&rmuf(res[2]),$pos=pos,C=void 0!==$B.last(res)?$transition(C,"imaginary",rmuf(res[0].substr(0,res[0].length-1))):$transition(C,"float",rmuf(res[0]))):(res=float_pattern2.exec(src.substr(pos)),res?(check_int(res[1]),$pos=pos,C=void 0!==$B.last(res)?$transition(C,"imaginary",rmuf(res[0].substr(0,res[0].length-1))):$transition(C,"float",rmuf(res[0]))):(res=int_pattern.exec(src.substr(pos)),check_int(res[1]),$pos=pos,C=void 0!==res[2]?$transition(C,"imaginary",rmu(res[1])):$transition(C,"int",[10,rmu(res[0])]))),pos+=res[0].length;break;case"\n":lnum++,br_stack.length>0?pos++:(current.C.tree.length>0||current.C.async?($pos=pos,C=$transition(C,"eol"),indent=null,new_node=new $Node):new_node.line_num=lnum,pos++);break;case"(":case"[":case"{":br_stack+=car,br_pos[br_stack.length-1]=[C,pos],$pos=pos,C=$transition(C,car),pos++;break;case")":case"]":case"}":""==br_stack?($pos=pos,$_SyntaxError(C,"Unexpected closing bracket")):br_close[car]!=br_stack.charAt(br_stack.length-1)?($pos=pos,$_SyntaxError(C,"Unbalanced bracket")):(br_stack=br_stack.substr(0,br_stack.length-1),$pos=pos,C=$transition(C,car),pos++);break;case"=":"="!=src.charAt(pos+1)?($pos=pos,C=$transition(C,"="),pos++):($pos=pos,C=$transition(C,"op","=="),pos+=2);break;case",":case":":$pos=pos,":="==src.substr(pos,2)?(C=$transition(C,":="),pos++):C=$transition(C,car),pos++;break;case";":$transition(C,"eol"),0==current.C.tree.length&&($pos=pos,$_SyntaxError(C,"invalid syntax"));for(var pos1=pos+1,ends_line=!1;pos1<src.length;){var _s=src.charAt(pos1);if("\n"==_s||"#"==_s){ends_line=!0;break}if(" "!=_s)break;pos1++}if(ends_line){pos++;break}new_node=new $Node,new_node.indent=$get_node(C).indent,new_node.line_num=lnum,new_node.module=module,$get_node(C).parent.add(new_node),current=new_node,C=new $NodeCtx(new_node),pos++;break;case"/":case"%":case"&":case">":case"<":case"-":case"+":case"*":case"@":case"/":case"^":case"=":case"|":case"~":case"!":if("-"==car&&">"==src.charAt(pos+1)){C=$transition(C,"annotation"),pos+=2;continue}if("@"==car&&"node"==C.type){$pos=pos,C=$transition(C,car),pos++;break}var op_match="";for(var op_sign in $operators)op_sign==src.substr(pos,op_sign.length)&&op_sign.length>op_match.length&&(op_match=op_sign);$pos=pos,op_match.length>0?(C=$transition(C,op_match in $augmented_assigns?"augm_assign":"op",op_match),pos+=op_match.length):$_SyntaxError(C,"invalid character: "+car);break;case"\\":if("\n"==src.charAt(pos+1)){lnum++,pos+=2,pos==src.length?$_SyntaxError(C,["unexpected EOF while parsing"]):"node"==C.type&&$_SyntaxError(C,"nothing before \\");break}$pos=pos,$_SyntaxError(C,["unexpected character after line continuation character"]);case String.fromCharCode(12):pos+=1;break;default:$pos=pos,$_SyntaxError(C,"unknown token ["+car+"]")}}else{var raw="str"==C.type&&C.raw,bytes=!1,fstring=!1,sm_length,end=null;if(string_modifier){switch(string_modifier){case"r":raw=!0;break;case"u":break;case"b":bytes=!0;break;case"rb":case"br":bytes=!0,raw=!0;break;case"f":fstring=!0,sm_length=1;break;case"rf":fstring=!0,sm_length=2,raw=!0}string_modifier=!1}src.substr(pos,3)==car+car+car?(_type="triple_string",end=pos+3):(_type="string",end=pos+1);for(var escaped=!1,zone=car,found=!1;end<src.length;)if(escaped)"a"==src.charAt(end)?zone=zone.substr(0,zone.length-1)+"":(zone+=src.charAt(end),raw&&"\\"==src.charAt(end)&&(zone+="\\")),escaped=!1,end++;else if("\\"==src.charAt(end))if(raw)end<src.length-1&&src.charAt(end+1)==car?(zone+="\\\\"+car,end+=2):(zone+="\\\\",end++),escaped=!0;else if("\n"==src.charAt(end+1))end+=2,lnum++;else if("N{"==src.substr(end+1,2)){var end_lit=end+3,re=new RegExp("[-a-zA-Z0-9 ]+"),search=re.exec(src.substr(end_lit));null===search&&$_SyntaxError(C,"(unicode error) malformed \\N character escape",pos);var end_lit=end_lit+search[0].length;"}"!=src.charAt(end_lit)&&$_SyntaxError(C,"(unicode error) malformed \\N character escape");var description=search[0].toUpperCase();if(void 0===$B.unicodedb){var xhr=new XMLHttpRequest;xhr.open("GET",$B.brython_path+"unicode.txt",!1),xhr.onreadystatechange=function(){4==this.readyState&&(200==this.status?$B.unicodedb=this.responseText:console.log("Warning - could not load unicode.txt"))},xhr.send()}if(void 0!==$B.unicodedb){var re=new RegExp("^([0-9A-F]+);"+description+";.*$","m");search=re.exec($B.unicodedb),null===search&&$_SyntaxError(C,"(unicode error) unknown Unicode character name");var cp="0x"+search[1];zone+=String.fromCodePoint(eval(cp)),end=end_lit+1}else end++}else end<src.length-1&&void 0===is_escaped[src.charAt(end+1)]&&(zone+="\\"),zone+="\\",escaped=!0,end++;else if("\n"==src.charAt(end)&&"triple_string"!=_type)$pos=end,$_SyntaxError(C,["EOL while scanning string literal"]);else if(src.charAt(end)==car){if("triple_string"!=_type||src.substr(end,3)==car+car+car){found=!0,$pos=pos;for(var $string=zone.substr(1),string="",i=0;i<$string.length;i++){var $car=$string.charAt(i);$car!=car||!raw&&0!=i&&"\\"==$string.charAt(i-1)||(string+="\\"),string+=$car}if(fstring)try{var re=new RegExp("\\\\"+car,"g"),string_no_bs=string.replace(re,car),elts=$B.parse_fstring(string_no_bs)}catch(e){$_SyntaxError(C,[e.toString()])}bytes?C=$transition(C,"str","b"+car+string+car):fstring?($pos-=sm_length,C=$transition(C,"str",elts),$pos+=sm_length):C=$transition(C,"str",car+string+car),C.raw=raw,pos=end+1,"triple_string"==_type&&(pos=end+3);break}zone+=src.charAt(end),end++}else zone+=src.charAt(end),"\n"==src.charAt(end)&&lnum++,end++;found||$_SyntaxError(C,"triple_string"===_type?"Triple string end not found":"String end not found")}else{var end=src.substr(pos+1).search("\n");-1==end&&(end=src.length-1),root.comments.push([pos,end]),pos+=end+1}else{for(var indent=0;pos<src.length;){var _s=src.charAt(pos);if(" "==_s)indent++,pos++;else{if("\t"!=_s)break;indent++,pos++,indent%8>0&&(indent+=8-indent%8)}}var _s=src.charAt(pos);if("\n"==_s){pos++,lnum++,indent=null;continue}if("#"==_s){var offset=src.substr(pos).search(/\n/);if(-1==offset)break;pos+=offset+1,lnum++,indent=null;continue}if(new_node.indent=indent,new_node.line_num=lnum,new_node.module=module,current.is_body_node&&(current.indent=indent),indent>current.indent)null!==C&&-1==$indented.indexOf(C.tree[0].type)&&($pos=pos,$_SyntaxError(C,"unexpected indent",pos)),current.add(new_node);else if(indent<=current.indent&&C&&C.tree[0]&&$indented.indexOf(C.tree[0].type)>-1&&C.tree.length<2)$pos=pos,$_SyntaxError(C,"expected an indented block",pos);else{for(;indent!==current.indent;)current=current.parent,(void 0===current||indent>current.indent)&&($pos=pos,$_SyntaxError(C,"unexpected indent",pos));current.parent.add(new_node)}current=new_node,C=new $NodeCtx(new_node)}function rmuf(e){return e.search("__")>-1?$_SyntaxError(C,"invalid literal"):e.endsWith("_")&&$_SyntaxError(C,"invalid literal"),e.replace(/_/g,"")}function check_int(e){if(rmuf(e),e.startsWith("0")){if(!(e.substr(1).search(/[^0_]/)>-1))return"0";$_SyntaxError(C,"invalid literal")}}function rmu(e){return e.replace(/_/g,"")}}if(0!=br_stack.length){var br_err=br_pos[0];$pos=br_err[1];var lines=src.split("\n"),id=root.id,fname=id.startsWith("$")?"<string>":id;$_SyntaxError(br_err[0],["unexpected EOF while parsing ("+fname+", line "+(lines.length-1)+")"])}if(null!==C){if("async"==C.type)throw console.log("error with async",pos,src,src.substr(pos)),$pos=pos-7,$_SyntaxError(C,"car "+car+"after async",pos);if(C.tree[0]&&$indented.indexOf(C.tree[0].type)>-1)$pos=pos-1,$_SyntaxError(C,"expected an indented block",pos);else{var parent=current.parent;parent.C&&parent.C.tree&&parent.C.tree[0]&&"try"==parent.C.tree[0].type&&($pos=pos-1,$_SyntaxError(C,["unexpected EOF while parsing"]))}}},$create_root_node=$B.parser.$create_root_node=function(e,t,r,n,s){var a=new $Node("module");return a.module=t,a.id=r,a.binding={__doc__:!0,__name__:!0,__file__:!0,__package__:!0},a.parent_block=n,a.line_num=s,a.indent=-1,a.comments=[],a.imports={},"object"==typeof e&&(a.is_comp=e.is_comp,e.has_annotations&&(a.binding.__annotations__=!0),e=e.src),a.src=e,a};$B.py2js=function(e,t,r,n,s){if($pos=0,"object"==typeof t){var a=t.__package__;t=t.__name__}else a="";n=n||$B.builtins_scope;var i=(new Date).getTime(),o=!1,_=!0;if("object"==typeof e){var l;o=e.is_comp,_=e.has_annotations;void 0!==(l=e.line_info)&&(s=parseInt(l.split(",")[0])),e=e.src}(e=e.replace(/\r\n/gm,"\n")).endsWith("\\")&&!e.endsWith("\\\\")&&(e=e.substr(0,e.length-1)),"\n"!=e.charAt(e.length-1)&&(e+="\n"),Array.isArray(r)&&(r=r[0]);r.charAt(0);var c="$locals_"+r.replace(/\./g,"_"),u="$locals_"+t.replace(/\./g,"_"),f=$create_root_node({src:e,is_comp:o,has_annotations:_},t,r,n,s);$tokenize(f,e),f.is_comp=o,f.transform();var p=1;($=["var $B = __BRYTHON__;\n"])[p++]="var $bltns = __BRYTHON__.InjectBuiltins();eval($bltns);\n\n",$[2]="var $locals = "+c+";";var d=0;f.insert(0,$NodeJS($.join(""))),d++,f.insert(d++,$NodeJS(c+'.__package__ = "'+a+'"')),f.binding.__annotations__&&f.insert(d++,$NodeJS("$locals.__annotations__ = _b_.dict.$factory()"));var h=d,$='var $top_frame = ["'+r.replace(/\./g,"_")+'", '+c+', "'+t.replace(/\./g,"_")+'", '+u+"]\n$locals.$f_trace = $B.enter_frame($top_frame)\nvar $stack_length = $B.frames_stack.length;";f.insert(d++,$NodeJS($));var m=new $NodeJS("try"),b=f.children.slice(h+1,f.children.length);f.insert(h+1,m),0==b.length&&(b=[$NodeJS("")]),b.forEach(function(e){m.add(e)}),m.add($NodeJS("$B.leave_frame({value: _b_.None})")),f.children.splice(h+2,f.children.length);var g=$NodeJS("catch(err)");g.add($NodeJS("$B.leave_frame({value: _b_.None})")),g.add($NodeJS("throw err")),f.add(g),$add_line_num(f,null,l);var y=(new Date).getTime();return $B.debug>2&&t==r&&console.log("module "+t+" translated in "+(y-i)+" ms"),$B.compile_time+=y-i,f},$B.set_import_paths=function(){var e=[],t=[];$B.use_VFS&&e.push($B.$meta_path[0]),!1!==$B.$options.static_stdlib_import&&"file"!=$B.protocol&&(e.push($B.$meta_path[1]),$B.path.length>3&&($B.path.shift(),$B.path.shift())),"file"!==$B.protocol&&(e.push($B.$meta_path[2]),t.push($B.$path_hooks[0])),$B.meta_path=e,$B.path_hooks=t};var brython=$B.parser.brython=function(e){void 0===e&&(e={debug:1}),"number"==typeof e&&(e={debug:e}),void 0===e.debug&&(e.debug=1),$B.debug=e.debug,_b_.__debug__=$B.debug>0,$B.compile_time=0,void 0===e.profile&&(e.profile=0),$B.profile=e.profile,void 0===e.indexedDB&&(e.indexedDB=!0),void 0===e.static_stdlib_import&&(e.static_stdlib_import=!0),$B.static_stdlib_import=e.static_stdlib_import,$B.$options=e,$B.set_import_paths();var t=($B.script_path=_window.location.href).split("/");if(t.pop(),($B.isWebWorker||$B.isNode)&&t.pop(),$B.curdir=t.join("/"),void 0!==e.pythonpath&&($B.path=e.pythonpath,$B.$options.static_stdlib_import=!1),e.python_paths&&e.python_paths.forEach(function(e){var t,r;"string"!=typeof e&&(t=e.lang,r=e.prefetch,e=e.path),$B.path.push(e),".vfs.js"!=e.slice(-7).toLowerCase()||void 0!==r&&!0!==r||($B.path_importer_cache[e+"/"]=$B.imported._importlib.VFSPathFinder(e)),t&&s.optimize_import_for_path(e,t)}),!$B.isWebWorker&&!$B.isNode)for(var r,n=document.querySelectorAll("head link[rel~=pythonpath]"),s=$B.imported._importlib,a=0;r=n[a];++a){var i=r.href;-1!=(" "+r.rel+" ").indexOf(" prepend ")?$B.path.unshift(i):$B.path.push(i);var o=r.hreflang;o&&("x-"==o.slice(0,2)&&(o=o.slice(2)),s.optimize_import_for_path(r.href,o))}$B.$options.args?$B.__ARGV=$B.$options.args:$B.__ARGV=_b_.list.$factory([]),$B.isWebWorker||$B.isNode||_run_scripts(e)};$B.run_script=function(e,t,r){r&&$B.idb_cx&&$B.idb_cx.$closed&&$B.tasks.push([$B.idb_open]),$B.$py_module_path[t]=$B.script_path;try{var n=$B.py2js(e,t,t),s=n.to_js(),a={__doc__:n.__doc__,js:s,__name__:t,$src:e,__file__:$B.script_path+($B.script_path.endsWith("/")?"":"/")+t};$B.file_cache[a.__file__]=e,$B.debug>1&&console.log(s)}catch(e){$B.handle_error(e)}if($B.hasOwnProperty("VFS")&&$B.has_indexedDB){var i=Object.keys(n.imports).slice().filter(function(e){return $B.VFS.hasOwnProperty(e)});Object.keys(i).forEach(function(e){if($B.VFS.hasOwnProperty(e)){var t=$B.VFS[e],r=t[0];if(".py"==r){t[1];var n=t[2];t.length;".py"==r&&required_stdlib_imports(n),n.forEach(function(e){-1==i.indexOf(e)&&i.push(e)})}}});for(var o=0;o<i.length;o++)$B.tasks.push([$B.inImported,i[o]]);n=null}$B.tasks.push(["execute",a]),r&&$B.loop()};var $log=$B.$log=function(e){e.split("\n").forEach(function(e,t){console.log(t+1,":",e)})},_run_scripts=$B.parser._run_scripts=function(options){var kk=Object.keys(_window),defined_ids={};if(void 0!==options.ipy_id){var $elts=[];options.ipy_id.forEach(function(e){$elts.push(document.getElementById(e))})}else for(var scripts=document.getElementsByTagName("script"),$elts=[],webworkers=[],i=0;i<scripts.length;i++){var script=scripts[i];if("text/python"==script.type||"text/python3"==script.type)if("webworker"==script.className){if(void 0===script.id)throw _b_.AttributeError.$factory("webworker script has no attribute 'id'");webworkers.push(script)}else $elts.push(script)}var first_script=!0,module_name;if(void 0!==options.ipy_id){module_name="__main__";var $src="",js,root;$B.$py_module_path[module_name]=$B.script_path,$elts.forEach(function(e){$src+=e.innerHTML||e.textContent});try{root=$B.py2js($src,module_name,module_name),js=root.to_js(),$B.debug>1&&$log(js),eval(js),$B.clear_ns(module_name),root=null,js=null}catch(e){if(root=null,js=null,console.log(e),$B.debug>1)for(var attr in console.log(e),e)console.log(attr+" : ",e[attr]);void 0===e.$py_error&&(console.log("Javascript error",e),e=_b_.RuntimeError.$factory(e+""));var $trace=_b_.getattr(e,"info")+"\n"+e.__name__+": "+e.args;try{_b_.getattr($B.stderr,"write")($trace)}catch(e){console.log($trace)}throw e}}else{$elts.length>0&&options.indexedDB&&$B.has_indexedDB&&$B.hasOwnProperty("VFS")&&$B.tasks.push([$B.idb_open]);for(var i=0;i<$elts.length;i++){var elt=$elts[i];if(elt.id){if(defined_ids[elt.id])throw Error("Brython error : Found 2 scripts with the same id '"+elt.id+"'");defined_ids[elt.id]=!0}}for(var src,i=0,len=webworkers.length;i<len;i++){var worker=webworkers[i];worker.src?$B.tasks.push([$B.ajax_load_script,{name:worker.id,url:worker.src,is_ww:!0}]):(src=worker.innerHTML||worker.textContent,src=src.replace(/^\n/,""),$B.webworkers[worker.id]=src)}for(var i=0;i<$elts.length;i++){var elt=$elts[i];if("text/python"==elt.type||"text/python3"==elt.type){if(elt.id)module_name=elt.id;else for(first_script?(module_name="__main__",first_script=!1):module_name="__main__"+$B.UUID();void 0!==defined_ids[module_name];)module_name="__main__"+$B.UUID();elt.src?$B.tasks.push([$B.ajax_load_script,{name:module_name,url:elt.src}]):(src=elt.innerHTML||elt.textContent,src=src.replace(/^\n/,""),$B.run_script(src,module_name))}}}void 0===options.ipy_id&&$B.loop()};$B.$operators=$operators,$B.$Node=$Node,$B.$NodeJSCtx=$NodeJSCtx,$B.brython=brython}(__BRYTHON__);var brython=__BRYTHON__.brython;__BRYTHON__.isNode&&(global.__BRYTHON__=__BRYTHON__,module.exports={__BRYTHON__:__BRYTHON__}),function(e){var t=e.builtins;function r(t,r,s,i,o){var _=e.idb_cx.result.transaction("modules","readwrite").objectStore("modules"),l=(_.openCursor(),{name:t,content:r,imports:i,origin:origin,timestamp:__BRYTHON__.timestamp,source_ts:s,is_package:o}),c=_.put(l);e.debug>1&&console.log("store precompiled",t,"package",o),document.dispatchEvent(new CustomEvent("precompile",{detail:"cache module "+t}));var u=e.outdated.indexOf(t);u>-1&&e.outdated.splice(u,1),c.onsuccess=function(r){e.tasks.splice(0,0,[n,t]),a()}}function n(t){var i=e.idb_cx.result.transaction("modules","readonly");try{var o=i.objectStore("modules");req=o.get(t),req.onsuccess=function(i){!function(t,i){var o=t.target.result;if(e.timestamp,void 0===o||o.timestamp!=e.timestamp||e.VFS[i]&&o.source_ts!==e.VFS[i].timestamp){if(void 0!==e.VFS[i]){var _=(v=e.VFS[i])[0],l=v[1];if(".py"==_){var c,u,f=v[2],p=4==v.length,d=v.timestamp;p?c=i:((u=i.split(".")).pop(),c=u.join(".")),e.imported[i]=e.module.$factory(i,"",c);try{var h=e.py2js(l,i,i).to_js()}catch(t){e.handle_error(t)}delete e.imported[i],e.debug>1&&console.log("precompile",i),(u=i.split(".")).length>1&&u.pop(),e.stdlib.hasOwnProperty(u.join("."))&&(f=(f=v[2]).join(","),e.tasks.splice(0,0,[r,i,h,d,f,p]))}else console.log("bizarre",i,_)}}else if(o.is_package?e.precompiled[i]=[o.content]:e.precompiled[i]=o.content,o.imports.length>0){e.debug>1&&console.log(i,"imports",o.imports);for(var $=o.imports.split(","),m=0;m<$.length;m++){var b=$[m];if(b.startsWith(".")){for(var g=i.split("."),y=0;b.startsWith(".");)y++,b=b.substr(1);var v=g.slice(0,y);b&&(v=v.concat([b])),b=v.join(".")}if(!e.imported.hasOwnProperty(b)&&!e.precompiled.hasOwnProperty(b)&&e.VFS.hasOwnProperty(b)){var x=e.VFS[b];_=x[0],l=x[1],".py"==x[0]?e.tasks.splice(0,0,[n,b]):s(b,l)}}}a()}(i,t)}}catch(e){console.info("error",e)}}function s(t,r){r+="\nvar $locals_"+t.replace(/\./g,"_")+" = $module",e.precompiled[t]=r}e.VFS_timestamp&&e.VFS_timestamp>e.timestamp&&(e.timestamp=e.VFS_timestamp),e.idb_open=function(t){e.idb_name="brython-cache";var r=e.idb_cx=indexedDB.open(e.idb_name);r.onsuccess=function(){var t=r.result;if(t.objectStoreNames.contains("modules")){console.info("using indexedDB for stdlib modules cache");var n,s=t.transaction("modules","readwrite").objectStore("modules"),i=[];s.openCursor().onsuccess=function(t){cursor=t.target.result,cursor?((n=cursor.value).timestamp==e.timestamp?e.VFS&&e.VFS[n.name]&&e.VFS[n.name].timestamp!=n.source_ts?i.push(n.name):(n.is_package?e.precompiled[n.name]=[n.content]:e.precompiled[n.name]=n.content,e.debug>1&&console.info("load from cache",n.name)):i.push(n.name),cursor.continue()):(e.debug>1&&console.log("done"),e.outdated=i,a())}}else{var o=t.version;t.close(),console.info("create object store",o),(r=indexedDB.open(e.idb_name,o+1)).onupgradeneeded=function(){console.info("upgrade needed"),e.idb_cx.result.createObjectStore("modules",{keyPath:"name"}).onsuccess=a},r.onversionchanged=function(){console.log("version changed")},r.onsuccess=function(){console.info("db opened",r),r.result.createObjectStore("modules",{keyPath:"name"}).onsuccess=a}}},r.onupgradeneeded=function(){console.info("upgrade needed"),r.result.createObjectStore("modules",{keyPath:"name"}).onsuccess=a},r.onerror=function(){console.info("could not open indexedDB database"),e.idb_cx=null,e.idb_name=null,e.$options.indexedDB=!1,a()}},e.ajax_load_script=function(r){var n=r.url,s=r.name;if(e.files&&e.files.hasOwnProperty(s))e.tasks.splice(0,0,[e.run_script,e.files[s],s,!0]);else{if("file"==e.protocol)throw t.IOError.$factory("can't load external script at "+r.url+" (Ajax calls not supported with protocol file:///)");var i=new XMLHttpRequest,o=e.$options.cache?"":"?"+Date.now();i.open("GET",n+o,!0),i.onreadystatechange=function(){if(4==this.readyState)if(200==this.status){var t=this.responseText;r.is_ww?e.webworkers[s]=t:e.tasks.splice(0,0,[e.run_script,t,s,!0]),a()}else if(404==this.status)throw Error(n+" not found")},i.send()}};e.inImported=function(t){if(e.imported.hasOwnProperty(t));else if(__BRYTHON__.VFS&&__BRYTHON__.VFS.hasOwnProperty(t)){var r=__BRYTHON__.VFS[t];void 0===r&&console.log("bizarre",t);var i=r[0],o=r[1];r.length;".py"==i?e.idb_cx&&e.tasks.splice(0,0,[n,t]):s(t,o)}else console.log("bizarre",t);a()};var a=e.loop=function(){if(0!=e.tasks.length){var r=e.tasks.shift(),n=r[0],s=r.slice(1);if("execute"==n){try{var i=r[1],o=i.__name__.replace(/\./g,"_");(l=e.module.$factory(i.__name__)).$src=i.$src,l.__file__=i.__file__,e.imported[o]=l,new Function("$locals_"+o,i.js)(l)}catch(r){void 0===r.__class__&&(console.log("Javascript error",r),e.is_recursion_error(r)?r=t.RecursionError.$factory("too much recursion"):(e.print_stack(),r=t.RuntimeError.$factory(r+""))),e.debug>1&&(console.log("handle error",r.__class__,r.args,r.$stack),console.log(e.frames_stack.slice())),e.handle_error(r)}a()}else try{n.apply(null,s)}catch(t){e.handle_error(t)}}else if(e.idb_cx){for(var _=e.idb_cx.result.transaction("modules","readwrite").objectStore("modules");e.outdated.length>0;){var l=e.outdated.pop();_.delete(l).onsuccess=function(t){e.debug>1&&console.info("delete outdated",l),document.dispatchEvent(new CustomEvent("precompile",{detail:"remove outdated "+l+" from cache"}))}}document.dispatchEvent(new CustomEvent("precompile",{detail:"close"})),e.idb_cx.result.close(),e.idb_cx.$closed=!0}};e.tasks=[],e.has_indexedDB=void 0!==self.indexedDB,e.handle_error=function(r){if(console.log("handle error",r.__class__,r.args),void 0!==r.__class__){var n=e.class_name(r),s=t.getattr(r,"info");if("SyntaxError"==n||"IndentationError"==n){var a=r.args[3];s+="\n "+" ".repeat(a)+"^\n"+n+": "+r.args[0]}else s+="\n"+n,r.args[0]&&r.args[0]!==t.None&&(s+=": "+t.str.$factory(r.args[0]))}else console.log(r),s=r+"";try{e.$getattr(e.stderr,"write")(s);try{e.$getattr(e.stderr,"flush")()}catch(r){console.log(r)}}catch(e){console.log(s)}throw r}}(__BRYTHON__),__BRYTHON__.builtins.object=function(e){var t=e.builtins,r={$infos:{__name__:"object"},$is_class:!0,$native:!0};function n(t){return e.$getattr(t,"__new__").apply(null,arguments)}return r.__delattr__=function(r,n){if(n=e.from_alias(n),r.__dict__&&r.__dict__.$string_dict&&void 0!==r.__dict__.$string_dict[n])return delete r.__dict__.$string_dict[n],t.None;if(void 0===r.__dict__&&void 0!==r[n])return delete r[n],t.None;var s=r.__class__;if(s){var a=e.$getattr(s,n);if(a.__class__===t.property&&void 0!==a.__delete__)return a.__delete__(r),t.None}throw t.AttributeError.$factory(n)},r.__dir__=function(r){var n;if(r.$is_class)n=[r].concat(r.__mro__);else{var s=r.__class__||e.get_class(r);n=[r,s].concat(s.__mro__)}for(var a=[],i=0,o=n.length;i<o;i++)for(var _ in n[i])"$"!=_.charAt(0)?isNaN(parseInt(_.charAt(0)))&&"__mro__"!=_&&a.push(_):"$"==_.charAt(1)&&a.push(_.substr(2));if(r.__dict__)for(var _ in r.__dict__.$string_dict)"$$"==_.substr(0,2)?a.push(_.substr(2)):"$"!=_.charAt(0)&&a.push(_);return a=t.list.$factory(t.set.$factory(a)),t.list.sort(a),a},r.__eq__=function(e,r){return e===r||t.NotImplemented},r.__format__=function(){var r=e.args("__format__",2,{self:null,spec:null},["self","spec"],arguments,{},null,null);if(""!==r.spec)throw t.TypeError.$factory("non-empty format string passed to object.__format__");return t.getattr(r.self,"__str__")()},r.__ge__=function(){return t.NotImplemented},r.__getattribute__=function(r,n){var s=r.__class__||e.get_class(r);if("__class__"===n)return s;var a=r[n];if(Array.isArray(r)&&void 0!==Array.prototype[n]&&(a=void 0),void 0===a&&r.__dict__){var i=r.__dict__;if(i.$string_dict.hasOwnProperty(n))return i.$string_dict[n][0]}if(void 0===a){function o(e,t,r){var n=t[r];if(void 0!==n)return n}if(void 0===(a=o(0,s,n)))for(var _=0,l=($=s.__mro__).length;_<l;_++)if(void 0!==(a=o(0,$[_],n))){0;break}}else if(void 0===a.__set__)return a;if(void 0!==a){if(a.__class__===t.property)return a.__get__(a,r,s);if(a.__class__===e.method)return void 0===a.__get__&&console.log("bizarre",r,n,a),a.__get__(r,s);if(void 0===(c=a.__get__)&&a.__class__){var c=a.__class__.__get__;for(_=0;_<a.__class__.__mro__.length&&void 0===c;_++)c=a.__class__.__mro__[_].__get__}0;var u=void 0===c?null:t.getattr(a,"__get__",null);if(null!==u)try{return u.apply(null,[r,s])}catch(e){throw console.log("error in get.apply",e),console.log("get attr",n,"of",r),console.log(u+""),e}if("object"==typeof a&&u&&"function"==typeof u&&(get_func=function(e,t){return u.apply(e,[t,s.$factory])}),null===u&&"function"==typeof a&&(u=function(e){return e}),null!==u){a.__name__=n,"__new__"==n&&(a.$type="staticmethod");var f=u.apply(null,[a,r,s]);if("function"==typeof f){if(f.__class__===e.method)return a;if("staticmethod"==a.$type)return a;var p=a.__class__===e.method?s:r,d=function(){for(var e=[p],t=0,r=arguments.length;t<r;t++)e.push(arguments[t]);return a.apply(this,e)};return d.__class__=e.method,(d.__get__=function(t,r){var n=a.bind(null,r);return n.__class__=e.method,n.$infos={__self__:r,__func__:a,__name__:a.$infos.__name__,__qualname__:r.$infos.__name__+"."+a.$infos.__name__},n}).__class__=e.method_wrapper,d.__get__.$infos=a.$infos,void 0===s.$infos&&(console.log("no $infos",s),console.log(e.last(e.frames_stack))),d.$infos={__self__:p,__func__:a,__name__:n,__qualname__:s.$infos.__name__+"."+n},d}return f}return a}var h=r.__getattr__;if(void 0===h&&void 0===(h=s.__getattr__)){var $;for(_=0,l=($=s.__mro__).length;_<l&&void 0===(h=$[_].__getattr__);_++);}return void 0!==h?s===e.module?h(n):h(r,n):void 0},r.__gt__=function(){return t.NotImplemented},r.__hash__=function(t){var r=t.__hashvalue__;return void 0!==r?r:t.__hashvalue__=e.$py_next_hash--},r.__init__=function(){if(0==arguments.length)throw t.TypeError.$factory("descriptor '__init__' of 'object' object needs an argument");return t.None},r.__le__=function(){return t.NotImplemented},r.__lt__=function(){return t.NotImplemented},r.__mro__=[],r.__new__=function(n,...s){if(void 0===n)throw t.TypeError.$factory("object.__new__(): not enough arguments");if(e.$getattr(n,"__init__")===r.__init__&&s.length>0)throw t.TypeError.$factory("object() takes no parameters");return{__class__:n,__dict__:t.dict.$factory()}},r.__ne__=function(r,n){if(r===n)return!1;var s=e.$getattr(r,"__eq__",null);if(null!==s){var a=e.$call(s)(n);return a===t.NotImplemented?a:!e.$bool(a)}return t.NotImplemented},r.__reduce__=function(r){function n(t){return e.$call(t)()}n.$infos={__qualname__:"_reconstructor"};var s=[n];s.push(t.tuple.$factory([r.__class__].concat(r.__class__.__mro__)));var a=t.dict.$factory();for(var i in r.__dict__.$string_dict)t.dict.$setitem(a.$string_dict,i,r.__dict__.$string_dict[i][0]);return console.log("object.__reduce__, d",a),s.push(a),t.tuple.$factory(s)},n.$infos={__name__:"__newobj__",__qualname__:"__newobj__"},t.__newobj__=n,r.__reduce_ex__=function(r){var s=[n],a=t.tuple.$factory([r.__class__]);Array.isArray(r)&&r.forEach(function(e){a.push(e)}),s.push(a);var i=t.dict.$factory(),o=0;for(var _ in void 0===r.__dict__&&(console.log("no dict",r),e.frames_stack.forEach(function(e){console.log(e[0],e[1],e[2])})),r.__dict__.$string_dict)"__class__"==_||_.startsWith("$")||(t.dict.$setitem(i,_,r.__dict__.$string_dict[_][0]),o++);return 0==o&&(i=t.None),s.push(i),s.push(t.None),t.tuple.$factory(s)},r.__repr__=function(n){if(n===r)return"<class 'object'>";if(n.__class__===t.type)return"<class '"+n.__name__+"'>";var s=n.__class__.$infos.__module__;return void 0===s||s.startsWith("$")||"builtins"===s?"<"+e.class_name(n)+" object>":"<"+n.__class__.$infos.__module__+"."+e.class_name(n)+" object>"},r.__setattr__=function(n,s,a){if(void 0===a)throw t.TypeError.$factory("can't set attributes of built-in/extension type 'object'");if(n.__class__===r)throw void 0===r[s]?t.AttributeError.$factory("'object' object has no attribute '"+s+"'"):t.AttributeError.$factory("'object' object attribute '"+s+"' is read-only");return e.aliased_names[s]&&(s="$$"+s),n.__dict__?t.dict.$setitem(n.__dict__,s,a):n[s]=a,t.None},r.__setattr__.__get__=function(e){return function(t,n){r.__setattr__(e,t,n)}},r.__setattr__.__str__=function(){return"method object.setattr"},r.__str__=function(t){var r=e.$getattr(t,"__repr__");return e.$call(r)()},r.__subclasshook__=function(){return t.NotImplemented},r.$factory=function(){var e={__class__:r},t=[e].concat(Array.prototype.slice.call(arguments));return r.__init__.apply(null,t),e},e.set_func_names(r,"builtins"),e.make_class=function(e,n){var s={__class__:t.type,__mro__:[r],$infos:{__name__:e},$is_class:!0};return s.$factory=n,s},r}(__BRYTHON__),function(e){var t=e.builtins;e.$class_constructor=function(r,n,s,a,i){var o;s=s||[];var _=n.__module__;void 0===_&&(_=n.__module__=e.last(e.frames_stack)[2]);for(var l=0;l<s.length;l++)if(void 0===s[l])throw e.line_info=n.$def_line,t.NameError.$factory("name '"+a[l]+"' is not defined");var c={},u={};if(i)for(l=0;l<i.length;l++){var f=i[l][0],p=i[l][1];"metaclass"==f?o=p:c[f]=p,u[f]=p}var d=n,h=s.slice(),$=!1;for(l=0;l<s.length;l++)if(void 0===s[l]||void 0===s[l].__mro__&&s[l].__class__!==e.JSObject){var m=e.$getattr(s[l],"__mro_entries__",t.None);if(m!==t.None){var b=t.list.$factory(m(s));s.splice(l,1,...b),$=!0,l--;continue}}if(void 0===o)if(s&&s.length>0&&s[0].__class__!==e.JSObject){o=s[0].__class__;for(l=1;l<s.length;l++){var g=s[l].__class__;if(g===o||t.issubclass(o,g));else if(t.issubclass(g,o))o=g;else if(o.__bases__&&-1==o.__bases__.indexOf(g))throw t.TypeError.$factory("metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases")}}else o=t.type;var y=e.$getattr(o,"__prepare__",t.None)(r,s);for(var v in y.__class__!==t.dict?set_class_item=e.$getattr(y,"__setitem__"):set_class_item=function(e,t){y.$string_dict[e]=[t,y.$version],y.$version++},n)if("__annotations__"==v){var x=y.$version;for(var f in void 0!==y.$string_dict[v]?y.$string_dict[v]=[n[v],x]:y.$string_dict[v]=[t.dict.$factory(),x],y.$version++,n[v].$string_dict)e.$setitem(y.$string_dict[v][0],f,n[v].$string_dict[f][0])}else"$"==v.charAt(0)&&"$$"!=v.substr(0,2)||set_class_item(v,n[v]);$&&set_class_item("__orig_bases__",t.tuple.$factory(h));var w={__bases__:s,__class__:o,__dict__:y};if(y.__class__===t.dict)for(var f in y.$string_dict)w[f]=y.$string_dict[f][0];else for(var B=e.$getattr(y,"__getitem__"),k=t.iter(y);;)try{w[f=t.next(k)]=B(f)}catch(e){break}w.__mro__=t.type.mro(w).slice(1);var j=!0,E={},N={},S=[w].concat(w.__mro__);for(l=0;l<S.length;l++){var C=0==l?d:S[l];for(var v in C)if(!E[v]){var O=C[v];"function"==typeof O&&(!0===O.__isabstractmethod__||O.$attrs&&O.$attrs.__isabstractmethod__?(j=!1,N[v]=!0):E[v]=!0)}}var A=n.__slots__;void 0!==A&&(A="string"==typeof A?[A]:t.list.$factory(A),y.__slots__=A);for(l=0;l<S.length-1;l++)for(var v in S[l]){if("__setattr__"==v){y.$has_setattr=!0;break}if(S[l][v]&&(S[l][v].__get__||S[l][v].__class__&&S[l][v].__class__.__get__)){y.$has_setattr=!0;break}}var I=t.type.__getattribute__(o,"__new__")(o,r,s,y);for(var v in I.__module__=_,I.$infos={__module__:_,__name__:r,__qualname__:r},I.$subclasses=[],n)"$"==v.charAt(0)&&"$$"!=v.substr(0,2)||"function"==typeof n[v]&&(n[v].$infos.$class=I);I.__class__===o&&t.type.__getattribute__(o,"__init__")(I,r,s,y);for(l=0;l<s.length;l++)if(s[l].$subclasses=s[l].$subclasses||[],s[l].$subclasses.push(I),0==l){var T=t.type.__getattribute__(s[l],"__init_subclass__");void 0!==T.$infos.__func__?T.$infos.__func__(I,{$nat:"kw",kw:c}):T(I,{$nat:"kw",kw:c})}if(0==s.length&&e.$getattr(o,"__init_subclass__")(I,{$nat:"kw",kw:c}),!j){I.$factory=function(){throw t.TypeError.$factory("Can't instantiate abstract class interface with abstract methods "+Object.keys(N).join(", "))}}return I.__qualname__=r.replace("$$",""),I};var r=e.make_class("type",function(t,n,s){return 1==arguments.length?void 0===t?e.UndefinedClass:t.__class__||e.get_class(t):r.__new__(r,t,n,s)});r.__call__=function(){for(var e=[],r=arguments[0],n=1,s=arguments.length;n<s;n++)e.push(arguments[n]);var a=t.type.__getattribute__(r,"__new__").apply(null,arguments);if(a.__class__===r){var i=t.type.__getattribute__(r,"__init__");if(i!==t.object.__init__){var o=[a].concat(e);i.apply(null,o)}}return a},r.__class__=r,r.__format__=function(e,r){return t.str.$factory(e)},r.__getattribute__=function(r,n){switch(n){case"__annotations__":for(var o=0,_=(f=[r].concat(r.__mro__)).length;o<_;o++)if(f[o].__dict__){var l=f[o].__dict__.$string_dict.__annotations__[0];if(l)if(void 0===$)$=l;else if($.__class__===t.dict&&l.__class__===t.dict)for(var c in l.$string_dict)$.$string_dict[c]=l.$string_dict[c]}return void 0===$&&($=t.dict.$factory()),$;case"__bases__":return($=r.__bases__||t.tuple.$factory()).__class__=t.tuple,0==$.length&&$.push(t.object),$;case"__class__":return r.__class__;case"__doc__":return r.__doc__||t.None;case"__setattr__":if(void 0!==r.__setattr__)var u=r.__setattr__;else u=function(e,t,r){e[t]=r};return s.$factory(n,r,u);case"__delattr__":return void 0!==r.__delattr__?r.__delattr__:s.$factory(n,r,function(e){delete r[e]})}if(void 0===($=r[n])&&r.__slots__&&r.__slots__.indexOf(n)>-1)return a.$factory(n,r);if(r.__class__&&r.__class__[n]&&r.__class__[n].__get__&&r.__class__[n].__set__)return r.__class__[n].__get__(r);if(void 0===$){if(void 0===(p=r[n])){var f=r.__mro__;for(o=0;o<f.length;o++){var p;if(void 0!==(p=f[o][n])){$=p;break}}}else $=p;if(void 0===$){var d=r.__class__;if(void 0===($=d[n])){var h=d.__mro__;for(o=0;o<h.length;o++){var $;if(void 0!==($=h[o][n]))break}}if(void 0!==$){if($.__class__===t.property)return $.fget(r);if("function"==typeof $){var m=$.bind(null,r);return m.__class__=e.method,m.$infos={__self__:r,__func__:$,__name__:n,__qualname__:r.$infos.__name__+"."+n,__module__:$.$infos?$.$infos.__module__:""},m}}if(void 0===$){var b=d.__getattr__;if(void 0===b)for(o=0;o<h.length;o++)if(void 0!==h[o].__getattr__){b=h[o].__getattr__;break}if(void 0!==b)return b(r,n)}}}if(void 0!==$){if($.__class__===t.property)return $;if($.__get__){if($.__class__===i){var g=$.__get__($.__func__,r);g.$infos={__func__:$,__name__:$.$infos.__name__,__qualname__:r.$infos.__name__+"."+$.$infos.__name__,__self__:r}}else g=$.__get__(r);return g}return!$.__class__||!$.__class__.__get__||n.startsWith("__")&&n.endsWith("__")?"function"==typeof $?(void 0===$.$infos&&e.debug>1&&console.log("warning: no attribute $infos for",$,"klass",r,"attr",n),"__new__"==n&&($.$type="staticmethod"),"__class_getitem__"==n&&$.__class__!==e.method&&($=t.classmethod.$factory($)),$.__class__===e.method?$.__get__(null,r):$):$:$.__class__.__get__($,t.None,r)}},r.__hash__=function(e){return t.hash(e)},r.__init__=function(){},r.__init_subclass__=function(r,n){var s=e.args("__init_subclass__",1,{cls:null},["cls"],arguments,{},"args","kwargs");if(void 0!==s.kwargs&&(s.kwargs.__class__!==t.dict||Object.keys(s.kwargs.$string_dict).length>0))throw t.TypeError.$factory("__init_subclass__() takes no keyword arguments");return t.None},r.__instancecheck__=function(t,r){var n=r.__class__||e.get_class(r);if(n===t)return!0;for(var s=0;s<n.__mro__.length;s++)if(n.__mro__[s]===t)return!0;return!1},r.__instancecheck__.$type="staticmethod",r.__name__={__get__:function(e){return e.$infos.__name__},__set__:function(e,t){e.$infos.__name__=t},__str__:function(e){return"type"},__eq__:function(e,t){return e.$infos.__name__==t}},r.__new__=function(n,s,a,i){var o=i.$string_dict.__module__;o&&(o=o[0]);for(var _={__class__:n,__bases__:a,__dict__:i,$infos:{__name__:s.replace("$$",""),__module__:i.$string_dict.__module__},$is_class:!0,$has_setattr:i.$has_setattr},l=e.dict_to_list(i),c=0;c<l.length;c++){var u=e.to_alias(l[c][0]),f=l[c][1];if("__module__"!==u&&void 0!==f){if(_[u]=f,f.__class__){var p=e.$getattr(f.__class__,"__set_name__",t.None);p!==t.None&&p(f,_,u)}if("function"==typeof f&&(f.$infos.$class=_,f.$infos.$defaults)){var d=f.$infos.$defaults;e.Function.__setattr__(f,"__defaults__",d)}}}return _.__mro__=r.mro(_).slice(1),_},r.__repr__=r.__str__=function(e){void 0===e.$infos&&console.log("no $infos",e);var t=e.$infos.__name__;return e.$infos.__module__&&"builtins"!=e.$infos.__module__&&!e.$infos.__module__.startsWith("$")&&(t=e.$infos.__module__+"."+t),"<class '"+t+"'>"},r.__prepare__=function(){return t.dict.$factory()},r.__qualname__={__get__:function(e){return e.$infos.__qualname__||e.$infos.__name__},__set__:function(e,t){e.$infos.__qualname__=t},__str__:function(e){console.log("type.__qualname__")},__eq__:function(e,t){return e.$infos.__qualname__==t}},r.mro=function(r){for(var n=r.__bases__,s=[],a=0,i=0;i<n.length;i++){n[i]===t.str&&(n[i]=e.StringSubclass);var o=[],_=0;if(void 0===n[i]||void 0===n[i].__mro__){if(n[i].__class__!==e.JSObject)throw t.TypeError.$factory("Object passed as base class is not a class");var l=n[i].js_func;n[i]={__class__:t.type,__mro__:[t.object],__name__:l.name,__init__:function(t,...r){for(var n in r.forEach(function(t,n){r[n]=e.pyobj2jsobj(t)}),l.apply(t,r),t)"function"==typeof t[n]&&(t[n]=function(r){return function(){var n=r.apply(t,arguments);return e.jsobj2pyobj(n)}}(t[n]))}},n[i].__init__.$infos={__name__:n[i].$infos.__name__}}o[_++]=n[i];var c=n[i].__mro__;c[0]===n[i]&&c.splice(0,1);for(var u=0;u<c.length;u++)o[_++]=c[u];s[a++]=o}-1==n.indexOf(t.object)&&(n=n.concat(t.tuple.$factory([t.object]))),s[a++]=n.slice();for(var f=[r],p=1;;){var d=[];for(_=0,i=0;i<s.length;i++)s[i].length>0&&(d[_++]=s[i]);if(0==d.length)break;for(i=0;i<d.length;i++){for(var h=d[i][0],$=[],m=(_=0,0);m<d.length;m++){var b=d[m];b.slice(1).indexOf(h)>-1&&($[_++]=b)}if(!($.length>0))break;h=null}if(null===h)throw t.TypeError.$factory("inconsistent hierarchy, no C3 MRO is possible");f[p++]=h;for(i=0;i<s.length;i++){s[i][0]===h&&s[i].shift()}}return f[f.length-1]!==t.object&&(f[p++]=t.object),f},r.__subclasscheck__=function(r,n){var s=r;return s===t.str?s=e.StringSubclass:s===t.float&&(s=e.FloatSubclass),void 0===n.__bases__?r===t.object:n.__bases__.indexOf(s)>-1},e.set_func_names(r,"builtins"),t.type=r;var n=e.make_class("wrapper_descriptor");e.set_func_names(n,"builtins"),r.__call__.__class__=n;e.$instance_creator=function(r){if(void 0!==r.$instanciable)return function(){throw t.TypeError.$factory("Can't instantiate abstract class interface with abstract methods")};var n,s=r.__class__;if(s!==t.type||r.__bases__&&0!=r.__bases__.length){n=t.type.__getattribute__(s,"__call__");var a=function(){return n.bind(null,r).apply(null,arguments)}}else a=r.hasOwnProperty("__new__")?r.hasOwnProperty("__init__")?function(){var e=r.__new__.bind(null,r).apply(null,arguments);return r.__init__.bind(null,e).apply(null,arguments),e}:function(){return r.__new__.bind(null,r).apply(null,arguments)}:r.hasOwnProperty("__init__")?function(){var e={__class__:r,__dict__:t.dict.$factory()};return r.__init__.bind(null,e).apply(null,arguments),e}:function(){if(arguments.length>0&&(1!=arguments.length||!arguments[0].$nat||0!=Object.keys(arguments[0].kw).length))throw t.TypeError.$factory("object() takes no parameters");return{__class__:r,__dict__:t.dict.$factory()}};return a.__class__=e.Function,a.$infos={__name__:r.$infos.__name__,__module__:r.$infos.__module__},a};var s=e.method_wrapper=e.make_class("method_wrapper",function(e,t,r){var n=function(){return r.apply(null,arguments)};return n.$infos={__name__:e,__module__:t.__module__},n});s.__str__=s.__repr__=function(e){return"<method '"+e.$infos.__name__+"' of function object>"};var a=e.make_class("member_descriptor",function(e,t){return{__class__:a,cls:t,attr:e}});a.__str__=a.__repr__=function(e){return"<member '"+e.attr+"' of '"+e.cls.$infos.__name__+"' objects>"},e.set_func_names(a,"builtins");var i=e.method=e.make_class("method",function(t,r){var n=function(){return e.$call(t).bind(null,r).apply(null,arguments)};return n.__class__=i,n.$infos=t.$infos,n});i.__eq__=function(e,t){return void 0!==e.$infos&&void 0!==t.$infos&&e.$infos.__func__===t.$infos.__func__&&e.$infos.__self__===t.$infos.__self__},i.__ne__=function(t,r){return!e.method.__eq__(t,r)},i.__get__=function(t){var r=function(){return t(arguments)};return r.__class__=e.method_wrapper,r.$infos=i.$infos,r},i.__getattribute__=function(r,n){var s=r.$infos;if(s&&s[n]){if("__code__"==n){var a={__class__:e.Code};for(var n in s.__code__)a[n]=s.__code__[n];return a}return s[n]}return i.hasOwnProperty(n)?t.object.__getattribute__(r,n):e.Function.__getattribute__(r.$infos.__func__,n)},i.__repr__=i.__str__=function(e){return"<bound method "+e.$infos.__qualname__+" of "+t.str.$factory(e.$infos.__self__)+">"},i.__setattr__=function(e,r,n){if("__class__"==r)throw t.TypeError.$factory("__class__ assignment only supported for heap types or ModuleType subclasses");throw t.AttributeError.$factory("'method' object has no attribute '"+r+"'")},e.set_func_names(i,"builtins"),e.method_descriptor=e.make_class("method_descriptor"),e.classmethod_descriptor=e.make_class("classmethod_descriptor"),t.object.__class__=r}(__BRYTHON__),function($B){var _b_=$B.builtins,_window=self,isWebWorker="undefined"!=typeof WorkerGlobalScope&&"function"==typeof importScripts&&navigator instanceof WorkerNavigator;function index_error(e){var t="string"==typeof e?"string":"list";throw _b_.IndexError.$factory(t+" index out of range")}$B.args=function(e,t,r,n,s,a,i,o){e.startsWith("lambda_"+$B.lambda_magic)&&(e="<lambda>");var _=[];if(Array.isArray(s))_=s;else for(var l=0,c=s.length;l<c;l++)_.push(s[l]);var u,f,p=!1,d=_.length,h=0,$=n.indexOf("/");if(-1!=$&&(n.splice($,1),f=n.slice(0,$)),d>0&&_[d-1]&&_[d-1].$nat&&(d--,Object.keys(_[d].kw).length>0)){p=!0;var m=_[d].kw;Array.isArray(m)&&(m=$B.extend(e,...m))}if(i&&(r[i]=[],r[i].__class__=_b_.tuple),o&&(u=_b_.dict.__new__(_b_.dict)),d>t){if(null===i||"*"==i)throw w=e+"() takes "+t+" positional argument"+(t>1?"s":"")+" but more were given",_b_.TypeError.$factory(w);for(l=t;l<d;l++)r[i].push(_[l]);d=t}for(l=0;l<d;l++)r[n[l]]=_[l],h++;if(h==t&&t===n.length&&!p)return o&&(r[o]=u),r;if(p)for(var b in m){var g=m[b],y=$B.to_alias(b);if(void 0===r[y]){if(!o)throw _b_.TypeError.$factory(e+"() got an unexpected keyword argument '"+b+"'");"$$"==b.substr(0,2)&&(b=b.substr(2)),u.$string_dict[b]=[g,u.$version],u.$version++}else{if(null!==r[y])throw _b_.TypeError.$factory(e+"() got multiple values for argument '"+b+"'");if(f&&f.indexOf(y)>-1)throw _b_.TypeError.$factory(e+"() got an unexpected keyword argument '"+b+"'");r[y]=g}}var v=[];for(var x in r)null===r[x]&&(void 0!==a[x]?r[x]=a[x]:v.push("'"+x+"'"));if(v.length>0){if(1==v.length)throw _b_.TypeError.$factory(e+" missing 1 positional argument: "+v[0]);var w=e+" missing "+v.length+" positional arguments: ";throw w+=v.join(" and "),_b_.TypeError.$factory(w)}return o&&(r[o]=u),r},$B.wrong_nb_args=function(e,t,r,n){if(t<r){var s=r-t;throw _b_.TypeError.$factory(e+"() missing "+s+" positional argument"+(s>1?"s":"")+": "+n.slice(t))}throw _b_.TypeError.$factory(e+"() takes "+r+" positional argument"+(r>1?"s":"")+" but more were given")},$B.get_class=function(e){if(null===e)return $B.$NoneDict;if(void 0===e)return $B.UndefinedClass;var t=e.__class__;if(void 0===t)switch(typeof e){case"number":return e%1==0?_b_.int:_b_.float;case"string":return _b_.str;case"boolean":return _b_.bool;case"function":return e.__class__=$B.Function,$B.Function;case"object":if(Array.isArray(e)){if(Object.getPrototypeOf(e)===Array.prototype)return e.__class__=_b_.list,_b_.list}else if(e.constructor===Number)return _b_.float}return t},$B.class_name=function(e){return $B.get_class(e).$infos.__name__},$B.$list_comp=function(e){for(var t=$B.UUID(),r="x"+t+"=[]\n",n=0,s=1,a=e.length;s<a;s++){var i=e[s].replace(/\s+$/,"").replace(/\n/g,"");r+=" ".repeat(n)+i+":\n",n+=4}return r+=" ".repeat(n),[r+="x"+t+".append("+e[0]+")\n",t]},$B.$dict_comp=function(e,t,r,n){for(var s=$B.UUID(),a="res"+s,i=a+"={}\n",o=0,_=1,l=r.length;_<l;_++){var c=r[_].replace(/\s+$/,"").replace(/\n/g,"");i+=" ".repeat(o)+c+":\n",o++}i+=" ".repeat(o)+a+".update({"+r[0]+"})";var u=n+","+e,f="dc"+s,p=$B.py2js({src:i,is_comp:!0,line_info:u},e,f,t,n).to_js();return p="(function($locals_"+f+"){"+(p+='\nreturn $locals["'+a+'"]\n')+"})({$dict_comp: true})",$B.clear_ns(f),delete $B.$py_src[f],p},$B.$gen_expr=function(e,t,r,n,s){for(var a=$B.UUID(),i=(s?"set_comp"+$B.lambda_magic:"__ge")+a,o="def "+i+"():\n",_=1,l=1,c=r.length;l<c;l++){var u=r[l].replace(/\s+$/,"").replace(/\n/g,"");o+=" ".repeat(_)+u+":\n",_+=4}o+=" ".repeat(_),o+="yield ("+r[0]+")";var f=n+","+e,p=$B.py2js({src:o,is_comp:!0,line_info:f},i,i,t,n).to_js(),d=p.split("\n");return p=d.join("\n"),p="(function($locals_"+i+"){"+(p+="\nvar $res = $locals_"+i+'["'+i+'"]();\n$res.is_gen_expr = true;\nreturn $res\n')+"})({})\n"},$B.clear_ns=function(e){e.startsWith("__ge")&&console.log("clear ns",e);var t=e.length;for(var r in $B.$py_module_path)r.substr(0,t)==e&&($B.$py_module_path[r]=null,delete $B.$py_module_path[r]);$B.$py_src[e]=null,delete $B.$py_src[e];var n=e.replace(/\./g,"_");n!=e&&$B.clear_ns(n)},$B.from_alias=function(e){return"$$"==e.substr(0,2)&&$B.aliased_names[e.substr(2)]?e.substr(2):e},$B.$search=function(e,t){var r=$B.last($B.frames_stack);if(void 0!==r[1][e])return r[1][e];if(void 0!==r[3][e])return r[3][e];if(void 0!==_b_[e])return _b_[e];throw r[0]==r[2]||"class"==r[1].$type||r[1].$exec_locals?_b_.NameError.$factory("name '"+e+"' is not defined"):_b_.UnboundLocalError.$factory("local variable '"+e+"' referenced before assignment")},$B.$global_search=function(e,t){for(var r=0;r<$B.frames_stack.length;r++){var n=$B.frames_stack[r];if(t.indexOf(n[0])>-1&&void 0!==n[1][e])return n[1][e];if(t.indexOf(n[2])>-1&&void 0!==n[3][e])return n[3][e]}for(r=0;r<t.length;r++){var s=t[r];if($B.imported[s]&&$B.imported[s][e])return $B.imported[s][e]}throw _b_.NameError.$factory("name '"+$B.from_alias(e)+"' is not defined")},$B.$local_search=function(e){var t=$B.last($B.frames_stack);if(void 0!==t[1][e])return t[1][e];throw _b_.UnboundLocalError.$factory("local variable '"+$B.from_alias(e)+"' referenced before assignment")},$B.$check_def=function(e,t){if(void 0!==t)return t;if(void 0!==_b_[e])return _b_[e];throw _b_.NameError.$factory("name '"+$B.from_alias(e)+"' is not defined")},$B.$check_def_local=function(e,t){if(void 0!==t)return t;throw _b_.UnboundLocalError.$factory("local variable '"+$B.from_alias(e)+"' referenced before assignment")},$B.$check_def_free=function(e,t){if(void 0!==t)return t;for(var r,n=$B.frames_stack.length-1;n>=0;n--){if(void 0!==(r=$B.frames_stack[n][1][e]))return r;if(void 0!==(r=$B.frames_stack[n][3][e]))return r}throw _b_.NameError.$factory("free variable '"+$B.from_alias(e)+"' referenced before assignment in enclosing scope")},$B.$check_def_free1=function(e,t){for(var r,n=$B.frames_stack.length-1;n>=0;n--){var s=$B.frames_stack[n];if(void 0!==(r=s[1][e]))return r;if(s[1].$parent&&void 0!==(r=s[1].$parent[e]))return r;if(s[2]==t&&void 0!==(r=s[3][e]))return r}throw _b_.NameError.$factory("free variable '"+$B.from_alias(e)+"' referenced before assignment in enclosing scope")},$B.$JS2Py=function(e){if("number"==typeof e)return e%1==0?e:_b_.float.$factory(e);if(null==e)return _b_.None;Array.isArray(e)&&Object.getPrototypeOf(e)===Array.prototype&&(e.$brython_class="js");var t=$B.get_class(e);if(void 0!==t){if(t!==$B.JSObject)return e;e=e.js}if("object"==typeof e){if($B.$isNode(e))return $B.DOMNode.$factory(e);if($B.$isEvent(e))return $B.$DOMEvent(e);if($B.$isNodeList(e))return $B.DOMNode.$factory(e)}return $B.JSObject.$factory(e)},$B.list_key=function(e,t){(t=$B.$GetInt(t))<0&&(t+=e.length);var r=e[t];if(void 0===r)throw _b_.IndexError.$factory("list index out of range");return r},$B.list_slice=function(e,t,r){return null===t?t=0:(t=$B.$GetInt(t))<0&&(t=Math.max(0,t+e.length)),null===r?e.slice(t):((r=$B.$GetInt(r))<0&&(r=Math.max(0,r+e.length)),e.slice(t,r))},$B.list_slice_step=function(e,t,r,n){if(null===n||1==n)return $B.list_slice(e,t,r);if(0==n)throw _b_.ValueError.$factory("slice step cannot be zero");n=$B.$GetInt(n),null===t?t=n>=0?0:e.length-1:(t=$B.$GetInt(t))<0&&(t=Math.min(0,t+e.length)),null===r?r=n>=0?e.length:-1:(r=$B.$GetInt(r))<0&&(r=Math.max(0,r+e.length));var s=[];if(n>0)for(var a=t;a<r;a+=n)s.push(e[a]);else for(a=t;a>r;a+=n)s.push(e[a]);return s},$B.$getitem=function(e,t){var r=Array.isArray(e)&&e.__class__===_b_.list;if("number"==typeof t&&(r||"string"==typeof e)){if(void 0!==e[t=t>=0?t:e.length+t])return e[t];index_error(e)}try{t=$B.$GetInt(t)}catch(e){}if((r||"string"==typeof e)&&"number"==typeof t){if(void 0!==e[t=t>=0?t:e.length+t])return e[t];index_error(e)}if(e.$is_class){var n=$B.$getattr(e,"__class_getitem__",_b_.None);if(n!==_b_.None)return n(t);if(e.__class__&&(n=$B.$getattr(e.__class__,"__getitem__",_b_.None))!==_b_.None)return n(e,t)}var s=$B.$getattr(e,"__getitem__",_b_.None);if(s!==_b_.None)return s(t);throw _b_.TypeError.$factory("'"+$B.class_name(e)+"' object is not subscriptable")},$B.set_list_key=function(e,t,r){try{t=$B.$GetInt(t)}catch(s){if(_b_.isinstance(t,_b_.slice)){var n=_b_.slice.$conv_for_seq(t,e.length);return $B.set_list_slice_step(e,n.start,n.stop,n.step,r)}}if(t<0&&(t+=e.length),void 0===e[t])throw console.log(e,t),_b_.IndexError.$factory("list assignment index out of range");e[t]=r},$B.set_list_slice=function(e,t,r,n){null===t?t=0:(t=$B.$GetInt(t))<0&&(t=Math.max(0,t+e.length)),null===r&&(r=e.length),(r=$B.$GetInt(r))<0&&(r=Math.max(0,r+e.length));var s=_b_.list.$factory(n);e.splice.apply(e,[t,r-t].concat(s))},$B.set_list_slice_step=function(e,t,r,n,s){if(null===n||1==n)return $B.set_list_slice(e,t,r,s);if(0==n)throw _b_.ValueError.$factory("slice step cannot be zero");n=$B.$GetInt(n),t=null===t?n>0?0:e.length-1:$B.$GetInt(t),r=null===r?n>0?e.length:-1:$B.$GetInt(r);var a,i=_b_.list.$factory(s),o=0,_=0;a=n>0?function(e){return e<r}:function(e){return e>r};for(var l=t;a(l);l+=n)_++;if(_!=i.length)throw _b_.ValueError.$factory("attempt to assign sequence of size "+i.length+" to extended slice of size "+_);for(l=t;a(l);l+=n)e[l]=i[o],o++},$B.$setitem=function(e,t,r){if(!Array.isArray(e)||void 0!==e.__class__||"number"!=typeof t||_b_.isinstance(e,_b_.tuple))if(e.__class__!==_b_.dict){if(e.__class__!==$B.JSObject)return e.__class__===_b_.list?_b_.list.$setitem(e,t,r):void $B.$getattr(e,"__setitem__")(t,r);$B.JSObject.__setattr__(e,t,r)}else _b_.dict.$setitem(e,t,r);else{if(t<0&&(t+=e.length),void 0===e[t])throw _b_.IndexError.$factory("list assignment index out of range");e[t]=r}},$B.augm_item_add=function(e,t,r){if(Array.isArray(e)&&"number"==typeof t&&void 0!==e[t]){if(Array.isArray(e[t])&&Array.isArray(r)){for(var n=0,s=r.length;n<s;n++)e[t].push(r[n]);return}if("string"==typeof e[t]&&"string"==typeof r)return void(e[t]+=r)}var a=$B.$getattr;try{var i=a(a(e,"__getitem__")(t),"__iadd__")}catch(n){return void a(e,"__setitem__")(t,a(a(e,"__getitem__")(t),"__add__")(r))}i(r)};for(var augm_item_src=""+$B.augm_item_add,augm_ops=[["-=","sub"],["*=","mul"]],i=0,len=augm_ops.length;i<len;i++){var augm_code=augm_item_src.replace(/add/g,augm_ops[i][1]);augm_code=augm_code.replace(/\+=/g,augm_ops[i][0]),eval("$B.augm_item_"+augm_ops[i][1]+"="+augm_code)}$B.extend=function(e,t){for(var r=2;r<arguments.length;r++)for(var n=arguments[r],s=_b_.iter(n),a=$B.$getattr(n,"__getitem__");;)try{var i=_b_.next(s);if("string"!=typeof i)throw _b_.TypeError.$factory(e+"() keywords must be strings");if(void 0!==t[i])throw _b_.TypeError.$factory(e+"() got multiple values for argument '"+i+"'");t[i]=a(i)}catch(e){if(_b_.isinstance(e,[_b_.StopIteration]))break;throw e}return t},$B.extend_list=function(){for(var e=Array.prototype.slice.call(arguments,0,arguments.length-1),t=$B.last(arguments),r=_b_.iter(t);;)try{e.push(_b_.next(r))}catch(e){if(_b_.isinstance(e,[_b_.StopIteration]))break;throw e}return e},$B.$test_item=function(e){return $B.$test_result=e,_b_.bool.$factory(e)},$B.$test_expr=function(){return $B.$test_result},$B.$is=function(e,t){return e instanceof Number&&t instanceof Number?e.valueOf()==t.valueOf():e===t},$B.$is_member=function(e,t){var r,n,s;try{s=$B.$getattr(t.__class__||$B.get_class(t),"__contains__")}catch(e){}if(s)return $B.$call(s)(t,e);try{n=_b_.iter(t)}catch(e){}if(n)for(;;)try{var a=_b_.next(n);if($B.rich_comp("__eq__",a,e))return!0}catch(e){return!1}try{r=$B.$getattr(t,"__getitem__")}catch(e){throw _b_.TypeError.$factory("'"+$B.class_name(t)+"' object is not iterable")}if(r)for(var i=-1;;){i++;try{a=r(i);if($B.rich_comp("__eq__",a,e))return!0}catch(e){if(e.__class__===_b_.IndexError)return!1;throw e}}},$B.$call=function(e){if(e.__class__===$B.method)return e;if(e.$is_func||"function"==typeof e)return e;if(e.$factory)return e.$factory;if(e.$is_class)return e.$factory=$B.$instance_creator(e);if(e.__class__===$B.JSObject){if("function"==typeof e.js)return e.js;throw _b_.TypeError.$factory("'"+$B.class_name(e)+"' object is not callable")}try{return $B.$getattr(e,"__call__")}catch(t){throw _b_.TypeError.$factory("'"+$B.class_name(e)+"' object is not callable")}};var $io=$B.make_class("io",function(){return{__class__:$io}});function $err(e,t,r){var n="unsupported operand type(s) for "+e+": '"+t.$infos.__name__+"' and '"+$B.class_name(r)+"'";throw _b_.TypeError.$factory(n)}$io.flush=function(){},$io.write=function(e,t){return console.log(t),_b_.None},$B.stderr=$io.$factory(),$B.stdout=$io.$factory(),$B.stdin={__class__:$io,__original__:!0,closed:!1,len:1,pos:0,read:function(){return""},readline:function(){return""}},$B.make_iterator_class=function(e){var t={__class__:_b_.type,__mro__:[_b_.object],$factory:function(e){return{__class__:t,__dict__:_b_.dict.$factory(),counter:-1,items:e,len:e.length}},$infos:{__name__:e},$is_class:!0,__iter__:function(e){return e.counter=void 0===e.counter?-1:e.counter,e.len=e.items.length,e},__len__:function(e){return e.items.length},__next__:function(e){if("function"==typeof e.len_func&&e.len_func()!=e.len)throw _b_.RuntimeError.$factory("dictionary changed size during iteration");if(e.counter++,e.counter<e.items.length){var t=e.items[e.counter];return"js"==e.items.$brython_class&&(t=$B.$JS2Py(t)),t}throw _b_.StopIteration.$factory("StopIteration")},__reduce_ex__:function(e,t){return $B.fast_tuple([_b_.iter,_b_.tuple.$factory([e.items])])}};return $B.set_func_names(t,"builtins"),t};var ropnames=["add","sub","mul","truediv","floordiv","mod","pow","lshift","rshift","and","xor","or"],ropsigns=["+","-","*","/","//","%","**","<<",">>","&","^","|"];function exit_ctx_managers_in_generators(e){for(key in e[1])if(e[1][key]&&e[1][key].$is_generator_obj){var t=e[1][key];if(void 0!==t.env)for(var r in t.env)if(r.search(/^\$ctx_manager_exit\d+$/)>-1)return $B.$call(t.env[r])(),!0}}$B.make_rmethods=function(e){for(var t=0,r=ropnames.length;t<r;t++)void 0===e["__"+ropnames[t]+"__"]&&(e["__"+ropnames[t]+"__"]=function(t,r){return function(n,s){try{return $B.$getattr(s,"__r"+t+"__")(n)}catch(t){$err(r,e,s)}}}(ropnames[t],ropsigns[t]))},$B.UUID=function(){return $B.$py_UUID++},$B.InjectBuiltins=function(){var e=["var _b_ = $B.builtins"],t=1;for(var r in $B.builtins)e[t++]="var "+r+'=_b_["'+r+'"]';return e.join(";")},$B.$GetInt=function(e){if("number"==typeof e||e.constructor===Number)return e;if("boolean"==typeof e)return e?1:0;if(_b_.isinstance(e,_b_.int))return e;if(_b_.isinstance(e,_b_.float))return e.valueOf();if(!e.$is_class){try{return $B.$getattr(e,"__int__")()}catch(e){}try{return $B.$getattr(e,"__index__")()}catch(e){}}throw _b_.TypeError.$factory("'"+$B.class_name(e)+"' object cannot be interpreted as an integer")},$B.to_num=function(e,t){for(var r={__complex__:_b_.complex,__float__:_b_.float,__index__:_b_.int,__int__:_b_.int},n=e.__class__||$B.get_class(e),s=0;s<t.length;s++){var a={},i=$B.$getattr(n,t[s],a);if(i!==a){var o=i(e);if(!_b_.isinstance(o,r[t[s]]))throw console.log(o,t[s],r[t[s]]),_b_.TypeError.$factory(t[s]+"returned non-"+r[t[s]].$infos.__name__+"(type "+$B.get_class(o)+")");return o}}return null},$B.PyNumber_Index=function(e){switch(typeof e){case"boolean":return e?1:0;case"number":return e;case"object":if(e.__class__===$B.long_int)return e;if(_b_.isinstance(e,_b_.int))return e.$brython_value;var t=$B.$getattr(e,"__index__",_b_.None);if(t!==_b_.None)return t="function"==typeof t?t:$B.$getattr(t,"__call__"),$B.int_or_bool(t());default:throw _b_.TypeError.$factory("'"+$B.class_name(e)+"' object cannot be interpreted as an integer")}},$B.int_or_bool=function(e){switch(typeof e){case"boolean":return e?1:0;case"number":return e;case"object":if(e.__class__===$B.long_int)return e;throw _b_.TypeError.$factory("'"+$B.class_name(e)+"' object cannot be interpreted as an integer");default:throw _b_.TypeError.$factory("'"+$B.class_name(e)+"' object cannot be interpreted as an integer")}},$B.enter_frame=function(e){if($B.frames_stack.push(e),$B.tracefunc&&$B.tracefunc!==_b_.None){if(e[4]===$B.tracefunc||$B.tracefunc.$infos&&e[4]&&e[4]===$B.tracefunc.$infos.__func__)return $B.tracefunc.$frame_id=e[0],_b_.None;for(var t=$B.frames_stack.length-1;t>=0;t--)if($B.frames_stack[t][0]==$B.tracefunc.$frame_id)return _b_.None;return $B.tracefunc($B._frame.$factory($B.frames_stack,$B.frames_stack.length-1),"call",_b_.None)}return _b_.None},$B.trace_exception=function(){var e=$B.last($B.frames_stack);if(e[0]==$B.tracefunc.$current_frame_id)return _b_.None;var t=e[1].$f_trace,r=e[1].$current_exception;return t($B._frame.$factory($B.frames_stack,$B.frames_stack.length-1),"exception",$B.fast_tuple([r.__class__,r,$B.traceback.$factory(r)]))},$B.trace_line=function(){var e=$B.last($B.frames_stack);return e[0]==$B.tracefunc.$current_frame_id?_b_.None:(0,e[1].$f_trace)($B._frame.$factory($B.frames_stack,$B.frames_stack.length-1),"line",_b_.None)},$B.set_line=function(e){var t=$B.last($B.frames_stack);if($B.tracefunc&&t[0]==$B.tracefunc.$current_frame_id)return _b_.None;t[1].$line_info=e;var r=t[1].$f_trace;if(r!==_b_.None){var n=$B._frame.$factory($B.frames_stack,$B.frames_stack.length-1);t[1].$ftrace=r(n,"line",_b_.None)}return!0},$B.trace_return=function(e){var t=$B.last($B.frames_stack),r=t[1].$f_trace,n=$B._frame.$factory($B.frames_stack,$B.frames_stack.length-1);if(t[0]==$B.tracefunc.$current_frame_id)return _b_.None;r(n,"return",e)},$B.set_cm_in_generator=function(e){void 0!==e&&$B.frames_stack.forEach(function(t){t[1].$cm_in_gen=t[1].$cm_in_gen||new Set,t[1].$cm_in_gen.add(e)})},$B.leave_frame=function(e){if(0!=$B.frames_stack.length){$B.del_exc(),e&&void 0!==e.value&&$B.tracefunc&&(void 0===$B.last($B.frames_stack)[1].$f_trace&&($B.last($B.frames_stack)[1].$f_trace=$B.tracefunc),$B.last($B.frames_stack)[1].$f_trace!==_b_.None&&$B.trace_return(e.value));var t=$B.frames_stack.pop();if(t[1].$has_yield_in_cm)!exit_ctx_managers_in_generators(t)&&$B.frames_stack.length>0&&($B.last($B.frames_stack)[1].$has_yield_in_cm=!0);return _b_.None}console.log("empty stack")},$B.leave_frame_exec=function(e){if($B.profile>0&&$B.$profile.return(),0!=$B.frames_stack.length){var t=$B.frames_stack.pop();exit_ctx_managers_in_generators(t);for(var r=$B.frames_stack.length-1;r>=0;r--)$B.frames_stack[r][2]==t[2]&&($B.frames_stack[r][3]=t[3])}else console.log("empty stack")};var min_int=Math.pow(-2,53),max_int=Math.pow(2,53)-1;$B.is_safe_int=function(){for(var e=0;e<arguments.length;e++){var t=arguments[e];if(t<min_int||t>max_int)return!1}return!0},$B.add=function(e,t){if("number"==typeof e.valueOf()&&"number"==typeof t.valueOf()){if("number"==typeof e&&"number"==typeof t){var r=e+t;return r<max_int?r:$B.long_int.__add__($B.long_int.$factory(e),$B.long_int.$factory(t))}return new Number(e+t)}if("string"==typeof e&&"string"==typeof t)return e+t;try{var n=$B.$getattr(e.__class__||$B.get_class(e),"__add__")}catch(r){if(r.__class__===_b_.AttributeError)throw _b_.TypeError.$factory("unsupported operand type(s) for +: '"+$B.class_name(e)+"' and '"+$B.class_name(t)+"'");throw r}var s=$B.$call(n)(e,t);return s===_b_.NotImplemented?$B.rich_op("add",e,t):s},$B.div=function(e,t){var r=e/t;return e>min_int&&e<max_int&&t>min_int&&t<max_int&&r>min_int&&r<max_int?r:$B.long_int.__truediv__($B.long_int.$factory(e),$B.long_int.$factory(t))},$B.eq=function(e,t){return e>min_int&&e<max_int&&t>min_int&&t<max_int?e==t:$B.long_int.__eq__($B.long_int.$factory(e),$B.long_int.$factory(t))},$B.floordiv=function(e,t){var r=e/t;return e>min_int&&e<max_int&&t>min_int&&t<max_int&&r>min_int&&r<max_int?Math.floor(r):$B.long_int.__floordiv__($B.long_int.$factory(e),$B.long_int.$factory(t))},$B.mul=function(e,t){var r="number"!=typeof e||"number"!=typeof t?new Number(e*t):e*t;return e>min_int&&e<max_int&&t>min_int&&t<max_int&&r>min_int&&r<max_int?r:"number"!=typeof e&&e.__class__!==$B.long_int||"number"!=typeof t&&t.__class__!==$B.long_int?r:"number"==typeof e&&isNaN(e)||"number"==typeof t&&isNaN(t)?_b_.float.$factory("nan"):$B.long_int.__mul__($B.long_int.$factory(e),$B.long_int.$factory(t))},$B.sub=function(e,t){var r="number"!=typeof e||"number"!=typeof t?new Number(e-t):e-t;return e>min_int&&e<max_int&&t>min_int&&t<max_int&&r>min_int&&r<max_int?r:"number"!=typeof e&&e.__class__!==$B.long_int||"number"!=typeof t&&t.__class__!==$B.long_int?r:"number"==typeof e&&isNaN(e)||"number"==typeof t&&isNaN(t)?_b_.float.$factory("nan"):$B.long_int.__sub__($B.long_int.$factory(e),$B.long_int.$factory(t))},$B.ge=function(e,t){return"number"==typeof e&&"number"==typeof t?e>=t:"number"==typeof e&&"number"!=typeof t?!t.pos:"number"!=typeof e&&"number"==typeof t?!0===e.pos:$B.long_int.__ge__(e,t)},$B.gt=function(e,t){return"number"==typeof e&&"number"==typeof t?e>t:"number"==typeof e&&"number"!=typeof t?!t.pos:"number"!=typeof e&&"number"==typeof t?!0===e.pos:$B.long_int.__gt__(e,t)};var reversed_op={__lt__:"__gt__",__le__:"__ge__",__gt__:"__lt__",__ge__:"__le__"},method2comp={__lt__:"<",__le__:"<=",__gt__:">",__ge__:">="};$B.rich_comp=function(e,t,r){var n=t.valueOf(),s=r.valueOf();if("number"==typeof n&&"number"==typeof s&&void 0===t.__class__&&void 0===r.__class__)switch(e){case"__eq__":return n==s;case"__ne__":return n!=s;case"__le__":return n<=s;case"__lt__":return n<s;case"__ge__":return n>=s;case"__gt__":return n>s}var a,i,o=!1;if(t.$is_class||t.$factory){if("__eq__"==e)return t===r;if("__ne__"==e)return!(t===r);throw _b_.TypeError.$factory("'"+method2comp[e]+"' not supported between instances of '"+$B.class_name(t)+"' and '"+$B.class_name(r)+"'")}if(t.__class__&&r.__class__&&r.__class__.__mro__.indexOf(t.__class__)>-1){i=reversed_op[e]||e;$B.$getattr(r,i);if((a=$B.$call($B.$getattr(r,i))(t))!==_b_.NotImplemented)return a;o=!0}if((a=$B.$call($B.$getattr(t,e))(r))!==_b_.NotImplemented)return a;if(o)return!1;if(i=reversed_op[e]||e,(a=$B.$call($B.$getattr(r,i))(t))!==_b_.NotImplemented)return a;if("__eq__"==e)return _b_.False;if("__ne__"==e)return _b_.True;throw _b_.TypeError.$factory("'"+method2comp[e]+"' not supported between instances of '"+$B.class_name(t)+"' and '"+$B.class_name(r)+"'")};var opname2opsign={sub:"-",xor:"^",mul:"*"};$B.rich_op=function(e,t,r){var n,s;if((t.__class__||$B.get_class(t))===(r.__class__||$B.get_class(r))){try{n=$B.$call($B.$getattr(t,"__"+e+"__"))}catch(r){if(r.__class__===_b_.AttributeError){var a=$B.class_name(t);throw _b_.TypeError.$factory("unsupported operand type(s) for "+opname2opsign[e]+": '"+a+"' and '"+a+"'")}throw r}return n(r)}try{n=$B.$call($B.$getattr(t,"__"+e+"__"))}catch(n){if(n.__class__!==_b_.AttributeError)throw n;if((s=$B.$call($B.$getattr(r,"__r"+e+"__"))(t))!==_b_.NotImplemented)return s;throw _b_.TypeError.$factory("'"+(opname2opsign[e]||e)+"' not supported between instances of '"+$B.class_name(t)+"' and '"+$B.class_name(r)+"'")}if((s=n(r))===_b_.NotImplemented){if((s=$B.$call($B.$getattr(r,"__r"+e+"__"))(t))!==_b_.NotImplemented)return s;throw _b_.TypeError.$factory("'"+(opname2opsign[e]||e)+"' not supported between instances of '"+$B.class_name(t)+"' and '"+$B.class_name(r)+"'")}return s},$B.is_none=function(e){return null==e||e==_b_.None};var repr_stack=new Set;$B.repr={enter:function(e){if(repr_stack.has(e))return!0;repr_stack.add(e)},leave:function(e){repr_stack.delete(e)}}}(__BRYTHON__),function($B){var bltns=$B.InjectBuiltins();eval(bltns),_b_.__debug__=!1;var object=_b_.object,odga=object.__getattribute__;$B.$comps={">":"gt",">=":"ge","<":"lt","<=":"le"},$B.$inv_comps={">":"lt",">=":"le","<":"gt","<=":"ge"};var check_nb_args=$B.check_nb_args=function(e,t,r){var n=r.length,s=r[n-1];if(s&&"kw"==s.$nat){var a=s.kw;Array.isArray(a)&&a[1]&&a[1].__class__===_b_.dict&&0==Object.keys(a[1].$string_dict).length&&n--}if(n!=t)throw 0==t?_b_.TypeError.$factory(e+"() takes no argument ("+n+" given)"):_b_.TypeError.$factory(e+"() takes exactly "+t+" argument"+(t<2?"":"s")+" ("+n+" given)")},check_no_kw=$B.check_no_kw=function(e,t,r){if(void 0===t&&console.log("x undef",e,t,r),t.$nat&&t.kw&&t.kw[0]&&t.kw[0].length>0||void 0!==r&&r.$nat)throw _b_.TypeError.$factory(e+"() takes no keyword arguments")},NoneType={$factory:function(){return None},$infos:{__name__:"NoneType",__module__:"builtins"},__bool__:function(e){return False},__class__:_b_.type,__hash__:function(e){return 0},__mro__:[object],__repr__:function(e){return"None"},__str__:function(e){return"None"},$is_class:!0,__setattr__:function(e,t){return no_set_attr(NoneType,t)}},None={__class__:NoneType};for(var $op in $B.$comps){var key=$B.$comps[$op];switch(key){case"ge":case"gt":case"le":case"lt":NoneType["__"+key+"__"]=function(e){return _b_.NotImplemented}}}for(var $func in None)"function"==typeof None[$func]&&(None[$func].__str__=function(e){return function(){return"<method-wrapper "+e+" of NoneType object>"}}($func));function abs(e){if(check_nb_args("abs",1,arguments),check_no_kw("abs",e),isinstance(e,_b_.int))return e.__class__===$B.long_int?{__class__:$B.long_int,value:e.value,pos:!0}:_b_.int.$factory(Math.abs(e));if(isinstance(e,_b_.float))return _b_.float.$factory(Math.abs(e));var t=e.__class__||$B.get_class(e);try{var r=$B.$getattr(t,"__abs__")}catch(t){if(t.__class__===_b_.AttributeError)throw _b_.TypeError.$factory("Bad operand type for abs(): '"+$B.class_name(e)+"'");throw t}return $B.$call(r)(e)}function all(e){check_nb_args("all",1,arguments),check_no_kw("all",e);for(var t=iter(e);;)try{var r=next(t);if(!$B.$bool(r))return!1}catch(e){return!0}}function any(e){check_nb_args("any",1,arguments),check_no_kw("any",e);for(var t=iter(e);;)try{var r=next(t);if($B.$bool(r))return!0}catch(e){return!1}}function ascii(e){check_nb_args("ascii",1,arguments),check_no_kw("ascii",e);for(var t,r=repr(e),n="",s=0;s<r.length;s++)if((t=r.charCodeAt(s))<128)n+=r.charAt(s);else if(t<256)n+="\\x"+t.toString(16);else{var a=t.toString(16);a.length%2==1&&(a="0"+a),n+="\\u"+a}return n}function $builtin_base_convert_helper(e,t){var r="";switch(t){case 2:r="0b";break;case 8:r="0o";break;case 16:r="0x";break;default:console.log("invalid base:"+t)}if(e.__class__===$B.long_int)return e.pos?r+$B.long_int.to_base(e,t):"-"+r+$B.long_int.to_base(-e,t);var n=$B.$GetInt(e);if(void 0===n)throw _b_.TypeError.$factory("Error, argument must be an integer or contains an __index__ function");return n>=0?r+n.toString(t):"-"+r+(-n).toString(t)}function bin_hex_oct(e,t){if(isinstance(t,_b_.int))return $builtin_base_convert_helper(t,e);try{var r=t.__class__||$B.get_class(t),n=$B.$getattr(r,"__index__")}catch(e){if(e.__class__===_b_.AttributeError)throw _b_.TypeError.$factory("'"+$B.class_name(t)+"' object cannot be interpreted as an integer");throw e}return $builtin_base_convert_helper($B.$call(n)(t),e)}function bin(e){return check_nb_args("bin",1,arguments),check_no_kw("bin",e),bin_hex_oct(2,e)}function breakpoint(){$B.$import("sys",[]);var e={},t=$B.$getattr($B.imported.sys,"breakpointhook",e);if(t===e)throw _b_.RuntimeError.$factory("lost sys.breakpointhook");return $B.$call(t).apply(null,arguments)}function callable(e){return check_nb_args("callable",1,arguments),check_no_kw("callable",e),hasattr(e,"__call__")}function chr(e){if(check_nb_args("chr",1,arguments),check_no_kw("chr",e),e<0||e>1114111)throw _b_.ValueError.$factory("Outside valid range");return String.fromCodePoint(e)}$B.set_func_names(NoneType,"builtins");var classmethod=$B.make_class("classmethod",function(e){check_nb_args("classmethod",1,arguments),check_no_kw("classmethod",e);var t=function(){return e.apply(null,arguments)};if(t.__class__=$B.method,e.$attrs)for(var r in e.$attrs)t[r]=e.$attrs[r];return t.$infos={__func__:e,__name__:e.$infos.__name__},(t.__get__=function(r,n){var s=function(){return t(n,...arguments)};return s.__class__=$B.method,s.$infos={__self__:n,__func__:t,__name__:e.$infos.__name__,__qualname__:n.$infos.__name__+"."+e.$infos.__name__},s}).__class__=$B.method_wrapper,t.__get__.$infos=e.$infos,t});$B.set_func_names(classmethod,"builtins");var code=$B.code=$B.make_class("code");function compile(){var e=$B.args("compile",6,{source:null,filename:null,mode:null,flags:null,dont_inherit:null,optimize:null,_feature_version:null},["source","filename","mode","flags","dont_inherit","optimize","_feature_version"],arguments,{flags:0,dont_inherit:!1,optimize:-1,_feature_version:0},null,null),t="$exec_"+$B.UUID();if($B.clear_ns(t),e.__class__=code,e.co_flags=e.flags,e.name="<module>","single"==e.mode&&512&e.flags&&!e.source.endsWith("\n")){var r=e.source.split("\n");if($B.last(r).startsWith(" "))throw _b_.SyntaxError.$factory("unexpected EOF while parsing")}return $B.py2js(e.source,t,t),e}code.__repr__=code.__str__=function(e){return"<code object "+e.name+", file "+e.filename+">"},code.__getattr__=function(e,t){return"co_code"==t?"co_code":e[t]},$B.set_func_names(code,"builtins");var __debug__=$B.debug>0;function delattr(e,t){if(check_no_kw("delattr",e,t),check_nb_args("delattr",2,arguments),"string"!=typeof t)throw _b_.TypeError.$factory("attribute name must be string, not '"+$B.class_name(t)+"'");return $B.$getattr(e,"__delattr__")(t)}function dir(e){if(void 0===e){var t=$B.last($B.frames_stack);for(var r in locals_obj=t[1],s=_b_.list.$factory(),a=0,locals_obj)"$"==r.charAt(0)&&"$"!=r.charAt(1)||(s[a++]=r);return _b_.list.sort(s),s}check_nb_args("dir",1,arguments),check_no_kw("dir",e);e.__class__||$B.get_class(e);if(e.$is_class){var n=$B.$getattr(e.__class__,"__dir__");return $B.$call(n)(e)}try{var s=$B.$call($B.$getattr(e,"__dir__"))();return s=_b_.list.$factory(s)}catch(e){}s=[];var a=0;for(var r in e)"$"!==r.charAt(0)&&"__class__"!==r&&void 0!==e[r]&&(s[a++]=r);return s.sort(),s}function divmod(e,t){check_no_kw("divmod",e,t),check_nb_args("divmod",2,arguments);var r=e.__class__||$B.get_class(e),n=$B.$getattr(r,"__divmod__",_b_.None);return n!==_b_.None?n(e,t):_b_.tuple.$factory([$B.$getattr(r,"__floordiv__")(e,t),$B.$getattr(r,"__mod__")(e,t)])}$B.$delete=function(e,t){function r(e){if(e.$is_generator_obj&&e.env)for(var t in e.env)t.search(/^\$ctx_manager_exit\d+$/)>-1&&($B.$call(e.env[t])(),delete e.env[t])}var n=!1,s=$B.last($B.frames_stack);if(t?s[2]!=s[0]&&void 0!==s[3][e]&&(n=!0,r(s[3][e]),delete s[3][e]):void 0!==s[1][e]&&(n=!0,r(s[1][e]),delete s[1][e]),!n)throw _b_.NameError.$factory(e)};var enumerate=$B.make_class("enumerate",function(){var e=$B.args("enumerate",2,{iterable:null,start:null},["iterable","start"],arguments,{start:0},null,null),t=iter(e.iterable),r=e.start;return{__class__:enumerate,__name__:"enumerate iterator",counter:r-1,iter:t,start:r}});function $$eval(src,_globals,_locals){var $=$B.args("eval",4,{src:null,globals:null,locals:null,mode:null},["src","globals","locals","mode"],arguments,{globals:_b_.None,locals:_b_.None,mode:"eval"},null,null),src=$.src,_globals=$.globals,_locals=$.locals,mode=$.mode;$.src.mode&&"single"==$.src.mode&&["<console>","<stdin>"].indexOf($.src.filename)>-1&&_b_.print(">",$.src.source.trim());var current_frame=$B.frames_stack[$B.frames_stack.length-1];if(void 0!==current_frame)var current_locals_id=current_frame[0].replace(/\./,"_"),current_globals_id=current_frame[2].replace(/\./,"_");var stack_len=$B.frames_stack.length;if(src.__class__===code)mode=src.mode,src=src.source;else if("string"!=typeof src)throw _b_.TypeError.$factory("eval() arg 1 must be a string, bytes or code object");var globals_id="$exec_"+$B.UUID(),globals_name=globals_id,locals_id="$exec_"+$B.UUID(),parent_scope;if(_globals===_b_.None){current_locals_id==current_globals_id&&(locals_id=globals_id);var local_scope={module:locals_id,id:locals_id,binding:{},bindings:{}};for(var attr in current_frame[1])local_scope.binding[attr]=!0,local_scope.bindings[attr]=!0;var global_scope={module:globals_id,id:globals_id,binding:{},bindings:{}};for(var attr in current_frame[3])global_scope.binding[attr]=!0,global_scope.bindings[attr]=!0;local_scope.parent_block=global_scope,global_scope.parent_block=$B.builtins_scope,parent_scope=local_scope,eval("$locals_"+parent_scope.id+" = current_frame[1]")}else{if(_globals.__class__!=_b_.dict)throw _b_.TypeError.$factory("exec() globals must be a dict, not "+$B.class_name(_globals));if(_globals.globals_id&&(globals_id=globals_name=_globals.globals_id),_globals.globals_id=globals_id,_locals===_globals||_locals===_b_.None)locals_id=globals_id,parent_scope=$B.builtins_scope;else{var grandparent_scope={id:globals_id,parent_block:$B.builtins_scope,binding:{}};for(var attr in parent_scope={id:locals_id,parent_block:grandparent_scope,binding:{}},_globals.$string_dict)grandparent_scope.binding[attr]=!0;for(var attr in _locals.$string_dict)parent_scope.binding[attr]=!0}}if($B.$py_module_path[globals_id]=$B.$py_module_path[current_globals_id],eval("var $locals_"+globals_id+" = {}\nvar $locals_"+locals_id+" = {}"),_globals===_b_.None){var gobj=current_frame[3],ex="var $locals_"+globals_id+" = gobj;",obj={};for(var attr in eval(ex),gobj)attr.startsWith("$")&&!attr.startsWith("$$")||(obj[attr]=gobj[attr]);eval("$locals_"+globals_id+" = obj")}else{var globals_is_dict=!1;if(_globals.$jsobj)var items=_globals.$jsobj;else{var items=_b_.dict.$to_obj(_globals);_globals.$jsobj=items,globals_is_dict=!0}for(var item in eval("$locals_"+globals_id+" = _globals.$jsobj"),items){var item1=$B.to_alias(item);try{eval("$locals_"+globals_id+'["'+item+'"] = items.'+item)}catch(e){console.log(e),console.log("error setting",item);break}}}if(_globals.$is_namespace=!0,_locals===_b_.None)if(_globals!==_b_.None)eval("var $locals_"+locals_id+" = $locals_"+globals_id);else{var lobj=current_frame[1],ex="",obj={};for(var attr in current_frame[1])attr.startsWith("$")&&!attr.startsWith("$$")||(obj[attr]=lobj[attr]);eval("$locals_"+locals_id+" = obj")}else{var locals_is_dict=!1;if(_locals.$jsobj)var items=_locals.$jsobj;else{locals_id_dict=!0;var items=_b_.dict.$to_obj(_locals);_locals.$jsobj=items}for(var item in items){var item1=$B.to_alias(item);try{eval("$locals_"+locals_id+'["'+item+'"] = items.'+item)}catch(e){console.log(e),console.log("error setting",item);break}}eval("$locals_"+locals_id+".$exec_locals = true")}_locals.$is_namespace=!0,_globals===_b_.None&&_locals===_b_.None&¤t_frame[0]==current_frame[2]||eval("$locals_"+locals_id+".$src = src");var root=$B.py2js(src,globals_id,locals_id,parent_scope),js,gns,lns;if(_globals!==_b_.None&&_locals==_b_.None)for(var attr in _globals.$string_dict)root.binding[attr]=!0;try{var try_node=root.children[root.children.length-2],instr=try_node.children[try_node.children.length-2],type=instr.C.tree[0].type;switch(type){case"expr":case"list_or_tuple":case"op":case"ternary":var children=try_node.children;root.children.splice(root.children.length-2,2);for(var i=0;i<children.length-1;i++)root.add(children[i]);break;default:if("eval"==mode)throw _b_.SyntaxError.$factory("eval() argument must be an expression","<string>",1,1,src)}if("eval"!=mode){var last=$B.last(root.children),js=last.to_js();-1==["node_js"].indexOf(last.C.type)&&(last.to_js=function(){for(;js.endsWith("\n");)js=js.substr(0,js.length-1);for(;js.endsWith(";");)js=js.substr(0,js.length-1);return"return ("+js+")"}),js=root.to_js();var locals_obj=eval("$locals_"+locals_id),globals_obj=eval("$locals_"+globals_id);if(_globals===_b_.None)var res=new Function("$locals_"+globals_id,"$locals_"+locals_id,js)(globals_obj,locals_obj);else{current_globals_obj=current_frame[3],current_locals_obj=current_frame[1];var res=new Function("$locals_"+globals_id,"$locals_"+locals_id,"$locals_"+current_globals_id,"$locals_"+current_locals_id,js)(globals_obj,locals_obj,current_globals_obj,current_locals_obj)}$.src.mode&&"single"==$.src.mode&&"<stdin>"==$.src.filename&&res!==_b_.None&&void 0!==res&&_b_.print(_b_.repr(res))}else{js=root.to_js();var res=eval(js)}if("<console>"==$.src.filename&&"single"==$.src.mode&&void 0!==res&&res!==_b_.None&&_b_.print(res),gns=eval("$locals_"+globals_id),$B.frames_stack[$B.frames_stack.length-1][2]==globals_id&&(gns=$B.frames_stack[$B.frames_stack.length-1][3]),_locals!==_b_.None)for(var attr in lns=eval("$locals_"+locals_id),lns){var attr1=$B.from_alias(attr);"$"!=attr1.charAt(0)&&(_locals.$jsobj?_locals.$jsobj[attr]=lns[attr]:_b_.dict.$setitem(_locals,attr1,lns[attr]))}else for(var attr in lns)"$src"!==attr&&(current_frame[1][attr]=lns[attr]);if(_globals!==_b_.None){if(globals_is_dict){var jsobj=_globals.$jsobj;delete _globals.$jsobj}for(var attr in gns)attr1=$B.from_alias(attr),"$"!=attr1.charAt(0)&&(globals_is_dict?_b_.dict.$setitem(_globals,attr,gns[attr]):_globals.$jsobj[attr1]=gns[attr]);for(var attr in _globals.$string_dict)attr.startsWith("$")&&!attr.startsWith("$$")&&delete _globals.$string_dict[attr]}else for(var attr in gns)"$src"!==attr&&(current_frame[3][attr]=gns[attr]);return void 0===res?_b_.None:res}catch(e){if(e.src=src,e.module=globals_id,void 0===e.$py_error)throw $B.exception(e);for(var i=0,len=e.$stack.length;i<len;i++)if(e.$stack[i][0]==current_frame[0]){e.$stack=e.$stack.slice(i);break}throw e}finally{$B.frames_stack.length==stack_len+1&&$B.frames_stack.pop(),root=null,js=null,gns=null,lns=null,$B.clear_ns(globals_id),$B.clear_ns(locals_id)}}function exec(e,t,r){var n=$B.args("exec",3,{src:null,globals:null,locals:null},["src","globals","locals"],arguments,{globals:_b_.None,locals:_b_.None},null,null);return $$eval(n.src,n.globals,n.locals,"exec")||_b_.None}function exit(){throw _b_.SystemExit}enumerate.__iter__=function(e){return e.counter=e.start-1,e},enumerate.__next__=function(e){return e.counter++,$B.fast_tuple([e.counter,next(e.iter)])},$B.set_func_names(enumerate,"builtins"),$B.from_alias=function(e){return"$$"==e.substr(0,2)&&$B.aliased_names[e.substr(2)]?e.substr(2):e},$B.to_alias=function(e){return $B.aliased_names[e]?"$$"+e:e},$$eval.$is_func=!0,exec.$is_func=!0,exit.__repr__=exit.__str__=function(){return"Use exit() or Ctrl-Z plus Return to exit"};var filter=$B.make_class("filter",function(e,t){return check_no_kw("filter",e,t),check_nb_args("filter",2,arguments),t=iter(t),e===_b_.None&&(e=$B.$bool),{__class__:filter,func:e,iterable:t}});function format(e,t){var r=$B.args("format",2,{value:null,format_spec:null},["value","format_spec"],arguments,{format_spec:""},null,null),n=e.__class__||$B.get_class(e);try{var s=$B.$getattr(n,"__format__")}catch(t){if(t.__class__===_b_.AttributeError)throw _b_.NotImplementedError("__format__ is not implemented for object '"+_b_.str.$factory(e)+"'");throw t}return $B.$call(s)(e,r.format_spec)}function attr_error(e,t){var r="bad operand type for unary #: '"+t+"'";switch(e){case"__neg__":throw _b_.TypeError.$factory(r.replace("#","-"));case"__pos__":throw _b_.TypeError.$factory(r.replace("#","+"));case"__invert__":throw _b_.TypeError.$factory(r.replace("#","~"));case"__call__":throw _b_.TypeError.$factory("'"+t+"' object is not callable");default:for(;"$"==e.charAt(0);)e=e.substr(1);throw _b_.AttributeError.$factory("'"+t+"' object has no attribute '"+e+"'")}}function getattr(){var e={},t=$B.args("getattr",3,{obj:null,attr:null,_default:null},["obj","attr","_default"],arguments,{_default:e},null,null);return $B.$getattr(t.obj,t.attr,t._default===e?void 0:t._default)}function in_mro(e,t){if(void 0===e)return!1;if(e.hasOwnProperty(t))return e[t];for(var r=e.__mro__,n=0,s=r.length;n<s;n++)if(r[n].hasOwnProperty(t))return r[n][t];return!1}function globals(){check_nb_args("globals",0,arguments);var e=$B.obj_dict($B.last($B.frames_stack)[3]);return e.$jsobj.__BRYTHON__=$B.JSObject.$factory($B),e.$is_namespace=!0,e}function hasattr(e,t){check_no_kw("hasattr",e,t),check_nb_args("hasattr",2,arguments);try{return $B.$getattr(e,t),!0}catch(e){return!1}}filter.__iter__=function(e){return e},filter.__next__=function(e){for(;;){var t=next(e.iterable);if(e.func(t))return t}},$B.set_func_names(filter,"builtins"),$B.$getattr=function(e,t,r){var n=t;t=$B.to_alias(t),void 0===e&&console.log("get attr",t,"of undefined");var s,a=e.$is_class||e.$factory,i=e.__class__;if(void 0!==i&&i.__bases__&&(0==i.__bases__.length||1==i.__bases__.length&&i.__bases__[0]===_b_.object)){if(e.hasOwnProperty(t))return e[t];if(e.__dict__&&e.__dict__.$string_dict.hasOwnProperty(t)&&(!i.hasOwnProperty(t)||!i[t].__get__))return e.__dict__.$string_dict[t][0];if(i.hasOwnProperty(t)&&"function"!=typeof i[t]&&"__dict__"!=t&&void 0===i[t].__get__&&!in_mro(i[t].__class__,"__get__"))return i[t]}if(void 0===i)if("string"==typeof e)i=_b_.str;else if("number"==typeof e)i=e%1==0?_b_.int:_b_.float;else if(e instanceof Number)i=_b_.float;else if(void 0===(i=$B.get_class(e))){if(void 0!==(v=e[t])){if("function"==typeof v){var o=function(){return v.apply(e,arguments)};return o.$infos={__name__:t,__qualname__:t},o}return $B.$JS2Py(v)}if(void 0!==r)return r;throw _b_.AttributeError.$factory("object has no attribute "+n)}switch(t){case"__call__":if("function"==typeof e)return(v=function(){return e.apply(null,arguments)}).__class__=method_wrapper,v.$infos={__name__:"__call__"},v;break;case"__class__":return i;case"__dict__":if(a){var _={};for(var l in e){var c=$B.from_alias(l);c.startsWith("$")||(_[c]=e[l])}return _.__dict__=$B.getset_descriptor.$factory(e,"__dict__"),$B.mappingproxy.$factory(_)}if(e.hasOwnProperty(t))return e[t];if(e.$infos){if(e.$infos.hasOwnProperty("__dict__"))return e.$infos.__dict__;if(e.$infos.hasOwnProperty("__func__"))return e.$infos.__func__.$infos.__dict__}return $B.obj_dict(e);case"__doc__":for(var u=0;u<builtin_names.length;u++)if(e===_b_[builtin_names[u]])return _get_builtins_doc(),$B.builtins_doc[builtin_names[u]];break;case"__mro__":if(e.$is_class)return _b_.tuple.$factory([e].concat(e.__mro__));if(e.__dict__&&void 0!==e.__dict__.$string_dict.__mro__)return e.__dict__.$string_dict.__mro__;throw _b_.AttributeError.$factory(t);case"__subclasses__":if(i.$factory||i.$is_class){var f=e.$subclasses||[];return function(){return f}}break;case"$$new":if(i===$B.JSObject&&void 0!==e.js_func)return $B.JSConstructor.$factory(e)}if("function"==typeof e){var p=e[t];if(void 0!==p&&"__module__"==t)return p}if(!a&&i.$native){if("__doc__"==t&&void 0===i[t]&&i.$infos&&(_get_builtins_doc(),i[t]=$B.builtins_doc[i.$infos.__name__]),void 0===i[t]){var d=_b_.object[t];if(void 0===d){0;var h=e.__dict__;return h&&void 0!==(d=h.$string_dict[t])?d[0]:(void 0===r&&attr_error(t,i.$infos.__name__),r)}i[t]=d}if(i.$descriptors&&void 0!==i.$descriptors[t])return i[t](e);if("function"==typeof i[t]){var $=i[t];if("__new__"==t&&($.$type="staticmethod"),"staticmethod"==$.$type)return $;var m=i[t].__class__==$B.method?i:e,b=i[t].bind(null,m);return b.__class__=$B.method,b.$infos={__func__:$,__name__:t,__self__:m,__qualname__:i.$infos.__name__+"."+t},b}if(void 0!==i[t])return i[t];attr_error(n,i.$infos.__name__)}if(a)s=_b_.type.__getattribute__;else if(void 0===(s=i.__getattribute__)){var g;void 0===(g=i.__mro__)&&console.log(e,t,"no mro, klass",i);u=0;for(var y=g.length;u<y&&void 0===(s=g[u].__getattribute__);u++);}if("function"!=typeof s&&console.log(t+" is not a function "+s,i),s===odga){var v=e[t];if(Array.isArray(e)&&void 0!==Array.prototype[t]&&(v=void 0),null===v)return null;if(void 0===v&&e.hasOwnProperty(t))return v;if(void 0!==v&&(void 0===v.__set__||v.$is_class))return v}try{v=s(e,t);0}catch(e){if(void 0!==r)return r;throw e}if(void 0!==v)return v;if(void 0!==r)return r;var x=i.$infos.__name__;a&&(x=e.$infos.__name__),attr_error(n,x)};var hash_cache={};function hash(e){if(check_no_kw("hash",e),check_nb_args("hash",1,arguments),void 0!==e.__hashvalue__)return e.__hashvalue__;if(isinstance(e,_b_.bool))return _b_.int.$factory(e);if(isinstance(e,_b_.int))return void 0===e.$brython_value?e.valueOf():e.__hashvalue__=e.$brython_value;if(e.$is_class||e.__class__===_b_.type||e.__class__===$B.Function)return e.__hashvalue__=$B.$py_next_hash--;if("string"==typeof e){var t=hash_cache[e];return void 0!==t?t:hash_cache[e]=_b_.str.__hash__(e)}var r=e.__class__||$B.get_class(e);if(void 0===r)throw _b_.TypeError.$factory("unhashable type: '"+_b_.str.$factory($B.JSObject.$factory(e))+"'");var n=$B.$getattr(r,"__hash__",_b_.None);if(n===_b_.None)throw _b_.TypeError.$factory("unhashable type: '"+$B.class_name(e)+"'");if(void 0===n.$infos)return e.__hashvalue__=hashfunc();if(n.$infos.__func__===_b_.object.__hash__){if($B.$getattr(e,"__eq__").$infos.__func__!==_b_.object.__eq__)throw _b_.TypeError.$factory("unhashable type: '"+$B.class_name(e)+"'","hash");return e.__hashvalue__=_b_.object.__hash__(e)}return e.__hashvalue__=$B.$call(n)(e)}function _get_builtins_doc(){if(void 0===$B.builtins_doc){var url=$B.brython_path;"/"==url.charAt(url.length-1)&&(url=url.substr(0,url.length-1)),url+="/builtins_docstrings.js";var f=_b_.open(url);eval(f.$string),$B.builtins_doc=docs}}function help(e){if(void 0===e&&(e="help"),"string"==typeof e&&void 0!==_b_[e]){_get_builtins_doc();var t=$B.builtins_doc[e];if(void 0!==t&&""!=t)return void _b_.print(t)}for(var r=0;r<builtin_names.length;r++)e===_b_[builtin_names[r]]&&(_get_builtins_doc(),_b_.print(t=$B.builtins_doc[builtin_names[r]]));if("string"!=typeof e)try{return $B.$getattr(e,"__doc__")}catch(e){return""}else{$B.$import("pydoc");var n=$B.imported.pydoc;$B.$getattr($B.$getattr(n,"help"),"__call__")(e)}}function hex(e){return check_no_kw("hex",e),check_nb_args("hex",1,arguments),bin_hex_oct(16,e)}function id(e){return check_no_kw("id",e),check_nb_args("id",1,arguments),isinstance(e,[_b_.str,_b_.int,_b_.float])&&!isinstance(e,$B.long_int)?$B.$getattr(_b_.str.$factory(e),"__hash__")():void 0!==e.$id?e.$id:e.$id=$B.UUID()}function __import__(e,t,r,n,s){var a=$B.args("__import__",5,{name:null,globals:null,locals:null,fromlist:null,level:null},["name","globals","locals","fromlist","level"],arguments,{globals:None,locals:None,fromlist:_b_.tuple.$factory(),level:0},null,null);return $B.$__import__(a.name,a.globals,a.locals,a.fromlist)}function input(e){var t=prompt(e||"")||"";if($B.imported.sys&&$B.imported.sys.ps1){var r=$B.imported.sys.ps1,n=$B.imported.sys.ps2;e!=r&&e!=n||console.log(e,t)}return t}function isinstance(e,t){if(check_no_kw("isinstance",e,t),check_nb_args("isinstance",2,arguments),null===e)return t===None;if(void 0===e)return!1;if(t.constructor===Array){for(var r=0;r<t.length;r++)if(isinstance(e,t[r]))return!0;return!1}if(!t.__class__||void 0===t.$factory&&void 0===t.$is_class)throw _b_.TypeError.$factory("isinstance() arg 2 must be a type or tuple of types");if(t===_b_.int&&(e===True||e===False))return True;if(t===_b_.bool)switch(typeof e){case"string":case"number":return!1;case"boolean":return!0}var n=e.__class__;if(null==n){if("string"==typeof e){if(t==_b_.str)return!0;if($B.builtin_classes.indexOf(t)>-1)return!1}else if(e.contructor===Number&&Number.isFinite(e)){if(t==_b_.float)return!0;if($B.builtin_classes.indexOf(t)>-1)return!1}else if("number"==typeof e&&Number.isFinite(e)){if(Number.isFinite(e)&&t==_b_.int)return!0;if($B.builtin_classes.indexOf(t)>-1)return!1}n=$B.get_class(e)}if(void 0===n)return!1;function s(e,t){return e===t||(t===_b_.str&&e===$B.StringSubclass||(t===_b_.int&&e===$B.IntSubclass||void 0))}if(s(n,t))return!0;var a=n.__mro__;for(r=0;r<a.length;r++)if(s(a[r],t))return!0;var i=$B.$getattr(t.__class__||$B.get_class(t),"__instancecheck__",_b_.None);return i!==_b_.None&&i(t,e)}function issubclass(e,t){if(check_no_kw("issubclass",e,t),check_nb_args("issubclass",2,arguments),!e.__class__||void 0===e.$factory&&void 0===e.$is_class)throw _b_.TypeError.$factory("issubclass() arg 1 must be a class");if(isinstance(t,_b_.tuple)){for(var r=0;r<t.length;r++)if(issubclass(e,t[r]))return!0;return!1}if((t.$factory||t.$is_class)&&(e===t||e.__mro__.indexOf(t)>-1))return!0;var n=$B.$getattr(t.__class__||$B.get_class(t),"__subclasscheck__",_b_.None);return n!=_b_.None&&n(t,e)}help.__repr__=help.__str__=function(){return"Type help() for interactive help, or help(object) for help about object."};var iterator_class=$B.make_class("iterator",function(e,t){return{__class__:iterator_class,getitem:e,len:t,counter:-1}});function iter(){var e=$B.args("iter",1,{obj:null},["obj"],arguments,{},"args","kw");if(e.args.length>0)var t=e.args[0];return $B.$iter(e.obj,t)}function len(e){check_no_kw("len",e),check_nb_args("len",1,arguments);var t=e.__class__||$B.get_class(e);try{var r=$B.$getattr(t,"__len__")}catch(t){throw _b_.TypeError.$factory("object of type '"+$B.class_name(e)+"' has no len()")}return $B.$call(r)(e)}function locals(){check_nb_args("locals",0,arguments);var e=$B.obj_dict($B.last($B.frames_stack)[1]);return e.$is_namespace=!0,delete e.$jsobj.__annotations__,e}iterator_class.__next__=function(e){if(e.counter++,null!==e.len&&e.counter==e.len)throw _b_.StopIteration.$factory("");try{return e.getitem(e.counter)}catch(e){throw _b_.StopIteration.$factory("")}},callable_iterator=$B.make_class("callable_iterator",function(e,t){return{__class__:callable_iterator,func:e,sentinel:t}}),callable_iterator.__iter__=function(e){return e},callable_iterator.__next__=function(e){var t=e.func();if($B.rich_comp("__eq__",t,e.sentinel))throw _b_.StopIteration.$factory();return t},$B.$iter=function(e,t){if(void 0===t){var r=e.__class__||$B.get_class(e);try{var n=$B.$call($B.$getattr(r,"__iter__"))}catch(t){if(t.__class__===_b_.AttributeError)try{var s=$B.$call($B.$getattr(r,"__getitem__"));len(e);return iterator_class.$factory(function(t){return s(e,t)},len)}catch(t){throw _b_.TypeError.$factory("'"+$B.class_name(e)+"' object is not iterable")}throw t}var a=$B.$call(n)(e);try{$B.$getattr(a,"__next__")}catch(e){if(isinstance(e,_b_.AttributeError))throw _b_.TypeError.$factory("iter() returned non-iterator of type '"+$B.class_name(a)+"'")}return a}return callable_iterator.$factory(e,t)};var map=$B.make_class("map",function(){var e=$B.args("map",2,{func:null,it1:null},["func","it1"],arguments,{},"args",null),t=$B.$call(e.func),r=[$B.$iter(e.it1)];return e.args.forEach(function(e){r.push($B.$iter(e))}),{__class__:map,args:r,func:t}});function $extreme(e,t){var r="min";if("__gt__"===t&&(r="max"),0==e.length)throw _b_.TypeError.$factory(r+" expected 1 arguments, got 0");var n=e[e.length-1],s=e.length,a=!1,i=!1;if("kw"==n.$nat)for(var o in s--,n=n.kw)switch(o){case"key":i=n[o];break;case"$$default":var _=n[o];a=!0;break;default:throw _b_.TypeError.$factory("'"+o+"' is an invalid keyword argument for this function")}if(i||(i=function(e){return e}),0==s)throw _b_.TypeError.$factory(r+" expected 1 argument, got 0");if(1!=s){if(a)throw _b_.TypeError.$factory("Cannot specify a default for "+r+"() with multiple positional arguments");u=null;for(var l=0;l<s;l++){f=e[l];(null===u||$B.$bool($B.$getattr(i(f),t)(i(u))))&&(u=f)}return u}for(var c=iter(e[0]),u=null;;)try{var f=next(c);(null===u||$B.$bool($B.$getattr(i(f),t)(i(u))))&&(u=f)}catch(e){if(e.__class__==_b_.StopIteration){if(null===u){if(a)return _;throw _b_.ValueError.$factory(r+"() arg is an empty sequence")}return u}throw e}}function max(){return $extreme(arguments,"__gt__")}map.__iter__=function(e){return e},map.__next__=function(e){for(var t=[],r=0;r<e.args.length;r++)t.push(next(e.args[r]));return e.func.apply(null,t)},$B.set_func_names(map,"builtins");var memoryview=$B.make_class("memoryview",function(e){if(check_no_kw("memoryview",e),check_nb_args("memoryview",1,arguments),e.__class__===memoryview)return e;if($B.get_class(e).$buffer_protocol)return{__class__:memoryview,obj:e,format:"B",itemsize:1,ndim:1,shape:_b_.tuple.$factory([_b_.len(e)]),strides:_b_.tuple.$factory([1]),suboffsets:_b_.tuple.$factory([]),c_contiguous:!0,f_contiguous:!0,contiguous:!0};throw _b_.TypeError.$factory("memoryview: a bytes-like object is required, not '"+$B.class_name(e)+"'")});function min(){return $extreme(arguments,"__lt__")}function next(e){check_no_kw("next",e);var t={},r=$B.args("next",2,{obj:null,def:null},["obj","def"],arguments,{def:t},null,null),n=e.__class__||$B.get_class(e),s=$B.$call($B.$getattr(n,"__next__"));if(void 0!==s)try{return $B.$call(s)(e)}catch(e){if(e.__class__===_b_.StopIteration&&r.def!==t)return r.def;throw e}throw _b_.TypeError.$factory("'"+$B.class_name(e)+"' object is not an iterator")}memoryview.__eq__=function(e,t){return t.__class__===memoryview&&$B.$getattr(e.obj,"__eq__")(t.obj)},memoryview.__getitem__=function(e,t){if(isinstance(t,_b_.int)){var r=t*e.itemsize;if("I"==e.format){for(var n=e.obj.source[r],s=256,a=1;a<4;a++)n+=e.obj.source[r+a]*s,s*=256;return n}if("B".indexOf(e.format)>-1){if(t>e.obj.source.length-1)throw _b_.KeyError.$factory(t);return e.obj.source[t]}return e.obj.source[t]}n=e.obj.__class__.__getitem__(e.obj,t);if(t.__class__===_b_.slice)return memoryview.$factory(n)},memoryview.__len__=function(e){return len(e.obj)/e.itemsize},memoryview.cast=function(e,t){switch(t){case"B":return memoryview.$factory(e.obj);case"I":var r=memoryview.$factory(e.obj),n=len(e.obj);if(r.itemsize=4,r.format="I",n%4!=0)throw _b_.TypeError.$factory("memoryview: length is not a multiple of itemsize");return r}},memoryview.hex=function(e){var t="";return _b_.bytes.$factory(e).source.forEach(function(e){t+=e.toString(16)}),t},memoryview.tobytes=function(e){return _b_.bytes.$factory(e.obj)},memoryview.tolist=function(e){if(1==e.itemsize)return _b_.list.$factory(_b_.bytes.$factory(e.obj));if(4==e.itemsize&&"I"==e.format){for(var t=[],r=0;r<e.obj.source.length;r+=4){for(var n=e.obj.source[r],s=256,a=1;a<4;a++)n+=s*e.obj.source[r+a],s*=256;t.push(n)}return t}},$B.set_func_names(memoryview,"builtins");var NotImplementedType=$B.make_class("NotImplementedType",function(){return NotImplemented});NotImplementedType.__repr__=NotImplementedType.__str__=function(e){return"NotImplemented"};var NotImplemented={__class__:NotImplementedType};function $not(e){return!$B.$bool(e)}function oct(e){return check_no_kw("oct",e),check_nb_args("oct",1,arguments),bin_hex_oct(8,e)}function ord(e){if(check_no_kw("ord",e),check_nb_args("ord",1,arguments),"string"==typeof e){if(1==e.length)return e.charCodeAt(0);throw _b_.TypeError.$factory("ord() expected a character, but string of length "+e.length+" found")}switch($B.get_class(e)){case _b_.str:if(1==e.length)return e.charCodeAt(0);throw _b_.TypeError.$factory("ord() expected a character, but string of length "+e.length+" found");case _b_.str.$surrogate:if(1==e.items.length)return e.items[0].codePointAt(0);throw _b_.TypeError.$factory("ord() expected a character, but string of length "+e.items.length+" found");case _b_.bytes:case _b_.bytearray:if(1==e.source.length)return e.source[0];throw _b_.TypeError.$factory("ord() expected a character, but string of length "+e.source.length+" found");default:throw _b_.TypeError.$factory("ord() expected a character, but "+$B.class_name(e)+" was found")}}function pow(){var e=$B.args("pow",3,{x:null,y:null,mod:null},["x","y","mod"],arguments,{mod:None},null,null),t=e.x,r=e.y,n=e.mod,s=t.__class__||$B.get_class(t);if(n===_b_.None)return $B.$call($B.$getattr(s,"__pow__"))(t,r);if(t!=_b_.int.$factory(t)||r!=_b_.int.$factory(r))throw _b_.TypeError.$factory("pow() 3rd argument not allowed unless all arguments are integers");return $B.$call($B.$getattr(s,"__pow__"))(t,r,n)}function $print(){var e=$B.args("print",0,{},[],arguments,{},"args","kw"),t=e.kw.$string_dict,r=void 0===t.end||t.end===None?"\n":t.end[0],n=void 0===t.sep||t.sep===None?" ":t.sep[0],s=void 0===t.file?$B.stdout:t.file[0],a=e.args,i=[];a.forEach(function(e){i.push(_b_.str.$factory(e))});var o=i.join(n)+r;o=o.replace(new RegExp("","g"),"").replace(new RegExp("(.)\b","g"),""),$B.$getattr(s,"write")(o);var _=$B.$getattr(s,"flush",None);return _!==None&&_(),None}$print.__name__="print",$print.is_func=!0;var property=$B.make_class("property",function(e,t,r,n){var s={__class__:property};return property.__init__(s,e,t,r,n),s});function quit(){throw _b_.SystemExit}function repr(e){check_no_kw("repr",e),check_nb_args("repr",1,arguments);var t=e.__class__||$B.get_class(e);return $B.$call($B.$getattr(t,"__repr__"))(e)}property.__init__=function(e,t,r,n,s){if(e.__doc__=s||"",e.$type=t.$type,e.fget=t,e.fset=r,e.fdel=n,t&&t.$attrs)for(var a in t.$attrs)e[a]=t.$attrs[a];e.__get__=function(e,t,r){if(void 0===t)return e;if(void 0===e.fget)throw _b_.AttributeError.$factory("unreadable attribute");return $B.$call(e.fget)(t)},void 0!==r&&(e.__set__=function(e,t,r){if(void 0===e.fset)throw _b_.AttributeError.$factory("can't set attribute");$B.$getattr(e.fset,"__call__")(t,r)}),e.__delete__=n,e.getter=function(t){return property.$factory(t,e.fset,e.fdel,e.__doc__)},e.setter=function(t){return property.$factory(e.fget,t,e.fdel,e.__doc__)},e.deleter=function(t){return property.$factory(e.fget,e.fset,t,e.__doc__)}},property.__repr__=function(e){return _b_.repr(e.fget(e))},property.__str__=function(e){return _b_.str.$factory(e.fget(e))},$B.set_func_names(property,"builtins"),quit.__repr__=quit.__str__=function(){return"Use quit() or Ctrl-Z plus Return to exit"};var reversed=$B.make_class("reversed",function(e){check_no_kw("reversed",e),check_nb_args("reversed",1,arguments);var t=e.__class__||$B.get_class(e),r=$B.$getattr(t,"__reversed__",null);if(null!==r)return $B.$call(r)(e);try{var n=$B.$getattr(t,"__getitem__")}catch(e){throw _b_.TypeError.$factory("argument to reversed() must be a sequence")}return{__class__:reversed,$counter:_b_.len(e),getter:function(t){return $B.$call(n)(e,t)}}});function round(){var e=$B.args("round",2,{number:null,ndigits:null},["number","ndigits"],arguments,{ndigits:None},null,null),t=e.number,r=e.ndigits===None?0:e.ndigits;if(!isinstance(t,[_b_.int,_b_.float])){var n=t.__class__||$B.get_class(t);try{return $B.$call($B.$getattr(n,"__round__")).apply(null,arguments)}catch(e){throw e.__class__===_b_.AttributeError?_b_.TypeError.$factory("type "+$B.class_name(t)+" doesn't define __round__ method"):e}}if(isinstance(t,_b_.float)&&(t.value===1/0||t.value===-1/0))throw _b_.OverflowError.$factory("cannot convert float infinity to integer");if(!isinstance(r,_b_.int))throw _b_.TypeError.$factory("'"+$B.class_name(r)+"' object cannot be interpreted as an integer");var s,a=Math.pow(10,r),i=t*a,o=Math.floor(i);return.5==Math.abs(i-o)?(o%2&&(o+=1),s=_b_.int.__truediv__(o,a)):s=_b_.int.__truediv__(Math.round(i),a),e.ndigits===None?s.valueOf():t instanceof Number?new Number(s):s.valueOf()}function setattr(){var e=$B.args("setattr",3,{obj:null,attr:null,value:null},["obj","attr","value"],arguments,{},null,null),t=e.obj,r=e.attr,n=e.value;if("string"!=typeof r)throw _b_.TypeError.$factory("setattr(): attribute name must be string");return $B.$setattr(t,r,n)}function sorted(){for(var e=$B.args("sorted",1,{iterable:null},["iterable"],arguments,{},null,"kw"),t=_b_.list.$factory(iter(e.iterable)),r=[t],n=1;n<arguments.length;n++)r.push(arguments[n]);return _b_.list.sort.apply(null,r),t}reversed.__iter__=function(e){return e},reversed.__next__=function(e){if(e.$counter--,e.$counter<0)throw _b_.StopIteration.$factory("");return e.getter(e.$counter)},$B.set_func_names(reversed,"builtins"),$B.$setattr=function(e,t,r){if($B.aliased_names[t])t="$$"+t;else{if("__dict__"==t){if(!isinstance(r,_b_.dict))throw _b_.TypeError.$factory("__dict__ must be set to a dictionary, not a '"+$B.class_name(r)+"'");return e.$infos?(e.$infos.__dict__=r,None):(e.__dict__=r,None)}if("__class__"==t){function n(e){throw _b_.TypeError.$factory(e)}if(r.__class__)if("builtins"==r.__module__)n("__class__ assignement only supported for heap types or ModuleType subclasses");else if(Array.isArray(r.__bases__))for(var s=0;s<r.__bases__.length;s++)"builtins"==r.__bases__[s].__module__&&n("__class__ assignment: '"+$B.class_name(e)+"' object layout differs from '"+$B.class_name(r)+"'");return e.__class__=r,None}"__doc__"==t&&e.__class__===_b_.property&&(e[t]=r)}if(e.$factory||e.$is_class){var a=e.__class__;return a&&a[t]&&a[t].__get__&&a[t].__set__?(a[t].__set__(e,r),None):(e[t]=r,"__init__"==t||"__new__"==t?e.$factory=$B.$instance_creator(e):"__bases__"==t&&(e.__mro__=_b_.type.mro(e)),None)}var i=e[t],o=e.__class__||$B.get_class(e);if(void 0===i&&o&&void 0===(i=o[t])){var _=(d=o.__mro__).length;for(s=0;s<_&&void 0===(i=d[s][t]);s++);}if(void 0!==i){if(void 0!==i.__set__)return i.__set__(i,e,r),None;var l,c=i.__class__;if(void 0!==c)if(void 0===(l=c.__set__))for(s=0,_=(d=c.__mro__).length;s<_&&!(l=d[s].__set__);s++);if(void 0!==l){var u=$B.$getattr(i,"__set__",null);if(u&&"function"==typeof u)return u.apply(i,[e,r]),None}else if(o&&void 0!==o.$descriptors&&void 0!==o[t]){var f=o[t].setter;if("function"==typeof f)return f(e,r),None;throw _b_.AttributeError.$factory("readonly attribute")}}var p=!1;if(void 0!==o&&void 0===(p=o.__setattr__)){var d;for(s=0,_=(d=o.__mro__).length-1;s<_&&!(p=d[s].__setattr__);s++);}if(o&&o.__slots__&&-1==["__module__"].indexOf(t)&&!p){function h(e){return e.__slots__?Array.isArray(e.__slots__)?e.__slots__.map(function(t){return t.startsWith("__")&&!t.endsWith("_")?"_"+e.$infos.__name__+t:t}):e.__slots__:[]}var $=!1;if(h(o).indexOf(t)>-1)$=!0;else for(s=0;s<o.__mro__.length;s++){if(h(o.__mro__[s]).indexOf(t)>-1){$=!0;break}}if(!$)throw _b_.AttributeError.$factory("'"+o.$infos.__name__+"' object has no attribute '"+t+"'")}return p?p(e,t,r):void 0===e.__dict__?e[t]=r:_b_.dict.$setitem(e.__dict__,t,r),None};var staticmethod=$B.make_class("staticmethod",function(e){var t={$infos:e.$infos,__get__:function(){return e}};return t.__get__.__class__=$B.method_wrapper,t.__get__.$infos=e.$infos,t});function sum(e,t){var r=$B.args("sum",2,{iterable:null,start:null},["iterable","start"],arguments,{start:0},null,null);e=r.iterable,t=r.start;if(_b_.isinstance(t,[_b_.str,_b_.bytes]))throw _b_.TypeError.$factory("TypeError: sum() can't sum bytes [use b''.join(seq) instead]");var n=t;for(e=iter(e);;)try{var s=next(e);n=$B.$getattr(n,"__add__")(s)}catch(e){if(e.__class__===_b_.StopIteration)break;throw e}return n}$B.set_func_names(staticmethod,"builtins"),$B.missing_super2=function(e){return e.$missing=!0,e};var $$super=$B.make_class("super",function(e,t){var r=!1;return Array.isArray(t)&&(t=t[0],r=!0),{__class__:$$super,__thisclass__:e,__self_class__:t,$missing2:r}});function vars(){var e={},t=$B.args("vars",1,{obj:null},["obj"],arguments,{obj:e},null,null);if(t.obj===e)return _b_.locals();try{return $B.$getattr(t.obj,"__dict__")}catch(e){if(e.__class__===_b_.AttributeError)throw _b_.TypeError.$factory("vars() argument must have __dict__ attribute");throw e}}$$super.__getattribute__=function(e,t){var r=e.__thisclass__.__mro__,n=e.__self_class__;if(void 0!==n){n.$is_class||(n=n.__class__);for(var s=[n].concat(n.__mro__),a=0;a<s.length;a++)if(s[a]===e.__thisclass__){r=s.slice(a+1);break}}var i=_b_.type.__getattribute__(r[0],t);if("staticmethod"==i.$type)return i;i.__class__===$B.method&&(i=i.$infos.__func__);var o,_=$B.$call(i),l=function(){var t=_(e.__self_class__,...arguments);return t};return l.__class__=$B.method,void 0!==i.$infos?o=i.$infos.__module__:i.__class__===property?o=i.fget.$infos.__module:i.$is_class&&(o=i.__module__),l.$infos={__self__:e.__self_class__,__func__:i,__name__:t,__module__:o,__qualname__:e.__thisclass__.$infos.__name__+"."+t},l},$$super.__repr__=$$super.__str__=function(e){var t="<super: <class '"+e.__thisclass__.$infos.__name__+"'>";return void 0!==e.__self_class__?t+=", <"+e.__self_class__.__class__.$infos.__name__+" object>":t+=", NULL",t+">"},$B.set_func_names($$super,"builtins");var $Reader=$B.make_class("Reader");function make_content(e){e.$binary&&void 0===e.$bytes?e.$bytes=_b_.str.encode(e.$string,e.encoding):e.$binary||void 0!==e.$string||(e.$string=_b_.bytes.decode(e.$bytes,e.encoding))}function make_lines(e){if(void 0===e.$lines)if(make_content(e),e.$binary){console.log("make lines, binary");for(var t=[],r=e.$bytes.source;;){var n=r.indexOf(10);if(-1==n){t.push({__class__:_b_.bytes,source:r});break}t.push({__class__:_b_.bytes,source:r.slice(0,n+1)}),r=r.slice(n+1)}e.$lines=t}else e.$lines=e.$string.split("\n")}$Reader.__enter__=function(e){return e},$Reader.__exit__=function(e){return!1},$Reader.__iter__=function(e){return iter($Reader.readlines(e))},$Reader.__len__=function(e){return e.lines.length},$Reader.close=function(e){e.closed=!0},$Reader.flush=function(e){return None},$Reader.read=function(){var e=$B.args("read",2,{self:null,size:null},["self","size"],arguments,{size:-1},null,null),t=e.self,r=$B.$GetInt(e.size);if(!0===t.closed)throw _b_.ValueError.$factory("I/O operation on closed file");make_content(t);var n=t.$binary?t.$bytes.source.length:t.$string.length;return r<0&&(r=n-t.$counter),t.$binary?res=_b_.bytes.$factory(t.$bytes.source.slice(t.$counter,t.$counter+r)):res=t.$string.substr(t.$counter,r),t.$counter+=r,res},$Reader.readable=function(e){return!0},$Reader.readline=function(e,t){var r=$B.args("readline",2,{self:null,size:null},["self","size"],arguments,{size:-1},null,null);e=r.self,t=$B.$GetInt(r.size);if(e.$lc=void 0===e.$lc?-1:e.$lc,!0===e.closed)throw _b_.ValueError.$factory("I/O operation on closed file");if(make_content(e),e.$binary){var n;if(-1==(n=e.$bytes.source.indexOf(10,e.$counter)))return _b_.bytes.$factory();var s={__class__:_b_.bytes,source:e.$bytes.source.slice(e.$counter,n+1)};return e.$counter=n+1,s}if(-1==(n=e.$string.indexOf("\n",e.$counter)))return"";s=e.$string.substring(e.$counter,n+1);return e.$counter=n+1,s},$Reader.readlines=function(){var e=$B.args("readlines",2,{self:null,hint:null},["self","hint"],arguments,{hint:-1},null,null),t=e.self,r=$B.$GetInt(e.hint);if(!0===t.closed)throw _b_.ValueError.$factory("I/O operation on closed file");if(t.$lc=void 0===t.$lc?-1:t.$lc,make_lines(t),r<0)var n=t.$lines.slice(t.$lc+1);else for(n=[];t.$lc<t.$lines.length&&0<r;)t.$lc++,n.push(t.$lines[t.$lc]);for(;""==n[n.length-1];)n.pop();return n},$Reader.seek=function(e,t,r){if(e.closed===True)throw _b_.ValueError.$factory("I/O operation on closed file");void 0===r&&(r=0),0===r?e.$counter=t:1===r?e.$counter+=t:2===r&&(e.$counter=e.$content.length+t)},$Reader.seekable=function(e){return!0},$Reader.tell=function(e){return e.$counter},$Reader.writable=function(e){return!1},$B.set_func_names($Reader,"builtins");var $BufferedReader=$B.make_class("_io.BufferedReader");$BufferedReader.__mro__=[$Reader,object];var $TextIOWrapper=$B.make_class("_io.TextIOWrapper",function(){var e=$B.args("TextIOWrapper",6,{buffer:null,encoding:null,errors:null,newline:null,line_buffering:null,write_through:null},["buffer","encoding","errors","newline","line_buffering","write_through"],arguments,{encoding:"utf-8",errors:_b_.None,newline:_b_.None,line_buffering:_b_.False,write_through:_b_.False},null,null);return{__class__:$TextIOWrapper,$bytes:e.buffer.$bytes,encoding:e.encoding,errors:e.errors,newline:e.newline}});function $url_open(){var $ns=$B.args("open",3,{file:null,mode:null,encoding:null},["file","mode","encoding"],arguments,{mode:"r",encoding:"utf-8"},"args","kw"),$bytes,$string,$res;for(var attr in $ns)eval("var "+attr+'=$ns["'+attr+'"]');if(args.length>0)var mode=args[0];if(args.length>1)var encoding=args[1];if(mode.search("w")>-1)throw _b_.IOError.$factory("Browsers cannot write on disk");if(-1==["r","rb"].indexOf(mode))throw _b_.ValueError.$factory("Invalid mode '"+mode+"'");if(isinstance(file,_b_.str)){var is_binary=mode.search("b")>-1;if($B.file_cache.hasOwnProperty($ns.file))$string=$B.file_cache[$ns.file];else if($B.files&&$B.files.hasOwnProperty($ns.file)){$res=atob($B.files[$ns.file].content);var source=[];for(const e of $res)source.push(e.charCodeAt(0));$bytes=_b_.bytes.$factory(),$bytes.source=source}else if("file"!=$B.protocol){if(is_binary)throw _b_.IOError.$factory("open() in binary mode is not supported");var req=new XMLHttpRequest;req.onreadystatechange=function(){try{var e=this.status;$res=404==e?_b_.FileNotFoundError.$factory(file):200!=e?_b_.IOError.$factory("Could not open file "+file+" : status "+e):this.responseText}catch(e){$res=_b_.IOError.$factory("Could not open file "+file+" : error "+e)}};var fake_qs=$B.$options.cache?"":"?foo="+(new Date).getTime();if(req.open("GET",file+fake_qs,!1),req.overrideMimeType("text/plain; charset=utf-8"),req.send(),$res.constructor===Error)throw $res;$string=$res}else console.warn("cannot load by Ajax call with protocol 'file'");if(void 0===$string&&void 0===$bytes)throw _b_.FileNotFoundError.$factory($ns.file);var res={$binary:is_binary,$string:$string,$bytes:$bytes,$counter:0,closed:False,encoding:encoding,mode:mode,name:file};return res.__class__=is_binary?$BufferedReader:$TextIOWrapper,res}throw _b_.TypeError.$factory("invalid argument for open(): "+_b_.str.$factory(file))}$TextIOWrapper.__mro__=[$Reader,object],$B.set_func_names($TextIOWrapper,"builtins"),$B.Reader=$Reader,$B.TextIOWrapper=$TextIOWrapper,$B.BufferedReader=$BufferedReader;var zip=$B.make_class("zip",function(){var e={__class__:zip,items:[]};if(0==arguments.length)return e;for(var t=$B.args("zip",0,{},[],arguments,{},"args","kw").args,r=[],n=0;n<t.length;n++)r.push(iter(t[n]));for(var s=0,a=[];;){var i=[],o=!0;for(n=0;n<r.length;n++)try{i.push(next(r[n]))}catch(e){if(e.__class__==_b_.StopIteration){o=!1;break}throw e}if(!o)break;a[s++]=_b_.tuple.$factory(i)}return e.items=a,e}),zip_iterator=$B.make_iterator_class("zip_iterator");function no_set_attr(e,t){throw void 0!==e[t]?_b_.AttributeError.$factory("'"+e.$infos.__name__+"' object attribute '"+t+"' is read-only"):_b_.AttributeError.$factory("'"+e.$infos.__name__+"' object has no attribute '"+t+"'")}zip.__iter__=function(e){return zip_iterator.$factory(e.items)},$B.set_func_names(zip,"builtins");var True=!0,False=!1,ellipsis=$B.make_class("ellipsis",function(){return Ellipsis}),Ellipsis={__class__:ellipsis,__bool__:function(){return True}};for(var $key in $B.$comps)switch($B.$comps[$key]){case"ge":case"gt":case"le":case"lt":ellipsis["__"+$B.$comps[$key]+"__"]=function(e){return function(t){throw _b_.TypeError.$factory("unorderable types: ellipsis() "+e+" "+$B.class_name(t))}}($key)}for(var $func in Ellipsis)"function"==typeof Ellipsis[$func]&&(Ellipsis[$func].__str__=function(e){return function(){return"<method-wrapper "+e+" of Ellipsis object>"}}($func));$B.set_func_names(ellipsis);var FunctionCode=$B.make_class("function code"),FunctionGlobals=$B.make_class("function globals");$B.Function={__class__:_b_.type,__code__:{__class__:FunctionCode,__name__:"function code"},__globals__:{__class__:FunctionGlobals,__name__:"function globals"},__mro__:[object],$infos:{__name__:"function",__module__:"builtins"},$is_class:!0},$B.Function.__delattr__=function(e,t){if("__dict__"==t)throw _b_.TypeError.$factory("can't deleted function __dict__")},$B.Function.__dir__=function(e){var t=e.$infos||{},r=e.$attrs||{};return Object.keys(t).concat(Object.keys(r))},$B.Function.__eq__=function(e,t){return e===t},$B.Function.__get__=function(e,t){if(t===_b_.None)return e;var r=function(){return e(t,...arguments)};return r.__class__=$B.method,void 0===e.$infos&&(console.log("no $infos",e),console.log($B.last($B.frames_stack))),r.$infos={__name__:e.$infos.__name__,__qualname__:$B.class_name(t)+"."+e.$infos.__name__,__self__:t,__func__:e},r},$B.Function.__getattribute__=function(e,t){if(!e.$infos||void 0===e.$infos[t]){if(e.$infos&&e.$infos.__dict__&&void 0!==e.$infos.__dict__.$string_dict[t])return e.$infos.__dict__.$string_dict[t][0];if("__closure__"==t){var r=e.$infos.__code__.co_freevars;if(0==r.length)return None;for(var n=[],s=0;s<r.length;s++)try{n.push($B.cell.$factory($B.$check_def_free(r[s])))}catch(e){n.push($B.cell.$factory(None))}return _b_.tuple.$factory(n)}return"__globals__"==t?$B.obj_dict($B.imported[e.$infos.__module__]):e.$attrs&&void 0!==e.$attrs[t]?e.$attrs[t]:_b_.object.__getattribute__(e,t)}if("__code__"==t){var a={__class__:code};for(var t in e.$infos.__code__)a[t]=e.$infos.__code__[t];return a.name=e.$infos.__name__,a.filename=e.$infos.__code__.co_filename,a.co_code=e+"",a}return"__annotations__"==t?$B.obj_dict(e.$infos[t]):e.$infos.hasOwnProperty(t)?e.$infos[t]:void 0},$B.Function.__repr__=$B.Function.__str__=function(e){return void 0===e.$infos?"<function "+e.name+">":"<function "+e.$infos.__qualname__+">"},$B.Function.__mro__=[object],$B.Function.__setattr__=function(e,t,r){if("__closure__"==t)throw _b_.AttributeError.$factory("readonly attribute");if("__defaults__"==t){if(r===_b_.None)r=[];else if(!isinstance(r,_b_.tuple))throw _b_.TypeError.$factory("__defaults__ must be set to a tuple object");var n=e.$set_defaults;if(void 0===n)throw _b_.AttributeError.$factory("cannot set attribute "+t+" of "+_b_.str.$factory(e));if(!e.$infos||!e.$infos.__code__)throw _b_.AttributeError.$factory("cannot set attribute "+t+" of "+_b_.str.$factory(e));for(var s=e.$infos.__code__.co_argcount,a=e.$infos.__code__.co_varnames.slice(0,s),i={},o=r.length-1;o>=0;o--){var _=a.length-r.length+o;if(_<0)break;i[a[_]]=r[o]}var l=e.$infos.$class,c=n(i);return c.$set_defaults=n,l?(l[e.$infos.__name__]=c,c.$infos.$class=l,c.$infos.__defaults__=r):(e.$infos.$defaults=r,e.$infos.__defaults__=r),_b_.None}void 0!==e.$infos[t]?e.$infos[t]=r:(e.$attrs=e.$attrs||{},e.$attrs[t]=r)},$B.Function.$factory=function(){},$B.set_func_names($B.Function,"builtins"),_b_.__BRYTHON__=__BRYTHON__,$B.builtin_funcs=["abs","all","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dir","divmod","eval","exec","exit","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","locals","max","min","next","oct","open","ord","pow","print","quit","repr","round","setattr","sorted","sum","vars"];var builtin_function=$B.builtin_function=$B.make_class("builtin_function_or_method");builtin_function.__getattribute__=$B.Function.__getattribute__,builtin_function.__reduce_ex__=builtin_function.__reduce__=function(e){return e.$infos.__name__},builtin_function.__repr__=builtin_function.__str__=function(e){return"<built-in function "+e.$infos.__name__+">"},$B.set_func_names(builtin_function,"builtins");var method_wrapper=$B.make_class("method_wrapper");method_wrapper.__repr__=method_wrapper.__str__=function(e){return"<method wrapper '"+e.$infos.__name__+"' of function object>"},$B.set_func_names(method_wrapper,"builtins");var wrapper_descriptor=$B.wrapper_descriptor=$B.make_class("wrapper_descriptor");wrapper_descriptor.__getattribute__=$B.Function.__getattribute__,wrapper_descriptor.__repr__=wrapper_descriptor.__str__=function(e){return"<slot wrapper '"+e.$infos.__name__+"' of '"+e.__objclass__.$infos.__name__+"' object>"},$B.set_func_names(wrapper_descriptor,"builtins"),$B.builtin_classes=["bool","bytearray","bytes","classmethod","complex","dict","enumerate","filter","float","frozenset","int","list","map","memoryview","object","property","range","reversed","set","slice","staticmethod","str","super","tuple","type","zip"];for(var other_builtins=["Ellipsis","False","None","True","__debug__","__import__","copyright","credits","license","NotImplemented"],builtin_names=$B.builtin_funcs.concat($B.builtin_classes).concat(other_builtins),i=0;i<builtin_names.length;i++){var name=builtin_names[i],orig_name=name,name1=name;"open"==name&&(name1="$url_open"),"super"==name&&(name=name1="$$super"),"eval"==name&&(name=name1="$$eval"),"print"==name&&(name1="$print");try{_b_[name]=eval(name1),$B.builtin_funcs.indexOf(orig_name)>-1&&(_b_[name].__class__=builtin_function,_b_[name].$infos={__module__:"builtins",__name__:orig_name,__qualname__:orig_name})}catch(e){}}_b_.open=$url_open,_b_.print=$print,_b_.$$super=$$super,_b_.object.__init__.__class__=wrapper_descriptor,_b_.object.__new__.__class__=builtin_function}(__BRYTHON__),function($B){var bltns=$B.InjectBuiltins();eval(bltns),$B.del_exc=function(){$B.last($B.frames_stack)[1].$current_exception=void 0},$B.set_exc=function(e){$B.last($B.frames_stack)[1].$current_exception=$B.exception(e)},$B.get_exc=function(){return $B.last($B.frames_stack)[1].$current_exception},$B.$raise=function(e){if(void 0===e){var t=$B.get_exc();if(void 0!==t)throw t;throw _b_.RuntimeError.$factory("No active exception to reraise")}if(isinstance(e,BaseException))throw e.__class__===_b_.StopIteration&&$B.last($B.frames_stack)[1].$is_generator&&(e=_b_.RuntimeError.$factory("generator raised StopIteration")),e;if(e.$is_class&&issubclass(e,BaseException)){if(e===_b_.StopIteration&&$B.last($B.frames_stack)[1].$is_generator)throw _b_.RuntimeError.$factory("generator raised StopIteration");throw $B.$call(e)()}throw _b_.TypeError.$factory("exceptions must derive from BaseException")},$B.$syntax_err_line=function(e,t,r,n,s){var a={},i=1;t="$"==t.charAt(0)?"<string>":t;if(void 0===r)e.$line_info=s+","+t,e.args=_b_.tuple.$factory([$B.$getitem(e.args,0),t,s,0,0]);else{for(var o={1:0},_=0,l=r.length;_<l;_++)a[_]=i,"\n"==r.charAt(_)&&(o[++i]=_);for(;void 0===s;)s=a[n],n--;e.$line_info=s+","+t;var c=r.split("\n")[s-1],u=n-o[s];l=c.length;for(e.text=c,(u-=l-c.length)<0&&(u=0);" "==c.charAt(0);)c=c.substr(1),u>0&&u--;e.offset=u,e.args=_b_.tuple.$factory([$B.$getitem(e.args,0),t,s,u,c])}e.lineno=s,e.msg=e.args[0],e.filename=t},$B.$SyntaxError=function(e,t,r,n,s,a){void 0!==a&&void 0!==a.line_info&&(s=a.line_info);var i=_b_.SyntaxError.$factory(t);throw $B.$syntax_err_line(i,e,r,n,s),i},$B.$IndentationError=function(e,t,r,n,s,a){$B.frames_stack.push([e,{$line_info:s+","+e},e,{$src:r}]),void 0!==a&&void 0!==a.line_info&&(s=a.line_info);var i=_b_.IndentationError.$factory(t);throw $B.$syntax_err_line(i,e,r,n,s),i},$B.print_stack=function(e){e=e||$B.frames_stack;var t=[];return e.forEach(function(e){var r=e[1].$line_info;if(void 0!==r){var n=r.split(",");n[1].startsWith("$exec")&&(n[1]="<module>"),t.push(n[1]+" line "+n[0]);var s=$B.file_cache[e[3].__file__];if(s){var a=s.split("\n")[parseInt(n[0])-1];t.push(" "+a.trim())}}}),console.log("print stack ok",t),t.join("\n")};var traceback=$B.traceback=$B.make_class("traceback",function(e,t){$B.last($B.frames_stack);return void 0===t&&(t=e.$stack),{__class__:traceback,$stack:t,exc:e}});traceback.__getattribute__=function(e,t){if("tb_frame"===t||"tb_lineno"===t||"tb_lasti"===t||"tb_next"===t){0==e.$stack.length&&console.log("no stack",t);var r=e.$stack[0];void 0===r&&console.log("last frame undef",e.$stack,Object.keys(e.$stack));var n=r[1].$line_info;null!=r[1].$frozen_line_info&&(n=r[1].$frozen_line_info)}switch(t){case"tb_frame":return frame.$factory(e.$stack);case"tb_lineno":return void 0===n||r[0].startsWith($B.lambda_magic)?r[4]&&r[4].$infos&&r[4].$infos.__code__?r[4].$infos.__code__.co_firstlineno:-1:parseInt(n.split(",")[0]);case"tb_lasti":if(void 0===n)return console.log("no line info",e.$stack),"";for(var s,a,i=n.split(","),o=e.$stack.length-1;o>=0;o--){var _=e.$stack[o];if(_[2]==i[1].replace(/\./g,"_")){a=_[3].__file__;break}}return void 0===s&&($B.file_cache.hasOwnProperty(a)?s=$B.file_cache[a]:$B.imported[i[1]]&&$B.imported[i[1]].__file__&&(s=$B.file_cache[$B.imported[i[1]].__file__],console.log("from filecache",n,$B.imported[i[1]].__file__))),void 0!==s?s.split("\n")[parseInt(i[0]-1)].trim():(console.log(a),console.log("no src for",i),"");case"tb_next":return e.$stack.length<=1?None:traceback.$factory(e.exc,e.$stack.slice(1));default:return _b_.object.__getattribute__(e,t)}},$B.set_func_names(traceback,"builtins");var frame=$B.make_class("frame",function(e,t){var r=e,n={__class__:frame,f_builtins:{},$stack:e.slice()};if(void 0===t&&(t=0),n.$pos=t,r.length){var s,a=r[t],i=a[0];try{n.f_locals=$B.obj_dict(a[1])}catch(e){throw console.log("err "+e),e}if(n.f_globals=$B.obj_dict(a[3]),void 0!==a[3].__file__?s=a[3].__file__:i.startsWith("$exec")&&(s="<string>"),void 0===a[1].$line_info)n.f_lineno=-1;else{var o=a[1].$line_info.split(",");n.f_lineno=parseInt(o[0]);var _=o[1];$B.imported.hasOwnProperty(_)&&(s=$B.imported[_].__file__),n.f_lineno=parseInt(a[1].$line_info.split(",")[0])}var l=i.startsWith("$exec")?"<module>":i;i==a[2]?l="<module>":a[1].$name?l=a[1].$name:a[1].$dict_comp?l="<dictcomp>":a[1].$list_comp?l="<listcomp>":a.length>4&&(l=a[4].$infos?a[4].$infos.__name__:a[4].name,void 0===a[4].$infos?a[4].name.startsWith("__ge")?l="<genexpr>":a[4].name.startsWith("set_comp"+$B.lambda_magic)&&(l="<setcomp>"):void 0===s&&a[4].$infos.__code__&&(void 0===(s=a[4].$infos.__code__.co_filename)&&(s=a[4].$infos.__module__),n.f_lineno=a[4].$infos.__code__.co_firstlineno)),n.f_code={__class__:$B.code,co_code:None,co_name:l,co_filename:s},void 0===s&&(n.f_code.co_filename="<string>")}return n});frame.__delattr__=function(e,t){"f_trace"==t&&($B.last(e.$stack)[1].$f_trace=_b_.None)},frame.__getattr__=function(e,t){if("f_back"==t)return e.$pos>0?frame.$factory(e.$stack.slice(0,e.$stack.length-1),e.$pos-1):_b_.None;if("clear"==t)return function(){};if("f_trace"==t){var r=$B.last(e.$stack)[1];return void 0===r.$f_trace?_b_.None:r.$f_trace}},frame.__setattr__=function(e,t,r){"f_trace"==t&&($B.last(e.$stack)[1].$f_trace=r)},frame.__str__=frame.__repr__=function(e){return"<frame object, file "+e.f_code.co_filename+", line "+e.f_lineno+", code "+e.f_code.co_name+">"},$B.set_func_names(frame,"builtins"),$B._frame=frame;var BaseException=_b_.BaseException={__class__:_b_.type,__bases__:[_b_.object],__mro__:[_b_.object],args:[],$infos:{__name__:"BaseException",__module__:"builtins"},$is_class:!0};BaseException.__init__=function(e){var t=void 0===arguments[1]?[]:[arguments[1]];e.args=_b_.tuple.$factory(t)},BaseException.__repr__=function(e){var t=e.__class__.$infos.__name__;return e.args[0]&&(t+="("+repr(e.args[0])),e.args.length>1&&(t+=", "+repr($B.fast_tuple(e.args.slice(1)))),t+")"},BaseException.__str__=function(e){return e.args.length>0?_b_.str.$factory(e.args[0]):e.__class__.$infos.__name__},BaseException.__new__=function(e){var t=_b_.BaseException.$factory();return t.__class__=e,t.__dict__=_b_.dict.$factory(),t};var getExceptionTrace=function(e,t){if(void 0===e.__class__)return $B.debug>1&&console.log("no class",e),e+"";var r="";void 0!==e.$js_exc&&t&&(r+="\nJS stack:\n"+e.$js_exc.stack+"\n"),r+="Traceback (most recent call last):";for(var n=e.$line_info,s=0;s<e.$stack.length;s++){var a=e.$stack[s];if(a[1]&&a[1].$line_info){var i;n=a[1].$line_info.split(",");if(e.module==n[1]&&(i=e.src),!t)if(void 0===(i=a[3].$src))if($B.VFS&&$B.VFS.hasOwnProperty(a[2]))i=$B.VFS[a[2]][1];else if(!(i=$B.file_cache[a[3].__file__]))continue;var o=a[3].__file__||"<string>",_=n[1],l="$"==_.charAt(0);if(l&&(_="<module>"),r+="\n File "+o+" line "+n[0],a.length>4?a[4].$infos?r+=", in "+a[4].$infos.__name__:a[4].name.startsWith("__ge")?r+=", in <genexpr>":a[4].name.startsWith("set_comp"+$B.lambda_magic)?r+=", in <setcomp>":console.log("frame[4]",a[4]):a[1].$list_comp?r+=", in <listcomp>":a[1].$dict_comp?r+=", in <dictcomp>":r+=", in <module>",void 0!==i&&!l){var c=i.split("\n")[parseInt(n[0])-1];c&&(c=c.replace(/^[ ]+/g,"")),r+="\n "+c}}}return e.__class__===_b_.SyntaxError&&(r+="\n File "+e.args[1]+", line "+e.args[2]+"\n "+e.args[4]),r};function deep_copy(e){var t=$B.last($B.frames_stack);if(t[0]!=t[2])for(var r=0,n=$B.frames_stack.length;r<n;r++)if($B.frames_stack[0]==t[0])return e.slice(r);return e.slice()}BaseException.__getattr__=function(e,t){if("info"==t)return getExceptionTrace(e,!1);if("infoWithInternal"==t)return getExceptionTrace(e,!0);if("__traceback__"==t)return void 0!==e.$traceback?e.$traceback:traceback.$factory(e);throw _b_.AttributeError.$factory(e.__class__.$infos.__name__+" has no attribute '"+t+"'")},BaseException.with_traceback=function(e,t){return e.$traceback=t,e},$B.freeze=function(e){for(var t=0,r=e.length;t<r;t++)e[t][1].$frozen_line_info=e[t][1].$line_info,e[t][3].$frozen_line_info=e[t][3].$line_info;return e};var show_stack=$B.show_stack=function(e){e=e||$B.frames_stack;for(const t of e)console.log(t[0],t[1].$line_info)};function $make_exc(names,parent){for(var _str=[],pos=0,i=0;i<names.length;i++){var name=names[i],code="";if(Array.isArray(name))var code=name[1],name=name[0];$B.builtins_scope[name]=!0;var $exc=(BaseException.$factory+"").replace(/BaseException/g,name);$exc=$exc.replace("//placeholder//",code),_str[pos++]="_b_."+name+" = {__class__:_b_.type, __mro__: [_b_."+parent.$infos.__name__+"].concat(parent.__mro__), $is_class: true,$infos: {__name__:'"+name+"'}}",_str[pos++]="_b_."+name+".$factory = "+$exc,_str[pos++]="_b_."+name+'.$factory.$infos = {__name__: "'+name+'", __qualname__: "'+name+'"}',_str[pos++]="$B.set_func_names(_b_."+name+", 'builtins')"}try{eval(_str.join(";"))}catch(e){throw console.log("--err"+e),e}}BaseException.$factory=function(){var err=Error();return err.args=$B.fast_tuple(Array.prototype.slice.call(arguments)),err.__class__=_b_.BaseException,err.$py_error=!0,void 0===err.$stack&&(err.$stack=$B.freeze($B.frames_stack.slice())),$B.frames_stack.length&&(err.$line_info=$B.last($B.frames_stack)[1].$line_info),eval("//placeholder//"),err.__cause__=_b_.None,err.__context__=_b_.None,err.__suppress_context__=!1,err},BaseException.$factory.$infos={__name__:"BaseException",__qualname__:"BaseException"},$B.set_func_names(BaseException),_b_.BaseException=BaseException,$B.exception=function(e,t){if(e.__class__){a=e;if(t)for(var r=$B.last($B.frames_stack)[0],n=0,s=a.$stack.length;n<s;n++)if(a.$stack[n][0]==r){a.$stack=a.$stack.slice(n),a.$traceback=traceback.$factory(a);break}}else{var a;if(console.log("Javascript exception:",e),console.log($B.last($B.frames_stack)),console.log("recursion error ?",$B.is_recursion_error(e)),(a=Error()).__name__="Internal Javascript error: "+(e.__name__||e.name),a.__class__=_b_.Exception,a.$js_exc=e,$B.is_recursion_error(e))return _b_.RecursionError.$factory("too much recursion");"ReferenceError"==e.name?(a.__name__="NameError",a.__class__=_b_.NameError,e.message=e.message.replace("$$","")):"InternalError"==e.name&&(a.__name__="RuntimeError",a.__class__=_b_.RuntimeError),a.__cause__=_b_.None,a.__context__=_b_.None,a.__suppress_context__=!1;var i="<Javascript "+e.name+">: "+(e.message||"<"+e+">");a.args=_b_.tuple.$factory([i]),a.$py_error=!0,a.$stack=$B.freeze($B.frames_stack.slice())}return a},$B.is_exc=function(e,t){void 0===e.__class__&&(e=$B.exception(e));for(var r=e.$is_class?e:e.__class__,n=0;n<t.length;n++){var s=t[n];if(void 0===r&&console.log("exc class undefined",e),issubclass(r,s))return!0}return!1},$B.is_recursion_error=function(e){console.log("test is js exc is recursion error",e,e+"");var t=(e+"").split(":"),r=t[0].trim(),n=t[1].trim();return"InternalError"==r&&"too much recursion"==n||"Error"==r&&"Out of stack space"==n||"RangeError"==r&&"Maximum call stack size exceeded"==n},$make_exc(["SystemExit","KeyboardInterrupt","GeneratorExit","Exception"],BaseException),$make_exc([["StopIteration","err.value = arguments[0]"],["StopAsyncIteration","err.value = arguments[0]"],"ArithmeticError","AssertionError","AttributeError","BufferError","EOFError",["ImportError","err.name = arguments[0]"],"LookupError","MemoryError","NameError","OSError","ReferenceError","RuntimeError",["SyntaxError","err.msg = arguments[0]"],"SystemError","TypeError","ValueError","Warning"],_b_.Exception),$make_exc(["FloatingPointError","OverflowError","ZeroDivisionError"],_b_.ArithmeticError),$make_exc([["ModuleNotFoundError","err.name = arguments[0]"]],_b_.ImportError),$make_exc(["IndexError","KeyError"],_b_.LookupError),$make_exc(["UnboundLocalError"],_b_.NameError),$make_exc(["BlockingIOError","ChildProcessError","ConnectionError","FileExistsError","FileNotFoundError","InterruptedError","IsADirectoryError","NotADirectoryError","PermissionError","ProcessLookupError","TimeoutError"],_b_.OSError),$make_exc(["BrokenPipeError","ConnectionAbortedError","ConnectionRefusedError","ConnectionResetError"],_b_.ConnectionError),$make_exc(["NotImplementedError","RecursionError"],_b_.RuntimeError),$make_exc(["IndentationError"],_b_.SyntaxError),$make_exc(["TabError"],_b_.IndentationError),$make_exc(["UnicodeError"],_b_.ValueError),$make_exc(["UnicodeDecodeError","UnicodeEncodeError","UnicodeTranslateError"],_b_.UnicodeError),$make_exc(["DeprecationWarning","PendingDeprecationWarning","RuntimeWarning","SyntaxWarning","UserWarning","FutureWarning","ImportWarning","UnicodeWarning","BytesWarning","ResourceWarning"],_b_.Warning),$make_exc(["EnvironmentError","IOError","VMSError","WindowsError"],_b_.OSError),$B.$TypeError=function(e){throw _b_.TypeError.$factory(e)};var se=_b_.SyntaxError.$factory;_b_.SyntaxError.$factory=function(){var e=arguments[0];if(e.__class__===_b_.SyntaxError)return e;var t=se.apply(null,arguments),r=$B.last($B.frames_stack);if(r){line_info=r[1].$line_info,t.filename=r[3].__file__,t.lineno=parseInt(line_info.split(",")[0]);var n=$B.file_cache[r[3].__file__];n&&(lines=n.split("\n"),t.text=lines[t.lineno-1]),t.offset=e.offset}return t},_b_.SyntaxError}(__BRYTHON__),function(e){var t=e.builtins,r=t.None,n={__class__:t.type,__mro__:[t.object],$infos:{__module__:"builtins",__name__:"range"},$is_class:!0,$native:!0,$descriptors:{start:!0,step:!0,stop:!0}};function s(t,r){var s=n.__len__(t);return 0==s?t.start:r>s?t.stop:e.add(t.start,e.mul(t.step,r))}n.__contains__=function(t,r){if(0==n.__len__(t))return!1;try{r=e.int_or_bool(r)}catch(e){try{return n.index(t,r),!0}catch(e){return!1}}var s=e.sub(r,t.start),a=e.floordiv(s,t.step),i=e.mul(t.step,a);return!!e.eq(i,s)&&(e.gt(t.stop,t.start)?e.ge(r,t.start)&&e.gt(t.stop,r):e.ge(t.start,r)&&e.gt(r,t.stop))},n.__delattr__=function(e,r,n){throw t.AttributeError.$factory("readonly attribute")},n.__eq__=function(r,s){if(t.isinstance(s,n)){var a=n.__len__(r);return!!e.eq(a,n.__len__(s))&&(0==a||!!e.eq(r.start,s.start)&&(1==a||e.eq(r.step,s.step)))}return!1},n.__getitem__=function(r,a){if(t.isinstance(a,t.slice)){var i=t.slice.$conv_for_seq(a,n.__len__(r)),o=e.mul(r.step,i.step),_=s(r,i.start),l=s(r,i.stop);return n.$factory(_,l,o)}"number"!=typeof a&&(a=e.$GetInt(a)),e.gt(0,a)&&(a=e.add(a,n.__len__(r)));var c=e.add(r.start,e.mul(a,r.step));if(e.gt(r.step,0)&&(e.ge(c,r.stop)||e.gt(r.start,c))||e.gt(0,r.step)&&(e.ge(r.stop,c)||e.gt(c,r.start)))throw t.IndexError.$factory("range object index out of range");return c},n.__hash__=function(e){var s=n.__len__(e);return 0==s?t.hash(t.tuple.$factory([0,r,r])):1==s?t.hash(t.tuple.$factory([1,e.start,r])):t.hash(t.tuple.$factory([s,e.start,e.step]))};var a={__class__:t.type,__mro__:[t.object],__iter__:function(e){return e},__next__:function(e){return t.next(e.obj)},$infos:{__name__:"range_iterator",__module__:"builtins"},$is_class:!0,$factory:function(e){return{__class__:a,obj:e}}};e.set_func_names(a,"builtins"),n.__iter__=function(t){var r={__class__:n,start:t.start,stop:t.stop,step:t.step};return t.$safe?r.$counter=t.start-t.step:r.$counter=e.sub(t.start,t.step),a.$factory(r)},n.__len__=function(t){var r;if(e.gt(t.step,0)){if(e.ge(t.start,t.stop))return 0;var n=e.sub(t.stop,e.add(1,t.start)),s=e.floordiv(n,t.step);r=e.add(1,s)}else{if(e.ge(t.stop,t.start))return 0;n=e.sub(t.start,e.add(1,t.stop)),s=e.floordiv(n,e.mul(-1,t.step));r=e.add(1,s)}return void 0===e.maxsize&&(e.maxsize=e.long_int.__pow__(e.long_int.$factory(2),63),e.maxsize=e.long_int.__sub__(e.maxsize,1)),r},n.__next__=function(r){if(r.$safe){if(r.$counter+=r.step,r.step>0&&r.$counter>=r.stop||r.step<0&&r.$counter<=r.stop)throw t.StopIteration.$factory("")}else if(r.$counter=e.add(r.$counter,r.step),e.gt(r.step,0)&&e.ge(r.$counter,r.stop)||e.gt(0,r.step)&&e.ge(r.stop,r.$counter))throw t.StopIteration.$factory("");return r.$counter},n.__reversed__=function(t){var r=e.sub(n.__len__(t),1);return n.$factory(e.add(t.start,e.mul(r,t.step)),e.sub(t.start,t.step),e.mul(-1,t.step))},n.__repr__=n.__str__=function(e){var r="range("+t.str.$factory(e.start)+", "+t.str.$factory(e.stop);return 1!=e.step&&(r+=", "+t.str.$factory(e.step)),r+")"},n.__setattr__=function(e,r,n){throw t.AttributeError.$factory("readonly attribute")},n.start=function(e){return e.start},n.step=function(e){return e.step},n.stop=function(e){return e.stop},n.count=function(r,s){if(t.isinstance(s,[t.int,t.float,t.bool]))return t.int.$factory(n.__contains__(r,s));for(var i=n.__iter__(r),o=a.__next__,_=0;;)try{l=o(i),e.rich_comp("__eq__",s,l)&&_++}catch(e){if(t.isinstance(e,t.StopIteration))return _;throw e}var l},n.index=function(r,s){var i,o=e.args("index",2,{self:null,other:null},["self","other"],arguments,{},null,null);r=o.self,s=o.other;try{s=e.int_or_bool(s)}catch(o){for(var _=n.__iter__(r),l=a.__next__,c=0;;)try{if(i=l(_),e.rich_comp("__eq__",s,i))return c;c++}catch(e){if(t.isinstance(e,t.StopIteration))throw t.ValueError.$factory(t.str.$factory(s)+" not in range");throw e}}var u=e.sub(s,r.start),f=e.floordiv(u,r.step),p=e.mul(r.step,f);if(e.eq(p,u)){if(e.gt(r.stop,r.start)&&e.ge(s,r.start)&&e.gt(r.stop,s)||e.ge(r.start,r.stop)&&e.ge(r.start,s)&&e.gt(s,r.stop))return f;throw t.ValueError.$factory(t.str.$factory(s)+" not in range")}throw t.ValueError.$factory(t.str.$factory(s)+" not in range")},n.$factory=function(){var r=e.args("range",3,{start:null,stop:null,step:null},["start","stop","step"],arguments,{start:null,stop:null,step:null},null,null),s=r.start,a=r.stop,i=r.step;if(null===a&&null===i){if(null==s)throw t.TypeError.$factory("range expected 1 arguments, got 0");return a=e.PyNumber_Index(s),{__class__:n,start:0,stop:a,step:1,$is_range:!0,$safe:"number"==typeof a}}if(null===i&&(i=1),s=e.PyNumber_Index(s),a=e.PyNumber_Index(a),0==(i=e.PyNumber_Index(i)))throw t.ValueError.$factory("range arg 3 must not be zero");return{__class__:n,start:s,stop:a,step:i,$is_range:!0,$safe:"number"==typeof s&&"number"==typeof a&&"number"==typeof i}},e.set_func_names(n,"builtins");var i={__class__:t.type,__mro__:[t.object],$infos:{__module__:"builtins",__name__:"slice"},$is_class:!0,$native:!0,$descriptors:{start:!0,step:!0,stop:!0}};function o(r){for(var n=["start","stop","step"],s=[],a=0;a<n.length;a++){var i=r[n[a]];if(i===t.None)s.push(i);else try{s.push(e.PyNumber_Index(i))}catch(e){throw t.TypeError.$factory("slice indices must be integers or None or have an __index__ method")}}return s}i.__eq__=function(e,t){var r=o(e),n=o(t);return r[0]==n[0]&&r[1]==n[1]&&r[2]==n[2]},i.__repr__=i.__str__=function(e){return"slice("+t.str.$factory(e.start)+", "+t.str.$factory(e.stop)+", "+t.str.$factory(e.step)+")"},i.__setattr__=function(e,r,n){throw t.AttributeError.$factory("readonly attribute")},i.$conv_for_seq=function(n,s){var a,i=n.step===r?1:e.PyNumber_Index(n.step),o=e.gt(0,i),_=e.sub(s,1);if(0==i)throw t.ValueError.$factory("slice step cannot be zero");return n.start===r?a=o?_:0:(a=e.PyNumber_Index(n.start),e.gt(0,a)&&(a=e.add(a,s),e.gt(0,a)&&(a=0)),e.ge(a,s)&&(a=i<0?_:s)),n.stop===r?stop=o?-1:s:(stop=e.PyNumber_Index(n.stop),e.gt(0,stop)&&(stop=e.add(stop,s)),e.ge(stop,s)&&(stop=o?_:s)),{start:a,stop:stop,step:i}},i.start=function(e){return e.start},i.step=function(e){return e.step},i.stop=function(e){return e.stop},i.indices=function(r,n){var s=e.args("indices",2,{self:null,length:null},["self","length"],arguments,{},null,null),a=e.$GetInt(s.length);a<0&&t.ValueError.$factory("length should not be negative");var i=r.step==t.None?1:r.step;if(i<0){var o=r.start,_=r.stop;o=o==t.None?a-1:o<0?t.max(-1,o+a):t.min(a-1,r.start),_=r.stop==t.None?-1:_<0?t.max(-1,_+a):t.min(a-1,r.stop)}else{o=r.start==t.None?0:t.min(a,r.start),_=r.stop==t.None?a:t.min(a,r.stop);o<0&&(o=t.max(0,o+a)),_<0&&(_=t.max(0,_+a))}return t.tuple.$factory([o,_,i])},i.$factory=function(){var r,n,s,a=e.args("slice",3,{start:null,stop:null,step:null},["start","stop","step"],arguments,{stop:null,step:null},null,null);null===a.stop&&null===a.step?(r=t.None,n=a.start,s=t.None):(r=a.start,n=a.stop,s=null===a.step?t.None:a.step);var _={__class__:i,start:r,stop:n,step:s};return o(_),_},e.set_func_names(i,"builtins"),t.range=n,t.slice=i}(__BRYTHON__),function(e){var t=e.builtins,r=t.object,n=t.isinstance,s=t.getattr,a=t.None,i={},o={};function _(e,r,s){if(void 0===r){r=[];for(var a="\r\n \t",i=0,o=a.length;i<o;i++)r.push(a.charCodeAt(i))}else{if(!n(r,f))throw t.TypeError.$factory("Type str doesn't support the buffer API");r=r.source}if("l"==s){for(i=0,o=e.source.length;i<o&&-1!=r.indexOf(e.source[i]);i++);return f.$factory(e.source.slice(i))}for(i=e.source.length-1;i>=0&&-1!=r.indexOf(e.source[i]);i--);return f.$factory(e.source.slice(0,i+1))}function l(e){return!t.isinstance(e,[f,c])}e.to_bytes=function(r){var n;if(t.isinstance(r,[f,c]))n=r.source;else{var s=e.$getattr(r,"tobytes",null);if(null===s)throw t.TypeError.$factory("object doesn't support the buffer protocol");n=e.$call(s)().source}return n};var c={__class__:t.type,__mro__:[r],$buffer_protocol:!0,$infos:{__module__:"builtins",__name__:"bytearray"},$is_class:!0};["__delitem__","clear","copy","count","index","pop","remove","reverse","sort"].forEach(function(e){var r;c[e]=(r=e,function(e){for(var n=[e.source],s=1,a=1,i=arguments.length;a<i;a++)n[s++]=arguments[a];return t.list[r].apply(null,n)})});var u=e.make_iterator_class("bytearray_iterator");c.__iter__=function(e){return u.$factory(e.source)},c.__mro__=[r],c.__repr__=c.__str__=function(e){return"bytearray("+f.__repr__(e)+")"},c.__setitem__=function(r,s,i){if(n(s,t.int)){if(!n(i,t.int))throw t.TypeError.$factory("an integer is required");if(i>255)throw t.ValueError.$factory("byte must be in range(0, 256)");var o=s;if(s<0&&(o=r.source.length+o),!(o>=0&&o<r.source.length))throw t.IndexError.$factory("list index out of range");r.source[o]=i}else{if(!n(s,t.slice))throw t.TypeError.$factory("list indices must be integer, not "+e.class_name(s));var _=s.start===a?0:s.start,l=s.stop===a?r.source.length:s.stop;_<0&&(_=r.source.length+_),l<0&&(l=r.source.length+l),r.source.splice(_,l-_);try{for(var c=t.list.$factory(i),u=c.length-1;u>=0;u--){if(!n(c[u],t.int))throw t.TypeError.$factory("an integer is required");if(c[u]>255)throw ValueError.$factory("byte must be in range(0, 256)");r.source.splice(_,0,c[u])}}catch(e){throw t.TypeError.$factory("can only assign an iterable")}}},c.append=function(e,r){if(2!=arguments.length)throw t.TypeError.$factory("append takes exactly one argument ("+(arguments.length-1)+" given)");if(!n(r,t.int))throw t.TypeError.$factory("an integer is required");if(r>255)throw ValueError.$factory("byte must be in range(0, 256)");e.source[e.source.length]=r},c.extend=function(e,r){if(r.__class__===c||r.__class__===f)return r.source.forEach(function(t){e.source.push(t)}),t.None;for(var n=t.iter(r);;)try{c.__add__(e,t.next(n))}catch(e){if(e===t.StopIteration)break;throw e}return t.None},c.insert=function(e,r,s){if(3!=arguments.length)throw t.TypeError.$factory("insert takes exactly 2 arguments ("+(arguments.length-1)+" given)");if(!n(s,t.int))throw t.TypeError.$factory("an integer is required");if(s>255)throw ValueError.$factory("byte must be in range(0, 256)");t.list.insert(e.source,r,s)},c.$factory=function(e,t,r){return c.__new__(c,e,t,r)};var f={__class__:t.type,__mro__:[r],$buffer_protocol:!0,$infos:{__module__:"builtins",__name__:"bytes"},$is_class:!0,__add__:function(e,r){if(n(r,f))return e.__class__.$factory(e.source.concat(r.source));if(n(r,c))return e.__class__.$factory(f.__add__(e,f.$factory(r)));if(n(r,t.memoryview))return e.__class__.$factory(f.__add__(e,t.memoryview.tobytes(r)));throw t.TypeError.$factory("can't concat bytes to "+t.str.$factory(r))},__contains__:function(e,t){if("number"==typeof t)return e.source.indexOf(t)>-1;if(e.source.length<t.source.length)return!1;for(var r=t.source.length,n=0;n<e.source.length-t.source.length+1;n++){for(var s=!0,a=0;a<r;a++)if(t.source[n+a]!=e.source[a]){s=!1;break}if(s)return!0}return!1}},p=e.make_iterator_class("bytes_iterator");f.__iter__=function(e){return p.$factory(e.source)},f.__eq__=function(e,t){return!l(t)&&s(e.source,"__eq__")(t.source)},f.__ge__=function(e,r){return l(r)?t.NotImplemented:t.list.__ge__(e.source,r.source)},f.__getitem__=function(e,r){if(n(r,t.int)){var s=r;if(r<0&&(s=e.source.length+s),s>=0&&s<e.source.length)return e.source[s];throw t.IndexError.$factory("index out of range")}if(n(r,t.slice)){var a=t.slice.$conv_for_seq(r,e.source.length),i=a.start,o=a.stop,_=a.step,l=[],c=null;s=0;if(_>0){if((o=Math.min(o,e.source.length))<=i)return f.$factory([]);for(c=i;c<o;c+=_)l[s++]=e.source[c]}else{if(o>=i)return f.$factory([]);o=Math.max(0,o);for(c=i;c>=o;c+=_)l[s++]=e.source[c]}return f.$factory(l)}if(n(r,t.bool))return e.source.__getitem__(t.int.$factory(r))},f.__gt__=function(e,r){return l(r)?t.NotImplemented:t.list.__gt__(e.source,r.source)},f.__hash__=function(t){if(void 0===t)return f.__hashvalue__||e.$py_next_hash--;for(var r=1,n=0,s=t.source.length;n<s;n++)r=101*r+t.source[n]&4294967295;return r},f.__init__=function(){return t.None},f.__le__=function(e,r){return l(r)?t.NotImplemented:t.list.__le__(e.source,r.source)},f.__len__=function(e){return e.source.length},f.__lt__=function(e,r){return l(r)?t.NotImplemented:t.list.__lt__(e.source,r.source)},f.__mod__=function(e,r){var n=$(e,"ascii","strict"),s=t.str.__mod__(n,r);return t.str.encode(s,"ascii")},f.__mul__=function(){for(var t=e.args("__mul__",2,{self:null,other:null},["self","other"],arguments,{},null,null),r=e.PyNumber_Index(t.other),n=[],s=t.self.source,a=s.length,i=0;i<r;i++)for(var o=0;o<a;o++)n.push(s[o]);var _=f.$factory();return _.source=n,_},f.__ne__=function(e,t){return!f.__eq__(e,t)},f.__new__=function(t,r,n,s){var a=e.args("__new__",4,{cls:null,source:null,encoding:null,errors:null},["cls","source","encoding","errors"],arguments,{encoding:"utf-8",errors:"strict"},null,null);return f.$new(a.cls,a.source,a.encoding,a.errors)},f.$new=function(r,s,a,i){var o={__class__:r},_=[],l=0;if(void 0===s);else if(n(s,t.int))for(var c=s;c--;)_[l++]=0;else if(n(s,t.str)){if(void 0===a)throw t.TypeError.$factory("string argument without an encoding");_=m(s,a,i)}else{_=t.list.$factory(s);for(c=0;c<_.length;c++){try{var u=t.int.$factory(_[c])}catch(r){throw t.TypeError.$factory("'"+e.class_name(_[c])+"' object cannot be interpreted as an integer")}if(u<0||u>255)throw t.ValueError.$factory("bytes must be in range(0, 256)")}}return o.source=_,o.encoding=a,o.errors=i,o},f.__repr__=f.__str__=function(e){for(var t="",r=0,n=e.source.length;r<n;r++){var s=e.source[r];if(10==s)t+="\\n";else if(s<32||s>=128){var a=s.toString(16);t+="\\x"+(a=(1==a.length?"0":"")+a)}else s=="\\".charCodeAt(0)?t+="\\\\":t+=String.fromCharCode(s)}return t.indexOf("'")>-1&&-1==t.indexOf('"')?'b"'+t+'"':"b'"+t.replace(new RegExp("'","g"),"\\'")+"'"},f.__reduce_ex__=function(e){return f.__repr__(e)},f.capitalize=function(e){var t=e.source,r=t.length,n=t.slice();n[0]>96&&n[0]<123&&(n[0]-=32);for(var s=1;s<r;++s)n[s]>64&&n[s]<91&&(n[s]+=32);return f.$factory(n)},f.center=function(){var t=e.args("center",3,{self:null,width:null,fillbyte:null},["self","width","fillbyte"],arguments,{fillbyte:f.$factory([32])},null,null),r=t.width-t.self.source.length;if(r<=0)return f.$factory(t.self.source);var n=f.ljust(t.self,t.self.source.length+Math.floor(r/2),t.fillbyte);return f.rjust(n,t.width,t.fillbyte)},f.count=function(){var r=e.args("count",4,{self:null,sub:null,start:null,end:null},["self","sub","start","end"],arguments,{start:0,end:-1},null,null),n=0,s=-1,a=0;if("number"==typeof r.sub){if(r.sub<0||r.sub>255)throw t.ValueError.$factory("byte must be in range(0, 256)");a=1}else{if(!r.sub.__class__)throw t.TypeError.$factory("first argument must be a bytes-like object, not '"+e.class_name(r.sub)+"'");if(!r.sub.__class__.$buffer_protocol)throw t.TypeError.$factory("first argument must be a bytes-like object, not '"+e.class_name(r.sub)+"'");a=r.sub.source.length}do{-1!=(s=f.find(r.self,r.sub,Math.max(s+a,r.start),r.end))&&n++}while(-1!=s);return n},f.decode=function(t,r,n){var s=e.args("decode",3,{self:null,encoding:null,errors:null},["self","encoding","errors"],arguments,{encoding:"utf-8",errors:"strict"},null,null);switch(s.errors){case"strict":case"ignore":case"replace":case"surrogateescape":case"surrogatepass":case"xmlcharrefreplace":case"backslashreplace":return $(s.self,s.encoding,s.errors)}},f.endswith=function(){var r=e.args("endswith",4,{self:null,suffix:null,start:null,end:null},["self","suffix","start","end"],arguments,{start:-1,end:-1},null,null);if(t.isinstance(r.suffix,f)){for(var n=-1==r.start?r.self.source.length-r.suffix.source.length:Math.min(r.self.source.length-r.suffix.source.length,r.start),s=-1==r.end?-1==r.start?r.self.source.length:n+r.suffix.source.length:Math.min(r.self.source.length-1,r.end),a=!0,i=r.suffix.source.length-1,o=r.suffix.source.length;i>=0&&a;--i)a=r.self.source[s-o+i]==r.suffix.source[i];return a}if(t.isinstance(r.suffix,t.tuple)){for(i=0;i<r.suffix.length;++i){if(!t.isinstance(r.suffix[i],f))throw t.TypeError.$factory("endswith first arg must be bytes or a tuple of bytes, not "+e.class_name(r.suffix));if(f.endswith(r.self,r.suffix[i],r.start,r.end))return!0}return!1}throw t.TypeError.$factory("endswith first arg must be bytes or a tuple of bytes, not "+e.class_name(r.suffix))},f.expandtabs=function(){var r=e.args("expandtabs",2,{self:null,tabsize:null},["self","tabsize"],arguments,{tabsize:8},null,null),n=[];for(let e=0;e<r.tabsize;++e)n.push(32);var s=r.self.source.slice();for(let e=0;e<s.length;++e)9===s[e]&&s.splice.apply(s,[e,1].concat(n));return t.bytes.$factory(s)},f.find=function(r,n){if(2!=arguments.length)var s=e.args("find",4,{self:null,sub:null,start:null,end:null},["self","sub","start","end"],arguments,{start:0,end:-1},null,null),a=(n=s.sub,s.start),i=s.end;else a=0,i=-1;if("number"==typeof n){if(n<0||n>255)throw t.ValueError.$factory("byte must be in range(0, 256)");return r.source.slice(0,-1==i?void 0:i).indexOf(n,a)}if(!n.__class__)throw t.TypeError.$factory("first argument must be a bytes-like object, not '"+e.class_name(n)+"'");if(!n.__class__.$buffer_protocol)throw t.TypeError.$factory("first argument must be a bytes-like object, not '"+e.class_name(n)+"'");i=-1==i?r.source.length:Math.min(r.source.length,i);for(var o=n.source.length,_=a;_<=i-o;_++){for(var l=r.source.slice(_,_+o),c=!0,u=0;u<o;u++)if(l[u]!=n.source[u]){c=!1;break}if(c)return _}return-1},f.fromhex=function(){for(var r=e.args("fromhex",2,{cls:null,string:null},["cls","string"],arguments,{},null,null),n=r.string.replace(/\s/g,""),s=[],a=0;a<n.length;a+=2){if(a+2>n.length)throw t.ValueError.$factory("non-hexadecimal number found in fromhex() arg");s.push(t.int.$factory(n.substr(a,2),16))}return r.cls.$factory(s)},f.hex=function(){for(var t=e.args("hex",1,{self:null},["self"],arguments,{},null,null).self,r="",n=0,s=t.source.length;n<s;n++){var a=t.source[n].toString(16);a.length<2&&(a="0"+a),r+=a}return r},f.index=function(){var r=e.args("rfind",4,{self:null,sub:null,start:null,end:null},["self","sub","start","end"],arguments,{start:0,end:-1},null,null),n=f.find(r.self,r.sub,r.start,r.end);if(-1==n)throw t.ValueError.$factory("subsection not found");return n},f.isalnum=function(e){for(var t=e.source,r=t.length,n=r>0,s=0;s<r&&n;++s)n=t[s]>96&&t[s]<123||t[s]>64&&t[s]<91||t[s]>47&&t[s]<58;return n},f.isalpha=function(e){for(var t=e.source,r=t.length,n=r>0,s=0;s<r&&n;++s)n=t[s]>96&&t[s]<123||t[s]>64&&t[s]<91;return n},f.isdigit=function(e){var t=e.source,r=t.length,n=r>0;for(let e=0;e<r&&n;++e)n=t[e]>47&&t[e]<58;return n},f.islower=function(e){var t=e.source,r=t.length,n=!1;for(let e=0;e<r;++e)if(n=n||t[e]>96&&t[e]<123,t[e]>64&&t[e]<91)return!1;return n},f.isspace=function(e){var t=e.source,r=t.length;for(let e=0;e<r;++e)switch(t[e]){case 9:case 10:case 11:case 12:case 13:case 32:break;default:return!1}return!0},f.isupper=function(e){var t=e.source,r=t.length,n=!1;for(let e=0;e<r;++e)if(n=n||t[e]>64&&t[e]<91,t[e]>96&&t[e]<123)return!1;return n},f.istitle=function(e){for(var t=e.source,r=t.length,n=!1,s=!1,a=!1,i=!1,o=0;o<r;++o){if(i=t[o]>96&&t[o]<123,a=t[o]>64&&t[o]<91,(n=i||a)&&s&&a||!s&&i)return!1;s=n}return!0},f.join=function(){for(var r=e.args("join",2,{self:null,iterable:null},["self","iterable"],arguments,{}),s=r.self,a=r.iterable,i=t.getattr(t.iter(a),"__next__"),o=s.__class__.$factory(),_=!0;;)try{var l=i();_?_=!1:o=f.__add__(o,s),o=f.__add__(o,l)}catch(e){if(n(e,t.StopIteration))break;throw e}return o};f.lower=function(e){for(var t,r=[],n=0,s=0,a=e.source.length;s<a;s++)e.source[s]&&(r[n++]=(t=e.source[s])>=65&&t<=90?t+32:t);return f.$factory(r)},f.ljust=function(){var r=e.args("ljust",3,{self:null,width:null,fillbyte:null},["self","width","fillbyte"],arguments,{fillbyte:f.$factory([32])},null,null);if(!r.fillbyte.__class__)throw t.TypeError.$factory("argument 2 must be a byte string of length 1, not '"+e.class_name(r.fillbyte)+"'");if(!r.fillbyte.__class__.$buffer_protocol)throw t.TypeError.$factory("argument 2 must be a byte string of length 1, not '"+e.class_name(r.fillbyte)+"'");for(var n=[],s=r.width-r.self.source.length,a=0;a<s;++a)n.push(r.fillbyte.source[0]);return f.$factory(r.self.source.concat(n))},f.lstrip=function(e,t){return _(e,t,"l")},f.maketrans=function(t,r){for(var n=[],s=(r=e.to_bytes(r),0);s<256;s++)n[s]=s;s=0;for(var a=t.source.length;s<a;s++){n[t.source[s]]=r[s]}return f.$factory(n)},f.partition=function(){var r=e.args("partition",2,{self:null,sep:null},["self","sep"],arguments,{},null,null);if(!r.sep.__class__)throw t.TypeError.$factory("a bytes-like object is required, not '"+e.class_name(r.sep)+"'");if(!r.sep.__class__.$buffer_protocol)throw t.TypeError.$factory("a bytes-like object is required, not '"+e.class_name(r.sep)+"'");var n=r.sep.source.length,s=r.self.source,a=f.find(r.self,r.sep);return t.tuple.$factory([f.$factory(s.slice(0,a)),f.$factory(s.slice(a,a+n)),f.$factory(s.slice(a+n))])},f.replace=function(){var r=e.args("replace",4,{self:null,old:null,new:null,count:null},["self","old","new","count"],arguments,{count:-1},null,null),n=[],s=r.self,a=s.source,i=a.length,o=r.old,_=r.new,l=r.count>=0?r.count:a.length;if(!r.old.__class__)throw t.TypeError.$factory("first argument must be a bytes-like object, not '"+e.class_name(r.old)+"'");if(!r.old.__class__.$buffer_protocol)throw t.TypeError.$factory("first argument must be a bytes-like object, not '"+e.class_name(r.sep)+"'");if(!r.new.__class__)throw t.TypeError.$factory("second argument must be a bytes-like object, not '"+e.class_name(r.old)+"'");if(!r.new.__class__.$buffer_protocol)throw t.TypeError.$factory("second argument must be a bytes-like object, not '"+e.class_name(r.sep)+"'");for(var c=0;c<i;c++)if(f.startswith(s,o,c)&&l){for(var u=0;u<_.source.length;u++)n.push(_.source[u]);c+=o.source.length-1,l--}else n.push(a[c]);return f.$factory(n)},f.rfind=function(r,n){if(2==arguments.length&&n.__class__===f)var s=n,a=0,i=-1;else{var o=e.args("rfind",4,{self:null,sub:null,start:null,end:null},["self","sub","start","end"],arguments,{start:0,end:-1},null,null);r=o.self,s=o.sub,a=o.start,i=o.end}if("number"==typeof s){if(s<0||s>255)throw t.ValueError.$factory("byte must be in range(0, 256)");return o.self.source.slice(a,-1==o.end?void 0:o.end).lastIndexOf(s)+a}if(!s.__class__)throw t.TypeError.$factory("first argument must be a bytes-like object, not '"+e.class_name(o.sub)+"'");if(!s.__class__.$buffer_protocol)throw t.TypeError.$factory("first argument must be a bytes-like object, not '"+e.class_name(s)+"'");i=-1==i?r.source.length:Math.min(r.source.length,i);for(var _=s.source.length,l=i-_;l>=a;--l){for(var c=r.source.slice(l,l+_),u=!0,p=0;p<_;p++)if(c[p]!=s.source[p]){u=!1;break}if(u)return l}return-1},f.rindex=function(){var r=e.args("rfind",4,{self:null,sub:null,start:null,end:null},["self","sub","start","end"],arguments,{start:0,end:-1},null,null),n=f.rfind(r.self,r.sub,r.start,r.end);if(-1==n)throw t.ValueError.$factory("subsection not found");return n},f.rjust=function(){var r=e.args("rjust",3,{self:null,width:null,fillbyte:null},["self","width","fillbyte"],arguments,{fillbyte:f.$factory([32])},null,null);if(!r.fillbyte.__class__)throw t.TypeError.$factory("argument 2 must be a byte string of length 1, not '"+e.class_name(r.fillbyte)+"'");if(!r.fillbyte.__class__.$buffer_protocol)throw t.TypeError.$factory("argument 2 must be a byte string of length 1, not '"+e.class_name(r.fillbyte)+"'");for(var n=[],s=r.width-r.self.source.length,a=0;a<s;++a)n.push(r.fillbyte.source[0]);return f.$factory(n.concat(r.self.source))},f.rpartition=function(){var r=e.args("rpartition",2,{self:null,sep:null},["self","sep"],arguments,{},null,null);if(!r.sep.__class__)throw t.TypeError.$factory("a bytes-like object is required, not '"+e.class_name(r.sep)+"'");if(!r.sep.__class__.$buffer_protocol)throw t.TypeError.$factory("a bytes-like object is required, not '"+e.class_name(r.sep)+"'");var n=r.sep.source.length,s=r.self.source,a=f.rfind(r.self,r.sep);return t.tuple.$factory([f.$factory(s.slice(0,a)),f.$factory(s.slice(a,a+n)),f.$factory(s.slice(a+n))])},f.rstrip=function(e,t){return _(e,t,"r")},f.split=function(){var r=e.args("split",2,{self:null,sep:null},["self","sep"],arguments,{},null,null),n=[],s=0,a=0;if(!r.sep.__class__)throw t.TypeError.$factory("a bytes-like object is required, not '"+e.class_name(r.sep)+"'");if(!r.sep.__class__.$buffer_protocol)throw t.TypeError.$factory("a bytes-like object is required, not '"+e.class_name(r.sep)+"'");for(var i=r.sep.source,o=i.length,_=r.self.source,l=_.length;a<l;){for(var c=!0,u=0;u<o&&c;u++)_[a+u]!=i[u]&&(c=!1);c?(n.push(f.$factory(_.slice(s,a))),a=s=a+o):a++}return(c||a>s)&&n.push(f.$factory(_.slice(s,a))),n},f.splitlines=function(r){var n=e.args("splitlines",2,{self:null,keepends:null},["self","keepends"],arguments,{keepends:!1},null,null);if(!t.isinstance(n.keepends,[t.bool,t.int]))throw t.TypeError("integer argument expected, got "+e.get_class(n.keepends).__name);var s=t.int.$factory(n.keepends),a=[],i=n.self.source,o=0,_=0;if(!i.length)return a;for(;_<i.length;)_<i.length-1&&13==i[_]&&10==i[_+1]?(a.push(f.$factory(i.slice(o,s?_+2:_))),o=_+=2):13==i[_]||10==i[_]?(a.push(f.$factory(i.slice(o,s?_+1:_))),o=_+=1):_++;return o<i.length&&a.push(f.$factory(i.slice(o))),a},f.startswith=function(){var r=e.args("startswith",3,{self:null,prefix:null,start:null},["self","prefix","start"],arguments,{start:0},null,null),n=r.start;if(t.isinstance(r.prefix,f)){for(var s=!0,a=0;a<r.prefix.source.length&&s;a++)s=r.self.source[n+a]==r.prefix.source[a];return s}if(t.isinstance(r.prefix,t.tuple)){var i=[];for(a=0;a<r.prefix.length;a++){if(!t.isinstance(r.prefix[a],f))throw t.TypeError.$factory("startswith first arg must be bytes or a tuple of bytes, not "+e.class_name(r.prefix));i=i.concat(r.prefix[a].source)}var o=f.$factory(i);return f.startswith(r.self,o,n)}throw t.TypeError.$factory("startswith first arg must be bytes or a tuple of bytes, not "+e.class_name(r.prefix))},f.strip=function(e,t){var r=f.lstrip(e,t);return f.rstrip(r,t)},f.swapcase=function(e){for(var t=e.source,r=t.length,n=t.slice(),s=0;s<r;++s)n[s]>96&&n[s]<123?n[s]-=32:n[s]>64&&n[s]<91&&(n[s]+=32);return f.$factory(n)},f.title=function(e){var t=e.source,r=t.length;buffer=t.slice(),current_char_is_letter=!1,prev_char_was_letter=!1,is_uppercase=!1,is_lowercase=!1;for(var n=0;n<r;++n)is_lowercase=buffer[n]>96&&buffer[n]<123,is_uppercase=buffer[n]>64&&buffer[n]<91,current_char_is_letter=is_lowercase||is_uppercase,current_char_is_letter&&(prev_char_was_letter&&is_uppercase?buffer[n]+=32:!prev_char_was_letter&&is_lowercase&&(buffer[n]-=32)),prev_char_was_letter=current_char_is_letter;return f.$factory(buffer)},f.translate=function(r,s,a){if(void 0===a)a=[];else{if(!n(a,f))throw t.TypeError.$factory("Type "+e.get_class(a).__name+" doesn't support the buffer API");a=a.source}var i=[],o=0;if(n(s,f)&&256==s.source.length)for(var _=0,l=r.source.length;_<l;_++)a.indexOf(r.source[_])>-1||(i[o++]=s.source[r.source[_]]);return f.$factory(i)};function d(e,r,n){throw t.UnicodeEncodeError.$factory("'"+e+"' codec can't encode character "+t.hex(r)+" in position "+n)}function h(e){var t=e.toLowerCase();return"windows"==t.substr(0,7)&&(t="cp"+t.substr(7)),(t.startsWith("cp")||t.startsWith("iso"))&&(t=t.replace("-","")),t=t.replace(/-/g,"_")}f.upper=function(e){for(var t,r=[],n=0,s=0,a=e.source.length;s<a;s++)e.source[s]&&(r[n++]=(t=e.source[s])>=97&&t<=122?t-32:t);return f.$factory(r)},f.zfill=function(e,t){for(var r=e.source.slice(),n=43==r[0]||45==r[0]?1:0,s=t-e.source.length,a=[],i=0;i<s;++i)a.push(48);return r.splice.apply(r,[n,0].concat(a)),f.$factory(r)};var $=e.decode=function(r,n,s){var a="",i=r.source,_=h(n),l=!1;switch(_){case"utf_8":case"utf-8":case"utf8":case"U8":case"UTF":var u,p=0;for(a="";p<i.length;){var d=i[p];if(u=null,128&d)if(d>>5==6)if(void 0===i[p+1]?u=[d,p,"end"]:128!=(192&i[p+1])&&(u=[d,p,"continuation"]),null!==u){if("ignore"!=s)throw t.UnicodeDecodeError.$factory("'utf-8' codec can't decode byte 0x"+u[0].toString(16)+" in position "+u[1]+("end"==u[2]?": unexpected end of data":": invalid continuation byte"));p++}else{var m=31&d;m<<=6,m+=63&i[p+1],a+=String.fromCodePoint(m),p+=2}else if(d>>4==14)if(void 0===i[p+1]?u=[d,p,"end",p+1]:128!=(192&i[p+1])?u=[d,p,"continuation",p+2]:void 0===i[p+2]?u=[d,p+"-"+(p+1),"end",p+2]:128!=(192&i[p+2])&&(u=[d,p,"continuation",p+3]),null!==u)if("ignore"==s)p=u[3];else{if("surrogateescape"!=s)throw t.UnicodeDecodeError.$factory("'utf-8' codec can't decode byte 0x"+u[0].toString(16)+" in position "+u[1]+("end"==u[2]?": unexpected end of data":": invalid continuation byte"));for(var b=p;b<u[3];b++)a+=String.fromCodePoint(56448+i[b]-128);p=u[3]}else{m=15&d;m<<=12,m+=(63&i[p+1])<<6,m+=63&i[p+2],a+=String.fromCodePoint(m),p+=3}else if(d>>3==30)if(l=!0,void 0===i[p+1]?u=[d,p,"end",p+1]:128!=(192&i[p+1])?u=[d,p,"continuation",p+2]:void 0===i[p+2]?u=[d,p+"-"+(p+1),"end",p+2]:128!=(192&i[p+2])?u=[d,p,"continuation",p+3]:void 0===i[p+3]?u=[d,p+"-"+(p+1)+"-"+(p+2),"end",p+3]:128!=(192&i[p+2])&&(u=[d,p,"continuation",p+3]),null!==u)if("ignore"==s)p=u[3];else{if("surrogateescape"!=s)throw t.UnicodeDecodeError.$factory("'utf-8' codec can't decode byte 0x"+u[0].toString(16)+" in position "+u[1]+("end"==u[2]?": unexpected end of data":": invalid continuation byte"));for(b=p;b<u[3];b++)a+=String.fromCodePoint(56448+i[b]-128);p=u[3]}else{m=15&d;m<<=18,m+=(63&i[p+1])<<12,m+=(63&i[p+2])<<6,m+=63&i[p+3],a+=String.fromCodePoint(m),p+=4}else if("ignore"==s)p++;else{if("surrogateescape"!=s)throw t.UnicodeDecodeError.$factory("'utf-8' codec can't decode byte 0x"+d.toString(16)+" in position "+p+": invalid start byte");a+=String.fromCodePoint(56448+i[p]-128),p++}else a+=String.fromCodePoint(d),p++}return l?t.str.$surrogate.$factory(a):a;case"latin_1":case"windows1252":case"iso-8859-1":case"iso8859-1":case"8859":case"cp819":case"latin":case"latin1":case"L1":i.forEach(function(e){a+=String.fromCharCode(e)});break;case"unicode_escape":return r.__class__!==f&&r.__class__!==c||(r=$(r,"latin-1","strict")),r.replace(/\\n/g,"\n").replace(/\\a/g,"").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\t/g,"\t").replace(/\\'/g,"'").replace(/\\"/g,'"');case"raw_unicode_escape":return r.__class__!==f&&r.__class__!==c||(r=$(r,"latin-1","strict")),r.replace(/\\u([a-fA-F0-9]{4})/g,function(e){var t=parseInt(e.substr(2),16);return String.fromCharCode(t)});case"ascii":b=0;for(var g=i.length;b<g;b++){if((m=i[b])<=127)a+=String.fromCharCode(m);else if("ignore"!=s){var y="'ascii' codec can't decode byte 0x"+m.toString(16)+" in position "+b+": ordinal not in range(128)";throw t.UnicodeDecodeError.$factory(y)}}break;default:try{!function(r){if(void 0===o[r]){var n=t.__import__("encodings."+r);n[r].getregentry&&(o[r]=e.$getattr(n[r].getregentry(),"decode"))}}(_)}catch(e){throw console.log(i,n,"error load_decoder",e),t.LookupError.$factory("unknown encoding: "+_)}return o[_](r)[0]}return a},m=e.encode=function(){var r=e.args("encode",3,{s:null,encoding:null,errors:null},["s","encoding","errors"],arguments,{encoding:"utf-8",errors:"strict"},null,null),n=r.s,s=r.encoding,a=r.errors,o=[],_=0,l=h(s);switch(l){case"utf-8":case"utf_8":case"utf8":for(var c=[],u=0,f=n.length;u<f;u++){(p=n.charCodeAt(u))<127?c.push(p):p<2047?c.push(192+(p>>6),128+(63&p)):p<65535?c.push(224+(p>>12),128+((4095&p)>>6),128+(63&p)):console.log("4 bytes")}return c;case"latin":case"latin1":case"latin-1":case"latin_1":case"L1":case"iso8859_1":case"iso_8859_1":case"8859":case"cp819":case"windows1252":for(u=0,f=n.length;u<f;u++){(p=n.charCodeAt(u))<=255?o[_++]=p:"ignore"!=a&&d(s,u)}break;case"ascii":for(u=0,f=n.length;u<f;u++){(p=n.charCodeAt(u))<=127?o[_++]=p:"ignore"!=a&&d(s,u)}break;case"raw_unicode_escape":for(u=0,f=n.length;u<f;u++){var p;if((p=n.charCodeAt(u))<256)o[_++]=p;else{var $=p.toString(16);$.length%2&&($="0"+$),$="\\u"+$;for(var m=0;m<$.length;m++)o[_++]=$.charCodeAt(m)}}break;default:try{!function(r){if(void 0===i[r]){var n=t.__import__("encodings."+r);n[r].getregentry&&(i[r]=e.$getattr(n[r].getregentry(),"encode"))}}(l)}catch(e){throw t.LookupError.$factory("unknown encoding: "+s)}o=i[l](n)[0].source}return o};for(var b in f.$factory=function(t,r,n){var s=e.args("bytes",3,{source:null,encoding:null,errors:null},["source","encoding","errors"],arguments,{source:[],encoding:"utf-8",errors:"strict"},null,null);return f.$new(f,s.source,s.encoding,s.errors)},f.__class__=t.type,f.$is_class=!0,f)void 0===c[b]&&"function"==typeof f[b]&&(c[b]=function(e){return function(){return f[e].apply(null,arguments)}}(b));e.set_func_names(f,"builtins"),f.fromhex=t.classmethod.$factory(f.fromhex),e.set_func_names(c,"builtins"),c.fromhex=t.classmethod.$factory(c.fromhex),t.bytes=f,t.bytearray=c}(__BRYTHON__),function($B){var _b_=$B.builtins,object=_b_.object,$N=_b_.None;function create_type(e){return $B.get_class(e).$factory()}function clone(e){var t=create_type(e);for(key in t.$items=e.$items.slice(),e.$hashes)t.$hashes[key]=e.$hashes[key];return t}var set={__class__:_b_.type,$infos:{__module__:"builtins",__name__:"set"},$is_class:!0,$native:!0,__add__:function(e,t){throw _b_.TypeError.$factory("unsupported operand type(s) for +: 'set' and "+typeof t)},__and__:function(e,t,r){try{$test(r,t)}catch(e){return _b_.NotImplemented}for(var n=create_type(e),s=0,a=e.$items.length;s<a;s++)_b_.getattr(t,"__contains__")(e.$items[s])&&set.add(n,e.$items[s]);return n},__contains__:function(e,t){if(e.$simple){if("number"==typeof t||t instanceof Number){if(isNaN(t)){for(var r=e.$items.length-1;r>=0;r--)if(isNaN(e.$items[r]))return!0;return!1}return t instanceof Number?e.$numbers.indexOf(t.valueOf())>-1:e.$items.indexOf(t)>-1}if("string"==typeof t)return e.$items.indexOf(t)>-1}_b_.isinstance(t,set)||$B.$getattr(t,"__hash__");var n=_b_.hash(t);if(e.$hashes[n]){r=0;for(var s=e.$hashes[n].length;r<s;r++)if($B.rich_comp("__eq__",e.$hashes[n][r],t))return!0}return!1},__eq__:function(e,t){if(void 0===t)return e===set;if(_b_.isinstance(t,[_b_.set,_b_.frozenset])){if(t.$items.length==e.$items.length){for(var r=0,n=e.$items.length;r<n;r++)if(!1===set.__contains__(e,t.$items[r]))return!1;return!0}return!1}return _b_.NotImplemented},__format__:function(e,t){return set.__str__(e)},__ge__:function(e,t){return _b_.isinstance(t,[set,frozenset])?set.__le__(t,e):_b_.NotImplemented},__gt__:function(e,t){return _b_.isinstance(t,[set,frozenset])?set.__lt__(t,e):_b_.NotImplemented}};set.__hash__=_b_.None,set.__init__=function(e,t,r){if(void 0===r&&Array.isArray(t)){for(var n=0,s=t.length;n<s;n++)$add(e,t[n]);return $N}var a=$B.args("__init__",2,{self:null,iterable:null},["self","iterable"],arguments,{iterable:[]},null,null);e=a.self,t=a.iterable;if(_b_.isinstance(t,[set,frozenset])){for(var i in e.$items=t.$items.slice(),e.$hashes={},t.$hashes)e.$hashes[i]=t.$hashes[i];return $N}for(var o=$B.$iter(t);;)try{$add(e,_b_.next(o))}catch(e){if(_b_.isinstance(e,_b_.StopIteration))break;throw e}return $N};var set_iterator=$B.make_iterator_class("set iterator");function $test(e,t,r){if(void 0===e&&!_b_.isinstance(t,[set,frozenset]))throw _b_.TypeError.$factory("unsupported operand type(s) for "+r+": 'set' and '"+$B.class_name(t)+"'")}function $add(e,t){var r,n=!1;if(("string"==typeof t||"number"==typeof t||t instanceof Number)&&(n=!0),n){var s=e.$items.indexOf(t);if(-1==s)if(t instanceof Number&&e.$numbers.indexOf(t.valueOf())>-1);else if("number"==typeof t&&e.$numbers.indexOf(t)>-1);else{e.$items.push(t);var a=t.valueOf();"number"==typeof a&&e.$numbers.push(a)}else t!==e.$items[s]&&e.$items.push(t)}else{if(_b_.hash(t),void 0===(i=e.$hashes[t.__hashvalue__]))e.$hashes[t.__hashvalue__]=[t],e.$items.push(t);else{for(var i,o=0,_=(i=e.$hashes[t.__hashvalue__]).length;o<_;o++)if(r=i[o],$B.rich_comp("__eq__",t,r))return $N;e.$hashes[t.__hashvalue__].push(t),e.$items.push(t)}}return $N}set.__iter__=function(e){return e.$items.sort(),set_iterator.$factory(e.$items)},set.__le__=function(e,t){if(_b_.isinstance(t,[set,frozenset])){for(var r=_b_.getattr(t,"__contains__"),n=0,s=e.$items.length;n<s;n++)if(!r(e.$items[n]))return!1;return!0}return _b_.NotImplemented},set.__len__=function(e){return e.$items.length},set.__lt__=function(e,t){return _b_.isinstance(t,[set,frozenset])?set.__le__(e,t)&&set.__len__(e)<_b_.getattr(t,"__len__")():_b_.NotImplemented},set.__mro__=[_b_.object],set.__new__=function(e){if(void 0===e)throw _b_.TypeError.$factory("set.__new__(): not enough arguments");return{__class__:e,$simple:!0,$items:[],$numbers:[],$hashes:{}}},set.__or__=function(e,t,r){for(var n=clone(e),s=_b_.getattr($B.$iter(t),"__next__");;)try{set.add(n,s())}catch(e){if(_b_.isinstance(e,_b_.StopIteration))break;throw e}return n.__class__=e.__class__,n},set.__rand__=function(e,t){return set.__and__(e,t)},set.__reduce__=function(e){return _b_.tuple.$factory([e.__class__,_b_.tuple.$factory([e.$items]),$N])},set.__reduce_ex__=function(e,t){return set.__reduce__(e)},set.__rsub__=function(e,t){return set.__sub__(e,t)},set.__rxor__=function(e,t){return set.__xor__(e,t)},set.__str__=set.__repr__=function(e){var t=$B.class_name(e);if(e.$cycle=void 0===e.$cycle?0:e.$cycle+1,0===e.$items.length)return t+"()";var r=t+"({",n="})";"set({"==r&&(r="{",n="}");var s=[];if(e.$cycle)return e.$cycle--,t+"(...)";e.$items.sort();for(var a=0,i=e.$items.length;a<i;a++){var o=_b_.repr(e.$items[a]);o===e||o===e.$items[a]?s.push("{...}"):s.push(o)}return s=s.join(", "),e.$cycle--,r+s+n},set.__sub__=function(e,t,r){try{$test(r,t,"-")}catch(e){return _b_.NotImplemented}for(var n=create_type(e),s=_b_.getattr(t,"__contains__"),a=0,i=e.$items.length;a<i;a++)s(e.$items[a])||n.$items.push(e.$items[a]);return n},set.__xor__=function(e,t,r){try{$test(r,t,"^")}catch(e){return _b_.NotImplemented}for(var n=create_type(e),s=_b_.getattr(t,"__contains__"),a=0,i=e.$items.length;a<i;a++)s(e.$items[a])||set.add(n,e.$items[a]);for(a=0,i=t.$items.length;a<i;a++)set.__contains__(e,t.$items[a])||set.add(n,t.$items[a]);return n},$B.make_rmethods(set),set.add=function(){var e=$B.args("add",2,{self:null,item:null},["self","item"],arguments,{},null,null);return $add(e.self,e.item)},set.clear=function(){var e=$B.args("clear",1,{self:null},["self"],arguments,{},null,null);return e.self.$items=[],e.self.$hashes={},$N},set.copy=function(){var e=$B.args("copy",1,{self:null},["self"],arguments,{},null,null);if(_b_.isinstance(e.self,frozenset))return e.self;var t=set.$factory();for(key in e.self.$items.forEach(function(e){t.$items.push(e)}),e.self.$numbers.forEach(function(e){t.$numbers.push(e)}),self.$hashes)t.$hashes[key]=self.$hashes[key];return t},set.difference_update=function(e){for(var t=$B.args("difference_update",1,{self:null},["self"],arguments,{},"args",null),r=0;r<t.args.length;r++)for(var n,s=set.$factory(t.args[r]),a=_b_.getattr($B.$iter(s),"__next__");;)try{var i=typeof(n=a());if("string"==i||"number"==i){var o=e.$items.indexOf(n);o>-1&&e.$items.splice(o,1)}else for(var _=0;_<e.$items.length;_++)if($B.rich_comp("__eq__",e.$items[_],n)){e.$items.splice(_,1);var l=_b_.hash(n);if(e.$hashes[l])for(var c=0;c<e.$hashes[l].length;c++)if($B.rich_comp("__eq__",e.$hashes[l][c],n)){e.$hashes[l].splice(c,1);break}}}catch(e){if(_b_.isinstance(e,_b_.StopIteration))break;throw e}return $N},set.discard=function(){var e=$B.args("discard",2,{self:null,item:null},["self","item"],arguments,{},null,null);try{set.remove(e.self,e.item)}catch(e){if(!_b_.isinstance(e,[_b_.KeyError,_b_.LookupError]))throw e}return $N},set.intersection_update=function(){for(var e=$B.args("intersection_update",1,{self:null},["self"],arguments,{},"args",null),t=e.self,r=0;r<e.args.length;r++){for(var n=[],s=set.$factory(e.args[r]),a=0;a<t.$items.length;a++){var i=t.$items[a],o=typeof i;if("string"==o||"number"==o)-1==s.$items.indexOf(i)&&n.push(a);else{var _=!1,l=_b_.hash(i);if(s.$hashes[l]){for(var c=s.$hashes[l],u=0;!_&&u<c.length;u++)$B.rich_comp("__eq__",c[u],i)&&(_=!0);if(!_){n.push(a),c=t.$hashes[l];for(u=0;!_&&u<c.length;u++)$B.rich_comp("__eq__",c[u],i)&&t.$hashes.splice(u,1)}}}}n.sort(function(e,t){return e-t}).reverse();for(a=0;a<n.length;a++)t.$items.splice(n[a],1)}return $N},set.isdisjoint=function(){for(var e=$B.args("is_disjoint",2,{self:null,other:null},["self","other"],arguments,{},null,null),t=0,r=e.self.$items.length;t<r;t++)if(_b_.getattr(e.other,"__contains__")(e.self.$items[t]))return!1;return!0},set.pop=function(e){if(0===e.$items.length)throw _b_.KeyError.$factory("pop from an empty set");var t=e.$items.pop();if("string"!=typeof t&&"number"!=typeof t)for(var r=_b_.hash(t),n=e.$hashes[r],s=0;s<n.length;s++)if($B.rich_comp("__eq__",n[s],t)){e.$hashes[r].splice(s,1);break}return t},set.remove=function(e,t){var r=$B.args("remove",2,{self:null,item:null},["self","item"],arguments,{},null,null);e=r.self,t=r.item;if(_b_.isinstance(t,set)||_b_.hash(t),"string"==typeof t||"number"==typeof t){var n=e.$items.indexOf(t);if(-1==n)throw _b_.KeyError.$factory(t);return e.$items.splice(n,1),"number"==typeof t&&e.$numbers.splice(e.$numbers.indexOf(t),1),$N}var s=_b_.hash(t);if(e.$hashes[s]){for(var a=0,i=e.$items.length;a<i;a++)if($B.rich_comp("__eq__",e.$items[a],t)){e.$items.splice(a,1),t instanceof Number&&e.$numbers.splice(e.$numbers.indexOf(t.valueOf()),1);break}for(a=0,i=e.$hashes[s].length;a<i;a++)if($B.rich_comp("__eq__",e.$hashes[s][a],t)){e.$hashes[s].splice(a,1);break}return $N}throw _b_.KeyError.$factory(t)},set.symmetric_difference_update=function(e,t){for(var r,n=$B.args("symmetric_difference_update",2,{self:null,s:null},["self","s"],arguments,{},null,null),s=(e=n.self,t=n.s,_b_.getattr($B.$iter(t),"__next__")),a=[],i=[];;)try{var o=typeof(r=s());if("string"==o||"number"==o){var _=e.$items.indexOf(r);_>-1?a.push(_):i.push(r)}else{for(var l=!1,c=0;!l&&c<e.$items.length;c++)$B.rich_comp("__eq__",e.$items[c],r)&&(a.push(c),l=!0);l||i.push(r)}}catch(e){if(_b_.isinstance(e,_b_.StopIteration))break;throw e}a.sort(function(e,t){return e-t}).reverse();for(var u=0;u<a.length;u++)a[u]!=a[u-1]&&e.$items.splice(a[u],1);for(u=0;u<i.length;u++)set.add(e,i[u]);return $N},set.update=function(e){for(var t=$B.args("update",1,{self:null},["self"],arguments,{},"args",null),r=0;r<t.args.length;r++)for(var n=set.$factory(t.args[r]),s=0,a=n.$items.length;s<a;s++)$add(e,n.$items[s]);return $N},set.difference=function(){var e=$B.args("difference",1,{self:null},["self"],arguments,{},"args",null);if(0==e.args.length)return set.copy(e.self);for(var t=clone(e.self),r=0;r<e.args.length;r++)t=set.__sub__(t,set.$factory(e.args[r]),!0);return t};var fc=set.difference+"";function $accept_only_set(e,t){return function(r,n,s){return $test(s,n,t),e(r,n),r}}eval("set.intersection = "+fc.replace(/difference/g,"intersection").replace("__sub__","__and__")),eval("set.symmetric_difference = "+fc.replace(/difference/g,"symmetric_difference").replace("__sub__","__xor__")),eval("set.union = "+fc.replace(/difference/g,"union").replace("__sub__","__or__")),set.issubset=function(){for(var e=$B.args("issubset",2,{self:null,other:null},["self","other"],arguments,{},"args",null),t=_b_.getattr(e.other,"__contains__"),r=0,n=e.self.$items.length;r<n;r++)if(!t(e.self.$items[r]))return!1;return!0},set.issuperset=function(){for(var e=$B.args("issuperset",2,{self:null,other:null},["self","other"],arguments,{},"args",null),t=_b_.getattr(e.self,"__contains__"),r=$B.$iter(e.other);;)try{if(!t(_b_.next(r)))return!1}catch(e){if(_b_.isinstance(e,_b_.StopIteration))return!0;throw e}return!0},set.__iand__=$accept_only_set(set.intersection_update,"&="),set.__isub__=$accept_only_set(set.difference_update,"-="),set.__ixor__=$accept_only_set(set.symmetric_difference_update,"^="),set.__ior__=$accept_only_set(set.update,"|="),set.$factory=function(){var e={__class__:set,$simple:!0,$items:[],$numbers:[],$hashes:{}},t=[e].concat(Array.prototype.slice.call(arguments));return set.__init__.apply(null,t),e},$B.set_func_names(set,"builtins");var frozenset={__class__:_b_.type,__mro__:[object],$infos:{__module__:"builtins",__name__:"frozenset"},$is_class:!0,$native:!0};for(var attr in set)switch(attr){case"add":case"clear":case"discard":case"pop":case"remove":case"update":break;default:null==frozenset[attr]&&("function"==typeof set[attr]?frozenset[attr]=function(e){return function(){return set[e].apply(null,arguments)}}(attr):frozenset[attr]=set[attr])}frozenset.__hash__=function(e){if(void 0===e)return frozenset.__hashvalue__||$B.$py_next_hash--;if(void 0!==e.__hashvalue__)return e.__hashvalue__;var t=1927868237;t*=e.$items.length;for(var r=0,n=e.$items.length;r<n;r++){var s=_b_.hash(e.$items[r]);t^=3644798167*(89869747^s^s<<16)}return-1==(t=69069*t+907133923)&&(t=590923713),e.__hashvalue__=t},frozenset.__init__=function(){return $N},frozenset.__new__=function(e){if(void 0===e)throw _b_.TypeError.$factory("frozenset.__new__(): not enough arguments");return{__class__:e,$simple:!0,$items:[],$numbers:[],$hashes:{}}};var singleton_id=Math.floor(Math.random()*Math.pow(2,40));function empty_frozenset(){return{__class__:frozenset,$items:[],$numbers:[],$id:singleton_id}}frozenset.$factory=function(){var e=$B.args("frozenset",1,{iterable:null},["iterable"],arguments,{iterable:null},null,null);if(null===e.iterable)return empty_frozenset();if(e.iterable.__class__==frozenset)return e.iterable;var t=set.$factory(e.iterable);return 0==t.$items.length?empty_frozenset():(t.__class__=frozenset,t)},$B.set_func_names(frozenset,"builtins"),_b_.set=set,_b_.frozenset=frozenset}(__BRYTHON__),function($B){var bltns=$B.InjectBuiltins();eval(bltns);var object=_b_.object,_window=self;$B.pyobj2structuredclone=function(e){if("boolean"==typeof e||"number"==typeof e||"string"==typeof e)return e;if(e instanceof Number)return e.valueOf();if(Array.isArray(e)||e.__class__===_b_.list||e.__class__===_b_.tuple){for(var t=[],r=0,n=e.length;r<n;r++)t.push($B.pyobj2structuredclone(e[r]));return t}if(e.__class__===_b_.dict){if(Object.keys(e.$numeric_dict).length>0||Object.keys(e.$object_dict).length>0)throw _b_.TypeError.$factory("a dictionary with non-string keys cannot be sent to or from a Web Worker");t={};for(var s in e.$string_dict)t[s]=$B.pyobj2structuredclone(e.$string_dict[s][0]);return t}return console.log(e,e.__class__),e},$B.structuredclone2pyobj=function(e){if(null===e)return _b_.None;if(void 0===e)return $B.Undefined;if("boolean"==typeof e||"number"==typeof e||"string"==typeof e)return e;if(e instanceof Number)return e.valueOf();if(Array.isArray(e)||e.__class__===_b_.list||e.__class__===_b_.tuple){for(var t=_b_.list.$factory(),r=0,n=e.length;r<n;r++)t.push($B.structuredclone2pyobj(e[r]));return t}if("object"==typeof e){t=_b_.dict.$factory();for(var s in e)_b_.dict.$setitem(t,s,$B.structuredclone2pyobj(e[s]));return t}throw console.log(e,Array.isArray(e),e.__class__,_b_.list,e.__class__===_b_.list),_b_.TypeError.$factory(_b_.str.$factory(e)+" does not support the structured clone algorithm")};var JSConstructor={__class__:_b_.type,__mro__:[object],$infos:{__module__:"<javascript>",__name__:"JSConstructor"},$is_class:!0,__call__:function(e){return function(){for(var t=[null],r=0,n=arguments.length;r<n;r++)t.push(pyobj2jsobj(arguments[r]));var s=new(e.func.bind.apply(e.func,t));return $B.$JS2Py(s)}},__getattribute__:function(e,t){return"__call__"==t?function(){for(var t=[null],r=0,n=arguments.length;r<n;r++)t.push(pyobj2jsobj(arguments[r]));var s=new(e.func.bind.apply(e.func,t));return $B.$JS2Py(s)}:JSObject.__getattribute__(e,t)},$factory:function(e){return{__class__:JSConstructor,js:e,func:e.js_func}}},jsobj2pyobj=$B.jsobj2pyobj=function(e){switch(e){case!0:case!1:return e}return void 0===e?$B.Undefined:null===e?_b_.None:Array.isArray(e)?_b_.list.$factory(e.map(jsobj2pyobj)):"number"==typeof e?-1==e.toString().indexOf(".")?_b_.int.$factory(e):_b_.float.$factory(e):"kw"===e.$nat?e:$B.$isNode(e)?$B.DOMNode.$factory(e):JSObject.$factory(e)},pyobj2jsobj=$B.pyobj2jsobj=function(e){if(!0===e||!1===e)return e;if(e===_b_.None)return null;if(e!==$B.Undefined){var t=$B.get_class(e);if(void 0===t)return e;if(t===JSObject||t===JSConstructor)return void 0!==e.js_func?e.js_func:e.js;if(t===$B.DOMNode||t.__mro__.indexOf($B.DOMNode)>-1)return e.elt;if([_b_.list,_b_.tuple].indexOf(t)>-1){var r=[];return e.forEach(function(e){r.push(pyobj2jsobj(e))}),r}if(t===_b_.dict||_b_.issubclass(t,_b_.dict)){var n={};return _b_.list.$factory(_b_.dict.items(e)).forEach(function(e){"function"==typeof e[1]&&e[1].bind(n),n[e[0]]=pyobj2jsobj(e[1])}),n}return t===_b_.float?e.valueOf():t===$B.Function||t===$B.method?function(){try{for(var t=[],r=0;r<arguments.length;r++)void 0===arguments[r]?t.push(_b_.None):t.push(jsobj2pyobj(arguments[r]));return pyobj2jsobj(e.apply(this,t))}catch(e){throw console.log(e),console.log(_b_.getattr(e,"info")),console.log($B.class_name(e)+":",e.args.length>0?e.args[0]:""),e}}:e}},JSObject={__class__:_b_.type,__mro__:[object],$infos:{__module__:"builtins",__name__:"JSObject"},__bool__:function(e){return new Boolean(e.js).valueOf()},__delattr__:function(e,t){return _b_.getattr(e,t),delete e.js[t],_b_.None},__dir__:function(e){return Object.keys(e.js)},__getattribute__:function(e,t){if("$$"==t.substr(0,2)&&(t=t.substr(2)),null===e.js)return object.__getattribute__(None,t);if("__class__"==t)return JSObject;if("__call__"==t){if("function"==typeof e.js)return function(){for(var t=[],r=0;r<arguments.length;r++)t.push($B.pyobj2jsobj(arguments[r]));var n=e.js.apply(null,t);return void 0===n?None:JSObject.$factory(n)};throw _b_.AttributeError.$factory("object is not callable")}if(e.__class__===JSObject&&"bind"==t&&void 0===e.js[t]&&void 0!==e.js.addEventListener&&(t="addEventListener"),"data"==t&&e.js instanceof MessageEvent)return $B.structuredclone2pyobj(e.js.data);var r,n=e.js[t];if(e.js_func&&void 0!==e.js_func[t]&&(n=e.js_func[t]),void 0!==n)return"function"==typeof n?((r=function(){for(var r=[],s=0,a=arguments.length;s<a;s++){var i=arguments[s];if(null!=i&&void 0!==i.$nat){var o=i.kw;if(Array.isArray(o)&&(o=$B.extend(n.name,...o)),Object.keys(o).length>0)throw _b_.TypeError.$factory("A Javascript function can't take keyword arguments")}else r.push(pyobj2jsobj(i))}if("replace"!==t||e.js!==location){var _=e.js;e.js_func&&(_=e.js_func),null!=this&&this!==_window&&(_=this);var l=n.apply(_,r);return jsobj2pyobj(l)}location.replace(r[0])}).__repr__=function(){return"<function "+t+">"},r.__str__=function(){return"<function "+t+">"},r.prototype=n.prototype,{__class__:JSObject,js:r,js_func:n}):$B.$JS2Py(n);if(e.js===_window&&"$$location"===t)return $Location();if(void 0===(r=e.__class__[t]))for(var s=e.__class__.__mro__,a=0,i=s.length;a<i;a++){var o=s[a][t];if(void 0!==o){r=o;break}}if(void 0!==r)return"function"==typeof r?function(){for(var t=[e],n=0,s=arguments.length;n<s;n++){var a=arguments[n];!a||a.__class__!==JSObject&&a.__class__!==JSConstructor?t.push(a):t.push(a.js)}return r.apply(e,t)}:$B.$JS2Py(r);throw _b_.AttributeError.$factory("no attribute "+t+" for "+e.js)},__getitem__:function(e,t){if("number"==typeof e.js.length){if(("number"==typeof t||"boolean"==typeof t)&&"function"==typeof e.js.item){var r=_b_.int.$factory(t);if(r<0&&(r+=e.js.length),null===(n=e.js.item(r)))throw _b_.IndexError.$factory(t);return JSObject.$factory(n)}if("string"==typeof t&&"function"==typeof e.js.getNamedItem){var n;if(void 0===(n=JSObject.$factory(e.js.getNamedItem(t))))throw _b_.KeyError.$factory(t);return n}}try{return $B.$call($B.$getattr(e.js,"__getitem__"))(t)}catch(r){if(void 0!==e.js[t])return JSObject.$factory(e.js[t]);throw _b_.KeyError.$factory(t)}}},JSObject_iterator=$B.make_iterator_class("JS object iterator");JSObject.__iter__=function(e){var t=[];if(_window.Symbol&&void 0!==e.js[Symbol.iterator]){t=[];if(void 0!==e.js.next)for(;;){var r=e.js.next();if(r.done)break;t.push(r.value)}else if(void 0!==e.js.length&&void 0!==e.js.item)for(var n=0;n<e.js.length;n++)t.push(e.js.item(n));return JSObject_iterator.$factory(t)}if(void 0!==e.js.length&&void 0!==e.js.item){for(n=0;n<e.js.length;n++)t.push(JSObject.$factory(e.js.item(n)));return JSObject_iterator.$factory(t)}var s=JSObject.to_dict(e);return _b_.dict.__iter__(s)},JSObject.__le__=function(e,t){return"function"==typeof e.js.appendChild?$B.DOMNode.__le__($B.DOMNode.$factory(e.js),t):_b_.NotImplemented},JSObject.__len__=function(e){if("number"==typeof e.js.length)return e.js.length;try{return getattr(e.js,"__len__")()}catch(t){throw _b_.AttributeError.$factory(e.js+" has no attribute __len__")}},JSObject.__repr__=function(e){if(e.js instanceof Date)return e.js.toString();var t=Object.getPrototypeOf(e.js);if(t){var r=t.constructor.name;if(void 0===r){var n=t.constructor.toString();r=n.substring(8,n.length-1)}return"<"+r+" object>"}return"<JSObject wraps "+e.js+">"},JSObject.__setattr__=function(e,t,r){t.substr&&"$$"==t.substr(0,2)&&(t=t.substr(2)),isinstance(r,JSObject)?e.js[t]=r.js:(e.js[t]=r,"function"==typeof r&&(e.js[t]=function(){for(var e=[],t=0,n=arguments.length;t<n;t++)e.push($B.$JS2Py(arguments[t]));try{return r.apply(null,e)}catch(e){e=$B.exception(e);var s=_b_.getattr(e,"info");throw e.args.length>0?e.toString=function(){return s+"\n"+$B.class_name(e)+": "+_b_.repr(e.args[0])}:e.toString=function(){return s+"\n"+$B.class_name(e)},console.log(e+""),e}}))},JSObject.__setitem__=JSObject.__setattr__,JSObject.__str__=JSObject.__repr__;var no_dict={string:!0,function:!0,number:!0,boolean:!0};JSObject.bind=function(e,t,r){return e.js.addEventListener(t,function(e){return r(jsobj2pyobj(e))}),_b_.None},JSObject.to_dict=function(e){return $B.structuredclone2pyobj(e.js)},JSObject.$factory=function(e){if(null===e)return _b_.None;if("function"==typeof e)return{__class__:JSObject,js:e,js_func:e};var t=$B.get_class(e);return t===_b_.float?_b_.float.$factory(e):t===_b_.list?$B.JSArray.$factory(e):void 0!==t?e:{__class__:JSObject,js:e}},$B.set_func_names(JSObject,"builtins"),$B.JSObject=JSObject,$B.JSConstructor=JSConstructor}(__BRYTHON__),function(e){e.stdlib={};for(var t=["VFS_import","__future__","_abcoll","_codecs","_collections","_collections_abc","_compat_pickle","_contextvars","_csv","_dummy_thread","_frozen_importlib","_frozen_importlib_external","_functools","_imp","_io","_markupbase","_operator","_py_abc","_pydecimal","_queue","_random","_socket","_sre","_struct","_sysconfigdata","_sysconfigdata_0_brython_","_testcapi","_thread","_threading_local","_weakref","_weakrefset","abc","antigravity","argparse","atexit","base64","bdb","binascii","bisect","browser.aio","browser.ajax","browser.highlight","browser.html","browser.indexed_db","browser.local_storage","browser.markdown","browser.object_storage","browser.session_storage","browser.svg","browser.template","browser.timer","browser.webcomponent","browser.websocket","browser.webworker","browser.worker","calendar","cmath","cmd","code","codecs","codeop","colorsys","configparser","contextlib","contextvars","copy","copyreg","csv","dataclasses","datetime","decimal","difflib","doctest","enum","errno","external_import","faulthandler","fnmatch","formatter","fractions","functools","gc","genericpath","getopt","gettext","glob","heapq","hmac","imp","inspect","interpreter","io","ipaddress","itertools","keyword","linecache","locale","mimetypes","nntplib","ntpath","numbers","opcode","operator","optparse","os","pathlib","pdb","pickle","pkgutil","platform","posixpath","pprint","profile","pwd","py_compile","pydoc","queue","quopri","re","reprlib","select","selectors","shlex","shutil","signal","site","site-packages.__future__","site-packages.docs","site-packages.header","site-packages.test","site-packages.test_sp","socket","sre_compile","sre_constants","sre_parse","stat","string","stringprep","struct","subprocess","sys","sysconfig","tarfile","tb","tempfile","test.namespace_pkgs.module_and_namespace_package.a_test","textwrap","this","threading","time","timeit","token","tokenize","traceback","turtle","types","typing","uu","uuid","warnings","weakref","webbrowser","zipfile","zipimport","zlib"],r=0;r<t.length;r++)e.stdlib[t[r]]=["py"];var n=["_aio","_ajax","_base64","_binascii","_io_classes","_jsre","_locale","_multiprocessing","_posixsubprocess","_profile","_sre_utils","_string","_strptime","_svg","_warnings","_webcomponent","_webworker","_zlib_utils","aes","array","builtins","dis","hashlib","hmac-md5","hmac-ripemd160","hmac-sha1","hmac-sha224","hmac-sha256","hmac-sha3","hmac-sha384","hmac-sha512","long_int","marshal","math","math1","math_kozh","md5","modulefinder","pbkdf2","posix","rabbit","rabbit-legacy","random","rc4","ripemd160","sha1","sha224","sha256","sha3","sha384","sha512","tripledes","unicodedata"];for(r=0;r<n.length;r++)e.stdlib[n[r]]=["js"];var s=["browser.widgets","collections","concurrent","concurrent.futures","email","email.mime","encodings","html","http","importlib","json","logging","multiprocessing","multiprocessing.dummy","pydoc_data","site-packages.simpleaio","site-packages.simpy","site-packages.simpy.resources","site-packages.ui","test","test.encoded_modules","test.leakers","test.namespace_pkgs.not_a_namespace_pkg.foo","test.support","test.test_email","test.test_importlib","test.test_importlib.builtin","test.test_importlib.extension","test.test_importlib.frozen","test.test_importlib.import_","test.test_importlib.source","test.test_json","test.tracedmodules","unittest","unittest.test","unittest.test.testmock","urllib"];for(r=0;r<s.length;r++)e.stdlib[s[r]]=["py",!0]}(__BRYTHON__),function($B){var _b_=$B.builtins,_window=self,module=$B.module={__class__:_b_.type,__mro__:[_b_.object],$infos:{__module__:"builtins",__name__:"module"},$is_class:!0};function parent_package(e){var t=e.split(".");return t.pop(),t.join(".")}function $download_module(e,t,r){var n=new XMLHttpRequest,s="?v="+(new Date).getTime(),a=null,i=e.__name__,o=_window.setTimeout(function(){n.abort()},5e3);if($B.$options.cache?n.open("GET",t,!1):n.open("GET",t+s,!1),n.send(),$B.$CORS?a=200==n.status||0==n.status?n.responseText:_b_.FileNotFoundError.$factory("No module named '"+i+"'"):4==n.readyState&&(200==n.status?(a=n.responseText,e.$last_modified=n.getResponseHeader("Last-Modified")):(console.info("Error "+n.status+" means that Python module "+i+" was not found at url "+t),a=_b_.FileNotFoundError.$factory("No module named '"+i+"'"))),_window.clearTimeout(o),null==a)throw _b_.FileNotFoundError.$factory("No module named '"+i+"' (res is null)");if(a.constructor===Error)throw a;return a}function import_js(e,t){try{var r=$download_module(e,t,void 0)}catch(e){return null}return run_js(r,t,e),!0}function run_js(e,t,r){try{var n=new Function(e+";\nreturn $module")();$B.$options.store&&(r.$js=e)}catch(e){throw console.log(e),console.log(t,r),e}for(var s in n.__name__=r.__name__,n)"function"==typeof n[s]&&(n[s].$infos={__module__:r.__name__,__name__:s,__qualname__:s});if(void 0!==r){for(var s in n)r[s]=n[s];(n=r).__class__=module}else n.__class__=module,n.__name__=r.__name__,n.__repr__=n.__str__=function(){return $B.builtin_module_names.indexOf(r.name)>-1?"<module '"+r.__name__+"' (built-in)>":"<module '"+r.__name__+"' from "+t+" >"},"builtins"!=r.name&&(n.__file__=t);return $B.imported[r.__name__]=n,!0}function show_ns(){for(var kk=Object.keys(_window),i=0,len=kk.length;i<len;i++)console.log(kk[i]),"$"==kk[i].charAt(0)&&console.log(eval(kk[i]));console.log("---")}function import_py(e,t,r){var n=e.__name__,s=$download_module(e,t,r);if(e.$src=s,$B.imported[n].$is_package=e.$is_package,$B.imported[n].$last_modified=e.$last_modified,"/__init__.py"==t.substr(t.length-12))$B.imported[n].__package__=n,$B.imported[n].__path__=t,$B.imported[n].$is_package=e.$is_package=!0;else if(r)$B.imported[n].__package__=r;else{var a=n.split(".");a.pop(),$B.imported[n].__package__=a.join(".")}return $B.imported[n].__file__=t,run_py(s,t,e)}function run_py(module_contents,path,module,compiled){$B.file_cache[path]=module_contents;var root,js,mod_name=module.__name__;if(!compiled){var $Node=$B.$Node,$NodeJSCtx=$B.$NodeJSCtx;$B.$py_module_path[module.__name__]=path;var src={src:module_contents,has_annotations:!1};root=$B.py2js(src,module,module.__name__,$B.builtins_scope),void 0!==module.__package__&&(root.binding.__package__=!0)}try{js=compiled?module_contents:root.to_js(),10==$B.$options.debug&&(console.log("code for module "+module.__name__),console.log(js));var src=js;js="var $module = (function(){\n"+js+"return $locals_"+module.__name__.replace(/\./g,"_")+"})(__BRYTHON__)\nreturn $module";var module_id="$locals_"+module.__name__.replace(/\./g,"_"),$module=new Function(module_id,js)(module)}catch(e){for(var attr in console.log(e+" for module "+module.__name__),console.log("module",module),console.log(root),console.log(e),$B.debug>1&&console.log(js),e)console.log(attr,e[attr]);throw console.log(_b_.getattr(e,"info","[no info]")),console.log("message: "+e.$message),console.log("filename: "+e.fileName),console.log("linenum: "+e.lineNumber),$B.debug>0&&console.log("line info "+$B.line_info),e}finally{$B.clear_ns(module.__name__)}try{var mod=eval("$module");for(var attr in mod)module[attr]=mod[attr];return module.__initializing__=!1,$B.imported[module.__name__]=module,{content:src,name:mod_name,imports:Object.keys(root.imports).join(",")}}catch(e){for(var attr in console.log(e+" for module "+module.__name__),e)console.log(attr+" "+e[attr]);throw $B.debug>0&&console.log("line info "+__BRYTHON__.line_info),e}}function new_spec(e){return e.__class__=module,e}module.__init__=function(){},module.__new__=function(e,t,r,n){return{__class__:e,__name__:t,__doc__:r||_b_.None,__package__:n||_b_.None}},module.__repr__=module.__str__=function(e){var t="<module "+e.__name__;return void 0===e.__file__&&(t+=" (built-in)"),t+">"},module.__setattr__=function(e,t,r){"__builtins__"==e.__name__?$B.builtins[t]=r:e[t]=r},module.$factory=function(e,t,r){return{__class__:module,__name__:e,__doc__:t||_b_.None,__package__:r||_b_.None}},$B.set_func_names(module,"builtins"),$B.$download_module=$download_module,$B.run_py=run_py;var finder_VFS={__class__:_b_.type,__mro__:[_b_.object],$infos:{__module__:"builtins",__name__:"VFSFinder"},create_module:function(e,t){return _b_.None},exec_module:function(e,t){var r=t.__spec__.loader_state.stored,n=t.__spec__.loader_state.timestamp;delete t.__spec__.loader_state;var s=r[0],a=r[1];r[2];t.$is_package=r[3]||!1;var i="VFS."+t.__name__;if(i+=t.$is_package?"/__init__.py":s,t.__file__=i,$B.file_cache[t.__file__]=$B.VFS[t.__name__][1],".js"==s)run_js(a,t.__path__,t);else{if($B.precompiled.hasOwnProperty(t.__name__)){$B.debug>1&&console.info("load",t.__name__,"from precompiled");for(var o=t.__name__.split("."),_=0;_<o.length;_++){var l=o.slice(0,_+1).join(".");if(!$B.imported.hasOwnProperty(l)||!$B.imported[l].__initialized__){var c=$B.precompiled[l],u=t.$is_package;Array.isArray(c)&&(c=c[0]);var f=$B.imported[l]=module.$factory(l,void 0,u);if(f.__initialized__=!0,u)f.__path__="<stdlib>",f.__package__=l;else(b=l.split(".")).pop(),f.__package__=b.join(".");f.__file__=i;try{var p=l.replace(/\./g,"_");c+="return $locals_"+p;var d=new Function("$locals_"+p,c)(f)}catch(e){if($B.debug>1){for(var h in console.log(e),e)console.log(h,e[h]);console.log(Object.keys($B.imported)),$B.debug>2&&console.log(t,"mod_js",c)}throw e}for(var $ in d)f[$]=d[$];d.__file__=i,_>0&&$B.builtins.setattr($B.imported[o.slice(0,_).join(".")],o[_],d)}}return d}var m=t.__name__;$B.debug>1&&console.log("run Python code from VFS",m);var b,g=run_py(a,t.__path__,t);g.is_package=t.$is_package,g.timestamp=$B.timestamp,g.source_ts=n,$B.precompiled[m]=g.is_package?[g.content]:g.content,(b=m.split(".")).length>1&&b.pop(),$B.$options.indexedDB&&self.indexedDB&&$B.idb_name&&(indexedDB.open($B.idb_name).onsuccess=function(e){var r=e.target.result.transaction("modules","readwrite").objectStore("modules"),n=(r.openCursor(),r.put(g));n.onsuccess=function(){$B.debug>1&&console.info(t.__name__,"stored in db")},n.onerror=function(){console.info("could not store "+t.__name__)}})}},find_module:function(e,t,r){return{__class__:Loader,load_module:function(t,r){var n=e.find_spec(e,t,r),s=module.$factory(t);$B.imported[t]=s,s.__spec__=n,e.exec_module(e,s)}}},find_spec:function(e,t,r,n){var s,a,i;return $B.use_VFS?void 0===(s=$B.VFS[t])?_b_.None:(a=s[3]||!1,i=s.timestamp,s?new_spec({name:t,loader:e,origin:$B.builtin_module_names.indexOf(t)>-1?"built-in":"brython_stdlib",submodule_search_locations:a?[]:_b_.None,loader_state:{stored:s,timestamp:i},cached:_b_.None,parent:a?t:parent_package(t),has_location:_b_.False}):void 0):_b_.None}};for(var method in $B.set_func_names(finder_VFS,"<import>"),finder_VFS)"function"==typeof finder_VFS[method]&&(finder_VFS[method]=_b_.classmethod.$factory(finder_VFS[method]));finder_VFS.$factory=function(){return{__class__:finder_VFS}};var finder_stdlib_static={$factory:finder_stdlib_static,__class__:_b_.type,__mro__:[_b_.object],$infos:{__module__:"builtins",__name__:"StdlibStatic"},create_module:function(e,t){return _b_.None},exec_module:function(e,t){var r=t.__spec__.loader_state;t.$is_package=r.is_package,"py"==r.ext?import_py(t,r.path,t.__package__):import_js(t,r.path),delete t.__spec__.loader_state},find_module:function(e,t,r){var n=e.find_spec(e,t,r);return n===_b_.None?_b_.None:{__class__:Loader,load_module:function(t,r){var s=module.$factory(t);$B.imported[t]=s,s.__spec__=n,s.__package__=n.parent,e.exec_module(e,s)}}},find_spec:function(e,t,r,n){if($B.stdlib&&$B.$options.static_stdlib_import){var s=$B.stdlib[t];if(void 0===s){var a=t.split(".");if(a.length>1){a.pop();var i=$B.stdlib[a.join(".")];i&&i[1]&&(s=["py"])}}if(void 0!==s){var o=s[0],_=void 0!==s[1],l={ext:o,is_package:_,path:(r=$B.brython_path+("py"==o?"Lib/":"libs/")+t.replace(/\./g,"/"))+(_?"/__init__.py":"py"==o?".py":".js"),address:s};return new_spec({name:t,loader:e,origin:l.path,submodule_search_locations:_?[r]:_b_.None,loader_state:l,cached:_b_.None,parent:_?t:parent_package(t),has_location:_b_.True})}}return _b_.None}};for(var method in $B.set_func_names(finder_stdlib_static,"<import>"),finder_stdlib_static)"function"==typeof finder_stdlib_static[method]&&(finder_stdlib_static[method]=_b_.classmethod.$factory(finder_stdlib_static[method]));finder_stdlib_static.$factory=function(){return{__class__:finder_stdlib_static}};var finder_path={__class__:_b_.type,__mro__:[_b_.object],$infos:{__module__:"builtins",__name__:"ImporterPath"},create_module:function(e,t){return _b_.None},exec_module:function(e,t){var r=$B.$getattr(t,"__spec__"),n=r.loader_state.code;t.$is_package=r.loader_state.is_package,delete r.loader_state.code;var s=r.loader_state.type;"py"==s||"pyc.js"==s?run_py(n,r.origin,t,"pyc.js"==s):"js"==r.loader_state.type&&run_js(n,r.origin,t)},find_module:function(e,t,r){return finder_path.find_spec(e,t,r)},find_spec:function(e,t,r,n){var s=$B.last($B.frames_stack)[2];if($B.VFS&&$B.VFS[s])return _b_.None;$B.is_none(r)&&(r=$B.path);for(var a=0,i=r.length;a<i;++a){var o=r[a];"/"!=o[o.length-1]&&(o+="/");var _=$B.path_importer_cache[o];if(void 0===_){for(var l=!0,c=0,u=$B.path_hooks.length;c<u&&l;++c){var f=$B.path_hooks[c].$factory;try{_=("function"==typeof f?f:$B.$getattr(f,"__call__"))(o),l=!1}catch(e){if(e.__class__!==_b_.ImportError)throw e}}l&&($B.path_importer_cache[o]=_b_.None)}if(!$B.is_none(_)){var p=$B.$getattr(_,"find_spec"),d=("function"==typeof p?p:$B.$getattr(p,"__call__"))(t,n);if(!$B.is_none(d))return d}}return _b_.None}};for(var method in $B.set_func_names(finder_path,"<import>"),finder_path)"function"==typeof finder_path[method]&&(finder_path[method]=_b_.classmethod.$factory(finder_path[method]));finder_path.$factory=function(){return{__class__:finder_path}};var url_hook={__class__:_b_.type,__mro__:[_b_.object],__repr__:function(e){return"<UrlPathFinder"+(e.hint?" for '"+e.hint+"'":"(unbound)")+" at "+e.path_entry+">"},$infos:{__module__:"builtins",__name__:"UrlPathFinder"},find_spec:function(e,t,r){var n={},s=!0,a=e.hint,i=e.path_entry+t.match(/[^.]+$/g)[0],o=[];(void 0===a||"py"==a)&&(o=o.concat([[i+".py","py",!1],[i+"/__init__.py","py",!0]]));for(var _=0;s&&_<o.length;++_)try{var l=o[_];r={__name__:t,$is_package:!1};n.code=$download_module(r,l[0],void 0),s=!1,n.type=l[1],n.is_package=l[2],void 0===a&&(e.hint=l[1],$B.path_importer_cache[e.path_entry]=e),n.is_package&&($B.path_importer_cache[i+"/"]=url_hook.$factory(i+"/",e.hint)),n.path=l[0]}catch(e){}return s?_b_.None:new_spec({name:t,loader:finder_path,origin:n.path,submodule_search_locations:n.is_package?[i]:_b_.None,loader_state:n,cached:_b_.None,parent:n.is_package?t:parent_package(t),has_location:_b_.True})},invalidate_caches:function(e){},$factory:function(e,t){return{__class__:url_hook,path_entry:e.endsWith("/")?e:e+"/",hint:t}}};$B.set_func_names(url_hook,"<import>"),$B.path_importer_cache={};for(var _sys_paths=[[$B.script_dir+"/","py"],[$B.brython_path+"Lib/","py"],[$B.brython_path+"Lib/site-packages/","py"],[$B.brython_path+"libs/","js"]],i=0;i<_sys_paths.length;++i){var _path=_sys_paths[i],_type=_path[1];_path=_path[0],$B.path_importer_cache[_path]=url_hook.$factory(_path,_type)}function import_error(e){var t=_b_.ImportError.$factory(e);throw t.name=e,t}function optimize_import_for_path(e,t){"/"!=e.slice(-1)&&(e+="/");var r="none"==t?_b_.None:url_hook.$factory(e,t);$B.path_importer_cache[e]=r}$B.$__import__=function(e,t,r,n,s){var a=!1;if(t.$jsobj&&t.$jsobj.__file__){var i=t.$jsobj.__file__;(i.startsWith($B.brython_path+"Lib/")&&!i.startsWith($B.brython_path+"Lib/site-packages/")||i.startsWith($B.brython_path+"libs/")||i.startsWith("VFS."))&&(a=!0)}var o=$B.imported[e],_=e.split("."),l=n.length>0;if(o==_b_.None&&import_error(e),void 0===o){$B.is_none(n)&&(n=[]);for(var c=0,u="",f="",p=_.length-1,d=_b_.None;c<=p;++c){var h=f;if(f+=u+_[c],u=".",(o=$B.imported[f])==_b_.None)import_error(f);else if(void 0===o){try{$B.import_hooks(f,d,a)}catch(e){throw delete $B.imported[f],e}$B.is_none($B.imported[f])?import_error(f):h&&_b_.setattr($B.imported[h],_[c],$B.imported[f])}if(c<p)try{d=$B.$getattr($B.imported[f],"__path__")}catch(t){if(c==p-1&&$B.imported[f][_[p]]&&$B.imported[f][_[p]].__class__===module)return $B.imported[f][_[p]];if(!l){var $=_b_.ModuleNotFoundError.$factory();throw $.msg="No module named '"+e+"'; '"+f+"' is not a package",$.args=$B.fast_tuple([$.msg]),$.name=e,$.path=_b_.None,$}import_error(e)}}}else if($B.imported[_[0]]&&2==_.length)try{$B.$setattr($B.imported[_[0]],_[1],o)}catch(e){throw console.log("error",_,o),e}return n.length>0?$B.imported[e]:$B.imported[_[0]]},$B.$import=function(e,t,r,n){t=void 0===t?[]:t,r=void 0===r?{}:r,n=void 0===n?{}:n;var s=e.split(".");"."==e[e.length-1]&&s.pop();for(var a=[],i=!0,o=0,_=s.length;o<_;o++){var l=s[o];if(i&&""==l){if(elt=a.pop(),void 0===elt)throw _b_.ImportError.$factory("Parent module '' not loaded, cannot perform relative import")}else i=!1,a.push("$$"==l.substr(0,2)?l.substr(2):l)}e=a.join(".");10==$B.$options.debug&&(console.log("$import "+e),console.log("use VFS ? "+$B.use_VFS),console.log("use static stdlib paths ? "+$B.static_stdlib_import));var c=$B.frames_stack[$B.frames_stack.length-1],u=c[3],f=u.__import__,p=$B.obj_dict(u);void 0===f&&(f=$B.$__import__);var d=("function"==typeof f?f:$B.$getattr(f,"__call__"))(e,p,void 0,t,0);if(t&&0!=t.length){var h=t,$={};if(t&&"*"==t[0]&&(h=$B.$getattr(d,"__all__",$))!==$&&(r={}),h===$)for(var m in d)"_"!==m[0]&&(n[m]=d[m]);else{o=0;for(var b=h.length;o<b;++o){var g=h[o],y=r[g]||g;try{n[y]=$B.$getattr(d,g)}catch(t){try{var v=$B.from_alias(g);$B.$getattr(f,"__call__")(e+"."+v,p,void 0,[],0),n[y]=$B.$getattr(d,v)}catch(t){if("__future__"===e){var x=$B.last($B.frames_stack),w=x[3].$line_info.split(","),B=parseInt(w[0]);$B.$SyntaxError(x[2],"future feature "+g+" is not defined",c[3].src,void 0,B)}if(t.$py_error){t.__class__.$infos.__name__;throw t.__class__!==_b_.ImportError&&t.__class__!==_b_.ModuleNotFoundError&&$B.handle_error(t),_b_.ImportError.$factory("cannot import name '"+g+"'")}throw $B.debug>1&&(console.log(t),console.log($B.last($B.frames_stack))),_b_.ImportError.$factory("cannot import name '"+g+"'")}}}}return n}(y=r[e])?n[y]=$B.imported[e]:n[$B.to_alias(a[0])]=d},$B.import_all=function(e,t){for(var r in t)r.startsWith("$$")?e[r]=t[r]:-1=="_$".indexOf(r.charAt(0))&&(e[r]=t[r])},$B.$path_hooks=[url_hook],$B.$meta_path=[finder_VFS,finder_stdlib_static,finder_path],$B.finders={VFS:finder_VFS,stdlib_static:finder_stdlib_static,path:finder_path};var Loader={__class__:$B.$type,__mro__:[_b_.object],__name__:"Loader"},_importlib_module={__class__:module,__name__:"_importlib",Loader:Loader,VFSFinder:finder_VFS,StdlibStatic:finder_stdlib_static,ImporterPath:finder_path,UrlPathFinder:url_hook,optimize_import_for_path:optimize_import_for_path};_importlib_module.__repr__=_importlib_module.__str__=function(){return"<module '_importlib' (built-in)>"},$B.imported._importlib=_importlib_module}(__BRYTHON__),function($B){var bltns=$B.InjectBuiltins();eval(bltns);var object=_b_.object;function $err(e,t){var r="unsupported operand type(s) for "+e+": 'float' and '"+$B.class_name(t)+"'";throw _b_.TypeError.$factory(r)}function float_value(e){return void 0!==e.$brython_value?e.$brython_value:e}var float={__class__:_b_.type,__dir__:object.__dir__,$infos:{__module__:"builtins",__name__:"float"},$is_class:!0,$native:!0,$descriptors:{numerator:!0,denominator:!0,imag:!0,real:!0}};function preformat(e,t){if(t.empty)return _b_.str.$factory(e);if(t.type&&-1=="eEfFgGn%".indexOf(t.type))throw _b_.ValueError.$factory("Unknown format code '"+t.type+"' for object of type 'float'");if(isNaN(e))return"f"==t.type||"g"==t.type?"nan":"NAN";if(e==Number.POSITIVE_INFINITY)return"f"==t.type||"g"==t.type?"inf":"INF";if(void 0===t.precision&&void 0!==t.type&&(t.precision=6),"%"==t.type&&(e*=100),"e"==t.type){var r=e.toExponential(t.precision),n=parseInt(r.substr(r.search("e")+1));return Math.abs(n)<10&&(r=r.substr(0,r.length-1)+"0"+r.charAt(r.length-1)),r}if(void 0!==t.precision){var s=t.precision;if(0==s)return Math.round(e)+"";var a=(r=e.toFixed(s)).indexOf(".");if(void 0===t.type||"%"!=t.type&&"f"!=t.type.toLowerCase()){if(t.type&&"g"==t.type.toLowerCase()){var i=preformat(e,{type:"e"}).split("e"),o=(r=-4<=(n=parseInt(i[1]))&&n<t.precision?preformat(e,{type:"f",precision:t.precision-1-n}):preformat(e,{type:"e",precision:t.precision-1})).split("e");if(t.alternate)-1==o[0].search(/\./)&&(o[0]+=".");else if(o[1]){for(var _=o[0];_.endsWith("0");)_=_.substr(0,_.length-1);_.endsWith(".")&&(_=_.substr(0,_.length-1)),o[0]=_}return r=o.join("e"),"G"==t.type&&(r=r.toUpperCase()),r}var l=e.toExponential(t.precision-1);if((n=parseInt(l.substr(l.search("e")+1)))<-4||n>=t.precision-1){for(var c=l.split("e");c[0].endsWith("0");)c[0]=c[0].substr(0,c[0].length-1);r=c.join("e")}}else if(-1==a)r+="."+"0".repeat(t.precision);else{var u=t.precision-r.length+a+1;u>0&&(r+="0".repeat(u))}}else r=_b_.str.$factory(e);if(void 0===t.type||-1!="gGn".indexOf(t.type)){if(-1==r.search("e"))for(;"0"==r.charAt(r.length-1);)r=r.substr(0,r.length-1);"."==r.charAt(r.length-1)&&(void 0===t.type?r+="0":r=r.substr(0,r.length-1))}return void 0!==t.sign&&(" "==t.sign||"+"==t.sign)&&e>0&&(r=t.sign+r),"%"==t.type&&(r+="%"),r}float.numerator=function(e){return float_value(e)},float.denominator=function(e){return _b_.int.$factory(1)},float.imag=function(e){return _b_.int.$factory(0)},float.real=function(e){return float_value(e)},float.__float__=function(e){return float_value(e)},float.as_integer_ratio=function(e){if((e=float_value(e)).valueOf()==Number.POSITIVE_INFINITY||e.valueOf()==Number.NEGATIVE_INFINITY)throw _b_.OverflowError.$factory("Cannot pass infinity to float.as_integer_ratio.");if(!Number.isFinite(e.valueOf()))throw _b_.ValueError.$factory("Cannot pass NaN to float.as_integer_ratio.");for(var t=_b_.$frexp(e.valueOf()),r=t[0],n=t[1],s=0;s<300&&r!=Math.floor(r);s++)r*=2,n--;return numerator=float.$factory(r),py_exponent=abs(n),denominator=1,py_exponent=_b_.getattr(_b_.int.$factory(denominator),"__lshift__")(py_exponent),n>0?numerator*=py_exponent:denominator=py_exponent,_b_.tuple.$factory([_b_.int.$factory(numerator),_b_.int.$factory(denominator)])},float.__bool__=function(e){return e=float_value(e),_b_.bool.$factory(e.valueOf())},float.__eq__=function(e,t){return e=float_value(e),t=float_value(t),(!isNaN(e)||!isNaN(t))&&(isinstance(t,_b_.int)?e==t:isinstance(t,float)?e.valueOf()==t.valueOf():isinstance(t,_b_.complex)?0==t.$imag&&e==t.$real:_b_.NotImplemented)},float.__floordiv__=function(e,t){if(e=float_value(e),t=float_value(t),isinstance(t,[_b_.int,float])){if(0==t.valueOf())throw ZeroDivisionError.$factory("division by zero");return float.$factory(Math.floor(e/t))}if(hasattr(t,"__rfloordiv__"))return getattr(t,"__rfloordiv__")(e);$err("//",t)},float.fromhex=function(e){if(!isinstance(e,_b_.str))throw _b_.ValueError.$factory("argument must be a string");var t,r=e.trim();switch(r.toLowerCase()){case"+inf":case"inf":case"+infinity":case"infinity":return $FloatClass(1/0);case"-inf":case"-infinity":return $FloatClass(-1/0);case"+nan":case"nan":return $FloatClass(Number.NaN);case"-nan":return $FloatClass(-Number.NaN);case"":throw _b_.ValueError.$factory("could not convert string to float")}if(null!==(t=/^(\d*\.?\d*)$/.exec(r)))return $FloatClass(parseFloat(t[1]));if(null==(t=/^(\+|-)?(0x)?([0-9A-F]+\.?)?(\.[0-9A-F]+)?(p(\+|-)?\d+)?$/i.exec(r)))throw _b_.ValueError.$factory("invalid hexadecimal floating-point string");var n=t[1],s=parseInt(t[3]||"0",16),a=t[4]||".0",i=t[5]||"p0";n="-"==n?-1:1;for(var o=s,_=1,l=a.length;_<l;_++)o+=parseInt(a.charAt(_),16)/Math.pow(16,_);return new Number(n*o*Math.pow(2,parseInt(i.substring(1))))},float.__getformat__=function(e){if("double"==e||"float"==e)return"IEEE, little-endian";throw _b_.ValueError.$factory("__getformat__() argument 1 must be 'double' or 'float'")},float.__format__=function(e,t){e=float_value(e);var r=new $B.parse_format_spec(t);r.align=r.align||">";var n=preformat(e,r).split("."),s=n[0];if(r.comma){for(var a=s.length,i=Math.ceil(s.length/3),o=[],_=0;_<i;_++)o.push(s.substring(a-3*_-3,a-3*_));o.reverse(),n[0]=o.join(",")}return $B.format_width(n.join("."),r)},float.__hash__=function(e){if(void 0===e)return float.__hashvalue__||$B.$py_next_hash--;var t=e.valueOf();if(t===1/0)return 314159;if(t===-1/0)return-271828;if(isNaN(t))return 0;if(t==Math.round(t))return Math.round(t);var r=_b_.$frexp(t);r[0]*=Math.pow(2,31);var n=_b_.int.$factory(r[0]);return r[0]=(r[0]-n)*Math.pow(2,31),4294967295&n+_b_.int.$factory(r[0])+(r[1]<<15)},_b_.$isninf=function(e){var t=e;return isinstance(e,float)&&(t=e.valueOf()),t==-1/0||t==Number.NEGATIVE_INFINITY},_b_.$isinf=function(e){var t=e;return isinstance(e,float)&&(t=e.valueOf()),t==1/0||t==-1/0||t==Number.POSITIVE_INFINITY||t==Number.NEGATIVE_INFINITY},_b_.$fabs=function(e){return e>0?float.$factory(e):float.$factory(-e)},_b_.$frexp=function(e){var t=e;if(isinstance(e,float)&&(t=e.valueOf()),isNaN(t)||_b_.$isinf(t))return[t,-1];if(0==t)return[0,0];var r=1,n=0,s=t;for(s<0&&(r=-r,s=-s);s<.5;)s*=2,n--;for(;s>=1;)s*=.5,n++;return[s*=r,n]},_b_.$ldexp=function(e,t){if(_b_.$isninf(e))return float.$factory("-inf");if(_b_.$isinf(e))return float.$factory("inf");var r=e;if(isinstance(e,float)&&(r=e.valueOf()),0==r)return r;var n=t;return isinstance(t,float)&&(n=t.valueOf()),r*Math.pow(2,n)},float.hex=function(e){switch((e=float_value(e)).valueOf()){case 1/0:case-1/0:case Number.NaN:case-Number.NaN:return e;case-0:return"-0x0.0p0";case 0:return"0x0.0p0"}var t=_b_.$frexp(_b_.$fabs(e.valueOf())),r=t[0],n=t[1],s=1-Math.max(-1021-n,0);r=_b_.$ldexp(r,s),n-=s;var a="0123456789ABCDEF".split(""),i=a[Math.floor(r)];i+=".",r-=Math.floor(r);for(var o=0;o<13;o++)r*=16,i+=a[Math.floor(r)],r-=Math.floor(r);var _="+";return n<0&&(_="-",n=-n),e.value<0?"-0x"+i+"p"+_+n:"0x"+i+"p"+_+n},float.__init__=function(e,t){return _b_.None},float.__int__=function(e){return parseInt(e)},float.is_integer=function(e){return _b_.int.$factory(e)==e},float.__mod__=function(e,t){if(e=float_value(e),0==(t=float_value(t)))throw ZeroDivisionError.$factory("float modulo");if(isinstance(t,_b_.int))return new Number((e%t+t)%t);if(isinstance(t,float)){var r=Math.floor(e/t);return new Number(e-t*r)}if(isinstance(t,_b_.bool)){var n=0;return t.valueOf()&&(n=1),new Number((e%n+n)%n)}if(hasattr(t,"__rmod__"))return getattr(t,"__rmod__")(e);$err("%",t)},float.__mro__=[object],float.__mul__=function(e,t){if(e=float_value(e),t=float_value(t),isinstance(t,_b_.int))return t.__class__==$B.long_int?new Number(e*parseFloat(t.value)):new Number(e*t);if(isinstance(t,float))return new Number(e*float_value(t));if(isinstance(t,_b_.bool)){var r=0;return t.valueOf()&&(r=1),new Number(e*r)}return isinstance(t,_b_.complex)?$B.make_complex(float.$factory(e*t.$real),float.$factory(e*t.$imag)):hasattr(t,"__rmul__")?getattr(t,"__rmul__")(e):void $err("*",t)},float.__ne__=function(e,t){var r=float.__eq__(e,t);return r===_b_.NotImplemented?r:!r},float.__neg__=function(e,t){return float.$factory(-float_value(e))},float.__new__=function(e,t){if(void 0===e)throw _b_.TypeError.$factory("float.__new__(): not enough arguments");if(!_b_.isinstance(e,_b_.type))throw _b_.TypeError.$factory("float.__new__(X): X is not a type object");return e===float?float.$factory(t):{__class__:e,__dict__:_b_.dict.$factory(),$brython_value:t||0}},float.__pos__=function(e){return float_value(e)},float.__pow__=function(e,t){if(e=float_value(e),t=float_value(t),isinstance(t,_b_.int)||isinstance(t,float)){if(1==e)return e;if(0==t)return new Number(1);if(!(-1!=e||isFinite(t)&&t.__class__!==$B.long_int&&$B.is_safe_int(t)||isNaN(t)))return new Number(1);if(0==e&&isFinite(t)&&t<0)throw _b_.ZeroDivisionError.$factory("0.0 cannot be raised to a negative power");return e!=Number.NEGATIVE_INFINITY||isNaN(t)?e!=Number.POSITIVE_INFINITY||isNaN(t)?t!=Number.NEGATIVE_INFINITY||isNaN(e)?t!=Number.POSITIVE_INFINITY||isNaN(e)?e<0&&!_b_.getattr(t,"__eq__")(_b_.int.$factory(t))?_b_.complex.__pow__($B.make_complex(e,0),t):float.$factory(Math.pow(e,t)):Math.abs(e)<1?new Number(0):Number.POSITIVE_INFINITY:Math.abs(e)<1?Number.POSITIVE_INFINITY:new Number(0):t>0?e:new Number(0):t<0&&t%2==1?new Number(-0):t<0?new Number(0):t>0&&t%2==1?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY}if(isinstance(t,_b_.complex)){var r=Math.pow(e,t.$real),n=Math.log(e);return $B.make_complex(r*Math.cos(n),r*Math.sin(n))}if(hasattr(t,"__rpow__"))return getattr(t,"__rpow__")(e);$err("** or pow()",t)},float.__repr__=float.__str__=function(e){if((e=float_value(e)).valueOf()==1/0)return"inf";if(e.valueOf()==-1/0)return"-inf";if(isNaN(e.valueOf()))return"nan";var t,r,n=e.valueOf()+"";if(-1==n.indexOf(".")&&(n+=".0"),[t,r]=n.split("."),t.length>16){for(var s=t.length-1,a=t[0],i=t.substr(1)+r;i.endsWith("0");)i=i.substr(0,i.length-1);var o=a;return i.length>0&&(o+="."+i),o+"e+"+s}if("0"==t){for(s=0;s<r.length&&"0"==r.charAt(s);)s++;if(s>3){var _=r.substr(s);for(s=(s+1).toString();_.endsWith("0");)_=_.substr(0,n.length-1);o=_[0];return _.length>1&&(o+="."+_.substr(1)),1==s.length&&(s="0"+s),o+"e-"+s}}return _b_.str.$factory(n)},float.__setattr__=function(e,t,r){if(e.constructor===Number)throw void 0===float[t]?_b_.AttributeError.$factory("'float' object has no attribute '"+t+"'"):_b_.AttributeError.$factory("'float' object attribute '"+t+"' is read-only");return e[t]=r,_b_.None},float.__truediv__=function(e,t){if(e=float_value(e),t=float_value(t),isinstance(t,[_b_.int,float])){if(0==t.valueOf())throw ZeroDivisionError.$factory("division by zero");return float.$factory(e/t)}if(isinstance(t,_b_.complex)){var r=t.$real*t.$real+t.$imag*t.$imag;if(0==r)throw ZeroDivisionError.$factory("division by zero");return $B.make_complex(float.$factory(e*t.$real/r),float.$factory(-e*t.$imag/r))}if(hasattr(t,"__rtruediv__"))return getattr(t,"__rtruediv__")(e);$err("/",t)};var $op_func=function(e,t){if(e=float_value(e),t=float_value(t),isinstance(t,_b_.int))return"boolean"==typeof t?t?e-1:e:t.__class__===$B.long_int?float.$factory(e-parseInt(t.value)):float.$factory(e-t);if(isinstance(t,float))return float.$factory(e-t);if(isinstance(t,_b_.bool)){var r=0;return t.valueOf()&&(r=1),float.$factory(e-r)}return isinstance(t,_b_.complex)?$B.make_complex(e-t.$real,-t.$imag):hasattr(t,"__rsub__")?getattr(t,"__rsub__")(e):void $err("-",t)};$op_func+="";var $ops={"+":"add","-":"sub"};for(var $op in $ops){var $opf=$op_func.replace(/-/gm,$op);$opf=$opf.replace(/__rsub__/gm,"__r"+$ops[$op]+"__"),eval("float.__"+$ops[$op]+"__ = "+$opf)}var $comp_func=function(e,t){if(e=float_value(e),t=float_value(t),isinstance(t,_b_.int))return t.__class__===$B.long_int?e>parseInt(t.value):e>t.valueOf();if(isinstance(t,float))return e>t;if(isinstance(t,_b_.bool))return e.valueOf()>_b_.bool.__hash__(t);if(hasattr(t,"__int__")||hasattr(t,"__index__"))return _b_.int.__gt__(e,$B.$GetInt(t));var r=getattr(t,"__le__",None);if(r!==None)return r(e);throw _b_.TypeError.$factory("unorderable types: float() > "+$B.class_name(t)+"()")};for(var $op in $comp_func+="",$B.$comps)eval("float.__"+$B.$comps[$op]+"__ = "+$comp_func.replace(/>/gm,$op).replace(/__gt__/gm,"__"+$B.$comps[$op]+"__").replace(/__le__/,"__"+$B.$inv_comps[$op]+"__"));$B.make_rmethods(float);var $notimplemented=function(e,t){throw _b_.TypeError.$factory("unsupported operand types for OPERATOR: 'float' and '"+$B.class_name(t)+"'")};for(var $op in $notimplemented+="",$B.$operators)if(void 0===$B.augmented_assigns[$op]){var $opfunc="__"+$B.$operators[$op]+"__";void 0===float[$opfunc]&&eval("float."+$opfunc+"="+$notimplemented.replace(/OPERATOR/gm,$op))}function $FloatClass(e){return new Number(e)}function to_digits(e){for(var t="",r=0;r<e.length;r++){var n="٠١٢٣٤٥٦٧٨٩".indexOf(e[r]);t+=n>-1?n:e[r]}return t}float.$factory=function(value){switch(value){case void 0:return $FloatClass(0);case Number.MAX_VALUE:return $FloatClass(1/0);case-Number.MAX_VALUE:return $FloatClass(-1/0);case!0:return new Number(1);case!1:return new Number(0)}if("number"==typeof value)return new Number(value);if(isinstance(value,float))return value;if(isinstance(value,bytes)){var s=getattr(value,"decode")("latin-1");return float.$factory(getattr(value,"decode")("latin-1"))}if("string"==typeof value)switch(value=value.trim(),value.toLowerCase()){case"+inf":case"inf":case"+infinity":case"infinity":return Number.POSITIVE_INFINITY;case"-inf":case"-infinity":return Number.NEGATIVE_INFINITY;case"+nan":case"nan":return Number.NaN;case"-nan":return-Number.NaN;case"":throw _b_.ValueError.$factory("count not convert string to float");default:if(value=value.charAt(0)+value.substr(1).replace(/_/g,""),value=to_digits(value),isFinite(value))return $FloatClass(eval(value));throw _b_.str.encode(value,"latin-1"),_b_.ValueError.$factory("Could not convert to float(): '"+_b_.str.$factory(value)+"'")}var klass=value.__class__||$B.get_class(value),num_value=$B.to_num(value,["__float__","__index__"]);if(null!==num_value)return num_value;throw _b_.TypeError.$factory("float() argument must be a string or a number, not '"+$B.class_name(value)+"'")},$B.$FloatClass=$FloatClass,$B.set_func_names(float,"builtins");var FloatSubclass=$B.FloatSubclass={__class__:_b_.type,__mro__:[object],$infos:{__module__:"builtins",__name__:"float"},$is_class:!0};for(var $attr in float)"function"==typeof float[$attr]&&(FloatSubclass[$attr]=function(e){return function(){var t=[],r=0;if(arguments.length>0){t=[arguments[0].valueOf()],r=1;for(var n=1,s=arguments.length;n<s;n++)t[r++]=arguments[n]}return float[e].apply(null,t)}}($attr));$B.set_func_names(FloatSubclass,"builtins"),_b_.float=float}(__BRYTHON__),function($B){var _b_=$B.builtins;function $err(e,t){var r="unsupported operand type(s) for "+e+": 'int' and '"+$B.class_name(t)+"'";throw _b_.TypeError.$factory(r)}function int_value(e){return void 0!==e.$brython_value?e.$brython_value:e}var int={__class__:_b_.type,__dir__:_b_.object.__dir__,$infos:{__module__:"builtins",__name__:"int"},$is_class:!0,$native:!0,$descriptors:{numerator:!0,denominator:!0,imag:!0,real:!0}};function preformat(e,t){if(t.empty)return _b_.str.$factory(e);if(t.type&&-1=="bcdoxXn".indexOf(t.type))throw _b_.ValueError.$factory("Unknown format code '"+t.type+"' for object of type 'int'");var r;switch(t.type){case void 0:case"d":r=e.toString();break;case"b":r=(t.alternate?"0b":"")+e.toString(2);break;case"c":r=_b_.chr(e);break;case"o":r=(t.alternate?"0o":"")+e.toString(8);break;case"x":r=(t.alternate?"0x":"")+e.toString(16);break;case"X":r=(t.alternate?"0X":"")+e.toString(16).toUpperCase();break;case"n":return e}return void 0!==t.sign&&(" "==t.sign||"+"==t.sign)&&e>=0&&(r=t.sign+r),r}function extended_euclidean(e,t){var r,n,s;return 0==t?[e,1,0]:([r,n,s]=extended_euclidean(t,e%t),[r,s,n-Math.floor(e/t)*s])}int.as_integer_ratio=function(){var e=$B.args("as_integer_ratio",1,{self:null},["self"],arguments,{},null,null);return $B.$list([e.self,1])},int.from_bytes=function(){var e,t,r=$B.args("from_bytes",3,{bytes:null,byteorder:null,signed:null},["bytes","byteorder","signed"],arguments,{signed:!1},null,null),n=r.bytes,s=r.byteorder,a=r.signed;if(_b_.isinstance(n,[_b_.bytes,_b_.bytearray]))e=n.source,t=n.source.length;else{t=(e=_b_.list.$factory(n)).length;for(var i=0;i<t;i++)_b_.bytes.$factory([e[i]])}switch(s){case"big":var o=e[t-1],_=256;for(i=t-2;i>=0;i--)o=$B.add($B.mul(_,e[i]),o),_=$B.mul(_,256);return a?e[0]<128?o:$B.sub(o,_):o;case"little":(o=e[0])>=128&&(o-=256);for(_=256,i=1;i<t;i++)o=$B.add($B.mul(_,e[i]),o),_=$B.mul(_,256);return a?e[t-1]<128?o:$B.sub(o,_):o}throw _b_.ValueError.$factory("byteorder must be either 'little' or 'big'")},int.to_bytes=function(){var e=$B.args("to_bytes",3,{self:null,len:null,byteorder:null},["self","len","byteorder"],arguments,{},"args","kw"),t=e.self,r=e.len,n=e.byteorder,s=e.kw;if(!_b_.isinstance(r,_b_.int))throw _b_.TypeError.$factory("integer argument expected, got "+$B.class_name(r));if(-1==["little","big"].indexOf(n))throw _b_.ValueError.$factory("byteorder must be either 'little' or 'big'");var a=s.$string_dict.signed||!1,i=[];if(t<0){if(!a)throw _b_.OverflowError.$factory("can't convert negative int to unsigned");t=Math.pow(256,r)+t}for(var o=t;;){var _=Math.floor(o/256),l=o-256*_;if(i.push(l),0==_)break;o=_}if(i.length>r)throw _b_.OverflowError.$factory("int too big to convert");for(;i.length<r;)i=i.concat([0]);return"big"==n&&(i=i.reverse()),{__class__:_b_.bytes,source:i}},int.__abs__=function(e){return _b_.abs(e)},int.__bool__=function(e){return 0!=int_value(e).valueOf()},int.__ceil__=function(e){return Math.ceil(int_value(e))},int.__divmod__=function(e,t){return $B.fast_tuple([int.__floordiv__(e,t),int.__mod__(e,t)])},int.__eq__=function(e,t){return void 0===t?e===int:_b_.isinstance(t,int)?e.valueOf()==int_value(t).valueOf():_b_.isinstance(t,_b_.float)?e.valueOf()==t.valueOf():_b_.isinstance(t,_b_.complex)?0!=t.$imag?False:e.valueOf()==t.$real:_b_.NotImplemented},int.__float__=function(e){return new Number(e)},int.__format__=function(e,t){var r=new $B.parse_format_spec(t);if(r.type&&-1!="eEfFgG%".indexOf(r.type))return _b_.float.__format__(e,t);r.align=r.align||">";var n=preformat(e,r);if(r.comma){for(var s="-"==n[0]?"-":"",a=n.substr(s.length),i=a.length,o=Math.ceil(a.length/3),_=[],l=0;l<o;l++)_.push(a.substring(i-3*l-3,i-3*l));_.reverse(),n=s+_.join(",")}return $B.format_width(n,r)},int.__floordiv__=function(e,t){if(t.__class__===$B.long_int)return $B.long_int.__floordiv__($B.long_int.$factory(e),t);if(_b_.isinstance(t,int)){if(0==(t=int_value(t)))throw _b_.ZeroDivisionError.$factory("division by zero");return Math.floor(e/t)}if(_b_.isinstance(t,_b_.float)){if(!t.valueOf())throw _b_.ZeroDivisionError.$factory("division by zero");return Math.floor(e/t)}if(_b_.hasattr(t,"__rfloordiv__"))return $B.$getattr(t,"__rfloordiv__")(e);$err("//",t)},int.__hash__=function(e){return void 0===e?int.__hashvalue__||$B.$py_next_hash--:e.valueOf()},int.__index__=function(e){return int_value(e)},int.__init__=function(e,t){return void 0===t&&(t=0),e.toString=function(){return t},_b_.None},int.__int__=function(e){return e},int.__invert__=function(e){return~e},int.__lshift__=function(e,t){if(_b_.isinstance(t,int))return t=int_value(t),int.$factory($B.long_int.__lshift__($B.long_int.$factory(e),$B.long_int.$factory(t)));var r=$B.$getattr(t,"__rlshift__",_b_.None);if(r!==_b_.None)return r(e);$err("<<",t)},int.__mod__=function(e,t){if(_b_.isinstance(t,_b_.tuple)&&1==t.length&&(t=t[0]),t.__class__===$B.long_int)return $B.long_int.__mod__($B.long_int.$factory(e),t);if(_b_.isinstance(t,[int,_b_.float,bool])){if(!1===(t=int_value(t))?t=0:!0===t&&(t=1),0==t)throw _b_.ZeroDivisionError.$factory("integer division or modulo by zero");return(e%t+t)%t}if(_b_.hasattr(t,"__rmod__"))return $B.$getattr(t,"__rmod__")(e);$err("%",t)},int.__mro__=[_b_.object],int.__mul__=function(e,t){var r=e.valueOf();if("string"==typeof t)return t.repeat(r);if(_b_.isinstance(t,int))return(n=e*(t=int_value(t)))>$B.min_int&&n<$B.max_int?n:int.$factory($B.long_int.__mul__($B.long_int.$factory(e),$B.long_int.$factory(t)));if(_b_.isinstance(t,_b_.float))return new Number(e*t);if(_b_.isinstance(t,_b_.bool))return t.valueOf()?e:int.$factory(0);if(_b_.isinstance(t,_b_.complex))return $B.make_complex(int.__mul__(e,t.$real),int.__mul__(e,t.$imag));if(_b_.isinstance(t,[_b_.list,_b_.tuple])){for(var n=[],s=t.slice(0,t.length),a=0;a<r;a++)n=n.concat(s);return _b_.isinstance(t,_b_.tuple)&&(n=_b_.tuple.$factory(n)),n}if(_b_.hasattr(t,"__rmul__"))return $B.$getattr(t,"__rmul__")(e);$err("*",t)},int.__ne__=function(e,t){var r=int.__eq__(e,t);return r===_b_.NotImplemented?r:!r},int.__neg__=function(e){return-e},int.__new__=function(e,t){if(void 0===e)throw _b_.TypeError.$factory("int.__new__(): not enough arguments");if(!_b_.isinstance(e,_b_.type))throw _b_.TypeError.$factory("int.__new__(X): X is not a type object");return e===int?int.$factory(t):{__class__:e,__dict__:_b_.dict.$factory(),$brython_value:t||0}},int.__pos__=function(e){return e},int.__pow__=function(e,t,r){if(_b_.isinstance(t,int)){switch((t=int_value(t)).valueOf()){case 0:return int.$factory(1);case 1:return int.$factory(e.valueOf())}if(void 0!==r&&r!==_b_.None){if(1==r)return 0;var n=1,s=e%r,a=t,i=$B.long_int;if(a<0){var o,_,l;if([o,_,l]=extended_euclidean(e,r),1!==o)throw _b_.ValueError.$factory("not relative primes: "+e+" and "+r);return int.__pow__(_,-a,r)}for(;a>0;)a%2==1&&(n*s>$B.max_int?(n=i.__mul__(i.$factory(n),i.$factory(s)),n=i.__mod__(n,r)):n=n*s%r),a>>=1,s*s>$B.max_int?(s=i.__mul__(i.$factory(s),i.$factory(s)),s=i.__mod__(s,r)):s=s*s%r;return n}var c=Math.pow(e.valueOf(),t.valueOf());return c>$B.min_int&&c<$B.max_int?c:c===1/0||isFinite(c)?int.$factory($B.long_int.__pow__($B.long_int.$factory(e),$B.long_int.$factory(t))):c}if(_b_.isinstance(t,_b_.float))return e>=0?new Number(Math.pow(e,t.valueOf())):_b_.complex.__pow__($B.make_complex(e,0),t);if(_b_.isinstance(t,_b_.complex)){var u=Math.pow(e,t.$real),f=Math.log(e);return $B.make_complex(u*Math.cos(f),u*Math.sin(f))}var p=$B.$getattr(t,"__rpow__",_b_.None);if(p!==_b_.None)return p(e);$err("**",t)},int.__repr__=function(e){return e===int?"<class 'int'>":e.toString()},int.__rshift__=function(e,t){if(_b_.isinstance(t,int))return t=int_value(t),int.$factory($B.long_int.__rshift__($B.long_int.$factory(e),$B.long_int.$factory(t)));var r=$B.$getattr(t,"__rrshift__",_b_.None);if(r!==_b_.None)return r(e);$err(">>",t)},int.__setattr__=function(e,t,r){if("number"==typeof e)throw void 0===int.$factory[t]?_b_.AttributeError.$factory("'int' object has no attribute '"+t+"'"):_b_.AttributeError.$factory("'int' object attribute '"+t+"' is read-only");return _b_.dict.$setitem(e.__dict__,t,r),_b_.None},int.__str__=int.__repr__,int.__truediv__=function(e,t){if(_b_.isinstance(t,int)){if(0==(t=int_value(t)))throw _b_.ZeroDivisionError.$factory("division by zero");return t.__class__===$B.long_int?new Number(e/parseInt(t.value)):new Number(e/t)}if(_b_.isinstance(t,_b_.float)){if(!t.valueOf())throw _b_.ZeroDivisionError.$factory("division by zero");return new Number(e/t)}if(_b_.isinstance(t,_b_.complex)){var r=t.$real*t.$real+t.$imag*t.$imag;if(0==r)throw _b_.ZeroDivisionError.$factory("division by zero");return $B.make_complex(e*t.$real/r,-e*t.$imag/r)}if(_b_.hasattr(t,"__rtruediv__"))return $B.$getattr(t,"__rtruediv__")(e);$err("/",t)},int.bit_length=function(e){return s=_b_.bin(e),s=$B.$getattr(s,"lstrip")("-0b"),s.length},int.numerator=function(e){return e},int.denominator=function(e){return int.$factory(1)},int.imag=function(e){return int.$factory(0)},int.real=function(e){return e},$B.max_int32=2147483647,$B.min_int32=-$B.max_int32;var $op_func=function(e,t){if(_b_.isinstance(t,int))return t.__class__===$B.long_int?$B.long_int.__sub__($B.long_int.$factory(e),$B.long_int.$factory(t)):(t=int_value(t),e>$B.max_int32||e<$B.min_int32||t>$B.max_int32||t<$B.min_int32?$B.long_int.__sub__($B.long_int.$factory(e),$B.long_int.$factory(t)):e-t);if(_b_.isinstance(t,_b_.bool))return e-t;var r=$B.$getattr(t,"__rsub__",_b_.None);if(r!==_b_.None)return r(e);$err("-",t)};$op_func+="";var $ops={"&":"and","|":"or","^":"xor"};for(var $op in $ops){var opf=$op_func.replace(/-/gm,$op);opf=opf.replace(new RegExp("sub","gm"),$ops[$op]),eval("int.__"+$ops[$op]+"__ = "+opf)}var $op_func=function(e,t){if(_b_.isinstance(t,int)){if("number"==typeof(t=int_value(t))){var r=e.valueOf()-t.valueOf();return r>$B.min_int&&r<$B.max_int?r:$B.long_int.__sub__($B.long_int.$factory(e),$B.long_int.$factory(t))}return"boolean"==typeof t?t?e-1:e:$B.long_int.__sub__($B.long_int.$factory(e),$B.long_int.$factory(t))}if(_b_.isinstance(t,_b_.float))return new Number(e-t);if(_b_.isinstance(t,_b_.complex))return $B.make_complex(e-t.$real,-t.$imag);if(_b_.isinstance(t,_b_.bool)){var n=0;return t.valueOf()&&(n=1),e-n}if(_b_.isinstance(t,_b_.complex))return $B.make_complex(e.valueOf()-t.$real,t.$imag);var s=$B.$getattr(t,"__rsub__",_b_.None);if(s!==_b_.None)return s(e);throw $err("-",t)};$op_func+="";var $ops={"+":"add","-":"sub"};for(var $op in $ops){var opf=$op_func.replace(/-/gm,$op);opf=opf.replace(new RegExp("sub","gm"),$ops[$op]),eval("int.__"+$ops[$op]+"__ = "+opf)}var $comp_func=function(e,t){return t.__class__===$B.long_int?$B.long_int.__lt__(t,$B.long_int.$factory(e)):_b_.isinstance(t,int)?(t=int_value(t),e.valueOf()>t.valueOf()):_b_.isinstance(t,_b_.float)?e.valueOf()>t.valueOf():_b_.isinstance(t,_b_.bool)?e.valueOf()>_b_.bool.__hash__(t):_b_.hasattr(t,"__int__")||_b_.hasattr(t,"__index__")?int.__gt__(e,$B.$GetInt(t)):_b_.NotImplemented};for(var $op in $comp_func+="",$B.$comps)eval("int.__"+$B.$comps[$op]+"__ = "+$comp_func.replace(/>/gm,$op).replace(/__gt__/gm,"__"+$B.$comps[$op]+"__").replace(/__lt__/,"__"+$B.$inv_comps[$op]+"__"));$B.make_rmethods(int);var $valid_digits=function(e){var t="";if(0===e)return"0";if(e<10){for(var r=0;r<e;r++)t+=String.fromCharCode(r+48);return t}for(t="0123456789",r=10;r<e;r++)t+=String.fromCharCode(r+55);return t};int.$factory=function(e,t){if(void 0===e)return 0;if("number"==typeof e&&(void 0===t||10==t))return parseInt(e);if(_b_.isinstance(e,_b_.complex))throw _b_.TypeError.$factory("can't convert complex to int");var r=$B.args("int",2,{x:null,base:null},["x","base"],arguments,{base:10},null,null);e=r.x,t=r.base;if(_b_.isinstance(e,_b_.float)&&10==t)return e<$B.min_int||e>$B.max_int?$B.long_int.$from_float(e):e>0?Math.floor(e):Math.ceil(e);if(!(t>=2&&t<=36)&&0!=t)throw _b_.ValueError.$factory("invalid base");if("number"==typeof e){if(10==t)return e<$B.min_int||e>$B.max_int?$B.long_int.$factory(e):e;if(e.toString().search("e")>-1)throw _b_.OverflowError.$factory("can't convert to base "+t);var n=parseInt(e,t);return e<$B.min_int||e>$B.max_int?$B.long_int.$factory(e,t):n}if(!0===e)return Number(1);if(!1===e)return Number(0);if(e.__class__===$B.long_int){var s=parseInt(e.value);return s>$B.min_int&&s<$B.max_int?s:e}function a(e,t){throw _b_.ValueError.$factory("invalid literal for int() with base "+t+": '"+_b_.str.$factory(e)+"'")}if(t=$B.$GetInt(t),_b_.isinstance(e,_b_.str)&&(e=e.valueOf()),"string"==typeof e){var i=e.trim();if(2==i.length&&0==t&&("0b"==i||"0o"==i||"0x"==i))throw _b_.ValueError.$factory("invalid value");if(i.length>2){var o=i.substr(0,2).toUpperCase();if(0==t?("0B"==o&&(t=2),"0O"==o&&(t=8),"0X"==o&&(t=16)):"0X"==o&&16!=t?a(i,t):"0O"==o&&8!=t&&a(i,t),"0B"==o&&2==t||"0O"==o||"0X"==o)for(i=i.substr(2);i.startsWith("_");)i=i.substr(1)}else 0==t&&(t=10);var _=$valid_digits(t);return null===new RegExp("^[+-]?["+_+"]["+_+"_]*$","i").exec(i)?a(e,t):e=i.replace(/_/g,""),t<=10&&!isFinite(e)&&a(i,t),(n=parseInt(e,t))<$B.min_int||n>$B.max_int?$B.long_int.$factory(e,t):n}if(_b_.isinstance(e,[_b_.bytes,_b_.bytearray]))return int.$factory($B.$getattr(e,"decode")("latin-1"),t);var l=$B.to_num(e,["__int__","__index__","__trunc__"]);if(null===l)throw _b_.TypeError.$factory("int() argument must be a string, a bytes-like object or a number, not '"+$B.class_name(e)+"'");return l},$B.set_func_names(int,"builtins"),_b_.int=int,$B.$bool=function(e){if(null==e)return!1;switch(typeof e){case"boolean":return e;case"number":case"string":return!!e;default:if(e.$is_class)return!0;var t=e.__class__||$B.get_class(e),r={},n=$B.$getattr(t,"__bool__",r);if(n!==r){var s=$B.$call(n)(e);if(!0!==s&&!1!==s)throw _b_.TypeError.$factory("__bool__ should return bool, returned "+$B.class_name(s));return s}try{return _b_.len(e)>0}catch(e){return!0}}};var bool={__bases__:[int],__class__:_b_.type,__mro__:[int,_b_.object],$infos:{__name__:"bool",__module__:"builtins"},$is_class:!0,$native:!0},methods=$B.op2method.subset("operations","binary","comparisons","boolean");for(var op in methods){var method="__"+methods[op]+"__";bool[method]=function(e){return function(t,r){var n=t?1:0;if(void 0!==int[e])return int[e](n,r)}}(method)}bool.__and__=function(e,t){return _b_.isinstance(t,bool)?e&&t:_b_.isinstance(t,int)?int.__and__(bool.__index__(e),int.__index__(t)):_b_.NotImplemented},bool.__hash__=bool.__index__=bool.__int__=function(e){return e.valueOf()?1:0},bool.__neg__=function(e){return-$B.int_or_bool(e)},bool.__or__=function(e,t){return _b_.isinstance(t,bool)?e||t:_b_.isinstance(t,int)?int.__or__(bool.__index__(e),int.__index__(t)):_b_.NotImplemented},bool.__pos__=$B.int_or_bool,bool.__repr__=bool.__str__=function(e){return e?"True":"False"},bool.__setattr__=function(e,t){if(_b_.dir(e).indexOf(t)>-1)var r="attribute '"+t+"' of 'int' objects is not writable";else r="'bool' object has no attribute '"+t+"'";throw _b_.AttributeError.$factory(r)},bool.__xor__=function(e,t){return _b_.isinstance(t,bool)?!!(e^t):_b_.isinstance(t,int)?int.__xor__(bool.__index__(e),int.__index__(t)):_b_.NotImplemented},bool.$factory=function(){var e=$B.args("bool",1,{x:null},["x"],arguments,{x:!1},null,null);return $B.$bool(e.x)},_b_.bool=bool,$B.set_func_names(bool,"builtins")}(__BRYTHON__),function($B){var bltns=$B.InjectBuiltins();eval(bltns);var long_int={__class__:_b_.type,__mro__:[int,object],$infos:{__module__:"builtins",__name__:"int"},$is_class:!0,$native:!0,$descriptors:{numerator:!0,denominator:!0,imag:!0,real:!0}};function add_pos(e,t){if(window.BigInt)return{__class__:long_int,value:(BigInt(e)+BigInt(t)).toString(),pos:!0};for(var r,n="",s=0,a=e.length,i=t.length-1;i>=0;i--)2==(r=(s+(--a<0?0:parseInt(e.charAt(a)))+parseInt(t.charAt(i))).toString()).length?(n=r.charAt(1)+n,s=parseInt(r.charAt(0))):(n=r+n,s=0);for(;a>0;)a--,2==(r=(s+parseInt(e.charAt(a))).toString()).length?(n=r.charAt(1)+n,s=parseInt(r.charAt(0))):(n=r+n,s=0);return s&&(n=s+n),{__class__:long_int,value:n,pos:!0}}var len=(Math.pow(2,53)-1+"").length-1;function binary(e){for(var t,r,n,s,a=Math.ceil(e.length/len),i=[],o=[],_=0;_<a;_++)n=(t=e.length-(_+1)*len)-(r=Math.max(0,t)),i.push(e.substr(r,len+n));(i=i.reverse()).forEach(function(e,t){i[t]=parseInt(e)});for(var l=Math.pow(10,15);i[i.length-1]>0;)i.forEach(function(e,t){s=e%2,i[t]=Math.floor(e/2),s&&t<i.length-1&&(i[t+1]+=l)}),o.push(s),0==i[0]&&i.shift();return o=o.reverse().join("")}function check_shift(e){if(!isinstance(e,long_int))throw TypeError.$factory("shift must be int, not '"+$B.class_name(e)+"'");if(!e.pos)throw ValueError.$factory("negative shift count")}function clone(e){var t={};for(var r in e)t[r]=e[r];return t}function comp_pos(e,t){return e.length>t.length?1:e.length<t.length?-1:e>t?1:e<t?-1:0}function divmod_by_safe_int(e,t){if(1==t)return[e,0];for(var r,n,s,a=(Math.floor((Math.pow(2,53)-1)/t)+"").length-1,i=Math.ceil(e.length/a),o=[],_=0;_<i;_++)s=(r=e.length-(_+1)*a)-(n=Math.max(0,r)),o.push(e.substr(n,a+s));(o=o.reverse()).forEach(function(e,t){o[t]=parseInt(e)});var l,c,u=Math.pow(10,a);for(o.forEach(function(e,r){l=e%t,o[r]=Math.floor(e/t),r<o.length-1&&(o[r+1]+=u*l)});0==o[0];)if(o.shift(),0==o.length)return[0,l];return c=o[0]+"",o.forEach(function(e,t){t>0&&(c+="0".repeat(a-e.toString().length)+e)}),[c,l]}function divmod_pos(e,t){if(window.BigInt)return[{__class__:long_int,value:(BigInt(e)/BigInt(t)).toString(),pos:!0},{__class__:long_int,value:(BigInt(e)%BigInt(t)).toString(),pos:!0}];var r,n=parseInt(e),s=parseInt(t);if(n<$B.max_int&&s<$B.max_int){var a=n%s,i=Math.floor(n/s).toString();return[{__class__:long_int,value:i.toString(),pos:!0},{__class__:long_int,value:a.toString(),pos:!0}]}if(s<$B.max_int){var o=divmod_by_safe_int(e,s);return[long_int.$factory(o[0]),long_int.$factory(o[1])]}if(-1==comp_pos(e,t))_="0",r=long_int.$factory(e);else if(t==e)_="1",r=long_int.$factory("0");else{var _="",l=e.substr(0,t.length);e<t&&(l=e.substr(0,t.length+1));for(var c=e.substr(l.length),u={};;){var f=Math.floor(parseInt(l)/parseInt(t))+"";if("10"==f&&(f="9"),void 0===u[f]&&(u[f]=mul_pos(t,f).value),-1==comp_pos(l,u[f])&&void 0===u[--f]&&(u[f]=mul_pos(t,f).value),_+=f,l=sub_pos(l,u[f]).value,0==c.length)break;l+=c.charAt(0),c=c.substr(1)}r=sub_pos(e,mul_pos(_,t).value)}return[long_int.$factory(_),r]}function split_chunks(e,t){for(var r=Math.ceil(e.length/t),n=[],s=e.length,a=0;a<r;a++){var i=s-t*(a+1);i<0&&(t+=i,i=0),n.push(parseInt(e.substr(i,t)))}return n}function mul_pos(e,t){if(window.BigInt)return{__class__:long_int,value:(BigInt(e)*BigInt(t)).toString(),pos:!0};var r=parseInt(e)*parseInt(t);if(r<$B.max_int)return{__class__:long_int,value:r.toString(),pos:!0};for(var n=split_chunks(e,6),s=split_chunks(t,6),a={},i=n.length+s.length,o=0;o<i-1;o++)a[o]=0;for(o=0;o<n.length;o++)for(var _=0;_<s.length;_++)a[o+_]+=n[o]*s[_];var l;for(o=0;o<i-1;o++){var c=split_chunks(a[o].toString(),6);for(_=1;_<c.length;_++)void 0===a[l=o+_]?(a[l]=parseInt(c[_]),l):a[l]+=parseInt(c[_]);a[o]=c[0]}var u,f="";for(o=0;void 0!==a[o];)u=a[o].toString(),void 0!==a[o+1]&&(u="0".repeat(6-u.length)+u),f=u+f,o++;try{return long_int.$factory(f)}catch(r){throw console.log(e,t,a,f),r}}function sub_pos(e,t){if(window.BigInt)return{__class__:long_int,value:(BigInt(e)-BigInt(t)).toString(),pos:!0};for(var r,n="",s=0,a=e.length,i=0,o=t.length-1;o>=0;o--)a--,r=(i=parseInt(e.charAt(a)))-s-parseInt(t.charAt(o)),isNaN(r)&&console.log("x is NaN",e.length,t.length,o,a,i,s,o,t.charAt(o)),r<0?(n=10+r+n,s=1):(n=r+n,s=0);for(n.startsWith("NaN")&&alert(n);a>0;)a--,(r=parseInt(e.charAt(a))-s)<0?(n=10+r+n,s=1):(n=r+n,s=0);for(;"0"==n.charAt(0)&&n.length>1;)n=n.substr(1);return n.startsWith("NaN")&&console.log("hoho !!",e,t,e>=t,n),{__class__:long_int,value:n,pos:!0}}function digits(e){for(var t={},r=0;r<e&&10!=r;r++)t[r]=!0;if(e>10)for(r=0;r<e-10;r++)t[String.fromCharCode(65+r)]=!0,t[String.fromCharCode(97+r)]=!0;return t}long_int.$from_float=function(e){var t=Math.abs(e).toString(),r=t;if(t.search("e")>-1){var n=/-?(\d)(\.\d+)?e([+-])(\d*)/.exec(t),s=n[1],a=n[2],i=n[3],o=n[4];"+"==i&&(r=void 0===a?s+"0".repeat(o-1):s+a+"0".repeat(o-1-a.length))}return{__class__:long_int,value:r,pos:e>=0}},long_int.__abs__=function(e){return{__class__:long_int,value:e.value,pos:!0}},long_int.__add__=function(e,t){if(isinstance(t,_b_.float))return _b_.float.$factory(parseInt(e.value)+t.value);if("number"==typeof t)t=long_int.$factory(_b_.str.$factory(t));else if(t.__class__!==long_int)if(isinstance(t,_b_.bool))t=long_int.$factory(t?1:0);else{if(!isinstance(t,int))return _b_.NotImplemented;t=long_int.$factory(_b_.str.$factory(_b_.int.__index__(t)))}var r;if(e.pos&&t.pos)return add_pos(e.value,t.value);if(e.pos||t.pos){if(e.pos&&!t.pos){switch(comp_pos(e.value,t.value)){case 1:r=sub_pos(e.value,t.value);break;case 0:r={__class__:long_int,value:0,pos:!0};break;case-1:(r=sub_pos(t.value,e.value)).pos=!1}return intOrLong(r)}switch(comp_pos(e.value,t.value)){case 1:(r=sub_pos(e.value,t.value)).pos=!1;break;case 0:r={__class__:long_int,value:0,pos:!0};break;case-1:r=sub_pos(t.value,e.value)}return intOrLong(r)}return(r=add_pos(e.value,t.value)).pos=!1,intOrLong(r)},long_int.__and__=function(e,t){"number"==typeof t&&(t=long_int.$factory(_b_.str.$factory(t)));for(var r,n,s=e.value,a=t.value,i="";;){if(r=divmod_by_safe_int(s,2),n=divmod_by_safe_int(a,2),i=("1"==r[1]&&"1"==n[1]?"1":"0")+i,s=r[0],a=n[0],"0"==s){var o=intOrLong(long_int.$factory(i,2));break}if("0"==a){o=intOrLong(long_int.$factory(i,2));break}}return o},long_int.__divmod__=function(e,t){"number"==typeof t&&(t=long_int.$factory(_b_.str.$factory(t)));var r=divmod_pos(e.value,t.value);return e.pos!==t.pos&&("0"!=r[0].value&&(r[0].pos=!1),"0"!=r[1].value&&(r[0]=long_int.__sub__(r[0],long_int.$factory("1")),r[1]=long_int.__sub__(e,long_int.__mul__(t,long_int.$factory(r[0]))))),$B.fast_tuple([intOrLong(r[0]),intOrLong(r[1])])},long_int.__eq__=function(e,t){return"number"==typeof t&&(t=long_int.$factory(_b_.str.$factory(t))),e.value==t.value&&e.pos==t.pos},long_int.__float__=function(e){return new Number(parseFloat(e.value))},long_int.__floordiv__=function(e,t){if(isinstance(t,_b_.float))return _b_.float.$factory(parseInt(e.value)/t);if("number"==typeof t){var r=divmod_by_safe_int(e.value,t),n=t>0?e.pos:!e.pos;return{__class__:long_int,value:r[0],pos:n}}return intOrLong(long_int.__divmod__(e,t)[0])},long_int.__ge__=function(e,t){return"number"==typeof t&&(t=long_int.$factory(_b_.str.$factory(t))),e.pos!=t.pos?!t.pos:e.value.length>t.value.length?e.pos:e.value.length<t.value.length?!e.pos:e.pos?e.value>=t.value:e.value<=t.value},long_int.__gt__=function(e,t){return!long_int.__le__(e,t)},$B.nb_index=0,long_int.__index__=function(e){$B.nb_index+=1;for(var t,r="",n=e.value;r=(t=divmod_pos(n,"2"))[1].value+r,"0"!=(n=t[0].value););if(e.pos)r="0"+r;else{for(var s="",a=!1,i=r.length-1;i>=0;i--){"0"==r.charAt(i)?s=a?"1"+s:"0"+s:a?s="0"+s:(a=!0,s="1"+s)}r=s="1"+s}return intOrLong(r)},long_int.__invert__=function(e){return long_int.__sub__(long_int.$factory("-1"),e)},long_int.__le__=function(e,t){return"number"==typeof t&&(t=long_int.$factory(_b_.str.$factory(t))),e.pos!==t.pos?!e.pos:e.value.length>t.value.length?!e.pos:e.value.length<t.value.length?e.pos:e.pos?e.value<=t.value:e.value>=t.value},long_int.__lt__=function(e,t){return!long_int.__ge__(e,t)},long_int.__lshift__=function(e,t){if(window.BigInt)return t.__class__==long_int&&(t=t.value),intOrLong({__class__:long_int,value:(BigInt(e.value)<<BigInt(t)).toString(),pos:e.pos});var r;if(t.__class__===long_int){var n=parseInt(t.value);if(n<0)throw _b_.ValueError.$factory("negative shift count");n<$B.max_int&&(r=!0,t=n)}if(r){if(0==n)return e}else if("0"==(t=long_int.$factory(t)).value)return e;for(var s=e.value;;){for(var a,i=0,o="",_=s.length-1;_>=0;_--)2==(a=(i+2*parseInt(s.charAt(_))).toString()).length?(o=a.charAt(1)+o,i=parseInt(a.charAt(0))):(o=a+o,i=0);if(i&&(o=i+o),s=o,r){if(0==--t)break}else if("0"==(t=sub_pos(t.value,"1")).value)break}return intOrLong({__class__:long_int,value:s,pos:e.pos})},long_int.__mod__=function(e,t){return intOrLong(long_int.__divmod__(e,t)[1])},long_int.__mro__=[_b_.int,_b_.object],long_int.__mul__=function(e,t){switch(e){case Number.NEGATIVE_INFINITY:case Number.POSITIVE_INFINITY:return $B.rich_comp("__eq__",t,0)?NaN:_b_.getattr(t,"__gt__")(0)?e:-e}if(isinstance(t,_b_.float))return _b_.float.$factory(parseInt(e.value)*t);if(other_value=t.value,other_pos=t.pos,t.__class__!==long_int&&isinstance(t,int)){var r=int.__index__(t);other_value=_b_.str.$factory(r),other_pos=r>0}var n=mul_pos(e.value,other_value);return e.pos==other_pos?intOrLong(n):(n.pos=!1,intOrLong(n))},long_int.__neg__=function(e){return{__class__:long_int,value:e.value,pos:!e.pos}},long_int.__or__=function(e,t){t=long_int.$factory(t);var r=long_int.__index__(e),n=long_int.__index__(t);if(r.length<n.length){var s=n;n=r,r=s}for(var a=r.length-n.length,i=r.substr(0,a),o=0;o<n.length;o++)"1"==r.charAt(a+o)||"1"==n.charAt(o)?i+="1":i+="0";return intOrLong(long_int.$factory(i,2))},long_int.__pos__=function(e){return e},long_int.__pow__=function(e,t,r){if("number"==typeof t)t=long_int.$factory(_b_.str.$factory(t));else if(isinstance(t,int))t=long_int.$factory(_b_.str.$factory(_b_.int.__index__(t)));else if(!isinstance(t,long_int)){throw TypeError.$factory("power must be an integer, not '"+$B.class_name(t)+"'")}if(!t.pos)return"1"==e.value?e:long_int.$factory("0");if("0"==t.value)return long_int.$factory("1");if(window.BigInt){var n=BigInt(e.value),s=BigInt(1),a=BigInt(t.value);for(r=void 0===r?r:"number"==typeof r?BigInt(r):BigInt(r.value);a>0;)a%BigInt(2)==1&&(s*=n),(a/=BigInt(2))>0&&(n*=n),void 0!==r&&(s%=r);return{__class__:long_int,value:s.toString(),pos:!0}}s={__class__:long_int,value:"1",pos:!0},n=e;for(var i,o=t.value;"string"==typeof o&&parseInt(o)<$B.max_int&&(o=parseInt(o)),0!=o;)"string"==typeof o?(parseInt(o.charAt(o.length-1))%2==1&&(s=long_int.__mul__(s,n)),o=long_int.__floordiv__(o,2)):(o%2==1&&(s="number"==typeof s&&"number"==typeof n&&(i=s*n)<$B.max_int?i:long_int.__mul__(long_int.$factory(s),long_int.$factory(n))),o=Math.floor(o/2)),o>0&&("number"==typeof n&&(i=n*n)<$B.max_int?n=i:(n=long_int.$factory(n),n=long_int.__mul__(n,n))),void 0!==r&&(s=long_int.__mod__(s,r));return intOrLong(s)},long_int.__rshift__=function(e,t){if(window.BigInt)return t.__class__===long_int&&(t=t.value),intOrLong({__class__:long_int,value:(BigInt(e.value)>>BigInt(t)).toString(),pos:e.pos});if("number"==typeof t){var r=Math.pow(2,t);if(r<$B.max_int){var n=divmod_by_safe_int(e.value,r);return intOrLong({__class__:long_int,value:n[0],pos:e.pos})}}if("0"==(t=long_int.$factory(t)).value)return e;for(n=e.value;"0"!=(n=divmod_pos(n,"2")[0].value).value&&"0"!=(t=sub_pos(t.value,"1")).value;);return intOrLong({__class__:long_int,value:n,pos:e.pos})},long_int.__str__=long_int.__repr__=function(e){var t="";return e.pos||(t+="-"),t+e.value},long_int.__sub__=function(e,t){if(isinstance(t,_b_.float))return t=t instanceof Number?t:t.$brython_value,_b_.float.$factory(parseInt(e.value)-t);var r;if("number"==typeof t&&(t=long_int.$factory(_b_.str.$factory(t))),e.pos&&t.pos){switch(comp_pos(e.value,t.value)){case 1:r=sub_pos(e.value,t.value);break;case 0:r={__class__:long_int,value:"0",pos:!0};break;case-1:(r=sub_pos(t.value,e.value)).pos=!1}return intOrLong(r)}if(e.pos||t.pos)return e.pos&&!t.pos?intOrLong(add_pos(e.value,t.value)):((r=add_pos(e.value,t.value)).pos=!1,intOrLong(r));switch(comp_pos(e.value,t.value)){case 1:(r=sub_pos(e.value,t.value)).pos=!1;break;case 0:r={__class__:long_int,value:"0",pos:!0};break;case-1:r=sub_pos(t.value,e.value)}return intOrLong(r)},long_int.__truediv__=function(e,t){if(isinstance(t,long_int))return _b_.float.$factory(parseInt(e.value)/parseInt(t.value));if(isinstance(t,_b_.int))return _b_.float.$factory(parseInt(e.value)/t);if(isinstance(t,_b_.float))return _b_.float.$factory(parseInt(e.value)/t);throw TypeError.$factory("unsupported operand type(s) for /: 'int' and '"+$B.class_name(t)+"'")},long_int.__xor__=function(e,t){t=long_int.$factory(t);var r=long_int.__index__(e),n=long_int.__index__(t);if(r.length<n.length){var s=n;n=r,r=s}for(var a=r.length-n.length,i=r.substr(0,a),o=0;o<n.length;o++)"1"==r.charAt(a+o)&&"0"==n.charAt(o)?i+="1":"0"==r.charAt(a+o)&&"1"==n.charAt(o)?i+="1":i+="0";return intOrLong(long_int.$factory(i,2))},long_int.numerator=function(e){return e},long_int.denominator=function(e){return _b_.int.$factory(1)},long_int.imag=function(e){return _b_.int.$factory(0)},long_int.real=function(e){return e},long_int.to_base=function(e,t){if(2==t)return binary(e.value);for(var r="",n=e.value;n>0;){var s=divmod_pos(n,t.toString());if(r=parseInt(s[1].value).toString(t)+r,0==(n=s[0].value))break}return r};var MAX_SAFE_INTEGER=Math.pow(2,53)-1,MIN_SAFE_INTEGER=-MAX_SAFE_INTEGER;function isSafeInteger(e){return"number"==typeof e&&Math.round(e)===e&&MIN_SAFE_INTEGER<=e&&e<=MAX_SAFE_INTEGER}function intOrLong(e){var t=parseInt(e.value)*(e.pos?1:-1);return t>MIN_SAFE_INTEGER&&t<MAX_SAFE_INTEGER?t:e}long_int.$factory=function(e,t){if(arguments.length>2)throw _b_.TypeError.$factory("long_int takes at most 2 arguments ("+arguments.length+" given)");if(void 0===t)t=10;else if(!isinstance(t,int))throw TypeError.$factory("'"+$B.class_name(t)+"' object cannot be interpreted as an integer");if(t<0||1==t||t>36)throw ValueError.$factory("long_int.$factory() base must be >= 2 and <= 36");if(isinstance(e,_b_.float)){if(e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY)return e;e=e>=0?new Number(Math.round(e.value)):new Number(Math.ceil(e.value))}else if(isinstance(e,_b_.bool))return e.valueOf()?int.$factory(1):int.$factory(0);if("number"==typeof e)if(isSafeInteger(e))e=e.toString();else{if(e.constructor!=Number)throw ValueError.$factory("argument of long_int is not a safe integer");e=e.toString()}else{if(e.__class__===long_int)return e;if(isinstance(e,int))e=e.$brython_value+"";else if(isinstance(e,_b_.bool))e=_b_.bool.__int__(e)+"";else if("string"!=typeof e)throw ValueError.$factory("argument of long_int must be a string, not "+$B.class_name(e))}for(var r=!1,n=!0,s=0;" "==e.charAt(0)&&e.length;)e=e.substr(1);for(;" "==e.charAt(e.length-1)&&e.length;)e=e.substr(0,e.length-1);if("+"==e.charAt(0)?r=!0:"-"==e.charAt(0)&&(r=!0,n=!1),r){if(1==e.length)throw ValueError.$factory('long_int argument is not a valid number: "'+e+'"');e=e.substr(1)}for(;s<e.length-1&&"0"==e.charAt(s);)s++;e=e.substr(s);for(var a=digits(t),i=-1,o=0;o<e.length;o++)if("."==e.charAt(o)&&-1==i)i=o;else{if("e"==e.charAt(o)){var _=e.substr(0,o);if(!/^[+-]?\d+$/.exec(e.substr(o+1)))throw Error("wrong exp "+e.substr(o+1));exp=parseInt(e.substr(o+1)),-1!=i&&(_=_.substr(0,i)+_.substr(i+1),exp=exp+i-1),i=-1,e=_+"0".repeat(exp-_.length);break}if(!a[e.charAt(o)])throw ValueError.$factory('long_int argument is not a valid number: "'+e+'"')}if(-1!=i&&(e=e.substr(0,i)),10!=t){for(var l="1",c=long_int.$factory(0),u=e.length;u--;){var f=mul_pos(l,parseInt(e.charAt(u),t).toString()).value;c=add_pos(c.value,f),l=mul_pos(l,t.toString()).value}return c}return{__class__:long_int,value:e,pos:n}},$B.set_func_names(long_int,"builtins"),$B.long_int=long_int}(__BRYTHON__),function($B){var _b_=$B.builtins;function $UnsupportedOpType(e,t,r){throw _b_.TypeError.$factory("unsupported operand type(s) for "+e+": '"+t+"' and '"+r+"'")}var complex={__class__:_b_.type,__dir__:_b_.object.__dir__,$infos:{__module__:"builtins",__name__:"complex"},$is_class:!0,$native:!0,$descriptors:{real:!0,imag:!0}};function complex2expo(e){var t=Math.sqrt(e.$real*e.$real+e.$imag*e.$imag),r=e.$imag/t,n=e.$real/t;return{norm:t,angle:0==n?1==r?Math.PI/2:3*Math.PI/2:0==r?1==n?0:Math.PI:Math.atan(r/n)}}complex.__abs__=function(e){var t=isFinite(e.$real),r=isFinite(e.$imag);if(t&&isNaN(e.$imag)||r&&isNaN(e.$real)||isNaN(e.$imag)&&isNaN(e.$real))return NaN;if(!t||!r)return 1/0;var n=Math.sqrt(Math.pow(e.$real,2)+Math.pow(e.$imag,2));if(!isFinite(n)&&t&&r)throw _b_.OverflowError.$factory("absolute value too large");return n},complex.__bool__=function(e){return 0!=e.$real||0!=e.$imag},complex.__eq__=function(e,t){return _b_.isinstance(t,complex)?e.$real.valueOf()==t.$real.valueOf()&&e.$imag.valueOf()==t.$imag.valueOf():_b_.isinstance(t,_b_.int)?0==e.$imag&&e.$real==t.valueOf():_b_.isinstance(t,_b_.float)?0==e.$imag&&e.$real==t.valueOf():_b_.NotImplemented},complex.__floordiv__=function(e,t){$UnsupportedOpType("//","complex",$B.get_class(t))},complex.__hash__=function(e){return 1000003*e.$imag+e.$real},complex.__init__=function(){return _b_.None},complex.__invert__=function(e){return~e},complex.__mod__=function(e,t){throw _b_.TypeError.$factory("TypeError: can't mod complex numbers.")},complex.__mro__=[_b_.object],complex.__mul__=function(e,t){return _b_.isinstance(t,complex)?make_complex(e.$real*t.$real-e.$imag*t.$imag,e.$imag*t.$real+e.$real*t.$imag):_b_.isinstance(t,_b_.int)?make_complex(e.$real*t.valueOf(),e.$imag*t.valueOf()):_b_.isinstance(t,_b_.float)?make_complex(e.$real*t,e.$imag*t):_b_.isinstance(t,_b_.bool)?t.valueOf()?e:make_complex(0,0):void $UnsupportedOpType("*",complex,t)},complex.__ne__=function(e,t){var r=complex.__eq__(e,t);return r===_b_.NotImplemented?r:!r},complex.__neg__=function(e){return make_complex(-e.$real,-e.$imag)},complex.__new__=function(e){if(void 0===e)throw _b_.TypeError.$factory("complex.__new__(): not enough arguments");var t={},r=$B.args("complex",3,{cls:null,real:null,imag:null},["cls","real","imag"],arguments,{real:0,imag:t},null,null),n=r.real,s=r.imag;if("string"==typeof n){if(s!==t)throw _b_.TypeError.$factory("complex() can't take second arg if first is a string");{var a=n;(n=n.trim()).startsWith("(")&&n.endsWith(")")&&(n=(n=n.substr(1)).substr(0,n.length-1));var i=/^\s*([\+\-]*[0-9_]*\.?[0-9_]*(e[\+\-]*[0-9_]*)?)([\+\-]?)([0-9_]*\.?[0-9_]*(e[\+\-]*[0-9_]*)?)(j?)\s*$/i.exec(n);function o(e){var t=parseFloat(e.charAt(0)+e.substr(1).replace(/_/g,""));if(isNaN(t))throw _b_.ValueError.$factory("could not convert string to complex: '"+a+"'");return t}if(null===i)throw _b_.ValueError.$factory("complex() arg is a malformed string");if("."==i[_real]||"."==i[_imag]||".e"==i[_real]||".e"==i[_imag]||"e"==i[_real]||"e"==i[_imag])throw _b_.ValueError.$factory("complex() arg is a malformed string");return""!=i[_j]?""==i[_sign]?(n=0,s="+"==i[_real]||""==i[_real]?1:"-"==i[_real]?-1:o(i[_real])):(n=o(i[_real]),s=""==i[_imag]?1:o(i[_imag]),s="-"==i[_sign]?-s:s):(n=o(i[_real]),s=0),{__class__:complex,$real:n||0,$imag:s||0}}}if(s=s===t?0:s,1==arguments.length&&n.__class__===complex&&0==s)return n;if(_b_.isinstance(n,[_b_.float,_b_.int])&&_b_.isinstance(s,[_b_.float,_b_.int]))return{__class__:complex,$real:n,$imag:s};var _=$B.to_num(n,["__complex__","__float__","__index__"]);if(null===_)throw _b_.TypeError.$factory("complex() first argument must be a string or a number, not '"+$B.class_name(n)+"'");if(n=_,s=_convert(s),!_b_.isinstance(n,_b_.float)&&!_b_.isinstance(n,_b_.int)&&!_b_.isinstance(n,_b_.complex))throw _b_.TypeError.$factory("complex() argument must be a string or a number");if("string"==typeof s)throw _b_.TypeError.$factory("complex() second arg can't be a string");if(!_b_.isinstance(s,_b_.float)&&!_b_.isinstance(s,_b_.int)&&!_b_.isinstance(s,_b_.complex)&&s!==t)throw _b_.TypeError.$factory("complex() argument must be a string or a number");return s=complex.__mul__(complex.$factory("1j"),s),complex.__add__(s,n)},complex.__pos__=function(e){return e},complex.__pow__=function(e,t){var r=complex2expo(e),n=r.angle,s=Math.pow(r.norm,t);if(_b_.isinstance(t,[_b_.int,_b_.float]))return make_complex(s*Math.cos(n*t),s*Math.sin(n*t));if(_b_.isinstance(t,complex)){var a=t.$real,i=t.$imag,o=Math.pow(r.norm,a)*Math.pow(Math.E,-i*n),_=i*Math.log(r.norm)-a*n;return make_complex(o*Math.cos(_),o*Math.sin(_))}throw _b_.TypeError.$factory("unsupported operand type(s) for ** or pow(): 'complex' and '"+$B.class_name(t)+"'")},complex.__str__=complex.__repr__=function(e){return 0==e.$real?1/e.$real<0?e.$imag<0?"(-0"+e.$imag+"j)":0==e.$imag&&1/e.$imag<0?"(-0-"+e.$imag+"j)":"(-0+"+e.$imag+"j)":0==e.$imag&&1/e.$imag<0?"-"+e.$imag+"j":e.$imag+"j":e.$imag>0?"("+e.$real+"+"+e.$imag+"j)":0==e.$imag?1/e.$imag<0?"("+e.$real+"-"+e.$imag+"j)":"("+e.$real+"+"+e.$imag+"j)":"("+e.$real+"-"+-e.$imag+"j)"},complex.__sqrt__=function(e){if(0==e.$imag)return complex(Math.sqrt(e.$real));var t=e.$real,r=e.$imag,n=Math.sqrt((t+sqrt)/2),s=Number.sign(r)*Math.sqrt((-t+sqrt)/2);return make_complex(n,s)},complex.__truediv__=function(e,t){if(_b_.isinstance(t,complex)){if(0==t.$real&&0==t.$imag)throw _b_.ZeroDivisionError.$factory("division by zero");var r=e.$real*t.$real+e.$imag*t.$imag,n=t.$real*t.$real+t.$imag*t.$imag,s=e.$imag*t.$real-e.$real*t.$imag;return make_complex(r/n,s/n)}if(_b_.isinstance(t,_b_.int)){if(!t.valueOf())throw _b_.ZeroDivisionError.$factory("division by zero");return complex.__truediv__(e,complex.$factory(t.valueOf()))}if(_b_.isinstance(t,_b_.float)){if(!t.valueOf())throw _b_.ZeroDivisionError.$factory("division by zero");return complex.__truediv__(e,complex.$factory(t.valueOf()))}$UnsupportedOpType("//","complex",t.__class__)},complex.conjugate=function(e){return make_complex(e.$real,-e.$imag)};var $op_func=function(e,t){throw _b_.TypeError.$factory("TypeError: unsupported operand type(s) for -: 'complex' and '"+$B.class_name(t)+"'")};$op_func+="";var $ops={"&":"and","|":"ior","<<":"lshift",">>":"rshift","^":"xor"};for(var $op in $ops)eval("complex.__"+$ops[$op]+"__ = "+$op_func.replace(/-/gm,$op));complex.__ior__=complex.__or__;var $op_func=function(e,t){if(_b_.isinstance(t,complex))return make_complex(e.$real-t.$real,e.$imag-t.$imag);if(_b_.isinstance(t,_b_.int))return make_complex($B.sub(e.$real,t.valueOf()),e.$imag);if(_b_.isinstance(t,_b_.float))return make_complex(e.$real-t.valueOf(),e.$imag);if(_b_.isinstance(t,_b_.bool)){var r=0;return t.valueOf()&&(r=1),make_complex(e.$real-r,e.$imag)}throw _b_.TypeError.$factory("unsupported operand type(s) for -: "+e.__repr__()+" and '"+$B.class_name(t)+"'")};complex.__sub__=$op_func,$op_func+="",$op_func=$op_func.replace(/-/gm,"+").replace(/sub/gm,"add"),eval("complex.__add__ = "+$op_func);var $comp_func=function(e,t){if(void 0===t||t==_b_.None)return _b_.NotImplemented;throw _b_.TypeError.$factory("TypeError: no ordering relation is defined for complex numbers")};for(var $op in $comp_func+="",$B.$comps)eval("complex.__"+$B.$comps[$op]+"__ = "+$comp_func.replace(/>/gm,$op));$B.make_rmethods(complex),complex.real=function(e){return new Number(e.$real)},complex.real.setter=function(){throw _b_.AttributeError.$factory("readonly attribute")},complex.imag=function(e){return new Number(e.$imag)},complex.imag.setter=function(){throw _b_.AttributeError.$factory("readonly attribute")};var _real=1,_real_mantissa=2,_sign=3,_imag=4,_imag_mantissa=5,_j=6,type_conversions=["__complex__","__float__","__index__"],_convert=function(e){for(var t=e.__class__||$B.get_class(e),r=0;r<type_conversions.length;r++){var n={},s=$B.$getattr(t,type_conversions[r],n);if(s!==n)return s(e)}return null},make_complex=$B.make_complex=function(e,t){return{__class__:complex,$real:e,$imag:t}};complex.$factory=function(){return complex.__new__(complex,...arguments)},$B.set_func_names(complex,"builtins"),_b_.complex=complex}(__BRYTHON__),function($B){var bltns=$B.InjectBuiltins();eval(bltns);var DEFAULT_MIN_MERGE=32,DEFAULT_MIN_GALLOPING=7,DEFAULT_TMP_STORAGE_LENGTH=256,POWERS_OF_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9];function log10(e){return e<1e5?e<100?e<10?0:1:e<1e4?e<1e3?2:3:4:e<1e7?e<1e6?5:6:e<1e9?e<1e8?7:8:9}function alphabeticalCompare(e,t){if(e===t)return 0;if(~~e===e&&~~t===t){if(0===e||0===t)return e<t?-1:1;if(e<0||t<0){if(t>=0)return-1;if(e>=0)return 1;e=-e,t=-t}al=log10(e),bl=log10(t);var r=0;return al<bl?(e*=POWERS_OF_TEN[bl-al-1],t/=10,r=-1):al>bl&&(t*=POWERS_OF_TEN[al-bl-1],e/=10,r=1),e===t?r:e<t?-1:1}var n=String(e),s=String(t);return n===s?0:n<s?-1:1}function minRunLength(e){for(var t=0;e>=DEFAULT_MIN_MERGE;)t|=1&e,e>>=1;return e+t}function makeAscendingRun(e,t,r,n){var s=t+1;if(s===r)return 1;if(n(e[s++],e[t])<0){for(;s<r&&n(e[s],e[s-1])<0;)s++;reverseRun(e,t,s)}else for(;s<r&&n(e[s],e[s-1])>=0;)s++;return s-t}function reverseRun(e,t,r){for(r--;t<r;){var n=e[t];e[t++]=e[r],e[r--]=n}}function binaryInsertionSort(e,t,r,n,s){for(n===t&&n++;n<r;n++){for(var a=e[n],i=t,o=n;i<o;){var _=i+o>>>1;s(a,e[_])<0?o=_:i=_+1}var l=n-i;switch(l){case 3:e[i+3]=e[i+2];case 2:e[i+2]=e[i+1];case 1:e[i+1]=e[i];break;default:for(;l>0;)e[i+l]=e[i+l-1],l--}e[i]=a}}function gallopLeft(e,t,r,n,s,a){var i=0,o=0,_=1;if(a(e,t[r+s])>0){for(o=n-s;_<o&&a(e,t[r+s+_])>0;)i=_,(_=1+(_<<1))<=0&&(_=o);_>o&&(_=o),i+=s,_+=s}else{for(o=s+1;_<o&&a(e,t[r+s-_])<=0;)i=_,(_=1+(_<<1))<=0&&(_=o);_>o&&(_=o);var l=i;i=s-_,_=s-l}for(i++;i<_;){var c=i+(_-i>>>1);a(e,t[r+c])>0?i=c+1:_=c}return _}function gallopRight(e,t,r,n,s,a){var i=0,o=0,_=1;if(a(e,t[r+s])<0){for(o=s+1;_<o&&a(e,t[r+s-_])<0;)i=_,(_=1+(_<<1))<=0&&(_=o);_>o&&(_=o);var l=i;i=s-_,_=s-l}else{for(o=n-s;_<o&&a(e,t[r+s+_])>=0;)i=_,(_=1+(_<<1))<=0&&(_=o);_>o&&(_=o),i+=s,_+=s}for(i++;i<_;){var c=i+(_-i>>>1);a(e,t[r+c])<0?_=c:i=c+1}return _}var TIM_SORT_ASSERTION="TimSortAssertion",TimSortAssertion=function(e){this.name=TIM_SORT_ASSERTION,this.message=e},TimSort=function(e,t){var r={array:e,compare:t,minGallop:DEFAULT_MIN_GALLOPING,length:e.length,tmpStorageLength:DEFAULT_TMP_STORAGE_LENGTH,stackLength:0,runStart:null,runLength:null,stackSize:0,pushRun:function(e,t){this.runStart[this.stackSize]=e,this.runLength[this.stackSize]=t,this.stackSize+=1},mergeRuns:function(){for(;this.stackSize>1;){var e=this.stackSize-2;if(e>=1&&this.runLength[e-1]<=this.runLength[e]+this.runLength[e+1]||e>=2&&this.runLength[e-2]<=this.runLength[e]+this.runLength[e-1])this.runLength[e-1]<this.runLength[e+1]&&e--;else if(this.runLength[e]>this.runLength[e+1])break;this.mergeAt(e)}},forceMergeRuns:function(){for(;this.stackSize>1;){var e=this.stackSize-2;e>0&&this.runLength[e-1]<this.runLength[e+1]&&e--,this.mergeAt(e)}},mergeAt:function(e){var t=this.compare,r=this.array,n=this.runStart[e],s=this.runLength[e],a=this.runStart[e+1],i=this.runLength[e+1];this.runLength[e]=s+i,e===this.stackSize-3&&(this.runStart[e+1]=this.runStart[e+2],this.runLength[e+1]=this.runLength[e+2]),this.stackSize--;var o=gallopRight(r[a],r,n,s,0,t);n+=o,0!==(s-=o)&&0!==(i=gallopLeft(r[n+s-1],r,a,i,i-1,t))&&(s<=i?this.mergeLow(n,s,a,i):this.mergeHigh(n,s,a,i))},mergeLow:function(e,t,r,n){var s=this.compare,a=this.array,i=this.tmp,o=0;for(o=0;o<t;o++)i[o]=a[e+o];var _=0,l=r,c=e;if(a[c++]=a[l++],0!=--n)if(1!==t){for(var u=this.minGallop;;){var f=0,p=0,d=!1;do{if(s(a[l],i[_])<0){if(a[c++]=a[l++],p++,f=0,0==--n){d=!0;break}}else if(a[c++]=i[_++],f++,p=0,1==--t){d=!0;break}}while((f|p)<u);if(d)break;do{if(0!==(f=gallopRight(a[l],i,_,t,0,s))){for(o=0;o<f;o++)a[c+o]=i[_+o];if(c+=f,_+=f,(t-=f)<=1){d=!0;break}}if(a[c++]=a[l++],0==--n){d=!0;break}if(0!==(p=gallopLeft(i[_],a,l,n,0,s))){for(o=0;o<p;o++)a[c+o]=a[l+o];if(c+=p,l+=p,0===(n-=p)){d=!0;break}}if(a[c++]=i[_++],1==--t){d=!0;break}u--}while(f>=DEFAULT_MIN_GALLOPING||p>=DEFAULT_MIN_GALLOPING);if(d)break;u<0&&(u=0),u+=2}if(this.minGallop=u,u<1&&(this.minGallop=1),1===t){for(o=0;o<n;o++)a[c+o]=a[l+o];a[c+n]=i[_]}else{if(0===t)throw new TimSortAssertion("mergeLow preconditions were not respected");for(o=0;o<t;o++)a[c+o]=i[_+o]}}else{for(var o=0;o<n;o++)a[c+o]=a[l+o];a[c+n]=i[_]}else for(var o=0;o<t;o++)a[c+o]=i[_+o]},mergeHigh:function(e,t,r,n){var s=this.compare,a=this.array,i=this.tmp,o=0;for(o=0;o<n;o++)i[o]=a[r+o];var _=e+t-1,l=n-1,c=r+n-1,u=0,f=0;if(a[c--]=a[_--],0!=--t)if(1!==n){for(var p=this.minGallop;;){var d=0,h=0,$=!1;do{if(s(i[l],a[_])<0){if(a[c--]=a[_--],d++,h=0,0==--t){$=!0;break}}else if(a[c--]=i[l--],h++,d=0,1==--n){$=!0;break}}while((d|h)<p);if($)break;do{if(0!==(d=t-gallopRight(i[l],a,e,t,t-1,s))){t-=d,f=(c-=d)+1,u=(_-=d)+1;for(o=d-1;o>=0;o--)a[f+o]=a[u+o];if(0===t){$=!0;break}}if(a[c--]=i[l--],1==--n){$=!0;break}if(0!==(h=n-gallopLeft(a[_],i,0,n,n-1,s))){n-=h,f=(c-=h)+1,u=(l-=h)+1;for(o=0;o<h;o++)a[f+o]=i[u+o];if(n<=1){$=!0;break}}if(a[c--]=a[_--],0==--t){$=!0;break}p--}while(d>=DEFAULT_MIN_GALLOPING||h>=DEFAULT_MIN_GALLOPING);if($)break;p<0&&(p=0),p+=2}if(this.minGallop=p,p<1&&(this.minGallop=1),1===n){f=(c-=t)+1,u=(_-=t)+1;for(o=t-1;o>=0;o--)a[f+o]=a[u+o];a[c]=i[l]}else{if(0==n)throw new TimSortAssertion("mergeHigh preconditions were not respected");u=c-(n-1);for(o=0;o<n;o++)a[u+o]=i[o]}}else{f=(c-=t)+1,u=(_-=t)+1;for(var o=t-1;o>=0;o--)a[f+o]=a[u+o];a[c]=i[l]}else{u=c-(n-1);for(var o=0;o<n;o++)a[u+o]=i[o]}}};return r.length<2*DEFAULT_TMP_STORAGE_LENGTH&&(r.tmpStorageLength=r.length>>>1),r.tmp=new Array(r.tmpStorageLength),r.stackLength=r.length<120?5:r.length<1542?10:r.length<119151?19:40,r.runStart=new Array(r.stackLength),r.runLength=new Array(r.stackLength),r};function tim_sort(e,t,r,n){if(!Array.isArray(e))throw TypeError.$factory("Can only sort arrays");t?"function"!=typeof t&&(n=r,r=t,t=alphabeticalCompare):t=alphabeticalCompare,r||(r=0),n||(n=e.length);var s=n-r;if(!(s<2)){var a=0;if(s<DEFAULT_MIN_MERGE)binaryInsertionSort(e,r,n,r+(a=makeAscendingRun(e,r,n,t)),t);else{var i=new TimSort(e,t),o=minRunLength(s);do{if((a=makeAscendingRun(e,r,n,t))<o){var _=s;_>o&&(_=o),binaryInsertionSort(e,r,r+_,r+a,t),a=_}i.pushRun(r,a),i.mergeRuns(),s-=a,r+=a}while(0!==s);i.forceMergeRuns()}}}function tim_sort_safe(e,t){try{tim_sort(e,t,0,e.length)}catch(r){if(r.name!=TIM_SORT_ASSERTION)throw r;e.sort(t)}}$B.$TimSort=tim_sort_safe,$B.$AlphabeticalCompare=alphabeticalCompare}(__BRYTHON__),function(e){var t=e.builtins,r=t.object,n=e.$getattr,a=t.isinstance,i=t.None;function o(e,r){if(e.__class__===p)throw t.AttributeError.$factory("'tuple' object has no attribute '"+r+"'")}var _={__class__:t.type,__mro__:[r],$infos:{__module__:"builtins",__name__:"list"},$is_class:!0,$native:!0,__dir__:r.__dir__,__add__:function(r,s){if(e.get_class(r)!==e.get_class(s)){var i=n(s,"__radd__",t.NotImplemented);if(i!==t.NotImplemented)return i(r);throw t.TypeError.$factory('can only concatenate list (not "'+e.class_name(s)+'") to list')}var o=r.slice(),_="js"==s.$brython_class;for(const t of s)o.push(_?e.$JS2Py(t):t);return o.__brython__=!0,a(r,p)&&(o=p.$factory(o)),o},__contains__:function(t,r){for(var n,s=e.args("__contains__",2,{self:null,item:null},["self","item"],arguments,{},null,null),a=(t=s.self,r=s.item,0);a<t.length;){if(n=t[a],e.rich_comp("__eq__",r,n))return!0;a++}return!1},__delitem__:function(e,r){if(a(r,t.int)){var n=r;if(r<0&&(n=e.length+n),n>=0&&n<e.length)return e.splice(n,1),i;throw t.IndexError.$factory("list index out of range")}if(a(r,t.slice)){var s=r.step;s===i&&(s=1);var o=r.start;o===i&&(o=s>0?0:e.length);var l=r.stop;l===i&&(l=s>0?e.length:0),o<0&&(o=e.length+o),l<0&&(l=e.length+l);var c=[],u=null;n=0;if(s>0){if(l>o)for(u=o;u<l;u+=s)void 0!==e[u]&&(c[n++]=u)}else if(l<o){for(u=o;u>l;u+=s)void 0!==e[u]&&(c[n++]=u);c.reverse()}for(u=c.length;u--;)e.splice(c[u],1);return i}if(t.hasattr(r,"__int__")||t.hasattr(r,"__index__"))return _.__delitem__(e,t.int.$factory(r)),i;throw t.TypeError.$factory("list indices must be integer, not "+t.str.$factory(r.__class__))},__eq__:function(r,n){if(a(r,_))var s=_;else s=p;if(a(n,s)&&n.length==r.length){for(var i=r.length;i--;)if(!e.rich_comp("__eq__",r[i],n[i]))return!1;return!0}return t.NotImplemented},__getitem__:function(r,n){var s=e.args("__getitem__",2,{self:null,key:null},["self","key"],arguments,{},null,null),i=(r=s.self,s.key),o=e.get_class(r).$factory;if(a(i,t.int)){var l=r.valueOf(),c=i;if(i<0&&(c=l.length+c),c>=0&&c<l.length)return l[c];throw t.IndexError.$factory("list index out of range")}if(a(i,t.slice)){var u=t.slice.$conv_for_seq(i,r.length),f=[],p=null,d=(l=r.valueOf(),c=0,u.start),h=u.stop,$=u.step;if($>0){if(h<=d)return o(f);for(p=d;p<h;p+=$)f[c++]=l[p];return o(f)}if(h>d)return o(f);for(p=d;p>h;p+=$)f[c++]=l[p];return o(f)}if(t.hasattr(i,"__int__")||t.hasattr(i,"__index__"))return _.__getitem__(r,t.int.$factory(i));throw t.TypeError.$factory("list indices must be integer, not "+e.class_name(i))},__ge__:function(r,s){if(!a(s,[_,t.tuple]))return t.NotImplemented;for(var i=0;i<r.length;){if(i>=s.length)return!0;if(!e.rich_comp("__eq__",r[i],s[i])){if(res=n(r[i],"__ge__")(s[i]),res===t.NotImplemented)throw t.TypeError.$factory("unorderable types: "+e.class_name(r[i])+"() >= "+e.class_name(s[i])+"()");return res}i++}return s.length==r.length},__gt__:function(r,s){if(!a(s,[_,t.tuple]))return t.NotImplemented;for(var i=0;i<r.length;){if(i>=s.length)return!0;if(!e.rich_comp("__eq__",r[i],s[i])){if(res=n(r[i],"__gt__")(s[i]),res===t.NotImplemented)throw t.TypeError.$factory("unorderable types: "+e.class_name(r[i])+"() > "+e.class_name(s[i])+"()");return res}i++}return!1}};_.__hash__=i,_.__iadd__=function(){var r=e.args("__iadd__",2,{self:null,x:null},["self","x"],arguments,{},null,null),s=n(r.x,"__radd__",t.NotImplemented);if(s!==t.NotImplemented)return s(r.self);for(var a=_.$factory(e.$iter(r.x)),i=0;i<a.length;i++)r.self.push(a[i]);return r.self},_.__imul__=function(){var t=e.args("__imul__",2,{self:null,x:null},["self","x"],arguments,{},null,null),r=e.$GetInt(t.x),n=t.self.length,s=n;if(0==r)return _.clear(t.self),t.self;for(var a=1;a<r;a++)for(j=0;j<n;j++)t.self[s++]=t.self[j];return t.self},_.__init__=function(r,s){var a=e.$call(n(r,"__len__")),o=n(r,"pop",i);if(o!==i)for(o=e.$call(o);a();)o();if(void 0===s)return i;s=e.$iter(s);for(var _=e.$call(n(s,"__next__")),l=a();;)try{var c=_();r[l++]=c}catch(e){if(e.__class__===t.StopIteration)break;throw e}return i};var l=e.make_iterator_class("list_iterator");l.__reduce__=l.__reduce_ex__=function(r){return e.fast_tuple([t.iter,e.fast_tuple([_.$factory(r)]),0])},_.__iter__=function(e){return l.$factory(e)},_.__le__=function(e,r){var n=_.__ge__(e,r);return n===t.NotImplemented?n:!n},_.__len__=function(e){return e.length},_.__lt__=function(r,s){if(!a(s,[_,t.tuple]))return t.NotImplemented;for(var i=0;i<r.length;){if(i>=s.length)return!1;if(!e.rich_comp("__eq__",r[i],s[i])){if(res=n(r[i],"__lt__")(s[i]),res===t.NotImplemented)throw t.TypeError.$factory("unorderable types: "+e.class_name(r[i])+"() >= "+e.class_name(s[i])+"()");return res}i++}return s.length>r.length},_.__mul__=function(r,n){if(a(n,t.int)){for(var s=[],i=r.slice(),o=i.length,l=0;l<n;l++)for(var c=0;c<o;c++)s.push(i[c]);return s.__class__=r.__class__,s}if(t.hasattr(n,"__int__")||t.hasattr(n,"__index__"))return _.__mul__(r,t.int.$factory(n));var u=e.$getattr(n,"__rmul__",t.NotImplemented);if(u!==t.NotImplemented)return u(r);throw t.TypeError.$factory("can't multiply sequence by non-int of type '"+e.class_name(n)+"'")},_.__new__=function(e,...r){if(void 0===e)throw t.TypeError.$factory("list.__new__(): not enough arguments");var n=[];return n.__class__=e,n.__brython__=!0,n.__dict__=t.dict.$factory(),n},_.__repr__=function(r){if(e.repr.enter(r))return"[...]";for(var n,s=[],a=0;a<r.length;a++)s.push(t.repr(r[a]));if(r.__class__===p){if(1==r.length)return"("+s[0]+",)";n="("+s.join(", ")+")"}else n="["+s.join(", ")+"]";return e.repr.leave(r),n},_.__setattr__=function(e,r,n){if(e.__class__===_)throw _.hasOwnProperty(r)?t.AttributeError.$factory("'list' object attribute '"+r+"' is read-only"):t.AttributeError.$factory("'list' object has no attribute '"+r+"'");return t.dict.$setitem(e.__dict__,r,n),i},_.__setitem__=function(){var t=e.args("__setitem__",3,{self:null,key:null,value:null},["self","key","value"],arguments,{},null,null),r=t.self,n=t.key,s=t.value;_.$setitem(r,n,s)},_.$setitem=function(r,n,s){if("number"==typeof n||a(n,t.int)){var o=n;if(n<0&&(o=r.length+o),!(o>=0&&o<r.length))throw t.IndexError.$factory("list index out of range");return r[o]=s,i}if(a(n,t.slice)){var l=t.slice.$conv_for_seq(n,r.length);return null===n.step?e.set_list_slice(r,l.start,l.stop,s):e.set_list_slice_step(r,l.start,l.stop,l.step,s),i}if(t.hasattr(n,"__int__")||t.hasattr(n,"__index__"))return _.__setitem__(r,t.int.$factory(n),s),i;throw t.TypeError.$factory("list indices must be integer, not "+e.class_name(n))},e.make_rmethods(_);_.append=function(){var t=e.args("append",2,{self:null,x:null},["self","x"],arguments,{},null,null);return t.self[t.self.length]=t.x,i},_.clear=function(){for(var t=e.args("clear",1,{self:null},["self"],arguments,{},null,null);t.self.length;)t.self.pop();return i},_.copy=function(){return e.args("copy",1,{self:null},["self"],arguments,{},null,null).self.slice()},_.count=function(){for(var t,r=e.args("count",2,{self:null,x:null},["self","x"],arguments,{},null,null),n=0,s=r.self.length;s--;)t=r.self[s],e.rich_comp("__eq__",r.x,t)&&n++;return n},_.extend=function(){for(var t=e.args("extend",2,{self:null,t:null},["self","t"],arguments,{},null,null),r=_.$factory(e.$iter(t.t)),n=0;n<r.length;n++)t.self.push(r[n]);return i},_.index=function(){var r,n={},s=e.args("index",4,{self:null,x:null,start:null,stop:null},["self","x","start","stop"],arguments,{start:0,stop:n},null,null),a=s.self,i=s.start,o=s.stop;i.__class__===e.long_int&&(i=parseInt(i.value)*(i.pos?1:-1)),i<0&&(i=Math.max(0,i+a.length)),o===n?o=a.length:(o.__class__===e.long_int&&(o=parseInt(o.value)*(o.pos?1:-1)),o<0&&(o=Math.min(a.length,o+a.length)),o=Math.min(o,a.length));for(var _=i;_<o;_++)if(r=a[_],e.rich_comp("__eq__",s.x,r))return _;throw t.ValueError.$factory(t.str.$factory(s.x)+" is not in list")},_.insert=function(){var t=e.args("insert",3,{self:null,i:null,item:null},["self","i","item"],arguments,{},null,null);return t.self.splice(t.i,0,t.item),i},_.pop=function(){var r={},n=e.args("pop",2,{self:null,pos:null},["self","pos"],arguments,{pos:r},null,null),s=n.self,a=n.pos;o(s,"pop"),a===r&&(a=s.length-1),(a=e.$GetInt(a))<0&&(a+=s.length);var i=s[a];if(void 0===i)throw t.IndexError.$factory("pop index out of range");return s.splice(a,1),i},_.remove=function(){for(var r=e.args("remove",2,{self:null,x:null},["self","x"],arguments,{},null,null),n=0,s=r.self.length;n<s;n++)if(e.rich_comp("__eq__",r.self[n],r.x))return r.self.splice(n,1),i;throw t.ValueError.$factory(t.str.$factory(r.x)+" is not in list")},_.reverse=function(t){for(var r=e.args("reverse",1,{self:null},["self"],arguments,{},null,null),n=r.self.length-1,s=parseInt(r.self.length/2);s--;){var a=r.self[s];r.self[s]=r.self[n-s],r.self[n-s]=a}return i},_.sort=function(r){var s=e.args("sort",1,{self:null},["self"],arguments,{},null,"kw");o(r,"sort");for(var a=i,_=!1,l=s.kw,c=t.list.$factory(t.dict.$$keys(l)),u=0;u<c.length;u++)if("key"==c[u])a=l.$string_dict[c[u]][0];else{if("reverse"!=c[u])throw t.TypeError.$factory("'"+c[u]+"' is an invalid keyword argument for this function");_=l.$string_dict[c[u]][0]}if(0!=r.length){a!==i&&(a=e.$call(a)),r.$cl=function(t){if(0==t.length)return null;for(var r=e.get_class(t[0]),n=t.length;n--;)if(e.get_class(t[n])!==r)return!1;return r}(r);var f=null;return f=a===i&&r.$cl===t.str?_?function(t,r){return e.$AlphabeticalCompare(r,t)}:function(t,r){return e.$AlphabeticalCompare(t,r)}:a===i&&r.$cl===t.int?_?function(e,t){return t-e}:function(e,t){return e-t}:a===i?_?function(r,s){if(res=n(s,"__lt__")(r),res===t.NotImplemented)throw t.TypeError.$factory("unorderable types: "+e.class_name(r)+"() < "+e.class_name(s)+"()");return res?s==r?0:-1:1}:function(r,s){if(res=n(r,"__lt__")(s),res===t.NotImplemented)throw t.TypeError.$factory("unorderable types: "+e.class_name(r)+"() < "+e.class_name(s)+"()");return res?r==s?0:-1:1}:_?function(r,s){var i=a(s),o=a(r);if(res=n(i,"__lt__")(o),res===t.NotImplemented)throw t.TypeError.$factory("unorderable types: "+e.class_name(r)+"() < "+e.class_name(s)+"()");return res?i==o?0:-1:1}:function(r,n){var s=a(r),i=a(n);if(res=e.$getattr(s,"__lt__")(i),res===t.NotImplemented)throw t.TypeError.$factory("unorderable types: "+e.class_name(r)+"() < "+e.class_name(n)+"()");return res?s==i?0:-1:1},e.$TimSort(r,f),r.__brython__?i:r}},e.$list=function(e){return e.__brython__=!0,e},_.$factory=function(){if(0==arguments.length)return[];var r=e.args("list",1,{obj:null},["obj"],arguments,{},null,null).obj;if(Array.isArray(r))return(r=r.slice()).__brython__=!0,r.__class__==p?((s=r.slice()).__class__=_,s):r;for(var s=[],i=0,o=e.$iter(r),l=e.$call(n(o,"__next__"));;)try{s[i++]=l()}catch(e){if(!a(e,t.StopIteration))throw e;break}return s.__brython__=!0,s},e.set_func_names(_,"builtins");var c=e.JSArray=e.make_class("JSArray",function(e){return{__class__:c,js:e}});function u(e){for(var t=[e[0].js],r=1,n=e.length;r<n;r++)t.push(e[r]);return t}for(var f in c.__repr__=c.__str__=function(){return"<JSArray object>"},_)void 0===e.JSArray[f]&&"function"==typeof _[f]&&(e.JSArray[f]=function(t){return function(){return e.$JS2Py(_[t].apply(null,u(arguments)))}}(f));e.set_func_names(e.JSArray,"builtins");var p={__class__:t.type,__mro__:[r],$infos:{__module__:"builtins",__name__:"tuple"},$is_class:!0,$native:!0},d=e.make_iterator_class("tuple_iterator");for(var f in p.__iter__=function(e){return d.$factory(e)},p.$factory=function(){var e=_.$factory(...arguments);return e.__class__=p,e},e.fast_tuple=function(e){return e.__class__=p,e.__brython__=!0,e.__dict__=t.dict.$factory(),e},_)switch(f){case"__delitem__":case"__iadd__":case"__imul__":case"__setitem__":case"append":case"extend":case"insert":case"remove":case"reverse":break;default:void 0===p[f]&&"function"==typeof _[f]&&(p[f]=function(e){return function(){return _[e].apply(null,arguments)}}(f))}p.__eq__=function(e,t){return void 0===t?e===p:_.__eq__(e,t)},p.__hash__=function(e){for(var r,n=54880137,a=0,i=e.length;a<i;a++){var o=t.hash(e[a]);r=n,s=(parseInt(1000003)*r&4294967295).toString(16),n=parseInt(s.substr(0,s.length-1),16)^4294967295&o}return n},p.__init__=function(){return i},p.__new__=function(r,...s){if(void 0===r)throw t.TypeError.$factory("list.__new__(): not enough arguments");var a=[];a.__class__=r,a.__brython__=!0,a.__dict__=t.dict.$factory();for(var i=e.$iter(s[0]),o=e.$call(n(i,"__next__"));;)try{var _=o();a.push(_)}catch(e){if(e.__class__===t.StopIteration)break;throw e}return a},e.set_func_names(p,"builtins"),t.list=_,t.tuple=p,t.object.__bases__=p.$factory()}(__BRYTHON__);var $B=__BRYTHON__;for(var gc in $B.unicode={Cc:[[0,32],[127,33]],Zs:[32,160,5760,6158,[8192,11],8239,8287,12288],Po:[[33,3],[37,3],[42,3,2],47,58,59,63,64,92,161,183,191,894,903,[1370,6],1417,[1472,3,3],1523,1524,1545,1546,1548,1549,1563,1566,1567,[1642,4],1748,[1792,14],[2039,3],[2096,15],2404,2405,2416,3572,3663,3674,3675,[3844,15],3973,[4048,5],[4170,6],4347,[4961,8],5741,5742,[5867,3],5941,5942,[6100,3],[6104,3],[6144,6],[6151,4],6468,6469,6622,6623,6686,6687,[6816,7],[6824,6],[7002,7],[7227,5],7294,7295,7379,8214,8215,[8224,8],[8240,9],[8251,4],[8257,3],[8263,11],8275,[8277,10],[11513,4],11518,11519,11776,11777,[11782,3],11787,[11790,9],11800,11801,11803,11806,11807,[11818,5],11824,11825,[12289,3],12349,12539,42238,42239,[42509,3],42611,42622,[42738,6],[43124,4],43214,43215,[43256,3],43310,43311,43359,[43457,13],43486,43487,[43612,4],43742,43743,44011,[65040,7],65049,65072,65093,65094,[65097,4],[65104,3],[65108,4],[65119,3],65128,65130,65131,[65281,3],[65285,3],[65290,3,2],65295,65306,65307,65311,65312,65340,65377,65380,65381,65792,65793,66463,66512,67671,67871,67903,[68176,9],68223,[68409,7],69819,69820,[69822,4],[74864,4]],Sc:[36,[162,4],1547,2546,2547,2555,2801,3065,3647,6107,[8352,25],43064,65020,65129,65284,65504,65505,65509,65510],Ps:[40,91,123,3898,3900,5787,8218,8222,8261,8317,8333,9001,[10088,7,2],10181,[10214,5,2],[10627,11,2],10712,10714,10748,[11810,4,2],[12296,5,2],[12308,4,2],12317,64830,65047,[65077,8,2],65095,[65113,3,2],65288,65339,65371,65375,65378],Pe:[41,93,125,3899,3901,5788,8262,8318,8334,9002,[10089,7,2],10182,[10215,5,2],[10628,11,2],10713,10715,10749,[11811,4,2],[12297,5,2],[12309,4,2],12318,12319,64831,65048,[65078,8,2],65096,[65114,3,2],65289,65341,[65373,3,3]],Sm:[43,[60,3],124,126,172,177,215,247,1014,[1542,3],8260,8274,[8314,3],[8330,3],[8512,5],8523,[8592,5],8602,8603,[8608,3,3],8622,8654,8655,8658,8660,[8692,268],[8968,4],8992,8993,9084,[9115,25],[9180,6],9655,9665,[9720,8],9839,[10176,5],[10183,4],10188,[10192,22],[10224,16],[10496,131],[10649,63],[10716,32],[10750,258],[11056,21],[11079,6],64297,65122,[65124,3],65291,[65308,3],65372,65374,65506,[65513,4],120513,120539,120571,120597,120629,120655,120687,120713,120745,120771],Pd:[45,1418,1470,5120,6150,[8208,6],11799,11802,12316,12336,12448,65073,65074,65112,65123,65293],Nd:[[48,10],[1632,10],[1776,10],[1984,10],[2406,10],[2534,10],[2662,10],[2790,10],[2918,10],[3046,10],[3174,10],[3302,10],[3430,10],[3664,10],[3792,10],[3872,10],[4160,10],[4240,10],[6112,10],[6160,10],[6470,10],[6608,11],[6784,10],[6800,10],[6992,10],[7088,10],[7232,10],[7248,10],[42528,10],[43216,10],[43264,10],[43472,10],[43600,10],[44016,10],[65296,10],[66720,10],[120782,50]],Lu:[[65,26],[192,23],[216,7],[256,28,2],[313,8,2],[330,24,2],[377,3,2],385,[386,3,2],391,[393,3],[398,4],403,404,[406,3],412,413,415,[416,4,2],423,425,428,430,431,[433,3],437,439,440,444,[452,4,3],[463,7,2],[478,9,2],497,500,[502,3],[506,29,2],570,571,573,574,577,[579,4],[584,4,2],880,882,886,902,[904,3],908,910,911,[913,17],[931,9],975,[978,3],[984,12,2],1012,1015,1017,1018,[1021,51],[1120,17,2],[1162,28,2],[1217,7,2],[1232,43,2],[1329,38],[4256,38],[7680,75,2],[7838,49,2],[7944,8],[7960,6],[7976,8],[7992,8],[8008,6],[8025,4,2],[8040,8],[8120,4],[8136,4],[8152,4],[8168,5],[8184,4],8450,8455,[8459,3],[8464,3],8469,[8473,5],[8484,4,2],[8491,3],[8496,4],8510,8511,8517,8579,[11264,47],11360,[11362,3],[11367,4,2],[11374,3],11378,11381,[11390,3],[11394,49,2],11499,11501,[42560,16,2],[42594,6,2],[42624,12,2],[42786,7,2],[42802,31,2],[42873,3,2],[42878,5,2],42891,[65313,26],[66560,40],[119808,26],[119860,26],[119912,26],119964,119966,[119967,3,3],119974,[119977,4],[119982,8],[120016,26],120068,120069,[120071,4],[120077,8],[120086,7],120120,120121,[120123,4],[120128,5],120134,[120138,7],[120172,26],[120224,26],[120276,26],[120328,26],[120380,26],[120432,26],[120488,25],[120546,25],[120604,25],[120662,25],[120720,25],120778],Sk:[94,96,168,175,180,184,[706,4],[722,14],[741,7],749,[751,17],885,900,901,8125,[8127,3],[8141,3],[8157,3],[8173,3],8189,8190,12443,12444,[42752,23],42784,42785,42889,42890,65342,65344,65507],Pc:[95,8255,8256,8276,65075,65076,[65101,3],65343],Ll:[[97,26],170,181,186,[223,24],[248,8],[257,28,2],[312,9,2],[329,24,2],[378,3,2],383,384,387,389,392,396,397,402,405,[409,3],414,[417,3,2],424,426,427,429,432,436,438,441,442,[445,3],[454,3,3],[462,8,2],[477,10,2],496,499,501,[505,30,2],[564,6],572,575,576,578,[583,5,2],[592,68],[661,27],881,[883,3,4],892,893,912,[940,35],976,977,[981,3],[985,12,2],[1008,4],[1013,3,3],1020,[1072,48],[1121,17,2],[1163,27,2],[1218,7,2],[1231,44,2],[1377,39],[7424,44],[7522,22],[7545,34],[7681,75,2],[7830,8],[7839,49,2],[7936,8],[7952,6],[7968,8],[7984,8],[8e3,6],[8016,8],[8032,8],[8048,14],[8064,8],[8080,8],[8096,8],[8112,5],8118,8119,8126,[8130,3],8134,8135,[8144,4],8150,8151,[8160,8],[8178,3],8182,8183,8458,8462,8463,8467,[8495,3,5],8508,8509,[8518,4],8526,8580,[11312,47],11361,11365,[11366,4,2],11377,11379,11380,[11382,7],[11393,50,2],11492,11500,11502,[11520,38],[42561,16,2],[42595,6,2],[42625,12,2],[42787,7,2],42800,[42801,33,2],[42866,7],42874,42876,[42879,5,2],42892,[64256,7],[64275,5],[65345,26],[66600,40],[119834,26],[119886,7],[119894,18],[119938,26],[119990,4],119995,[119997,7],[120005,11],[120042,26],[120094,26],[120146,26],[120198,26],[120250,26],[120302,26],[120354,26],[120406,26],[120458,28],[120514,25],[120540,6],[120572,25],[120598,6],[120630,25],[120656,6],[120688,25],[120714,6],[120746,25],[120772,6],120779],So:[166,167,169,174,176,182,1154,1550,1551,1769,1789,1790,2038,2554,2928,[3059,6],3066,3199,3313,3314,3449,[3841,3],[3859,5],[3866,6],[3892,3,2],[4030,8],[4039,6],4046,4047,[4053,4],4254,4255,4960,[5008,10],6464,[6624,32],[7009,10],[7028,9],8448,8449,[8451,4],8456,8457,8468,[8470,3],[8478,6],[8485,3,2],8494,8506,8507,8522,8524,8525,8527,[8597,5],[8604,4],8609,8610,8612,8613,[8615,7],[8623,31],8656,[8657,3,2],[8662,30],[8960,8],[8972,20],[8994,7],[9003,81],[9085,30],[9140,40],[9186,7],[9216,39],[9280,11],[9372,78],[9472,183],[9656,9],[9666,54],[9728,111],[9840,94],[9935,19],9955,[9960,24],[9985,4],[9990,4],[9996,28],[10025,35],10061,[10063,4],[10070,9],[10081,7],10132,[10136,24],[10161,14],[10240,256],[11008,48],11077,11078,[11088,10],[11493,6],[11904,26],[11931,89],[12032,214],[12272,12],12292,12306,12307,12320,12342,12343,12350,12351,12688,12689,[12694,10],[12736,36],[12800,31],[12842,39],[12896,32],[12938,39],[12992,63],[13056,256],[19904,64],[42128,55],[43048,4],43062,43063,43065,[43639,3],65021,65508,65512,65517,65518,65532,65533,65794,[65847,9],[65913,17],[65936,12],[66e3,45],[118784,246],[119040,39],[119081,60],[119146,3],119171,119172,[119180,30],[119214,48],[119296,66],119365,[119552,87],[126976,44],[127024,100],[127248,31],127281,127293,127295,[127298,3,4],[127307,4],127319,127327,127353,127355,127356,127359,[127370,4],127376,127488,[127504,34],[127552,9]],Pi:[171,8216,8219,8220,8223,8249,11778,11780,11785,11788,11804,11808],Cf:[173,[1536,4],1757,1807,6068,6069,[8203,5],[8234,5],[8288,5],[8298,6],65279,[65529,3],69821,[119155,8],917505,[917536,96]],No:[178,179,185,[188,3],[2548,6],[3056,3],[3192,7],[3440,6],[3882,10],[4969,20],[6128,10],8304,[8308,6],[8320,10],[8528,16],8585,[9312,60],[9450,22],[10102,30],11517,[12690,4],[12832,10],[12881,15],[12928,10],[12977,15],[43056,6],[65799,45],[65909,4],65930,[66336,4],[67672,8],[67862,6],[68160,8],68221,68222,[68440,8],[68472,8],[69216,31],[119648,18],[127232,11]],Pf:[187,8217,8221,8250,11779,11781,11786,11789,11805,11809],Lo:[443,[448,4],660,[1488,27],[1520,3],[1569,31],[1601,10],1646,1647,[1649,99],1749,1774,1775,[1786,3],1791,1808,[1810,30],[1869,89],1969,[1994,33],[2048,22],[2308,54],2365,2384,[2392,10],2418,[2425,7],[2437,8],2447,2448,[2451,22],[2474,7],2482,[2486,4],2493,2510,2524,2525,[2527,3],2544,2545,[2565,6],2575,2576,[2579,22],[2602,7],2610,2611,2613,2614,2616,2617,[2649,4],2654,[2674,3],[2693,9],[2703,3],[2707,22],[2730,7],2738,2739,[2741,5],2749,2768,2784,2785,[2821,8],2831,2832,[2835,22],[2858,7],2866,2867,[2869,5],2877,2908,2909,[2911,3],2929,2947,[2949,6],[2958,3],[2962,4],2969,[2970,3,2],2975,2979,2980,[2984,3],[2990,12],3024,[3077,8],[3086,3],[3090,23],[3114,10],[3125,5],3133,3160,3161,3168,3169,[3205,8],[3214,3],[3218,23],[3242,10],[3253,5],3261,3294,3296,3297,[3333,8],[3342,3],[3346,23],[3370,16],3389,3424,3425,[3450,6],[3461,18],[3482,24],[3507,9],3517,[3520,7],[3585,48],3634,3635,[3648,6],3713,3714,3716,3719,3720,3722,3725,[3732,4],[3737,7],[3745,3],3749,3751,3754,3755,[3757,4],3762,3763,3773,[3776,5],3804,3805,3840,[3904,8],[3913,36],[3976,4],[4096,43],4159,[4176,6],[4186,4],4193,4197,4198,[4206,3],[4213,13],4238,[4304,43],[4352,329],[4682,4],[4688,7],4696,[4698,4],[4704,41],[4746,4],[4752,33],[4786,4],[4792,7],4800,[4802,4],[4808,15],[4824,57],[4882,4],[4888,67],[4992,16],[5024,85],[5121,620],[5743,17],[5761,26],[5792,75],[5888,13],[5902,4],[5920,18],[5952,18],[5984,13],[5998,3],[6016,52],6108,[6176,35],[6212,52],[6272,41],6314,[6320,70],[6400,29],[6480,30],[6512,5],[6528,44],[6593,7],[6656,23],[6688,53],[6917,47],[6981,7],[7043,30],7086,7087,[7168,36],[7245,3],[7258,30],[7401,4],[7406,4],[8501,4],[11568,54],[11648,23],[11680,7],[11688,7],[11696,7],[11704,7],[11712,7],[11720,7],[11728,7],[11736,7],12294,12348,[12353,86],12447,[12449,90],12543,[12549,41],[12593,94],[12704,24],[12784,16],13312,19893,19968,40907,[40960,21],[40982,1143],[42192,40],[42240,268],[42512,16],42538,42539,42606,[42656,70],[43003,7],[43011,3],[43015,4],[43020,23],[43072,52],[43138,50],[43250,6],43259,[43274,28],[43312,23],[43360,29],[43396,47],[43520,41],[43584,3],[43588,8],[43616,16],[43633,6],43642,[43648,48],43697,43701,43702,[43705,5],43712,43714,43739,43740,[43968,35],44032,55203,[55216,23],[55243,49],[63744,302],[64048,62],[64112,106],64285,[64287,10],[64298,13],[64312,5],64318,64320,64321,64323,64324,[64326,108],[64467,363],[64848,64],[64914,54],[65008,12],[65136,5],[65142,135],[65382,10],[65393,45],[65440,31],[65474,6],[65482,6],[65490,6],[65498,3],[65536,12],[65549,26],[65576,19],65596,65597,[65599,15],[65616,14],[65664,123],[66176,29],[66208,49],[66304,31],[66352,17],[66370,8],[66432,30],[66464,36],[66504,8],[66640,78],[67584,6],67592,[67594,44],67639,67640,67644,[67647,23],[67840,22],[67872,26],68096,[68112,4],[68117,3],[68121,27],[68192,29],[68352,54],[68416,22],[68448,19],[68608,73],[69763,45],[73728,879],[77824,1071],131072,173782,173824,177972,[194560,542]],Lt:[[453,3,3],498,[8072,8],[8088,8],[8104,8],8124,8140,8188],Lm:[[688,18],[710,12],[736,5],748,750,884,890,1369,1600,1765,1766,2036,2037,2042,2074,2084,2088,2417,3654,3782,4348,6103,6211,6823,[7288,6],[7468,54],7544,[7579,37],8305,8319,[8336,5],11389,11631,11823,12293,[12337,5],12347,12445,12446,[12540,3],40981,[42232,6],42508,42623,[42775,9],42864,42888,43471,43632,43741,65392,65438,65439],Mn:[[768,112],[1155,5],[1425,45],1471,1473,1474,1476,1477,1479,[1552,11],[1611,20],1648,[1750,7],[1759,6],1767,1768,[1770,4],1809,[1840,27],[1958,11],[2027,9],[2070,4],[2075,9],[2085,3],[2089,5],[2304,3],2364,[2369,8],2381,[2385,5],2402,2403,2433,2492,[2497,4],2509,2530,2531,2561,2562,2620,2625,2626,2631,2632,[2635,3],2641,2672,2673,2677,2689,2690,2748,[2753,5],2759,2760,2765,2786,2787,2817,2876,2879,[2881,4],2893,2902,2914,2915,2946,3008,3021,[3134,3],[3142,3],[3146,4],3157,3158,3170,3171,3260,3263,3270,3276,3277,3298,3299,[3393,4],3405,3426,3427,3530,[3538,3],3542,3633,[3636,7],[3655,8],3761,[3764,6],3771,3772,[3784,6],3864,3865,[3893,3,2],[3953,14],[3968,5],3974,3975,[3984,8],[3993,36],4038,[4141,4],[4146,6],4153,4154,4157,4158,4184,4185,[4190,3],[4209,4],4226,4229,4230,4237,4253,4959,[5906,3],[5938,3],5970,5971,6002,6003,[6071,7],6086,[6089,11],6109,[6155,3],6313,[6432,3],6439,6440,6450,[6457,3],6679,6680,6742,[6744,7],6752,6754,[6757,8],[6771,10],6783,[6912,4],6964,[6966,5],6972,6978,[7019,9],7040,7041,[7074,4],7080,7081,[7212,8],7222,7223,[7376,3],[7380,13],[7394,7],7405,[7616,39],[7677,3],[8400,13],8417,[8421,12],[11503,3],[11744,32],[12330,6],12441,12442,42607,42620,42621,42736,42737,43010,43014,43019,43045,43046,43204,[43232,18],[43302,8],[43335,11],[43392,3],43443,[43446,4],43452,[43561,6],43569,43570,43573,43574,43587,43596,43696,[43698,3],43703,43704,43710,43711,43713,44005,44008,44013,64286,[65024,16],[65056,7],66045,[68097,3],68101,68102,[68108,4],[68152,3],68159,69760,69761,[69811,4],69817,69818,[119143,3],[119163,8],[119173,7],[119210,4],[119362,3],[917760,240]],Me:[1160,1161,1758,[8413,4],[8418,3],[42608,3]],Mc:[2307,[2366,3],[2377,4],2382,2434,2435,[2494,3],2503,2504,2507,2508,2519,2563,[2622,3],2691,[2750,3],2761,2763,2764,2818,2819,2878,2880,2887,2888,2891,2892,2903,3006,3007,3009,3010,[3014,3],[3018,3],3031,[3073,3],[3137,4],3202,3203,3262,[3264,5],3271,3272,3274,3275,3285,3286,3330,3331,[3390,3],[3398,3],[3402,3],3415,3458,3459,[3535,3],[3544,8],3570,3571,3902,3903,3967,4139,4140,4145,4152,4155,4156,4182,4183,[4194,3],[4199,7],4227,4228,[4231,6],4239,[4250,3],6070,[6078,8],6087,6088,[6435,4],[6441,3],6448,6449,[6451,6],[6576,17],6600,6601,[6681,3],6741,6743,6753,6755,6756,[6765,6],6916,6965,6971,[6973,5],6979,6980,7042,7073,7078,7079,7082,[7204,8],7220,7221,7393,7410,43043,43044,43047,43136,43137,[43188,16],43346,43347,43395,43444,43445,43450,43451,[43453,4],43567,43568,43571,43572,43597,43643,44003,44004,44006,44007,44009,44010,44012,69762,[69808,3],69815,69816,119141,119142,[119149,6]],Nl:[[5870,3],[8544,35],[8581,4],12295,[12321,9],[12344,3],[42726,10],[65856,53],66369,66378,[66513,5],[74752,99]],Zl:[8232],Zp:[8233],Cs:[55296,56191,56192,56319,56320,57343],Co:[57344,63743,983040,1048573,1048576,1114109],digits:[[48,10],178,179,185,[1632,10],[1776,10],[1984,10],[2406,10],[2534,10],[2662,10],[2790,10],[2918,10],[3046,10],[3174,10],[3302,10],[3430,10],[3558,10],[3664,10],[3792,10],[3872,10],[4160,10],[4240,10],[4969,9],[6112,10],[6160,10],[6470,10],[6608,11],[6784,10],[6800,10],[6992,10],[7088,10],[7232,10],[7248,10],8304,[8308,6],[8320,10],[9312,9],[9332,9],[9352,9],9450,[9461,9],9471,[10102,9],[10112,9],[10122,9],[42528,10],[43216,10],[43264,10],[43472,10],[43504,10],[43600,10],[44016,10],[65296,10],[66720,10],[68160,4],[68912,10],[69216,9],[69714,9],[69734,10],[69872,10],[69942,10],[70096,10],[70384,10],[70736,10],[70864,10],[71248,10],[71360,10],[71472,10],[71904,10],[72784,10],[73040,10],[73120,10],[92768,10],[93008,10],[120782,50],[123200,10],[123632,10],[125264,10],[127232,11]],numeric:[[48,10],178,179,185,[188,3],[1632,10],[1776,10],[1984,10],[2406,10],[2534,10],[2548,6],[2662,10],[2790,10],[2918,10],[2930,6],[3046,13],[3174,10],[3192,7],[3302,10],[3416,7],[3430,19],[3558,10],[3664,10],[3792,10],[3872,20],[4160,10],[4240,10],[4969,20],[5870,3],[6112,10],[6128,10],[6160,10],[6470,10],[6608,11],[6784,10],[6800,10],[6992,10],[7088,10],[7232,10],[7248,10],8304,[8308,6],[8320,10],[8528,51],[8581,5],[9312,60],[9450,22],[10102,30],11517,12295,[12321,9],[12344,3],[12690,4],[12832,10],[12872,8],[12881,15],[12928,10],[12977,15],13317,13443,14378,15181,19968,19971,19975,19977,20061,20108,20116,20118,20159,20160,20191,20200,20237,20336,20740,20806,[20841,3,2],21313,[21315,3],21324,[21441,4],22235,22769,22777,24186,24318,24319,[24332,3],24336,25342,25420,26578,28422,29590,30334,32902,33836,36014,36019,36144,38433,38470,38476,38520,38646,[42528,10],[42726,10],[43056,6],[43216,10],[43264,10],[43472,10],[43504,10],[43600,10],[44016,10],63851,63859,63864,63922,63953,63955,63997,[65296,10],[65799,45],[65856,57],65930,65931,[66273,27],[66336,4],66369,66378,[66513,5],[66720,10],[67672,8],[67705,7],[67751,9],[67835,5],[67862,6],68028,68029,[68032,16],[68050,46],[68160,9],68221,68222,[68253,3],[68331,5],[68440,8],[68472,8],[68521,7],[68858,6],[68912,10],[69216,31],[69405,10],[69457,4],[69714,30],[69872,10],[69942,10],[70096,10],[70113,20],[70384,10],[70736,10],[70864,10],[71248,10],[71360,10],[71472,12],[71904,19],[72784,29],[73040,10],[73120,10],[73664,21],[74752,111],[92768,10],[93008,10],[93019,7],[93824,23],[119520,20],[119648,25],[120782,50],[123200,10],[123632,10],[125127,9],[125264,10],[126065,59],[126125,3],[126129,4],[126209,45],[126255,15],[127232,13],131073,131172,131298,131361,133418,133507,133516,133532,133866,133885,133913,140176,141720,146203,156269,194704]},$B.unicode_casefold={223:[115,115],304:[105,775],329:[700,110],496:[106,780],912:[953,776,769],944:[965,776,769],1415:[1381,1410],7830:[104,817],7831:[116,776],7832:[119,778],7833:[121,778],7834:[97,702],7838:[223],8016:[965,787],8018:[965,787,768],8020:[965,787,769],8022:[965,787,834],8064:[7936,953],8065:[7937,953],8066:[7938,953],8067:[7939,953],8068:[7940,953],8069:[7941,953],8070:[7942,953],8071:[7943,953],8072:[8064],8073:[8065],8074:[8066],8075:[8067],8076:[8068],8077:[8069],8078:[8070],8079:[8071],8080:[7968,953],8081:[7969,953],8082:[7970,953],8083:[7971,953],8084:[7972,953],8085:[7973,953],8086:[7974,953],8087:[7975,953],8088:[8080],8089:[8081],8090:[8082],8091:[8083],8092:[8084],8093:[8085],8094:[8086],8095:[8087],8096:[8032,953],8097:[8033,953],8098:[8034,953],8099:[8035,953],8100:[8036,953],8101:[8037,953],8102:[8038,953],8103:[8039,953],8104:[8096],8105:[8097],8106:[8098],8107:[8099],8108:[8100],8109:[8101],8110:[8102],8111:[8103],8114:[8048,953],8115:[945,953],8116:[940,953],8118:[945,834],8119:[945,834,953],8124:[8115],8130:[8052,953],8131:[951,953],8132:[942,953],8134:[951,834],8135:[951,834,953],8140:[8131],8146:[953,776,768],8147:[953,776,769],8150:[953,834],8151:[953,776,834],8162:[965,776,768],8163:[965,776,769],8164:[961,787],8166:[965,834],8167:[965,776,834],8178:[8060,953],8179:[969,953],8180:[974,953],8182:[969,834],8183:[969,834,953],8188:[8179],64256:[102,102],64257:[102,105],64258:[102,108],64259:[102,102,105],64260:[102,102,108],64261:[115,116],64262:[115,116],64275:[1396,1398],64276:[1396,1381],64277:[1396,1387],64278:[1406,1398],64279:[1396,1389]},$B.unicode_bidi_whitespace=[9,10,11,12,13,28,29,30,31,32,133,5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8287,12288],$B.unicode_identifiers={XID_Start:[95,[65,26],[97,26],170,181,186,[192,23],[216,31],[248,458],[710,12],[736,5],748,750,[880,5],[886,2],[891,3],902,[904,3],908,[910,20],[931,83],[1015,139],[1162,156],[1329,38],1369,[1377,39],[1488,27],[1520,3],[1569,42],[1646,2],[1649,99],1749,[1765,2],[1774,2],[1786,3],1791,1808,[1810,30],[1869,89],1969,[1994,33],[2036,2],2042,[2048,22],2074,2084,2088,[2308,54],2365,2384,[2392,10],2417,2418,[2425,7],[2437,8],[2447,2],[2451,22],[2474,7],2482,[2486,4],2493,2510,[2524,2],[2527,3],[2544,2],[2565,6],[2575,2],[2579,22],[2602,7],[2610,2],[2613,2],[2616,2],[2649,4],2654,[2674,3],[2693,9],[2703,3],[2707,22],[2730,7],[2738,2],[2741,5],2749,2768,[2784,2],[2821,8],[2831,2],[2835,22],[2858,7],[2866,2],[2869,5],2877,[2908,2],[2911,3],2929,2947,[2949,6],[2958,3],[2962,4],[2969,2],2972,[2974,2],[2979,2],[2984,3],[2990,12],3024,[3077,8],[3086,3],[3090,23],[3114,10],[3125,5],3133,[3160,2],[3168,2],[3205,8],[3214,3],[3218,23],[3242,10],[3253,5],3261,3294,[3296,2],[3333,8],[3342,3],[3346,23],[3370,16],3389,[3424,2],[3450,6],[3461,18],[3482,24],[3507,9],3517,[3520,7],[3585,48],3634,[3648,7],[3713,2],3716,[3719,2],3722,3725,[3732,4],[3737,7],[3745,3],3749,3751,[3754,2],[3757,4],3762,3773,[3776,5],3782,[3804,2],3840,[3904,8],[3913,36],[3976,4],[4096,43],4159,[4176,6],[4186,4],4193,[4197,2],[4206,3],[4213,13],4238,[4256,38],[4304,43],4348,[4352,329],[4682,4],[4688,7],4696,[4698,4],[4704,41],[4746,4],[4752,33],[4786,4],[4792,7],4800,[4802,4],[4808,15],[4824,57],[4882,4],[4888,67],[4992,16],[5024,85],[5121,620],[5743,17],[5761,26],[5792,75],[5870,3],[5888,13],[5902,4],[5920,18],[5952,18],[5984,13],[5998,3],[6016,52],6103,6108,[6176,88],[6272,41],6314,[6320,70],[6400,29],[6480,30],[6512,5],[6528,44],[6593,7],[6656,23],[6688,53],6823,[6917,47],[6981,7],[7043,30],[7086,2],[7168,36],[7245,3],[7258,36],[7401,4],[7406,4],[7424,192],[7680,278],[7960,6],[7968,38],[8008,6],[8016,8],8025,8027,8029,[8031,31],[8064,53],[8118,7],8126,[8130,3],[8134,7],[8144,4],[8150,6],[8160,13],[8178,3],[8182,7],8305,8319,[8336,5],8450,8455,[8458,10],8469,8472,[8473,5],8484,8486,8488,[8490,16],[8508,4],[8517,5],8526,[8544,41],[11264,47],[11312,47],[11360,133],[11499,4],[11520,38],[11568,54],11631,[11648,23],[11680,7],[11688,7],[11696,7],[11704,7],[11712,7],[11720,7],[11728,7],[11736,7],12293,12294,12295,[12321,9],[12337,5],[12344,5],[12353,86],[12445,3],[12449,90],[12540,4],[12549,41],[12593,94],[12704,24],[12784,16],[13312,6582],[19968,20940],[40960,1165],[42192,46],[42240,269],[42512,16],[42538,2],[42560,32],[42594,13],42623,[42624,24],[42656,80],[42775,9],[42786,103],[42891,2],[43003,7],[43011,3],[43015,4],[43020,23],[43072,52],[43138,50],[43250,6],43259,[43274,28],[43312,23],[43360,29],[43396,47],43471,[43520,41],[43584,3],[43588,8],[43616,23],43642,[43648,48],43697,[43701,2],[43705,5],43712,43714,[43739,3],[43968,35],[44032,11172],[55216,23],[55243,49],[63744,302],[64048,62],[64112,106],[64256,7],[64275,5],64285,[64287,10],[64298,13],[64312,5],64318,[64320,2],[64323,2],[64326,108],[64467,139],[64612,218],[64848,64],[64914,54],[65008,10],65137,65139,65143,65145,65147,65149,[65151,126],[65313,26],[65345,26],[65382,56],[65440,31],[65474,6],[65482,6],[65490,6],[65498,3],[65536,12],[65549,26],[65576,19],[65596,2],[65599,15],[65616,14],[65664,123],[65856,53],[66176,29],[66208,49],[66304,31],[66352,27],[66432,30],[66464,36],[66504,8],[66513,5],[66560,158],[67584,6],67592,[67594,44],[67639,2],67644,[67647,23],[67840,22],[67872,26],68096,[68112,4],[68117,3],[68121,27],[68192,29],[68352,54],[68416,22],[68448,19],[68608,73],[69763,45],[73728,879],[74752,99],[77824,1071],[119808,85],[119894,71],[119966,2],119970,[119973,2],[119977,4],[119982,12],119995,[119997,7],[120005,65],[120071,4],[120077,8],[120086,7],[120094,28],[120123,4],[120128,5],120134,[120138,7],[120146,340],[120488,25],[120514,25],[120540,31],[120572,25],[120598,31],[120630,25],[120656,31],[120688,25],[120714,31],[120746,25],[120772,8],[131072,42711],[173824,4149],[194560,542]],XID_Continue:[[48,10],[65,26],95,[97,26],170,181,183,186,[192,23],[216,31],[248,458],[710,12],[736,5],748,750,[768,117],[886,2],[891,3],902,903,[904,3],908,[910,20],[931,83],[1015,139],[1155,5],[1162,156],[1329,38],1369,[1377,39],[1425,45],1471,[1473,2],[1476,2],1479,[1488,27],[1520,3],[1552,11],[1569,62],[1632,10],[1646,102],1749,[1750,7],[1759,10],[1770,19],1791,1808,1809,[1810,57],[1869,101],[1984,54],2042,[2048,46],[2304,58],2364,2365,[2366,17],2384,[2385,5],[2392,12],[2406,10],2417,2418,[2425,7],2433,[2434,2],[2437,8],[2447,2],[2451,22],[2474,7],2482,[2486,4],2492,2493,[2494,7],[2503,2],[2507,4],2519,[2524,2],[2527,5],[2534,12],[2561,3],[2565,6],[2575,2],[2579,22],[2602,7],[2610,2],[2613,2],[2616,2],2620,[2622,5],[2631,2],[2635,3],2641,[2649,4],2654,[2662,16],[2689,3],[2693,9],[2703,3],[2707,22],[2730,7],[2738,2],[2741,5],2748,2749,[2750,8],[2759,3],[2763,3],2768,[2784,4],[2790,10],2817,[2818,2],[2821,8],[2831,2],[2835,22],[2858,7],[2866,2],[2869,5],2876,2877,2878,2879,2880,[2881,4],[2887,2],[2891,3],2902,2903,[2908,2],[2911,5],[2918,10],2929,2946,2947,[2949,6],[2958,3],[2962,4],[2969,2],2972,[2974,2],[2979,2],[2984,3],[2990,12],[3006,5],[3014,3],[3018,4],3024,3031,[3046,10],[3073,3],[3077,8],[3086,3],[3090,23],[3114,10],[3125,5],3133,[3134,7],[3142,3],[3146,4],[3157,2],[3160,2],[3168,4],[3174,10],[3202,2],[3205,8],[3214,3],[3218,23],[3242,10],[3253,5],3260,3261,3262,3263,[3264,5],3270,[3271,2],[3274,4],[3285,2],3294,[3296,4],[3302,10],[3330,2],[3333,8],[3342,3],[3346,23],[3370,16],3389,[3390,7],[3398,3],[3402,4],3415,[3424,4],[3430,10],[3450,6],[3458,2],[3461,18],[3482,24],[3507,9],3517,[3520,7],3530,[3535,6],3542,[3544,8],[3570,2],[3585,58],[3648,15],[3664,10],[3713,2],3716,[3719,2],3722,3725,[3732,4],[3737,7],[3745,3],3749,3751,[3754,2],[3757,13],[3771,3],[3776,5],3782,[3784,6],[3792,10],[3804,2],3840,[3864,2],[3872,10],3893,3895,3897,[3902,10],[3913,36],[3953,20],[3974,6],[3984,8],[3993,36],4038,[4096,74],[4176,78],[4256,38],[4304,43],4348,[4352,329],[4682,4],[4688,7],4696,[4698,4],[4704,41],[4746,4],[4752,33],[4786,4],[4792,7],4800,[4802,4],[4808,15],[4824,57],[4882,4],[4888,67],4959,[4969,9],[4992,16],[5024,85],[5121,620],[5743,17],[5761,26],[5792,75],[5870,3],[5888,13],[5902,7],[5920,21],[5952,20],[5984,13],[5998,3],[6002,2],[6016,52],6070,[6071,29],6103,6108,6109,[6112,10],[6155,3],[6160,10],[6176,88],[6272,43],[6320,70],[6400,29],[6432,12],[6448,12],[6470,40],[6512,5],[6528,44],[6576,26],[6608,11],[6656,28],[6688,63],6752,6753,6754,[6755,26],6783,[6784,10],[6800,10],6823,[6912,76],[6992,10],[7019,9],[7040,43],[7086,12],[7168,56],[7232,10],[7245,49],[7376,3],[7380,31],[7424,231],[7677,281],[7960,6],[7968,38],[8008,6],[8016,8],8025,8027,8029,[8031,31],[8064,53],[8118,7],8126,[8130,3],[8134,7],[8144,4],[8150,6],[8160,13],[8178,3],[8182,7],[8255,2],8276,8305,8319,[8336,5],[8400,13],8417,[8421,12],8450,8455,[8458,10],8469,8472,[8473,5],8484,8486,8488,[8490,16],[8508,4],[8517,5],8526,[8544,41],[11264,47],[11312,47],[11360,133],[11499,7],[11520,38],[11568,54],11631,[11648,23],[11680,7],[11688,7],[11696,7],[11704,7],[11712,7],[11720,7],[11728,7],[11736,7],[11744,32],12293,12294,12295,[12321,15],[12337,5],[12344,5],[12353,86],[12441,2],[12445,3],[12449,90],[12540,4],[12549,41],[12593,94],[12704,24],[12784,16],[13312,6582],[19968,20940],[40960,1165],[42192,46],[42240,269],[42512,28],[42560,32],[42594,14],[42620,2],42623,[42624,24],[42656,82],[42775,9],[42786,103],[42891,2],[43003,45],[43072,52],[43136,69],[43216,10],[43232,24],43259,[43264,46],[43312,36],[43360,29],[43392,65],43471,[43472,10],[43520,55],[43584,14],[43600,10],[43616,23],43642,43643,[43648,67],[43739,3],[43968,43],44012,44013,[44016,10],[44032,11172],[55216,23],[55243,49],[63744,302],[64048,62],[64112,106],[64256,7],[64275,5],64285,64286,[64287,10],[64298,13],[64312,5],64318,[64320,2],[64323,2],[64326,108],[64467,139],[64612,218],[64848,64],[64914,54],[65008,10],[65024,16],[65056,7],[65075,2],[65101,3],65137,65139,65143,65145,65147,65149,[65151,126],[65296,10],[65313,26],65343,[65345,26],[65382,89],[65474,6],[65482,6],[65490,6],[65498,3],[65536,12],[65549,26],[65576,19],[65596,2],[65599,15],[65616,14],[65664,123],[65856,53],66045,[66176,29],[66208,49],[66304,31],[66352,27],[66432,30],[66464,36],[66504,8],[66513,5],[66560,158],[66720,10],[67584,6],67592,[67594,44],[67639,2],67644,[67647,23],[67840,22],[67872,26],68096,[68097,3],[68101,2],[68108,8],[68117,3],[68121,27],[68152,3],68159,[68192,29],[68352,54],[68416,22],[68448,19],[68608,73],[69760,59],[73728,879],[74752,99],[77824,1071],[119141,5],[119149,6],[119163,8],[119173,7],[119210,4],[119362,3],[119808,85],[119894,71],[119966,2],119970,[119973,2],[119977,4],[119982,12],119995,[119997,7],[120005,65],[120071,4],[120077,8],[120086,7],[120094,28],[120123,4],[120128,5],120134,[120138,7],[120146,340],[120488,25],[120514,25],[120540,31],[120572,25],[120598,31],[120630,25],[120656,31],[120688,25],[120714,31],[120746,25],[120772,8],[120782,50],[131072,42711],[173824,4149],[194560,542],[917760,240]]},$B.unicode_tables={},$B.unicode)$B.unicode_tables[gc]={},$B.unicode[gc].forEach(function(e){if(Array.isArray(e))for(var t=e[2]||1,r=0,n=e[1];r<n;r+=1)$B.unicode_tables[gc][e[0]+r*t]=!0;else $B.unicode_tables[gc][e]=!0});for(var key in $B.unicode_identifiers){$B.unicode_tables[key]={};for(const e of $B.unicode_identifiers[key])if(Array.isArray(e))for(var i=0;i<e[1];i++)$B.unicode_tables[key][e[0]+i]=!0;else $B.unicode_tables[key][e]=!0}!function($B){var bltns=$B.InjectBuiltins();eval(bltns);var unicode_tables=$B.unicode_tables,str={__class__:_b_.type,__dir__:object.__dir__,$infos:{__module__:"builtins",__name__:"str"},$is_class:!0,$native:!0};function normalize_start_end(e){if(null===e.start||e.start===_b_.None?e.start=0:e.start<0&&(e.start+=e.self.length,e.start=Math.max(0,e.start)),null===e.end||e.end===_b_.None?e.end=e.self.length:e.end<0&&(e.end+=e.self.length,e.end=Math.max(0,e.end)),!isinstance(e.start,_b_.int)||!isinstance(e.end,_b_.int))throw _b_.TypeError.$factory("slice indices must be integers or None or have an __index__ method")}function reverse(e){return e.split("").reverse().join("")}function check_str(e){if(!_b_.isinstance(e,str))throw _b_.TypeError.$factory("can't convert '"+$B.class_name(e)+"' object to str implicitly")}function preformat(e,t){if(t.empty)return _b_.str.$factory(e);if(t.type&&"s"!=t.type)throw _b_.ValueError.$factory("Unknown format code '"+t.type+"' for object of type 'str'");return e}str.__add__=function(e,t){if("string"!=typeof t)try{return getattr(t,"__radd__")(e)}catch(e){throw _b_.TypeError.$factory("Can't convert "+$B.class_name(t)+" to str implicitly")}return e+t},str.__contains__=function(e,t){if(!_b_.isinstance(t,str))throw _b_.TypeError.$factory("'in <string>' requires string as left operand, not "+t.__class__);if("string"==typeof t)var r=t.length;else r=_b_.len(t);if(0==r)return!0;if(0==e.length)return 0==r;for(var n=0,s=e.length;n<s;n++)if(e.substr(n,r)==t)return!0;return!1},str.__delitem__=function(){throw _b_.TypeError.$factory("'str' object doesn't support item deletion")},str.__dir__=object.__dir__,str.__eq__=function(e,t){return void 0===t?e===str:_b_.isinstance(t,_b_.str)?t.valueOf()==e.valueOf():_b_.NotImplemented},str.__format__=function(e,t){var r=new $B.parse_format_spec(t);if(void 0!==r.sign)throw _b_.ValueError.$factory("Sign not allowed in string format specifier");return r.align=r.align||"<",$B.format_width(preformat(e,r),r)},str.__getitem__=function(e,t){if(isinstance(t,_b_.int)){var r=t;if(t<0&&(r+=e.length),r>=0&&r<e.length)return e.charAt(r);throw _b_.IndexError.$factory("string index out of range")}if(isinstance(t,slice)){var n=_b_.slice.$conv_for_seq(t,e.length),s=n.start,a=n.stop,i=n.step,o="",_=null;if(i>0){if(a<=s)return"";for(_=s;_<a;_+=i)o+=e.charAt(_)}else{if(a>=s)return"";for(_=s;_>a;_+=i)o+=e.charAt(_)}return o}if(isinstance(t,_b_.bool))return e.__getitem__(_b_.int.$factory(t));throw _b_.TypeError.$factory("string indices must be integers")};var prefix=2,suffix=3,mask=2**32-1;function fnv(e){if(0==e.length)return 0;var t=prefix;t=(t^e.charCodeAt(0)<<7)&mask;for(var r=0,n=e.length;r<n;r++)t=(1000003*t^e.charCodeAt(r))&mask;return-1==(t=((t=(t^e.length)&mask)^suffix)&mask)&&(t=-2),t}str.__hash__=function(e){return fnv(e)},str.__init__=function(e,t){return e.valueOf=function(){return t},e.toString=function(){return t},_b_.None};var str_iterator=$B.make_iterator_class("str_iterator");str.__iter__=function(e){var t=e.split("");return str_iterator.$factory(t)},str.__len__=function(e){return e.length};var kwarg_key=new RegExp("([^\\)]*)\\)"),NotANumber=function(){this.name="NotANumber"},number_check=function(e){if(!isinstance(e,[_b_.int,_b_.float]))throw new NotANumber},get_char_array=function(e,t){return e<=0?"":new Array(e+1).join(t)},format_padding=function(e,t,r){var n=t.padding;return n?(e=e.toString(),n=parseInt(n,10),r&&(n-=1),t.left?e+get_char_array(n-e.length,t.pad_char):get_char_array(n-e.length,t.pad_char)+e):e},format_int_precision=function(e,t){var r,n=t.precision;return n?(n=parseInt(n,10),"-"===(r=e.__class__===$B.long_int?$B.long_int.to_base(e,10):e.toString())[0]?"-"+get_char_array(n-r.length+1,"0")+r.slice(1):get_char_array(n-r.length,"0")+r):e.toString()},format_float_precision=function(e,t,r,n){var s=r.precision;return isFinite(e)?n(e,s,r,t):(e=e===1/0?"inf":e===-1/0?"-inf":"nan",t?e.toUpperCase():e)},format_sign=function(e,t){if(t.sign){if(e>=0)return"+"}else if(t.space&&e>=0)return" ";return""},str_format=function(e,t){return t.pad_char=" ",format_padding(str.$factory(e),t)},num_format=function(e,t){number_check(e),e=e.__class__===$B.long_int?$B.long_int.to_base(e,10):parseInt(e);var r=format_int_precision(e,t);if("0"===t.pad_char){if(e<0)return r=r.substring(1),"-"+format_padding(r,t,!0);var n=format_sign(e,t);if(""!==n)return n+format_padding(r,t,!0)}return format_padding(format_sign(e,t)+r,t)},repr_format=function(e,t){return t.pad_char=" ",format_padding(repr(e),t)},ascii_format=function(e,t){return t.pad_char=" ",format_padding(ascii(e),t)},_float_helper=function(e,t){return number_check(e),t.precision?(t.precision=parseInt(t.precision,10),validate_precision(t.precision)):t.decimal_point?t.precision=0:t.precision=6,parseFloat(e)},trailing_zeros=/(.*?)(0+)([eE].*)/,leading_zeros=/\.(0*)/,trailing_dot=/\.$/,validate_precision=function(e){e>20&&(e=20)},floating_point_format=function(e,t,r){if(e=_float_helper(e,r),v=e.toString(),v_len=v.length,dot_idx=v.indexOf("."),dot_idx<0&&(dot_idx=v_len),e<1&&e>-1){var n,s=leading_zeros.exec(v);if((n=s?s[1].length:0)>=4){if(e=format_sign(e,r)+format_float_precision(e,t,r,_floating_g_exp_helper),r.alternate)r.precision<=1&&(e=e[0]+"."+e.substring(1));else(a=trailing_zeros.exec(e))&&(e=a[1].replace(trailing_dot,"")+a[3]);return format_padding(e,r)}return r.precision=(r.precision||0)+n,format_padding(format_sign(e,r)+format_float_precision(e,t,r,function(e,t){return e.toFixed(min(t,v_len-dot_idx)+n)}),r)}if(dot_idx>r.precision){var a;if(e=format_sign(e,r)+format_float_precision(e,t,r,_floating_g_exp_helper),r.alternate)r.precision<=1&&(e=e[0]+"."+e.substring(1));else(a=trailing_zeros.exec(e))&&(e=a[1].replace(trailing_dot,"")+a[3]);return format_padding(e,r)}return format_padding(format_sign(e,r)+format_float_precision(e,t,r,function(e,t){return r.decimal_point?t>v_len&&(r.alternate||(t=v_len)):t=min(v_len-1,6),t<dot_idx&&(t=dot_idx),e.toFixed(t-dot_idx)}),r)},_floating_g_exp_helper=function(e,t,r,n){t&&--t;var s=(e=e.toExponential(t)).lastIndexOf("e");return s>e.length-4&&(e=e.substring(0,s+2)+"0"+e.substring(s+2)),n?e.toUpperCase():e},floating_point_decimal_format=function(e,t,r){return e=_float_helper(e,r),format_padding(format_sign(e,r)+format_float_precision(e,t,r,function(e,t,r){return e=e.toFixed(t),0===t&&r.alternate&&(e+="."),e}),r)},_floating_exp_helper=function(e,t,r,n){var s=(e=e.toExponential(t)).lastIndexOf("e");return s>e.length-4&&(e=e.substring(0,s+2)+"0"+e.substring(s+2)),n?e.toUpperCase():e},floating_point_exponential_format=function(e,t,r){return e=_float_helper(e,r),format_padding(format_sign(e,r)+format_float_precision(e,t,r,_floating_exp_helper),r)},signed_hex_format=function(e,t,r){var n;if(number_check(e),n=e.__class__===$B.long_int?$B.long_int.to_base(e,16):(n=parseInt(e)).toString(16),n=format_int_precision(n,r),t&&(n=n.toUpperCase()),"0"===r.pad_char){e<0&&(n=n.substring(1),n="-"+format_padding(n,r,!0));var s=format_sign(e,r);""!==s&&(n=s+format_padding(n,r,!0))}return r.alternate&&(n="-"===n.charAt(0)?t?"-0X"+n.slice(1):"-0x"+n.slice(1):t?"0X"+n:"0x"+n),format_padding(format_sign(e,r)+n,r)},octal_format=function(e,t){var r;if(number_check(e),r=e.__class__===$B.long_int?$B.long_int.to_base(8):(r=parseInt(e)).toString(8),r=format_int_precision(r,t),"0"===t.pad_char){e<0&&(r=r.substring(1),r="-"+format_padding(r,t,!0));var n=format_sign(e,t);""!==n&&(r=n+format_padding(r,t,!0))}return t.alternate&&(r="-"===r.charAt(0)?"-0o"+r.slice(1):"0o"+r),format_padding(r,t)};function series_of_bytes(e,t){if(e.__class__&&e.__class__.$buffer_protocol)for(var r=_b_.iter(e),n=[];;)try{n.push(_b_.next(r))}catch(e){if(e.__class__===_b_.StopIteration){var s=_b_.bytes.$factory(n);return format_padding(_b_.bytes.decode(s,"ascii"),t)}throw e}else try{return bytes_obj=$B.$getattr(e,"__bytes__"),format_padding(_b_.bytes.decode(bytes_obj),t)}catch(t){if(t.__class__===_b_.AttributeError)throw _b_.TypeError.$factory("%b does not accept '"+$B.class_name(e)+"'");throw t}}var single_char_format=function(e,t){if(isinstance(e,str)&&1==e.length)return e;if(isinstance(e,bytes)&&1==e.source.length)e=e.source[0];else try{e=_b_.int.$factory(e)}catch(e){throw _b_.TypeError.$factory("%c requires int or char")}return format_padding(chr(e),t)},num_flag=function(e,t){"0"!==e||t.padding||t.decimal_point||t.left?t.decimal_point?t.precision=(t.precision||"")+e:t.padding=(t.padding||"")+e:t.pad_char="0"},decimal_point_flag=function(e,t){if(t.decimal_point)throw new UnsupportedChar;t.decimal_point=!0},neg_flag=function(e,t){t.pad_char=" ",t.left=!0},space_flag=function(e,t){t.space=!0},sign_flag=function(e,t){t.sign=!0},alternate_flag=function(e,t){t.alternate=!0},char_mapping={b:series_of_bytes,s:str_format,d:num_format,i:num_format,u:num_format,o:octal_format,r:repr_format,a:ascii_format,g:function(e,t){return floating_point_format(e,!1,t)},G:function(e,t){return floating_point_format(e,!0,t)},f:function(e,t){return floating_point_decimal_format(e,!1,t)},F:function(e,t){return floating_point_decimal_format(e,!0,t)},e:function(e,t){return floating_point_exponential_format(e,!1,t)},E:function(e,t){return floating_point_exponential_format(e,!0,t)},x:function(e,t){return signed_hex_format(e,!1,t)},X:function(e,t){return signed_hex_format(e,!0,t)},c:single_char_format,0:function(e,t){return num_flag("0",t)},1:function(e,t){return num_flag("1",t)},2:function(e,t){return num_flag("2",t)},3:function(e,t){return num_flag("3",t)},4:function(e,t){return num_flag("4",t)},5:function(e,t){return num_flag("5",t)},6:function(e,t){return num_flag("6",t)},7:function(e,t){return num_flag("7",t)},8:function(e,t){return num_flag("8",t)},9:function(e,t){return num_flag("9",t)},"-":neg_flag," ":space_flag,"+":sign_flag,".":decimal_point_flag,"#":alternate_flag},UnsupportedChar=function(){this.name="UnsupportedChar"};str.__mod__=function(e,t){var r,n=e.length,s=0,a=null;_b_.isinstance(t,_b_.tuple)?a=0:r=_b_.getattr(t,"__getitem__",_b_.None);var i="",o=function(e){++s;var t=kwarg_key.exec(e.substring(u));if(!t)throw _b_.ValueError.$factory("incomplete format key");var n=t[1];u+=t[0].length;try{var a=r(n)}catch(e){if("KeyError"===e.name)throw e;throw _b_.TypeError.$factory("format requires a mapping")}return l(e,a)},_=function(e){var r;if(null===a)r=t;else if(void 0===(r=t[a++]))throw _b_.TypeError.$factory("not enough arguments for format string");return l(e,r)},l=function(e,t){for(var r={pad_char:" "};;){var n=char_mapping[e[u]];try{if(void 0===n)throw new UnsupportedChar;var s=n(t,r);if(void 0!==s)return s;++u}catch(r){if("UnsupportedChar"==r.name){if(invalid_char=e[u],void 0===invalid_char)throw _b_.ValueError.$factory("incomplete format");throw _b_.ValueError.$factory("unsupported format character '"+invalid_char+"' (0x"+invalid_char.charCodeAt(0).toString(16)+") at index "+u)}if("NotANumber"===r.name){var a=e[u],i=t.__class__;throw i=i?i.$infos.__name__:"string"==typeof t?"str":typeof t,_b_.TypeError.$factory("%"+a+" format: a number is required, not "+i)}throw r}}},c=0;do{var u=e.indexOf("%",s);if(u<0){i+=e.substring(s);break}if(i+=e.substring(s,u),!(++u<n))throw _b_.ValueError.$factory("incomplete format");"%"===e[u]?i+="%":(c++,"("===e[u]?(++u,i+=o(e)):i+=_(e)),s=u+1}while(s<n);if(null!==a){if(t.length>a)throw _b_.TypeError.$factory("not enough arguments for format string");if(t.length<a)throw _b_.TypeError.$factory("not all arguments converted during string formatting")}else if(0==c)throw _b_.TypeError.$factory("not all arguments converted during string formatting");return i},str.__mro__=[object],str.__mul__=function(){var e=$B.args("__mul__",2,{self:null,other:null},["self","other"],arguments,{},null,null);if(!isinstance(e.other,_b_.int))throw _b_.TypeError.$factory("Can't multiply sequence by non-int of type '"+$B.class_name(e.other)+"'");for(var t="",r=0;r<e.other;r++)t+=e.self.valueOf();return t},str.__ne__=function(e,t){return t!==e.valueOf()},str.__repr__=function(e){var t=e;if(-1==(t=(t=(t=e.replace(/\\/g,"\\\\")).replace(new RegExp("","g"),"\\x07").replace(new RegExp("\b","g"),"\\x08").replace(new RegExp("\v","g"),"\\x0b").replace(new RegExp("\f","g"),"\\x0c").replace(new RegExp("\n","g"),"\\n").replace(new RegExp("\r","g"),"\\r").replace(new RegExp("\t","g"),"\\t")).replace(combining_re,"$1")).search('"')&&-1==t.search("'"))return"'"+t+"'";if(-1==e.search('"'))return'"'+t+'"';var r=new RegExp("'","g");return t="'"+t.replace(r,"\\'")+"'"},str.__setitem__=function(e,t,r){throw _b_.TypeError.$factory("'str' object does not support item assignment")};for(var combining=[],cp=768;cp<=879;cp++)combining.push(String.fromCharCode(cp));var combining_re=new RegExp("("+combining.join("|")+")");str.__str__=function(e){return e.replace(combining_re,"$1")},str.toString=function(){return"string!"};var $comp_func=function(e,t){return"string"!=typeof t?_b_.NotImplemented:e>t};$comp_func+="";var $comps={">":"gt",">=":"ge","<":"lt","<=":"le"};for(var $op in $comps)eval("str.__"+$comps[$op]+"__ = "+$comp_func.replace(/>/gm,$op));$B.make_rmethods(str);var $notimplemented=function(e,t){throw NotImplementedError.$factory("OPERATOR not implemented for class str")};str.capitalize=function(e){$B.args("capitalize",1,{self:e},["self"],arguments,{},null,null);return 0==e.length?"":e.charAt(0).toUpperCase()+e.substr(1)},str.casefold=function(e){$B.args("casefold",1,{self:e},["self"],arguments,{},null,null);for(var t,r,n="",s=0,a=e.length;s<a;s++)t=e.charCodeAt(s),(r=$B.unicode_casefold[t])?r.forEach(function(e){n+=String.fromCharCode(e)}):n+=e.charAt(s).toLowerCase();return n},str.center=function(){var e=$B.args("center",3,{self:null,width:null,fillchar:null},["self","width","fillchar"],arguments,{fillchar:" "},null,null),t=e.self;if(e.width<=t.length)return t;var r=parseInt((e.width-t.length)/2),n=e.fillchar.repeat(r);return(n+=t+n).length<e.width&&(n+=e.fillchar),n},str.count=function(){var e=$B.args("count",4,{self:null,sub:null,start:null,stop:null},["self","sub","start","stop"],arguments,{start:null,stop:null},null,null);if("string"!=typeof e.sub)throw _b_.TypeError.$factory("Can't convert '"+$B.class_name(e.sub)+"' object to str implicitly");var t,r=e.self;if(null!==e.start)t=null!==e.stop?_b_.slice.$factory(e.start,e.stop):_b_.slice.$factory(e.start,e.self.length),r=str.__getitem__.apply(null,[e.self].concat(t));else if(e.self.length+e.sub.length==0)return 1;if(0==e.sub.length)return e.start==e.self.length?1:0==r.length?0:r.length+1;for(var n=0,s=0;s<r.length&&(s=r.indexOf(e.sub,s))>=0;)n++,s+=e.sub.length;return n},str.encode=function(){var e=$B.args("encode",3,{self:null,encoding:null,errors:null},["self","encoding","errors"],arguments,{encoding:"utf-8",errors:"strict"},null,null);if("rot13"==e.encoding||"rot_13"==e.encoding){for(var t="",r=0,n=e.self.length;r<n;r++){var s=e.self.charAt(r);t+="a"<=s&&s<="m"||"A"<=s&&s<="M"?String.fromCharCode(String.charCodeAt(s)+13):"m"<s&&s<="z"||"M"<s&&s<="Z"?String.fromCharCode(String.charCodeAt(s)-13):s}return t}return _b_.bytes.__new__(_b_.bytes,e.self,e.encoding,e.errors)},str.endswith=function(){var e=$B.args("endswith",4,{self:null,suffix:null,start:null,end:null},["self","suffix","start","end"],arguments,{start:0,end:null},null,null);normalize_start_end(e);var t=e.suffix;isinstance(t,_b_.tuple)||(t=[t]);for(var r=e.self.substring(e.start,e.end),n=0,s=t.length;n<s;n++){var a=t[n];if(!_b_.isinstance(a,str))throw _b_.TypeError.$factory("endswith first arg must be str or a tuple of str, not int");if(a.length<=r.length&&r.substr(r.length-a.length)==a)return!0}return!1},str.expandtabs=function(e,t){var r=$B.args("expandtabs",2,{self:null,tabsize:null},["self","tabsize"],arguments,{tabsize:8},null,null),n=$B.$GetInt(r.tabsize),s=0,a=0,i="";if(1==n)return e.replace(/\t/g," ");for(;a<e.length;){var o=e.charAt(a);switch(o){case"\t":for(;s%n>0;)i+=" ",s++;break;case"\r":case"\n":i+=o,s=0;break;default:i+=o,s++}a++}return i},str.find=function(){var e=$B.args("str.find",4,{self:null,sub:null,start:null,end:null},["self","sub","start","end"],arguments,{start:0,end:null},null,null);if(check_str(e.sub),normalize_start_end(e),!isinstance(e.start,_b_.int)||!isinstance(e.end,_b_.int))throw _b_.TypeError.$factory("slice indices must be integers or None or have an __index__ method");for(var t="",r=e.start;r<e.end;r++)t+=e.self.charAt(r);if(0==e.sub.length&&e.start==e.self.length)return e.self.length;if(t.length+e.sub.length==0)return-1;var n=t.length-e.sub.length;for(r=0;r<=n;r++)if(t.substr(r,e.sub.length)==e.sub)return e.start+r;return-1},$B.parse_format=function(e){var t,r,n,s=e.split(":"),a=[];if(1==s.length?t=e:(t=s[0],n=s.splice(1).join(":")),(s=t.split("!")).length>1&&(t=s[0],r=s[1]),void 0!==t){t=t.replace(/\.[_a-zA-Z][_a-zA-Z0-9]*|\[[_a-zA-Z][_a-zA-Z0-9]*\]|\[[0-9]+\]/g,function(e){return a.push(e),""})}return{name:t,name_ext:a,conv:r,spec:n||"",string:e}},$B.split_format=function(e){for(var t,r=0,n=e.length,s="",a=[],i=0;r<n;)if("{"==(t=e.charAt(r))&&"{"==e.charAt(r+1))s+="{",r+=2;else if("}"==t&&"}"==e.charAt(r+1))s+="}",r+=2;else if("{"==t){a.push(s);for(var o=r+1,_=1;o<n;)if("{"==e.charAt(o))_++,o++;else if("}"==e.charAt(o)){if(o++,0==--_){var l=e.substring(r+1,o-1),c=$B.parse_format(l);if(c.raw_name=c.name,c.raw_spec=c.spec,c.name||(c.name=i+"",i++),void 0!==c.spec){function u(e,t){return""==t?"{"+i+++"}":"{"+t+"}"}c.spec=c.spec.replace(/\{(.*?)\}/g,u)}a.push(c),s="";break}}else o++;if(_>0)throw ValueError.$factory("wrong format "+e);r=o}else s+=t,r++;return s&&a.push(s),a},str.format=function(e){for(var t,r=$B.args("format",1,{self:null},["self"],arguments,{},"$args","$kw"),n=$B.split_format(r.self),s="",a=0;a<n.length;a++)if("string"!=typeof n[a]){if(void 0!==(t=n[a]).spec){function i(e,t){return/\d+/.exec(t)?_b_.tuple.__getitem__(r.$args,parseInt(t)):_b_.dict.__getitem__(r.$kw,t)}t.spec=t.spec.replace(/\{(.*?)\}/g,i)}if(t.name.charAt(0).search(/\d/)>-1)var o=parseInt(t.name),_=_b_.tuple.__getitem__(r.$args,o);else _=_b_.dict.__getitem__(r.$kw,t.name);for(var l=0;l<t.name_ext.length;l++){var c=t.name_ext[l];if("."==c.charAt(0))_=_b_.getattr(_,c.substr(1));else{var u=c.substr(1,c.length-2);u.charAt(0).search(/\d/)>-1&&(u=parseInt(u)),_=_b_.getattr(_,"__getitem__")(u)}}"a"==t.conv?_=_b_.ascii(_):"r"==t.conv?_=_b_.repr(_):"s"==t.conv&&(_=_b_.str.$factory(_)),_.$is_class||_.$factory?s+=_.__class__.__format__(_,t.spec):s+=_b_.getattr(_,"__format__")(t.spec)}else s+=n[a];return s},str.format_map=function(e){throw NotImplementedError.$factory("function format_map not implemented yet")},str.index=function(e){var t=str.find.apply(null,arguments);if(-1===t)throw _b_.ValueError.$factory("substring not found");return t},str.isascii=function(e){for(var t=0,r=e.length;t<r;t++)if(e.charCodeAt(t)>127)return!1;return!0},str.isalnum=function(e){$B.args("isalnum",1,{self:null},["self"],arguments,{},null,null);for(var t,r=0,n=e.length;r<n;r++)if(t=e.charCodeAt(r),!(unicode_tables.Ll[t]||unicode_tables.Lu[t]||unicode_tables.Lm[t]||unicode_tables.Lt[t]||unicode_tables.Lo[t]||unicode_tables.Nd[t]||unicode_tables.digits[t]||unicode_tables.numeric[t]))return!1;return!0},str.isalpha=function(e){$B.args("isalpha",1,{self:null},["self"],arguments,{},null,null);for(var t,r=0,n=e.length;r<n;r++)if(t=e.charCodeAt(r),!(unicode_tables.Ll[t]||unicode_tables.Lu[t]||unicode_tables.Lm[t]||unicode_tables.Lt[t]||unicode_tables.Lo[t]))return!1;return!0},str.isdecimal=function(e){$B.args("isdecimal",1,{self:null},["self"],arguments,{},null,null);for(var t,r=0,n=e.length;r<n;r++)if(t=e.charCodeAt(r),!unicode_tables.Nd[t])return!1;return e.length>0},str.isdigit=function(e){$B.args("isdigit",1,{self:null},["self"],arguments,{},null,null);for(var t,r=0,n=e.length;r<n;r++)if(t=e.charCodeAt(r),!unicode_tables.digits[t])return!1;return e.length>0},str.isidentifier=function(e){$B.args("isidentifier",1,{self:null},["self"],arguments,{},null,null);if(0==e.length)return!1;if(void 0===unicode_tables.XID_Start[e.charCodeAt(0)])return!1;for(var t=1,r=e.length;t<r;t++)if(void 0===unicode_tables.XID_Continue[e.charCodeAt(t)])return!1;return!0},str.islower=function(e){$B.args("islower",1,{self:null},["self"],arguments,{},null,null);for(var t,r=!1,n=0,s=e.length;n<s;n++)if(t=e.charCodeAt(n),unicode_tables.Ll[t])r=!0;else if(unicode_tables.Lu[t]||unicode_tables.Lt[t])return!1;return r},str.isnumeric=function(e){$B.args("isnumeric",1,{self:null},["self"],arguments,{},null,null);for(var t=0,r=e.length;t<r;t++)if(!unicode_tables.numeric[e.charCodeAt(t)])return!1;return e.length>0};var printable,printable_gc=["Cc","Cf","Co","Cs","Zl","Zp","Zs"];function $re_escape(e){for(var t=0,r="[.*+?|()$^".length;t<r;t++){var n=new RegExp("\\"+"[.*+?|()$^".charAt(t),"g");e=e.replace(n,"\\"+"[.*+?|()$^".charAt(t))}return e}str.isprintable=function(e){if(void 0===printable){for(var t=0;t<printable_gc.length;t++){var r=unicode_tables[printable_gc[t]];for(var n in r)printable[n]=!0}printable[32]=!0}$B.args("isprintable",1,{self:null},["self"],arguments,{},null,null),t=0;for(var s,a=e.length;t<a;t++)if(s=e.charCodeAt(t),!printable[s])return!1;return!0},str.isspace=function(e){$B.args("isspace",1,{self:null},["self"],arguments,{},null,null);for(var t,r=0,n=e.length;r<n;r++)if(t=e.charCodeAt(r),!unicode_tables.Zs[t]&&-1==$B.unicode_bidi_whitespace.indexOf(t))return!1;return e.length>0},str.istitle=function(e){$B.args("istitle",1,{self:null},["self"],arguments,{},null,null);return e.length>0&&str.title(e)==e},str.isupper=function(e){$B.args("islower",1,{self:null},["self"],arguments,{},null,null);for(var t,r=!1,n=0,s=e.length;n<s;n++)if(t=e.charCodeAt(n),unicode_tables.Lu[t])r=!0;else if(unicode_tables.Ll[t]||unicode_tables.Lt[t])return!1;return r},str.join=function(){for(var e=$B.args("join",2,{self:null,iterable:null},["self","iterable"],arguments,{},null,null),t=_b_.iter(e.iterable),r=[];;)try{var n=_b_.next(t);if(!isinstance(n,str))throw _b_.TypeError.$factory("sequence item 0: expected str instance, "+$B.class_name(n)+" found");r.push(n)}catch(e){if(_b_.isinstance(e,_b_.StopIteration))break;throw e}return r.join(e.self)},str.ljust=function(e){var t=$B.args("ljust",3,{self:null,width:null,fillchar:null},["self","width","fillchar"],arguments,{fillchar:" "},null,null);return t.width<=e.length?e:e+t.fillchar.repeat(t.width-e.length)},str.lower=function(e){$B.args("lower",1,{self:null},["self"],arguments,{},null,null);return e.toLowerCase()},str.lstrip=function(e,t){var r=$B.args("lstrip",2,{self:null,chars:null},["self","chars"],arguments,{chars:_b_.None},null,null);if(r.chars===_b_.None)return r.self.trimLeft();for(var n=0;n<r.self.length;n++)if(-1===r.chars.indexOf(r.self.charAt(n)))return r.self.substring(n);return""},str.maketrans=function(){var e=$B.args("maketrans",3,{x:null,y:null,z:null},["x","y","z"],arguments,{y:null,z:null},null,null),t=_b_.dict.$factory();if(null===e.y&&null===e.z){if(!_b_.isinstance(e.x,_b_.dict))throw _b_.TypeError.$factory("maketrans only argument must be a dict");for(var r=_b_.list.$factory(_b_.dict.items(e.x)),n=0,s=r.length;n<s;n++){var a=r[n][0],i=r[n][1];if(!_b_.isinstance(a,_b_.int)){if(!_b_.isinstance(a,_b_.str)||1!=a.length)throw _b_.TypeError.$factory("dictionary key "+a+" is not int or 1-char string");a=_b_.ord(a)}if(i!==_b_.None&&!_b_.isinstance(i,[_b_.int,_b_.str]))throw _b_.TypeError.$factory("dictionary value "+i+" is not None, integer or string");_b_.dict.$setitem(t,a,i)}return t}if(_b_.isinstance(e.x,_b_.str)&&_b_.isinstance(e.y,_b_.str)){if(e.x.length!==e.y.length)throw _b_.TypeError.$factory("maketrans arguments must be strings or same length");var o={};if(null!==e.z){if(!_b_.isinstance(e.z,_b_.str))throw _b_.TypeError.$factory("maketrans third argument must be a string");for(n=0,s=e.z.length;n<s;n++)o[_b_.ord(e.z.charAt(n))]=!0}for(n=0,s=e.x.length;n<s;n++){var _=_b_.ord(e.x.charAt(n)),l=e.y.charCodeAt(n);_b_.dict.$setitem(t,_,l)}for(var a in o)_b_.dict.$setitem(t,parseInt(a),_b_.None);return t}throw _b_.TypeError.$factory("maketrans arguments must be strings")},str.maketrans.$type="staticmethod",str.partition=function(){var e=$B.args("partition",2,{self:null,sep:null},["self","sep"],arguments,{},null,null);if(""==e.sep)throw _b_.ValueError.$factory("empty separator");check_str(e.sep);var t=e.self.indexOf(e.sep);return-1==t?_b_.tuple.$factory([e.self,"",""]):_b_.tuple.$factory([e.self.substring(0,t),e.sep,e.self.substring(t+e.sep.length)])},str.replace=function(e,t,r,n){var s=$B.args("replace",4,{self:null,old:null,$$new:null,count:null},["self","old","$$new","count"],arguments,{count:-1},null,null);n=s.count,e=s.self,t=s.old,r=s.$$new;if(check_str(t),check_str(r),!isinstance(n,[_b_.int,_b_.float]))throw _b_.TypeError.$factory("'"+$B.class_name(n)+"' object cannot be interpreted as an integer");if(isinstance(n,_b_.float))throw _b_.TypeError.$factory("integer argument expected, got float");if(0==n)return e;if(n.__class__==$B.long_int&&(n=parseInt(n.value)),""==t){if(""==r)return e;if(""==e)return r;var a=e.split("");if(n>-1&&a.length>=n){var i=a.slice(n).join("");return r+a.slice(0,n).join(r)+i}return r+a.join(r)+r}a=str.split(e,t,n);var o=e,_=-1;if(0==t.length){o=r;for(var l=0;l<a.length;l++)o+=a[l]+r;return o+i}for(n<0&&(n=o.length);n>0&&!((_=o.indexOf(t,_))<0);)o=o.substr(0,_)+r+o.substr(_+t.length),_+=r.length,n--;return o},str.rfind=function(e,t){if(2==arguments.length&&"string"==typeof t)return e.lastIndexOf(t);var r=$B.args("rfind",4,{self:null,sub:null,start:null,end:null},["self","sub","start","end"],arguments,{start:0,end:null},null,null);if(normalize_start_end(r),check_str(r.sub),0==r.sub.length)return r.start>r.self.length?-1:r.self.length;for(var n=r.sub.length,s=r.end-n;s>=r.start;s--)if(r.self.substr(s,n)==r.sub)return s;return-1},str.rindex=function(){var e=str.rfind.apply(null,arguments);if(-1==e)throw _b_.ValueError.$factory("substring not found");return e},str.rjust=function(e){var t=$B.args("rjust",3,{self:null,width:null,fillchar:null},["self","width","fillchar"],arguments,{fillchar:" "},null,null);return t.width<=e.length?e:t.fillchar.repeat(t.width-e.length)+e},str.rpartition=function(e,t){var r=$B.args("rpartition",2,{self:null,sep:null},["self","sep"],arguments,{},null,null);check_str(r.sep);e=reverse(r.self),t=reverse(r.sep);for(var n=str.partition(e,t).reverse(),s=0;s<n.length;s++)n[s]=n[s].split("").reverse().join("");return n},str.rsplit=function(e){var t=$B.args("rsplit",3,{self:null,sep:null,maxsplit:null},["self","sep","maxsplit"],arguments,{sep:_b_.None,maxsplit:-1},null,null),r=t.sep,n=reverse(t.self),s=r===_b_.None?r:reverse(t.sep),a=str.split(n,s,t.maxsplit);a.reverse();for(var i=0;i<a.length;i++)a[i]=reverse(a[i]);return a},str.rstrip=function(e,t){var r=$B.args("rstrip",2,{self:null,chars:null},["self","chars"],arguments,{chars:_b_.None},null,null);if(r.chars===_b_.None)return r.self.trimRight();for(var n=r.self.length-1;n>=0;n--)if(-1==r.chars.indexOf(r.self.charAt(n)))return r.self.substring(0,n+1);return""},str.split=function(){var e=$B.args("split",3,{self:null,sep:null,maxsplit:null},["self","sep","maxsplit"],arguments,{sep:_b_.None,maxsplit:-1},null,null),t=e.sep,r=e.maxsplit,n=e.self,s=0;if(r.__class__===$B.long_int&&(r=parseInt(r.value)),""==t)throw _b_.ValueError.$factory("empty separator");if(t===_b_.None){for(var a=[];s<n.length&&n.charAt(s).search(/\s/)>-1;)s++;if(s===n.length-1)return[n];for(var i="";;){if(-1==n.charAt(s).search(/\s/))""==i?i=n.charAt(s):i+=n.charAt(s);else if(""!==i){if(a.push(i),-1!==r&&a.length==r+1)return a.pop(),a.push(i+n.substr(s)),a;i=""}if(++s>n.length-1){i&&a.push(i);break}}return a}a=[];var o="",_=t.length;if(0==r)return[n];for(;s<n.length;)if(n.substr(s,_)==t){if(a.push(o),s+=_,r>-1&&a.length>=r)return a.push(n.substr(s)),a;o=""}else o+=n.charAt(s),s++;return a.push(o),a},str.splitlines=function(e){var t=$B.args("splitlines",2,{self:null,keepends:null},["self","keepends"],arguments,{keepends:!1},null,null);if(!_b_.isinstance(t.keepends,[_b_.bool,_b_.int]))throw _b_.TypeError("integer argument expected, got "+$B.get_class(t.keepends).__name);var r=_b_.int.$factory(t.keepends),n=[],s=0,a=0;if(!(e=t.self).length)return n;for(;a<e.length;)"\r\n"==e.substr(a,2)?(n.push(e.slice(s,r?a+2:a)),s=a+=2):"\r"==e[a]||"\n"==e[a]?(n.push(e.slice(s,r?a+1:a)),s=a+=1):a++;return s<e.length&&n.push(e.slice(s)),n},str.startswith=function(){var e=$B.args("startswith",4,{self:null,prefix:null,start:null,end:null},["self","prefix","start","end"],arguments,{start:0,end:null},null,null);normalize_start_end(e);var t=e.prefix;isinstance(t,_b_.tuple)||(t=[t]);for(var r=e.self.substring(e.start,e.end),n=0,s=t.length;n<s;n++){var a=t[n];if(!_b_.isinstance(a,str))throw _b_.TypeError.$factory("endswith first arg must be str or a tuple of str, not int");if(r.substr(0,a.length)==a)return!0}return!1},str.strip=function(){var e=$B.args("strip",2,{self:null,chars:null},["self","chars"],arguments,{chars:_b_.None},null,null);if(e.chars===_b_.None)return e.self.trim();for(var t=0;t<e.self.length&&-1!=e.chars.indexOf(e.self.charAt(t));t++);for(var r=e.self.length-1;r>=t&&-1!=e.chars.indexOf(e.self.charAt(r));r--);return e.self.substring(t,r+1)},str.swapcase=function(e){$B.args("swapcase",1,{self:e},["self"],arguments,{},null,null);for(var t,r="",n=0,s=e.length;n<s;n++)t=e.charCodeAt(n),unicode_tables.Ll[t]?r+=e.charAt(n).toUpperCase():unicode_tables.Lu[t]?r+=e.charAt(n).toLowerCase():r+=e.charAt(n);return r},str.title=function(e){$B.args("title",1,{self:e},["self"],arguments,{},null,null);for(var t,r,n="",s=0,a=e.length;s<a;s++)r=e.charCodeAt(s),unicode_tables.Ll[r]?t?n+=e.charAt(s):(n+=e.charAt(s).toUpperCase(),t="word"):unicode_tables.Lu[r]||unicode_tables.Lt[r]?(n+=t?e.charAt(s).toLowerCase():e.charAt(s),t="word"):(t=null,n+=e.charAt(s));return n},str.translate=function(e,t){for(var r=[],n=$B.$getattr(t,"__getitem__"),s=0,a=e.length;s<a;s++)try{var i=n(e.charCodeAt(s));i!==_b_.None&&("string"==typeof i?r.push(i):"number"==typeof i&&r.push(String.fromCharCode(i)))}catch(t){r.push(e.charAt(s))}return r.join("")},str.upper=function(e){$B.args("upper",1,{self:null},["self"],arguments,{},null,null);return e.toUpperCase()},str.zfill=function(e,t){var r=$B.args("zfill",2,{self:null,width:null},["self","width"],arguments,{},null,null);if(r.width<=e.length)return e;switch(e.charAt(0)){case"+":case"-":return e.charAt(0)+"0".repeat(r.width-e.length)+e.substr(1);default:return"0".repeat(t-e.length)+e}},str.$factory=function(e,t,r){if(0==arguments.length)return"";if(void 0===e)return $B.UndefinedClass.__str__();if(void 0!==t){var n=$B.args("str",3,{arg:null,encoding:null,errors:null},["arg","encoding","errors"],arguments,{encoding:"utf-8",errors:"strict"},null,null);t=n.encoding,r=n.errors}switch(typeof e){case"string":return str.__str__(e);case"number":if(isFinite(e))return e.toString()}try{if(e.$is_class||e.$factory)return $B.$getattr(e.__class__,"__str__")(e);if(e.__class__&&e.__class__===_b_.bytes&&void 0!==t)return _b_.bytes.decode(e,n.encoding,n.errors);var s=e.__class__||$B.get_class(e);if(void 0===s)return $B.JSObject.__str__($B.JSObject.$factory(e));if(null===(a=$B.$getattr(s,"__str__",null))||e.__class__&&e.__class__!==_b_.object&&a.$infos&&a.$infos.__func__===_b_.object.__str__)var a=$B.$getattr(s,"__repr__")}catch(t){throw console.log("no __str__ for",e),console.log("err ",t),$B.debug>1&&console.log(t),console.log("Warning - no method __str__ or __repr__, default to toString",e),t}return $B.$call(a)(e)},str.__new__=function(e){if(void 0===e)throw _b_.TypeError.$factory("str.__new__(): not enough arguments");return{__class__:e}},$B.set_func_names(str,"builtins");var StringSubclass=$B.StringSubclass={__class__:_b_.type,__mro__:[object],$infos:{__module__:"builtins",__name__:"str"},$is_class:!0};for(var $attr in str)"function"==typeof str[$attr]&&(StringSubclass[$attr]=function(e){return function(){var t=[],r=0;if(arguments.length>0){t=[arguments[0].valueOf()],r=1;for(var n=1,s=arguments.length;n<s;n++)t[r++]=arguments[n]}return str[e].apply(null,t)}}($attr));function fstring_expression(){this.type="expression",this.expression="",this.conversion=null,this.fmt=null}StringSubclass.__new__=function(e){return{__class__:e}},$B.set_func_names(StringSubclass,"builtins"),_b_.str=str,$B.parse_format_spec=function(e){if(""==e)this.empty=!0;else{var t=0,r="<>=^".indexOf(e.charAt(0));-1!=r?e.charAt(1)&&-1!="<>=^".indexOf(e.charAt(1))?(this.fill=e.charAt(0),this.align=e.charAt(1),t=2):(this.align="<>=^"[r],this.fill=" ",t++):(r="<>=^".indexOf(e.charAt(1)),e.charAt(1)&&-1!=r&&(this.align="<>=^"[r],this.fill=e.charAt(0),t=2));var n=e.charAt(t);for("+"!=n&&"-"!=n&&" "!=n||(this.sign=n,t++,n=e.charAt(t)),"#"==n&&(this.alternate=!0,t++,n=e.charAt(t)),"0"==n&&(this.fill="0",-1==r&&(this.align="="),t++,n=e.charAt(t));n&&"0123456789".indexOf(n)>-1;)void 0===this.width?this.width=n:this.width+=n,t++,n=e.charAt(t);if(void 0!==this.width&&(this.width=parseInt(this.width)),void 0===this.width&&"{"==n){var s=e.substr(t).search("}");this.width=e.substring(t,s),console.log("width","["+this.width+"]"),t+=s+1}if(","==n&&(this.comma=!0,t++,n=e.charAt(t)),"."==n){if(-1=="0123456789".indexOf(e.charAt(t+1)))throw _b_.ValueError.$factory("Missing precision in format spec");for(this.precision=e.charAt(t+1),t+=2,n=e.charAt(t);n&&"0123456789".indexOf(n)>-1;)this.precision+=n,t++,n=e.charAt(t);this.precision=parseInt(this.precision)}if(n&&"bcdeEfFgGnosxX%".indexOf(n)>-1&&(this.type=n,t++,n=e.charAt(t)),t!==e.length)throw _b_.ValueError.$factory("Invalid format specifier: "+e)}this.toString=function(){return(void 0===this.fill?"":_b_.str.$factory(this.fill))+(this.align||"")+(this.sign||"")+(this.alternate?"#":"")+(this.sign_aware?"0":"")+(this.width||"")+(this.comma?",":"")+(this.precision?"."+this.precision:"")+(this.type||"")}},$B.format_width=function(e,t){if(t.width&&e.length<t.width){var r=t.fill||" ",n=t.align||"<",s=t.width-e.length;switch(n){case"<":return e+r.repeat(s);case">":return r.repeat(s)+e;case"=":return"+-".indexOf(e.charAt(0))>-1?e.charAt(0)+r.repeat(s)+e.substr(1):r.repeat(s)+e;case"^":var a=parseInt(s/2);return r.repeat(a)+e+r.repeat(s-a)}}return e},$B.parse_fstring=function(e){for(var t,r=[],n=0,s="",a=null,i=0;n<e.length;)if(null===a)if("{"==(t=e.charAt(n)))"{"==e.charAt(n+1)?(a="string",s="{",n+=2):(a="expression",i=1,n++);else if("}"==t){if(e.charAt(n+1)!=t)throw Error(" f-string: single '}' is not allowed");a="string",s="}",n+=2}else a="string",s=t,n++;else if("string"==a){for(var o=n;o<e.length;)if("{"==(t=e.charAt(o))){if("{"!=e.charAt(o+1)){r.push(s),a="expression",n=o+1;break}s+="{",o+=2}else if("}"==t){if(e.charAt(o+1)!=t)throw Error(" f-string: single '}' is not allowed");s+=t,o+=2}else s+=t,o++;n=o+1}else if("debug"==a){for(;" "==e.charAt(o);)o++;"}"==e.charAt(o)&&(r.push(s),a=null,s="",n=o+1)}else{o=n,i=1;var _=0;for(s=new fstring_expression;o<e.length;)if("{"==(t=e.charAt(o))&&0==_)i++,s.expression+=t,o++;else if("}"==t&&0==_){if(0==(i-=1)){r.push(s),a=null,s="",n=o+1;break}s.expression+=t,o++}else{if("\\"==t)throw Error("f-string expression part cannot include a backslash");if(0==_&&"!"==t&&null===s.fmt&&":}".indexOf(e.charAt(o+2))>-1){if(0==s.expression.length)throw Error("f-string: empty expression not allowed");if(-1=="ars".indexOf(e.charAt(o+1)))throw Error("f-string: invalid conversion character: expected 's', 'r', or 'a'");s.conversion=e.charAt(o+1),o+=2}else if("("==t)_++,s.expression+=t,o++;else if(")"==t)_--,s.expression+=t,o++;else if('"'==t)if('"""'==e.substr(o,3)){if(-1==(c=e.indexOf('"""',o+3)))throw Error("f-string: unterminated string");var l=e.substring(o,c+3);l=l.replace("\n","\\n\\"),s.expression+=l,o=c+3}else{var c;if(-1==(c=e.indexOf('"',o+1)))throw Error("f-string: unterminated string");s.expression+=e.substring(o,c+1),o=c+1}else if(0==_&&":"==t)s.fmt=!0,s.expression+=t,o++;else if("="==t){var u=s.expression;if(0==u.length||"="==e.charAt(o+1)||"=!<>:".search(u.charAt(u.length-1))>-1)s.expression+=t+e.charAt(o+1),o+=2;else{for(tail=t;e.charAt(o+1).match(/\s/);)tail+=e.charAt(o+1),o++;for(r.push(s.expression+tail);u.match(/\s$/);)u=u.substr(0,u.length-1);s.expression=u,a="debug",o++}}else s.expression+=t,o++}if(i>0)throw Error("f-string: expected '}'")}return s.length>0&&r.push(s),r};var surrogate=str.$surrogate=$B.make_class("surrogate_string",function(e){for(var t=[],r=0,n=e.length;r<n;r++){var s=e.charCodeAt(r);if(s>=55296&&s<=56319)r++,s=1024*(s-55296)+(e.charCodeAt(r)-56320)+65536;t.push(String.fromCodePoint(s))}return{__class__:str.$surrogate,items:t}});surrogate.__mro__=[str,object],surrogate.__contains__=function(e,t){return str.__contains__(e.items.join(""),t)},surrogate.__getitem__=function(e,t){if(isinstance(t,_b_.int)){var r=t;if(t<0&&(r+=e.items.length),r>=0&&r<e.items.length)return 2==e.items[r].length?surrogate.$factory(e.items[r]):e.items[r];throw _b_.IndexError.$factory("string index out of range")}if(isinstance(t,slice)){var n=_b_.slice.$conv_for_seq(t,e.items.length),s=n.start,a=n.stop,i=n.step,o="",_=null;if(i>0){if(a<=s)return"";for(_=s;_<a;_+=i)o+=e.items[_]}else{if(a>=s)return"";for(_=s;_>a;_+=i)o+=e.items[_]}return o}if(isinstance(t,_b_.bool))return surrogate.__getitem__(e,_b_.int.$factory(t));throw _b_.TypeError.$factory("string indices must be integers")},surrogate.__hash__=function(e){return str.__hash__(e.items.join(""))},surrogate.__iter__=function(e){return str_iterator.$factory(e.items)},surrogate.__len__=function(e){return e.items.length},surrogate.__repr__=function(e){return str.__repr__(e.items.join(""))},surrogate.__str__=function(e){return str.__str__(e.items.join(""))},$B.set_func_names(surrogate,"builtins")}(__BRYTHON__),function($B){var bltns=$B.InjectBuiltins();eval(bltns);var object=_b_.object,str_hash=_b_.str.__hash__,$N=_b_.None,set_ops=["eq","add","sub","and","or","xor","le","lt","ge","gt"];function dict_iterator_next(e){if(e.len_func()!=e.len)throw RuntimeError.$factory("dictionary changed size during iteration");if(e.counter++,e.counter<e.items.length)return e.items[e.counter];throw _b_.StopIteration.$factory("StopIteration")}$B.make_view=function(e,t){var r=$B.make_class(e,function(e){return{__class__:r,__dict__:_b_.dict.$factory(),counter:-1,items:e,len:e.length}});if(t)for(var n=0,s=set_ops.length;n<s;n++){var a="__"+set_ops[n]+"__";r[a]=function(e){return function(t,r){return _b_.set[e](_b_.set.$factory(t),_b_.set.$factory(r))}}(a)}return r.__iter__=function(e){var t=r.$iterator.$factory(e.items);return t.len_func=e.len_func,t},r.__len__=function(e){return e.len},r.__repr__=function(e){return r.$infos.__name__+"("+_b_.repr(e.items)+")"},$B.set_func_names(r,"builtins"),r};var dict={__class__:_b_.type,__mro__:[object],$infos:{__module__:"builtins",__name__:"dict"},$is_class:!0,$native:!0};function to_list(e,t){var r=[];if(e.$jsobj){for(var n in r=[],e.$jsobj)if("$"!=n.charAt(0)){var s=e.$jsobj[n];void 0===s?s=_b_.NotImplemented:null===s&&(s=$N),r.push([n,s])}}else{for(var a in e.$numeric_dict)r.push([parseFloat(a),e.$numeric_dict[a]]);for(var a in e.$string_dict)r.push([a,e.$string_dict[a]]);for(var a in e.$object_dict)e.$object_dict[a].forEach(function(e){r.push(e)});r.sort(function(e,t){return e[1][1]-t[1][1]}),r=r.map(function(e){return[e[0],e[1][0]]})}return void 0!==t?r.map(function(e){return e[t]}):(r.__class__=_b_.tuple,r.map(function(e){return e.__class__=_b_.tuple,e}))}function dict_iterator_next(e){if(e.len_func()!=e.len)throw RuntimeError.$factory("dictionary changed size during iteration");if(e.counter++,e.counter<e.items.length)return e.items[e.counter];throw _b_.StopIteration.$factory("StopIteration")}dict.$to_obj=function(e){var t={};for(var r in e.$string_dict)t[r]=e.$string_dict[r][0];return t},$B.dict_to_list=to_list;var $copy_dict=function(e,t){var r=to_list(t),n=dict.$setitem;t.$version=t.$version||0;for(var s=t.$version||0,a=0,i=r.length;a<i;a++)if(n(e,r[a][0],r[a][1]),t.$version!=s)throw _b_.RuntimeError.$factory("dict mutated during update")};function rank(e,t,r){var n=e.$object_dict[t];if(void 0!==n)for(var s=0,a=n.length;s<a;s++)if($B.rich_comp("__eq__",r,n[s][0]))return s;return-1}function init_from_list(e,t){for(var r=-1,n=t.length-1,s=dict.__setitem__;r++<n;){var a=t[r];switch(typeof a[0]){case"string":e.$string_dict[a[0]]=[a[1],e.$version],e.$str_hash[str_hash(a[0])]=a[0],e.$version++;break;case"number":e.$numeric_dict[a[0]]=[a[1],e.$version],e.$version++;break;default:s(e,a[0],a[1])}}}dict.__bool__=function(){var e=$B.args("__bool__",1,{self:null},["self"],arguments,{},null,null);return dict.__len__(e.self)>0},dict.__contains__=function(){var e=$B.args("__contains__",2,{self:null,key:null},["self","key"],arguments,{},null,null),t=e.self,r=e.key;if(t.$is_namespace&&(r=$B.to_alias(r)),t.$jsobj)return void 0!==t.$jsobj[r];switch(typeof r){case"string":return void 0!==t.$string_dict[r];case"number":return void 0!==t.$numeric_dict[r]}var n=_b_.hash(r);return!(void 0===t.$str_hash[n]||!$B.rich_comp("__eq__",r,t.$str_hash[n]))||(!(void 0===t.$numeric_dict[n]||!$B.rich_comp("__eq__",r,n))||rank(t,n,r)>-1)},dict.__delitem__=function(){var e=$B.args("__eq__",2,{self:null,arg:null},["self","arg"],arguments,{},null,null),t=e.self,r=e.arg;if(t.$jsobj){if(void 0===t.$jsobj[r])throw KeyError.$factory(r);return delete t.$jsobj[r],$N}switch(typeof r){case"string":if(void 0===t.$string_dict[r])throw KeyError.$factory(_b_.str.$factory(r));return delete t.$string_dict[r],delete t.$str_hash[str_hash(r)],t.$version++,$N;case"number":if(void 0===t.$numeric_dict[r])throw KeyError.$factory(_b_.str.$factory(r));return delete t.$numeric_dict[r],t.$version++,$N}var n,s=_b_.hash(r);if(!((n=rank(t,s,r))>-1))throw KeyError.$factory(_b_.str.$factory(r));return t.$object_dict[s].splice(n,1),t.$version++,$N},dict.__eq__=function(){var e=$B.args("__eq__",2,{self:null,other:null},["self","other"],arguments,{},null,null),t=e.self,r=e.other;if(!isinstance(r,dict))return!1;if(t.$jsobj&&(t=jsobj2dict(t.$jsobj)),r.$jsobj&&(r=jsobj2dict(r.$jsobj)),dict.__len__(t)!=dict.__len__(r))return!1;if(t.$string_dict.length!=r.$string_dict.length)return!1;for(var n in t.$numeric_dict)if(r.$numeric_dict.hasOwnProperty(n)){if(!$B.rich_comp("__eq__",r.$numeric_dict[n][0],t.$numeric_dict[n][0]))return!1}else{if(!r.$object_dict.hasOwnProperty(n))return!1;for(var s=!1,a=0,i=(_=r.$object_dict[n]).length;a<i;a++)if($B.rich_comp("__eq__",n,_[a][0])&&$B.rich_comp("__eq__",t.$numeric_dict[n],_[a][1])){s=!0;break}if(!s)return!1}for(var n in t.$string_dict)if(!r.$string_dict.hasOwnProperty(n)||!$B.rich_comp("__eq__",r.$string_dict[n][0],t.$string_dict[n][0]))return!1;for(var o in t.$object_dict){var _=t.$object_dict[o],l=[];if(void 0!==r.$numeric_dict[o]&&l.push([o,r.$numeric_dict[o]]),void 0!==r.$object_dict[o]&&(l=l.concat(r.$object_dict[o])),0==l.length)return!1;a=0;for(var c=_.length;a<c;a++){s=!1;for(var u=_[a][0],f=_[a][1][0],p=0,d=l.length;p<d;p++)if($B.rich_comp("__eq__",u,l[p][0])&&$B.rich_comp("__eq__",f,l[p][1][0])){s=!0;break}if(!s)return!1}}return!0},dict.__getitem__=function(){var e=$B.args("__getitem__",2,{self:null,arg:null},["self","arg"],arguments,{},null,null),t=e.self,r=e.arg;return dict.$getitem(t,r)},dict.$getitem=function(e,t){if(e.$jsobj){if(void 0===e.$jsobj[t]){if(e.$jsobj.hasOwnProperty(t))return $B.Undefined;throw _b_.KeyError.$factory(t)}return e.$jsobj[t]}switch(typeof t){case"string":if(void 0!==e.$string_dict[t])return e.$string_dict[t][0];break;case"number":if(void 0!==e.$numeric_dict[t])return e.$numeric_dict[t][0]}var r=_b_.hash(t),n=function(e){return $B.rich_comp("__eq__",t,e)};"object"==typeof t&&(t.$hash=r);var s=e.$str_hash[r];if(void 0!==s&&n(s))return e.$string_dict[s][0];if(void 0!==e.$numeric_dict[r]&&n(r))return e.$numeric_dict[r][0];if(isinstance(t,_b_.str)){var a=e.$string_dict[t.valueOf()];if(void 0!==a)return a[0]}var i=rank(e,r,t);if(i>-1)return e.$object_dict[r][i][1][0];if(e.__class__!==dict){try{var o=getattr(e.__class__,"__missing__",_b_.None)}catch(e){console.log(e)}if(o!==_b_.None)return o(e,t)}throw KeyError.$factory(t)},dict.__hash__=_b_.None,dict.__init__=function(e,t,r){var n;if(void 0===t)return $N;if(void 0===r){if(t.__class__===$B.JSObject)return e.$jsobj=t.js,$N;if(t.$jsobj){for(var s in e.$jsobj={},t.$jsobj)e.$jsobj[s]=t.$jsobj[s];return $N}if(Array.isArray(t))return init_from_list(e,t),$N}var a=(n=n||$B.args("dict",1,{self:null},["self"],arguments,{},"first","second")).first;if(a.length>1)throw _b_.TypeError.$factory("dict expected at most 1 argument, got 2");if(1==a.length)if((a=a[0]).__class__===dict)["$string_dict","$str_hash","$numeric_dict","$object_dict"].forEach(function(t){for(l in a[t])e[t][l]=a[t][l]});else if(isinstance(a,dict))$copy_dict(e,a);else{var i=$B.$getattr(a,"keys",null);if(null!==i){var o=$B.$getattr(a,"__getitem__",null);if(null!==o){o=$B.$call(o);for(var _=_b_.iter($B.$call(i)());;)try{var l=_b_.next(_),c=o(l);dict.__setitem__(e,l,c)}catch(e){if(e.__class__===_b_.StopIteration)break;throw e}return $N}}Array.isArray(a)||(a=_b_.list.$factory(a)),init_from_list(e,a)}var u=n.second.$string_dict;for(var s in u)switch(typeof s){case"string":e.$string_dict[s]=u[s],e.$str_hash[str_hash(s)]=s;break;case"number":e.$numeric_dict[s]=u[s];break;default:si(e,s,u[s])}return $N},dict.__iter__=function(e){return _b_.iter(dict.$$keys(e))},dict.__len__=function(e){var t=0;if(e.$jsobj){for(var r in e.$jsobj)"$"!=r.charAt(0)&&t++;return t}for(var n in e.$numeric_dict)t++;for(var n in e.$string_dict)t++;for(var s in e.$object_dict)t+=e.$object_dict[s].length;return t},dict.__ne__=function(e,t){return!dict.__eq__(e,t)},dict.__new__=function(e){if(void 0===e)throw _b_.TypeError.$factory("int.__new__(): not enough arguments");var t={__class__:e,$numeric_dict:{},$object_dict:{},$string_dict:{},$str_hash:{},$version:0};return e!==dict&&(t.__dict__=_b_.dict.$factory()),t},dict.__repr__=function(e){if(e.$jsobj)return dict.__repr__(jsobj2dict(e.$jsobj));if($B.repr.enter(e))return"{...}";var t=[];return to_list(e).forEach(function(e){try{t.push(repr(e[0])+": "+repr(e[1]))}catch(e){throw e}}),$B.repr.leave(e),"{"+t.join(", ")+"}"},dict.__setitem__=function(e,t,r){var n=$B.args("__setitem__",3,{self:null,key:null,value:null},["self","key","value"],arguments,{},null,null);return dict.$setitem(n.self,n.key,n.value)},dict.$setitem=function(e,t,r,n){if(e.$jsobj)return e.$from_js&&(r=$B.pyobj2jsobj(r)),e.$jsobj.__class__===_b_.type?(e.$jsobj[t]=r,"__init__"!=t&&"__new__"!=t||(e.$jsobj.$factory=$B.$instance_creator(e.$jsobj))):e.$jsobj[t]=r,$N;switch(typeof t){case"string":return void 0===e.$string_dict&&console.log("pas de string dict",e,t,r),e.$string_dict[t]=[r,e.$version],e.$str_hash[str_hash(t)]=t,e.$version++,$N;case"number":return e.$numeric_dict[t]=[r,e.$version],e.$version++,$N}var s=void 0===n?_b_.hash(t):n,a=function(e){return $B.rich_comp("__eq__",t,e)};if(void 0!==e.$numeric_dict[s]&&a(s))return e.$numeric_dict[s]=[r,e.$numeric_dict[s][1]],e.$version++,$N;var i=e.$str_hash[s];if(void 0!==i&&a(i))return e.$string_dict[i]=[r,e.$string_dict[i][1]],e.$version++,$N;if(n)return void 0!==e.$object_dict[n]?e.$object_dict[n].push([t,[r,e.$version]]):e.$object_dict[n]=[[t,[r,e.$version]]],e.$version++,$N;var o=rank(e,s,t);return o>-1?(e.$object_dict[s][o][1]=[r,e.$object_dict[s][o][1][1]],$N):(e.$object_dict.hasOwnProperty(s)?e.$object_dict[s].push([t,[r,e.$version]]):e.$object_dict[s]=[[t,[r,e.$version]]],e.$version++,$N)},dict.__str__=function(){return dict.__repr__.apply(null,arguments)},$B.make_rmethods(dict),dict.clear=function(){var e=$B.args("clear",1,{self:null},["self"],arguments,{},null,null).self;if(e.$numeric_dict={},e.$string_dict={},e.$str_hash={},e.$object_dict={},e.$jsobj)for(var t in e.$jsobj)"$"!==t.charAt(0)&&"__class__"!==t&&delete e.$jsobj[t];return e.$version++,$N},dict.copy=function(e){e=$B.args("copy",1,{self:null},["self"],arguments,{},null,null).self;var t=_b_.dict.$factory();return $copy_dict(t,e),t},dict.fromkeys=function(){for(var e=$B.args("fromkeys",3,{cls:null,keys:null,value:null},["cls","keys","value"],arguments,{value:_b_.None},null,null),t=e.keys,r=e.value,n=e.cls,s=$B.$call(n)(),a=$B.$iter(t);;)try{var i=_b_.next(a);n===dict?dict.$setitem(s,i,r):$B.$getattr(s,"__setitem__")(i,r)}catch(e){if($B.is_exc(e,[_b_.StopIteration]))return s;throw e}},dict.get=function(){var e=$B.args("get",3,{self:null,key:null,_default:null},["self","key","_default"],arguments,{_default:$N},null,null);try{return dict.__getitem__(e.self,e.key)}catch(t){if(_b_.isinstance(t,_b_.KeyError))return e._default;throw t}};var dict_items=$B.make_view("dict_items",!0);dict_items.$iterator=$B.make_iterator_class("dict_itemiterator"),dict.items=function(e){if(arguments.length>1){var t="items() takes no arguments ("+(arguments.length-1)+" given)";throw _b_.TypeError.$factory(t)}var r=dict_items.$factory(to_list(e));return r.len_func=function(){return dict.__len__(e)},r};var dict_keys=$B.make_view("dict_keys",!0);dict_keys.$iterator=$B.make_iterator_class("dict_keyiterator"),dict.$$keys=function(e){if(arguments.length>1){var t="keys() takes no arguments ("+(arguments.length-1)+" given)";throw _b_.TypeError.$factory(t)}var r=dict_keys.$factory(to_list(e,0));return r.len_func=function(){return dict.__len__(e)},r},dict.pop=function(){var e={},t=$B.args("pop",3,{self:null,key:null,_default:null},["self","key","_default"],arguments,{_default:e},null,null),r=t.self,n=t.key,s=t._default;try{var a=dict.__getitem__(r,n);return dict.__delitem__(r,n),a}catch(t){if(t.__class__===_b_.KeyError){if(s!==e)return s;throw t}throw t}},dict.popitem=function(e){try{var t=_b_.next(_b_.iter(dict.items(e)));return dict.__delitem__(e,t[0]),_b_.tuple.$factory(t)}catch(e){if(e.__class__==_b_.StopIteration)throw KeyError.$factory("'popitem(): dictionary is empty'")}},dict.setdefault=function(){var e=$B.args("setdefault",3,{self:null,key:null,_default:null},["self","key","_default"],arguments,{_default:$N},null,null),t=e.self,r=e.key,n=e._default;try{return dict.__getitem__(t,r)}catch(e){if(e.__class__!==_b_.KeyError)throw e;void 0===n&&(n=$N);var s=r.$hash;return r.$hash=void 0,dict.$setitem(t,r,n,s),n}},dict.update=function(e){var t=$B.args("update",1,{self:null},["self"],arguments,{},"args","kw"),r=(e=t.self,t.args),n=t.kw;if(r.length>0){var s=r[0];if(isinstance(s,dict))s.$jsobj&&(s=jsobj2dict(s.$jsobj)),$copy_dict(e,s);else if(hasattr(s,"keys"))for(var a=_b_.list.$factory($B.$call($B.$getattr(s,"keys"))()),i=0,o=a.length;i<o;i++){var _=getattr(s,"__getitem__")(a[i]);dict.$setitem(e,a[i],_)}else{var l=_b_.iter(s);for(i=0;;){try{var c=_b_.next(l)}catch(e){if(e.__class__===_b_.StopIteration)break;throw e}try{key_value=_b_.list.$factory(c)}catch(e){throw _b_.TypeError.$factory("cannot convert dictionary update sequence element #"+i+" to a sequence")}if(2!==key_value.length)throw _b_.ValueError.$factory("dictionary update sequence element #"+i+" has length "+key_value.length+"; 2 is required");dict.$setitem(e,key_value[0],key_value[1]),i++}}}return $copy_dict(e,n),e.$version++,$N};var dict_values=$B.make_view("dict_values");dict_values.$iterator=$B.make_iterator_class("dict_valueiterator"),dict.values=function(e){if(arguments.length>1){var t="values() takes no arguments ("+(arguments.length-1)+" given)";throw _b_.TypeError.$factory(t)}var r=dict_values.$factory(to_list(e,1));return r.len_func=function(){return dict.__len__(e)},r},dict.$factory=function(){for(var e=dict.__new__(dict),t=[e],r=0,n=arguments.length;r<n;r++)t.push(arguments[r]);return dict.__init__.apply(null,t),e},_b_.dict=dict,$B.set_func_names(dict,"builtins"),dict.fromkeys=_b_.classmethod.$factory(dict.fromkeys),$B.getset_descriptor=$B.make_class("getset_descriptor",function(e,t){return{__class__:$B.getset_descriptor,cls:e,attr:t}}),$B.getset_descriptor.__repr__=$B.getset_descriptor.__str__=function(e){return`<attribute '${e.attr}' of '${e.cls.$infos.__name__}' objects>`},$B.set_func_names($B.getset_descriptor,"builtins");var mappingproxy=$B.mappingproxy=$B.make_class("mappingproxy",function(e){if(_b_.isinstance(e,dict))var t=$B.obj_dict(dict.$to_obj(e));else t=$B.obj_dict(e);return t.__class__=mappingproxy,t});for(var attr in mappingproxy.__setitem__=function(){throw _b_.TypeError.$factory("'mappingproxy' object does not support item assignment")},dict)void 0!==mappingproxy[attr]||["__class__","__mro__","__new__","__init__","__delitem__","clear","fromkeys","pop","popitem","setdefault","update"].indexOf(attr)>-1||("function"==typeof dict[attr]?mappingproxy[attr]=function(e){return function(){return dict[e].apply(null,arguments)}}(attr):mappingproxy[attr]=dict[attr]);function jsobj2dict(e){var t=dict.$factory();for(var r in e)if("$"!=r.charAt(0)&&"__class__"!==r){if(null===e[r])t.$string_dict[r]=[_b_.None,t.$version];else{if(void 0===e[r])continue;e[r].$jsobj===e?t.$string_dict[r]=[t,t.$version]:t.$string_dict[r]=[$B.$JS2Py(e[r]),t.$version]}t.$version++}return t}$B.set_func_names(mappingproxy,"builtins"),$B.obj_dict=function(e,t){var r=e.__class__||$B.get_class(e);if(void 0!==r&&r.$native)throw _b_.AttributeError.$factory(r.__name__+" has no attribute '__dict__'");var n=dict.$factory();return n.$jsobj=e,n.$from_js=t,n}}(__BRYTHON__),function(e){var t=e.builtins,r=t.object,n=e.JSObject,s=self;function a(e){var t=0,r=0,n=e.width||e.offsetWidth,s=e.height||e.offsetHeight;for(document.scrollingElement.scrollTop;e.offsetParent;)t+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;if(t+=e.offsetLeft||0,r+=e.offsetTop||0,e.parentElement){var i=a(e.parentElement);t+=i.left,r+=i.top}return{left:t,top:r,width:n,height:s}}function i(e){if(e.type.startsWith("touch"))return(r={}).x=t.int.$factory(e.touches[0].screenX),r.y=t.int.$factory(e.touches[0].screenY),r.__getattr__=function(e){return this[e]},r.__class__="MouseCoords",r;var r,n=0,a=0;if(!e)e=s.event;return e.pageX||e.pageY?(n=e.pageX,a=e.pageY):(e.clientX||e.clientY)&&(n=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,a=e.clientY+document.body.scrollTop+document.documentElement.scrollTop),(r={}).x=t.int.$factory(n),r.y=t.int.$factory(a),r.__getattr__=function(e){return this[e]},r.__class__="MouseCoords",r}e.$isNode=function(e){return"object"==typeof Node?e instanceof Node:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},e.$isNodeList=function(e){try{var t=Object.prototype.toString.call(e),r=new RegExp("^\\[object (HTMLCollection|NodeList)\\]$");return"object"==typeof e&&null!==r.exec(t)&&void 0!==e.length&&(0==e.length||"object"==typeof e[0]&&e[0].nodeType>0)}catch(e){return!1}};var o=["NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","type","target","currentTarget","eventPhase","bubbles","cancelable","timeStamp","stopPropagation","preventDefault","initEvent"],_=["altKey","altLeft","button","cancelBubble","clientX","clientY","contentOverflow","ctrlKey","ctrlLeft","data","dataFld","dataTransfer","fromElement","keyCode","nextPage","offsetX","offsetY","origin","propertyName","reason","recordset","repeat","screenX","screenY","shiftKey","shiftLeft","source","srcElement","srcFilter","srcUrn","toElement","type","url","wheelDelta","x","y"];e.$isEvent=function(e){for(var t=!0,r=0;r<o.length;r++)if(void 0===e[o[r]]){t=!1;break}if(t)return!0;for(r=0;r<_.length;r++)if(void 0===e[_[r]])return!1;return!0};var l={1:"ELEMENT",2:"ATTRIBUTE",3:"TEXT",4:"CDATA_SECTION",5:"ENTITY_REFERENCE",6:"ENTITY",7:"PROCESSING_INSTRUCTION",8:"COMMENT",9:"DOCUMENT",10:"DOCUMENT_TYPE",11:"DOCUMENT_FRAGMENT",12:"NOTATION"},c=e.make_class("Attributes",function(e){return{__class__:c,elt:e}});c.__contains__=function(){var t=e.args("__getitem__",2,{self:null,key:null},["self","key"],arguments,{},null,null);return t.self.elt instanceof SVGElement?t.self.elt.hasAttributeNS(null,t.key):"function"==typeof t.self.elt.hasAttribute&&t.self.elt.hasAttribute(t.key)},c.__delitem__=function(){var r=e.args("__getitem__",2,{self:null,key:null},["self","key"],arguments,{},null,null);if(!c.__contains__(r.self,r.key))throw t.KeyError.$factory(r.key);return r.self.elt instanceof SVGElement?(r.self.elt.removeAttributeNS(null,r.key),t.None):"function"==typeof r.self.elt.hasAttribute?(r.self.elt.removeAttribute(r.key),t.None):void 0},c.__getitem__=function(){var r=e.args("__getitem__",2,{self:null,key:null},["self","key"],arguments,{},null,null);if(r.self.elt instanceof SVGElement&&r.self.elt.hasAttributeNS(null,r.key))return r.self.elt.getAttributeNS(null,r.key);if("function"==typeof r.self.elt.hasAttribute&&r.self.elt.hasAttribute(r.key))return r.self.elt.getAttribute(r.key);throw t.KeyError.$factory(r.key)},c.__iter__=function(e){e.$counter=0;for(var t=e.elt.attributes,r=[],n=0;n<t.length;n++)r.push(t[n].name);return e.$items=r,e},c.__next__=function(){var r=e.args("__next__",1,{self:null},["self"],arguments,{},null,null);if(r.self.$counter<r.self.$items.length){var n=r.self.$items[r.self.$counter];return r.self.$counter++,n}throw t.StopIteration.$factory("")},c.__setitem__=function(){var r=e.args("__setitem__",3,{self:null,key:null,value:null},["self","key","value"],arguments,{},null,null);if(r.self.elt instanceof SVGElement&&"function"==typeof r.self.elt.setAttributeNS)return r.self.elt.setAttributeNS(null,r.key,r.value),t.None;if("function"==typeof r.self.elt.setAttribute)return r.self.elt.setAttribute(r.key,r.value),t.None;throw t.TypeError.$factory("Can't set attributes on element")},c.get=function(){var r=e.args("get",3,{self:null,key:null,deflt:null},["self","key","deflt"],arguments,{deflt:t.None},null,null);try{return c.__getitem__(r.self,r.key)}catch(e){if(e.__class__===t.KeyError)return r.deflt;throw e}},c.keys=function(){return c.__iter__.apply(null,arguments)},c.items=function(){for(var r=e.args("values",1,{self:null},["self"],arguments,{},null,null).self.elt.attributes,n=[],s=0;s<r.length;s++)n.push([r[s].name,r[s].value]);return t.list.__iter__(n)},c.values=function(){for(var r=e.args("values",1,{self:null},["self"],arguments,{},null,null).self.elt.attributes,n=[],s=0;s<r.length;s++)n.push(r[s].value);return t.list.__iter__(n)},e.set_func_names(c,"<dom>");var u=e.DOMEvent={__class__:t.type,__mro__:[r],$infos:{__name__:"DOMEvent"}};function f(e,t){var r=e.createSVGPoint();return r.x=t.x,r.y=t.y,r.matrixTransform(e.getScreenCTM().inverse())}u.__new__=function(e,t){var r=new Event(t);return r.__class__=u,void 0===r.preventDefault&&(r.preventDefault=function(){r.returnValue=!1}),void 0===r.stopPropagation&&(r.stopPropagation=function(){r.cancelBubble=!0}),r},u.__getattribute__=function(r,n){switch(n){case"__repr__":case"__str__":return function(){return"<DOMEvent object>"};case"x":return i(r).x;case"y":return i(r).y;case"data":return void 0!==r.dataTransfer?d.$factory(r.dataTransfer):r.data;case"target":if(void 0!==r.target)return b.$factory(r.target);case"char":return String.fromCharCode(r.which);case"svgX":if(r.target instanceof SVGSVGElement)return Math.floor(f(r.target,i(r)).x);throw t.AttributeError.$factory("event target is not an SVG element");case"svgY":if(r.target instanceof SVGSVGElement)return Math.floor(f(r.target,i(r)).y);throw t.AttributeError.$factory("event target is not an SVG element")}var s=r[n];if(void 0!==s){if("function"==typeof s){var a=function(){for(var t=[],n=0;n<arguments.length;n++)t.push(e.pyobj2jsobj(arguments[n]));return s.apply(r,arguments)};return a.$infos={__name__:s.name,__qualname__:s.name},a}return e.$JS2Py(s)}throw t.AttributeError.$factory("object DOMEvent has no attribute '"+n+"'")},u.$factory=function(e){return u.__new__(u,e)};var p=e.$DOMEvent=function(e){return e.__class__=u,e.$no_dict=!0,void 0===e.preventDefault&&(e.preventDefault=function(){e.returnValue=!1}),void 0===e.stopPropagation&&(e.stopPropagation=function(){e.cancelBubble=!0}),e};e.set_func_names(u,"browser");var d={__class__:t.type,$infos:{__module__:"browser",__name__:"Clipboard"}};d.__getitem__=function(e,t){return e.data.getData(t)},d.__mro__=[r],d.__setitem__=function(e,t,r){e.data.setData(t,r)},d.$factory=function(e){return{__class__:d,__dict__:t.dict.$factory(),data:e}},e.set_func_names(d,"<dom>");var h=e.OpenFile={__class__:t.type,__mro__:[r],$infos:{__module__:"<pydom>",__name__:"OpenFile"}};h.$factory=function(e,t,r){var n={__class__:$OpenFileDict,file:e,reader:new FileReader};return"r"===t?n.reader.readAsText(e,r):"rb"===t&&n.reader.readAsBinaryString(e),n},h.__getattr__=function(e,t){return void 0!==e["get_"+t]?e["get_"+t]:e.reader[t]},h.__setattr__=function(e,t,r){var n=e.reader;if("on"==t.substr(0,2)){n.addEventListener(t.substr(2),function(e){return r(p(e))})}else{if("set_"+t in n)return n["set_"+t](r);t in n?n[t]=r:setattr(n,t,r)}},e.set_func_names(h,"<dom>");var $={File:function(){},FileReader:function(){}};$.File.__class__=t.type,$.File.__str__=function(){return"<class 'File'>"},$.FileReader.__class__=t.type,$.FileReader.__str__=function(){return"<class 'FileReader'>"};var m={__class__:t.type,__delitem__:function(e,t){e.parent.options.remove(t.elt)},__getitem__:function(e,t){return b.$factory(e.parent.options[t])},__len__:function(e){return e.parent.options.length},__mro__:[r],__setattr__:function(e,t,r){e.parent.options[t]=r},__setitem__:function(t,r,n){t.parent.options[r]=e.$JS2Py(n)},__str__:function(e){return"<object Options wraps "+e.parent.options+">"},append:function(e,t){e.parent.options.add(t.elt)},insert:function(e,t,r){void 0===t?e.parent.options.add(r.elt):e.parent.options.add(r.elt,t)},item:function(e,t){return e.parent.options.item(t)},namedItem:function(e,t){return e.parent.options.namedItem(t)},remove:function(e,t){e.parent.options.remove(t.elt)},$infos:{__module__:"<pydom>",__name__:"Options"},$factory:function(e){return{__class__:m,parent:e}}};e.set_func_names(m,"<dom>");var b={__class__:t.type,__mro__:[r],$infos:{__module__:"browser",__name__:"DOMNode"}};function g(e){for(var t=[],r=0;r<e.length;r++)t.push(b.$factory(e[r]));return t}b.$factory=function(r,n){if(r.__class__===b)return r;if("number"==typeof r||"boolean"==typeof r||"string"==typeof r)return r;if(void 0===n&&void 0!==b.tags){var s=b.tags.$string_dict;if(void 0!==s&&s.hasOwnProperty(r.tagName)){try{var a=s[r.tagName][0]}catch(e){throw console.log("tdict",s,"tag name",r.tagName),e}if(void 0!==a)return a.$elt_wrap=r,a.$factory()}}void 0!==r.$brython_id&&9!=r.nodeType||(r.$brython_id="DOM-"+e.UUID());var i=t.dict.$factory();return i.$jsobj=r,{__class__:b,__dict__:i,elt:r}},b.__add__=function(r,n){var s=x.$factory();if(s.children=[r],pos=1,t.isinstance(n,x))s.children=s.children.concat(n.children);else if(t.isinstance(n,[t.str,t.int,t.float,t.list,t.dict,t.set,t.tuple]))s.children[pos++]=b.$factory(document.createTextNode(t.str.$factory(n)));else if(t.isinstance(n,b))s.children[pos++]=n;else try{s.children=s.children.concat(t.list.$factory(n))}catch(r){throw t.TypeError.$factory("can't add '"+e.class_name(n)+"' object to DOMNode instance")}return s},b.__bool__=function(e){return!0},b.__contains__=function(e,t){if(9==e.elt.nodeType&&"string"==typeof t)return null!==document.getElementById(t);if(t=void 0!==t.elt?t.elt:t,void 0!==e.elt.length&&"function"==typeof e.elt.item)for(var r=0,n=e.elt.length;r<n;r++)if(e.elt.item(r)===t)return!0;return!1},b.__del__=function(e){if(!e.elt.parentNode)throw t.ValueError.$factory("can't delete "+t.str.$factory(e.elt));e.elt.parentNode.removeChild(e.elt)},b.__delattr__=function(e,r){if(void 0===e.elt[r])throw t.AttributeError.$factory(`cannot delete DOMNode attribute '${r}'`);return delete e.elt[r],t.None},b.__delitem__=function(e,r){if(9==e.elt.nodeType){var n=e.elt.getElementById(r);if(!n)throw t.KeyError.$factory(r);n.parentNode.removeChild(n)}else e.elt.parentNode.removeChild(e.elt)},b.__dir__=function(e){var t=[];for(var r in e.elt)"$"!=r.charAt(0)&&t.push(r);return t.sort(),t},b.__eq__=function(e,t){return e.elt==t.elt},b.__getattribute__=function(s,i){switch("$$"==i.substr(0,2)&&(i=i.substr(2)),i){case"attrs":return c.$factory(s.elt);case"class_name":case"html":case"id":case"parent":case"query":case"text":return b[i](s);case"height":case"left":case"top":case"width":if("CANVAS"==s.elt.tagName&&s.elt[i])return s.elt[i];if(s.elt instanceof SVGElement)return s.elt[i].baseVal.value;if(s.elt.style[i])return parseInt(s.elt.style[i]);var o=window.getComputedStyle(s.elt)[i];if(void 0!==o)return Math.floor(parseFloat(o)+.5);throw t.AttributeError.$factory("style."+i+" is not set for "+t.str.$factory(s));case"x":case"y":if(!(s.elt instanceof SVGElement)){var _=a(s.elt);return"x"==i?_.left:_.top}case"clear":case"closest":return function(){return b[i](s,arguments[0])};case"headers":if(9==s.elt.nodeType){var l=new XMLHttpRequest;l.open("GET",document.location,!1),l.send(null);var u=l.getAllResponseHeaders();u=u.split("\r\n");for(var f=t.dict.$factory(),p=0;p<u.length;p++){var d=u[p];if(0!=d.strip().length){_=d.search(":");f.__setitem__(d.substr(0,_),d.substr(_+1).lstrip())}}return f}break;case"$$location":i="location"}if("select"==i&&1==s.elt.nodeType&&["INPUT","TEXTAREA"].indexOf(s.elt.tagName.toUpperCase())>-1)return function(e){return void 0===e?(s.elt.select(),t.None):b.select(s,e)};var h,$,g=s.elt[i];if(void 0===g&&e.aliased_names[i]&&(g=s.elt["$$"+i]),void 0===g)return r.__getattribute__(s,i);if(void 0!==(f=g)){if(null===f)return t.None;if("function"==typeof f){var y=(h=f,$=s.elt,function(){for(var r=[],s=0,a=0;a<arguments.length;a++){var i=arguments[a];if("function"==typeof i){if(i.$cache)var o=i.$cache;else o=function(t){return function(){try{return t.apply(null,arguments)}catch(t){e.handle_error(t)}}}(i),i.$cache=o;r[s++]=o}else t.isinstance(i,n)?r[s++]=i.js:t.isinstance(i,b)?r[s++]=i.elt:i===t.None?r[s++]=null:i.__class__==t.dict?r[s++]=t.dict.$to_obj(i):r[s++]=i}var _=h.apply($,r);return e.$JS2Py(_)});return y.$infos={__name__:i,__qualname__:i},y.$is_func=!0,y}return"options"==i?m.$factory(s.elt):"style"==i?e.JSObject.$factory(s.elt[i]):Array.isArray(f)?f:e.$JS2Py(f)}return r.__getattribute__(s,i)},b.__getitem__=function(e,r){if(9==e.elt.nodeType){if("string"==typeof r){if(s=e.elt.getElementById(r))return b.$factory(s);throw t.KeyError.$factory(r)}try{for(var n=e.elt.getElementsByTagName(r.$infos.__name__),s=[],a=0;a<n.length;a++)s.push(b.$factory(n[a]));return s}catch(e){throw t.KeyError.$factory(t.str.$factory(r))}}else{if(("number"==typeof r||"boolean"==typeof r)&&"function"==typeof e.elt.item){var i=t.int.$factory(r);if(i<0&&(i+=e.elt.length),void 0===(s=b.$factory(e.elt.item(i))))throw t.KeyError.$factory(r);return s}if("string"==typeof r&&e.elt.attributes&&"function"==typeof e.elt.attributes.getNamedItem){var o=e.elt.attributes.getNamedItem(r);if(o)return o.value;throw t.KeyError.$factory(r)}}},b.__hash__=function(t){return void 0===t.__hashvalue__?t.__hashvalue__=e.$py_next_hash--:t.__hashvalue__},b.__iter__=function(t){if(void 0!==t.elt.length&&"function"==typeof t.elt.item)for(var r=[],n=0,s=t.elt.length;n<s;n++)r.push(b.$factory(t.elt.item(n)));else if(void 0!==t.elt.childNodes)for(r=[],n=0,s=t.elt.childNodes.length;n<s;n++)r.push(b.$factory(t.elt.childNodes[n]));return e.$iter(r)},b.__le__=function(r,n){var s=r.elt;if(9==r.elt.nodeType&&(s=r.elt.body),t.isinstance(n,x))for(var a=0;a<n.children.length;a++)s.appendChild(n.children[a].elt);else if("string"==typeof n||"number"==typeof n){var i=document.createTextNode(n.toString());s.appendChild(i)}else if(t.isinstance(n,b))s.appendChild(n.elt);else try{t.list.$factory(n).forEach(function(e){b.__le__(r,e)})}catch(r){throw t.TypeError.$factory("can't add '"+e.class_name(n)+"' object to DOMNode instance")}},b.__len__=function(e){return e.elt.length},b.__mul__=function(e,r){if(t.isinstance(r,t.int)&&r.valueOf()>0){for(var n=x.$factory(),s=n.children.length,a=0;a<r.valueOf();a++)n.children[s++]=b.clone(e)();return n}throw t.ValueError.$factory("can't multiply "+e.__class__+"by "+r)},b.__ne__=function(e,t){return!b.__eq__(e,t)},b.__next__=function(e){if(e.$counter++,e.$counter<e.elt.childNodes.length)return b.$factory(e.elt.childNodes[e.$counter]);throw t.StopIteration.$factory("StopIteration")},b.__radd__=function(e,t){var r=x.$factory(),n=b.$factory(document.createTextNode(t));return r.children=[n,e],r},b.__str__=b.__repr__=function(e){var t=Object.getPrototypeOf(e.elt);if(t){var r=t.constructor.name;if(void 0===r){var n=t.constructor.toString();r=n.substring(8,n.length-1)}return"<"+r+" object>"}return"<DOMNode object type '"+l[e.elt.nodeType]+"' name '"+e.elt.nodeName+"'>"},b.__setattr__=function(r,n,s){if("on"!=n.substr(0,2)){switch(n){case"left":case"top":case"width":case"height":if(t.isinstance(s,t.int)&&1==r.elt.nodeType)return r.elt.style[n]=s+"px",t.None;throw t.ValueError.$factory(n+" value should be an integer, not "+e.class_name(s))}if(void 0!==b["set_"+n])return b["set_"+n](r,s);function a(t){console.log(t);var r=e.last(e.frames_stack);if(e.debug>0){var n=r[1].$line_info.split(",");if(console.log("module",n[1],"line",n[0]),e.$py_src.hasOwnProperty(n[1])){var s=e.$py_src[n[1]];console.log(s.split("\n")[parseInt(n[0])-1])}}else console.log("module",r[2])}for(var i=Object.getPrototypeOf(r.elt),o=0;i&&i!==Object.prototype&&o++<10;){var _=Object.getOwnPropertyDescriptors(i);if(!_||"function"!=typeof _.hasOwnProperty)break;if(_.hasOwnProperty(n)){_[n].writable||void 0!==_[n].set||a("Warning: property '"+n+"' is not writable. Use element.attrs['"+n+"'] instead.");break}i=Object.getPrototypeOf(i)}return r.elt.style&&void 0!==r.elt.style[n]&&a("Warning: '"+n+"' is a property of element.style"),s.__class__===e.JSObject&&s.js instanceof EventTarget&&(s=s.js),r.elt[n]=s,t.None}e.$bool(s)?b.bind(r,n.substr(2),s):b.unbind(r,n.substr(2))},b.__setitem__=function(e,t,r){"number"==typeof t?e.elt.childNodes[t]=r:"string"==typeof t&&e.elt.attributes&&(e.elt instanceof SVGElement?e.elt.setAttributeNS(null,t,r):"function"==typeof e.elt.setAttribute&&e.elt.setAttribute(t,r))},b.abs_left={__get__:function(e){return a(e.elt).left},__set__:function(){throw t.AttributeError.$factory("'DOMNode' objectattribute 'abs_left' is read-only")}},b.abs_top={__get__:function(e){return a(e.elt).top},__set__:function(){throw t.AttributeError.$factory("'DOMNode' objectattribute 'abs_top' is read-only")}},b.bind=function(r,n){var s,a=e.args("bind",4,{self:null,event:null,func:null,options:null},["self","event","func","options"],arguments,{options:t.None},null,null),i=(r=a.self,n=a.event,a.func),o=a.options,_=(s=i,function(t){try{return s(p(t))}catch(t){if(void 0!==t.__class__)e.handle_error(t);else try{e.$getattr(e.stderr,"write")(t)}catch(e){console.log(t)}}});return _.$infos=i.$infos,_.$attrs=i.$attrs||{},_.$func=i,"boolean"==typeof o?r.elt.addEventListener(n,_,o):o.__class__===t.dict?r.elt.addEventListener(n,_,t.dict.$to_obj(o)):o===t.None&&r.elt.addEventListener(n,_,!1),r.elt.$events=r.elt.$events||{},r.elt.$events[n]=r.elt.$events[n]||[],r.elt.$events[n].push([i,_]),r},b.children=function(e){var t=[],r=e.elt;return console.log(r,r.childNodes),9==r.nodeType&&(r=r.body),r.childNodes.forEach(function(e){t.push(b.$factory(e))}),t},b.clear=function(e){var t=e.elt;for(9==t.nodeType&&(t=t.body);t.firstChild;)t.removeChild(t.firstChild)},b.Class=function(e){return void 0!==e.elt.className?e.elt.className:t.None},b.class_name=function(e){return b.Class(e)},b.clone=function(e){var t=b.$factory(e.elt.cloneNode(!0)),r=e.elt.$events||{};for(var n in r){r[n].forEach(function(e){var r=e[0];b.bind(t,n,r)})}return t},b.closest=function(e,r){var n=e.elt;for(r=r.toLowerCase();n.tagName.toLowerCase()!=r;)if(void 0===(n=n.parentNode)||void 0===n.tagName)throw t.KeyError.$factory("no parent of type "+r);return b.$factory(n)},b.events=function(e,t){e.elt.$events=e.elt.$events||{};var r=e.elt.$events[t]=e.elt.$events[t]||[],n=[];return r.forEach(function(e){n.push(e[1])}),n},b.focus=function(e){return t=e.elt,function(){setTimeout(function(){t.focus()},10)};var t},b.get=function(r){for(var n=r.elt,s=[],a=1;a<arguments.length;a++)s.push(arguments[a]);var i=e.args("get",0,{},[],s,{},null,"kw"),o={};if(t.list.$factory(t.dict.items(i.kw)).forEach(function(e){o[e[0]]=e[1]}),void 0!==o.name){if(void 0===n.getElementsByName)throw t.TypeError.$factory("DOMNode object doesn't support selection by name");return g(n.getElementsByName(o.name))}if(void 0!==o.tag){if(void 0===n.getElementsByTagName)throw t.TypeError.$factory("DOMNode object doesn't support selection by tag name");return g(n.getElementsByTagName(o.tag))}if(void 0!==o.classname){if(void 0===n.getElementsByClassName)throw t.TypeError.$factory("DOMNode object doesn't support selection by class name");return g(n.getElementsByClassName(o.classname))}if(void 0!==o.id){if(void 0===n.getElementById)throw t.TypeError.$factory("DOMNode object doesn't support selection by id");var _=document.getElementById(o.id);return _?[b.$factory(_)]:[]}if(void 0!==o.selector){if(void 0===n.querySelectorAll)throw t.TypeError.$factory("DOMNode object doesn't support selection by selector");return g(n.querySelectorAll(o.selector))}return res},b.getContext=function(e){if(!("getContext"in e.elt))throw t.AttributeError.$factory("object has no attribute 'getContext'");var r=e.elt;return function(e){return n.$factory(r.getContext(e))}},b.getSelectionRange=function(e){if(void 0!==e.elt.getSelectionRange)return e.elt.getSelectionRange.apply(null,arguments)},b.html=function(e){var r=e.elt.innerHTML;return void 0===r&&(r=9==e.elt.nodeType?e.elt.body.innerHTML:t.None),r},b.id=function(e){return void 0!==e.elt.id?e.elt.id:t.None},b.index=function(e,t){var r;r=void 0===t?e.elt.parentElement.childNodes:e.elt.parentElement.querySelectorAll(t);for(var n=-1,s=0;s<r.length;s++)if(r[s]===e.elt){n=s;break}return n},b.inside=function(e,t){t=t.elt;for(var r=e.elt;;){if(t===r)return!0;if(!(r=r.parentElement))return!1}},b.options=function(e){return new $OptionsClass(e.elt)},b.parent=function(e){return e.elt.parentElement?b.$factory(e.elt.parentElement):t.None},b.reset=function(e){return function(){e.elt.reset()}},b.scrolled_left={__get__:function(e){return a(e.elt).left-document.scrollingElement.scrollLeft},__set__:function(){throw t.AttributeError.$factory("'DOMNode' objectattribute 'scrolled_left' is read-only")}},b.scrolled_top={__get__:function(e){return a(e.elt).top-document.scrollingElement.scrollTop},__set__:function(){throw t.AttributeError.$factory("'DOMNode' objectattribute 'scrolled_top' is read-only")}},b.select=function(e,r){if(void 0===e.elt.querySelectorAll)throw t.TypeError.$factory("DOMNode object doesn't support selection by selector");return g(e.elt.querySelectorAll(r))},b.select_one=function(e,r){if(void 0===e.elt.querySelector)throw t.TypeError.$factory("DOMNode object doesn't support selection by selector");var n=e.elt.querySelector(r);return null===n?t.None:b.$factory(n)},b.style=function(t){return t.elt.style.float=t.elt.style.cssFloat||t.style.styleFloat,e.JSObject.$factory(t.elt.style)},b.setSelectionRange=function(e){return void 0!==this.setSelectionRange?(t=this,function(){return t.setSelectionRange.apply(t,arguments)}):void 0!==this.createTextRange?function(e){return function(t,r){null==r&&(r=t);var n=e.createTextRange();n.collapse(!0),n.moveEnd("character",t),n.moveStart("character",r),n.select()}}(this):void 0;var t},b.set_class_name=function(e,t){e.elt.setAttribute("class",t)},b.set_html=function(e,r){var n=e.elt;9==n.nodeType&&(n=n.body),n.innerHTML=t.str.$factory(r)},b.set_style=function(r,n){if(!t.isinstance(n,t.dict))throw t.TypeError.$factory("style must be dict, not "+e.class_name(n));for(var s=t.list.$factory(t.dict.items(n)),a=0;a<s.length;a++){var i=s[a][0],o=s[a][1];if("float"==i.toLowerCase())r.elt.style.cssFloat=o,r.elt.style.styleFloat=o;else{switch(i){case"top":case"left":case"width":case"borderWidth":t.isinstance(o,t.int)&&(o+="px")}r.elt.style[i]=o}}},b.set_text=function(e,r){var n=e.elt;9==n.nodeType&&(n=n.body),n.innerText=t.str.$factory(r),n.textContent=t.str.$factory(r)},b.set_value=function(e,r){e.elt.value=t.str.$factory(r)},b.submit=function(e){return function(){e.elt.submit()}},b.text=function(e){var r=e.elt;9==r.nodeType&&(r=r.body);var n=r.innerText||r.textContent;return null===n&&(n=t.None),n},b.toString=function(e){return void 0===e?"DOMNode":e.elt.nodeName},b.trigger=function(e,t){if(e.elt.fireEvent)e.elt.fireEvent("on"+t);else{var r=document.createEvent("Events");r.initEvent(t,!0,!1),e.elt.dispatchEvent(r)}},b.unbind=function(r,n){if(r.elt.$events=r.elt.$events||{},r.elt.$events==={})return t.None;if(void 0===n){for(var n in r.elt.$events)b.unbind(r,n);return t.None}if(void 0===r.elt.$events[n]||0==r.elt.$events[n].length)return t.None;var s=r.elt.$events[n];if(2==arguments.length){for(var a=0;a<s.length;a++){var i=s[a][1];r.elt.removeEventListener(n,i,!1)}return r.elt.$events[n]=[],t.None}for(a=2;a<arguments.length;a++){var o=!1;if(void 0===(c=(i=arguments[a]).$func)){for(var _=!1,l=0;l<s.length;l++)if(s[l][0]===i){var c=i;_=!0;break}if(!_)throw t.TypeError.$factory("function is not an event callback")}for(l=0;l<s.length;l++)if(e.$getattr(c,"__eq__")(s[l][0])){i=s[l][1];r.elt.removeEventListener(n,i,!1),s.splice(l,1),o=!0;break}if(!o)throw t.KeyError.$factory("missing callback for event "+n)}},e.set_func_names(b,"browser");var y={__class__:t.type,__mro__:[t.object],$infos:{__name__:"query"},__contains__:function(e,t){return e._keys.indexOf(t)>-1},__getitem__:function(e,r){var n=e._values[r];if(void 0===n)throw t.KeyError.$factory(r);return 1==n.length?n[0]:n}},v=e.make_iterator_class("query string iterator");y.__iter__=function(e){return v.$factory(e._keys)},y.__setitem__=function(e,r,n){return e._values[r]=[n],t.None},y.__str__=y.__repr__=function(e){var t=[];for(var r in e._values)for(const n of e._values[r])t.push(encodeURIComponent(r)+"="+encodeURIComponent(n));return 0==t.length?"":"?"+t.join("&")},y.getfirst=function(e,r,n){var s=e._values[r];return void 0===s?void 0===n?t.None:n:s[0]},y.getlist=function(e,t){var r=e._values[t];return void 0===r?[]:r},y.getvalue=function(e,r,n){try{return y.__getitem__(e,r)}catch(e){return void 0===n?t.None:n}},y.keys=function(e){return e._keys},b.query=function(e){for(var t={__class__:y,_keys:[],_values:{}},r=location.search.substr(1).split("&"),n=0;n<r.length;n++){var s=r[n].search("="),a=[r[n].substr(0,s),r[n].substr(s+1)],i=decodeURIComponent(a[0]),o=decodeURIComponent(a[1]);t._keys.indexOf(i)>-1?t._values[i].push(o):(t._keys.push(i),t._values[i]=[o])}return t};var x={__class__:t.type,__mro__:[r],$infos:{__module__:"<pydom>",__name__:"TagSum"},appendChild:function(e,t){e.children.push(t)},__add__:function(r,n){return e.get_class(n)===x?r.children=r.children.concat(n.children):t.isinstance(n,[t.str,t.int,t.float,t.dict,t.set,t.list])?r.children=r.children.concat(b.$factory(document.createTextNode(n))):r.children.push(n),r},__radd__:function(e,t){var r=x.$factory();return r.children=e.children.concat(b.$factory(document.createTextNode(t))),r},__repr__:function(e){for(var t="<object TagSum> ",r=0;r<e.children.length;r++)t+=e.children[r],"[object Text]"==e.children[r].toString()&&(t+=" ["+e.children[r].textContent+"]\n");return t}};x.__str__=x.toString=x.__repr__,x.clone=function(e){for(var t=x.$factory(),r=0;r<e.children.length;r++)t.children.push(e.children[r].cloneNode(!0));return t},x.$factory=function(){return{__class__:x,children:[],toString:function(){return"(TagSum)"}}},e.set_func_names(x,"<dom>"),e.TagSum=x;var w=n.$factory(s);w.get_postMessage=function(e,r){if(t.isinstance(e,dict)){var n={__class__:"dict"};t.list.$factory(t.dict.items(e)).forEach(function(e){n[e[0]]=e[1]}),e=n}return s.postMessage(e,r)},e.DOMNode=b,e.win=w}(__BRYTHON__),function($B){var _b_=$B.builtins,bltns=$B.InjectBuiltins();function rstrip(e,t){for(var r=t||" \t\n",n=0,s=e.length;n<s&&r.indexOf(e.charAt(s-1-n))>-1;)n++;return e.substr(0,s-n)}function jscode_namespace(e,t,r){var n="";"store"===t&&(n=" = {}");var s='for(var attr in this.blocks){eval("var " + attr + " = this.blocks[attr]")};\nvar $locals_'+e+" = this.env"+n+', \n $local_name = "'+e+'", \n $locals = $locals_'+e+";";return r&&(s+="$locals.$parent = $locals_"+r.replace(/\./g,"_")+";"),s}function make_node(e,t){if("marker"!==t.type){var r,n,s=!1,a=!1,i=!1;if(r=t.C.$genjs?t.C.$genjs:t.C.$genjs=t.C.to_js(),t.locals_def){var o=t.func_node.parent_block.id;if("generator"==t.func_node.ntype)r=jscode_namespace(e.iter_id,"store",o);else r+="$locals.$parent = $locals_"+o+";"}if(t.is_catch&&(a=!0,s=!0),t.is_except&&(a=!0),"node"==t.C.type){var _=t.C.tree[0],l=_.type;switch(_.type){case"except":a=!0,s=!0;break;case"single_kw":s=!0,"else"==_.token&&(i=!0),"finally"==_.token&&(a=!0);break;case"condition":"elif"==_.token&&(i=!0,s=!0),"if"==_.token&&(s=!0)}}if(r){var c=new $B.genNode(r);if(c.line_num=t.line_num,"yield"==l){for(var u=in_ctx_manager(t),f=e.yields.length;r.endsWith(";");)r=r.substr(0,r.length-1);n="";for(const e of in_try(t))n+=`$locals.$run_finally${e.line_num}=false;`;n+="return ["+r+", "+f+"]",void 0!==u&&(n="$locals.$yield"+u.ctx_manager_num+" = true;"+n),c.data=n,e.yields.push(c)}else if(t.is_set_yield_value){t.after_yield&&(u=in_ctx_manager(t));var p="var sent_value = this.sent_value === undefined ? _b_.None : this.sent_value;",d="\n"+" ".repeat(t.indent);if(p+=d+"this.sent_value = _b_.None",p+=d+"if(sent_value.__class__ === $B.$GeneratorSendError){sent_value.err.$stack.splice(0, 0, $B.freeze([$top_frame])[0]); throw sent_value.err};","number"==typeof r&&(p+=d+"var $yield_value"+r+" = sent_value;"),void 0!==u){var h=u.ctx_manager_num;p+=d+"$locals.$yield"+h+" = true;",p+=d+"$locals.$exc"+h+" = true;"}c.data=p}else if("break"==l||"continue"==l)c["is_"+l]=!0,c.loop_num=t.C.tree[0].loop_ctx.loop_num;else if("return"==l){(u=in_ctx_manager(t))&&(c.data="$locals.$ctx_manager_exit"+u.ctx_manager_num+"(_b_.None, _b_.None, _b_.None);"+c.data);var $="";for(const e of in_try(t))$+=`$locals.$run_finally${e.line_num}=true;`;c.data=$+c.data}if(c.is_yield="yield"==l||"return"==l,c.is_cond=s,c.is_except=a,c.is_if="condition"==l&&"if"==_.token,c.is_try=t.is_try,c.is_else=i,c.loop_start=t.loop_start,c.is_set_yield_value=t.is_set_yield_value,c.ctx_manager_num=t.ctx_manager_num,"single_kw"==l&&"finally"==_.token){var m;for(const e of t.parent.children)if(e.is_try)m=e;else if(e===t)break;var b=t.children.slice(),g=new $B.genNode(`if($locals.$run_finally${m.line_num})`);c.addChild(g);for(const t of b){void 0!==(x=make_node(e,t))&&g.addChild(x)}}else{for(var y=0,v=t.children.length;y<v;y++){var x;void 0!==(x=make_node(e,t.children[y]))&&c.addChild(x)}t.is_try&&c.addChild(new $B.genNode(`$locals.$run_finally${t.line_num}=true`))}}return c}}eval(bltns),$B.genNode=function(e,t){this.data=e,this.parent=t,this.children=[],this.has_child=!1,void 0===t&&(this.nodes={},this.num=0),this.addChild=function(e){void 0===e&&console.log("child of "+this+" undefined"),this.children[this.children.length]=e,this.has_child=!0,e.parent=this,e.rank=this.children.length-1},this.insert=function(e,t){void 0===t&&console.log("child of "+this+" undefined"),this.children.splice(e,0,t),this.has_child=!0,t.parent=this,t.rank=e},this.clone=function(){var e=new $B.genNode(this.data);return e.has_child=this.has_child,e.is_cond=this.is_cond,e.is_except=this.is_except,e.is_if=this.is_if,e.is_try=this.is_try,e.is_else=this.is_else,e.loop_num=this.loop_num,e.loop_start=this.loop_start,e.is_yield=this.is_yield,e.line_num=this.line_num,e},this.clone_tree=function(e,t){var r=new $B.genNode(this.data);if(this.replaced&&!in_loop(this)&&(console.log("already replaced",this),r.data="void(0)"),this!==e||!this.parent.is_cond&&in_loop(this)||(e.replaced?r=new $B.genNode(e.data):(console.log("replace by void(0)",this),r=new $B.genNode("void(0)")),e.replaced=!0),t&&(this.is_break||this.is_continue)){var n=in_loop(this);r.loop=n;n.has("yield");r.data="",this.is_break&&(r.data+='$locals["$no_break'+this.loop_num+'"] = false;'),n.has("yield")?r.data+='var err = new Error("'+(this.is_break?"break":"continue")+'"); err.__class__ = $B.GeneratorBreak; throw err;':r.data+=this.is_break?"break":"continue",r.is_break=this.is_break}r.is_continue=this.is_continue,r.has_child=this.has_child,r.is_cond=this.is_cond,r.is_except=this.is_except,r.is_try=this.is_try,r.is_else=this.is_else,r.loop_num=this.loop_num,r.loop_start=this.loop_start,r.no_break=!0,r.is_yield=this.is_yield,r.line_num=this.line_num;for(var s=0,a=this.children.length;s<a;s++)r.addChild(this.children[s].clone_tree(e,t)),this.children[s].is_break&&(r.no_break=!1);return r},this.has=function(e){if(this["is_"+e])return!0;for(var t=0,r=this.children.length;t<r;t++)if(!(["break","continue"].indexOf(e)>-1&&void 0!==this.children[t].loop_start)&&this.children[t].has(e))return!0;return!1},this.indent_src=function(e){return" ".repeat(e*e)},this.src=function(e){e=e||0;var t=[this.indent_src(e)+this.data],r=1;this.has_child&&(t[r++]="{"),t[r++]="\n";for(var n=0,s=this.children.length;n<s&&(t[r++]=this.children[n].src(e+1),!this.children[n].is_yield);n++);return this.has_child&&(t[r++]="\n"+this.indent_src(e)+"}\n"),t.join("")},this.toString=function(){return"<Node "+this.data+">"}},$B.GeneratorBreak=$B.make_class("GeneratorBreak"),$B.$GeneratorSendError={};var $GeneratorReturn={};function in_ctx_manager(e){for(var t=e.parent;t&&"generator"!==t.ntype;){if(void 0!==t.ctx_manager_num)return t;t=t.parent}}function in_loop(e){for(;e;){if(void 0!==e.loop_start)return e;e=e.parent}return!1}function in_try(e){for(var t=[],r=e.parent,n=0;r;)r.is_try&&(t[n++]=r),r=r.parent;return t}$B.generator_return=function(e){return{__class__:$GeneratorReturn,value:e}};var $BRGeneratorDict={__class__:_b_.type,$infos:{__name__:"generator",__module__:"builtins"},$is_class:!0};function remove_line_nums(e){for(var t=0;t<e.children.length;t++)e.children[t].is_line_num?e.children.splice(t,1):remove_line_nums(e.children[t])}function make_next(e,t){var r=e.func_root.yields[t];r.replaced=!1;var n=new $B.genNode(e.def_ctx.to_js()),s=e.func_root.clone();n.addChild(s);e.func_root;var a=jscode_namespace(e.iter_id,"restore");for(s.addChild(new $B.genNode(a)),a='var $top_frame = ["'+e.iter_id+'",$locals,"'+e.module+'",$locals_'+e.module.replace(/\./g,"_")+"];$B.frames_stack.push($top_frame); var $stack_length = $B.frames_stack.length;",a+="$locals.$is_generator = true;",a+="$locals.$yield_node_id = "+t+";",s.addChild(new $B.genNode(a));;){var i,o,_=r.parent,l=[],c=0,u=r.rank+1;if(void 0!==r.loop_start)u=r.rank;else if(r.is_cond)for(;u<_.children.length&&(_.children[u].is_except||_.children[u].is_else);)u++;else if(r.is_try||r.is_except)for(;u<_.children.length&&(_.children[u].is_except||_.children[u].is_else);)u++;for(var f=u,p=_.children.length;f<p;f++){var d=_.children[f].clone_tree(null,!0);if(d.is_continue){!0;var h=d.loop;l[c++]=h.clone_tree();break}d.has("continue")&&(o=!0,continue_pos=c+1),l[c++]=d,d.has("break")&&(i=!0)}if((i||o)&&l.length>0){var $=new $B.genNode("try");for(f=0,p=l.length;f<p;f++)$.addChild(l[f]);if(catch_test=new $B.genNode("catch(err)"),catch_test.addChild(new $B.genNode("if(err.__class__ !== $B.GeneratorBreak){throw err}")),l=[$,catch_test],void 0!==_.loop_start){var m='if($locals["$no_break'+_.loop_start+'"])',b=new $B.genNode(m);b.addChild($),b.addChild(catch_test),l=[b]}}var g=in_try(r);if(0==g.length)for(f=0;f<l.length;f++)s.addChild(l[f]);else{var y=[];for(c=0,f=0;f<g.length;f++){var v=g[f],x=v.clone();if(0==f)for(var w=0;w<l.length;w++)x.addChild(l[w]);var B=[x],k=1;for(w=v.rank+1;w<v.parent.children.length&&v.parent.children[w].is_except;w++)if("finally"==v.parent.children[w].data){if(h=in_loop(r))for(var j=h.parent;j;){if(j===v){!1;break}j=j.parent}B[k++]=v.parent.children[w].clone_tree(null,!0)}else B[k++]=v.parent.children[w].clone_tree(null,!0);1==B.length&&B.push(new $B.genNode("catch(err){}")),y[c++]=B}for(j=s;y.length;)(B=y.pop()).forEach(function(e){j.addChild(e)}),j=B[0]}if((r=_)===e.func_root)break}var E=n.children[0].src(),N=E.substr(E.search("function"));return N=(N=N.substr(10)).substr(N.search("function")),e.def_ctx.async&&(N="async "+N),N}$B.gen_counter=0,$B.$BRgenerator=function(e,t,r,n){for(var s=n.parent_block;s.parent_block&&"__builtins__"!=s.parent_block.id;)s=s.parent_block;n.line_num,s.id.replace(/\./g,"_");var a=n.C.tree[0],i=n.module,o=r;$B.$add_line_num(n,a.rank);var _=new $B.genNode(a.to_js());remove_line_nums(n.parent),_.module=i,_.yields=[],_.loop_ends={},_.def_id=r,_.iter_id=o;for(var l=0,c=n.children.length;l<c;l++){var u=make_node(_,n.children[l]);void 0!==u&&_.addChild(u)}var f={__class__:$BRGeneratorDict,blocks:t,def_ctx:a,def_id:r,func_name:e,func_root:_,module:i,gi_running:!1,iter_id:o,id:o,num:0},p=_.src(),d=p.substr(p.search("function")),h=[d+="return "+a.name+a.num+"}"];f.parent_block=n;for(l=0;l<_.yields.length;l++)h.push(make_next(f,l));return h};var generator={__class__:_b_.type,__mro__:[_b_.object],$infos:{__module__:"builtins",__name__:"generator"},$is_class:!0,__dir__:function(e){var t=object.__dir__(e);for(const e of["blocks","env","nexts","next","iter_id","sent_value"])t.splice(t.indexOf(e),1);return t},__enter__:function(e){console.log("generator.__enter__ called")},__exit__:function(e){console.log("generator.__exit__ called")},__str__:function(e){return"<generator object "+e.__name__+">"},__iter__:function(e){return e},__next__:function(e){if(e.$finished)throw _b_.StopIteration.$factory(_b_.None);if(!0===e.gi_running)throw ValueError.$factory("generator already executing");if(e.gi_running=!0,void 0===e.next)throw e.$finished=!0,_b_.StopIteration.$factory(_b_.None);try{var t=e.next.apply(e,e.args)}catch(t){throw e.$finished=!0,t.$stack=$B.frames_stack.slice(),t}finally{e.gi_running=!1,$B.leave_frame(e.iter_id)}if(void 0===t)throw _b_.StopIteration.$factory(_b_.None);if(t[0].__class__===$GeneratorReturn)throw e.$finished=!0,StopIteration.$factory(t[0].value);return e.next=e.nexts[t[1]],e.gi_running=!1,t[0]},close:function(e,t){e.sent_value={__class__:$B.$GeneratorSendError,err:_b_.GeneratorExit.$factory()};try{if(generator.__next__(e)!==_b_.None)throw _b_.RuntimeError.$factory("closed generator returned a value")}catch(e){if($B.is_exc(e,[_b_.StopIteration,_b_.GeneratorExit]))return _b_.None;throw e}},send:function(e,t){return e.sent_value=t,generator.__next__(e)},$$throw:function(e,t,r,n){var s=t;if(s.$is_class){if(!_b_.issubclass(t,_b_.BaseException))throw _b_.TypeError.$factory("exception value must be an instance of BaseException");void 0===r&&(r=$B.$call(s)())}else void 0===r?r=s:s=$B.$call(s)(r);return void 0!==n&&(s.$traceback=n),e.sent_value={__class__:$B.$GeneratorSendError,err:r},generator.__next__(e)}},async_generator={__class__:_b_.type,__mro__:[_b_.object],$infos:{__module__:"builtins",__name__:"async_generator"},$is_class:!0};generator.$factory=$B.genfunc=function(e,t,r,n,s){if(e.startsWith("__ge"))for(var a in r)if(a!="$locals_"+e)for(var i in r[a])r["$locals_"+e][i]=r[a][i];return function(){var a="$gen"+$B.gen_counter++,i=[];i.push(n[0](s));for(var o=1;o<n.length;o++)i.push(n[o]);var _={__class__:t?async_generator:generator,__name__:e,args:Array.prototype.slice.call(arguments),blocks:r,env:{},name:e,nexts:i.slice(1),next:i[0],iter_id:a,$started:!1,$defaults:s,$is_generator_obj:!0};return t?_.ag_running=!1:_.gi_running=!1,_}},$B.set_func_names(generator,"builtins");var ag_closed={};async_generator.__aiter__=function(e){return e},async_generator.__anext__=async function(e){if(e.$finished)throw _b_.StopAsyncIteration.$factory(_b_.None);if(e.$closed)throw _b_.StopAsyncIteration.$factory();if(e.$exc)throw e.$exc;if(!0===e.ag_running)throw ValueError.$factory("generator already executing");if(e.ag_running=!0,void 0===e.next)throw e.$finished=!0,_b_.StopAsyncIteration.$factory(_b_.None);try{var t=await e.next.apply(e,e.args);if(void 0===t)throw _b_.StopAsyncIteration.$factory(_b_.None);if(t[0].__class__===$GeneratorReturn)throw e.$finished=!0,_b_.StopAsyncIteration.$factory(t[0].value);return e.next=e.nexts[t[1]],e.ag_running=!1,t[0]}catch(t){if(e.$finished=!0,t.$stack=$B.frames_stack.slice(),t.__class__!==_b_.GeneratorExit)throw t}finally{e.ag_running=!1,$B.leave_frame(e.iter_id)}},async_generator.__dir__=generator.__dir__,async_generator.aclose=function(e){return e.$finished?_b_.None:(e.sent_value={__class__:$B.$GeneratorSendError,err:_b_.GeneratorExit.$factory()},async_generator.__anext__(e))},async_generator.asend=function(){var e=$B.args("asend",2,{self:null,value:null},["self","value"],arguments,{},null,null),t=e.self,r=e.value;return t.sent_value=r,async_generator.__anext__(t)},async_generator.athrow=function(e,t,r,n){var s=t;if(s.$is_class){if(!_b_.issubclass(t,_b_.BaseException))throw _b_.TypeError.$factory("exception value must be an instance of BaseException");void 0===r&&(r=$B.$call(s)())}else void 0===r?r=s:s=$B.$call(s)(r);return void 0!==n&&(s.$traceback=n),e.sent_value={__class__:$B.$GeneratorSendError,err:r},async_generator.__anext__(e)},$B.set_func_names(async_generator,"builtins")}(__BRYTHON__),function($B){var _b_=$B.builtins,update=function(e,t){for(attr in t)e[attr]=t[attr]},_window=self,modules={},browser={$package:!0,$is_package:!0,__initialized__:!0,__package__:"browser",__file__:$B.brython_path.replace(/\/*$/g,"")+"/Lib/browser/__init__.py",bind:function(){var e=$B.args("bind",3,{elt:null,evt:null,options:null},["elt","evt","options"],arguments,{options:_b_.None},null,null),t=e.options;return"boolean"==typeof t||t.__class__===_b_.dict&&(t=t.$string_dict),function(r){if(e.elt.__class__&&_b_.issubclass(e.elt.__class__,$B.JSObject)){return e.elt.js.addEventListener(e.evt,function(e){try{return r($B.JSObject.$factory(e))}catch(e){$B.handle_error(e)}},t),r}if(_b_.isinstance(e.elt,$B.DOMNode))return $B.DOMNode.bind(e.elt,e.evt,r,t),r;if(_b_.isinstance(e.elt,_b_.str)){for(var n=document.querySelectorAll(e.elt),s=0;s<n.length;s++)$B.DOMNode.bind($B.DOMNode.$factory(n[s]),e.evt,r,t);return r}try{for(var a=$B.$iter(e.elt);;)try{var i=_b_.next(a);$B.DOMNode.bind(i,e.evt,r)}catch(e){if(_b_.isinstance(e,_b_.StopIteration))break;throw e}}catch(t){throw _b_.isinstance(t,_b_.AttributeError)&&$B.DOMNode.bind(e.elt,e.evt,r),t}return r}},console:self.console&&$B.JSObject.$factory(self.console),self:$B.win,win:$B.win,$$window:$B.win};browser.__path__=browser.__file__,$B.isNode?(delete browser.$$window,delete browser.win):$B.isWebWorker?(browser.is_webworker=!0,delete browser.$$window,delete browser.win,browser.self.js.send=self.postMessage):(browser.is_webworker=!1,update(browser,{$$alert:function(e){window.alert($B.builtins.str.$factory(e||""))},confirm:$B.JSObject.$factory(window.confirm),$$document:$B.DOMNode.$factory(document),doc:$B.DOMNode.$factory(document),DOMEvent:$B.DOMEvent,DOMNode:$B.DOMNode,load:function(script_url){var file_obj=$B.builtins.open(script_url),content=$B.builtins.getattr(file_obj,"read")();eval(content)},mouseCoords:function(e){return $B.JSObject.$factory($mouseCoords(e))},prompt:function(e,t){return $B.JSObject.$factory(window.prompt(e,t||""))},reload:function(){var e=document.getElementsByTagName("script"),t=[];for(var r in e.forEach(function(e){void 0!==e.type&&"text/javascript"!=e.type||(t.push(e),e.src&&console.log(e.src))}),console.log(t),$B.imported)$B.imported[r].$last_modified?console.log("check",r,$B.imported[r].__file__,$B.imported[r].$last_modified):console.log("no date for mod",r)},run_script:function(){var e=$B.args("run_script",2,{src:null,name:null},["src","name"],arguments,{name:"script_"+$B.UUID()},null,null);$B.run_script(e.src,e.name,!0)},URLParameter:function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return t=null===t?"":decodeURIComponent(t[1].replace(/\+/g," ")),$B.builtins.str.$factory(t)}}),modules["browser.html"]=function($B){var _b_=$B.builtins,TagSum=$B.TagSum;function makeTagDict(tagName){var dict={__class__:_b_.type,$infos:{__name__:tagName,__module__:"browser.html"},__init__:function(){var $ns=$B.args("pow",1,{self:null},["self"],arguments,{},"args","kw"),self=$ns.self,args=$ns.args;if(1==args.length){var first=args[0];if(_b_.isinstance(first,[_b_.str,_b_.int,_b_.float]))self.elt.innerHTML=_b_.str.$factory(first);else if(first.__class__===TagSum)for(var i=0,len=first.children.length;i<len;i++)self.elt.appendChild(first.children[i].elt);else if(_b_.isinstance(first,$B.DOMNode))self.elt.appendChild(first.elt);else try{var items=_b_.list.$factory(first);items.forEach(function(e){$B.DOMNode.__le__(self,e)})}catch(e){$B.debug>1&&(console.log(e,e.__class__,e.args),console.log("first",first),console.log(arguments)),$B.handle_error(e)}}for(var items=_b_.list.$factory(_b_.dict.items($ns.kw)),i=0,len=items.length;i<len;i++){var arg=items[i][0],value=items[i][1];if("on"==arg.toLowerCase().substr(0,2)){var js='$B.DOMNode.bind(self,"'+arg.toLowerCase().substr(2);eval(js+'",function(){'+value+"})")}else if("style"==arg.toLowerCase())$B.DOMNode.set_style(self,value);else if(!1!==value)try{arg=$B.imported["browser.html"].attribute_mapper(arg),self.elt.setAttribute(arg,value)}catch(e){throw _b_.ValueError.$factory("can't set attribute "+arg)}}}};return dict.__mro__=[$B.DOMNode,$B.builtins.object],dict.__new__=function(e){if(void 0!==e.$elt_wrap){var t=e.$elt_wrap;e.$elt_wrap=void 0,(r=$B.DOMNode.$factory(t,!0))._wrapped=!0}else{var r;(r=$B.DOMNode.$factory(document.createElement(tagName),!0))._wrapped=!1}return r.__class__=e,r.__dict__=_b_.dict.$factory(),r},$B.set_func_names(dict,"browser.html"),dict}function makeFactory(e){return function(){if(void 0!==e.$elt_wrap){var t=e.$elt_wrap;e.$elt_wrap=void 0,(r=$B.DOMNode.$factory(t,!0))._wrapped=!0}else{if("SVG"==e.$infos.__name__)var r=$B.DOMNode.$factory(document.createElementNS("http://www.w3.org/2000/svg","svg"),!0);else r=$B.DOMNode.$factory(document.createElement(e.$infos.__name__),!0);r._wrapped=!1}return r.__class__=e,e.__init__(r,...arguments),r}}var tags=["A","ABBR","ACRONYM","ADDRESS","APPLET","AREA","B","BASE","BASEFONT","BDO","BIG","BLOCKQUOTE","BODY","BR","BUTTON","CAPTION","CENTER","CITE","CODE","COL","COLGROUP","DD","DEL","DFN","DIR","DIV","DL","DT","EM","FIELDSET","FONT","FORM","FRAME","FRAMESET","H1","H2","H3","H4","H5","H6","HEAD","HR","HTML","I","IFRAME","IMG","INPUT","INS","ISINDEX","KBD","LABEL","LEGEND","LI","LINK","MAP","MENU","META","NOFRAMES","NOSCRIPT","OBJECT","OL","OPTGROUP","OPTION","P","PARAM","PRE","Q","S","SAMP","SCRIPT","SELECT","SMALL","SPAN","STRIKE","STRONG","STYLE","SUB","SUP","SVG","TABLE","TBODY","TD","TEXTAREA","TFOOT","TH","THEAD","TITLE","TR","TT","U","UL","VAR","ARTICLE","ASIDE","AUDIO","BDI","CANVAS","COMMAND","DATA","DATALIST","EMBED","FIGCAPTION","FIGURE","FOOTER","HEADER","KEYGEN","MAIN","MARK","MATH","METER","NAV","OUTPUT","PROGRESS","RB","RP","RT","RTC","RUBY","SECTION","SOURCE","TEMPLATE","TIME","TRACK","VIDEO","WBR","DETAILS","DIALOG","MENUITEM","PICTURE","SUMMARY"],obj={tags:_b_.dict.$factory()},dicts={};function maketag(e){if("string"!=typeof e)throw _b_.TypeError.$factory("html.maketag expects a string as argument");var t=dicts[e]=makeTagDict(e);return t.$factory=makeFactory(t),_b_.dict.$setitem(obj.tags,e,t),t}return $B.DOMNode.tags=obj.tags,tags.forEach(function(e){obj[e]=maketag(e)}),obj.maketag=maketag,obj.attribute_mapper=function(e){return e.replace(/_/g,"-")},obj}(__BRYTHON__)),modules.browser=browser,$B.UndefinedClass=$B.make_class("Undefined",function(){return $B.Undefined}),$B.UndefinedClass.__mro__=[_b_.object],$B.UndefinedClass.__bool__=function(e){return!1},$B.UndefinedClass.__repr__=$B.UndefinedClass.__str__=function(e){return"<Javascript undefined>"},$B.Undefined={__class__:$B.UndefinedClass},$B.set_func_names($B.UndefinedClass,"javascript"),modules.javascript={$$this:function(){return void 0===$B.js_this?$B.builtins.None:$B.JSObject.$factory($B.js_this)},$$Date:self.Date&&$B.JSObject.$factory(self.Date),JSConstructor:{__get__:function(){return console.warn('"javascript.JSConstructor" is deprecrated. Use window.<js constructor name>.new() instead.'),$B.JSConstructor},__set__:function(){throw _b_.AttributeError.$factory("read only")}},JSObject:{__get__:function(){return console.warn('"javascript.JSObject" is deprecrated. To use a Javascript object, use window.<object name> instead.'),$B.JSObject},__set__:function(){throw _b_.AttributeError.$factory("read only")}},JSON:{__class__:$B.make_class("JSON"),parse:function(e){return $B.structuredclone2pyobj(JSON.parse(e))},stringify:function(e){return JSON.stringify($B.pyobj2structuredclone(e))}},jsobj2pyobj:function(e){return $B.jsobj2pyobj(e)},load:function(script_url){console.log('"javascript.load" is deprecrated. Use browser.load instead.');var file_obj=$B.builtins.open(script_url),content=$B.builtins.getattr(file_obj,"read")();eval(content)},$$Math:self.Math&&$B.JSObject.$factory(self.Math),NULL:null,$$Number:self.Number&&$B.JSObject.$factory(self.Number),py2js:function(e,t){return void 0===t&&(t="__main__"+$B.UUID()),$B.py2js(e,t,t,$B.builtins_scope).to_js()},pyobj2jsobj:function(e){return $B.pyobj2jsobj(e)},$$RegExp:self.RegExp&&$B.JSObject.$factory(self.RegExp),$$String:self.String&&$B.JSObject.$factory(self.String),UNDEFINED:$B.Undefined,UndefinedType:$B.UndefinedClass};var arraybuffers=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];arraybuffers.forEach(function(e){void 0!==self[e]&&(modules.javascript[e]=$B.JSObject.$factory(self[e]))});var _b_=$B.builtins;function load(e,t){for(var r in t.__class__=$B.module,t.__name__=e,$B.imported[e]=t,t)if("function"==typeof t[r]){var n=$B.from_alias(r);t[r].$infos={__module__:e,__name__:n,__qualname__:e+"."+n}}}for(var attr in modules._sys={Getframe:function(){var e=$B.args("_getframe",1,{depth:null},["depth"],arguments,{depth:0},null,null).depth;return $B._frame.$factory($B.frames_stack,$B.frames_stack.length-e-1)},breakpointhook:function(){var e,t,r,n,s=$B.$options.breakpoint;void 0===s&&(s="pdb.set_trace"),[e,t,r]=_b_.str.rpartition(s,"."),""==t&&(e="builtins");try{$B.$import(e),n=$B.$getattr($B.imported[e],r)}catch(e){return console.warn("cannot import breakpoint",s),_b_.None}return $B.$call(n).apply(null,arguments)},exc_info:function(){for(var e=$B.frames_stack.length-1;e>=0;e--){var t=$B.frames_stack[e][1].$current_exception;if(t)return _b_.tuple.$factory([t.__class__,t,$B.$getattr(t,"__traceback__")])}return _b_.tuple.$factory([_b_.None,_b_.None,_b_.None])},excepthook:function(e,t,r){$B.handle_error(t)},modules:_b_.property.$factory(function(){return $B.obj_dict($B.imported)},function(e,t,r){throw _b_.TypeError.$factory("Read only property 'sys.modules'")}),path:_b_.property.$factory(function(){return $B.path},function(e,t,r){$B.path=r}),meta_path:_b_.property.$factory(function(){return $B.meta_path},function(e,t,r){$B.meta_path=r}),path_hooks:_b_.property.$factory(function(){return $B.path_hooks},function(e,t,r){$B.path_hooks=r}),path_importer_cache:_b_.property.$factory(function(){return _b_.dict.$factory($B.JSObject.$factory($B.path_importer_cache))},function(e,t,r){throw _b_.TypeError.$factory("Read only property 'sys.path_importer_cache'")}),settrace:function(){var e=$B.args("settrace",1,{tracefunc:null},["tracefunc"],arguments,{},null,null);return $B.tracefunc=e.tracefunc,$B.last($B.frames_stack)[1].$f_trace=$B.tracefunc,$B.tracefunc.$current_frame_id=$B.last($B.frames_stack)[0],_b_.None},stderr:_b_.property.$factory(function(){return $B.stderr},function(e,t){$B.stderr=t}),stdout:_b_.property.$factory(function(){return $B.stdout},function(e,t){$B.stdout=t}),stdin:_b_.property.$factory(function(){return $B.stdin},function(e,t){$B.stdin=t}),vfs:_b_.property.$factory(function(){return $B.hasOwnProperty("VFS")?$B.obj_dict($B.VFS):_b_.None},function(){throw _b_.TypeError.$factory("Read only property 'sys.vfs'")})},modules._sys.__breakpointhook__=modules._sys.breakpointhook,modules._sys.stderr.write=function(e){return $B.$getattr(_sys.stderr.__get__(),"write")(e)},modules._sys.stdout.write=function(e){return $B.$getattr(_sys.stdout.__get__(),"write")(e)},modules)load(attr,modules[attr]);$B.isWebWorker||$B.isNode||(modules.browser.html=modules["browser.html"]);var _b_=$B.builtins;for(var attr in _b_.__builtins__=$B.module.$factory("__builtins__","Python builtins"),_b_)_b_.__builtins__[attr]=_b_[attr],$B.builtins_scope.binding[attr]=!0;for(var name in _b_.__builtins__.__setattr__=function(e,t){_b_[e]=t},$B.method_descriptor.__getattribute__=$B.Function.__getattribute__,$B.wrapper_descriptor.__getattribute__=$B.Function.__getattribute__,_b_)if(_b_[name].__class__===_b_.type)for(var key in $B.builtin_classes.push(_b_[name]),_b_[name]){var value=_b_[name][key];void 0!==value&&(value.__class__||"function"==typeof value&&("__new__"==key?value.__class__=$B.builtin_function:key.startsWith("__")?value.__class__=$B.wrapper_descriptor:value.__class__=$B.method_descriptor,value.__objclass__=_b_[name]))}for(var attr in $B)Array.isArray($B[attr])&&($B[attr].__class__=_b_.list);$B.cell=$B.make_class("cell",function(e){return{__class__:$B.cell,$cell_contents:e}}),$B.cell.cell_contents=$B.$call(_b_.property)(function(e){if(null===e.$cell_contents)throw _b_.ValueError.$factory("empty cell");return e.$cell_contents},function(e,t){e.$cell_contents=t});var $comps=Object.values($B.$comps).concat(["eq","ne"]);$comps.forEach(function(e){var t="__"+e+"__";$B.cell[t]=function(e){return function(t,r){return _b_.isinstance(r,$B.cell)?null===t.$cell_contents?null===r.$cell_contents?"__eq__"==e:["__ne__","__lt__","__le__"].indexOf(e)>-1:null===r.$cell_contents?["__ne__","__gt__","__ge__"].indexOf(e)>-1:$B.rich_comp(e,t.$cell_contents,r.$cell_contents):NotImplemented}}(t)}),$B.set_func_names($B.cell,"builtins")}(__BRYTHON__);var docs={ArithmeticError:"Base class for arithmetic errors.",AssertionError:"Assertion failed.",AttributeError:"Attribute not found.",BaseException:"Common base class for all exceptions",BlockingIOError:"I/O operation would block.",BrokenPipeError:"Broken pipe.",BufferError:"Buffer error.",BytesWarning:"Base class for warnings about bytes and buffer related problems, mostly\nrelated to conversion from str or comparing to str.",ChildProcessError:"Child process error.",ConnectionAbortedError:"Connection aborted.",ConnectionError:"Connection error.",ConnectionRefusedError:"Connection refused.",ConnectionResetError:"Connection reset.",DeprecationWarning:"Base class for warnings about deprecated features.",EOFError:"Read beyond end of file.",Ellipsis:"",EnvironmentError:"Base class for I/O related errors.",Exception:"Common base class for all non-exit exceptions.",False:"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.",FileExistsError:"File already exists.",FileNotFoundError:"File not found.",FloatingPointError:"Floating point operation failed.",FutureWarning:"Base class for warnings about constructs that will change semantically\nin the future.",GeneratorExit:"Request that a generator exit.",IOError:"Base class for I/O related errors.",ImportError:"Import can't find module, or can't find name in module.",ImportWarning:"Base class for warnings about probable mistakes in module imports",IndentationError:"Improper indentation.",IndexError:"Sequence index out of range.",InterruptedError:"Interrupted by signal.",IsADirectoryError:"Operation doesn't work on directories.",KeyError:"Mapping key not found.",KeyboardInterrupt:"Program interrupted by user.",LookupError:"Base class for lookup errors.",MemoryError:"Out of memory.",NameError:"Name not found globally.",None:"",NotADirectoryError:"Operation only works on directories.",NotImplemented:"",NotImplementedError:"Method or function hasn't been implemented yet.",OSError:"Base class for I/O related errors.",OverflowError:"Result too large to be represented.",PendingDeprecationWarning:"Base class for warnings about features which will be deprecated\nin the future.",PermissionError:"Not enough permissions.",ProcessLookupError:"Process not found.",ReferenceError:"Weak ref proxy used after referent went away.",ResourceWarning:"Base class for warnings about resource usage.",RuntimeError:"Unspecified run-time error.",RuntimeWarning:"Base class for warnings about dubious runtime behavior.",StopIteration:"Signal the end from iterator.__next__().",SyntaxError:"Invalid syntax.",SyntaxWarning:"Base class for warnings about dubious syntax.",SystemError:"Internal error in the Python interpreter.\n\nPlease report this to the Python maintainer, along with the traceback,\nthe Python version, and the hardware/OS platform and version.",SystemExit:"Request to exit from the interpreter.",TabError:"Improper mixture of spaces and tabs.",TimeoutError:"Timeout expired.",True:"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.",TypeError:"Inappropriate argument type.",UnboundLocalError:"Local name referenced but not bound to a value.",UnicodeDecodeError:"Unicode decoding error.",UnicodeEncodeError:"Unicode encoding error.",UnicodeError:"Unicode related error.",UnicodeTranslateError:"Unicode translation error.",UnicodeWarning:"Base class for warnings about Unicode related problems, mostly\nrelated to conversion problems.",UserWarning:"Base class for warnings generated by user code.",ValueError:"Inappropriate argument value (of correct type).",Warning:"Base class for warning categories.",WindowsError:"Base class for I/O related errors.",ZeroDivisionError:"Second argument to a division or modulo operation was zero.",__debug__:"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.",abs:"abs(number) -> number\n\nReturn the absolute value of the argument.",all:"all(iterable) -> bool\n\nReturn True if bool(x) is True for all values x in the iterable.\nIf the iterable is empty, return True.",any:"any(iterable) -> bool\n\nReturn True if bool(x) is True for any x in the iterable.\nIf the iterable is empty, return False.",ascii:"ascii(object) -> string\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:"bin(number) -> string\n\nReturn the binary representation of an integer.\n\n >>> bin(2796202)\n '0b1010101010101010101010'\n",bool:"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.",bytearray:"bytearray(iterable_of_ints) -> bytearray\nbytearray(string, encoding[, errors]) -> bytearray\nbytearray(bytes_or_buffer) -> mutable copy of bytes_or_buffer\nbytearray(int) -> bytes array of size given by the parameter initialized with null bytes\nbytearray() -> empty bytes array\n\nConstruct an mutable bytearray object from:\n - an iterable yielding integers in range(256)\n - a text string encoded using the specified encoding\n - a bytes or a buffer object\n - any object implementing the buffer API.\n - an integer",bytes:"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",callable:"callable(object) -> bool\n\nReturn whether the object is callable (i.e., some kind of function).\nNote that classes are callable, as are instances of classes with a\n__call__() method.",chr:"chr(i) -> Unicode character\n\nReturn a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.",classmethod:"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 def f(cls, arg1, arg2, ...): ...\n f = classmethod(f)\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.",compile:"compile(source, filename, mode[, flags[, dont_inherit]]) -> code object\n\nCompile the source (a Python module, statement or expression)\ninto a code object that can be executed by exec() or eval().\nThe filename will be used for run-time error messages.\nThe mode must be 'exec' to compile a module, 'single' to compile a\nsingle (interactive) statement, or 'eval' to compile an expression.\nThe flags argument, if present, controls which future statements influence\nthe compilation of the code.\nThe dont_inherit argument, if non-zero, stops the compilation inheriting\nthe effects of any future statements in effect in the code calling\ncompile; if absent or zero these statements do influence the compilation,\nin addition to any features explicitly specified.",complex:"complex(real[, imag]) -> complex number\n\nCreate a complex number from a real part and an optional imaginary part.\nThis is equivalent to (real + imag*1j) where imag defaults to 0.",copyright:"interactive prompt objects for printing the license text, a list of\n contributors and the copyright notice.",credits:"interactive prompt objects for printing the license text, a list of\n contributors and the copyright notice.",delattr:"delattr(object, name)\n\nDelete a named attribute on an object; delattr(x, 'y') is equivalent to\n``del x.y''.",dict:"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)",dir:"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:"divmod(x, y) -> (div, mod)\n\nReturn the tuple ((x-x%y)/y, x%y). Invariant: div*y + mod == x.",enumerate:"enumerate(iterable[, start]) -> iterator for index, value of iterable\n\nReturn an enumerate object. iterable must be another object that supports\niteration. The enumerate object yields pairs containing a count (from\nstart, which defaults to zero) and a value yielded by the iterable argument.\nenumerate is useful for obtaining an indexed list:\n (0, seq[0]), (1, seq[1]), (2, seq[2]), ...",eval:"eval(source[, globals[, locals]]) -> value\n\nEvaluate the source in the C of globals and locals.\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.\n",exec:"exec(object[, globals[, locals]])\n\nRead and execute code from an object, which can be a string or a code\nobject.\nThe globals and locals are dictionaries, defaulting to the current\nglobals and locals. If only globals is given, locals defaults to it.",exit:"",filter:"filter(function or None, iterable) --\x3e filter object\n\nReturn an iterator yielding those items of iterable for which function(item)\nis true. If function is None, return the items that are true.",float:"float(x) -> floating point number\n\nConvert a string or number to a floating point number, if possible.",format:'format(value[, format_spec]) -> string\n\nReturns value.__format__(format_spec)\nformat_spec defaults to ""',frozenset:"frozenset()-> empty frozenset object\nfrozenset(iterable)-> frozenset object\n\nBuild an immutable unordered collection of unique elements.",getattr:"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:"globals() -> dictionary\n\nReturn the dictionary containing the current scope's global variables.",hasattr:"hasattr(object,name)-> bool\n\nReturn whether the object has an attribute with the given name.\n(This is done by calling getattr(object,name)and catching AttributeError.)",hash:"hash(object)-> integer\n\nReturn a hash value for the object. Two objects with the same value have\nthe same hash value. The reverse is not necessarily true,but likely.",help:"Define the builtin 'help'.\n\n This is a wrapper around pydoc.help that provides a helpful message\n when 'help' is typed at the Python interactive prompt.\n\n Calling help()at the Python prompt starts an interactive help session.\n Calling help(thing)prints help for the python object 'thing'.\n ",hex:"hex(number)-> string\n\nReturn the hexadecimal representation of an integer.\n\n >>> hex(3735928559)\n '0xdeadbeef'\n",id:"id(object)-> integer\n\nReturn the identity of an object. This is guaranteed to be unique among\nsimultaneously existing objects.(Hint:it's the object's memory address.)",input:"input([prompt])-> string\n\nRead a string from standard input. The trailing newline is stripped.\nIf the user hits EOF(Unix:Ctl-D,Windows:Ctl-Z+Return),raise EOFError.\nOn Unix,GNU readline is used if enabled. The prompt string,if given,\nis printed without a trailing newline before reading.",int:"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",isinstance:"isinstance(object,class-or-type-or-tuple)-> bool\n\nReturn whether an object is an instance of a class or of a subclass thereof.\nWith a type as second argument,return whether that is the object's type.\nThe form using a tuple, isinstance(x, (A, B, ...)), is a shortcut for\nisinstance(x, A) or isinstance(x, B) or ... (etc.).",issubclass:"issubclass(C, B) -> bool\n\nReturn whether class C is a subclass (i.e., a derived class) of class B.\nWhen using a tuple as the second argument issubclass(X, (A, B, ...)),\nis a shortcut for issubclass(X, A) or issubclass(X, B) or ... (etc.).",iter:"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:"len(object)\n\nReturn the number of items of a sequence or collection.",license:"interactive prompt objects for printing the license text, a list of\n contributors and the copyright notice.",list:"list() -> new empty list\nlist(iterable) -> new list initialized from iterable's items",locals:"locals()-> dictionary\n\nUpdate and return a dictionary containing the current scope's local variables.",map:"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.",max:"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.",memoryview:"memoryview(object)\n\nCreate a new memoryview object which references the given object.",min:"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:"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.",object:"The most base type",oct:"oct(number) -> string\n\nReturn the octal representation of an integer.\n\n >>> oct(342391)\n '0o1234567'\n",open:"open(file, mode='r', buffering=-1, encoding=None,\n errors=None, newline=None, closefd=True, opener=None) -> file object\n\nOpen file and return a stream. Raise IOError upon failure.\n\nfile is either a text or byte string giving the name (and the path\nif the file isn't in the current working directory)of the file to\nbe opened or an integer file descriptor of the file to be\nwrapped.(If a file descriptor is given,it is closed when the\nreturned I/O object is closed,unless closefd is set to False.)\n\nmode is an optional string that specifies the mode in which the file\nis opened. It defaults to 'r' which means open for reading in text\nmode. Other common values are 'w' for writing(truncating the file if\nit already exists),'x' for creating and writing to a new file,and\n'a' for appending(which on some Unix systems,means that all writes\nappend to the end of the file regardless of the current seek position).\nIn text mode,if encoding is not specified the encoding used is platform\ndependent:locale.getpreferredencoding(False)is called to get the\ncurrent locale encoding.(For reading and writing raw bytes use binary\nmode and leave encoding unspecified.)The available modes are:\n\n========================================================================\nCharacter Meaning\n------------------------------------------------------------------------\n'r' open for reading(default)\n'w' open for writing,truncating the file first\n'x' create a new file and open it for writing\n'a' open for writing,appending to the end of the file if it exists\n'b' binary mode\n't' text mode(default)\n'+' open a disk file for updating(reading and writing)\n'U' universal newline mode(deprecated)\n========================================================================\n\nThe default mode is 'rt'(open for reading text). For binary random\naccess,the mode 'w+b' opens and truncates the file to 0 bytes,while\n'r+b' opens the file without truncation. The 'x' mode implies 'w' and\nraises an `FileExistsError` if the file already exists.\n\nPython distinguishes between files opened in binary and text modes,\neven when the underlying operating system doesn't. Files opened in\nbinary mode (appending 'b' to the mode argument) return contents as\nbytes objects without any decoding. In text mode (the default, or when\n't' is appended to the mode argument), the contents of the file are\nreturned as strings, the bytes having been first decoded using a\nplatform-dependent encoding or using the specified encoding if given.\n\n'U' mode is deprecated and will raise an exception in future versions\nof Python. It has no effect in Python 3. Use newline to control\nuniversal newlines mode.\n\nbuffering is an optional integer used to set the buffering policy.\nPass 0 to switch buffering off (only allowed in binary mode), 1 to select\nline buffering (only usable in text mode), and an integer > 1 to indicate\nthe size of a fixed-size chunk buffer. When no buffering argument is\ngiven, the default buffering policy works as follows:\n\n* Binary files are buffered in fixed-size chunks; the size of the buffer\n is chosen using a heuristic trying to determine the underlying device's\n \"block size\" and falling back on `io.DEFAULT_BUFFER_SIZE`.\n On many systems, the buffer will typically be 4096 or 8192 bytes long.\n\n* \"Interactive\" text files (files for which isatty() returns True)\n use line buffering. Other text files use the policy described above\n for binary files.\n\nencoding is the name of the encoding used to decode or encode the\nfile. This should only be used in text mode. The default encoding is\nplatform dependent, but any encoding supported by Python can be\npassed. See the codecs module for the list of supported encodings.\n\nerrors is an optional string that specifies how encoding errors are to\nbe handled---this argument should not be used in binary mode. Pass\n'strict' to raise a ValueError exception if there is an encoding error\n(the default of None has the same effect), or pass 'ignore' to ignore\nerrors. (Note that ignoring encoding errors can lead to data loss.)\nSee the documentation for codecs.register or run 'help(codecs.Codec)'\nfor a list of the permitted encoding error strings.\n\nnewline controls how universal newlines works (it only applies to text\nmode). It can be None, '', '\\n', '\\r', and '\\r\\n'. It works as\nfollows:\n\n* On input, if newline is None, universal newlines mode is\n enabled. Lines in the input can end in '\\n', '\\r', or '\\r\\n', and\n these are translated into '\\n' before being returned to the\n caller. If it is '', universal newline mode is enabled, but line\n endings are returned to the caller untranslated. If it has any of\n the other legal values, input lines are only terminated by the given\n string, and the line ending is returned to the caller untranslated.\n\n* On output, if newline is None, any '\\n' characters written are\n translated to the system default line separator, os.linesep. If\n newline is '' or '\\n', no translation takes place. If newline is any\n of the other legal values, any '\\n' characters written are translated\n to the given string.\n\nIf closefd is False, the underlying file descriptor will be kept open\nwhen the file is closed. This does not work when a file name is given\nand must be True in that case.\n\nA custom opener can be used by passing a callable as *opener*. The\nunderlying file descriptor for the file object is then obtained by\ncalling *opener* with (*file*, *flags*). *opener* must return an open\nfile descriptor (passing os.open as *opener* results in functionality\nsimilar to passing None).\n\nopen() returns a file object whose type depends on the mode, and\nthrough which the standard file operations such as reading and writing\nare performed. When open() is used to open a file in a text mode ('w',\n'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open\na file in a binary mode, the returned class varies: in read binary\nmode, it returns a BufferedReader; in write binary and append binary\nmodes, it returns a BufferedWriter, and in read/write mode, it returns\na BufferedRandom.\n\nIt is also possible to use a string or bytearray as a file for both\nreading and writing. For strings StringIO can be used like a file\nopened in a text mode, and for bytes a BytesIO can be used like a file\nopened in a binary mode.\n",ord:"ord(c) -> integer\n\nReturn the integer ordinal of a one-character string.",pow:"pow(x, y[, z]) -> number\n\nWith two arguments, equivalent to x**y. With three arguments,\nequivalent to (x**y) % z, but may be more efficient (e.g. for ints).",print:"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.",property:"property(fget=None, fset=None, fdel=None, doc=None) -> property attribute\n\nfget is a function to be used for getting an attribute value, and likewise\nfset is a function for setting, and fdel a function for del'ing, an\nattribute. Typical 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\n",quit:"",range:"range(stop) -> range object\nrange(start, stop[, step]) -> range object\n\nReturn a virtual sequence of numbers from start to stop by step.",repr:"repr(object) -> string\n\nReturn the canonical string representation of the object.\nFor most object types, eval(repr(object)) == object.",reversed:"reversed(sequence) -> reverse iterator over values of the sequence\n\nReturn a reverse iterator",round:"round(number[, ndigits]) -> number\n\nRound a number to a given precision in decimal digits (default 0 digits).\nThis returns an int when called with one argument, otherwise the\nsame type as the number. ndigits may be negative.",set:"set() -> new empty set object\nset(iterable) -> new set object\n\nBuild an unordered collection of unique elements.",setattr:"setattr(object, name, value)\n\nSet a named attribute on an object; setattr(x, 'y', v) is equivalent to\n``x.y = v''.",slice:"slice(stop)\nslice(start, stop[, step])\n\nCreate a slice object. This is used for extended slicing (e.g. a[0:10:2]).",sorted:"sorted(iterable, key=None, reverse=False) --\x3e new sorted list",staticmethod:"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 def f(arg1, arg2, ...): ...\n f = staticmethod(f)\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.",str:"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'.",sum:"sum(iterable[, start]) -> value\n\nReturn the sum of an iterable of numbers (NOT strings) plus the value\nof parameter 'start' (which defaults to 0). When the iterable is\nempty, return start.",super:"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",tuple:"tuple() -> empty tuple\ntuple(iterable) -> tuple initialized from iterable's items\n\nIf the argument is a tuple, the return value is the same object.",type:"type(object_or_name, bases, dict)\ntype(object) -> the object's type\ntype(name, bases, dict) -> a new type",vars:"vars([object]) -> dictionary\n\nWithout arguments, equivalent to locals().\nWith an argument, equivalent to object.__dict__.",zip:"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."};__BRYTHON__.builtins_doc=docs,function(e){var t=e.builtins;e.import_hooks=function(r,n,s){var a,i,o=e.meta_path.slice(),_=e.imported;if(s){var l=o.indexOf(e.finders.path);l>-1&&o.splice(l,1)}for(var c=0,u=o.length;c<u;c++){var f=o[c],p=e.$getattr(f,"find_spec",t.None);if(p==t.None){var d=e.$getattr(f,"find_module",t.None);if(d!==t.None&&(a=d(r,n))!==t.None){var h=e.$getattr(a,"load_module"),$=e.$call(h)(r);return _[r]=$,$}}else if(i=p(r,n),!e.is_none(i)){if(void 0!==($=e.imported[i.name]))return _[i.name]=$;a=t.getattr(i,"loader",t.None);break}}if(void 0===a){var m=t.ModuleNotFoundError.$factory(r);throw m.name=r,m}if(e.is_none($)){if(i===t.None)throw t.ModuleNotFoundError.$factory(r);var b=t.getattr(i,"name");if(!e.is_none(a)){var g=t.getattr(a,"create_module",t.None);e.is_none(g)||($=e.$call(g)(i))}if(void 0===$)throw t.ImportError.$factory(r);if(e.is_none($)){$=e.module.$factory(r);var y=t.getattr(i,"origin");y=t.getattr(i,"has_location")?"from '"+y+"'":"("+y+")"}}$.__name__=b,$.__loader__=a,$.__package__=t.getattr(i,"parent",""),$.__spec__=i;var v=t.getattr(i,"submodule_search_locations");($.$is_package=!e.is_none(v))&&($.__path__=v),t.getattr(i,"has_location")&&($.__file__=t.getattr(i,"origin"),e.$py_module_path[$.__name__]=$.__file__);var x=t.getattr(i,"cached");if(e.is_none(x)||($.__cached__=x),e.is_none(a)){if(e.is_none(v))throw t.ImportError.$factory(r);_[b]=$}else{var w=t.getattr(a,"exec_module",t.None);if(e.is_none(w))$=t.getattr(a,"load_module")(b);else{_[b]=$;try{w($)}catch(e){throw delete _[b],e}}}return _[b]}}(__BRYTHON__),function(e){e.builtins;var t=e.coroutine=e.make_class("coroutine");t.close=function(e){},t.send=function(e){return e.$func.apply(null,e.$args)},t.__repr__=t.__str__=function(e){return e.$func.$infos?"<coroutine "+e.$func.$infos.__name__+">":"<coroutine object>"},e.set_func_names(t,"builtins"),e.make_async=(e=>{var r=function(){return{__class__:t,$args:arguments,$func:e}};return r.$infos=e.$infos,r}),e.promise=function(r){return r.__class__===e.JSObject?r.js:r.__class__===t?t.send(r):"function"==typeof r?r():r}}(__BRYTHON__); |