editor.js 207 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611
  1. (function(){
  2. "use strict";
  3. var ρσ_iterator_symbol = (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") ? Symbol.iterator : "iterator-Symbol-5d0927e5554349048cf0e3762a228256";
  4. var ρσ_kwargs_symbol = (typeof Symbol === "function") ? Symbol("kwargs-object") : "kwargs-object-Symbol-5d0927e5554349048cf0e3762a228256";
  5. var ρσ_cond_temp, ρσ_expr_temp, ρσ_last_exception;
  6. var ρσ_object_counter = 0;
  7. var ρσ_len;
  8. function ρσ_bool(val) {
  9. return !!val;
  10. };
  11. if (!ρσ_bool.__argnames__) Object.defineProperties(ρσ_bool, {
  12. __argnames__ : {value: ["val"]},
  13. __module__ : {value: "__main__"}
  14. });
  15. function ρσ_print() {
  16. var parts;
  17. if (typeof console === "object") {
  18. parts = [];
  19. for (var i = 0; i < arguments.length; i++) {
  20. parts.push(ρσ_str(arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i]));
  21. }
  22. console.log(parts.join(" "));
  23. }
  24. };
  25. if (!ρσ_print.__module__) Object.defineProperties(ρσ_print, {
  26. __module__ : {value: "__main__"}
  27. });
  28. function ρσ_int(val, base) {
  29. var ans;
  30. if (typeof val === "number") {
  31. ans = val | 0;
  32. } else {
  33. ans = parseInt(val, base || 10);
  34. }
  35. if (isNaN(ans)) {
  36. throw new ValueError("Invalid literal for int with base " + (base || 10) + ": " + val);
  37. }
  38. return ans;
  39. };
  40. if (!ρσ_int.__argnames__) Object.defineProperties(ρσ_int, {
  41. __argnames__ : {value: ["val", "base"]},
  42. __module__ : {value: "__main__"}
  43. });
  44. function ρσ_float(val) {
  45. var ans;
  46. if (typeof val === "number") {
  47. ans = val;
  48. } else {
  49. ans = parseFloat(val);
  50. }
  51. if (isNaN(ans)) {
  52. throw new ValueError("Could not convert string to float: " + arguments[0]);
  53. }
  54. return ans;
  55. };
  56. if (!ρσ_float.__argnames__) Object.defineProperties(ρσ_float, {
  57. __argnames__ : {value: ["val"]},
  58. __module__ : {value: "__main__"}
  59. });
  60. function ρσ_arraylike_creator() {
  61. var names;
  62. names = "Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" ");
  63. if (typeof HTMLCollection === "function") {
  64. names = names.concat("HTMLCollection NodeList NamedNodeMap TouchList".split(" "));
  65. }
  66. return (function() {
  67. var ρσ_anonfunc = function (x) {
  68. if (Array.isArray(x) || typeof x === "string" || names.indexOf(Object.prototype.toString.call(x).slice(8, -1)) > -1) {
  69. return true;
  70. }
  71. return false;
  72. };
  73. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  74. __argnames__ : {value: ["x"]},
  75. __module__ : {value: "__main__"}
  76. });
  77. return ρσ_anonfunc;
  78. })();
  79. };
  80. if (!ρσ_arraylike_creator.__module__) Object.defineProperties(ρσ_arraylike_creator, {
  81. __module__ : {value: "__main__"}
  82. });
  83. function options_object(f) {
  84. return (function() {
  85. var ρσ_anonfunc = function () {
  86. if (typeof arguments[arguments.length - 1] === "object") {
  87. arguments[ρσ_bound_index(arguments.length - 1, arguments)][ρσ_kwargs_symbol] = true;
  88. }
  89. return f.apply(this, arguments);
  90. };
  91. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  92. __module__ : {value: "__main__"}
  93. });
  94. return ρσ_anonfunc;
  95. })();
  96. };
  97. if (!options_object.__argnames__) Object.defineProperties(options_object, {
  98. __argnames__ : {value: ["f"]},
  99. __module__ : {value: "__main__"}
  100. });
  101. function ρσ_id(x) {
  102. return x.ρσ_object_id;
  103. };
  104. if (!ρσ_id.__argnames__) Object.defineProperties(ρσ_id, {
  105. __argnames__ : {value: ["x"]},
  106. __module__ : {value: "__main__"}
  107. });
  108. function ρσ_dir(item) {
  109. var arr;
  110. arr = ρσ_list_decorate([]);
  111. for (var i in item) {
  112. arr.push(i);
  113. }
  114. return arr;
  115. };
  116. if (!ρσ_dir.__argnames__) Object.defineProperties(ρσ_dir, {
  117. __argnames__ : {value: ["item"]},
  118. __module__ : {value: "__main__"}
  119. });
  120. function ρσ_ord(x) {
  121. var ans, second;
  122. ans = x.charCodeAt(0);
  123. if (55296 <= ans && ans <= 56319) {
  124. second = x.charCodeAt(1);
  125. if (56320 <= second && second <= 57343) {
  126. return (ans - 55296) * 1024 + second - 56320 + 65536;
  127. }
  128. throw new TypeError("string is missing the low surrogate char");
  129. }
  130. return ans;
  131. };
  132. if (!ρσ_ord.__argnames__) Object.defineProperties(ρσ_ord, {
  133. __argnames__ : {value: ["x"]},
  134. __module__ : {value: "__main__"}
  135. });
  136. function ρσ_chr(code) {
  137. if (code <= 65535) {
  138. return String.fromCharCode(code);
  139. }
  140. code -= 65536;
  141. return String.fromCharCode(55296 + (code >> 10), 56320 + (code & 1023));
  142. };
  143. if (!ρσ_chr.__argnames__) Object.defineProperties(ρσ_chr, {
  144. __argnames__ : {value: ["code"]},
  145. __module__ : {value: "__main__"}
  146. });
  147. function ρσ_callable(x) {
  148. return typeof x === "function";
  149. };
  150. if (!ρσ_callable.__argnames__) Object.defineProperties(ρσ_callable, {
  151. __argnames__ : {value: ["x"]},
  152. __module__ : {value: "__main__"}
  153. });
  154. function ρσ_bin(x) {
  155. var ans;
  156. if (typeof x !== "number" || x % 1 !== 0) {
  157. throw new TypeError("integer required");
  158. }
  159. ans = x.toString(2);
  160. if (ans[0] === "-") {
  161. ans = "-" + "0b" + ans.slice(1);
  162. } else {
  163. ans = "0b" + ans;
  164. }
  165. return ans;
  166. };
  167. if (!ρσ_bin.__argnames__) Object.defineProperties(ρσ_bin, {
  168. __argnames__ : {value: ["x"]},
  169. __module__ : {value: "__main__"}
  170. });
  171. function ρσ_hex(x) {
  172. var ans;
  173. if (typeof x !== "number" || x % 1 !== 0) {
  174. throw new TypeError("integer required");
  175. }
  176. ans = x.toString(16);
  177. if (ans[0] === "-") {
  178. ans = "-" + "0x" + ans.slice(1);
  179. } else {
  180. ans = "0x" + ans;
  181. }
  182. return ans;
  183. };
  184. if (!ρσ_hex.__argnames__) Object.defineProperties(ρσ_hex, {
  185. __argnames__ : {value: ["x"]},
  186. __module__ : {value: "__main__"}
  187. });
  188. function ρσ_enumerate(iterable) {
  189. var ans, iterator;
  190. ans = {"_i":-1};
  191. ans[ρσ_iterator_symbol] = (function() {
  192. var ρσ_anonfunc = function () {
  193. return this;
  194. };
  195. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  196. __module__ : {value: "__main__"}
  197. });
  198. return ρσ_anonfunc;
  199. })();
  200. if (ρσ_arraylike(iterable)) {
  201. ans["next"] = (function() {
  202. var ρσ_anonfunc = function () {
  203. this._i += 1;
  204. if (this._i < iterable.length) {
  205. return {'done':false, 'value':[this._i, iterable[this._i]]};
  206. }
  207. return {'done':true};
  208. };
  209. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  210. __module__ : {value: "__main__"}
  211. });
  212. return ρσ_anonfunc;
  213. })();
  214. return ans;
  215. }
  216. if (typeof iterable[ρσ_iterator_symbol] === "function") {
  217. iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
  218. ans["_iterator"] = iterator;
  219. ans["next"] = (function() {
  220. var ρσ_anonfunc = function () {
  221. var r;
  222. r = this._iterator.next();
  223. if (r.done) {
  224. return {'done':true};
  225. }
  226. this._i += 1;
  227. return {'done':false, 'value':[this._i, r.value]};
  228. };
  229. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  230. __module__ : {value: "__main__"}
  231. });
  232. return ρσ_anonfunc;
  233. })();
  234. return ans;
  235. }
  236. return ρσ_enumerate(Object.keys(iterable));
  237. };
  238. if (!ρσ_enumerate.__argnames__) Object.defineProperties(ρσ_enumerate, {
  239. __argnames__ : {value: ["iterable"]},
  240. __module__ : {value: "__main__"}
  241. });
  242. function ρσ_reversed(iterable) {
  243. var ans;
  244. if (ρσ_arraylike(iterable)) {
  245. ans = {"_i": iterable.length};
  246. ans["next"] = (function() {
  247. var ρσ_anonfunc = function () {
  248. this._i -= 1;
  249. if (this._i > -1) {
  250. return {'done':false, 'value':iterable[this._i]};
  251. }
  252. return {'done':true};
  253. };
  254. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  255. __module__ : {value: "__main__"}
  256. });
  257. return ρσ_anonfunc;
  258. })();
  259. ans[ρσ_iterator_symbol] = (function() {
  260. var ρσ_anonfunc = function () {
  261. return this;
  262. };
  263. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  264. __module__ : {value: "__main__"}
  265. });
  266. return ρσ_anonfunc;
  267. })();
  268. return ans;
  269. }
  270. throw new TypeError("reversed() can only be called on arrays or strings");
  271. };
  272. if (!ρσ_reversed.__argnames__) Object.defineProperties(ρσ_reversed, {
  273. __argnames__ : {value: ["iterable"]},
  274. __module__ : {value: "__main__"}
  275. });
  276. function ρσ_iter(iterable) {
  277. var ans;
  278. if (typeof iterable[ρσ_iterator_symbol] === "function") {
  279. return (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
  280. }
  281. if (ρσ_arraylike(iterable)) {
  282. ans = {"_i":-1};
  283. ans[ρσ_iterator_symbol] = (function() {
  284. var ρσ_anonfunc = function () {
  285. return this;
  286. };
  287. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  288. __module__ : {value: "__main__"}
  289. });
  290. return ρσ_anonfunc;
  291. })();
  292. ans["next"] = (function() {
  293. var ρσ_anonfunc = function () {
  294. this._i += 1;
  295. if (this._i < iterable.length) {
  296. return {'done':false, 'value':iterable[this._i]};
  297. }
  298. return {'done':true};
  299. };
  300. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  301. __module__ : {value: "__main__"}
  302. });
  303. return ρσ_anonfunc;
  304. })();
  305. return ans;
  306. }
  307. return ρσ_iter(Object.keys(iterable));
  308. };
  309. if (!ρσ_iter.__argnames__) Object.defineProperties(ρσ_iter, {
  310. __argnames__ : {value: ["iterable"]},
  311. __module__ : {value: "__main__"}
  312. });
  313. function ρσ_range_next(step, length) {
  314. var ρσ_unpack;
  315. this._i += step;
  316. this._idx += 1;
  317. if (this._idx >= length) {
  318. ρσ_unpack = [this.__i, -1];
  319. this._i = ρσ_unpack[0];
  320. this._idx = ρσ_unpack[1];
  321. return {'done':true};
  322. }
  323. return {'done':false, 'value':this._i};
  324. };
  325. if (!ρσ_range_next.__argnames__) Object.defineProperties(ρσ_range_next, {
  326. __argnames__ : {value: ["step", "length"]},
  327. __module__ : {value: "__main__"}
  328. });
  329. function ρσ_range(start, stop, step) {
  330. var length, ans;
  331. if (arguments.length <= 1) {
  332. stop = start || 0;
  333. start = 0;
  334. }
  335. step = arguments[2] || 1;
  336. length = Math.max(Math.ceil((stop - start) / step), 0);
  337. ans = {start:start, step:step, stop:stop};
  338. ans[ρσ_iterator_symbol] = (function() {
  339. var ρσ_anonfunc = function () {
  340. var it;
  341. it = {"_i": start - step, "_idx": -1};
  342. it.next = ρσ_range_next.bind(it, step, length);
  343. it[ρσ_iterator_symbol] = (function() {
  344. var ρσ_anonfunc = function () {
  345. return this;
  346. };
  347. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  348. __module__ : {value: "__main__"}
  349. });
  350. return ρσ_anonfunc;
  351. })();
  352. return it;
  353. };
  354. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  355. __module__ : {value: "__main__"}
  356. });
  357. return ρσ_anonfunc;
  358. })();
  359. ans.count = (function() {
  360. var ρσ_anonfunc = function (val) {
  361. if (!this._cached) {
  362. this._cached = list(this);
  363. }
  364. return this._cached.count(val);
  365. };
  366. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  367. __argnames__ : {value: ["val"]},
  368. __module__ : {value: "__main__"}
  369. });
  370. return ρσ_anonfunc;
  371. })();
  372. ans.index = (function() {
  373. var ρσ_anonfunc = function (val) {
  374. if (!this._cached) {
  375. this._cached = list(this);
  376. }
  377. return this._cached.index(val);
  378. };
  379. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  380. __argnames__ : {value: ["val"]},
  381. __module__ : {value: "__main__"}
  382. });
  383. return ρσ_anonfunc;
  384. })();
  385. ans.__len__ = (function() {
  386. var ρσ_anonfunc = function () {
  387. return length;
  388. };
  389. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  390. __module__ : {value: "__main__"}
  391. });
  392. return ρσ_anonfunc;
  393. })();
  394. ans.__repr__ = (function() {
  395. var ρσ_anonfunc = function () {
  396. return "range(" + ρσ_str.format("{}", start) + ", " + ρσ_str.format("{}", stop) + ", " + ρσ_str.format("{}", step) + ")";
  397. };
  398. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  399. __module__ : {value: "__main__"}
  400. });
  401. return ρσ_anonfunc;
  402. })();
  403. ans.__str__ = ans.toString = ans.__repr__;
  404. if (typeof Proxy === "function") {
  405. ans = new Proxy(ans, (function(){
  406. var ρσ_d = {};
  407. ρσ_d["get"] = (function() {
  408. var ρσ_anonfunc = function (obj, prop) {
  409. var iprop;
  410. if (typeof prop === "string") {
  411. iprop = parseInt(prop);
  412. if (!isNaN(iprop)) {
  413. prop = iprop;
  414. }
  415. }
  416. if (typeof prop === "number") {
  417. if (!obj._cached) {
  418. obj._cached = list(obj);
  419. }
  420. return (ρσ_expr_temp = obj._cached)[(typeof prop === "number" && prop < 0) ? ρσ_expr_temp.length + prop : prop];
  421. }
  422. return obj[(typeof prop === "number" && prop < 0) ? obj.length + prop : prop];
  423. };
  424. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  425. __argnames__ : {value: ["obj", "prop"]},
  426. __module__ : {value: "__main__"}
  427. });
  428. return ρσ_anonfunc;
  429. })();
  430. return ρσ_d;
  431. }).call(this));
  432. }
  433. return ans;
  434. };
  435. if (!ρσ_range.__argnames__) Object.defineProperties(ρσ_range, {
  436. __argnames__ : {value: ["start", "stop", "step"]},
  437. __module__ : {value: "__main__"}
  438. });
  439. function ρσ_getattr(obj, name, defval) {
  440. var ret;
  441. try {
  442. ret = obj[(typeof name === "number" && name < 0) ? obj.length + name : name];
  443. } catch (ρσ_Exception) {
  444. ρσ_last_exception = ρσ_Exception;
  445. if (ρσ_Exception instanceof TypeError) {
  446. if (defval === undefined) {
  447. throw new AttributeError("The attribute " + name + " is not present");
  448. }
  449. return defval;
  450. } else {
  451. throw ρσ_Exception;
  452. }
  453. }
  454. if (ret === undefined && !(name in obj)) {
  455. if (defval === undefined) {
  456. throw new AttributeError("The attribute " + name + " is not present");
  457. }
  458. ret = defval;
  459. }
  460. return ret;
  461. };
  462. if (!ρσ_getattr.__argnames__) Object.defineProperties(ρσ_getattr, {
  463. __argnames__ : {value: ["obj", "name", "defval"]},
  464. __module__ : {value: "__main__"}
  465. });
  466. function ρσ_setattr(obj, name, value) {
  467. obj[(typeof name === "number" && name < 0) ? obj.length + name : name] = value;
  468. };
  469. if (!ρσ_setattr.__argnames__) Object.defineProperties(ρσ_setattr, {
  470. __argnames__ : {value: ["obj", "name", "value"]},
  471. __module__ : {value: "__main__"}
  472. });
  473. function ρσ_hasattr(obj, name) {
  474. return name in obj;
  475. };
  476. if (!ρσ_hasattr.__argnames__) Object.defineProperties(ρσ_hasattr, {
  477. __argnames__ : {value: ["obj", "name"]},
  478. __module__ : {value: "__main__"}
  479. });
  480. ρσ_len = (function() {
  481. var ρσ_anonfunc = function () {
  482. function len(obj) {
  483. if (ρσ_arraylike(obj)) {
  484. return obj.length;
  485. }
  486. if (typeof obj.__len__ === "function") {
  487. return obj.__len__();
  488. }
  489. if (obj instanceof Set || obj instanceof Map) {
  490. return obj.size;
  491. }
  492. return Object.keys(obj).length;
  493. };
  494. if (!len.__argnames__) Object.defineProperties(len, {
  495. __argnames__ : {value: ["obj"]},
  496. __module__ : {value: "__main__"}
  497. });
  498. function len5(obj) {
  499. if (ρσ_arraylike(obj)) {
  500. return obj.length;
  501. }
  502. if (typeof obj.__len__ === "function") {
  503. return obj.__len__();
  504. }
  505. return Object.keys(obj).length;
  506. };
  507. if (!len5.__argnames__) Object.defineProperties(len5, {
  508. __argnames__ : {value: ["obj"]},
  509. __module__ : {value: "__main__"}
  510. });
  511. return (typeof Set === "function" && typeof Map === "function") ? len : len5;
  512. };
  513. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  514. __module__ : {value: "__main__"}
  515. });
  516. return ρσ_anonfunc;
  517. })()();
  518. function ρσ_get_module(name) {
  519. return ρσ_modules[(typeof name === "number" && name < 0) ? ρσ_modules.length + name : name];
  520. };
  521. if (!ρσ_get_module.__argnames__) Object.defineProperties(ρσ_get_module, {
  522. __argnames__ : {value: ["name"]},
  523. __module__ : {value: "__main__"}
  524. });
  525. function ρσ_pow(x, y, z) {
  526. var ans;
  527. ans = Math.pow(x, y);
  528. if (z !== undefined) {
  529. ans %= z;
  530. }
  531. return ans;
  532. };
  533. if (!ρσ_pow.__argnames__) Object.defineProperties(ρσ_pow, {
  534. __argnames__ : {value: ["x", "y", "z"]},
  535. __module__ : {value: "__main__"}
  536. });
  537. function ρσ_type(x) {
  538. return x.constructor;
  539. };
  540. if (!ρσ_type.__argnames__) Object.defineProperties(ρσ_type, {
  541. __argnames__ : {value: ["x"]},
  542. __module__ : {value: "__main__"}
  543. });
  544. function ρσ_divmod(x, y) {
  545. var d;
  546. if (y === 0) {
  547. throw new ZeroDivisionError("integer division or modulo by zero");
  548. }
  549. d = Math.floor(x / y);
  550. return [d, x - d * y];
  551. };
  552. if (!ρσ_divmod.__argnames__) Object.defineProperties(ρσ_divmod, {
  553. __argnames__ : {value: ["x", "y"]},
  554. __module__ : {value: "__main__"}
  555. });
  556. function ρσ_max() {
  557. var kwargs = arguments[arguments.length-1];
  558. if (kwargs === null || typeof kwargs !== "object" || kwargs [ρσ_kwargs_symbol] !== true) kwargs = {};
  559. var args = Array.prototype.slice.call(arguments, 0);
  560. if (kwargs !== null && typeof kwargs === "object" && kwargs [ρσ_kwargs_symbol] === true) args.pop();
  561. var args, x;
  562. if (args.length === 0) {
  563. if (kwargs.defval !== undefined) {
  564. return kwargs.defval;
  565. }
  566. throw new TypeError("expected at least one argument");
  567. }
  568. if (args.length === 1) {
  569. args = args[0];
  570. }
  571. if (kwargs.key) {
  572. args = (function() {
  573. var ρσ_Iter = ρσ_Iterable(args), ρσ_Result = [], x;
  574. for (var ρσ_Index = 0; ρσ_Index < ρσ_Iter.length; ρσ_Index++) {
  575. x = ρσ_Iter[ρσ_Index];
  576. ρσ_Result.push(kwargs.key(x));
  577. }
  578. ρσ_Result = ρσ_list_constructor(ρσ_Result);
  579. return ρσ_Result;
  580. })();
  581. }
  582. if (!Array.isArray(args)) {
  583. args = list(args);
  584. }
  585. if (args.length) {
  586. return this.apply(null, args);
  587. }
  588. if (kwargs.defval !== undefined) {
  589. return kwargs.defval;
  590. }
  591. throw new TypeError("expected at least one argument");
  592. };
  593. if (!ρσ_max.__handles_kwarg_interpolation__) Object.defineProperties(ρσ_max, {
  594. __handles_kwarg_interpolation__ : {value: true},
  595. __module__ : {value: "__main__"}
  596. });
  597. var abs = Math.abs, max = ρσ_max.bind(Math.max), min = ρσ_max.bind(Math.min), bool = ρσ_bool, type = ρσ_type;
  598. var float = ρσ_float, int = ρσ_int, arraylike = ρσ_arraylike_creator(), ρσ_arraylike = arraylike;
  599. var print = ρσ_print, id = ρσ_id, get_module = ρσ_get_module, pow = ρσ_pow, divmod = ρσ_divmod;
  600. var dir = ρσ_dir, ord = ρσ_ord, chr = ρσ_chr, bin = ρσ_bin, hex = ρσ_hex, callable = ρσ_callable;
  601. var enumerate = ρσ_enumerate, iter = ρσ_iter, reversed = ρσ_reversed, len = ρσ_len;
  602. var range = ρσ_range, getattr = ρσ_getattr, setattr = ρσ_setattr, hasattr = ρσ_hasattr;function ρσ_equals(a, b) {
  603. var ρσ_unpack, akeys, bkeys, key;
  604. if (a === b) {
  605. return true;
  606. }
  607. if (a && typeof a.__eq__ === "function") {
  608. return a.__eq__(b);
  609. }
  610. if (b && typeof b.__eq__ === "function") {
  611. return b.__eq__(a);
  612. }
  613. if (ρσ_arraylike(a) && ρσ_arraylike(b)) {
  614. if ((a.length !== b.length && (typeof a.length !== "object" || ρσ_not_equals(a.length, b.length)))) {
  615. return false;
  616. }
  617. for (var i=0; i < a.length; i++) {
  618. if (!(((a[(typeof i === "number" && i < 0) ? a.length + i : i] === b[(typeof i === "number" && i < 0) ? b.length + i : i] || typeof a[(typeof i === "number" && i < 0) ? a.length + i : i] === "object" && ρσ_equals(a[(typeof i === "number" && i < 0) ? a.length + i : i], b[(typeof i === "number" && i < 0) ? b.length + i : i]))))) {
  619. return false;
  620. }
  621. }
  622. return true;
  623. }
  624. if (typeof a === "object" && typeof b === "object" && a !== null && b !== null && (a.constructor === Object && b.constructor === Object || Object.getPrototypeOf(a) === null && Object.getPrototypeOf(b) === null)) {
  625. ρσ_unpack = [Object.keys(a), Object.keys(b)];
  626. akeys = ρσ_unpack[0];
  627. bkeys = ρσ_unpack[1];
  628. if (akeys.length !== bkeys.length) {
  629. return false;
  630. }
  631. for (var j=0; j < akeys.length; j++) {
  632. key = akeys[(typeof j === "number" && j < 0) ? akeys.length + j : j];
  633. if (!(((a[(typeof key === "number" && key < 0) ? a.length + key : key] === b[(typeof key === "number" && key < 0) ? b.length + key : key] || typeof a[(typeof key === "number" && key < 0) ? a.length + key : key] === "object" && ρσ_equals(a[(typeof key === "number" && key < 0) ? a.length + key : key], b[(typeof key === "number" && key < 0) ? b.length + key : key]))))) {
  634. return false;
  635. }
  636. }
  637. return true;
  638. }
  639. return false;
  640. };
  641. if (!ρσ_equals.__argnames__) Object.defineProperties(ρσ_equals, {
  642. __argnames__ : {value: ["a", "b"]},
  643. __module__ : {value: "__main__"}
  644. });
  645. function ρσ_not_equals(a, b) {
  646. if (a === b) {
  647. return false;
  648. }
  649. if (a && typeof a.__ne__ === "function") {
  650. return a.__ne__(b);
  651. }
  652. if (b && typeof b.__ne__ === "function") {
  653. return b.__ne__(a);
  654. }
  655. return !ρσ_equals(a, b);
  656. };
  657. if (!ρσ_not_equals.__argnames__) Object.defineProperties(ρσ_not_equals, {
  658. __argnames__ : {value: ["a", "b"]},
  659. __module__ : {value: "__main__"}
  660. });
  661. var equals = ρσ_equals;
  662. function ρσ_list_extend(iterable) {
  663. var start, iterator, result;
  664. if (Array.isArray(iterable) || typeof iterable === "string") {
  665. start = this.length;
  666. this.length += iterable.length;
  667. for (var i = 0; i < iterable.length; i++) {
  668. (ρσ_expr_temp = this)[ρσ_bound_index(start + i, ρσ_expr_temp)] = iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i];
  669. }
  670. } else {
  671. iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
  672. result = iterator.next();
  673. while (!result.done) {
  674. this.push(result.value);
  675. result = iterator.next();
  676. }
  677. }
  678. };
  679. if (!ρσ_list_extend.__argnames__) Object.defineProperties(ρσ_list_extend, {
  680. __argnames__ : {value: ["iterable"]},
  681. __module__ : {value: "__main__"}
  682. });
  683. function ρσ_list_index(val, start, stop) {
  684. start = start || 0;
  685. if (start < 0) {
  686. start = this.length + start;
  687. }
  688. if (start < 0) {
  689. throw new ValueError(val + " is not in list");
  690. }
  691. if (stop === undefined) {
  692. stop = this.length;
  693. }
  694. if (stop < 0) {
  695. stop = this.length + stop;
  696. }
  697. for (var i = start; i < stop; i++) {
  698. if (((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === val || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], val))) {
  699. return i;
  700. }
  701. }
  702. throw new ValueError(val + " is not in list");
  703. };
  704. if (!ρσ_list_index.__argnames__) Object.defineProperties(ρσ_list_index, {
  705. __argnames__ : {value: ["val", "start", "stop"]},
  706. __module__ : {value: "__main__"}
  707. });
  708. function ρσ_list_pop(index) {
  709. var ans;
  710. if (this.length === 0) {
  711. throw new IndexError("list is empty");
  712. }
  713. if (index === undefined) {
  714. index = -1;
  715. }
  716. ans = this.splice(index, 1);
  717. if (!ans.length) {
  718. throw new IndexError("pop index out of range");
  719. }
  720. return ans[0];
  721. };
  722. if (!ρσ_list_pop.__argnames__) Object.defineProperties(ρσ_list_pop, {
  723. __argnames__ : {value: ["index"]},
  724. __module__ : {value: "__main__"}
  725. });
  726. function ρσ_list_remove(value) {
  727. for (var i = 0; i < this.length; i++) {
  728. if (((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === value || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], value))) {
  729. this.splice(i, 1);
  730. return;
  731. }
  732. }
  733. throw new ValueError(value + " not in list");
  734. };
  735. if (!ρσ_list_remove.__argnames__) Object.defineProperties(ρσ_list_remove, {
  736. __argnames__ : {value: ["value"]},
  737. __module__ : {value: "__main__"}
  738. });
  739. function ρσ_list_to_string() {
  740. return "[" + this.join(", ") + "]";
  741. };
  742. if (!ρσ_list_to_string.__module__) Object.defineProperties(ρσ_list_to_string, {
  743. __module__ : {value: "__main__"}
  744. });
  745. function ρσ_list_insert(index, val) {
  746. if (index < 0) {
  747. index += this.length;
  748. }
  749. index = min(this.length, max(index, 0));
  750. if (index === 0) {
  751. this.unshift(val);
  752. return;
  753. }
  754. for (var i = this.length; i > index; i--) {
  755. (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] = (ρσ_expr_temp = this)[ρσ_bound_index(i - 1, ρσ_expr_temp)];
  756. }
  757. (ρσ_expr_temp = this)[(typeof index === "number" && index < 0) ? ρσ_expr_temp.length + index : index] = val;
  758. };
  759. if (!ρσ_list_insert.__argnames__) Object.defineProperties(ρσ_list_insert, {
  760. __argnames__ : {value: ["index", "val"]},
  761. __module__ : {value: "__main__"}
  762. });
  763. function ρσ_list_copy() {
  764. return ρσ_list_constructor(this);
  765. };
  766. if (!ρσ_list_copy.__module__) Object.defineProperties(ρσ_list_copy, {
  767. __module__ : {value: "__main__"}
  768. });
  769. function ρσ_list_clear() {
  770. this.length = 0;
  771. };
  772. if (!ρσ_list_clear.__module__) Object.defineProperties(ρσ_list_clear, {
  773. __module__ : {value: "__main__"}
  774. });
  775. function ρσ_list_as_array() {
  776. return Array.prototype.slice.call(this);
  777. };
  778. if (!ρσ_list_as_array.__module__) Object.defineProperties(ρσ_list_as_array, {
  779. __module__ : {value: "__main__"}
  780. });
  781. function ρσ_list_count(value) {
  782. return this.reduce((function() {
  783. var ρσ_anonfunc = function (n, val) {
  784. return n + (val === value);
  785. };
  786. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  787. __argnames__ : {value: ["n", "val"]},
  788. __module__ : {value: "__main__"}
  789. });
  790. return ρσ_anonfunc;
  791. })(), 0);
  792. };
  793. if (!ρσ_list_count.__argnames__) Object.defineProperties(ρσ_list_count, {
  794. __argnames__ : {value: ["value"]},
  795. __module__ : {value: "__main__"}
  796. });
  797. function ρσ_list_sort_key(value) {
  798. var t;
  799. t = typeof value;
  800. if (t === "string" || t === "number") {
  801. return value;
  802. }
  803. return value.toString();
  804. };
  805. if (!ρσ_list_sort_key.__argnames__) Object.defineProperties(ρσ_list_sort_key, {
  806. __argnames__ : {value: ["value"]},
  807. __module__ : {value: "__main__"}
  808. });
  809. function ρσ_list_sort_cmp(a, b, ap, bp) {
  810. if (a < b) {
  811. return -1;
  812. }
  813. if (a > b) {
  814. return 1;
  815. }
  816. return ap - bp;
  817. };
  818. if (!ρσ_list_sort_cmp.__argnames__) Object.defineProperties(ρσ_list_sort_cmp, {
  819. __argnames__ : {value: ["a", "b", "ap", "bp"]},
  820. __module__ : {value: "__main__"}
  821. });
  822. function ρσ_list_sort() {
  823. var key = (arguments[0] === undefined || ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ρσ_list_sort.__defaults__.key : arguments[0];
  824. var reverse = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ρσ_list_sort.__defaults__.reverse : arguments[1];
  825. var ρσ_kwargs_obj = arguments[arguments.length-1];
  826. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  827. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "key")){
  828. key = ρσ_kwargs_obj.key;
  829. }
  830. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "reverse")){
  831. reverse = ρσ_kwargs_obj.reverse;
  832. }
  833. var mult, keymap, posmap, k;
  834. key = key || ρσ_list_sort_key;
  835. mult = (reverse) ? -1 : 1;
  836. keymap = dict();
  837. posmap = dict();
  838. for (var i=0; i < this.length; i++) {
  839. k = (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
  840. keymap.set(k, key(k));
  841. posmap.set(k, i);
  842. }
  843. this.sort((function() {
  844. var ρσ_anonfunc = function (a, b) {
  845. return mult * ρσ_list_sort_cmp(keymap.get(a), keymap.get(b), posmap.get(a), posmap.get(b));
  846. };
  847. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  848. __argnames__ : {value: ["a", "b"]},
  849. __module__ : {value: "__main__"}
  850. });
  851. return ρσ_anonfunc;
  852. })());
  853. };
  854. if (!ρσ_list_sort.__defaults__) Object.defineProperties(ρσ_list_sort, {
  855. __defaults__ : {value: {key:null, reverse:false}},
  856. __handles_kwarg_interpolation__ : {value: true},
  857. __argnames__ : {value: ["key", "reverse"]},
  858. __module__ : {value: "__main__"}
  859. });
  860. function ρσ_list_concat() {
  861. var ans;
  862. ans = Array.prototype.concat.apply(this, arguments);
  863. ρσ_list_decorate(ans);
  864. return ans;
  865. };
  866. if (!ρσ_list_concat.__module__) Object.defineProperties(ρσ_list_concat, {
  867. __module__ : {value: "__main__"}
  868. });
  869. function ρσ_list_slice() {
  870. var ans;
  871. ans = Array.prototype.slice.apply(this, arguments);
  872. ρσ_list_decorate(ans);
  873. return ans;
  874. };
  875. if (!ρσ_list_slice.__module__) Object.defineProperties(ρσ_list_slice, {
  876. __module__ : {value: "__main__"}
  877. });
  878. function ρσ_list_iterator(value) {
  879. var self;
  880. self = this;
  881. return (function(){
  882. var ρσ_d = {};
  883. ρσ_d["_i"] = -1;
  884. ρσ_d["_list"] = self;
  885. ρσ_d["next"] = (function() {
  886. var ρσ_anonfunc = function () {
  887. this._i += 1;
  888. if (this._i >= this._list.length) {
  889. return (function(){
  890. var ρσ_d = {};
  891. ρσ_d["done"] = true;
  892. return ρσ_d;
  893. }).call(this);
  894. }
  895. return (function(){
  896. var ρσ_d = {};
  897. ρσ_d["done"] = false;
  898. ρσ_d["value"] = (ρσ_expr_temp = this._list)[ρσ_bound_index(this._i, ρσ_expr_temp)];
  899. return ρσ_d;
  900. }).call(this);
  901. };
  902. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  903. __module__ : {value: "__main__"}
  904. });
  905. return ρσ_anonfunc;
  906. })();
  907. return ρσ_d;
  908. }).call(this);
  909. };
  910. if (!ρσ_list_iterator.__argnames__) Object.defineProperties(ρσ_list_iterator, {
  911. __argnames__ : {value: ["value"]},
  912. __module__ : {value: "__main__"}
  913. });
  914. function ρσ_list_len() {
  915. return this.length;
  916. };
  917. if (!ρσ_list_len.__module__) Object.defineProperties(ρσ_list_len, {
  918. __module__ : {value: "__main__"}
  919. });
  920. function ρσ_list_contains(val) {
  921. for (var i = 0; i < this.length; i++) {
  922. if (((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === val || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], val))) {
  923. return true;
  924. }
  925. }
  926. return false;
  927. };
  928. if (!ρσ_list_contains.__argnames__) Object.defineProperties(ρσ_list_contains, {
  929. __argnames__ : {value: ["val"]},
  930. __module__ : {value: "__main__"}
  931. });
  932. function ρσ_list_eq(other) {
  933. if (!ρσ_arraylike(other)) {
  934. return false;
  935. }
  936. if ((this.length !== other.length && (typeof this.length !== "object" || ρσ_not_equals(this.length, other.length)))) {
  937. return false;
  938. }
  939. for (var i = 0; i < this.length; i++) {
  940. if (!((((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === other[(typeof i === "number" && i < 0) ? other.length + i : i] || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], other[(typeof i === "number" && i < 0) ? other.length + i : i]))))) {
  941. return false;
  942. }
  943. }
  944. return true;
  945. };
  946. if (!ρσ_list_eq.__argnames__) Object.defineProperties(ρσ_list_eq, {
  947. __argnames__ : {value: ["other"]},
  948. __module__ : {value: "__main__"}
  949. });
  950. function ρσ_list_decorate(ans) {
  951. ans.append = Array.prototype.push;
  952. ans.toString = ρσ_list_to_string;
  953. ans.inspect = ρσ_list_to_string;
  954. ans.extend = ρσ_list_extend;
  955. ans.index = ρσ_list_index;
  956. ans.pypop = ρσ_list_pop;
  957. ans.remove = ρσ_list_remove;
  958. ans.insert = ρσ_list_insert;
  959. ans.copy = ρσ_list_copy;
  960. ans.clear = ρσ_list_clear;
  961. ans.count = ρσ_list_count;
  962. ans.concat = ρσ_list_concat;
  963. ans.pysort = ρσ_list_sort;
  964. ans.slice = ρσ_list_slice;
  965. ans.as_array = ρσ_list_as_array;
  966. ans.__len__ = ρσ_list_len;
  967. ans.__contains__ = ρσ_list_contains;
  968. ans.__eq__ = ρσ_list_eq;
  969. ans.constructor = ρσ_list_constructor;
  970. if (typeof ans[ρσ_iterator_symbol] !== "function") {
  971. ans[ρσ_iterator_symbol] = ρσ_list_iterator;
  972. }
  973. return ans;
  974. };
  975. if (!ρσ_list_decorate.__argnames__) Object.defineProperties(ρσ_list_decorate, {
  976. __argnames__ : {value: ["ans"]},
  977. __module__ : {value: "__main__"}
  978. });
  979. function ρσ_list_constructor(iterable) {
  980. var ans, iterator, result;
  981. if (iterable === undefined) {
  982. ans = [];
  983. } else if (ρσ_arraylike(iterable)) {
  984. ans = new Array(iterable.length);
  985. for (var i = 0; i < iterable.length; i++) {
  986. ans[(typeof i === "number" && i < 0) ? ans.length + i : i] = iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i];
  987. }
  988. } else if (typeof iterable[ρσ_iterator_symbol] === "function") {
  989. iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
  990. ans = ρσ_list_decorate([]);
  991. result = iterator.next();
  992. while (!result.done) {
  993. ans.push(result.value);
  994. result = iterator.next();
  995. }
  996. } else if (typeof iterable === "number") {
  997. ans = new Array(iterable);
  998. } else {
  999. ans = Object.keys(iterable);
  1000. }
  1001. return ρσ_list_decorate(ans);
  1002. };
  1003. if (!ρσ_list_constructor.__argnames__) Object.defineProperties(ρσ_list_constructor, {
  1004. __argnames__ : {value: ["iterable"]},
  1005. __module__ : {value: "__main__"}
  1006. });
  1007. ρσ_list_constructor.__name__ = "list";
  1008. var list = ρσ_list_constructor, list_wrap = ρσ_list_decorate;
  1009. function sorted() {
  1010. var iterable = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
  1011. var key = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? sorted.__defaults__.key : arguments[1];
  1012. var reverse = (arguments[2] === undefined || ( 2 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? sorted.__defaults__.reverse : arguments[2];
  1013. var ρσ_kwargs_obj = arguments[arguments.length-1];
  1014. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  1015. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "key")){
  1016. key = ρσ_kwargs_obj.key;
  1017. }
  1018. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "reverse")){
  1019. reverse = ρσ_kwargs_obj.reverse;
  1020. }
  1021. var ans;
  1022. ans = ρσ_list_constructor(iterable);
  1023. ans.pysort(key, reverse);
  1024. return ans;
  1025. };
  1026. if (!sorted.__defaults__) Object.defineProperties(sorted, {
  1027. __defaults__ : {value: {key:null, reverse:false}},
  1028. __handles_kwarg_interpolation__ : {value: true},
  1029. __argnames__ : {value: ["iterable", "key", "reverse"]},
  1030. __module__ : {value: "__main__"}
  1031. });
  1032. var ρσ_global_object_id = 0, ρσ_set_implementation;
  1033. function ρσ_set_keyfor(x) {
  1034. var t, ans;
  1035. t = typeof x;
  1036. if (t === "string" || t === "number" || t === "boolean") {
  1037. return "_" + t[0] + x;
  1038. }
  1039. if (x === null) {
  1040. return "__!@#$0";
  1041. }
  1042. ans = x.ρσ_hash_key_prop;
  1043. if (ans === undefined) {
  1044. ans = "_!@#$" + (++ρσ_global_object_id);
  1045. Object.defineProperty(x, "ρσ_hash_key_prop", (function(){
  1046. var ρσ_d = {};
  1047. ρσ_d["value"] = ans;
  1048. return ρσ_d;
  1049. }).call(this));
  1050. }
  1051. return ans;
  1052. };
  1053. if (!ρσ_set_keyfor.__argnames__) Object.defineProperties(ρσ_set_keyfor, {
  1054. __argnames__ : {value: ["x"]},
  1055. __module__ : {value: "__main__"}
  1056. });
  1057. function ρσ_set_polyfill() {
  1058. this._store = {};
  1059. this.size = 0;
  1060. };
  1061. if (!ρσ_set_polyfill.__module__) Object.defineProperties(ρσ_set_polyfill, {
  1062. __module__ : {value: "__main__"}
  1063. });
  1064. ρσ_set_polyfill.prototype.add = (function() {
  1065. var ρσ_anonfunc = function (x) {
  1066. var key;
  1067. key = ρσ_set_keyfor(x);
  1068. if (!Object.prototype.hasOwnProperty.call(this._store, key)) {
  1069. this.size += 1;
  1070. (ρσ_expr_temp = this._store)[(typeof key === "number" && key < 0) ? ρσ_expr_temp.length + key : key] = x;
  1071. }
  1072. return this;
  1073. };
  1074. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1075. __argnames__ : {value: ["x"]},
  1076. __module__ : {value: "__main__"}
  1077. });
  1078. return ρσ_anonfunc;
  1079. })();
  1080. ρσ_set_polyfill.prototype.clear = (function() {
  1081. var ρσ_anonfunc = function (x) {
  1082. this._store = {};
  1083. this.size = 0;
  1084. };
  1085. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1086. __argnames__ : {value: ["x"]},
  1087. __module__ : {value: "__main__"}
  1088. });
  1089. return ρσ_anonfunc;
  1090. })();
  1091. ρσ_set_polyfill.prototype.delete = (function() {
  1092. var ρσ_anonfunc = function (x) {
  1093. var key;
  1094. key = ρσ_set_keyfor(x);
  1095. if (Object.prototype.hasOwnProperty.call(this._store, key)) {
  1096. this.size -= 1;
  1097. delete this._store[key];
  1098. return true;
  1099. }
  1100. return false;
  1101. };
  1102. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1103. __argnames__ : {value: ["x"]},
  1104. __module__ : {value: "__main__"}
  1105. });
  1106. return ρσ_anonfunc;
  1107. })();
  1108. ρσ_set_polyfill.prototype.has = (function() {
  1109. var ρσ_anonfunc = function (x) {
  1110. return Object.prototype.hasOwnProperty.call(this._store, ρσ_set_keyfor(x));
  1111. };
  1112. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1113. __argnames__ : {value: ["x"]},
  1114. __module__ : {value: "__main__"}
  1115. });
  1116. return ρσ_anonfunc;
  1117. })();
  1118. ρσ_set_polyfill.prototype.values = (function() {
  1119. var ρσ_anonfunc = function (x) {
  1120. var ans;
  1121. ans = {'_keys': Object.keys(this._store), '_i':-1, '_s':this._store};
  1122. ans[ρσ_iterator_symbol] = (function() {
  1123. var ρσ_anonfunc = function () {
  1124. return this;
  1125. };
  1126. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1127. __module__ : {value: "__main__"}
  1128. });
  1129. return ρσ_anonfunc;
  1130. })();
  1131. ans["next"] = (function() {
  1132. var ρσ_anonfunc = function () {
  1133. this._i += 1;
  1134. if (this._i >= this._keys.length) {
  1135. return {'done': true};
  1136. }
  1137. return {'done':false, 'value':this._s[this._keys[this._i]]};
  1138. };
  1139. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1140. __module__ : {value: "__main__"}
  1141. });
  1142. return ρσ_anonfunc;
  1143. })();
  1144. return ans;
  1145. };
  1146. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1147. __argnames__ : {value: ["x"]},
  1148. __module__ : {value: "__main__"}
  1149. });
  1150. return ρσ_anonfunc;
  1151. })();
  1152. if (typeof Set !== "function" || typeof Set.prototype.delete !== "function") {
  1153. ρσ_set_implementation = ρσ_set_polyfill;
  1154. } else {
  1155. ρσ_set_implementation = Set;
  1156. }
  1157. function ρσ_set(iterable) {
  1158. var ans, s, iterator, result, keys;
  1159. if (this instanceof ρσ_set) {
  1160. this.jsset = new ρσ_set_implementation;
  1161. ans = this;
  1162. if (iterable === undefined) {
  1163. return ans;
  1164. }
  1165. s = ans.jsset;
  1166. if (ρσ_arraylike(iterable)) {
  1167. for (var i = 0; i < iterable.length; i++) {
  1168. s.add(iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i]);
  1169. }
  1170. } else if (typeof iterable[ρσ_iterator_symbol] === "function") {
  1171. iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
  1172. result = iterator.next();
  1173. while (!result.done) {
  1174. s.add(result.value);
  1175. result = iterator.next();
  1176. }
  1177. } else {
  1178. keys = Object.keys(iterable);
  1179. for (var j=0; j < keys.length; j++) {
  1180. s.add(keys[(typeof j === "number" && j < 0) ? keys.length + j : j]);
  1181. }
  1182. }
  1183. return ans;
  1184. } else {
  1185. return new ρσ_set(iterable);
  1186. }
  1187. };
  1188. if (!ρσ_set.__argnames__) Object.defineProperties(ρσ_set, {
  1189. __argnames__ : {value: ["iterable"]},
  1190. __module__ : {value: "__main__"}
  1191. });
  1192. ρσ_set.prototype.__name__ = "set";
  1193. Object.defineProperties(ρσ_set.prototype, (function(){
  1194. var ρσ_d = {};
  1195. ρσ_d["length"] = (function(){
  1196. var ρσ_d = {};
  1197. ρσ_d["get"] = (function() {
  1198. var ρσ_anonfunc = function () {
  1199. return this.jsset.size;
  1200. };
  1201. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1202. __module__ : {value: "__main__"}
  1203. });
  1204. return ρσ_anonfunc;
  1205. })();
  1206. return ρσ_d;
  1207. }).call(this);
  1208. ρσ_d["size"] = (function(){
  1209. var ρσ_d = {};
  1210. ρσ_d["get"] = (function() {
  1211. var ρσ_anonfunc = function () {
  1212. return this.jsset.size;
  1213. };
  1214. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1215. __module__ : {value: "__main__"}
  1216. });
  1217. return ρσ_anonfunc;
  1218. })();
  1219. return ρσ_d;
  1220. }).call(this);
  1221. return ρσ_d;
  1222. }).call(this));
  1223. ρσ_set.prototype.__len__ = (function() {
  1224. var ρσ_anonfunc = function () {
  1225. return this.jsset.size;
  1226. };
  1227. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1228. __module__ : {value: "__main__"}
  1229. });
  1230. return ρσ_anonfunc;
  1231. })();
  1232. ρσ_set.prototype.has = ρσ_set.prototype.__contains__ = (function() {
  1233. var ρσ_anonfunc = function (x) {
  1234. return this.jsset.has(x);
  1235. };
  1236. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1237. __argnames__ : {value: ["x"]},
  1238. __module__ : {value: "__main__"}
  1239. });
  1240. return ρσ_anonfunc;
  1241. })();
  1242. ρσ_set.prototype.add = (function() {
  1243. var ρσ_anonfunc = function (x) {
  1244. this.jsset.add(x);
  1245. };
  1246. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1247. __argnames__ : {value: ["x"]},
  1248. __module__ : {value: "__main__"}
  1249. });
  1250. return ρσ_anonfunc;
  1251. })();
  1252. ρσ_set.prototype.clear = (function() {
  1253. var ρσ_anonfunc = function () {
  1254. this.jsset.clear();
  1255. };
  1256. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1257. __module__ : {value: "__main__"}
  1258. });
  1259. return ρσ_anonfunc;
  1260. })();
  1261. ρσ_set.prototype.copy = (function() {
  1262. var ρσ_anonfunc = function () {
  1263. return ρσ_set(this);
  1264. };
  1265. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1266. __module__ : {value: "__main__"}
  1267. });
  1268. return ρσ_anonfunc;
  1269. })();
  1270. ρσ_set.prototype.discard = (function() {
  1271. var ρσ_anonfunc = function (x) {
  1272. this.jsset.delete(x);
  1273. };
  1274. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1275. __argnames__ : {value: ["x"]},
  1276. __module__ : {value: "__main__"}
  1277. });
  1278. return ρσ_anonfunc;
  1279. })();
  1280. ρσ_set.prototype[ρσ_iterator_symbol] = (function() {
  1281. var ρσ_anonfunc = function () {
  1282. return this.jsset.values();
  1283. };
  1284. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1285. __module__ : {value: "__main__"}
  1286. });
  1287. return ρσ_anonfunc;
  1288. })();
  1289. ρσ_set.prototype.difference = (function() {
  1290. var ρσ_anonfunc = function () {
  1291. var ans, s, iterator, r, x, has;
  1292. ans = new ρσ_set;
  1293. s = ans.jsset;
  1294. iterator = this.jsset.values();
  1295. r = iterator.next();
  1296. while (!r.done) {
  1297. x = r.value;
  1298. has = false;
  1299. for (var i = 0; i < arguments.length; i++) {
  1300. if (arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i].has(x)) {
  1301. has = true;
  1302. break;
  1303. }
  1304. }
  1305. if (!has) {
  1306. s.add(x);
  1307. }
  1308. r = iterator.next();
  1309. }
  1310. return ans;
  1311. };
  1312. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1313. __module__ : {value: "__main__"}
  1314. });
  1315. return ρσ_anonfunc;
  1316. })();
  1317. ρσ_set.prototype.difference_update = (function() {
  1318. var ρσ_anonfunc = function () {
  1319. var s, remove, iterator, r, x;
  1320. s = this.jsset;
  1321. remove = [];
  1322. iterator = s.values();
  1323. r = iterator.next();
  1324. while (!r.done) {
  1325. x = r.value;
  1326. for (var i = 0; i < arguments.length; i++) {
  1327. if (arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i].has(x)) {
  1328. remove.push(x);
  1329. break;
  1330. }
  1331. }
  1332. r = iterator.next();
  1333. }
  1334. for (var j = 0; j < remove.length; j++) {
  1335. s.delete(remove[(typeof j === "number" && j < 0) ? remove.length + j : j]);
  1336. }
  1337. };
  1338. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1339. __module__ : {value: "__main__"}
  1340. });
  1341. return ρσ_anonfunc;
  1342. })();
  1343. ρσ_set.prototype.intersection = (function() {
  1344. var ρσ_anonfunc = function () {
  1345. var ans, s, iterator, r, x, has;
  1346. ans = new ρσ_set;
  1347. s = ans.jsset;
  1348. iterator = this.jsset.values();
  1349. r = iterator.next();
  1350. while (!r.done) {
  1351. x = r.value;
  1352. has = true;
  1353. for (var i = 0; i < arguments.length; i++) {
  1354. if (!arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i].has(x)) {
  1355. has = false;
  1356. break;
  1357. }
  1358. }
  1359. if (has) {
  1360. s.add(x);
  1361. }
  1362. r = iterator.next();
  1363. }
  1364. return ans;
  1365. };
  1366. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1367. __module__ : {value: "__main__"}
  1368. });
  1369. return ρσ_anonfunc;
  1370. })();
  1371. ρσ_set.prototype.intersection_update = (function() {
  1372. var ρσ_anonfunc = function () {
  1373. var s, remove, iterator, r, x;
  1374. s = this.jsset;
  1375. remove = [];
  1376. iterator = s.values();
  1377. r = iterator.next();
  1378. while (!r.done) {
  1379. x = r.value;
  1380. for (var i = 0; i < arguments.length; i++) {
  1381. if (!arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i].has(x)) {
  1382. remove.push(x);
  1383. break;
  1384. }
  1385. }
  1386. r = iterator.next();
  1387. }
  1388. for (var j = 0; j < remove.length; j++) {
  1389. s.delete(remove[(typeof j === "number" && j < 0) ? remove.length + j : j]);
  1390. }
  1391. };
  1392. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1393. __module__ : {value: "__main__"}
  1394. });
  1395. return ρσ_anonfunc;
  1396. })();
  1397. ρσ_set.prototype.isdisjoint = (function() {
  1398. var ρσ_anonfunc = function (other) {
  1399. var iterator, r, x;
  1400. iterator = this.jsset.values();
  1401. r = iterator.next();
  1402. while (!r.done) {
  1403. x = r.value;
  1404. if (other.has(x)) {
  1405. return false;
  1406. }
  1407. r = iterator.next();
  1408. }
  1409. return true;
  1410. };
  1411. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1412. __argnames__ : {value: ["other"]},
  1413. __module__ : {value: "__main__"}
  1414. });
  1415. return ρσ_anonfunc;
  1416. })();
  1417. ρσ_set.prototype.issubset = (function() {
  1418. var ρσ_anonfunc = function (other) {
  1419. var iterator, r, x;
  1420. iterator = this.jsset.values();
  1421. r = iterator.next();
  1422. while (!r.done) {
  1423. x = r.value;
  1424. if (!other.has(x)) {
  1425. return false;
  1426. }
  1427. r = iterator.next();
  1428. }
  1429. return true;
  1430. };
  1431. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1432. __argnames__ : {value: ["other"]},
  1433. __module__ : {value: "__main__"}
  1434. });
  1435. return ρσ_anonfunc;
  1436. })();
  1437. ρσ_set.prototype.issuperset = (function() {
  1438. var ρσ_anonfunc = function (other) {
  1439. var s, iterator, r, x;
  1440. s = this.jsset;
  1441. iterator = other.jsset.values();
  1442. r = iterator.next();
  1443. while (!r.done) {
  1444. x = r.value;
  1445. if (!s.has(x)) {
  1446. return false;
  1447. }
  1448. r = iterator.next();
  1449. }
  1450. return true;
  1451. };
  1452. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1453. __argnames__ : {value: ["other"]},
  1454. __module__ : {value: "__main__"}
  1455. });
  1456. return ρσ_anonfunc;
  1457. })();
  1458. ρσ_set.prototype.pop = (function() {
  1459. var ρσ_anonfunc = function () {
  1460. var iterator, r;
  1461. iterator = this.jsset.values();
  1462. r = iterator.next();
  1463. if (r.done) {
  1464. throw new KeyError("pop from an empty set");
  1465. }
  1466. this.jsset.delete(r.value);
  1467. return r.value;
  1468. };
  1469. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1470. __module__ : {value: "__main__"}
  1471. });
  1472. return ρσ_anonfunc;
  1473. })();
  1474. ρσ_set.prototype.remove = (function() {
  1475. var ρσ_anonfunc = function (x) {
  1476. if (!this.jsset.delete(x)) {
  1477. throw new KeyError(x.toString());
  1478. }
  1479. };
  1480. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1481. __argnames__ : {value: ["x"]},
  1482. __module__ : {value: "__main__"}
  1483. });
  1484. return ρσ_anonfunc;
  1485. })();
  1486. ρσ_set.prototype.symmetric_difference = (function() {
  1487. var ρσ_anonfunc = function (other) {
  1488. return this.union(other).difference(this.intersection(other));
  1489. };
  1490. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1491. __argnames__ : {value: ["other"]},
  1492. __module__ : {value: "__main__"}
  1493. });
  1494. return ρσ_anonfunc;
  1495. })();
  1496. ρσ_set.prototype.symmetric_difference_update = (function() {
  1497. var ρσ_anonfunc = function (other) {
  1498. var common;
  1499. common = this.intersection(other);
  1500. this.update(other);
  1501. this.difference_update(common);
  1502. };
  1503. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1504. __argnames__ : {value: ["other"]},
  1505. __module__ : {value: "__main__"}
  1506. });
  1507. return ρσ_anonfunc;
  1508. })();
  1509. ρσ_set.prototype.union = (function() {
  1510. var ρσ_anonfunc = function () {
  1511. var ans;
  1512. ans = ρσ_set(this);
  1513. ans.update.apply(ans, arguments);
  1514. return ans;
  1515. };
  1516. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1517. __module__ : {value: "__main__"}
  1518. });
  1519. return ρσ_anonfunc;
  1520. })();
  1521. ρσ_set.prototype.update = (function() {
  1522. var ρσ_anonfunc = function () {
  1523. var s, iterator, r;
  1524. s = this.jsset;
  1525. for (var i=0; i < arguments.length; i++) {
  1526. iterator = arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i][ρσ_iterator_symbol]();
  1527. r = iterator.next();
  1528. while (!r.done) {
  1529. s.add(r.value);
  1530. r = iterator.next();
  1531. }
  1532. }
  1533. };
  1534. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1535. __module__ : {value: "__main__"}
  1536. });
  1537. return ρσ_anonfunc;
  1538. })();
  1539. ρσ_set.prototype.toString = ρσ_set.prototype.__repr__ = ρσ_set.prototype.__str__ = ρσ_set.prototype.inspect = (function() {
  1540. var ρσ_anonfunc = function () {
  1541. return "{" + list(this).join(", ") + "}";
  1542. };
  1543. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1544. __module__ : {value: "__main__"}
  1545. });
  1546. return ρσ_anonfunc;
  1547. })();
  1548. ρσ_set.prototype.__eq__ = (function() {
  1549. var ρσ_anonfunc = function (other) {
  1550. var iterator, r;
  1551. if (!other instanceof this.constructor) {
  1552. return false;
  1553. }
  1554. if (other.size !== this.size) {
  1555. return false;
  1556. }
  1557. if (other.size === 0) {
  1558. return true;
  1559. }
  1560. iterator = other[ρσ_iterator_symbol]();
  1561. r = iterator.next();
  1562. while (!r.done) {
  1563. if (!this.has(r.value)) {
  1564. return false;
  1565. }
  1566. r = iterator.next();
  1567. }
  1568. return true;
  1569. };
  1570. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1571. __argnames__ : {value: ["other"]},
  1572. __module__ : {value: "__main__"}
  1573. });
  1574. return ρσ_anonfunc;
  1575. })();
  1576. function ρσ_set_wrap(x) {
  1577. var ans;
  1578. ans = new ρσ_set;
  1579. ans.jsset = x;
  1580. return ans;
  1581. };
  1582. if (!ρσ_set_wrap.__argnames__) Object.defineProperties(ρσ_set_wrap, {
  1583. __argnames__ : {value: ["x"]},
  1584. __module__ : {value: "__main__"}
  1585. });
  1586. var set = ρσ_set, set_wrap = ρσ_set_wrap;
  1587. var ρσ_dict_implementation;
  1588. function ρσ_dict_polyfill() {
  1589. this._store = {};
  1590. this.size = 0;
  1591. };
  1592. if (!ρσ_dict_polyfill.__module__) Object.defineProperties(ρσ_dict_polyfill, {
  1593. __module__ : {value: "__main__"}
  1594. });
  1595. ρσ_dict_polyfill.prototype.set = (function() {
  1596. var ρσ_anonfunc = function (x, value) {
  1597. var key;
  1598. key = ρσ_set_keyfor(x);
  1599. if (!Object.prototype.hasOwnProperty.call(this._store, key)) {
  1600. this.size += 1;
  1601. }
  1602. (ρσ_expr_temp = this._store)[(typeof key === "number" && key < 0) ? ρσ_expr_temp.length + key : key] = [x, value];
  1603. return this;
  1604. };
  1605. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1606. __argnames__ : {value: ["x", "value"]},
  1607. __module__ : {value: "__main__"}
  1608. });
  1609. return ρσ_anonfunc;
  1610. })();
  1611. ρσ_dict_polyfill.prototype.clear = (function() {
  1612. var ρσ_anonfunc = function (x) {
  1613. this._store = {};
  1614. this.size = 0;
  1615. };
  1616. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1617. __argnames__ : {value: ["x"]},
  1618. __module__ : {value: "__main__"}
  1619. });
  1620. return ρσ_anonfunc;
  1621. })();
  1622. ρσ_dict_polyfill.prototype.delete = (function() {
  1623. var ρσ_anonfunc = function (x) {
  1624. var key;
  1625. key = ρσ_set_keyfor(x);
  1626. if (Object.prototype.hasOwnProperty.call(this._store, key)) {
  1627. this.size -= 1;
  1628. delete this._store[key];
  1629. return true;
  1630. }
  1631. return false;
  1632. };
  1633. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1634. __argnames__ : {value: ["x"]},
  1635. __module__ : {value: "__main__"}
  1636. });
  1637. return ρσ_anonfunc;
  1638. })();
  1639. ρσ_dict_polyfill.prototype.has = (function() {
  1640. var ρσ_anonfunc = function (x) {
  1641. return Object.prototype.hasOwnProperty.call(this._store, ρσ_set_keyfor(x));
  1642. };
  1643. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1644. __argnames__ : {value: ["x"]},
  1645. __module__ : {value: "__main__"}
  1646. });
  1647. return ρσ_anonfunc;
  1648. })();
  1649. ρσ_dict_polyfill.prototype.get = (function() {
  1650. var ρσ_anonfunc = function (x) {
  1651. try {
  1652. return (ρσ_expr_temp = this._store)[ρσ_bound_index(ρσ_set_keyfor(x), ρσ_expr_temp)][1];
  1653. } catch (ρσ_Exception) {
  1654. ρσ_last_exception = ρσ_Exception;
  1655. if (ρσ_Exception instanceof TypeError) {
  1656. return undefined;
  1657. } else {
  1658. throw ρσ_Exception;
  1659. }
  1660. }
  1661. };
  1662. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1663. __argnames__ : {value: ["x"]},
  1664. __module__ : {value: "__main__"}
  1665. });
  1666. return ρσ_anonfunc;
  1667. })();
  1668. ρσ_dict_polyfill.prototype.values = (function() {
  1669. var ρσ_anonfunc = function (x) {
  1670. var ans;
  1671. ans = {'_keys': Object.keys(this._store), '_i':-1, '_s':this._store};
  1672. ans[ρσ_iterator_symbol] = (function() {
  1673. var ρσ_anonfunc = function () {
  1674. return this;
  1675. };
  1676. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1677. __module__ : {value: "__main__"}
  1678. });
  1679. return ρσ_anonfunc;
  1680. })();
  1681. ans["next"] = (function() {
  1682. var ρσ_anonfunc = function () {
  1683. this._i += 1;
  1684. if (this._i >= this._keys.length) {
  1685. return {'done': true};
  1686. }
  1687. return {'done':false, 'value':this._s[this._keys[this._i]][1]};
  1688. };
  1689. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1690. __module__ : {value: "__main__"}
  1691. });
  1692. return ρσ_anonfunc;
  1693. })();
  1694. return ans;
  1695. };
  1696. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1697. __argnames__ : {value: ["x"]},
  1698. __module__ : {value: "__main__"}
  1699. });
  1700. return ρσ_anonfunc;
  1701. })();
  1702. ρσ_dict_polyfill.prototype.keys = (function() {
  1703. var ρσ_anonfunc = function (x) {
  1704. var ans;
  1705. ans = {'_keys': Object.keys(this._store), '_i':-1, '_s':this._store};
  1706. ans[ρσ_iterator_symbol] = (function() {
  1707. var ρσ_anonfunc = function () {
  1708. return this;
  1709. };
  1710. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1711. __module__ : {value: "__main__"}
  1712. });
  1713. return ρσ_anonfunc;
  1714. })();
  1715. ans["next"] = (function() {
  1716. var ρσ_anonfunc = function () {
  1717. this._i += 1;
  1718. if (this._i >= this._keys.length) {
  1719. return {'done': true};
  1720. }
  1721. return {'done':false, 'value':this._s[this._keys[this._i]][0]};
  1722. };
  1723. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1724. __module__ : {value: "__main__"}
  1725. });
  1726. return ρσ_anonfunc;
  1727. })();
  1728. return ans;
  1729. };
  1730. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1731. __argnames__ : {value: ["x"]},
  1732. __module__ : {value: "__main__"}
  1733. });
  1734. return ρσ_anonfunc;
  1735. })();
  1736. ρσ_dict_polyfill.prototype.entries = (function() {
  1737. var ρσ_anonfunc = function (x) {
  1738. var ans;
  1739. ans = {'_keys': Object.keys(this._store), '_i':-1, '_s':this._store};
  1740. ans[ρσ_iterator_symbol] = (function() {
  1741. var ρσ_anonfunc = function () {
  1742. return this;
  1743. };
  1744. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1745. __module__ : {value: "__main__"}
  1746. });
  1747. return ρσ_anonfunc;
  1748. })();
  1749. ans["next"] = (function() {
  1750. var ρσ_anonfunc = function () {
  1751. this._i += 1;
  1752. if (this._i >= this._keys.length) {
  1753. return {'done': true};
  1754. }
  1755. return {'done':false, 'value':this._s[this._keys[this._i]]};
  1756. };
  1757. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1758. __module__ : {value: "__main__"}
  1759. });
  1760. return ρσ_anonfunc;
  1761. })();
  1762. return ans;
  1763. };
  1764. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1765. __argnames__ : {value: ["x"]},
  1766. __module__ : {value: "__main__"}
  1767. });
  1768. return ρσ_anonfunc;
  1769. })();
  1770. if (typeof Map !== "function" || typeof Map.prototype.delete !== "function") {
  1771. ρσ_dict_implementation = ρσ_dict_polyfill;
  1772. } else {
  1773. ρσ_dict_implementation = Map;
  1774. }
  1775. function ρσ_dict() {
  1776. var iterable = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
  1777. var kw = arguments[arguments.length-1];
  1778. if (kw === null || typeof kw !== "object" || kw [ρσ_kwargs_symbol] !== true) kw = {};
  1779. if (this instanceof ρσ_dict) {
  1780. this.jsmap = new ρσ_dict_implementation;
  1781. if (iterable !== undefined) {
  1782. this.update(iterable);
  1783. }
  1784. this.update(kw);
  1785. return this;
  1786. } else {
  1787. return ρσ_interpolate_kwargs_constructor.call(Object.create(ρσ_dict.prototype), false, ρσ_dict, [iterable].concat([ρσ_desugar_kwargs(kw)]));
  1788. }
  1789. };
  1790. if (!ρσ_dict.__handles_kwarg_interpolation__) Object.defineProperties(ρσ_dict, {
  1791. __handles_kwarg_interpolation__ : {value: true},
  1792. __argnames__ : {value: ["iterable"]},
  1793. __module__ : {value: "__main__"}
  1794. });
  1795. ρσ_dict.prototype.__name__ = "dict";
  1796. Object.defineProperties(ρσ_dict.prototype, (function(){
  1797. var ρσ_d = {};
  1798. ρσ_d["length"] = (function(){
  1799. var ρσ_d = {};
  1800. ρσ_d["get"] = (function() {
  1801. var ρσ_anonfunc = function () {
  1802. return this.jsmap.size;
  1803. };
  1804. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1805. __module__ : {value: "__main__"}
  1806. });
  1807. return ρσ_anonfunc;
  1808. })();
  1809. return ρσ_d;
  1810. }).call(this);
  1811. ρσ_d["size"] = (function(){
  1812. var ρσ_d = {};
  1813. ρσ_d["get"] = (function() {
  1814. var ρσ_anonfunc = function () {
  1815. return this.jsmap.size;
  1816. };
  1817. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1818. __module__ : {value: "__main__"}
  1819. });
  1820. return ρσ_anonfunc;
  1821. })();
  1822. return ρσ_d;
  1823. }).call(this);
  1824. return ρσ_d;
  1825. }).call(this));
  1826. ρσ_dict.prototype.__len__ = (function() {
  1827. var ρσ_anonfunc = function () {
  1828. return this.jsmap.size;
  1829. };
  1830. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1831. __module__ : {value: "__main__"}
  1832. });
  1833. return ρσ_anonfunc;
  1834. })();
  1835. ρσ_dict.prototype.has = ρσ_dict.prototype.__contains__ = (function() {
  1836. var ρσ_anonfunc = function (x) {
  1837. return this.jsmap.has(x);
  1838. };
  1839. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1840. __argnames__ : {value: ["x"]},
  1841. __module__ : {value: "__main__"}
  1842. });
  1843. return ρσ_anonfunc;
  1844. })();
  1845. ρσ_dict.prototype.set = ρσ_dict.prototype.__setitem__ = (function() {
  1846. var ρσ_anonfunc = function (key, value) {
  1847. this.jsmap.set(key, value);
  1848. };
  1849. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1850. __argnames__ : {value: ["key", "value"]},
  1851. __module__ : {value: "__main__"}
  1852. });
  1853. return ρσ_anonfunc;
  1854. })();
  1855. ρσ_dict.prototype.__delitem__ = (function() {
  1856. var ρσ_anonfunc = function (key) {
  1857. this.jsmap.delete(key);
  1858. };
  1859. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1860. __argnames__ : {value: ["key"]},
  1861. __module__ : {value: "__main__"}
  1862. });
  1863. return ρσ_anonfunc;
  1864. })();
  1865. ρσ_dict.prototype.clear = (function() {
  1866. var ρσ_anonfunc = function () {
  1867. this.jsmap.clear();
  1868. };
  1869. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1870. __module__ : {value: "__main__"}
  1871. });
  1872. return ρσ_anonfunc;
  1873. })();
  1874. ρσ_dict.prototype.copy = (function() {
  1875. var ρσ_anonfunc = function () {
  1876. return ρσ_dict(this);
  1877. };
  1878. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1879. __module__ : {value: "__main__"}
  1880. });
  1881. return ρσ_anonfunc;
  1882. })();
  1883. ρσ_dict.prototype.keys = (function() {
  1884. var ρσ_anonfunc = function () {
  1885. return this.jsmap.keys();
  1886. };
  1887. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1888. __module__ : {value: "__main__"}
  1889. });
  1890. return ρσ_anonfunc;
  1891. })();
  1892. ρσ_dict.prototype.values = (function() {
  1893. var ρσ_anonfunc = function () {
  1894. return this.jsmap.values();
  1895. };
  1896. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1897. __module__ : {value: "__main__"}
  1898. });
  1899. return ρσ_anonfunc;
  1900. })();
  1901. ρσ_dict.prototype.items = ρσ_dict.prototype.entries = (function() {
  1902. var ρσ_anonfunc = function () {
  1903. return this.jsmap.entries();
  1904. };
  1905. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1906. __module__ : {value: "__main__"}
  1907. });
  1908. return ρσ_anonfunc;
  1909. })();
  1910. ρσ_dict.prototype[ρσ_iterator_symbol] = (function() {
  1911. var ρσ_anonfunc = function () {
  1912. return this.jsmap.keys();
  1913. };
  1914. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  1915. __module__ : {value: "__main__"}
  1916. });
  1917. return ρσ_anonfunc;
  1918. })();
  1919. ρσ_dict.prototype.__getitem__ = (function() {
  1920. var ρσ_anonfunc = function (key) {
  1921. var ans;
  1922. ans = this.jsmap.get(key);
  1923. if (ans === undefined && !this.jsmap.has(key)) {
  1924. throw new KeyError(key + "");
  1925. }
  1926. return ans;
  1927. };
  1928. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1929. __argnames__ : {value: ["key"]},
  1930. __module__ : {value: "__main__"}
  1931. });
  1932. return ρσ_anonfunc;
  1933. })();
  1934. ρσ_dict.prototype.get = (function() {
  1935. var ρσ_anonfunc = function (key, defval) {
  1936. var ans;
  1937. ans = this.jsmap.get(key);
  1938. if (ans === undefined && !this.jsmap.has(key)) {
  1939. return (defval === undefined) ? null : defval;
  1940. }
  1941. return ans;
  1942. };
  1943. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1944. __argnames__ : {value: ["key", "defval"]},
  1945. __module__ : {value: "__main__"}
  1946. });
  1947. return ρσ_anonfunc;
  1948. })();
  1949. ρσ_dict.prototype.set_default = ρσ_dict.prototype.setdefault = (function() {
  1950. var ρσ_anonfunc = function (key, defval) {
  1951. var j;
  1952. j = this.jsmap;
  1953. if (!j.has(key)) {
  1954. j.set(key, defval);
  1955. return defval;
  1956. }
  1957. return j.get(key);
  1958. };
  1959. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1960. __argnames__ : {value: ["key", "defval"]},
  1961. __module__ : {value: "__main__"}
  1962. });
  1963. return ρσ_anonfunc;
  1964. })();
  1965. ρσ_dict.fromkeys = ρσ_dict.prototype.fromkeys = (function() {
  1966. var ρσ_anonfunc = function () {
  1967. var iterable = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
  1968. var value = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ρσ_anonfunc.__defaults__.value : arguments[1];
  1969. var ρσ_kwargs_obj = arguments[arguments.length-1];
  1970. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  1971. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "value")){
  1972. value = ρσ_kwargs_obj.value;
  1973. }
  1974. var ans, iterator, r;
  1975. ans = ρσ_dict();
  1976. iterator = iter(iterable);
  1977. r = iterator.next();
  1978. while (!r.done) {
  1979. ans.set(r.value, value);
  1980. r = iterator.next();
  1981. }
  1982. return ans;
  1983. };
  1984. if (!ρσ_anonfunc.__defaults__) Object.defineProperties(ρσ_anonfunc, {
  1985. __defaults__ : {value: {value:null}},
  1986. __handles_kwarg_interpolation__ : {value: true},
  1987. __argnames__ : {value: ["iterable", "value"]},
  1988. __module__ : {value: "__main__"}
  1989. });
  1990. return ρσ_anonfunc;
  1991. })();
  1992. ρσ_dict.prototype.pop = (function() {
  1993. var ρσ_anonfunc = function (key, defval) {
  1994. var ans;
  1995. ans = this.jsmap.get(key);
  1996. if (ans === undefined && !this.jsmap.has(key)) {
  1997. if (defval === undefined) {
  1998. throw new KeyError(key);
  1999. }
  2000. return defval;
  2001. }
  2002. this.jsmap.delete(key);
  2003. return ans;
  2004. };
  2005. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  2006. __argnames__ : {value: ["key", "defval"]},
  2007. __module__ : {value: "__main__"}
  2008. });
  2009. return ρσ_anonfunc;
  2010. })();
  2011. ρσ_dict.prototype.popitem = (function() {
  2012. var ρσ_anonfunc = function () {
  2013. var last, e, r;
  2014. last = null;
  2015. e = this.jsmap.entries();
  2016. while (true) {
  2017. r = e.next();
  2018. if (r.done) {
  2019. if (last === null) {
  2020. throw new KeyError("dict is empty");
  2021. }
  2022. this.jsmap.delete(last.value[0]);
  2023. return last.value;
  2024. }
  2025. last = r;
  2026. }
  2027. };
  2028. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  2029. __module__ : {value: "__main__"}
  2030. });
  2031. return ρσ_anonfunc;
  2032. })();
  2033. ρσ_dict.prototype.update = (function() {
  2034. var ρσ_anonfunc = function () {
  2035. var m, iterable, iterator, result, keys;
  2036. if (arguments.length === 0) {
  2037. return;
  2038. }
  2039. m = this.jsmap;
  2040. iterable = arguments[0];
  2041. if (Array.isArray(iterable)) {
  2042. for (var i = 0; i < iterable.length; i++) {
  2043. m.set(iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i][0], iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i][1]);
  2044. }
  2045. } else if (iterable instanceof ρσ_dict) {
  2046. iterator = iterable.items();
  2047. result = iterator.next();
  2048. while (!result.done) {
  2049. m.set(result.value[0], result.value[1]);
  2050. result = iterator.next();
  2051. }
  2052. } else if (typeof Map === "function" && iterable instanceof Map) {
  2053. iterator = iterable.entries();
  2054. result = iterator.next();
  2055. while (!result.done) {
  2056. m.set(result.value[0], result.value[1]);
  2057. result = iterator.next();
  2058. }
  2059. } else if (typeof iterable[ρσ_iterator_symbol] === "function") {
  2060. iterator = iterable[ρσ_iterator_symbol]();
  2061. result = iterator.next();
  2062. while (!result.done) {
  2063. m.set(result.value[0], result.value[1]);
  2064. result = iterator.next();
  2065. }
  2066. } else {
  2067. keys = Object.keys(iterable);
  2068. for (var j=0; j < keys.length; j++) {
  2069. if (keys[(typeof j === "number" && j < 0) ? keys.length + j : j] !== ρσ_iterator_symbol) {
  2070. m.set(keys[(typeof j === "number" && j < 0) ? keys.length + j : j], iterable[ρσ_bound_index(keys[(typeof j === "number" && j < 0) ? keys.length + j : j], iterable)]);
  2071. }
  2072. }
  2073. }
  2074. if (arguments.length > 1) {
  2075. ρσ_dict.prototype.update.call(this, arguments[1]);
  2076. }
  2077. };
  2078. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  2079. __module__ : {value: "__main__"}
  2080. });
  2081. return ρσ_anonfunc;
  2082. })();
  2083. ρσ_dict.prototype.toString = ρσ_dict.prototype.inspect = ρσ_dict.prototype.__str__ = ρσ_dict.prototype.__repr__ = (function() {
  2084. var ρσ_anonfunc = function () {
  2085. var entries, iterator, r;
  2086. entries = [];
  2087. iterator = this.jsmap.entries();
  2088. r = iterator.next();
  2089. while (!r.done) {
  2090. entries.push(ρσ_repr(r.value[0]) + ": " + ρσ_repr(r.value[1]));
  2091. r = iterator.next();
  2092. }
  2093. return "{" + entries.join(", ") + "}";
  2094. };
  2095. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  2096. __module__ : {value: "__main__"}
  2097. });
  2098. return ρσ_anonfunc;
  2099. })();
  2100. ρσ_dict.prototype.__eq__ = (function() {
  2101. var ρσ_anonfunc = function (other) {
  2102. var iterator, r, x;
  2103. if (!(other instanceof this.constructor)) {
  2104. return false;
  2105. }
  2106. if (other.size !== this.size) {
  2107. return false;
  2108. }
  2109. if (other.size === 0) {
  2110. return true;
  2111. }
  2112. iterator = other.items();
  2113. r = iterator.next();
  2114. while (!r.done) {
  2115. x = this.jsmap.get(r.value[0]);
  2116. if (x === undefined && !this.jsmap.has(r.value[0]) || x !== r.value[1]) {
  2117. return false;
  2118. }
  2119. r = iterator.next();
  2120. }
  2121. return true;
  2122. };
  2123. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  2124. __argnames__ : {value: ["other"]},
  2125. __module__ : {value: "__main__"}
  2126. });
  2127. return ρσ_anonfunc;
  2128. })();
  2129. ρσ_dict.prototype.as_object = (function() {
  2130. var ρσ_anonfunc = function (other) {
  2131. var ans, iterator, r;
  2132. ans = {};
  2133. iterator = this.jsmap.entries();
  2134. r = iterator.next();
  2135. while (!r.done) {
  2136. ans[ρσ_bound_index(r.value[0], ans)] = r.value[1];
  2137. r = iterator.next();
  2138. }
  2139. return ans;
  2140. };
  2141. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  2142. __argnames__ : {value: ["other"]},
  2143. __module__ : {value: "__main__"}
  2144. });
  2145. return ρσ_anonfunc;
  2146. })();
  2147. function ρσ_dict_wrap(x) {
  2148. var ans;
  2149. ans = new ρσ_dict;
  2150. ans.jsmap = x;
  2151. return ans;
  2152. };
  2153. if (!ρσ_dict_wrap.__argnames__) Object.defineProperties(ρσ_dict_wrap, {
  2154. __argnames__ : {value: ["x"]},
  2155. __module__ : {value: "__main__"}
  2156. });
  2157. var dict = ρσ_dict, dict_wrap = ρσ_dict_wrap;// }}}
  2158. var NameError;
  2159. NameError = ReferenceError;
  2160. function Exception() {
  2161. if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
  2162. Exception.prototype.__init__.apply(this, arguments);
  2163. }
  2164. ρσ_extends(Exception, Error);
  2165. Exception.prototype.__init__ = function __init__(message) {
  2166. var self = this;
  2167. self.message = message;
  2168. self.stack = (new Error).stack;
  2169. self.name = self.constructor.name;
  2170. };
  2171. if (!Exception.prototype.__init__.__argnames__) Object.defineProperties(Exception.prototype.__init__, {
  2172. __argnames__ : {value: ["message"]},
  2173. __module__ : {value: "__main__"}
  2174. });
  2175. Exception.__argnames__ = Exception.prototype.__init__.__argnames__;
  2176. Exception.__handles_kwarg_interpolation__ = Exception.prototype.__init__.__handles_kwarg_interpolation__;
  2177. Exception.prototype.__repr__ = function __repr__() {
  2178. var self = this;
  2179. return self.name + ": " + self.message;
  2180. };
  2181. if (!Exception.prototype.__repr__.__module__) Object.defineProperties(Exception.prototype.__repr__, {
  2182. __module__ : {value: "__main__"}
  2183. });
  2184. Exception.prototype.__str__ = function __str__ () {
  2185. if(Error.prototype.__str__) return Error.prototype.__str__.call(this);
  2186. return this.__repr__();
  2187. };
  2188. Object.defineProperty(Exception.prototype, "__bases__", {value: [Error]});
  2189. function AttributeError() {
  2190. if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
  2191. AttributeError.prototype.__init__.apply(this, arguments);
  2192. }
  2193. ρσ_extends(AttributeError, Exception);
  2194. AttributeError.prototype.__init__ = function __init__ () {
  2195. Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
  2196. };
  2197. AttributeError.prototype.__repr__ = function __repr__ () {
  2198. if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
  2199. return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
  2200. };
  2201. AttributeError.prototype.__str__ = function __str__ () {
  2202. if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
  2203. return this.__repr__();
  2204. };
  2205. Object.defineProperty(AttributeError.prototype, "__bases__", {value: [Exception]});
  2206. function IndexError() {
  2207. if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
  2208. IndexError.prototype.__init__.apply(this, arguments);
  2209. }
  2210. ρσ_extends(IndexError, Exception);
  2211. IndexError.prototype.__init__ = function __init__ () {
  2212. Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
  2213. };
  2214. IndexError.prototype.__repr__ = function __repr__ () {
  2215. if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
  2216. return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
  2217. };
  2218. IndexError.prototype.__str__ = function __str__ () {
  2219. if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
  2220. return this.__repr__();
  2221. };
  2222. Object.defineProperty(IndexError.prototype, "__bases__", {value: [Exception]});
  2223. function KeyError() {
  2224. if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
  2225. KeyError.prototype.__init__.apply(this, arguments);
  2226. }
  2227. ρσ_extends(KeyError, Exception);
  2228. KeyError.prototype.__init__ = function __init__ () {
  2229. Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
  2230. };
  2231. KeyError.prototype.__repr__ = function __repr__ () {
  2232. if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
  2233. return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
  2234. };
  2235. KeyError.prototype.__str__ = function __str__ () {
  2236. if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
  2237. return this.__repr__();
  2238. };
  2239. Object.defineProperty(KeyError.prototype, "__bases__", {value: [Exception]});
  2240. function ValueError() {
  2241. if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
  2242. ValueError.prototype.__init__.apply(this, arguments);
  2243. }
  2244. ρσ_extends(ValueError, Exception);
  2245. ValueError.prototype.__init__ = function __init__ () {
  2246. Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
  2247. };
  2248. ValueError.prototype.__repr__ = function __repr__ () {
  2249. if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
  2250. return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
  2251. };
  2252. ValueError.prototype.__str__ = function __str__ () {
  2253. if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
  2254. return this.__repr__();
  2255. };
  2256. Object.defineProperty(ValueError.prototype, "__bases__", {value: [Exception]});
  2257. function UnicodeDecodeError() {
  2258. if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
  2259. UnicodeDecodeError.prototype.__init__.apply(this, arguments);
  2260. }
  2261. ρσ_extends(UnicodeDecodeError, Exception);
  2262. UnicodeDecodeError.prototype.__init__ = function __init__ () {
  2263. Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
  2264. };
  2265. UnicodeDecodeError.prototype.__repr__ = function __repr__ () {
  2266. if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
  2267. return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
  2268. };
  2269. UnicodeDecodeError.prototype.__str__ = function __str__ () {
  2270. if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
  2271. return this.__repr__();
  2272. };
  2273. Object.defineProperty(UnicodeDecodeError.prototype, "__bases__", {value: [Exception]});
  2274. function AssertionError() {
  2275. if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
  2276. AssertionError.prototype.__init__.apply(this, arguments);
  2277. }
  2278. ρσ_extends(AssertionError, Exception);
  2279. AssertionError.prototype.__init__ = function __init__ () {
  2280. Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
  2281. };
  2282. AssertionError.prototype.__repr__ = function __repr__ () {
  2283. if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
  2284. return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
  2285. };
  2286. AssertionError.prototype.__str__ = function __str__ () {
  2287. if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
  2288. return this.__repr__();
  2289. };
  2290. Object.defineProperty(AssertionError.prototype, "__bases__", {value: [Exception]});
  2291. function ZeroDivisionError() {
  2292. if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
  2293. ZeroDivisionError.prototype.__init__.apply(this, arguments);
  2294. }
  2295. ρσ_extends(ZeroDivisionError, Exception);
  2296. ZeroDivisionError.prototype.__init__ = function __init__ () {
  2297. Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
  2298. };
  2299. ZeroDivisionError.prototype.__repr__ = function __repr__ () {
  2300. if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
  2301. return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
  2302. };
  2303. ZeroDivisionError.prototype.__str__ = function __str__ () {
  2304. if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
  2305. return this.__repr__();
  2306. };
  2307. Object.defineProperty(ZeroDivisionError.prototype, "__bases__", {value: [Exception]});
  2308. var ρσ_in, ρσ_desugar_kwargs, ρσ_exists;
  2309. function ρσ_eslice(arr, step, start, end) {
  2310. var is_string;
  2311. if (typeof arr === "string" || arr instanceof String) {
  2312. is_string = true;
  2313. arr = arr.split("");
  2314. }
  2315. if (step < 0) {
  2316. step = -step;
  2317. arr = arr.slice().reverse();
  2318. if (typeof start !== "undefined") {
  2319. start = arr.length - start - 1;
  2320. }
  2321. if (typeof end !== "undefined") {
  2322. end = arr.length - end - 1;
  2323. }
  2324. }
  2325. if (typeof start === "undefined") {
  2326. start = 0;
  2327. }
  2328. if (typeof end === "undefined") {
  2329. end = arr.length;
  2330. }
  2331. arr = arr.slice(start, end).filter((function() {
  2332. var ρσ_anonfunc = function (e, i) {
  2333. return i % step === 0;
  2334. };
  2335. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  2336. __argnames__ : {value: ["e", "i"]},
  2337. __module__ : {value: "__main__"}
  2338. });
  2339. return ρσ_anonfunc;
  2340. })());
  2341. if (is_string) {
  2342. arr = arr.join("");
  2343. }
  2344. return arr;
  2345. };
  2346. if (!ρσ_eslice.__argnames__) Object.defineProperties(ρσ_eslice, {
  2347. __argnames__ : {value: ["arr", "step", "start", "end"]},
  2348. __module__ : {value: "__main__"}
  2349. });
  2350. function ρσ_delslice(arr, step, start, end) {
  2351. var is_string, ρσ_unpack, indices;
  2352. if (typeof arr === "string" || arr instanceof String) {
  2353. is_string = true;
  2354. arr = arr.split("");
  2355. }
  2356. if (step < 0) {
  2357. if (typeof start === "undefined") {
  2358. start = arr.length;
  2359. }
  2360. if (typeof end === "undefined") {
  2361. end = 0;
  2362. }
  2363. ρσ_unpack = [end, start, -step];
  2364. start = ρσ_unpack[0];
  2365. end = ρσ_unpack[1];
  2366. step = ρσ_unpack[2];
  2367. }
  2368. if (typeof start === "undefined") {
  2369. start = 0;
  2370. }
  2371. if (typeof end === "undefined") {
  2372. end = arr.length;
  2373. }
  2374. if (step === 1) {
  2375. arr.splice(start, end - start);
  2376. } else {
  2377. if (end > start) {
  2378. indices = [];
  2379. for (var i = start; i < end; i += step) {
  2380. indices.push(i);
  2381. }
  2382. for (var i = indices.length - 1; i >= 0; i--) {
  2383. arr.splice(indices[(typeof i === "number" && i < 0) ? indices.length + i : i], 1);
  2384. }
  2385. }
  2386. }
  2387. if (is_string) {
  2388. arr = arr.join("");
  2389. }
  2390. return arr;
  2391. };
  2392. if (!ρσ_delslice.__argnames__) Object.defineProperties(ρσ_delslice, {
  2393. __argnames__ : {value: ["arr", "step", "start", "end"]},
  2394. __module__ : {value: "__main__"}
  2395. });
  2396. function ρσ_flatten(arr) {
  2397. var ans, value;
  2398. ans = ρσ_list_decorate([]);
  2399. for (var i=0; i < arr.length; i++) {
  2400. value = arr[(typeof i === "number" && i < 0) ? arr.length + i : i];
  2401. if (Array.isArray(value)) {
  2402. ans = ans.concat(ρσ_flatten(value));
  2403. } else {
  2404. ans.push(value);
  2405. }
  2406. }
  2407. return ans;
  2408. };
  2409. if (!ρσ_flatten.__argnames__) Object.defineProperties(ρσ_flatten, {
  2410. __argnames__ : {value: ["arr"]},
  2411. __module__ : {value: "__main__"}
  2412. });
  2413. function ρσ_unpack_asarray(num, iterable) {
  2414. var ans, iterator, result;
  2415. if (ρσ_arraylike(iterable)) {
  2416. return iterable;
  2417. }
  2418. ans = [];
  2419. if (typeof iterable[ρσ_iterator_symbol] === "function") {
  2420. iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
  2421. result = iterator.next();
  2422. while (!result.done && ans.length < num) {
  2423. ans.push(result.value);
  2424. result = iterator.next();
  2425. }
  2426. }
  2427. return ans;
  2428. };
  2429. if (!ρσ_unpack_asarray.__argnames__) Object.defineProperties(ρσ_unpack_asarray, {
  2430. __argnames__ : {value: ["num", "iterable"]},
  2431. __module__ : {value: "__main__"}
  2432. });
  2433. function ρσ_extends(child, parent) {
  2434. child.prototype = Object.create(parent.prototype);
  2435. child.prototype.constructor = child;
  2436. };
  2437. if (!ρσ_extends.__argnames__) Object.defineProperties(ρσ_extends, {
  2438. __argnames__ : {value: ["child", "parent"]},
  2439. __module__ : {value: "__main__"}
  2440. });
  2441. ρσ_in = (function() {
  2442. var ρσ_anonfunc = function () {
  2443. if (typeof Map === "function" && typeof Set === "function") {
  2444. return (function() {
  2445. var ρσ_anonfunc = function (val, arr) {
  2446. if (typeof arr === "string") {
  2447. return arr.indexOf(val) !== -1;
  2448. }
  2449. if (typeof arr.__contains__ === "function") {
  2450. return arr.__contains__(val);
  2451. }
  2452. if (arr instanceof Map || arr instanceof Set) {
  2453. return arr.has(val);
  2454. }
  2455. if (ρσ_arraylike(arr)) {
  2456. return ρσ_list_contains.call(arr, val);
  2457. }
  2458. return Object.prototype.hasOwnProperty.call(arr, val);
  2459. };
  2460. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  2461. __argnames__ : {value: ["val", "arr"]},
  2462. __module__ : {value: "__main__"}
  2463. });
  2464. return ρσ_anonfunc;
  2465. })();
  2466. }
  2467. return (function() {
  2468. var ρσ_anonfunc = function (val, arr) {
  2469. if (typeof arr === "string") {
  2470. return arr.indexOf(val) !== -1;
  2471. }
  2472. if (typeof arr.__contains__ === "function") {
  2473. return arr.__contains__(val);
  2474. }
  2475. if (ρσ_arraylike(arr)) {
  2476. return ρσ_list_contains.call(arr, val);
  2477. }
  2478. return Object.prototype.hasOwnProperty.call(arr, val);
  2479. };
  2480. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  2481. __argnames__ : {value: ["val", "arr"]},
  2482. __module__ : {value: "__main__"}
  2483. });
  2484. return ρσ_anonfunc;
  2485. })();
  2486. };
  2487. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  2488. __module__ : {value: "__main__"}
  2489. });
  2490. return ρσ_anonfunc;
  2491. })()();
  2492. function ρσ_Iterable(iterable) {
  2493. var iterator, ans, result;
  2494. if (ρσ_arraylike(iterable)) {
  2495. return iterable;
  2496. }
  2497. if (typeof iterable[ρσ_iterator_symbol] === "function") {
  2498. iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
  2499. ans = ρσ_list_decorate([]);
  2500. result = iterator.next();
  2501. while (!result.done) {
  2502. ans.push(result.value);
  2503. result = iterator.next();
  2504. }
  2505. return ans;
  2506. }
  2507. return Object.keys(iterable);
  2508. };
  2509. if (!ρσ_Iterable.__argnames__) Object.defineProperties(ρσ_Iterable, {
  2510. __argnames__ : {value: ["iterable"]},
  2511. __module__ : {value: "__main__"}
  2512. });
  2513. ρσ_desugar_kwargs = (function() {
  2514. var ρσ_anonfunc = function () {
  2515. if (typeof Object.assign === "function") {
  2516. return (function() {
  2517. var ρσ_anonfunc = function () {
  2518. var ans;
  2519. ans = Object.create(null);
  2520. ans[ρσ_kwargs_symbol] = true;
  2521. for (var i = 0; i < arguments.length; i++) {
  2522. Object.assign(ans, arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i]);
  2523. }
  2524. return ans;
  2525. };
  2526. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  2527. __module__ : {value: "__main__"}
  2528. });
  2529. return ρσ_anonfunc;
  2530. })();
  2531. }
  2532. return (function() {
  2533. var ρσ_anonfunc = function () {
  2534. var ans, keys;
  2535. ans = Object.create(null);
  2536. ans[ρσ_kwargs_symbol] = true;
  2537. for (var i = 0; i < arguments.length; i++) {
  2538. keys = Object.keys(arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i]);
  2539. for (var j = 0; j < keys.length; j++) {
  2540. ans[ρσ_bound_index(keys[(typeof j === "number" && j < 0) ? keys.length + j : j], ans)] = (ρσ_expr_temp = arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i])[ρσ_bound_index(keys[(typeof j === "number" && j < 0) ? keys.length + j : j], ρσ_expr_temp)];
  2541. }
  2542. }
  2543. return ans;
  2544. };
  2545. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  2546. __module__ : {value: "__main__"}
  2547. });
  2548. return ρσ_anonfunc;
  2549. })();
  2550. };
  2551. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  2552. __module__ : {value: "__main__"}
  2553. });
  2554. return ρσ_anonfunc;
  2555. })()();
  2556. function ρσ_interpolate_kwargs(f, supplied_args) {
  2557. var has_prop, kwobj, args, prop;
  2558. if (!f.__argnames__) {
  2559. return f.apply(this, supplied_args);
  2560. }
  2561. has_prop = Object.prototype.hasOwnProperty;
  2562. kwobj = supplied_args.pop();
  2563. if (f.__handles_kwarg_interpolation__) {
  2564. args = new Array(Math.max(supplied_args.length, f.__argnames__.length) + 1);
  2565. args[args.length-1] = kwobj;
  2566. for (var i = 0; i < args.length - 1; i++) {
  2567. if (i < f.__argnames__.length) {
  2568. prop = (ρσ_expr_temp = f.__argnames__)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
  2569. if (has_prop.call(kwobj, prop)) {
  2570. args[(typeof i === "number" && i < 0) ? args.length + i : i] = kwobj[(typeof prop === "number" && prop < 0) ? kwobj.length + prop : prop];
  2571. delete kwobj[prop];
  2572. } else if (i < supplied_args.length) {
  2573. args[(typeof i === "number" && i < 0) ? args.length + i : i] = supplied_args[(typeof i === "number" && i < 0) ? supplied_args.length + i : i];
  2574. }
  2575. } else {
  2576. args[(typeof i === "number" && i < 0) ? args.length + i : i] = supplied_args[(typeof i === "number" && i < 0) ? supplied_args.length + i : i];
  2577. }
  2578. }
  2579. return f.apply(this, args);
  2580. }
  2581. for (var i = 0; i < f.__argnames__.length; i++) {
  2582. prop = (ρσ_expr_temp = f.__argnames__)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
  2583. if (has_prop.call(kwobj, prop)) {
  2584. supplied_args[(typeof i === "number" && i < 0) ? supplied_args.length + i : i] = kwobj[(typeof prop === "number" && prop < 0) ? kwobj.length + prop : prop];
  2585. }
  2586. }
  2587. return f.apply(this, supplied_args);
  2588. };
  2589. if (!ρσ_interpolate_kwargs.__argnames__) Object.defineProperties(ρσ_interpolate_kwargs, {
  2590. __argnames__ : {value: ["f", "supplied_args"]},
  2591. __module__ : {value: "__main__"}
  2592. });
  2593. function ρσ_interpolate_kwargs_constructor(apply, f, supplied_args) {
  2594. if (apply) {
  2595. f.apply(this, supplied_args);
  2596. } else {
  2597. ρσ_interpolate_kwargs.call(this, f, supplied_args);
  2598. }
  2599. return this;
  2600. };
  2601. if (!ρσ_interpolate_kwargs_constructor.__argnames__) Object.defineProperties(ρσ_interpolate_kwargs_constructor, {
  2602. __argnames__ : {value: ["apply", "f", "supplied_args"]},
  2603. __module__ : {value: "__main__"}
  2604. });
  2605. function ρσ_getitem(obj, key) {
  2606. if (obj.__getitem__) {
  2607. return obj.__getitem__(key);
  2608. }
  2609. if (typeof key === "number" && key < 0) {
  2610. key += obj.length;
  2611. }
  2612. return obj[(typeof key === "number" && key < 0) ? obj.length + key : key];
  2613. };
  2614. if (!ρσ_getitem.__argnames__) Object.defineProperties(ρσ_getitem, {
  2615. __argnames__ : {value: ["obj", "key"]},
  2616. __module__ : {value: "__main__"}
  2617. });
  2618. function ρσ_setitem(obj, key, val) {
  2619. if (obj.__setitem__) {
  2620. obj.__setitem__(key, val);
  2621. } else {
  2622. if (typeof key === "number" && key < 0) {
  2623. key += obj.length;
  2624. }
  2625. obj[(typeof key === "number" && key < 0) ? obj.length + key : key] = val;
  2626. }
  2627. return val;
  2628. };
  2629. if (!ρσ_setitem.__argnames__) Object.defineProperties(ρσ_setitem, {
  2630. __argnames__ : {value: ["obj", "key", "val"]},
  2631. __module__ : {value: "__main__"}
  2632. });
  2633. function ρσ_delitem(obj, key) {
  2634. if (obj.__delitem__) {
  2635. obj.__delitem__(key);
  2636. } else if (typeof obj.splice === "function") {
  2637. obj.splice(key, 1);
  2638. } else {
  2639. if (typeof key === "number" && key < 0) {
  2640. key += obj.length;
  2641. }
  2642. delete obj[key];
  2643. }
  2644. };
  2645. if (!ρσ_delitem.__argnames__) Object.defineProperties(ρσ_delitem, {
  2646. __argnames__ : {value: ["obj", "key"]},
  2647. __module__ : {value: "__main__"}
  2648. });
  2649. function ρσ_bound_index(idx, arr) {
  2650. if (typeof idx === "number" && idx < 0) {
  2651. idx += arr.length;
  2652. }
  2653. return idx;
  2654. };
  2655. if (!ρσ_bound_index.__argnames__) Object.defineProperties(ρσ_bound_index, {
  2656. __argnames__ : {value: ["idx", "arr"]},
  2657. __module__ : {value: "__main__"}
  2658. });
  2659. function ρσ_splice(arr, val, start, end) {
  2660. start = start || 0;
  2661. if (start < 0) {
  2662. start += arr.length;
  2663. }
  2664. if (end === undefined) {
  2665. end = arr.length;
  2666. }
  2667. if (end < 0) {
  2668. end += arr.length;
  2669. }
  2670. Array.prototype.splice.apply(arr, [start, end - start].concat(val));
  2671. };
  2672. if (!ρσ_splice.__argnames__) Object.defineProperties(ρσ_splice, {
  2673. __argnames__ : {value: ["arr", "val", "start", "end"]},
  2674. __module__ : {value: "__main__"}
  2675. });
  2676. ρσ_exists = (function(){
  2677. var ρσ_d = {};
  2678. ρσ_d["n"] = (function() {
  2679. var ρσ_anonfunc = function (expr) {
  2680. return expr !== undefined && expr !== null;
  2681. };
  2682. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  2683. __argnames__ : {value: ["expr"]},
  2684. __module__ : {value: "__main__"}
  2685. });
  2686. return ρσ_anonfunc;
  2687. })();
  2688. ρσ_d["d"] = (function() {
  2689. var ρσ_anonfunc = function (expr) {
  2690. if (expr === undefined || expr === null) {
  2691. return Object.create(null);
  2692. }
  2693. return expr;
  2694. };
  2695. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  2696. __argnames__ : {value: ["expr"]},
  2697. __module__ : {value: "__main__"}
  2698. });
  2699. return ρσ_anonfunc;
  2700. })();
  2701. ρσ_d["c"] = (function() {
  2702. var ρσ_anonfunc = function (expr) {
  2703. if (typeof expr === "function") {
  2704. return expr;
  2705. }
  2706. return (function() {
  2707. var ρσ_anonfunc = function () {
  2708. return undefined;
  2709. };
  2710. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  2711. __module__ : {value: "__main__"}
  2712. });
  2713. return ρσ_anonfunc;
  2714. })();
  2715. };
  2716. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  2717. __argnames__ : {value: ["expr"]},
  2718. __module__ : {value: "__main__"}
  2719. });
  2720. return ρσ_anonfunc;
  2721. })();
  2722. ρσ_d["g"] = (function() {
  2723. var ρσ_anonfunc = function (expr) {
  2724. if (expr === undefined || expr === null || typeof expr.__getitem__ !== "function") {
  2725. return (function(){
  2726. var ρσ_d = {};
  2727. ρσ_d["__getitem__"] = (function() {
  2728. var ρσ_anonfunc = function () {
  2729. return undefined;
  2730. };
  2731. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  2732. __module__ : {value: "__main__"}
  2733. });
  2734. return ρσ_anonfunc;
  2735. })();
  2736. return ρσ_d;
  2737. }).call(this);
  2738. }
  2739. };
  2740. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  2741. __argnames__ : {value: ["expr"]},
  2742. __module__ : {value: "__main__"}
  2743. });
  2744. return ρσ_anonfunc;
  2745. })();
  2746. ρσ_d["e"] = (function() {
  2747. var ρσ_anonfunc = function (expr, alt) {
  2748. return (expr === undefined || expr === null) ? alt : expr;
  2749. };
  2750. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  2751. __argnames__ : {value: ["expr", "alt"]},
  2752. __module__ : {value: "__main__"}
  2753. });
  2754. return ρσ_anonfunc;
  2755. })();
  2756. return ρσ_d;
  2757. }).call(this);
  2758. function ρσ_mixin() {
  2759. var seen, resolved_props, p, target, props, name;
  2760. seen = Object.create(null);
  2761. seen.__argnames__ = seen.__handles_kwarg_interpolation__ = seen.__init__ = seen.__annotations__ = seen.__doc__ = seen.__bind_methods__ = seen.__bases__ = seen.constructor = seen.__class__ = true;
  2762. resolved_props = {};
  2763. p = target = arguments[0].prototype;
  2764. while (p && p !== Object.prototype) {
  2765. props = Object.getOwnPropertyNames(p);
  2766. for (var i = 0; i < props.length; i++) {
  2767. seen[ρσ_bound_index(props[(typeof i === "number" && i < 0) ? props.length + i : i], seen)] = true;
  2768. }
  2769. p = Object.getPrototypeOf(p);
  2770. }
  2771. for (var c = 1; c < arguments.length; c++) {
  2772. p = arguments[(typeof c === "number" && c < 0) ? arguments.length + c : c].prototype;
  2773. while (p && p !== Object.prototype) {
  2774. props = Object.getOwnPropertyNames(p);
  2775. for (var i = 0; i < props.length; i++) {
  2776. name = props[(typeof i === "number" && i < 0) ? props.length + i : i];
  2777. if (seen[(typeof name === "number" && name < 0) ? seen.length + name : name]) {
  2778. continue;
  2779. }
  2780. seen[(typeof name === "number" && name < 0) ? seen.length + name : name] = true;
  2781. resolved_props[(typeof name === "number" && name < 0) ? resolved_props.length + name : name] = Object.getOwnPropertyDescriptor(p, name);
  2782. }
  2783. p = Object.getPrototypeOf(p);
  2784. }
  2785. }
  2786. Object.defineProperties(target, resolved_props);
  2787. };
  2788. if (!ρσ_mixin.__module__) Object.defineProperties(ρσ_mixin, {
  2789. __module__ : {value: "__main__"}
  2790. });
  2791. function ρσ_instanceof() {
  2792. var obj, bases, q, cls, p;
  2793. obj = arguments[0];
  2794. bases = "";
  2795. if (obj && obj.constructor && obj.constructor.prototype) {
  2796. bases = obj.constructor.prototype.__bases__ || "";
  2797. }
  2798. for (var i = 1; i < arguments.length; i++) {
  2799. q = arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i];
  2800. if (obj instanceof q) {
  2801. return true;
  2802. }
  2803. if ((q === Array || q === ρσ_list_constructor) && Array.isArray(obj)) {
  2804. return true;
  2805. }
  2806. if (q === ρσ_str && (typeof obj === "string" || obj instanceof String)) {
  2807. return true;
  2808. }
  2809. if (q === ρσ_int && typeof obj === "number" && Number.isInteger(obj)) {
  2810. return true;
  2811. }
  2812. if (q === ρσ_float && typeof obj === "number" && !Number.isInteger(obj)) {
  2813. return true;
  2814. }
  2815. if (bases.length > 1) {
  2816. for (var c = 1; c < bases.length; c++) {
  2817. cls = bases[(typeof c === "number" && c < 0) ? bases.length + c : c];
  2818. while (cls) {
  2819. if (q === cls) {
  2820. return true;
  2821. }
  2822. p = Object.getPrototypeOf(cls.prototype);
  2823. if (!p) {
  2824. break;
  2825. }
  2826. cls = p.constructor;
  2827. }
  2828. }
  2829. }
  2830. }
  2831. return false;
  2832. };
  2833. if (!ρσ_instanceof.__module__) Object.defineProperties(ρσ_instanceof, {
  2834. __module__ : {value: "__main__"}
  2835. });
  2836. function sum(iterable, start) {
  2837. var ans, iterator, r;
  2838. if (Array.isArray(iterable)) {
  2839. return iterable.reduce((function() {
  2840. var ρσ_anonfunc = function (prev, cur) {
  2841. return prev + cur;
  2842. };
  2843. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  2844. __argnames__ : {value: ["prev", "cur"]},
  2845. __module__ : {value: "__main__"}
  2846. });
  2847. return ρσ_anonfunc;
  2848. })(), start || 0);
  2849. }
  2850. ans = start || 0;
  2851. iterator = iter(iterable);
  2852. r = iterator.next();
  2853. while (!r.done) {
  2854. ans += r.value;
  2855. r = iterator.next();
  2856. }
  2857. return ans;
  2858. };
  2859. if (!sum.__argnames__) Object.defineProperties(sum, {
  2860. __argnames__ : {value: ["iterable", "start"]},
  2861. __module__ : {value: "__main__"}
  2862. });
  2863. function map() {
  2864. var iterators, func, args, ans;
  2865. iterators = new Array(arguments.length - 1);
  2866. func = arguments[0];
  2867. args = new Array(arguments.length - 1);
  2868. for (var i = 1; i < arguments.length; i++) {
  2869. iterators[ρσ_bound_index(i - 1, iterators)] = iter(arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i]);
  2870. }
  2871. ans = {'_func':func, '_iterators':iterators, '_args':args};
  2872. ans[ρσ_iterator_symbol] = (function() {
  2873. var ρσ_anonfunc = function () {
  2874. return this;
  2875. };
  2876. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  2877. __module__ : {value: "__main__"}
  2878. });
  2879. return ρσ_anonfunc;
  2880. })();
  2881. ans["next"] = (function() {
  2882. var ρσ_anonfunc = function () {
  2883. var r;
  2884. for (var i = 0; i < this._iterators.length; i++) {
  2885. r = (ρσ_expr_temp = this._iterators)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i].next();
  2886. if (r.done) {
  2887. return {'done':true};
  2888. }
  2889. (ρσ_expr_temp = this._args)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] = r.value;
  2890. }
  2891. return {'done':false, 'value':this._func.apply(undefined, this._args)};
  2892. };
  2893. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  2894. __module__ : {value: "__main__"}
  2895. });
  2896. return ρσ_anonfunc;
  2897. })();
  2898. return ans;
  2899. };
  2900. if (!map.__module__) Object.defineProperties(map, {
  2901. __module__ : {value: "__main__"}
  2902. });
  2903. function filter(func_or_none, iterable) {
  2904. var func, ans;
  2905. func = (func_or_none === null) ? ρσ_bool : func_or_none;
  2906. ans = {'_func':func, '_iterator':ρσ_iter(iterable)};
  2907. ans[ρσ_iterator_symbol] = (function() {
  2908. var ρσ_anonfunc = function () {
  2909. return this;
  2910. };
  2911. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  2912. __module__ : {value: "__main__"}
  2913. });
  2914. return ρσ_anonfunc;
  2915. })();
  2916. ans["next"] = (function() {
  2917. var ρσ_anonfunc = function () {
  2918. var r;
  2919. r = this._iterator.next();
  2920. while (!r.done) {
  2921. if (this._func(r.value)) {
  2922. return r;
  2923. }
  2924. r = this._iterator.next();
  2925. }
  2926. return {'done':true};
  2927. };
  2928. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  2929. __module__ : {value: "__main__"}
  2930. });
  2931. return ρσ_anonfunc;
  2932. })();
  2933. return ans;
  2934. };
  2935. if (!filter.__argnames__) Object.defineProperties(filter, {
  2936. __argnames__ : {value: ["func_or_none", "iterable"]},
  2937. __module__ : {value: "__main__"}
  2938. });
  2939. function zip() {
  2940. var iterators, ans;
  2941. iterators = new Array(arguments.length);
  2942. for (var i = 0; i < arguments.length; i++) {
  2943. iterators[(typeof i === "number" && i < 0) ? iterators.length + i : i] = iter(arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i]);
  2944. }
  2945. ans = {'_iterators':iterators};
  2946. ans[ρσ_iterator_symbol] = (function() {
  2947. var ρσ_anonfunc = function () {
  2948. return this;
  2949. };
  2950. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  2951. __module__ : {value: "__main__"}
  2952. });
  2953. return ρσ_anonfunc;
  2954. })();
  2955. ans["next"] = (function() {
  2956. var ρσ_anonfunc = function () {
  2957. var args, r;
  2958. args = new Array(this._iterators.length);
  2959. for (var i = 0; i < this._iterators.length; i++) {
  2960. r = (ρσ_expr_temp = this._iterators)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i].next();
  2961. if (r.done) {
  2962. return {'done':true};
  2963. }
  2964. args[(typeof i === "number" && i < 0) ? args.length + i : i] = r.value;
  2965. }
  2966. return {'done':false, 'value':args};
  2967. };
  2968. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  2969. __module__ : {value: "__main__"}
  2970. });
  2971. return ρσ_anonfunc;
  2972. })();
  2973. return ans;
  2974. };
  2975. if (!zip.__module__) Object.defineProperties(zip, {
  2976. __module__ : {value: "__main__"}
  2977. });
  2978. function any(iterable) {
  2979. var i;
  2980. var ρσ_Iter0 = ρσ_Iterable(iterable);
  2981. for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) {
  2982. i = ρσ_Iter0[ρσ_Index0];
  2983. if (i) {
  2984. return true;
  2985. }
  2986. }
  2987. return false;
  2988. };
  2989. if (!any.__argnames__) Object.defineProperties(any, {
  2990. __argnames__ : {value: ["iterable"]},
  2991. __module__ : {value: "__main__"}
  2992. });
  2993. function all(iterable) {
  2994. var i;
  2995. var ρσ_Iter1 = ρσ_Iterable(iterable);
  2996. for (var ρσ_Index1 = 0; ρσ_Index1 < ρσ_Iter1.length; ρσ_Index1++) {
  2997. i = ρσ_Iter1[ρσ_Index1];
  2998. if (!i) {
  2999. return false;
  3000. }
  3001. }
  3002. return true;
  3003. };
  3004. if (!all.__argnames__) Object.defineProperties(all, {
  3005. __argnames__ : {value: ["iterable"]},
  3006. __module__ : {value: "__main__"}
  3007. });
  3008. var decimal_sep, define_str_func, ρσ_unpack, ρσ_orig_split, ρσ_orig_replace;
  3009. decimal_sep = 1.1.toLocaleString()[1];
  3010. function ρσ_repr_js_builtin(x, as_array) {
  3011. var ans, b, keys, key;
  3012. ans = [];
  3013. b = "{}";
  3014. if (as_array) {
  3015. b = "[]";
  3016. for (var i = 0; i < x.length; i++) {
  3017. ans.push(ρσ_repr(x[(typeof i === "number" && i < 0) ? x.length + i : i]));
  3018. }
  3019. } else {
  3020. keys = Object.keys(x);
  3021. for (var k = 0; k < keys.length; k++) {
  3022. key = keys[(typeof k === "number" && k < 0) ? keys.length + k : k];
  3023. ans.push(JSON.stringify(key) + ":" + ρσ_repr(x[(typeof key === "number" && key < 0) ? x.length + key : key]));
  3024. }
  3025. }
  3026. return b[0] + ans.join(", ") + b[1];
  3027. };
  3028. if (!ρσ_repr_js_builtin.__argnames__) Object.defineProperties(ρσ_repr_js_builtin, {
  3029. __argnames__ : {value: ["x", "as_array"]},
  3030. __module__ : {value: "__main__"}
  3031. });
  3032. function ρσ_html_element_to_string(elem) {
  3033. var attrs, val, attr, ans;
  3034. attrs = [];
  3035. var ρσ_Iter0 = ρσ_Iterable(elem.attributes);
  3036. for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) {
  3037. attr = ρσ_Iter0[ρσ_Index0];
  3038. if (attr.specified) {
  3039. val = attr.value;
  3040. if (val.length > 10) {
  3041. val = val.slice(0, 15) + "...";
  3042. }
  3043. val = JSON.stringify(val);
  3044. attrs.push("" + ρσ_str.format("{}", attr.name) + "=" + ρσ_str.format("{}", val) + "");
  3045. }
  3046. }
  3047. attrs = (attrs.length) ? " " + attrs.join(" ") : "";
  3048. ans = "<" + ρσ_str.format("{}", elem.tagName) + "" + ρσ_str.format("{}", attrs) + ">";
  3049. return ans;
  3050. };
  3051. if (!ρσ_html_element_to_string.__argnames__) Object.defineProperties(ρσ_html_element_to_string, {
  3052. __argnames__ : {value: ["elem"]},
  3053. __module__ : {value: "__main__"}
  3054. });
  3055. function ρσ_repr(x) {
  3056. var ans, name;
  3057. if (x === null) {
  3058. return "None";
  3059. }
  3060. if (x === undefined) {
  3061. return "undefined";
  3062. }
  3063. ans = x;
  3064. if (typeof x.__repr__ === "function") {
  3065. ans = x.__repr__();
  3066. } else if (x === true || x === false) {
  3067. ans = (x) ? "True" : "False";
  3068. } else if (Array.isArray(x)) {
  3069. ans = ρσ_repr_js_builtin(x, true);
  3070. } else if (typeof x === "function") {
  3071. ans = x.toString();
  3072. } else if (typeof x === "object" && !x.toString) {
  3073. ans = ρσ_repr_js_builtin(x);
  3074. } else {
  3075. name = Object.prototype.toString.call(x).slice(8, -1);
  3076. if (ρσ_not_equals("Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".indexOf(name), -1)) {
  3077. return name + "([" + x.map((function() {
  3078. var ρσ_anonfunc = function (i) {
  3079. return str.format("0x{:02x}", i);
  3080. };
  3081. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3082. __argnames__ : {value: ["i"]},
  3083. __module__ : {value: "__main__"}
  3084. });
  3085. return ρσ_anonfunc;
  3086. })()).join(", ") + "])";
  3087. }
  3088. if (typeof HTMLElement !== "undefined" && x instanceof HTMLElement) {
  3089. ans = ρσ_html_element_to_string(x);
  3090. } else {
  3091. ans = (typeof x.toString === "function") ? x.toString() : x;
  3092. }
  3093. if (ans === "[object Object]") {
  3094. return ρσ_repr_js_builtin(x);
  3095. }
  3096. try {
  3097. ans = JSON.stringify(x);
  3098. } catch (ρσ_Exception) {
  3099. ρσ_last_exception = ρσ_Exception;
  3100. {
  3101. }
  3102. }
  3103. }
  3104. return ans + "";
  3105. };
  3106. if (!ρσ_repr.__argnames__) Object.defineProperties(ρσ_repr, {
  3107. __argnames__ : {value: ["x"]},
  3108. __module__ : {value: "__main__"}
  3109. });
  3110. function ρσ_str(x) {
  3111. var ans, name;
  3112. if (x === null) {
  3113. return "None";
  3114. }
  3115. if (x === undefined) {
  3116. return "undefined";
  3117. }
  3118. ans = x;
  3119. if (typeof x.__str__ === "function") {
  3120. ans = x.__str__();
  3121. } else if (typeof x.__repr__ === "function") {
  3122. ans = x.__repr__();
  3123. } else if (x === true || x === false) {
  3124. ans = (x) ? "True" : "False";
  3125. } else if (Array.isArray(x)) {
  3126. ans = ρσ_repr_js_builtin(x, true);
  3127. } else if (typeof x.toString === "function") {
  3128. name = Object.prototype.toString.call(x).slice(8, -1);
  3129. if (ρσ_not_equals("Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".indexOf(name), -1)) {
  3130. return name + "([" + x.map((function() {
  3131. var ρσ_anonfunc = function (i) {
  3132. return str.format("0x{:02x}", i);
  3133. };
  3134. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3135. __argnames__ : {value: ["i"]},
  3136. __module__ : {value: "__main__"}
  3137. });
  3138. return ρσ_anonfunc;
  3139. })()).join(", ") + "])";
  3140. }
  3141. if (typeof HTMLElement !== "undefined" && x instanceof HTMLElement) {
  3142. ans = ρσ_html_element_to_string(x);
  3143. } else {
  3144. ans = x.toString();
  3145. }
  3146. if (ans === "[object Object]") {
  3147. ans = ρσ_repr_js_builtin(x);
  3148. }
  3149. } else if (typeof x === "object" && !x.toString) {
  3150. ans = ρσ_repr_js_builtin(x);
  3151. }
  3152. return ans + "";
  3153. };
  3154. if (!ρσ_str.__argnames__) Object.defineProperties(ρσ_str, {
  3155. __argnames__ : {value: ["x"]},
  3156. __module__ : {value: "__main__"}
  3157. });
  3158. define_str_func = (function() {
  3159. var ρσ_anonfunc = function (name, func) {
  3160. var f;
  3161. (ρσ_expr_temp = ρσ_str.prototype)[(typeof name === "number" && name < 0) ? ρσ_expr_temp.length + name : name] = func;
  3162. ρσ_str[(typeof name === "number" && name < 0) ? ρσ_str.length + name : name] = f = func.call.bind(func);
  3163. if (func.__argnames__) {
  3164. Object.defineProperty(f, "__argnames__", (function(){
  3165. var ρσ_d = {};
  3166. ρσ_d["value"] = ['string'].concat(func.__argnames__);
  3167. return ρσ_d;
  3168. }).call(this));
  3169. }
  3170. };
  3171. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3172. __argnames__ : {value: ["name", "func"]},
  3173. __module__ : {value: "__main__"}
  3174. });
  3175. return ρσ_anonfunc;
  3176. })();
  3177. ρσ_unpack = [String.prototype.split.call.bind(String.prototype.split), String.prototype.replace.call.bind(String.prototype.replace)];
  3178. ρσ_orig_split = ρσ_unpack[0];
  3179. ρσ_orig_replace = ρσ_unpack[1];
  3180. define_str_func("format", (function() {
  3181. var ρσ_anonfunc = function () {
  3182. var template, args, kwargs, explicit, implicit, idx, split, ans, pos, in_brace, markup, ch;
  3183. template = this;
  3184. if (template === undefined) {
  3185. throw new TypeError("Template is required");
  3186. }
  3187. args = Array.prototype.slice.call(arguments);
  3188. kwargs = {};
  3189. if (args[args.length-1] && args[args.length-1][ρσ_kwargs_symbol] !== undefined) {
  3190. kwargs = args[args.length-1];
  3191. args = args.slice(0, -1);
  3192. }
  3193. explicit = implicit = false;
  3194. idx = 0;
  3195. split = ρσ_orig_split;
  3196. if (ρσ_str.format._template_resolve_pat === undefined) {
  3197. ρσ_str.format._template_resolve_pat = /[.\[]/;
  3198. }
  3199. function resolve(arg, object) {
  3200. var ρσ_unpack, first, key, rest, ans;
  3201. if (!arg) {
  3202. return object;
  3203. }
  3204. ρσ_unpack = [arg[0], arg.slice(1)];
  3205. first = ρσ_unpack[0];
  3206. arg = ρσ_unpack[1];
  3207. key = split(arg, ρσ_str.format._template_resolve_pat, 1)[0];
  3208. rest = arg.slice(key.length);
  3209. ans = (first === "[") ? object[ρσ_bound_index(key.slice(0, -1), object)] : getattr(object, key);
  3210. if (ans === undefined) {
  3211. throw new KeyError((first === "[") ? key.slice(0, -1) : key);
  3212. }
  3213. return resolve(rest, ans);
  3214. };
  3215. if (!resolve.__argnames__) Object.defineProperties(resolve, {
  3216. __argnames__ : {value: ["arg", "object"]},
  3217. __module__ : {value: "__main__"}
  3218. });
  3219. function resolve_format_spec(format_spec) {
  3220. if (ρσ_str.format._template_resolve_fs_pat === undefined) {
  3221. ρσ_str.format._template_resolve_fs_pat = /[{]([a-zA-Z0-9_]+)[}]/g;
  3222. }
  3223. return format_spec.replace(ρσ_str.format._template_resolve_fs_pat, (function() {
  3224. var ρσ_anonfunc = function (match, key) {
  3225. if (!Object.prototype.hasOwnProperty.call(kwargs, key)) {
  3226. return "";
  3227. }
  3228. return "" + kwargs[(typeof key === "number" && key < 0) ? kwargs.length + key : key];
  3229. };
  3230. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3231. __argnames__ : {value: ["match", "key"]},
  3232. __module__ : {value: "__main__"}
  3233. });
  3234. return ρσ_anonfunc;
  3235. })());
  3236. };
  3237. if (!resolve_format_spec.__argnames__) Object.defineProperties(resolve_format_spec, {
  3238. __argnames__ : {value: ["format_spec"]},
  3239. __module__ : {value: "__main__"}
  3240. });
  3241. function set_comma(ans, comma) {
  3242. var sep;
  3243. if (comma !== ",") {
  3244. sep = 1234;
  3245. sep = sep.toLocaleString(undefined, {useGrouping: true})[1];
  3246. ans = str.replace(ans, sep, comma);
  3247. }
  3248. return ans;
  3249. };
  3250. if (!set_comma.__argnames__) Object.defineProperties(set_comma, {
  3251. __argnames__ : {value: ["ans", "comma"]},
  3252. __module__ : {value: "__main__"}
  3253. });
  3254. function safe_comma(value, comma) {
  3255. try {
  3256. return set_comma(value.toLocaleString(undefined, {useGrouping: true}), comma);
  3257. } catch (ρσ_Exception) {
  3258. ρσ_last_exception = ρσ_Exception;
  3259. {
  3260. return value.toString(10);
  3261. }
  3262. }
  3263. };
  3264. if (!safe_comma.__argnames__) Object.defineProperties(safe_comma, {
  3265. __argnames__ : {value: ["value", "comma"]},
  3266. __module__ : {value: "__main__"}
  3267. });
  3268. function safe_fixed(value, precision, comma) {
  3269. if (!comma) {
  3270. return value.toFixed(precision);
  3271. }
  3272. try {
  3273. return set_comma(value.toLocaleString(undefined, {useGrouping: true, minimumFractionDigits: precision, maximumFractionDigits: precision}), comma);
  3274. } catch (ρσ_Exception) {
  3275. ρσ_last_exception = ρσ_Exception;
  3276. {
  3277. return value.toFixed(precision);
  3278. }
  3279. }
  3280. };
  3281. if (!safe_fixed.__argnames__) Object.defineProperties(safe_fixed, {
  3282. __argnames__ : {value: ["value", "precision", "comma"]},
  3283. __module__ : {value: "__main__"}
  3284. });
  3285. function apply_formatting(value, format_spec) {
  3286. var ρσ_unpack, fill, align, sign, fhash, zeropad, width, comma, precision, ftype, is_numeric, is_int, lftype, code, prec, exp, nval, is_positive, left, right;
  3287. if (format_spec.indexOf("{") !== -1) {
  3288. format_spec = resolve_format_spec(format_spec);
  3289. }
  3290. if (ρσ_str.format._template_format_pat === undefined) {
  3291. ρσ_str.format._template_format_pat = /([^{}](?=[<>=^]))?([<>=^])?([-+\x20])?(\#)?(0)?(\d+)?([,_])?(?:\.(\d+))?([bcdeEfFgGnosxX%])?/;
  3292. }
  3293. try {
  3294. ρσ_unpack = format_spec.match(ρσ_str.format._template_format_pat).slice(1);
  3295. ρσ_unpack = ρσ_unpack_asarray(9, ρσ_unpack);
  3296. fill = ρσ_unpack[0];
  3297. align = ρσ_unpack[1];
  3298. sign = ρσ_unpack[2];
  3299. fhash = ρσ_unpack[3];
  3300. zeropad = ρσ_unpack[4];
  3301. width = ρσ_unpack[5];
  3302. comma = ρσ_unpack[6];
  3303. precision = ρσ_unpack[7];
  3304. ftype = ρσ_unpack[8];
  3305. } catch (ρσ_Exception) {
  3306. ρσ_last_exception = ρσ_Exception;
  3307. if (ρσ_Exception instanceof TypeError) {
  3308. return value;
  3309. } else {
  3310. throw ρσ_Exception;
  3311. }
  3312. }
  3313. if (zeropad) {
  3314. fill = fill || "0";
  3315. align = align || "=";
  3316. } else {
  3317. fill = fill || " ";
  3318. align = align || ">";
  3319. }
  3320. is_numeric = Number(value) === value;
  3321. is_int = is_numeric && value % 1 === 0;
  3322. precision = parseInt(precision, 10);
  3323. lftype = (ftype || "").toLowerCase();
  3324. if (ftype === "n") {
  3325. is_numeric = true;
  3326. if (is_int) {
  3327. if (comma) {
  3328. throw new ValueError("Cannot specify ',' with 'n'");
  3329. }
  3330. value = parseInt(value, 10).toLocaleString();
  3331. } else {
  3332. value = parseFloat(value).toLocaleString();
  3333. }
  3334. } else if (['b', 'c', 'd', 'o', 'x'].indexOf(lftype) !== -1) {
  3335. value = parseInt(value, 10);
  3336. is_numeric = true;
  3337. if (!isNaN(value)) {
  3338. if (ftype === "b") {
  3339. value = (value >>> 0).toString(2);
  3340. if (fhash) {
  3341. value = "0b" + value;
  3342. }
  3343. } else if (ftype === "c") {
  3344. if (value > 65535) {
  3345. code = value - 65536;
  3346. value = String.fromCharCode(55296 + (code >> 10), 56320 + (code & 1023));
  3347. } else {
  3348. value = String.fromCharCode(value);
  3349. }
  3350. } else if (ftype === "d") {
  3351. if (comma) {
  3352. value = safe_comma(value, comma);
  3353. } else {
  3354. value = value.toString(10);
  3355. }
  3356. } else if (ftype === "o") {
  3357. value = value.toString(8);
  3358. if (fhash) {
  3359. value = "0o" + value;
  3360. }
  3361. } else if (lftype === "x") {
  3362. value = value.toString(16);
  3363. value = (ftype === "x") ? value.toLowerCase() : value.toUpperCase();
  3364. if (fhash) {
  3365. value = "0x" + value;
  3366. }
  3367. }
  3368. }
  3369. } else if (['e','f','g','%'].indexOf(lftype) !== -1) {
  3370. is_numeric = true;
  3371. value = parseFloat(value);
  3372. prec = (isNaN(precision)) ? 6 : precision;
  3373. if (lftype === "e") {
  3374. value = value.toExponential(prec);
  3375. value = (ftype === "E") ? value.toUpperCase() : value.toLowerCase();
  3376. } else if (lftype === "f") {
  3377. value = safe_fixed(value, prec, comma);
  3378. value = (ftype === "F") ? value.toUpperCase() : value.toLowerCase();
  3379. } else if (lftype === "%") {
  3380. value *= 100;
  3381. value = safe_fixed(value, prec, comma) + "%";
  3382. } else if (lftype === "g") {
  3383. prec = max(1, prec);
  3384. exp = parseInt(split(value.toExponential(prec - 1).toLowerCase(), "e")[1], 10);
  3385. if (-4 <= exp && exp < prec) {
  3386. value = safe_fixed(value, prec - 1 - exp, comma);
  3387. } else {
  3388. value = value.toExponential(prec - 1);
  3389. }
  3390. value = value.replace(/0+$/g, "");
  3391. if (value[value.length-1] === decimal_sep) {
  3392. value = value.slice(0, -1);
  3393. }
  3394. if (ftype === "G") {
  3395. value = value.toUpperCase();
  3396. }
  3397. }
  3398. } else {
  3399. if (comma) {
  3400. value = parseInt(value, 10);
  3401. if (isNaN(value)) {
  3402. throw new ValueError("Must use numbers with , or _");
  3403. }
  3404. value = safe_comma(value, comma);
  3405. }
  3406. value += "";
  3407. if (!isNaN(precision)) {
  3408. value = value.slice(0, precision);
  3409. }
  3410. }
  3411. value += "";
  3412. if (is_numeric && sign) {
  3413. nval = Number(value);
  3414. is_positive = !isNaN(nval) && nval >= 0;
  3415. if (is_positive && (sign === " " || sign === "+")) {
  3416. value = sign + value;
  3417. }
  3418. }
  3419. function repeat(char, num) {
  3420. return (new Array(num+1)).join(char);
  3421. };
  3422. if (!repeat.__argnames__) Object.defineProperties(repeat, {
  3423. __argnames__ : {value: ["char", "num"]},
  3424. __module__ : {value: "__main__"}
  3425. });
  3426. if (is_numeric && width && width[0] === "0") {
  3427. width = width.slice(1);
  3428. ρσ_unpack = ["0", "="];
  3429. fill = ρσ_unpack[0];
  3430. align = ρσ_unpack[1];
  3431. }
  3432. width = parseInt(width || "-1", 10);
  3433. if (isNaN(width)) {
  3434. throw new ValueError("Invalid width specification: " + width);
  3435. }
  3436. if (fill && value.length < width) {
  3437. if (align === "<") {
  3438. value = value + repeat(fill, width - value.length);
  3439. } else if (align === ">") {
  3440. value = repeat(fill, width - value.length) + value;
  3441. } else if (align === "^") {
  3442. left = Math.floor((width - value.length) / 2);
  3443. right = width - left - value.length;
  3444. value = repeat(fill, left) + value + repeat(fill, right);
  3445. } else if (align === "=") {
  3446. if (ρσ_in(value[0], "+- ")) {
  3447. value = value[0] + repeat(fill, width - value.length) + value.slice(1);
  3448. } else {
  3449. value = repeat(fill, width - value.length) + value;
  3450. }
  3451. } else {
  3452. throw new ValueError("Unrecognized alignment: " + align);
  3453. }
  3454. }
  3455. return value;
  3456. };
  3457. if (!apply_formatting.__argnames__) Object.defineProperties(apply_formatting, {
  3458. __argnames__ : {value: ["value", "format_spec"]},
  3459. __module__ : {value: "__main__"}
  3460. });
  3461. function parse_markup(markup) {
  3462. var key, transformer, format_spec, pos, state, ch;
  3463. key = transformer = format_spec = "";
  3464. pos = 0;
  3465. state = 0;
  3466. while (pos < markup.length) {
  3467. ch = markup[(typeof pos === "number" && pos < 0) ? markup.length + pos : pos];
  3468. if (state === 0) {
  3469. if (ch === "!") {
  3470. state = 1;
  3471. } else if (ch === ":") {
  3472. state = 2;
  3473. } else {
  3474. key += ch;
  3475. }
  3476. } else if (state === 1) {
  3477. if (ch === ":") {
  3478. state = 2;
  3479. } else {
  3480. transformer += ch;
  3481. }
  3482. } else {
  3483. format_spec += ch;
  3484. }
  3485. pos += 1;
  3486. }
  3487. return [key, transformer, format_spec];
  3488. };
  3489. if (!parse_markup.__argnames__) Object.defineProperties(parse_markup, {
  3490. __argnames__ : {value: ["markup"]},
  3491. __module__ : {value: "__main__"}
  3492. });
  3493. function render_markup(markup) {
  3494. var ρσ_unpack, key, transformer, format_spec, ends_with_equal, lkey, nvalue, object, ans;
  3495. ρσ_unpack = parse_markup(markup);
  3496. ρσ_unpack = ρσ_unpack_asarray(3, ρσ_unpack);
  3497. key = ρσ_unpack[0];
  3498. transformer = ρσ_unpack[1];
  3499. format_spec = ρσ_unpack[2];
  3500. if (transformer && ['a', 'r', 's'].indexOf(transformer) === -1) {
  3501. throw new ValueError("Unknown conversion specifier: " + transformer);
  3502. }
  3503. ends_with_equal = key.endsWith("=");
  3504. if (ends_with_equal) {
  3505. key = key.slice(0, -1);
  3506. }
  3507. lkey = key.length && split(key, /[.\[]/, 1)[0];
  3508. if (lkey) {
  3509. explicit = true;
  3510. if (implicit) {
  3511. throw new ValueError("cannot switch from automatic field numbering to manual field specification");
  3512. }
  3513. nvalue = parseInt(lkey);
  3514. object = (isNaN(nvalue)) ? kwargs[(typeof lkey === "number" && lkey < 0) ? kwargs.length + lkey : lkey] : args[(typeof nvalue === "number" && nvalue < 0) ? args.length + nvalue : nvalue];
  3515. if (object === undefined) {
  3516. if (isNaN(nvalue)) {
  3517. throw new KeyError(lkey);
  3518. }
  3519. throw new IndexError(lkey);
  3520. }
  3521. object = resolve(key.slice(lkey.length), object);
  3522. } else {
  3523. implicit = true;
  3524. if (explicit) {
  3525. throw new ValueError("cannot switch from manual field specification to automatic field numbering");
  3526. }
  3527. if (idx >= args.length) {
  3528. throw new IndexError("Not enough arguments to match template: " + template);
  3529. }
  3530. object = args[(typeof idx === "number" && idx < 0) ? args.length + idx : idx];
  3531. idx += 1;
  3532. }
  3533. if (typeof object === "function") {
  3534. object = object();
  3535. }
  3536. ans = "" + object;
  3537. if (format_spec) {
  3538. ans = apply_formatting(ans, format_spec);
  3539. }
  3540. if (ends_with_equal) {
  3541. ans = "" + ρσ_str.format("{}", key) + "=" + ρσ_str.format("{}", ans) + "";
  3542. }
  3543. return ans;
  3544. };
  3545. if (!render_markup.__argnames__) Object.defineProperties(render_markup, {
  3546. __argnames__ : {value: ["markup"]},
  3547. __module__ : {value: "__main__"}
  3548. });
  3549. ans = "";
  3550. pos = 0;
  3551. in_brace = 0;
  3552. markup = "";
  3553. while (pos < template.length) {
  3554. ch = template[(typeof pos === "number" && pos < 0) ? template.length + pos : pos];
  3555. if (in_brace) {
  3556. if (ch === "{") {
  3557. in_brace += 1;
  3558. markup += "{";
  3559. } else if (ch === "}") {
  3560. in_brace -= 1;
  3561. if (in_brace > 0) {
  3562. markup += "}";
  3563. } else {
  3564. ans += render_markup(markup);
  3565. }
  3566. } else {
  3567. markup += ch;
  3568. }
  3569. } else {
  3570. if (ch === "{") {
  3571. if (template[ρσ_bound_index(pos + 1, template)] === "{") {
  3572. pos += 1;
  3573. ans += "{";
  3574. } else {
  3575. in_brace = 1;
  3576. markup = "";
  3577. }
  3578. } else {
  3579. ans += ch;
  3580. if (ch === "}" && template[ρσ_bound_index(pos + 1, template)] === "}") {
  3581. pos += 1;
  3582. }
  3583. }
  3584. }
  3585. pos += 1;
  3586. }
  3587. if (in_brace) {
  3588. throw new ValueError("expected '}' before end of string");
  3589. }
  3590. return ans;
  3591. };
  3592. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  3593. __module__ : {value: "__main__"}
  3594. });
  3595. return ρσ_anonfunc;
  3596. })());
  3597. define_str_func("capitalize", (function() {
  3598. var ρσ_anonfunc = function () {
  3599. var string;
  3600. string = this;
  3601. if (string) {
  3602. string = string[0].toUpperCase() + string.slice(1).toLowerCase();
  3603. }
  3604. return string;
  3605. };
  3606. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  3607. __module__ : {value: "__main__"}
  3608. });
  3609. return ρσ_anonfunc;
  3610. })());
  3611. define_str_func("center", (function() {
  3612. var ρσ_anonfunc = function (width, fill) {
  3613. var left, right;
  3614. left = Math.floor((width - this.length) / 2);
  3615. right = width - left - this.length;
  3616. fill = fill || " ";
  3617. return new Array(left+1).join(fill) + this + new Array(right+1).join(fill);
  3618. };
  3619. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3620. __argnames__ : {value: ["width", "fill"]},
  3621. __module__ : {value: "__main__"}
  3622. });
  3623. return ρσ_anonfunc;
  3624. })());
  3625. define_str_func("count", (function() {
  3626. var ρσ_anonfunc = function (needle, start, end) {
  3627. var string, ρσ_unpack, pos, step, ans;
  3628. string = this;
  3629. start = start || 0;
  3630. end = end || string.length;
  3631. if (start < 0 || end < 0) {
  3632. string = string.slice(start, end);
  3633. ρσ_unpack = [0, string.length];
  3634. start = ρσ_unpack[0];
  3635. end = ρσ_unpack[1];
  3636. }
  3637. pos = start;
  3638. step = needle.length;
  3639. if (!step) {
  3640. return 0;
  3641. }
  3642. ans = 0;
  3643. while (pos !== -1) {
  3644. pos = string.indexOf(needle, pos);
  3645. if (pos !== -1) {
  3646. ans += 1;
  3647. pos += step;
  3648. }
  3649. }
  3650. return ans;
  3651. };
  3652. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3653. __argnames__ : {value: ["needle", "start", "end"]},
  3654. __module__ : {value: "__main__"}
  3655. });
  3656. return ρσ_anonfunc;
  3657. })());
  3658. define_str_func("endswith", (function() {
  3659. var ρσ_anonfunc = function (suffixes, start, end) {
  3660. var string, q;
  3661. string = this;
  3662. start = start || 0;
  3663. if (typeof suffixes === "string") {
  3664. suffixes = [suffixes];
  3665. }
  3666. if (end !== undefined) {
  3667. string = string.slice(0, end);
  3668. }
  3669. for (var i = 0; i < suffixes.length; i++) {
  3670. q = suffixes[(typeof i === "number" && i < 0) ? suffixes.length + i : i];
  3671. if (string.indexOf(q, Math.max(start, string.length - q.length)) !== -1) {
  3672. return true;
  3673. }
  3674. }
  3675. return false;
  3676. };
  3677. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3678. __argnames__ : {value: ["suffixes", "start", "end"]},
  3679. __module__ : {value: "__main__"}
  3680. });
  3681. return ρσ_anonfunc;
  3682. })());
  3683. define_str_func("startswith", (function() {
  3684. var ρσ_anonfunc = function (prefixes, start, end) {
  3685. var prefix;
  3686. start = start || 0;
  3687. if (typeof prefixes === "string") {
  3688. prefixes = [prefixes];
  3689. }
  3690. for (var i = 0; i < prefixes.length; i++) {
  3691. prefix = prefixes[(typeof i === "number" && i < 0) ? prefixes.length + i : i];
  3692. end = (end === undefined) ? this.length : end;
  3693. if (end - start >= prefix.length && prefix === this.slice(start, start + prefix.length)) {
  3694. return true;
  3695. }
  3696. }
  3697. return false;
  3698. };
  3699. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3700. __argnames__ : {value: ["prefixes", "start", "end"]},
  3701. __module__ : {value: "__main__"}
  3702. });
  3703. return ρσ_anonfunc;
  3704. })());
  3705. define_str_func("find", (function() {
  3706. var ρσ_anonfunc = function (needle, start, end) {
  3707. var ans;
  3708. while (start < 0) {
  3709. start += this.length;
  3710. }
  3711. ans = this.indexOf(needle, start);
  3712. if (end !== undefined && ans !== -1) {
  3713. while (end < 0) {
  3714. end += this.length;
  3715. }
  3716. if (ans >= end - needle.length) {
  3717. return -1;
  3718. }
  3719. }
  3720. return ans;
  3721. };
  3722. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3723. __argnames__ : {value: ["needle", "start", "end"]},
  3724. __module__ : {value: "__main__"}
  3725. });
  3726. return ρσ_anonfunc;
  3727. })());
  3728. define_str_func("rfind", (function() {
  3729. var ρσ_anonfunc = function (needle, start, end) {
  3730. var ans;
  3731. while (end < 0) {
  3732. end += this.length;
  3733. }
  3734. ans = this.lastIndexOf(needle, end - 1);
  3735. if (start !== undefined && ans !== -1) {
  3736. while (start < 0) {
  3737. start += this.length;
  3738. }
  3739. if (ans < start) {
  3740. return -1;
  3741. }
  3742. }
  3743. return ans;
  3744. };
  3745. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3746. __argnames__ : {value: ["needle", "start", "end"]},
  3747. __module__ : {value: "__main__"}
  3748. });
  3749. return ρσ_anonfunc;
  3750. })());
  3751. define_str_func("index", (function() {
  3752. var ρσ_anonfunc = function (needle, start, end) {
  3753. var ans;
  3754. ans = ρσ_str.prototype.find.apply(this, arguments);
  3755. if (ans === -1) {
  3756. throw new ValueError("substring not found");
  3757. }
  3758. return ans;
  3759. };
  3760. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3761. __argnames__ : {value: ["needle", "start", "end"]},
  3762. __module__ : {value: "__main__"}
  3763. });
  3764. return ρσ_anonfunc;
  3765. })());
  3766. define_str_func("rindex", (function() {
  3767. var ρσ_anonfunc = function (needle, start, end) {
  3768. var ans;
  3769. ans = ρσ_str.prototype.rfind.apply(this, arguments);
  3770. if (ans === -1) {
  3771. throw new ValueError("substring not found");
  3772. }
  3773. return ans;
  3774. };
  3775. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3776. __argnames__ : {value: ["needle", "start", "end"]},
  3777. __module__ : {value: "__main__"}
  3778. });
  3779. return ρσ_anonfunc;
  3780. })());
  3781. define_str_func("islower", (function() {
  3782. var ρσ_anonfunc = function () {
  3783. return this.length > 0 && this.toLowerCase() === this.toString();
  3784. };
  3785. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  3786. __module__ : {value: "__main__"}
  3787. });
  3788. return ρσ_anonfunc;
  3789. })());
  3790. define_str_func("isupper", (function() {
  3791. var ρσ_anonfunc = function () {
  3792. return this.length > 0 && this.toUpperCase() === this.toString();
  3793. };
  3794. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  3795. __module__ : {value: "__main__"}
  3796. });
  3797. return ρσ_anonfunc;
  3798. })());
  3799. define_str_func("isspace", (function() {
  3800. var ρσ_anonfunc = function () {
  3801. return this.length > 0 && /^\s+$/.test(this);
  3802. };
  3803. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  3804. __module__ : {value: "__main__"}
  3805. });
  3806. return ρσ_anonfunc;
  3807. })());
  3808. define_str_func("join", (function() {
  3809. var ρσ_anonfunc = function (iterable) {
  3810. var ans, r;
  3811. if (Array.isArray(iterable)) {
  3812. return iterable.join(this);
  3813. }
  3814. ans = "";
  3815. r = iterable.next();
  3816. while (!r.done) {
  3817. if (ans) {
  3818. ans += this;
  3819. }
  3820. ans += r.value;
  3821. r = iterable.next();
  3822. }
  3823. return ans;
  3824. };
  3825. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3826. __argnames__ : {value: ["iterable"]},
  3827. __module__ : {value: "__main__"}
  3828. });
  3829. return ρσ_anonfunc;
  3830. })());
  3831. define_str_func("ljust", (function() {
  3832. var ρσ_anonfunc = function (width, fill) {
  3833. var string;
  3834. string = this;
  3835. if (width > string.length) {
  3836. fill = fill || " ";
  3837. string += new Array(width - string.length + 1).join(fill);
  3838. }
  3839. return string;
  3840. };
  3841. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3842. __argnames__ : {value: ["width", "fill"]},
  3843. __module__ : {value: "__main__"}
  3844. });
  3845. return ρσ_anonfunc;
  3846. })());
  3847. define_str_func("rjust", (function() {
  3848. var ρσ_anonfunc = function (width, fill) {
  3849. var string;
  3850. string = this;
  3851. if (width > string.length) {
  3852. fill = fill || " ";
  3853. string = new Array(width - string.length + 1).join(fill) + string;
  3854. }
  3855. return string;
  3856. };
  3857. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3858. __argnames__ : {value: ["width", "fill"]},
  3859. __module__ : {value: "__main__"}
  3860. });
  3861. return ρσ_anonfunc;
  3862. })());
  3863. define_str_func("lower", (function() {
  3864. var ρσ_anonfunc = function () {
  3865. return this.toLowerCase();
  3866. };
  3867. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  3868. __module__ : {value: "__main__"}
  3869. });
  3870. return ρσ_anonfunc;
  3871. })());
  3872. define_str_func("upper", (function() {
  3873. var ρσ_anonfunc = function () {
  3874. return this.toUpperCase();
  3875. };
  3876. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  3877. __module__ : {value: "__main__"}
  3878. });
  3879. return ρσ_anonfunc;
  3880. })());
  3881. define_str_func("lstrip", (function() {
  3882. var ρσ_anonfunc = function (chars) {
  3883. var string, pos;
  3884. string = this;
  3885. pos = 0;
  3886. chars = chars || ρσ_str.whitespace;
  3887. while (chars.indexOf(string[(typeof pos === "number" && pos < 0) ? string.length + pos : pos]) !== -1) {
  3888. pos += 1;
  3889. }
  3890. if (pos) {
  3891. string = string.slice(pos);
  3892. }
  3893. return string;
  3894. };
  3895. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3896. __argnames__ : {value: ["chars"]},
  3897. __module__ : {value: "__main__"}
  3898. });
  3899. return ρσ_anonfunc;
  3900. })());
  3901. define_str_func("rstrip", (function() {
  3902. var ρσ_anonfunc = function (chars) {
  3903. var string, pos;
  3904. string = this;
  3905. pos = string.length - 1;
  3906. chars = chars || ρσ_str.whitespace;
  3907. while (chars.indexOf(string[(typeof pos === "number" && pos < 0) ? string.length + pos : pos]) !== -1) {
  3908. pos -= 1;
  3909. }
  3910. if (pos < string.length - 1) {
  3911. string = string.slice(0, pos + 1);
  3912. }
  3913. return string;
  3914. };
  3915. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3916. __argnames__ : {value: ["chars"]},
  3917. __module__ : {value: "__main__"}
  3918. });
  3919. return ρσ_anonfunc;
  3920. })());
  3921. define_str_func("strip", (function() {
  3922. var ρσ_anonfunc = function (chars) {
  3923. return ρσ_str.prototype.lstrip.call(ρσ_str.prototype.rstrip.call(this, chars), chars);
  3924. };
  3925. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3926. __argnames__ : {value: ["chars"]},
  3927. __module__ : {value: "__main__"}
  3928. });
  3929. return ρσ_anonfunc;
  3930. })());
  3931. define_str_func("partition", (function() {
  3932. var ρσ_anonfunc = function (sep) {
  3933. var idx;
  3934. idx = this.indexOf(sep);
  3935. if (idx === -1) {
  3936. return [this, "", ""];
  3937. }
  3938. return [this.slice(0, idx), sep, this.slice(idx + sep.length)];
  3939. };
  3940. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3941. __argnames__ : {value: ["sep"]},
  3942. __module__ : {value: "__main__"}
  3943. });
  3944. return ρσ_anonfunc;
  3945. })());
  3946. define_str_func("rpartition", (function() {
  3947. var ρσ_anonfunc = function (sep) {
  3948. var idx;
  3949. idx = this.lastIndexOf(sep);
  3950. if (idx === -1) {
  3951. return ["", "", this];
  3952. }
  3953. return [this.slice(0, idx), sep, this.slice(idx + sep.length)];
  3954. };
  3955. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3956. __argnames__ : {value: ["sep"]},
  3957. __module__ : {value: "__main__"}
  3958. });
  3959. return ρσ_anonfunc;
  3960. })());
  3961. define_str_func("replace", (function() {
  3962. var ρσ_anonfunc = function (old, repl, count) {
  3963. var string, pos, idx;
  3964. string = this;
  3965. if (count === 1) {
  3966. return ρσ_orig_replace(string, old, repl);
  3967. }
  3968. if (count < 1) {
  3969. return string;
  3970. }
  3971. count = count || Number.MAX_VALUE;
  3972. pos = 0;
  3973. while (count > 0) {
  3974. count -= 1;
  3975. idx = string.indexOf(old, pos);
  3976. if (idx === -1) {
  3977. break;
  3978. }
  3979. pos = idx + repl.length;
  3980. string = string.slice(0, idx) + repl + string.slice(idx + old.length);
  3981. }
  3982. return string;
  3983. };
  3984. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  3985. __argnames__ : {value: ["old", "repl", "count"]},
  3986. __module__ : {value: "__main__"}
  3987. });
  3988. return ρσ_anonfunc;
  3989. })());
  3990. define_str_func("split", (function() {
  3991. var ρσ_anonfunc = function (sep, maxsplit) {
  3992. var split, ans, extra, parts;
  3993. if (maxsplit === 0) {
  3994. return ρσ_list_decorate([ this ]);
  3995. }
  3996. split = ρσ_orig_split;
  3997. if (sep === undefined || sep === null) {
  3998. if (maxsplit > 0) {
  3999. ans = split(this, /(\s+)/);
  4000. extra = "";
  4001. parts = [];
  4002. for (var i = 0; i < ans.length; i++) {
  4003. if (parts.length >= maxsplit + 1) {
  4004. extra += ans[(typeof i === "number" && i < 0) ? ans.length + i : i];
  4005. } else if (i % 2 === 0) {
  4006. parts.push(ans[(typeof i === "number" && i < 0) ? ans.length + i : i]);
  4007. }
  4008. }
  4009. parts[parts.length-1] += extra;
  4010. ans = parts;
  4011. } else {
  4012. ans = split(this, /\s+/);
  4013. }
  4014. } else {
  4015. if (sep === "") {
  4016. throw new ValueError("empty separator");
  4017. }
  4018. ans = split(this, sep);
  4019. if (maxsplit > 0 && ans.length > maxsplit) {
  4020. extra = ans.slice(maxsplit).join(sep);
  4021. ans = ans.slice(0, maxsplit);
  4022. ans.push(extra);
  4023. }
  4024. }
  4025. return ρσ_list_decorate(ans);
  4026. };
  4027. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  4028. __argnames__ : {value: ["sep", "maxsplit"]},
  4029. __module__ : {value: "__main__"}
  4030. });
  4031. return ρσ_anonfunc;
  4032. })());
  4033. define_str_func("rsplit", (function() {
  4034. var ρσ_anonfunc = function (sep, maxsplit) {
  4035. var split, ans, is_space, pos, current, spc, ch, end, idx;
  4036. if (!maxsplit) {
  4037. return ρσ_str.prototype.split.call(this, sep);
  4038. }
  4039. split = ρσ_orig_split;
  4040. if (sep === undefined || sep === null) {
  4041. if (maxsplit > 0) {
  4042. ans = [];
  4043. is_space = /\s/;
  4044. pos = this.length - 1;
  4045. current = "";
  4046. while (pos > -1 && maxsplit > 0) {
  4047. spc = false;
  4048. ch = (ρσ_expr_temp = this)[(typeof pos === "number" && pos < 0) ? ρσ_expr_temp.length + pos : pos];
  4049. while (pos > -1 && is_space.test(ch)) {
  4050. spc = true;
  4051. ch = this[--pos];
  4052. }
  4053. if (spc) {
  4054. if (current) {
  4055. ans.push(current);
  4056. maxsplit -= 1;
  4057. }
  4058. current = ch;
  4059. } else {
  4060. current += ch;
  4061. }
  4062. pos -= 1;
  4063. }
  4064. ans.push(this.slice(0, pos + 1) + current);
  4065. ans.reverse();
  4066. } else {
  4067. ans = split(this, /\s+/);
  4068. }
  4069. } else {
  4070. if (sep === "") {
  4071. throw new ValueError("empty separator");
  4072. }
  4073. ans = [];
  4074. pos = end = this.length;
  4075. while (pos > -1 && maxsplit > 0) {
  4076. maxsplit -= 1;
  4077. idx = this.lastIndexOf(sep, pos);
  4078. if (idx === -1) {
  4079. break;
  4080. }
  4081. ans.push(this.slice(idx + sep.length, end));
  4082. pos = idx - 1;
  4083. end = idx;
  4084. }
  4085. ans.push(this.slice(0, end));
  4086. ans.reverse();
  4087. }
  4088. return ρσ_list_decorate(ans);
  4089. };
  4090. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  4091. __argnames__ : {value: ["sep", "maxsplit"]},
  4092. __module__ : {value: "__main__"}
  4093. });
  4094. return ρσ_anonfunc;
  4095. })());
  4096. define_str_func("splitlines", (function() {
  4097. var ρσ_anonfunc = function (keepends) {
  4098. var split, parts, ans;
  4099. split = ρσ_orig_split;
  4100. if (keepends) {
  4101. parts = split(this, /((?:\r?\n)|\r)/);
  4102. ans = [];
  4103. for (var i = 0; i < parts.length; i++) {
  4104. if (i % 2 === 0) {
  4105. ans.push(parts[(typeof i === "number" && i < 0) ? parts.length + i : i]);
  4106. } else {
  4107. ans[ans.length-1] += parts[(typeof i === "number" && i < 0) ? parts.length + i : i];
  4108. }
  4109. }
  4110. } else {
  4111. ans = split(this, /(?:\r?\n)|\r/);
  4112. }
  4113. return ρσ_list_decorate(ans);
  4114. };
  4115. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  4116. __argnames__ : {value: ["keepends"]},
  4117. __module__ : {value: "__main__"}
  4118. });
  4119. return ρσ_anonfunc;
  4120. })());
  4121. define_str_func("swapcase", (function() {
  4122. var ρσ_anonfunc = function () {
  4123. var ans, a, b;
  4124. ans = new Array(this.length);
  4125. for (var i = 0; i < ans.length; i++) {
  4126. a = (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
  4127. b = a.toLowerCase();
  4128. if (a === b) {
  4129. b = a.toUpperCase();
  4130. }
  4131. ans[(typeof i === "number" && i < 0) ? ans.length + i : i] = b;
  4132. }
  4133. return ans.join("");
  4134. };
  4135. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  4136. __module__ : {value: "__main__"}
  4137. });
  4138. return ρσ_anonfunc;
  4139. })());
  4140. define_str_func("zfill", (function() {
  4141. var ρσ_anonfunc = function (width) {
  4142. var string;
  4143. string = this;
  4144. if (width > string.length) {
  4145. string = new Array(width - string.length + 1).join("0") + string;
  4146. }
  4147. return string;
  4148. };
  4149. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  4150. __argnames__ : {value: ["width"]},
  4151. __module__ : {value: "__main__"}
  4152. });
  4153. return ρσ_anonfunc;
  4154. })());
  4155. ρσ_str.uchrs = (function() {
  4156. var ρσ_anonfunc = function (string, with_positions) {
  4157. return (function(){
  4158. var ρσ_d = {};
  4159. ρσ_d["_string"] = string;
  4160. ρσ_d["_pos"] = 0;
  4161. ρσ_d[ρσ_iterator_symbol] = (function() {
  4162. var ρσ_anonfunc = function () {
  4163. return this;
  4164. };
  4165. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  4166. __module__ : {value: "__main__"}
  4167. });
  4168. return ρσ_anonfunc;
  4169. })();
  4170. ρσ_d["next"] = (function() {
  4171. var ρσ_anonfunc = function () {
  4172. var length, pos, value, ans, extra;
  4173. length = this._string.length;
  4174. if (this._pos >= length) {
  4175. return (function(){
  4176. var ρσ_d = {};
  4177. ρσ_d["done"] = true;
  4178. return ρσ_d;
  4179. }).call(this);
  4180. }
  4181. pos = this._pos;
  4182. value = this._string.charCodeAt(this._pos++);
  4183. ans = "\ufffd";
  4184. if (55296 <= value && value <= 56319) {
  4185. if (this._pos < length) {
  4186. extra = this._string.charCodeAt(this._pos++);
  4187. if ((extra & 56320) === 56320) {
  4188. ans = String.fromCharCode(value, extra);
  4189. }
  4190. }
  4191. } else if ((value & 56320) !== 56320) {
  4192. ans = String.fromCharCode(value);
  4193. }
  4194. if (with_positions) {
  4195. return (function(){
  4196. var ρσ_d = {};
  4197. ρσ_d["done"] = false;
  4198. ρσ_d["value"] = ρσ_list_decorate([ pos, ans ]);
  4199. return ρσ_d;
  4200. }).call(this);
  4201. } else {
  4202. return (function(){
  4203. var ρσ_d = {};
  4204. ρσ_d["done"] = false;
  4205. ρσ_d["value"] = ans;
  4206. return ρσ_d;
  4207. }).call(this);
  4208. }
  4209. };
  4210. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  4211. __module__ : {value: "__main__"}
  4212. });
  4213. return ρσ_anonfunc;
  4214. })();
  4215. return ρσ_d;
  4216. }).call(this);
  4217. };
  4218. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  4219. __argnames__ : {value: ["string", "with_positions"]},
  4220. __module__ : {value: "__main__"}
  4221. });
  4222. return ρσ_anonfunc;
  4223. })();
  4224. ρσ_str.uslice = (function() {
  4225. var ρσ_anonfunc = function (string, start, end) {
  4226. var items, iterator, r;
  4227. items = [];
  4228. iterator = ρσ_str.uchrs(string);
  4229. r = iterator.next();
  4230. while (!r.done) {
  4231. items.push(r.value);
  4232. r = iterator.next();
  4233. }
  4234. return items.slice(start || 0, (end === undefined) ? items.length : end).join("");
  4235. };
  4236. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  4237. __argnames__ : {value: ["string", "start", "end"]},
  4238. __module__ : {value: "__main__"}
  4239. });
  4240. return ρσ_anonfunc;
  4241. })();
  4242. ρσ_str.ulen = (function() {
  4243. var ρσ_anonfunc = function (string) {
  4244. var iterator, r, ans;
  4245. iterator = ρσ_str.uchrs(string);
  4246. r = iterator.next();
  4247. ans = 0;
  4248. while (!r.done) {
  4249. r = iterator.next();
  4250. ans += 1;
  4251. }
  4252. return ans;
  4253. };
  4254. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  4255. __argnames__ : {value: ["string"]},
  4256. __module__ : {value: "__main__"}
  4257. });
  4258. return ρσ_anonfunc;
  4259. })();
  4260. ρσ_str.ascii_lowercase = "abcdefghijklmnopqrstuvwxyz";
  4261. ρσ_str.ascii_uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  4262. ρσ_str.ascii_letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  4263. ρσ_str.digits = "0123456789";
  4264. ρσ_str.punctuation = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
  4265. ρσ_str.printable = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\u000b\f";
  4266. ρσ_str.whitespace = " \t\n\r\u000b\f";
  4267. define_str_func = undefined;
  4268. var str = ρσ_str, repr = ρσ_repr;;
  4269. var ρσ_modules = {};
  4270. ρσ_modules.elementmaker = {};
  4271. ρσ_modules.fs_images = {};
  4272. ρσ_modules.live_css = {};
  4273. ρσ_modules.qt = {};
  4274. (function(){
  4275. var __name__ = "elementmaker";
  4276. var html_elements, mathml_elements, svg_elements, html5_tags, E;
  4277. html_elements = (function(){
  4278. var s = ρσ_set();
  4279. s.jsset.add("a");
  4280. s.jsset.add("abbr");
  4281. s.jsset.add("acronym");
  4282. s.jsset.add("address");
  4283. s.jsset.add("area");
  4284. s.jsset.add("article");
  4285. s.jsset.add("aside");
  4286. s.jsset.add("audio");
  4287. s.jsset.add("b");
  4288. s.jsset.add("base");
  4289. s.jsset.add("big");
  4290. s.jsset.add("body");
  4291. s.jsset.add("blockquote");
  4292. s.jsset.add("br");
  4293. s.jsset.add("button");
  4294. s.jsset.add("canvas");
  4295. s.jsset.add("caption");
  4296. s.jsset.add("center");
  4297. s.jsset.add("cite");
  4298. s.jsset.add("code");
  4299. s.jsset.add("col");
  4300. s.jsset.add("colgroup");
  4301. s.jsset.add("command");
  4302. s.jsset.add("datagrid");
  4303. s.jsset.add("datalist");
  4304. s.jsset.add("dd");
  4305. s.jsset.add("del");
  4306. s.jsset.add("details");
  4307. s.jsset.add("dfn");
  4308. s.jsset.add("dialog");
  4309. s.jsset.add("dir");
  4310. s.jsset.add("div");
  4311. s.jsset.add("dl");
  4312. s.jsset.add("dt");
  4313. s.jsset.add("em");
  4314. s.jsset.add("event-source");
  4315. s.jsset.add("fieldset");
  4316. s.jsset.add("figcaption");
  4317. s.jsset.add("figure");
  4318. s.jsset.add("footer");
  4319. s.jsset.add("font");
  4320. s.jsset.add("form");
  4321. s.jsset.add("header");
  4322. s.jsset.add("h1");
  4323. s.jsset.add("h2");
  4324. s.jsset.add("h3");
  4325. s.jsset.add("h4");
  4326. s.jsset.add("h5");
  4327. s.jsset.add("h6");
  4328. s.jsset.add("hr");
  4329. s.jsset.add("head");
  4330. s.jsset.add("i");
  4331. s.jsset.add("iframe");
  4332. s.jsset.add("img");
  4333. s.jsset.add("input");
  4334. s.jsset.add("ins");
  4335. s.jsset.add("keygen");
  4336. s.jsset.add("kbd");
  4337. s.jsset.add("label");
  4338. s.jsset.add("legend");
  4339. s.jsset.add("li");
  4340. s.jsset.add("m");
  4341. s.jsset.add("map");
  4342. s.jsset.add("menu");
  4343. s.jsset.add("meter");
  4344. s.jsset.add("multicol");
  4345. s.jsset.add("nav");
  4346. s.jsset.add("nextid");
  4347. s.jsset.add("ol");
  4348. s.jsset.add("output");
  4349. s.jsset.add("optgroup");
  4350. s.jsset.add("option");
  4351. s.jsset.add("p");
  4352. s.jsset.add("pre");
  4353. s.jsset.add("progress");
  4354. s.jsset.add("q");
  4355. s.jsset.add("s");
  4356. s.jsset.add("samp");
  4357. s.jsset.add("script");
  4358. s.jsset.add("section");
  4359. s.jsset.add("select");
  4360. s.jsset.add("small");
  4361. s.jsset.add("sound");
  4362. s.jsset.add("source");
  4363. s.jsset.add("spacer");
  4364. s.jsset.add("span");
  4365. s.jsset.add("strike");
  4366. s.jsset.add("strong");
  4367. s.jsset.add("style");
  4368. s.jsset.add("sub");
  4369. s.jsset.add("sup");
  4370. s.jsset.add("table");
  4371. s.jsset.add("tbody");
  4372. s.jsset.add("td");
  4373. s.jsset.add("textarea");
  4374. s.jsset.add("time");
  4375. s.jsset.add("tfoot");
  4376. s.jsset.add("th");
  4377. s.jsset.add("thead");
  4378. s.jsset.add("tr");
  4379. s.jsset.add("tt");
  4380. s.jsset.add("u");
  4381. s.jsset.add("ul");
  4382. s.jsset.add("var");
  4383. s.jsset.add("video");
  4384. return s;
  4385. })();
  4386. mathml_elements = (function(){
  4387. var s = ρσ_set();
  4388. s.jsset.add("maction");
  4389. s.jsset.add("math");
  4390. s.jsset.add("merror");
  4391. s.jsset.add("mfrac");
  4392. s.jsset.add("mi");
  4393. s.jsset.add("mmultiscripts");
  4394. s.jsset.add("mn");
  4395. s.jsset.add("mo");
  4396. s.jsset.add("mover");
  4397. s.jsset.add("mpadded");
  4398. s.jsset.add("mphantom");
  4399. s.jsset.add("mprescripts");
  4400. s.jsset.add("mroot");
  4401. s.jsset.add("mrow");
  4402. s.jsset.add("mspace");
  4403. s.jsset.add("msqrt");
  4404. s.jsset.add("mstyle");
  4405. s.jsset.add("msub");
  4406. s.jsset.add("msubsup");
  4407. s.jsset.add("msup");
  4408. s.jsset.add("mtable");
  4409. s.jsset.add("mtd");
  4410. s.jsset.add("mtext");
  4411. s.jsset.add("mtr");
  4412. s.jsset.add("munder");
  4413. s.jsset.add("munderover");
  4414. s.jsset.add("none");
  4415. return s;
  4416. })();
  4417. svg_elements = (function(){
  4418. var s = ρσ_set();
  4419. s.jsset.add("a");
  4420. s.jsset.add("animate");
  4421. s.jsset.add("animateColor");
  4422. s.jsset.add("animateMotion");
  4423. s.jsset.add("animateTransform");
  4424. s.jsset.add("clipPath");
  4425. s.jsset.add("circle");
  4426. s.jsset.add("defs");
  4427. s.jsset.add("desc");
  4428. s.jsset.add("ellipse");
  4429. s.jsset.add("font-face");
  4430. s.jsset.add("font-face-name");
  4431. s.jsset.add("font-face-src");
  4432. s.jsset.add("g");
  4433. s.jsset.add("glyph");
  4434. s.jsset.add("hkern");
  4435. s.jsset.add("linearGradient");
  4436. s.jsset.add("line");
  4437. s.jsset.add("marker");
  4438. s.jsset.add("metadata");
  4439. s.jsset.add("missing-glyph");
  4440. s.jsset.add("mpath");
  4441. s.jsset.add("path");
  4442. s.jsset.add("polygon");
  4443. s.jsset.add("polyline");
  4444. s.jsset.add("radialGradient");
  4445. s.jsset.add("rect");
  4446. s.jsset.add("set");
  4447. s.jsset.add("stop");
  4448. s.jsset.add("svg");
  4449. s.jsset.add("switch");
  4450. s.jsset.add("text");
  4451. s.jsset.add("title");
  4452. s.jsset.add("tspan");
  4453. s.jsset.add("use");
  4454. return s;
  4455. })();
  4456. html5_tags = html_elements.union(mathml_elements).union(svg_elements);
  4457. function _makeelement() {
  4458. var tag = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
  4459. var kwargs = arguments[arguments.length-1];
  4460. if (kwargs === null || typeof kwargs !== "object" || kwargs [ρσ_kwargs_symbol] !== true) kwargs = {};
  4461. var args = Array.prototype.slice.call(arguments, 1);
  4462. if (kwargs !== null && typeof kwargs === "object" && kwargs [ρσ_kwargs_symbol] === true) args.pop();
  4463. var ans, vattr, val, attr, arg;
  4464. ans = this.createElement(tag);
  4465. var ρσ_Iter0 = ρσ_Iterable(kwargs);
  4466. for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) {
  4467. attr = ρσ_Iter0[ρσ_Index0];
  4468. vattr = str.replace(str.rstrip(attr, "_"), "_", "-");
  4469. val = kwargs[(typeof attr === "number" && attr < 0) ? kwargs.length + attr : attr];
  4470. if (callable(val)) {
  4471. if (str.startswith(attr, "on")) {
  4472. attr = attr.slice(2);
  4473. }
  4474. ans.addEventListener(attr, val);
  4475. } else if (val === true) {
  4476. ans.setAttribute(vattr, vattr);
  4477. } else if (typeof val === "string") {
  4478. ans.setAttribute(vattr, val);
  4479. }
  4480. }
  4481. var ρσ_Iter1 = ρσ_Iterable(args);
  4482. for (var ρσ_Index1 = 0; ρσ_Index1 < ρσ_Iter1.length; ρσ_Index1++) {
  4483. arg = ρσ_Iter1[ρσ_Index1];
  4484. if (typeof arg === "string") {
  4485. arg = this.createTextNode(arg);
  4486. }
  4487. ans.appendChild(arg);
  4488. }
  4489. return ans;
  4490. };
  4491. if (!_makeelement.__handles_kwarg_interpolation__) Object.defineProperties(_makeelement, {
  4492. __handles_kwarg_interpolation__ : {value: true},
  4493. __argnames__ : {value: ["tag"]},
  4494. __module__ : {value: "elementmaker"}
  4495. });
  4496. function maker_for_document(document) {
  4497. var E;
  4498. E = _makeelement.bind(document);
  4499. Object.defineProperties(E, (function() {
  4500. var ρσ_Iter = ρσ_Iterable(html5_tags), ρσ_Result = {}, tag;
  4501. for (var ρσ_Index = 0; ρσ_Index < ρσ_Iter.length; ρσ_Index++) {
  4502. tag = ρσ_Iter[ρσ_Index];
  4503. ρσ_Result[tag] = ((function(){
  4504. var ρσ_d = {};
  4505. ρσ_d["value"] = _makeelement.bind(document, tag);
  4506. return ρσ_d;
  4507. }).call(this));
  4508. }
  4509. return ρσ_Result;
  4510. })());
  4511. return E;
  4512. };
  4513. if (!maker_for_document.__argnames__) Object.defineProperties(maker_for_document, {
  4514. __argnames__ : {value: ["document"]},
  4515. __module__ : {value: "elementmaker"}
  4516. });
  4517. if (typeof document === "undefined") {
  4518. E = maker_for_document((function(){
  4519. var ρσ_d = {};
  4520. ρσ_d["createTextNode"] = (function() {
  4521. var ρσ_anonfunc = function (value) {
  4522. return value;
  4523. };
  4524. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  4525. __argnames__ : {value: ["value"]},
  4526. __module__ : {value: "elementmaker"}
  4527. });
  4528. return ρσ_anonfunc;
  4529. })();
  4530. ρσ_d["createElement"] = (function() {
  4531. var ρσ_anonfunc = function (name) {
  4532. return (function(){
  4533. var ρσ_d = {};
  4534. ρσ_d["name"] = name;
  4535. ρσ_d["children"] = ρσ_list_decorate([]);
  4536. ρσ_d["attributes"] = {};
  4537. ρσ_d["setAttribute"] = (function() {
  4538. var ρσ_anonfunc = function (name, val) {
  4539. (ρσ_expr_temp = this.attributes)[(typeof name === "number" && name < 0) ? ρσ_expr_temp.length + name : name] = val;
  4540. };
  4541. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  4542. __argnames__ : {value: ["name", "val"]},
  4543. __module__ : {value: "elementmaker"}
  4544. });
  4545. return ρσ_anonfunc;
  4546. })();
  4547. ρσ_d["appendChild"] = (function() {
  4548. var ρσ_anonfunc = function (child) {
  4549. this.children.push(child);
  4550. };
  4551. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  4552. __argnames__ : {value: ["child"]},
  4553. __module__ : {value: "elementmaker"}
  4554. });
  4555. return ρσ_anonfunc;
  4556. })();
  4557. return ρσ_d;
  4558. }).call(this);
  4559. };
  4560. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  4561. __argnames__ : {value: ["name"]},
  4562. __module__ : {value: "elementmaker"}
  4563. });
  4564. return ρσ_anonfunc;
  4565. })();
  4566. return ρσ_d;
  4567. }).call(this));
  4568. } else {
  4569. E = maker_for_document(document);
  4570. }
  4571. ρσ_modules.elementmaker.html_elements = html_elements;
  4572. ρσ_modules.elementmaker.mathml_elements = mathml_elements;
  4573. ρσ_modules.elementmaker.svg_elements = svg_elements;
  4574. ρσ_modules.elementmaker.html5_tags = html5_tags;
  4575. ρσ_modules.elementmaker.E = E;
  4576. ρσ_modules.elementmaker._makeelement = _makeelement;
  4577. ρσ_modules.elementmaker.maker_for_document = maker_for_document;
  4578. })();
  4579. (function(){
  4580. var __name__ = "fs_images";
  4581. function is_svg_fs_markup(names, svg) {
  4582. if (svg !== null) {
  4583. if (names.length === 2 || names.length === 3) {
  4584. if (names[names.length-1] === "image" && names[names.length-2] === "svg") {
  4585. if (names.length === 2 || names[0] === "div") {
  4586. if (svg.width === "100%" && svg.height === "100%") {
  4587. return true;
  4588. }
  4589. }
  4590. }
  4591. }
  4592. }
  4593. return false;
  4594. };
  4595. if (!is_svg_fs_markup.__argnames__) Object.defineProperties(is_svg_fs_markup, {
  4596. __argnames__ : {value: ["names", "svg"]},
  4597. __module__ : {value: "fs_images"}
  4598. });
  4599. function fix_fullscreen_svg_images() {
  4600. var child_names, name, node, names, svg;
  4601. child_names = [];
  4602. var ρσ_Iter0 = ρσ_Iterable(document.body.childNodes);
  4603. for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) {
  4604. node = ρσ_Iter0[ρσ_Index0];
  4605. if (node.tagName) {
  4606. name = node.tagName.toLowerCase();
  4607. if (name !== "style" && name !== "script") {
  4608. child_names.push(name);
  4609. }
  4610. if (child_names.length > 1) {
  4611. break;
  4612. }
  4613. }
  4614. }
  4615. if (child_names.length === 1 && (child_names[0] === "div" || child_names[0] === "svg")) {
  4616. names = [];
  4617. svg = null;
  4618. var ρσ_Iter1 = ρσ_Iterable(document.body.querySelectorAll("*"));
  4619. for (var ρσ_Index1 = 0; ρσ_Index1 < ρσ_Iter1.length; ρσ_Index1++) {
  4620. node = ρσ_Iter1[ρσ_Index1];
  4621. if (node.tagName) {
  4622. name = node.tagName.toLowerCase();
  4623. if (name !== "style" && name !== "script") {
  4624. names.push(name);
  4625. if (name === "svg") {
  4626. svg = node;
  4627. }
  4628. }
  4629. }
  4630. }
  4631. if (is_svg_fs_markup(names, svg)) {
  4632. svg.setAttribute("width", "100vw");
  4633. svg.setAttribute("height", "100vh");
  4634. }
  4635. }
  4636. };
  4637. if (!fix_fullscreen_svg_images.__module__) Object.defineProperties(fix_fullscreen_svg_images, {
  4638. __module__ : {value: "fs_images"}
  4639. });
  4640. ρσ_modules.fs_images.is_svg_fs_markup = is_svg_fs_markup;
  4641. ρσ_modules.fs_images.fix_fullscreen_svg_images = fix_fullscreen_svg_images;
  4642. })();
  4643. (function(){
  4644. var __name__ = "live_css";
  4645. var INHERITED_PROPS;
  4646. INHERITED_PROPS = (function(){
  4647. var ρσ_d = Object.create(null);
  4648. ρσ_d["azimuth"] = "2";
  4649. ρσ_d["border-collapse"] = "2";
  4650. ρσ_d["border-spacing"] = "2";
  4651. ρσ_d["caption-side"] = "2";
  4652. ρσ_d["color"] = "2";
  4653. ρσ_d["cursor"] = "2";
  4654. ρσ_d["direction"] = "2";
  4655. ρσ_d["elevation"] = "2";
  4656. ρσ_d["empty-cells"] = "2";
  4657. ρσ_d["fit"] = "3";
  4658. ρσ_d["fit-position"] = "3";
  4659. ρσ_d["font"] = "2";
  4660. ρσ_d["font-family"] = "2";
  4661. ρσ_d["font-size"] = "2";
  4662. ρσ_d["font-size-adjust"] = "2";
  4663. ρσ_d["font-stretch"] = "2";
  4664. ρσ_d["font-style"] = "2";
  4665. ρσ_d["font-variant"] = "2";
  4666. ρσ_d["font-weight"] = "2";
  4667. ρσ_d["hanging-punctuation"] = "3";
  4668. ρσ_d["hyphenate-after"] = "3";
  4669. ρσ_d["hyphenate-before"] = "3";
  4670. ρσ_d["hyphenate-character"] = "3";
  4671. ρσ_d["hyphenate-lines"] = "3";
  4672. ρσ_d["hyphenate-resource"] = "3";
  4673. ρσ_d["hyphens"] = "3";
  4674. ρσ_d["image-resolution"] = "3";
  4675. ρσ_d["letter-spacing"] = "2";
  4676. ρσ_d["line-height"] = "2";
  4677. ρσ_d["line-stacking"] = "3";
  4678. ρσ_d["line-stacking-ruby"] = "3";
  4679. ρσ_d["line-stacking-shift"] = "3";
  4680. ρσ_d["line-stacking-strategy"] = "3";
  4681. ρσ_d["list-style"] = "2";
  4682. ρσ_d["list-style-image"] = "2";
  4683. ρσ_d["list-style-position"] = "2";
  4684. ρσ_d["list-style-type"] = "2";
  4685. ρσ_d["marquee-direction"] = "3";
  4686. ρσ_d["orphans"] = "2";
  4687. ρσ_d["overflow-style"] = "3";
  4688. ρσ_d["page"] = "2";
  4689. ρσ_d["page-break-inside"] = "2";
  4690. ρσ_d["pitch"] = "2";
  4691. ρσ_d["pitch-range"] = "2";
  4692. ρσ_d["presentation-level"] = "3";
  4693. ρσ_d["punctuation-trim"] = "3";
  4694. ρσ_d["quotes"] = "2";
  4695. ρσ_d["richness"] = "2";
  4696. ρσ_d["ruby-align"] = "3";
  4697. ρσ_d["ruby-overhang"] = "3";
  4698. ρσ_d["ruby-position"] = "3";
  4699. ρσ_d["speak"] = "2";
  4700. ρσ_d["speak-header"] = "2";
  4701. ρσ_d["speak-numeral"] = "2";
  4702. ρσ_d["speak-punctuation"] = "2";
  4703. ρσ_d["speech-rate"] = "2";
  4704. ρσ_d["stress"] = "2";
  4705. ρσ_d["text-align"] = "2";
  4706. ρσ_d["text-align-last"] = "3";
  4707. ρσ_d["text-emphasis"] = "3";
  4708. ρσ_d["text-height"] = "3";
  4709. ρσ_d["text-indent"] = "2";
  4710. ρσ_d["text-justify"] = "3";
  4711. ρσ_d["text-outline"] = "3";
  4712. ρσ_d["text-replace"] = "?";
  4713. ρσ_d["text-shadow"] = "3";
  4714. ρσ_d["text-transform"] = "2";
  4715. ρσ_d["text-wrap"] = "3";
  4716. ρσ_d["visibility"] = "2";
  4717. ρσ_d["voice-balance"] = "3";
  4718. ρσ_d["voice-family"] = "2";
  4719. ρσ_d["voice-rate"] = "3";
  4720. ρσ_d["voice-pitch"] = "3";
  4721. ρσ_d["voice-pitch-range"] = "3";
  4722. ρσ_d["voice-stress"] = "3";
  4723. ρσ_d["voice-volume"] = "3";
  4724. ρσ_d["volume"] = "2";
  4725. ρσ_d["white-space"] = "2";
  4726. ρσ_d["white-space-collapse"] = "3";
  4727. ρσ_d["widows"] = "2";
  4728. ρσ_d["word-break"] = "3";
  4729. ρσ_d["word-spacing"] = "2";
  4730. ρσ_d["word-wrap"] = "3";
  4731. ρσ_d["-moz-force-broken-image-icon"] = "m";
  4732. ρσ_d["-moz-image-region"] = "m";
  4733. ρσ_d["-moz-stack-sizing"] = "m";
  4734. ρσ_d["-moz-user-input"] = "m";
  4735. ρσ_d["-x-system-font"] = "m";
  4736. ρσ_d["-xv-voice-balance"] = "o";
  4737. ρσ_d["-xv-voice-pitch"] = "o";
  4738. ρσ_d["-xv-voice-pitch-range"] = "o";
  4739. ρσ_d["-xv-voice-rate"] = "o";
  4740. ρσ_d["-xv-voice-stress"] = "o";
  4741. ρσ_d["-xv-voice-volume"] = "o";
  4742. ρσ_d["-ms-text-align-last"] = "e";
  4743. ρσ_d["-ms-text-justify"] = "e";
  4744. ρσ_d["-ms-word-break"] = "e";
  4745. ρσ_d["-ms-word-wrap"] = "e";
  4746. return ρσ_d;
  4747. }).call(this);
  4748. function get_sourceline_address(node) {
  4749. var sourceline, tags, elem;
  4750. sourceline = parseInt(node.dataset.lnum);
  4751. tags = [];
  4752. var ρσ_Iter0 = ρσ_Iterable(document.querySelectorAll("[data-lnum=\"" + ρσ_str.format("{}", sourceline) + "\"]"));
  4753. for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) {
  4754. elem = ρσ_Iter0[ρσ_Index0];
  4755. tags.push(elem.tagName.toLowerCase());
  4756. if (elem === node) {
  4757. break;
  4758. }
  4759. }
  4760. return [sourceline, tags];
  4761. };
  4762. if (!get_sourceline_address.__argnames__) Object.defineProperties(get_sourceline_address, {
  4763. __argnames__ : {value: ["node"]},
  4764. __module__ : {value: "live_css"}
  4765. });
  4766. function get_color(property, val) {
  4767. var color;
  4768. color = null;
  4769. if (property.indexOf("color") > -1) {
  4770. try {
  4771. color = window.parseCSSColor(val);
  4772. } catch (ρσ_Exception) {
  4773. ρσ_last_exception = ρσ_Exception;
  4774. {
  4775. }
  4776. }
  4777. }
  4778. return color;
  4779. };
  4780. if (!get_color.__argnames__) Object.defineProperties(get_color, {
  4781. __argnames__ : {value: ["property", "val"]},
  4782. __module__ : {value: "live_css"}
  4783. });
  4784. function get_style_properties(style, all_properties, node_style, is_ancestor) {
  4785. var i, properties, property, val, cval;
  4786. i = 0;
  4787. properties = [];
  4788. while (i < style.length) {
  4789. property = style.item(i);
  4790. if (property) {
  4791. property = property.toLowerCase();
  4792. val = style.getPropertyValue(property);
  4793. } else {
  4794. val = null;
  4795. }
  4796. if (property && val && (!is_ancestor || INHERITED_PROPS[(typeof property === "number" && property < 0) ? INHERITED_PROPS.length + property : property])) {
  4797. properties.push([property, val, style.getPropertyPriority(property), get_color(property, val)]);
  4798. if (!all_properties[(typeof property === "number" && property < 0) ? all_properties.length + property : property]) {
  4799. cval = node_style.getPropertyValue(property);
  4800. cval;
  4801. all_properties[(typeof property === "number" && property < 0) ? all_properties.length + property : property] = [cval, get_color(property, cval)];
  4802. }
  4803. }
  4804. i += 1;
  4805. }
  4806. return properties;
  4807. };
  4808. if (!get_style_properties.__argnames__) Object.defineProperties(get_style_properties, {
  4809. __argnames__ : {value: ["style", "all_properties", "node_style", "is_ancestor"]},
  4810. __module__ : {value: "live_css"}
  4811. });
  4812. function get_sheet_rules(sheet) {
  4813. var sheet_media;
  4814. if (sheet.disabled || !sheet.cssRules) {
  4815. return [];
  4816. }
  4817. sheet_media = sheet.media && sheet.media.mediaText;
  4818. if (sheet_media && sheet_media.length && !window.matchMedia(sheet_media).matches) {
  4819. return [];
  4820. }
  4821. return sheet.cssRules;
  4822. };
  4823. if (!get_sheet_rules.__argnames__) Object.defineProperties(get_sheet_rules, {
  4824. __argnames__ : {value: ["sheet"]},
  4825. __module__ : {value: "live_css"}
  4826. });
  4827. function selector_matches(node, selector) {
  4828. var sanitized_sel;
  4829. try {
  4830. return node.matches(selector);
  4831. } catch (ρσ_Exception) {
  4832. ρσ_last_exception = ρσ_Exception;
  4833. {
  4834. if (ρσ_in("epub|", selector)) {
  4835. sanitized_sel = str.replace(selector, "epub|", "*|");
  4836. try {
  4837. return node.matches(sanitized_sel);
  4838. } catch (ρσ_Exception) {
  4839. ρσ_last_exception = ρσ_Exception;
  4840. {
  4841. return false;
  4842. }
  4843. }
  4844. }
  4845. return false;
  4846. }
  4847. }
  4848. };
  4849. if (!selector_matches.__argnames__) Object.defineProperties(selector_matches, {
  4850. __argnames__ : {value: ["node", "selector"]},
  4851. __module__ : {value: "live_css"}
  4852. });
  4853. function process_rules(node, rules, address, sheet, sheet_index, all_properties, node_style, is_ancestor, ans) {
  4854. var offset, rule, rule_address, st, type, href, parts, q, properties, data, rule_index;
  4855. offset = 0;
  4856. for (var ρσ_Index1 = 0; ρσ_Index1 < rules.length; ρσ_Index1++) {
  4857. rule_index = ρσ_Index1;
  4858. rule = rules[(typeof rule_index === "number" && rule_index < 0) ? rules.length + rule_index : rule_index];
  4859. rule_address = address.concat([rule_index - offset]);
  4860. if (rule.type === CSSRule.MEDIA_RULE) {
  4861. process_rules(node, rule.cssRules, rule_address, sheet, sheet_index, all_properties, node_style, is_ancestor, ans);
  4862. continue;
  4863. }
  4864. if (rule.type !== CSSRule.STYLE_RULE) {
  4865. if (rule.type === CSSRule.NAMESPACE_RULE) {
  4866. offset += 1;
  4867. }
  4868. continue;
  4869. }
  4870. st = rule.selectorText;
  4871. if (!selector_matches(node, st)) {
  4872. continue;
  4873. }
  4874. type = "sheet";
  4875. href = sheet.href;
  4876. if (!href) {
  4877. href = get_sourceline_address(sheet.ownerNode);
  4878. type = "elem";
  4879. }
  4880. parts = st.split(",");
  4881. if (parts.length > 1) {
  4882. var ρσ_Iter2 = ρσ_Iterable(parts);
  4883. for (var ρσ_Index2 = 0; ρσ_Index2 < ρσ_Iter2.length; ρσ_Index2++) {
  4884. q = ρσ_Iter2[ρσ_Index2];
  4885. if (selector_matches(node, q)) {
  4886. st = q;
  4887. break;
  4888. }
  4889. }
  4890. }
  4891. properties = get_style_properties(rule.style, all_properties, node_style, is_ancestor);
  4892. if (properties.length > 0) {
  4893. data = (function(){
  4894. var ρσ_d = Object.create(null);
  4895. ρσ_d["selector"] = st;
  4896. ρσ_d["type"] = type;
  4897. ρσ_d["href"] = href;
  4898. ρσ_d["properties"] = properties;
  4899. ρσ_d["rule_address"] = rule_address;
  4900. ρσ_d["sheet_index"] = sheet_index;
  4901. return ρσ_d;
  4902. }).call(this);
  4903. ans.push(data);
  4904. }
  4905. }
  4906. };
  4907. if (!process_rules.__argnames__) Object.defineProperties(process_rules, {
  4908. __argnames__ : {value: ["node", "rules", "address", "sheet", "sheet_index", "all_properties", "node_style", "is_ancestor", "ans"]},
  4909. __module__ : {value: "live_css"}
  4910. });
  4911. function get_matched_css(node, is_ancestor, all_properties) {
  4912. var ans, node_style, sheets, sheet, sheet_index, properties, data;
  4913. ans = [];
  4914. node_style = window.getComputedStyle(node);
  4915. sheets = document.styleSheets;
  4916. for (var ρσ_Index3 = 0; ρσ_Index3 < sheets.length; ρσ_Index3++) {
  4917. sheet_index = ρσ_Index3;
  4918. sheet = sheets[(typeof sheet_index === "number" && sheet_index < 0) ? sheets.length + sheet_index : sheet_index];
  4919. process_rules(node, get_sheet_rules(sheet), [], sheet, sheet_index, all_properties, node_style, is_ancestor, ans);
  4920. }
  4921. if (node.getAttribute("style")) {
  4922. properties = get_style_properties(node.style, all_properties, node_style, is_ancestor);
  4923. if (properties.length > 0) {
  4924. data = (function(){
  4925. var ρσ_d = Object.create(null);
  4926. ρσ_d["selector"] = null;
  4927. ρσ_d["type"] = "inline";
  4928. ρσ_d["href"] = get_sourceline_address(node);
  4929. ρσ_d["properties"] = properties;
  4930. ρσ_d["rule_address"] = null;
  4931. ρσ_d["sheet_index"] = null;
  4932. return ρσ_d;
  4933. }).call(this);
  4934. ans.push(data);
  4935. }
  4936. }
  4937. return ans.reverse();
  4938. };
  4939. if (!get_matched_css.__argnames__) Object.defineProperties(get_matched_css, {
  4940. __argnames__ : {value: ["node", "is_ancestor", "all_properties"]},
  4941. __module__ : {value: "live_css"}
  4942. });
  4943. ρσ_modules.live_css.INHERITED_PROPS = INHERITED_PROPS;
  4944. ρσ_modules.live_css.get_sourceline_address = get_sourceline_address;
  4945. ρσ_modules.live_css.get_color = get_color;
  4946. ρσ_modules.live_css.get_style_properties = get_style_properties;
  4947. ρσ_modules.live_css.get_sheet_rules = get_sheet_rules;
  4948. ρσ_modules.live_css.selector_matches = selector_matches;
  4949. ρσ_modules.live_css.process_rules = process_rules;
  4950. ρσ_modules.live_css.get_matched_css = get_matched_css;
  4951. })();
  4952. (function(){
  4953. var __name__ = "qt";
  4954. var special_title, slots, to_python;
  4955. special_title = "__webengine_messages_pending__";
  4956. slots = Object.create(null);
  4957. function ping(suffix) {
  4958. document.title = special_title + suffix;
  4959. };
  4960. if (!ping.__argnames__) Object.defineProperties(ping, {
  4961. __argnames__ : {value: ["suffix"]},
  4962. __module__ : {value: "qt"}
  4963. });
  4964. function signal() {
  4965. var args;
  4966. args = Array.from(arguments);
  4967. to_python._queue_message((function(){
  4968. var ρσ_d = Object.create(null);
  4969. ρσ_d["type"] = "signal";
  4970. ρσ_d["name"] = this;
  4971. ρσ_d["args"] = args;
  4972. return ρσ_d;
  4973. }).call(this));
  4974. };
  4975. if (!signal.__module__) Object.defineProperties(signal, {
  4976. __module__ : {value: "qt"}
  4977. });
  4978. function ToPython() {
  4979. if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
  4980. ToPython.prototype.__bind_methods__.call(this);
  4981. ToPython.prototype.__init__.apply(this, arguments);
  4982. }
  4983. Object.defineProperty(ToPython.prototype, "__bind_methods__", {value: function () {
  4984. this._ping = ToPython.prototype._ping.bind(this);
  4985. this._queue_message = ToPython.prototype._queue_message.bind(this);
  4986. this._register_signals = ToPython.prototype._register_signals.bind(this);
  4987. this._poll = ToPython.prototype._poll.bind(this);
  4988. this._from_python = ToPython.prototype._from_python.bind(this);
  4989. }});
  4990. ToPython.prototype.__init__ = function __init__() {
  4991. var self = this;
  4992. self._messages = [];
  4993. self._last_ping_value = 0;
  4994. self._ping_timer_id = -1;
  4995. self._queue_message((function(){
  4996. var ρσ_d = Object.create(null);
  4997. ρσ_d["type"] = "qt-ready";
  4998. return ρσ_d;
  4999. }).call(this));
  5000. };
  5001. if (!ToPython.prototype.__init__.__module__) Object.defineProperties(ToPython.prototype.__init__, {
  5002. __module__ : {value: "qt"}
  5003. });
  5004. ToPython.__argnames__ = ToPython.prototype.__init__.__argnames__;
  5005. ToPython.__handles_kwarg_interpolation__ = ToPython.prototype.__init__.__handles_kwarg_interpolation__;
  5006. ToPython.prototype._ping = function _ping() {
  5007. var self = this;
  5008. if (self._ping_timer_id < 0) {
  5009. self._last_ping_value = (self._last_ping_value) ? 0 : 1;
  5010. self._ping_timer_id = setTimeout((function() {
  5011. var ρσ_anonfunc = function () {
  5012. ping(self._last_ping_value);
  5013. self._ping_timer_id = -1;
  5014. };
  5015. if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
  5016. __module__ : {value: "qt"}
  5017. });
  5018. return ρσ_anonfunc;
  5019. })(), 0);
  5020. }
  5021. };
  5022. if (!ToPython.prototype._ping.__module__) Object.defineProperties(ToPython.prototype._ping, {
  5023. __module__ : {value: "qt"}
  5024. });
  5025. ToPython.prototype._queue_message = function _queue_message(msg) {
  5026. var self = this;
  5027. self._messages.push(msg);
  5028. self._ping();
  5029. };
  5030. if (!ToPython.prototype._queue_message.__argnames__) Object.defineProperties(ToPython.prototype._queue_message, {
  5031. __argnames__ : {value: ["msg"]},
  5032. __module__ : {value: "qt"}
  5033. });
  5034. ToPython.prototype._register_signals = function _register_signals(signals) {
  5035. var self = this;
  5036. var signal_name;
  5037. var ρσ_Iter0 = ρσ_Iterable(signals);
  5038. for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) {
  5039. signal_name = ρσ_Iter0[ρσ_Index0];
  5040. self[(typeof signal_name === "number" && signal_name < 0) ? self.length + signal_name : signal_name] = signal.bind(signal_name);
  5041. }
  5042. };
  5043. if (!ToPython.prototype._register_signals.__argnames__) Object.defineProperties(ToPython.prototype._register_signals, {
  5044. __argnames__ : {value: ["signals"]},
  5045. __module__ : {value: "qt"}
  5046. });
  5047. ToPython.prototype._poll = function _poll() {
  5048. var self = this;
  5049. var ans;
  5050. ans = self._messages;
  5051. self._messages = [];
  5052. return ans;
  5053. };
  5054. if (!ToPython.prototype._poll.__module__) Object.defineProperties(ToPython.prototype._poll, {
  5055. __module__ : {value: "qt"}
  5056. });
  5057. ToPython.prototype._from_python = function _from_python(name, args) {
  5058. var self = this;
  5059. var callback;
  5060. callback = slots[(typeof name === "number" && name < 0) ? slots.length + name : name];
  5061. if (callback) {
  5062. callback.apply(null, args);
  5063. } else {
  5064. console.warn("Attempt to call non-existent python-to-js slot named: " + ρσ_str.format("{}", name) + "");
  5065. }
  5066. };
  5067. if (!ToPython.prototype._from_python.__argnames__) Object.defineProperties(ToPython.prototype._from_python, {
  5068. __argnames__ : {value: ["name", "args"]},
  5069. __module__ : {value: "qt"}
  5070. });
  5071. ToPython.prototype.__repr__ = function __repr__ () {
  5072. return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
  5073. };
  5074. ToPython.prototype.__str__ = function __str__ () {
  5075. return this.__repr__();
  5076. };
  5077. Object.defineProperty(ToPython.prototype, "__bases__", {value: []});
  5078. to_python = null;
  5079. if (window === window.top) {
  5080. window.python_comm = to_python = new ToPython;
  5081. }
  5082. function from_python(func) {
  5083. slots[ρσ_bound_index(func.name, slots)] = func;
  5084. };
  5085. if (!from_python.__argnames__) Object.defineProperties(from_python, {
  5086. __argnames__ : {value: ["func"]},
  5087. __module__ : {value: "qt"}
  5088. });
  5089. ρσ_modules.qt.special_title = special_title;
  5090. ρσ_modules.qt.slots = slots;
  5091. ρσ_modules.qt.to_python = to_python;
  5092. ρσ_modules.qt.ping = ping;
  5093. ρσ_modules.qt.signal = signal;
  5094. ρσ_modules.qt.ToPython = ToPython;
  5095. ρσ_modules.qt.from_python = from_python;
  5096. })();
  5097. (function(){
  5098. var __name__ = "__main__";
  5099. var FAKE_HOST, FAKE_PROTOCOL, state, settings, css;
  5100. var E = ρσ_modules.elementmaker.E;
  5101. var fix_fullscreen_svg_images = ρσ_modules.fs_images.fix_fullscreen_svg_images;
  5102. var get_matched_css = ρσ_modules.live_css.get_matched_css;
  5103. var get_sourceline_address = ρσ_modules.live_css.get_sourceline_address;
  5104. var from_python = ρσ_modules.qt.from_python;
  5105. var to_python = ρσ_modules.qt.to_python;
  5106. FAKE_HOST = "internal.invalid";
  5107. FAKE_PROTOCOL = "clbr";
  5108. function is_hidden(elem) {
  5109. while (elem) {
  5110. if (elem.style && (elem.style.visibility === "hidden" || elem.style.display === "none")) {
  5111. return true;
  5112. }
  5113. elem = elem.parentNode;
  5114. }
  5115. return false;
  5116. };
  5117. if (!is_hidden.__argnames__) Object.defineProperties(is_hidden, {
  5118. __argnames__ : {value: ["elem"]},
  5119. __module__ : {value: null}
  5120. });
  5121. function is_block(elem) {
  5122. var style;
  5123. style = window.getComputedStyle(elem);
  5124. return style.display === "block" || style.display === "flex-box" || style.display === "box";
  5125. };
  5126. if (!is_block.__argnames__) Object.defineProperties(is_block, {
  5127. __argnames__ : {value: ["elem"]},
  5128. __module__ : {value: null}
  5129. });
  5130. function in_table(elem) {
  5131. var tn;
  5132. while (elem) {
  5133. tn = (elem.tagName) ? elem.tagName.toLowerCase() : "";
  5134. if (tn === "table") {
  5135. return true;
  5136. }
  5137. elem = elem.parentNode;
  5138. }
  5139. return false;
  5140. };
  5141. if (!in_table.__argnames__) Object.defineProperties(in_table, {
  5142. __argnames__ : {value: ["elem"]},
  5143. __module__ : {value: null}
  5144. });
  5145. function find_containing_block(elem) {
  5146. while (elem && elem.dataset.isBlock !== "1") {
  5147. elem = elem.parentNode;
  5148. }
  5149. return elem;
  5150. };
  5151. if (!find_containing_block.__argnames__) Object.defineProperties(find_containing_block, {
  5152. __argnames__ : {value: ["elem"]},
  5153. __module__ : {value: null}
  5154. });
  5155. function line_height() {
  5156. var ans, ds, lh;
  5157. ans = line_height.ans;
  5158. if (!ans) {
  5159. ds = window.getComputedStyle(document.body);
  5160. try {
  5161. lh = float(ds.lineHeight);
  5162. } catch (ρσ_Exception) {
  5163. ρσ_last_exception = ρσ_Exception;
  5164. {
  5165. try {
  5166. lh = 1.2 * float(ds.fontSize);
  5167. } catch (ρσ_Exception) {
  5168. ρσ_last_exception = ρσ_Exception;
  5169. {
  5170. lh = 15;
  5171. }
  5172. }
  5173. }
  5174. }
  5175. ans = line_height.ans = max(5, lh);
  5176. }
  5177. return ans;
  5178. };
  5179. if (!line_height.__module__) Object.defineProperties(line_height, {
  5180. __module__ : {value: null}
  5181. });
  5182. function scroll_to_node(node, sync_context) {
  5183. if (node === document.body) {
  5184. window.scrollTo(0, 0);
  5185. } else {
  5186. node.scrollIntoView();
  5187. if (sync_context) {
  5188. window.scrollBy(0, -sync_context * line_height());
  5189. }
  5190. }
  5191. };
  5192. if (!scroll_to_node.__argnames__) Object.defineProperties(scroll_to_node, {
  5193. __argnames__ : {value: ["node", "sync_context"]},
  5194. __module__ : {value: null}
  5195. });
  5196. state = (function(){
  5197. var ρσ_d = Object.create(null);
  5198. ρσ_d["blocks_found"] = false;
  5199. ρσ_d["in_split_mode"] = false;
  5200. return ρσ_d;
  5201. }).call(this);
  5202. function go_to_line(lnum, sync_context) {
  5203. var node;
  5204. var ρσ_Iter0 = ρσ_Iterable(document.querySelectorAll("[data-lnum=\"" + ρσ_str.format("{}", lnum) + "\"]"));
  5205. for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) {
  5206. node = ρσ_Iter0[ρσ_Index0];
  5207. if (is_hidden(node)) {
  5208. continue;
  5209. }
  5210. scroll_to_node(node, sync_context);
  5211. break;
  5212. }
  5213. };
  5214. if (!go_to_line.__argnames__) Object.defineProperties(go_to_line, {
  5215. __argnames__ : {value: ["lnum", "sync_context"]},
  5216. __module__ : {value: null}
  5217. });
  5218. var go_to_sourceline_address = from_python((function() {
  5219. var ρσ_anonfunc = function go_to_sourceline_address(sourceline, tags, sync_context) {
  5220. var nodes, node, index;
  5221. nodes = document.querySelectorAll("[data-lnum=\"" + ρσ_str.format("{}", sourceline) + "\"]");
  5222. for (var ρσ_Index1 = 0; ρσ_Index1 < nodes.length; ρσ_Index1++) {
  5223. index = ρσ_Index1;
  5224. node = nodes[(typeof index === "number" && index < 0) ? nodes.length + index : index];
  5225. if (index >= tags.length || node.tagName.toLowerCase() !== tags[(typeof index === "number" && index < 0) ? tags.length + index : index]) {
  5226. break;
  5227. }
  5228. if (ρσ_equals(index, tags.length - 1) && !is_hidden(node)) {
  5229. return scroll_to_node(node, sync_context);
  5230. }
  5231. }
  5232. go_to_line(sourceline, sync_context);
  5233. };
  5234. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  5235. __argnames__ : {value: ["sourceline", "tags", "sync_context"]},
  5236. __module__ : {value: null}
  5237. });
  5238. return ρσ_anonfunc;
  5239. })());
  5240. function line_numbers() {
  5241. var found_body, ans, node;
  5242. found_body = false;
  5243. ans = [];
  5244. var ρσ_Iter2 = ρσ_Iterable(document.getElementsByTagName("*"));
  5245. for (var ρσ_Index2 = 0; ρσ_Index2 < ρσ_Iter2.length; ρσ_Index2++) {
  5246. node = ρσ_Iter2[ρσ_Index2];
  5247. if (!found_body && node.tagName.toLowerCase() === "body") {
  5248. found_body = true;
  5249. }
  5250. if (found_body) {
  5251. ans.push(node.dataset.lnum);
  5252. }
  5253. }
  5254. return ans;
  5255. };
  5256. if (!line_numbers.__module__) Object.defineProperties(line_numbers, {
  5257. __module__ : {value: null}
  5258. });
  5259. function find_blocks() {
  5260. var elem;
  5261. if (state.blocks_found) {
  5262. return;
  5263. }
  5264. var ρσ_Iter3 = ρσ_Iterable(document.body.getElementsByTagName("*"));
  5265. for (var ρσ_Index3 = 0; ρσ_Index3 < ρσ_Iter3.length; ρσ_Index3++) {
  5266. elem = ρσ_Iter3[ρσ_Index3];
  5267. if (is_block(elem) && !in_table(elem)) {
  5268. elem.setAttribute("data-is-block", "1");
  5269. }
  5270. }
  5271. state.blocks_found = true;
  5272. };
  5273. if (!find_blocks.__module__) Object.defineProperties(find_blocks, {
  5274. __module__ : {value: null}
  5275. });
  5276. var set_split_mode = from_python((function() {
  5277. var ρσ_anonfunc = function set_split_mode(enabled) {
  5278. state.in_split_mode = enabled;
  5279. document.body.dataset.inSplitMode = (enabled) ? "1" : "0";
  5280. if (enabled) {
  5281. find_blocks();
  5282. }
  5283. };
  5284. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  5285. __argnames__ : {value: ["enabled"]},
  5286. __module__ : {value: null}
  5287. });
  5288. return ρσ_anonfunc;
  5289. })());
  5290. function report_split(node) {
  5291. var loc, totals, parent, num, sibling;
  5292. loc = [];
  5293. totals = [];
  5294. parent = find_containing_block(node);
  5295. while (parent && parent.tagName.toLowerCase() !== "body") {
  5296. totals.push(parent.parentNode.children.length);
  5297. num = 0;
  5298. sibling = parent.previousElementSibling;
  5299. while (sibling) {
  5300. num += 1;
  5301. sibling = sibling.previousElementSibling;
  5302. }
  5303. loc.push(num);
  5304. parent = parent.parentNode;
  5305. }
  5306. loc.reverse();
  5307. totals.reverse();
  5308. to_python.request_split(loc, totals);
  5309. };
  5310. if (!report_split.__argnames__) Object.defineProperties(report_split, {
  5311. __argnames__ : {value: ["node"]},
  5312. __module__ : {value: null}
  5313. });
  5314. function onclick(event) {
  5315. var e, address, href, tn;
  5316. event.preventDefault();
  5317. if (state.in_split_mode) {
  5318. report_split(event.target);
  5319. } else {
  5320. e = event.target;
  5321. address = get_sourceline_address(e);
  5322. href = tn = "";
  5323. while (e && e !== document.body && e !== document && e !== document.documentElement && (tn !== "a" || !href)) {
  5324. tn = (e.tagName) ? e.tagName.toLowerCase() : "";
  5325. href = e.getAttribute("href");
  5326. e = e.parentNode;
  5327. }
  5328. if (to_python.request_sync) {
  5329. to_python.request_sync(tn, href, address);
  5330. }
  5331. }
  5332. return false;
  5333. };
  5334. if (!onclick.__argnames__) Object.defineProperties(onclick, {
  5335. __argnames__ : {value: ["event"]},
  5336. __module__ : {value: null}
  5337. });
  5338. var go_to_anchor = from_python((function() {
  5339. var ρσ_anonfunc = function go_to_anchor(anchor) {
  5340. var elem, address;
  5341. elem = document.getElementById(anchor);
  5342. if (!elem) {
  5343. elem = document.querySelector("[name=\"" + ρσ_str.format("{}", anchor) + "\"]");
  5344. }
  5345. if (elem) {
  5346. elem.scrollIntoView();
  5347. address = get_sourceline_address(elem);
  5348. if (to_python.request_sync) {
  5349. to_python.request_sync("", "", address);
  5350. }
  5351. }
  5352. };
  5353. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  5354. __argnames__ : {value: ["anchor"]},
  5355. __module__ : {value: null}
  5356. });
  5357. return ρσ_anonfunc;
  5358. })());
  5359. var live_css = from_python((function() {
  5360. var ρσ_anonfunc = function live_css(editor_name, sourceline, tags) {
  5361. var all_properties, ans, target, i, tn, node, ancestor_specificity, css;
  5362. all_properties = Object.create(null);
  5363. ans = (function(){
  5364. var ρσ_d = Object.create(null);
  5365. ρσ_d["nodes"] = [];
  5366. ρσ_d["computed_css"] = all_properties;
  5367. ρσ_d["editor_name"] = editor_name;
  5368. ρσ_d["sourceline"] = sourceline;
  5369. ρσ_d["tags"] = tags;
  5370. return ρσ_d;
  5371. }).call(this);
  5372. target = null;
  5373. i = 0;
  5374. var ρσ_Iter4 = ρσ_Iterable(document.querySelectorAll("[data-lnum=\"" + ρσ_str.format("{}", sourceline) + "\"]"));
  5375. for (var ρσ_Index4 = 0; ρσ_Index4 < ρσ_Iter4.length; ρσ_Index4++) {
  5376. node = ρσ_Iter4[ρσ_Index4];
  5377. tn = (node.tagName) ? node.tagName.toLowerCase() : "";
  5378. if (tn !== tags[(typeof i === "number" && i < 0) ? tags.length + i : i]) {
  5379. if (to_python.live_css_data) {
  5380. to_python.live_css_data(ans);
  5381. }
  5382. return;
  5383. }
  5384. i += 1;
  5385. target = node;
  5386. if (i >= tags.length) {
  5387. break;
  5388. }
  5389. }
  5390. ancestor_specificity = 0;
  5391. while (target && target.ownerDocument) {
  5392. css = get_matched_css(target, ancestor_specificity !== 0, all_properties);
  5393. if (css.length > 0 || ancestor_specificity === 0) {
  5394. tn = (target.tagName) ? target.tagName.toLowerCase() : "";
  5395. ans.nodes.push((function(){
  5396. var ρσ_d = Object.create(null);
  5397. ρσ_d["name"] = tn;
  5398. ρσ_d["css"] = css;
  5399. ρσ_d["ancestor_specificity"] = -ancestor_specificity;
  5400. ρσ_d["sourceline"] = target.getAttribute("data-lnum");
  5401. return ρσ_d;
  5402. }).call(this));
  5403. }
  5404. target = target.parentNode;
  5405. ancestor_specificity += 1;
  5406. }
  5407. if (to_python.live_css_data) {
  5408. to_python.live_css_data(ans);
  5409. }
  5410. };
  5411. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  5412. __argnames__ : {value: ["editor_name", "sourceline", "tags"]},
  5413. __module__ : {value: null}
  5414. });
  5415. return ρσ_anonfunc;
  5416. })());
  5417. function check_for_maths() {
  5418. var s;
  5419. if (document.body.getElementsByTagNameNS("http://www.w3.org/1998/Math/MathML", "math").length > 0) {
  5420. return true;
  5421. }
  5422. var ρσ_Iter5 = ρσ_Iterable(document.scripts);
  5423. for (var ρσ_Index5 = 0; ρσ_Index5 < ρσ_Iter5.length; ρσ_Index5++) {
  5424. s = ρσ_Iter5[ρσ_Index5];
  5425. if (s.type === "text/x-mathjax-config") {
  5426. return true;
  5427. }
  5428. }
  5429. return false;
  5430. };
  5431. if (!check_for_maths.__module__) Object.defineProperties(check_for_maths, {
  5432. __module__ : {value: null}
  5433. });
  5434. function load_mathjax() {
  5435. var script;
  5436. script = ρσ_interpolate_kwargs.call(E, E.script, [ρσ_desugar_kwargs({type: "text/javascript"})]);
  5437. script.async = true;
  5438. script.src = "" + ρσ_str.format("{}", FAKE_PROTOCOL) + "://" + ρσ_str.format("{}", FAKE_HOST) + "/calibre_internal-mathjax/startup.js";
  5439. document.head.appendChild(script);
  5440. };
  5441. if (!load_mathjax.__module__) Object.defineProperties(load_mathjax, {
  5442. __module__ : {value: null}
  5443. });
  5444. if (document.body) {
  5445. settings = JSON.parse(window.navigator.userAgent.split("|")[1]);
  5446. css = "[data-in-split-mode=\"1\"] [data-is-block=\"1\"]:hover { cursor: pointer !important; border-top: solid 5px green !important }";
  5447. if (settings.os === "macos") {
  5448. css += "\n* { -webkit-hyphenate-character: \"-\" !important }\n";
  5449. }
  5450. document.body.addEventListener("click", onclick, true);
  5451. document.documentElement.appendChild(ρσ_interpolate_kwargs.call(E, E.style, [css].concat([ρσ_desugar_kwargs({type: "text/css"})])));
  5452. fix_fullscreen_svg_images();
  5453. if (check_for_maths()) {
  5454. load_mathjax();
  5455. }
  5456. }
  5457. })();
  5458. })();