123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349 |
- // include: shell.js
- // The Module object: Our interface to the outside world. We import
- // and export values on it. There are various ways Module can be used:
- // 1. Not defined. We create it here
- // 2. A function parameter, function(Module) { ..generated code.. }
- // 3. pre-run appended it, var Module = {}; ..generated code..
- // 4. External script tag defines var Module.
- // We need to check if Module already exists (e.g. case 3 above).
- // Substitution will be replaced with actual code on later stage of the build,
- // this way Closure Compiler will not mangle it (e.g. case 4. above).
- // Note that if you want to run closure, and also to use Module
- // after the generated code, you will need to define var Module = {};
- // before the code. Then that object will be used in the code, and you
- // can continue to use Module afterwards as well.
- var Module = typeof Module != "undefined" ? Module : {};
- // --pre-jses are emitted after the Module integration code, so that they can
- // refer to Module (if they choose; they can also define Module)
- /******/ (function () {
- // webpackBootstrap
- /******/ var __webpack_modules__ = {
- /***/ 3099: /***/ function (module) {
- module.exports = function (it) {
- if (typeof it != "function") {
- throw TypeError(String(it) + " is not a function");
- }
- return it;
- };
- /***/
- },
- /***/ 6077: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var isObject = __webpack_require__(111);
- module.exports = function (it) {
- if (!isObject(it) && it !== null) {
- throw TypeError("Can't set " + String(it) + " as a prototype");
- }
- return it;
- };
- /***/
- },
- /***/ 1223: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var wellKnownSymbol = __webpack_require__(5112);
- var create = __webpack_require__(30);
- var definePropertyModule = __webpack_require__(3070);
- var UNSCOPABLES = wellKnownSymbol("unscopables");
- var ArrayPrototype = Array.prototype;
- // Array.prototype[@@unscopables]
- // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
- if (ArrayPrototype[UNSCOPABLES] == undefined) {
- definePropertyModule.f(ArrayPrototype, UNSCOPABLES, {
- configurable: true,
- value: create(null)
- });
- }
- // add a key to Array.prototype[@@unscopables]
- module.exports = function (key) {
- ArrayPrototype[UNSCOPABLES][key] = true;
- };
- /***/
- },
- /***/ 5787: /***/ function (module) {
- module.exports = function (it, Constructor, name) {
- if (!(it instanceof Constructor)) {
- throw TypeError(
- "Incorrect " + (name ? name + " " : "") + "invocation"
- );
- }
- return it;
- };
- /***/
- },
- /***/ 9670: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var isObject = __webpack_require__(111);
- module.exports = function (it) {
- if (!isObject(it)) {
- throw TypeError(String(it) + " is not an object");
- }
- return it;
- };
- /***/
- },
- /***/ 4019: /***/ function (module) {
- module.exports =
- typeof ArrayBuffer !== "undefined" && typeof DataView !== "undefined";
- /***/
- },
- /***/ 260: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var NATIVE_ARRAY_BUFFER = __webpack_require__(4019);
- var DESCRIPTORS = __webpack_require__(9781);
- var global = __webpack_require__(7854);
- var isObject = __webpack_require__(111);
- var has = __webpack_require__(6656);
- var classof = __webpack_require__(648);
- var createNonEnumerableProperty = __webpack_require__(8880);
- var redefine = __webpack_require__(1320);
- var defineProperty = __webpack_require__(3070).f;
- var getPrototypeOf = __webpack_require__(9518);
- var setPrototypeOf = __webpack_require__(7674);
- var wellKnownSymbol = __webpack_require__(5112);
- var uid = __webpack_require__(9711);
- var Int8Array = global.Int8Array;
- var Int8ArrayPrototype = Int8Array && Int8Array.prototype;
- var Uint8ClampedArray = global.Uint8ClampedArray;
- var Uint8ClampedArrayPrototype =
- Uint8ClampedArray && Uint8ClampedArray.prototype;
- var TypedArray = Int8Array && getPrototypeOf(Int8Array);
- var TypedArrayPrototype =
- Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype);
- var ObjectPrototype = Object.prototype;
- var isPrototypeOf = ObjectPrototype.isPrototypeOf;
- var TO_STRING_TAG = wellKnownSymbol("toStringTag");
- var TYPED_ARRAY_TAG = uid("TYPED_ARRAY_TAG");
- // Fixing native typed arrays in Opera Presto crashes the browser, see #595
- var NATIVE_ARRAY_BUFFER_VIEWS =
- NATIVE_ARRAY_BUFFER &&
- !!setPrototypeOf &&
- classof(global.opera) !== "Opera";
- var TYPED_ARRAY_TAG_REQIRED = false;
- var NAME;
- var TypedArrayConstructorsList = {
- Int8Array: 1,
- Uint8Array: 1,
- Uint8ClampedArray: 1,
- Int16Array: 2,
- Uint16Array: 2,
- Int32Array: 4,
- Uint32Array: 4,
- Float32Array: 4,
- Float64Array: 8
- };
- var isView = function isView(it) {
- var klass = classof(it);
- return klass === "DataView" || has(TypedArrayConstructorsList, klass);
- };
- var isTypedArray = function (it) {
- return isObject(it) && has(TypedArrayConstructorsList, classof(it));
- };
- var aTypedArray = function (it) {
- if (isTypedArray(it)) return it;
- throw TypeError("Target is not a typed array");
- };
- var aTypedArrayConstructor = function (C) {
- if (setPrototypeOf) {
- if (isPrototypeOf.call(TypedArray, C)) return C;
- } else
- for (var ARRAY in TypedArrayConstructorsList)
- if (has(TypedArrayConstructorsList, NAME)) {
- var TypedArrayConstructor = global[ARRAY];
- if (
- TypedArrayConstructor &&
- (C === TypedArrayConstructor ||
- isPrototypeOf.call(TypedArrayConstructor, C))
- ) {
- return C;
- }
- }
- throw TypeError("Target is not a typed array constructor");
- };
- var exportTypedArrayMethod = function (KEY, property, forced) {
- if (!DESCRIPTORS) return;
- if (forced)
- for (var ARRAY in TypedArrayConstructorsList) {
- var TypedArrayConstructor = global[ARRAY];
- if (
- TypedArrayConstructor &&
- has(TypedArrayConstructor.prototype, KEY)
- ) {
- delete TypedArrayConstructor.prototype[KEY];
- }
- }
- if (!TypedArrayPrototype[KEY] || forced) {
- redefine(
- TypedArrayPrototype,
- KEY,
- forced
- ? property
- : (NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY]) ||
- property
- );
- }
- };
- var exportTypedArrayStaticMethod = function (KEY, property, forced) {
- var ARRAY, TypedArrayConstructor;
- if (!DESCRIPTORS) return;
- if (setPrototypeOf) {
- if (forced)
- for (ARRAY in TypedArrayConstructorsList) {
- TypedArrayConstructor = global[ARRAY];
- if (TypedArrayConstructor && has(TypedArrayConstructor, KEY)) {
- delete TypedArrayConstructor[KEY];
- }
- }
- if (!TypedArray[KEY] || forced) {
- // V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable
- try {
- return redefine(
- TypedArray,
- KEY,
- forced
- ? property
- : (NATIVE_ARRAY_BUFFER_VIEWS && Int8Array[KEY]) || property
- );
- } catch (error) {
- /* empty */
- }
- } else return;
- }
- for (ARRAY in TypedArrayConstructorsList) {
- TypedArrayConstructor = global[ARRAY];
- if (
- TypedArrayConstructor &&
- (!TypedArrayConstructor[KEY] || forced)
- ) {
- redefine(TypedArrayConstructor, KEY, property);
- }
- }
- };
- for (NAME in TypedArrayConstructorsList) {
- if (!global[NAME]) NATIVE_ARRAY_BUFFER_VIEWS = false;
- }
- // WebKit bug - typed arrays constructors prototype is Object.prototype
- if (
- !NATIVE_ARRAY_BUFFER_VIEWS ||
- typeof TypedArray != "function" ||
- TypedArray === Function.prototype
- ) {
- // eslint-disable-next-line no-shadow
- TypedArray = function TypedArray() {
- throw TypeError("Incorrect invocation");
- };
- if (NATIVE_ARRAY_BUFFER_VIEWS)
- for (NAME in TypedArrayConstructorsList) {
- if (global[NAME]) setPrototypeOf(global[NAME], TypedArray);
- }
- }
- if (
- !NATIVE_ARRAY_BUFFER_VIEWS ||
- !TypedArrayPrototype ||
- TypedArrayPrototype === ObjectPrototype
- ) {
- TypedArrayPrototype = TypedArray.prototype;
- if (NATIVE_ARRAY_BUFFER_VIEWS)
- for (NAME in TypedArrayConstructorsList) {
- if (global[NAME])
- setPrototypeOf(global[NAME].prototype, TypedArrayPrototype);
- }
- }
- // WebKit bug - one more object in Uint8ClampedArray prototype chain
- if (
- NATIVE_ARRAY_BUFFER_VIEWS &&
- getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype
- ) {
- setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype);
- }
- if (DESCRIPTORS && !has(TypedArrayPrototype, TO_STRING_TAG)) {
- TYPED_ARRAY_TAG_REQIRED = true;
- defineProperty(TypedArrayPrototype, TO_STRING_TAG, {
- get: function () {
- return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
- }
- });
- for (NAME in TypedArrayConstructorsList)
- if (global[NAME]) {
- createNonEnumerableProperty(global[NAME], TYPED_ARRAY_TAG, NAME);
- }
- }
- module.exports = {
- NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS,
- TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQIRED && TYPED_ARRAY_TAG,
- aTypedArray: aTypedArray,
- aTypedArrayConstructor: aTypedArrayConstructor,
- exportTypedArrayMethod: exportTypedArrayMethod,
- exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,
- isView: isView,
- isTypedArray: isTypedArray,
- TypedArray: TypedArray,
- TypedArrayPrototype: TypedArrayPrototype
- };
- /***/
- },
- /***/ 3331: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var global = __webpack_require__(7854);
- var DESCRIPTORS = __webpack_require__(9781);
- var NATIVE_ARRAY_BUFFER = __webpack_require__(4019);
- var createNonEnumerableProperty = __webpack_require__(8880);
- var redefineAll = __webpack_require__(2248);
- var fails = __webpack_require__(7293);
- var anInstance = __webpack_require__(5787);
- var toInteger = __webpack_require__(9958);
- var toLength = __webpack_require__(7466);
- var toIndex = __webpack_require__(7067);
- var IEEE754 = __webpack_require__(1179);
- var getPrototypeOf = __webpack_require__(9518);
- var setPrototypeOf = __webpack_require__(7674);
- var getOwnPropertyNames = __webpack_require__(8006).f;
- var defineProperty = __webpack_require__(3070).f;
- var arrayFill = __webpack_require__(1285);
- var setToStringTag = __webpack_require__(8003);
- var InternalStateModule = __webpack_require__(9909);
- var getInternalState = InternalStateModule.get;
- var setInternalState = InternalStateModule.set;
- var ARRAY_BUFFER = "ArrayBuffer";
- var DATA_VIEW = "DataView";
- var PROTOTYPE = "prototype";
- var WRONG_LENGTH = "Wrong length";
- var WRONG_INDEX = "Wrong index";
- var NativeArrayBuffer = global[ARRAY_BUFFER];
- var $ArrayBuffer = NativeArrayBuffer;
- var $DataView = global[DATA_VIEW];
- var $DataViewPrototype = $DataView && $DataView[PROTOTYPE];
- var ObjectPrototype = Object.prototype;
- var RangeError = global.RangeError;
- var packIEEE754 = IEEE754.pack;
- var unpackIEEE754 = IEEE754.unpack;
- var packInt8 = function (number) {
- return [number & 0xff];
- };
- var packInt16 = function (number) {
- return [number & 0xff, (number >> 8) & 0xff];
- };
- var packInt32 = function (number) {
- return [
- number & 0xff,
- (number >> 8) & 0xff,
- (number >> 16) & 0xff,
- (number >> 24) & 0xff
- ];
- };
- var unpackInt32 = function (buffer) {
- return (
- (buffer[3] << 24) | (buffer[2] << 16) | (buffer[1] << 8) | buffer[0]
- );
- };
- var packFloat32 = function (number) {
- return packIEEE754(number, 23, 4);
- };
- var packFloat64 = function (number) {
- return packIEEE754(number, 52, 8);
- };
- var addGetter = function (Constructor, key) {
- defineProperty(Constructor[PROTOTYPE], key, {
- get: function () {
- return getInternalState(this)[key];
- }
- });
- };
- var get = function (view, count, index, isLittleEndian) {
- var intIndex = toIndex(index);
- var store = getInternalState(view);
- if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
- var bytes = getInternalState(store.buffer).bytes;
- var start = intIndex + store.byteOffset;
- var pack = bytes.slice(start, start + count);
- return isLittleEndian ? pack : pack.reverse();
- };
- var set = function (
- view,
- count,
- index,
- conversion,
- value,
- isLittleEndian
- ) {
- var intIndex = toIndex(index);
- var store = getInternalState(view);
- if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
- var bytes = getInternalState(store.buffer).bytes;
- var start = intIndex + store.byteOffset;
- var pack = conversion(+value);
- for (var i = 0; i < count; i++)
- bytes[start + i] = pack[isLittleEndian ? i : count - i - 1];
- };
- if (!NATIVE_ARRAY_BUFFER) {
- $ArrayBuffer = function ArrayBuffer(length) {
- anInstance(this, $ArrayBuffer, ARRAY_BUFFER);
- var byteLength = toIndex(length);
- setInternalState(this, {
- bytes: arrayFill.call(new Array(byteLength), 0),
- byteLength: byteLength
- });
- if (!DESCRIPTORS) this.byteLength = byteLength;
- };
- $DataView = function DataView(buffer, byteOffset, byteLength) {
- anInstance(this, $DataView, DATA_VIEW);
- anInstance(buffer, $ArrayBuffer, DATA_VIEW);
- var bufferLength = getInternalState(buffer).byteLength;
- var offset = toInteger(byteOffset);
- if (offset < 0 || offset > bufferLength)
- throw RangeError("Wrong offset");
- byteLength =
- byteLength === undefined
- ? bufferLength - offset
- : toLength(byteLength);
- if (offset + byteLength > bufferLength)
- throw RangeError(WRONG_LENGTH);
- setInternalState(this, {
- buffer: buffer,
- byteLength: byteLength,
- byteOffset: offset
- });
- if (!DESCRIPTORS) {
- this.buffer = buffer;
- this.byteLength = byteLength;
- this.byteOffset = offset;
- }
- };
- if (DESCRIPTORS) {
- addGetter($ArrayBuffer, "byteLength");
- addGetter($DataView, "buffer");
- addGetter($DataView, "byteLength");
- addGetter($DataView, "byteOffset");
- }
- redefineAll($DataView[PROTOTYPE], {
- getInt8: function getInt8(byteOffset) {
- return (get(this, 1, byteOffset)[0] << 24) >> 24;
- },
- getUint8: function getUint8(byteOffset) {
- return get(this, 1, byteOffset)[0];
- },
- getInt16: function getInt16(byteOffset /* , littleEndian */) {
- var bytes = get(
- this,
- 2,
- byteOffset,
- arguments.length > 1 ? arguments[1] : undefined
- );
- return (((bytes[1] << 8) | bytes[0]) << 16) >> 16;
- },
- getUint16: function getUint16(byteOffset /* , littleEndian */) {
- var bytes = get(
- this,
- 2,
- byteOffset,
- arguments.length > 1 ? arguments[1] : undefined
- );
- return (bytes[1] << 8) | bytes[0];
- },
- getInt32: function getInt32(byteOffset /* , littleEndian */) {
- return unpackInt32(
- get(
- this,
- 4,
- byteOffset,
- arguments.length > 1 ? arguments[1] : undefined
- )
- );
- },
- getUint32: function getUint32(byteOffset /* , littleEndian */) {
- return (
- unpackInt32(
- get(
- this,
- 4,
- byteOffset,
- arguments.length > 1 ? arguments[1] : undefined
- )
- ) >>> 0
- );
- },
- getFloat32: function getFloat32(byteOffset /* , littleEndian */) {
- return unpackIEEE754(
- get(
- this,
- 4,
- byteOffset,
- arguments.length > 1 ? arguments[1] : undefined
- ),
- 23
- );
- },
- getFloat64: function getFloat64(byteOffset /* , littleEndian */) {
- return unpackIEEE754(
- get(
- this,
- 8,
- byteOffset,
- arguments.length > 1 ? arguments[1] : undefined
- ),
- 52
- );
- },
- setInt8: function setInt8(byteOffset, value) {
- set(this, 1, byteOffset, packInt8, value);
- },
- setUint8: function setUint8(byteOffset, value) {
- set(this, 1, byteOffset, packInt8, value);
- },
- setInt16: function setInt16(byteOffset, value /* , littleEndian */) {
- set(
- this,
- 2,
- byteOffset,
- packInt16,
- value,
- arguments.length > 2 ? arguments[2] : undefined
- );
- },
- setUint16: function setUint16(
- byteOffset,
- value /* , littleEndian */
- ) {
- set(
- this,
- 2,
- byteOffset,
- packInt16,
- value,
- arguments.length > 2 ? arguments[2] : undefined
- );
- },
- setInt32: function setInt32(byteOffset, value /* , littleEndian */) {
- set(
- this,
- 4,
- byteOffset,
- packInt32,
- value,
- arguments.length > 2 ? arguments[2] : undefined
- );
- },
- setUint32: function setUint32(
- byteOffset,
- value /* , littleEndian */
- ) {
- set(
- this,
- 4,
- byteOffset,
- packInt32,
- value,
- arguments.length > 2 ? arguments[2] : undefined
- );
- },
- setFloat32: function setFloat32(
- byteOffset,
- value /* , littleEndian */
- ) {
- set(
- this,
- 4,
- byteOffset,
- packFloat32,
- value,
- arguments.length > 2 ? arguments[2] : undefined
- );
- },
- setFloat64: function setFloat64(
- byteOffset,
- value /* , littleEndian */
- ) {
- set(
- this,
- 8,
- byteOffset,
- packFloat64,
- value,
- arguments.length > 2 ? arguments[2] : undefined
- );
- }
- });
- } else {
- if (
- !fails(function () {
- NativeArrayBuffer(1);
- }) ||
- !fails(function () {
- new NativeArrayBuffer(-1); // eslint-disable-line no-new
- }) ||
- fails(function () {
- new NativeArrayBuffer(); // eslint-disable-line no-new
- new NativeArrayBuffer(1.5); // eslint-disable-line no-new
- new NativeArrayBuffer(NaN); // eslint-disable-line no-new
- return NativeArrayBuffer.name != ARRAY_BUFFER;
- })
- ) {
- $ArrayBuffer = function ArrayBuffer(length) {
- anInstance(this, $ArrayBuffer);
- return new NativeArrayBuffer(toIndex(length));
- };
- var ArrayBufferPrototype = ($ArrayBuffer[PROTOTYPE] =
- NativeArrayBuffer[PROTOTYPE]);
- for (
- var keys = getOwnPropertyNames(NativeArrayBuffer), j = 0, key;
- keys.length > j;
- ) {
- if (!((key = keys[j++]) in $ArrayBuffer)) {
- createNonEnumerableProperty(
- $ArrayBuffer,
- key,
- NativeArrayBuffer[key]
- );
- }
- }
- ArrayBufferPrototype.constructor = $ArrayBuffer;
- }
- // WebKit bug - the same parent prototype for typed arrays and data view
- if (
- setPrototypeOf &&
- getPrototypeOf($DataViewPrototype) !== ObjectPrototype
- ) {
- setPrototypeOf($DataViewPrototype, ObjectPrototype);
- }
- // iOS Safari 7.x bug
- var testView = new $DataView(new $ArrayBuffer(2));
- var nativeSetInt8 = $DataViewPrototype.setInt8;
- testView.setInt8(0, 2147483648);
- testView.setInt8(1, 2147483649);
- if (testView.getInt8(0) || !testView.getInt8(1))
- redefineAll(
- $DataViewPrototype,
- {
- setInt8: function setInt8(byteOffset, value) {
- nativeSetInt8.call(this, byteOffset, (value << 24) >> 24);
- },
- setUint8: function setUint8(byteOffset, value) {
- nativeSetInt8.call(this, byteOffset, (value << 24) >> 24);
- }
- },
- { unsafe: true }
- );
- }
- setToStringTag($ArrayBuffer, ARRAY_BUFFER);
- setToStringTag($DataView, DATA_VIEW);
- module.exports = {
- ArrayBuffer: $ArrayBuffer,
- DataView: $DataView
- };
- /***/
- },
- /***/ 1285: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var toObject = __webpack_require__(7908);
- var toAbsoluteIndex = __webpack_require__(1400);
- var toLength = __webpack_require__(7466);
- // `Array.prototype.fill` method implementation
- // https://tc39.github.io/ecma262/#sec-array.prototype.fill
- module.exports = function fill(value /* , start = 0, end = @length */) {
- var O = toObject(this);
- var length = toLength(O.length);
- var argumentsLength = arguments.length;
- var index = toAbsoluteIndex(
- argumentsLength > 1 ? arguments[1] : undefined,
- length
- );
- var end = argumentsLength > 2 ? arguments[2] : undefined;
- var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
- while (endPos > index) O[index++] = value;
- return O;
- };
- /***/
- },
- /***/ 8533: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var $forEach = __webpack_require__(2092).forEach;
- var arrayMethodIsStrict = __webpack_require__(9341);
- var arrayMethodUsesToLength = __webpack_require__(9207);
- var STRICT_METHOD = arrayMethodIsStrict("forEach");
- var USES_TO_LENGTH = arrayMethodUsesToLength("forEach");
- // `Array.prototype.forEach` method implementation
- // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
- module.exports =
- !STRICT_METHOD || !USES_TO_LENGTH
- ? function forEach(callbackfn /* , thisArg */) {
- return $forEach(
- this,
- callbackfn,
- arguments.length > 1 ? arguments[1] : undefined
- );
- }
- : [].forEach;
- /***/
- },
- /***/ 1318: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var toIndexedObject = __webpack_require__(5656);
- var toLength = __webpack_require__(7466);
- var toAbsoluteIndex = __webpack_require__(1400);
- // `Array.prototype.{ indexOf, includes }` methods implementation
- var createMethod = function (IS_INCLUDES) {
- return function ($this, el, fromIndex) {
- var O = toIndexedObject($this);
- var length = toLength(O.length);
- var index = toAbsoluteIndex(fromIndex, length);
- var value;
- // Array#includes uses SameValueZero equality algorithm
- // eslint-disable-next-line no-self-compare
- if (IS_INCLUDES && el != el)
- while (length > index) {
- value = O[index++];
- // eslint-disable-next-line no-self-compare
- if (value != value) return true;
- // Array#indexOf ignores holes, Array#includes - not
- }
- else
- for (; length > index; index++) {
- if ((IS_INCLUDES || index in O) && O[index] === el)
- return IS_INCLUDES || index || 0;
- }
- return !IS_INCLUDES && -1;
- };
- };
- module.exports = {
- // `Array.prototype.includes` method
- // https://tc39.github.io/ecma262/#sec-array.prototype.includes
- includes: createMethod(true),
- // `Array.prototype.indexOf` method
- // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
- indexOf: createMethod(false)
- };
- /***/
- },
- /***/ 2092: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var bind = __webpack_require__(9974);
- var IndexedObject = __webpack_require__(8361);
- var toObject = __webpack_require__(7908);
- var toLength = __webpack_require__(7466);
- var arraySpeciesCreate = __webpack_require__(5417);
- var push = [].push;
- // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
- var createMethod = function (TYPE) {
- var IS_MAP = TYPE == 1;
- var IS_FILTER = TYPE == 2;
- var IS_SOME = TYPE == 3;
- var IS_EVERY = TYPE == 4;
- var IS_FIND_INDEX = TYPE == 6;
- var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
- return function ($this, callbackfn, that, specificCreate) {
- var O = toObject($this);
- var self = IndexedObject(O);
- var boundFunction = bind(callbackfn, that, 3);
- var length = toLength(self.length);
- var index = 0;
- var create = specificCreate || arraySpeciesCreate;
- var target = IS_MAP
- ? create($this, length)
- : IS_FILTER
- ? create($this, 0)
- : undefined;
- var value, result;
- for (; length > index; index++)
- if (NO_HOLES || index in self) {
- value = self[index];
- result = boundFunction(value, index, O);
- if (TYPE) {
- if (IS_MAP) target[index] = result; // map
- else if (result)
- switch (TYPE) {
- case 3:
- return true; // some
- case 5:
- return value; // find
- case 6:
- return index; // findIndex
- case 2:
- push.call(target, value); // filter
- }
- else if (IS_EVERY) return false; // every
- }
- }
- return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
- };
- };
- module.exports = {
- // `Array.prototype.forEach` method
- // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
- forEach: createMethod(0),
- // `Array.prototype.map` method
- // https://tc39.github.io/ecma262/#sec-array.prototype.map
- map: createMethod(1),
- // `Array.prototype.filter` method
- // https://tc39.github.io/ecma262/#sec-array.prototype.filter
- filter: createMethod(2),
- // `Array.prototype.some` method
- // https://tc39.github.io/ecma262/#sec-array.prototype.some
- some: createMethod(3),
- // `Array.prototype.every` method
- // https://tc39.github.io/ecma262/#sec-array.prototype.every
- every: createMethod(4),
- // `Array.prototype.find` method
- // https://tc39.github.io/ecma262/#sec-array.prototype.find
- find: createMethod(5),
- // `Array.prototype.findIndex` method
- // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
- findIndex: createMethod(6)
- };
- /***/
- },
- /***/ 1194: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var fails = __webpack_require__(7293);
- var wellKnownSymbol = __webpack_require__(5112);
- var V8_VERSION = __webpack_require__(7392);
- var SPECIES = wellKnownSymbol("species");
- module.exports = function (METHOD_NAME) {
- // We can't use this feature detection in V8 since it causes
- // deoptimization and serious performance degradation
- // https://github.com/zloirock/core-js/issues/677
- return (
- V8_VERSION >= 51 ||
- !fails(function () {
- var array = [];
- var constructor = (array.constructor = {});
- constructor[SPECIES] = function () {
- return { foo: 1 };
- };
- return array[METHOD_NAME](Boolean).foo !== 1;
- })
- );
- };
- /***/
- },
- /***/ 9341: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var fails = __webpack_require__(7293);
- module.exports = function (METHOD_NAME, argument) {
- var method = [][METHOD_NAME];
- return (
- !!method &&
- fails(function () {
- // eslint-disable-next-line no-useless-call,no-throw-literal
- method.call(
- null,
- argument ||
- function () {
- throw 1;
- },
- 1
- );
- })
- );
- };
- /***/
- },
- /***/ 9207: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var DESCRIPTORS = __webpack_require__(9781);
- var fails = __webpack_require__(7293);
- var has = __webpack_require__(6656);
- var defineProperty = Object.defineProperty;
- var cache = {};
- var thrower = function (it) {
- throw it;
- };
- module.exports = function (METHOD_NAME, options) {
- if (has(cache, METHOD_NAME)) return cache[METHOD_NAME];
- if (!options) options = {};
- var method = [][METHOD_NAME];
- var ACCESSORS = has(options, "ACCESSORS") ? options.ACCESSORS : false;
- var argument0 = has(options, 0) ? options[0] : thrower;
- var argument1 = has(options, 1) ? options[1] : undefined;
- return (cache[METHOD_NAME] =
- !!method &&
- !fails(function () {
- if (ACCESSORS && !DESCRIPTORS) return true;
- var O = { length: -1 };
- if (ACCESSORS)
- defineProperty(O, 1, { enumerable: true, get: thrower });
- else O[1] = 1;
- method.call(O, argument0, argument1);
- }));
- };
- /***/
- },
- /***/ 5417: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var isObject = __webpack_require__(111);
- var isArray = __webpack_require__(3157);
- var wellKnownSymbol = __webpack_require__(5112);
- var SPECIES = wellKnownSymbol("species");
- // `ArraySpeciesCreate` abstract operation
- // https://tc39.github.io/ecma262/#sec-arrayspeciescreate
- module.exports = function (originalArray, length) {
- var C;
- if (isArray(originalArray)) {
- C = originalArray.constructor;
- // cross-realm fallback
- if (typeof C == "function" && (C === Array || isArray(C.prototype)))
- C = undefined;
- else if (isObject(C)) {
- C = C[SPECIES];
- if (C === null) C = undefined;
- }
- }
- return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
- };
- /***/
- },
- /***/ 3411: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var anObject = __webpack_require__(9670);
- // call something on iterator step with safe closing on error
- module.exports = function (iterator, fn, value, ENTRIES) {
- try {
- return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
- // 7.4.6 IteratorClose(iterator, completion)
- } catch (error) {
- var returnMethod = iterator["return"];
- if (returnMethod !== undefined) anObject(returnMethod.call(iterator));
- throw error;
- }
- };
- /***/
- },
- /***/ 7072: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var wellKnownSymbol = __webpack_require__(5112);
- var ITERATOR = wellKnownSymbol("iterator");
- var SAFE_CLOSING = false;
- try {
- var called = 0;
- var iteratorWithReturn = {
- next: function () {
- return { done: !!called++ };
- },
- return: function () {
- SAFE_CLOSING = true;
- }
- };
- iteratorWithReturn[ITERATOR] = function () {
- return this;
- };
- // eslint-disable-next-line no-throw-literal
- Array.from(iteratorWithReturn, function () {
- throw 2;
- });
- } catch (error) {
- /* empty */
- }
- module.exports = function (exec, SKIP_CLOSING) {
- if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
- var ITERATION_SUPPORT = false;
- try {
- var object = {};
- object[ITERATOR] = function () {
- return {
- next: function () {
- return { done: (ITERATION_SUPPORT = true) };
- }
- };
- };
- exec(object);
- } catch (error) {
- /* empty */
- }
- return ITERATION_SUPPORT;
- };
- /***/
- },
- /***/ 4326: /***/ function (module) {
- var toString = {}.toString;
- module.exports = function (it) {
- return toString.call(it).slice(8, -1);
- };
- /***/
- },
- /***/ 648: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var TO_STRING_TAG_SUPPORT = __webpack_require__(1694);
- var classofRaw = __webpack_require__(4326);
- var wellKnownSymbol = __webpack_require__(5112);
- var TO_STRING_TAG = wellKnownSymbol("toStringTag");
- // ES3 wrong here
- var CORRECT_ARGUMENTS =
- classofRaw(
- (function () {
- return arguments;
- })()
- ) == "Arguments";
- // fallback for IE11 Script Access Denied error
- var tryGet = function (it, key) {
- try {
- return it[key];
- } catch (error) {
- /* empty */
- }
- };
- // getting tag from ES6+ `Object.prototype.toString`
- module.exports = TO_STRING_TAG_SUPPORT
- ? classofRaw
- : function (it) {
- var O, tag, result;
- return it === undefined
- ? "Undefined"
- : it === null
- ? "Null"
- : // @@toStringTag case
- typeof (tag = tryGet((O = Object(it)), TO_STRING_TAG)) == "string"
- ? tag
- : // builtinTag case
- CORRECT_ARGUMENTS
- ? classofRaw(O)
- : // ES3 arguments fallback
- (result = classofRaw(O)) == "Object" &&
- typeof O.callee == "function"
- ? "Arguments"
- : result;
- };
- /***/
- },
- /***/ 9920: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var has = __webpack_require__(6656);
- var ownKeys = __webpack_require__(3887);
- var getOwnPropertyDescriptorModule = __webpack_require__(1236);
- var definePropertyModule = __webpack_require__(3070);
- module.exports = function (target, source) {
- var keys = ownKeys(source);
- var defineProperty = definePropertyModule.f;
- var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- if (!has(target, key))
- defineProperty(target, key, getOwnPropertyDescriptor(source, key));
- }
- };
- /***/
- },
- /***/ 8544: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var fails = __webpack_require__(7293);
- module.exports = !fails(function () {
- function F() {
- /* empty */
- }
- F.prototype.constructor = null;
- return Object.getPrototypeOf(new F()) !== F.prototype;
- });
- /***/
- },
- /***/ 4994: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var IteratorPrototype = __webpack_require__(3383).IteratorPrototype;
- var create = __webpack_require__(30);
- var createPropertyDescriptor = __webpack_require__(9114);
- var setToStringTag = __webpack_require__(8003);
- var Iterators = __webpack_require__(7497);
- var returnThis = function () {
- return this;
- };
- module.exports = function (IteratorConstructor, NAME, next) {
- var TO_STRING_TAG = NAME + " Iterator";
- IteratorConstructor.prototype = create(IteratorPrototype, {
- next: createPropertyDescriptor(1, next)
- });
- setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
- Iterators[TO_STRING_TAG] = returnThis;
- return IteratorConstructor;
- };
- /***/
- },
- /***/ 8880: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var DESCRIPTORS = __webpack_require__(9781);
- var definePropertyModule = __webpack_require__(3070);
- var createPropertyDescriptor = __webpack_require__(9114);
- module.exports = DESCRIPTORS
- ? function (object, key, value) {
- return definePropertyModule.f(
- object,
- key,
- createPropertyDescriptor(1, value)
- );
- }
- : function (object, key, value) {
- object[key] = value;
- return object;
- };
- /***/
- },
- /***/ 9114: /***/ function (module) {
- module.exports = function (bitmap, value) {
- return {
- enumerable: !(bitmap & 1),
- configurable: !(bitmap & 2),
- writable: !(bitmap & 4),
- value: value
- };
- };
- /***/
- },
- /***/ 6135: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var toPrimitive = __webpack_require__(7593);
- var definePropertyModule = __webpack_require__(3070);
- var createPropertyDescriptor = __webpack_require__(9114);
- module.exports = function (object, key, value) {
- var propertyKey = toPrimitive(key);
- if (propertyKey in object)
- definePropertyModule.f(
- object,
- propertyKey,
- createPropertyDescriptor(0, value)
- );
- else object[propertyKey] = value;
- };
- /***/
- },
- /***/ 654: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var $ = __webpack_require__(2109);
- var createIteratorConstructor = __webpack_require__(4994);
- var getPrototypeOf = __webpack_require__(9518);
- var setPrototypeOf = __webpack_require__(7674);
- var setToStringTag = __webpack_require__(8003);
- var createNonEnumerableProperty = __webpack_require__(8880);
- var redefine = __webpack_require__(1320);
- var wellKnownSymbol = __webpack_require__(5112);
- var IS_PURE = __webpack_require__(1913);
- var Iterators = __webpack_require__(7497);
- var IteratorsCore = __webpack_require__(3383);
- var IteratorPrototype = IteratorsCore.IteratorPrototype;
- var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
- var ITERATOR = wellKnownSymbol("iterator");
- var KEYS = "keys";
- var VALUES = "values";
- var ENTRIES = "entries";
- var returnThis = function () {
- return this;
- };
- module.exports = function (
- Iterable,
- NAME,
- IteratorConstructor,
- next,
- DEFAULT,
- IS_SET,
- FORCED
- ) {
- createIteratorConstructor(IteratorConstructor, NAME, next);
- var getIterationMethod = function (KIND) {
- if (KIND === DEFAULT && defaultIterator) return defaultIterator;
- if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype)
- return IterablePrototype[KIND];
- switch (KIND) {
- case KEYS:
- return function keys() {
- return new IteratorConstructor(this, KIND);
- };
- case VALUES:
- return function values() {
- return new IteratorConstructor(this, KIND);
- };
- case ENTRIES:
- return function entries() {
- return new IteratorConstructor(this, KIND);
- };
- }
- return function () {
- return new IteratorConstructor(this);
- };
- };
- var TO_STRING_TAG = NAME + " Iterator";
- var INCORRECT_VALUES_NAME = false;
- var IterablePrototype = Iterable.prototype;
- var nativeIterator =
- IterablePrototype[ITERATOR] ||
- IterablePrototype["@@iterator"] ||
- (DEFAULT && IterablePrototype[DEFAULT]);
- var defaultIterator =
- (!BUGGY_SAFARI_ITERATORS && nativeIterator) ||
- getIterationMethod(DEFAULT);
- var anyNativeIterator =
- NAME == "Array"
- ? IterablePrototype.entries || nativeIterator
- : nativeIterator;
- var CurrentIteratorPrototype, methods, KEY;
- // fix native
- if (anyNativeIterator) {
- CurrentIteratorPrototype = getPrototypeOf(
- anyNativeIterator.call(new Iterable())
- );
- if (
- IteratorPrototype !== Object.prototype &&
- CurrentIteratorPrototype.next
- ) {
- if (
- !IS_PURE &&
- getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype
- ) {
- if (setPrototypeOf) {
- setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
- } else if (
- typeof CurrentIteratorPrototype[ITERATOR] != "function"
- ) {
- createNonEnumerableProperty(
- CurrentIteratorPrototype,
- ITERATOR,
- returnThis
- );
- }
- }
- // Set @@toStringTag to native iterators
- setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
- if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
- }
- }
- // fix Array#{values, @@iterator}.name in V8 / FF
- if (
- DEFAULT == VALUES &&
- nativeIterator &&
- nativeIterator.name !== VALUES
- ) {
- INCORRECT_VALUES_NAME = true;
- defaultIterator = function values() {
- return nativeIterator.call(this);
- };
- }
- // define iterator
- if (
- (!IS_PURE || FORCED) &&
- IterablePrototype[ITERATOR] !== defaultIterator
- ) {
- createNonEnumerableProperty(
- IterablePrototype,
- ITERATOR,
- defaultIterator
- );
- }
- Iterators[NAME] = defaultIterator;
- // export additional methods
- if (DEFAULT) {
- methods = {
- values: getIterationMethod(VALUES),
- keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
- entries: getIterationMethod(ENTRIES)
- };
- if (FORCED)
- for (KEY in methods) {
- if (
- BUGGY_SAFARI_ITERATORS ||
- INCORRECT_VALUES_NAME ||
- !(KEY in IterablePrototype)
- ) {
- redefine(IterablePrototype, KEY, methods[KEY]);
- }
- }
- else
- $(
- {
- target: NAME,
- proto: true,
- forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME
- },
- methods
- );
- }
- return methods;
- };
- /***/
- },
- /***/ 7235: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var path = __webpack_require__(857);
- var has = __webpack_require__(6656);
- var wrappedWellKnownSymbolModule = __webpack_require__(6061);
- var defineProperty = __webpack_require__(3070).f;
- module.exports = function (NAME) {
- var Symbol = path.Symbol || (path.Symbol = {});
- if (!has(Symbol, NAME))
- defineProperty(Symbol, NAME, {
- value: wrappedWellKnownSymbolModule.f(NAME)
- });
- };
- /***/
- },
- /***/ 9781: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var fails = __webpack_require__(7293);
- // Thank's IE8 for his funny defineProperty
- module.exports = !fails(function () {
- return (
- Object.defineProperty({}, 1, {
- get: function () {
- return 7;
- }
- })[1] != 7
- );
- });
- /***/
- },
- /***/ 317: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var global = __webpack_require__(7854);
- var isObject = __webpack_require__(111);
- var document = global.document;
- // typeof document.createElement is 'object' in old IE
- var EXISTS = isObject(document) && isObject(document.createElement);
- module.exports = function (it) {
- return EXISTS ? document.createElement(it) : {};
- };
- /***/
- },
- /***/ 8324: /***/ function (module) {
- // iterable DOM collections
- // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
- module.exports = {
- CSSRuleList: 0,
- CSSStyleDeclaration: 0,
- CSSValueList: 0,
- ClientRectList: 0,
- DOMRectList: 0,
- DOMStringList: 0,
- DOMTokenList: 1,
- DataTransferItemList: 0,
- FileList: 0,
- HTMLAllCollection: 0,
- HTMLCollection: 0,
- HTMLFormElement: 0,
- HTMLSelectElement: 0,
- MediaList: 0,
- MimeTypeArray: 0,
- NamedNodeMap: 0,
- NodeList: 1,
- PaintRequestList: 0,
- Plugin: 0,
- PluginArray: 0,
- SVGLengthList: 0,
- SVGNumberList: 0,
- SVGPathSegList: 0,
- SVGPointList: 0,
- SVGStringList: 0,
- SVGTransformList: 0,
- SourceBufferList: 0,
- StyleSheetList: 0,
- TextTrackCueList: 0,
- TextTrackList: 0,
- TouchList: 0
- };
- /***/
- },
- /***/ 6833: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var userAgent = __webpack_require__(8113);
- module.exports = /(iphone|ipod|ipad).*applewebkit/i.test(userAgent);
- /***/
- },
- /***/ 8113: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var getBuiltIn = __webpack_require__(5005);
- module.exports = getBuiltIn("navigator", "userAgent") || "";
- /***/
- },
- /***/ 7392: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var global = __webpack_require__(7854);
- var userAgent = __webpack_require__(8113);
- var process = global.process;
- var versions = process && process.versions;
- var v8 = versions && versions.v8;
- var match, version;
- if (v8) {
- match = v8.split(".");
- version = match[0] + match[1];
- } else if (userAgent) {
- match = userAgent.match(/Edge\/(\d+)/);
- if (!match || match[1] >= 74) {
- match = userAgent.match(/Chrome\/(\d+)/);
- if (match) version = match[1];
- }
- }
- module.exports = version && +version;
- /***/
- },
- /***/ 748: /***/ function (module) {
- // IE8- don't enum bug keys
- module.exports = [
- "constructor",
- "hasOwnProperty",
- "isPrototypeOf",
- "propertyIsEnumerable",
- "toLocaleString",
- "toString",
- "valueOf"
- ];
- /***/
- },
- /***/ 2109: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var global = __webpack_require__(7854);
- var getOwnPropertyDescriptor = __webpack_require__(1236).f;
- var createNonEnumerableProperty = __webpack_require__(8880);
- var redefine = __webpack_require__(1320);
- var setGlobal = __webpack_require__(3505);
- var copyConstructorProperties = __webpack_require__(9920);
- var isForced = __webpack_require__(4705);
- /*
- options.target - name of the target object
- options.global - target is the global object
- options.stat - export as static methods of target
- options.proto - export as prototype methods of target
- options.real - real prototype method for the `pure` version
- options.forced - export even if the native feature is available
- options.bind - bind methods to the target, required for the `pure` version
- options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
- options.unsafe - use the simple assignment of property instead of delete + defineProperty
- options.sham - add a flag to not completely full polyfills
- options.enumerable - export as enumerable property
- options.noTargetGet - prevent calling a getter on target
- */
- module.exports = function (options, source) {
- var TARGET = options.target;
- var GLOBAL = options.global;
- var STATIC = options.stat;
- var FORCED, target, key, targetProperty, sourceProperty, descriptor;
- if (GLOBAL) {
- target = global;
- } else if (STATIC) {
- target = global[TARGET] || setGlobal(TARGET, {});
- } else {
- target = (global[TARGET] || {}).prototype;
- }
- if (target)
- for (key in source) {
- sourceProperty = source[key];
- if (options.noTargetGet) {
- descriptor = getOwnPropertyDescriptor(target, key);
- targetProperty = descriptor && descriptor.value;
- } else targetProperty = target[key];
- FORCED = isForced(
- GLOBAL ? key : TARGET + (STATIC ? "." : "#") + key,
- options.forced
- );
- // contained in target
- if (!FORCED && targetProperty !== undefined) {
- if (typeof sourceProperty === typeof targetProperty) continue;
- copyConstructorProperties(sourceProperty, targetProperty);
- }
- // add a flag to not completely full polyfills
- if (options.sham || (targetProperty && targetProperty.sham)) {
- createNonEnumerableProperty(sourceProperty, "sham", true);
- }
- // extend global
- redefine(target, key, sourceProperty, options);
- }
- };
- /***/
- },
- /***/ 7293: /***/ function (module) {
- module.exports = function (exec) {
- try {
- return !!exec();
- } catch (error) {
- return true;
- }
- };
- /***/
- },
- /***/ 9974: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var aFunction = __webpack_require__(3099);
- // optional / simple context binding
- module.exports = function (fn, that, length) {
- aFunction(fn);
- if (that === undefined) return fn;
- switch (length) {
- case 0:
- return function () {
- return fn.call(that);
- };
- case 1:
- return function (a) {
- return fn.call(that, a);
- };
- case 2:
- return function (a, b) {
- return fn.call(that, a, b);
- };
- case 3:
- return function (a, b, c) {
- return fn.call(that, a, b, c);
- };
- }
- return function (/* ...args */) {
- return fn.apply(that, arguments);
- };
- };
- /***/
- },
- /***/ 5005: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var path = __webpack_require__(857);
- var global = __webpack_require__(7854);
- var aFunction = function (variable) {
- return typeof variable == "function" ? variable : undefined;
- };
- module.exports = function (namespace, method) {
- return arguments.length < 2
- ? aFunction(path[namespace]) || aFunction(global[namespace])
- : (path[namespace] && path[namespace][method]) ||
- (global[namespace] && global[namespace][method]);
- };
- /***/
- },
- /***/ 1246: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var classof = __webpack_require__(648);
- var Iterators = __webpack_require__(7497);
- var wellKnownSymbol = __webpack_require__(5112);
- var ITERATOR = wellKnownSymbol("iterator");
- module.exports = function (it) {
- if (it != undefined)
- return it[ITERATOR] || it["@@iterator"] || Iterators[classof(it)];
- };
- /***/
- },
- /***/ 7854: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var check = function (it) {
- return it && it.Math == Math && it;
- };
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
- module.exports =
- // eslint-disable-next-line no-undef
- check(typeof globalThis == "object" && globalThis) ||
- check(typeof window == "object" && window) ||
- check(typeof self == "object" && self) ||
- check(
- typeof __webpack_require__.g == "object" && __webpack_require__.g
- ) ||
- // eslint-disable-next-line no-new-func
- Function("return this")();
- /***/
- },
- /***/ 6656: /***/ function (module) {
- var hasOwnProperty = {}.hasOwnProperty;
- module.exports = function (it, key) {
- return hasOwnProperty.call(it, key);
- };
- /***/
- },
- /***/ 3501: /***/ function (module) {
- module.exports = {};
- /***/
- },
- /***/ 842: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var global = __webpack_require__(7854);
- module.exports = function (a, b) {
- var console = global.console;
- if (console && console.error) {
- arguments.length === 1 ? console.error(a) : console.error(a, b);
- }
- };
- /***/
- },
- /***/ 490: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var getBuiltIn = __webpack_require__(5005);
- module.exports = getBuiltIn("document", "documentElement");
- /***/
- },
- /***/ 4664: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var DESCRIPTORS = __webpack_require__(9781);
- var fails = __webpack_require__(7293);
- var createElement = __webpack_require__(317);
- // Thank's IE8 for his funny defineProperty
- module.exports =
- !DESCRIPTORS &&
- !fails(function () {
- return (
- Object.defineProperty(createElement("div"), "a", {
- get: function () {
- return 7;
- }
- }).a != 7
- );
- });
- /***/
- },
- /***/ 1179: /***/ function (module) {
- // IEEE754 conversions based on https://github.com/feross/ieee754
- // eslint-disable-next-line no-shadow-restricted-names
- var Infinity = 1 / 0;
- var abs = Math.abs;
- var pow = Math.pow;
- var floor = Math.floor;
- var log = Math.log;
- var LN2 = Math.LN2;
- var pack = function (number, mantissaLength, bytes) {
- var buffer = new Array(bytes);
- var exponentLength = bytes * 8 - mantissaLength - 1;
- var eMax = (1 << exponentLength) - 1;
- var eBias = eMax >> 1;
- var rt = mantissaLength === 23 ? pow(2, -24) - pow(2, -77) : 0;
- var sign = number < 0 || (number === 0 && 1 / number < 0) ? 1 : 0;
- var index = 0;
- var exponent, mantissa, c;
- number = abs(number);
- // eslint-disable-next-line no-self-compare
- if (number != number || number === Infinity) {
- // eslint-disable-next-line no-self-compare
- mantissa = number != number ? 1 : 0;
- exponent = eMax;
- } else {
- exponent = floor(log(number) / LN2);
- if (number * (c = pow(2, -exponent)) < 1) {
- exponent--;
- c *= 2;
- }
- if (exponent + eBias >= 1) {
- number += rt / c;
- } else {
- number += rt * pow(2, 1 - eBias);
- }
- if (number * c >= 2) {
- exponent++;
- c /= 2;
- }
- if (exponent + eBias >= eMax) {
- mantissa = 0;
- exponent = eMax;
- } else if (exponent + eBias >= 1) {
- mantissa = (number * c - 1) * pow(2, mantissaLength);
- exponent = exponent + eBias;
- } else {
- mantissa = number * pow(2, eBias - 1) * pow(2, mantissaLength);
- exponent = 0;
- }
- }
- for (
- ;
- mantissaLength >= 8;
- buffer[index++] = mantissa & 255, mantissa /= 256, mantissaLength -= 8
- );
- exponent = (exponent << mantissaLength) | mantissa;
- exponentLength += mantissaLength;
- for (
- ;
- exponentLength > 0;
- buffer[index++] = exponent & 255, exponent /= 256, exponentLength -= 8
- );
- buffer[--index] |= sign * 128;
- return buffer;
- };
- var unpack = function (buffer, mantissaLength) {
- var bytes = buffer.length;
- var exponentLength = bytes * 8 - mantissaLength - 1;
- var eMax = (1 << exponentLength) - 1;
- var eBias = eMax >> 1;
- var nBits = exponentLength - 7;
- var index = bytes - 1;
- var sign = buffer[index--];
- var exponent = sign & 127;
- var mantissa;
- sign >>= 7;
- for (
- ;
- nBits > 0;
- exponent = exponent * 256 + buffer[index], index--, nBits -= 8
- );
- mantissa = exponent & ((1 << -nBits) - 1);
- exponent >>= -nBits;
- nBits += mantissaLength;
- for (
- ;
- nBits > 0;
- mantissa = mantissa * 256 + buffer[index], index--, nBits -= 8
- );
- if (exponent === 0) {
- exponent = 1 - eBias;
- } else if (exponent === eMax) {
- return mantissa ? NaN : sign ? -Infinity : Infinity;
- } else {
- mantissa = mantissa + pow(2, mantissaLength);
- exponent = exponent - eBias;
- }
- return (sign ? -1 : 1) * mantissa * pow(2, exponent - mantissaLength);
- };
- module.exports = {
- pack: pack,
- unpack: unpack
- };
- /***/
- },
- /***/ 8361: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var fails = __webpack_require__(7293);
- var classof = __webpack_require__(4326);
- var split = "".split;
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
- module.exports = fails(function () {
- // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
- // eslint-disable-next-line no-prototype-builtins
- return !Object("z").propertyIsEnumerable(0);
- })
- ? function (it) {
- return classof(it) == "String" ? split.call(it, "") : Object(it);
- }
- : Object;
- /***/
- },
- /***/ 9587: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var isObject = __webpack_require__(111);
- var setPrototypeOf = __webpack_require__(7674);
- // makes subclassing work correct for wrapped built-ins
- module.exports = function ($this, dummy, Wrapper) {
- var NewTarget, NewTargetPrototype;
- if (
- // it can work only with native `setPrototypeOf`
- setPrototypeOf &&
- // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
- typeof (NewTarget = dummy.constructor) == "function" &&
- NewTarget !== Wrapper &&
- isObject((NewTargetPrototype = NewTarget.prototype)) &&
- NewTargetPrototype !== Wrapper.prototype
- )
- setPrototypeOf($this, NewTargetPrototype);
- return $this;
- };
- /***/
- },
- /***/ 2788: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var store = __webpack_require__(5465);
- var functionToString = Function.toString;
- // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
- if (typeof store.inspectSource != "function") {
- store.inspectSource = function (it) {
- return functionToString.call(it);
- };
- }
- module.exports = store.inspectSource;
- /***/
- },
- /***/ 9909: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var NATIVE_WEAK_MAP = __webpack_require__(8536);
- var global = __webpack_require__(7854);
- var isObject = __webpack_require__(111);
- var createNonEnumerableProperty = __webpack_require__(8880);
- var objectHas = __webpack_require__(6656);
- var sharedKey = __webpack_require__(6200);
- var hiddenKeys = __webpack_require__(3501);
- var WeakMap = global.WeakMap;
- var set, get, has;
- var enforce = function (it) {
- return has(it) ? get(it) : set(it, {});
- };
- var getterFor = function (TYPE) {
- return function (it) {
- var state;
- if (!isObject(it) || (state = get(it)).type !== TYPE) {
- throw TypeError("Incompatible receiver, " + TYPE + " required");
- }
- return state;
- };
- };
- if (NATIVE_WEAK_MAP) {
- var store = new WeakMap();
- var wmget = store.get;
- var wmhas = store.has;
- var wmset = store.set;
- set = function (it, metadata) {
- wmset.call(store, it, metadata);
- return metadata;
- };
- get = function (it) {
- return wmget.call(store, it) || {};
- };
- has = function (it) {
- return wmhas.call(store, it);
- };
- } else {
- var STATE = sharedKey("state");
- hiddenKeys[STATE] = true;
- set = function (it, metadata) {
- createNonEnumerableProperty(it, STATE, metadata);
- return metadata;
- };
- get = function (it) {
- return objectHas(it, STATE) ? it[STATE] : {};
- };
- has = function (it) {
- return objectHas(it, STATE);
- };
- }
- module.exports = {
- set: set,
- get: get,
- has: has,
- enforce: enforce,
- getterFor: getterFor
- };
- /***/
- },
- /***/ 7659: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var wellKnownSymbol = __webpack_require__(5112);
- var Iterators = __webpack_require__(7497);
- var ITERATOR = wellKnownSymbol("iterator");
- var ArrayPrototype = Array.prototype;
- // check on default Array iterator
- module.exports = function (it) {
- return (
- it !== undefined &&
- (Iterators.Array === it || ArrayPrototype[ITERATOR] === it)
- );
- };
- /***/
- },
- /***/ 3157: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var classof = __webpack_require__(4326);
- // `IsArray` abstract operation
- // https://tc39.github.io/ecma262/#sec-isarray
- module.exports =
- Array.isArray ||
- function isArray(arg) {
- return classof(arg) == "Array";
- };
- /***/
- },
- /***/ 4705: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var fails = __webpack_require__(7293);
- var replacement = /#|\.prototype\./;
- var isForced = function (feature, detection) {
- var value = data[normalize(feature)];
- return value == POLYFILL
- ? true
- : value == NATIVE
- ? false
- : typeof detection == "function"
- ? fails(detection)
- : !!detection;
- };
- var normalize = (isForced.normalize = function (string) {
- return String(string).replace(replacement, ".").toLowerCase();
- });
- var data = (isForced.data = {});
- var NATIVE = (isForced.NATIVE = "N");
- var POLYFILL = (isForced.POLYFILL = "P");
- module.exports = isForced;
- /***/
- },
- /***/ 111: /***/ function (module) {
- module.exports = function (it) {
- return typeof it === "object" ? it !== null : typeof it === "function";
- };
- /***/
- },
- /***/ 1913: /***/ function (module) {
- module.exports = false;
- /***/
- },
- /***/ 408: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var anObject = __webpack_require__(9670);
- var isArrayIteratorMethod = __webpack_require__(7659);
- var toLength = __webpack_require__(7466);
- var bind = __webpack_require__(9974);
- var getIteratorMethod = __webpack_require__(1246);
- var callWithSafeIterationClosing = __webpack_require__(3411);
- var Result = function (stopped, result) {
- this.stopped = stopped;
- this.result = result;
- };
- var iterate = (module.exports = function (
- iterable,
- fn,
- that,
- AS_ENTRIES,
- IS_ITERATOR
- ) {
- var boundFunction = bind(fn, that, AS_ENTRIES ? 2 : 1);
- var iterator, iterFn, index, length, result, next, step;
- if (IS_ITERATOR) {
- iterator = iterable;
- } else {
- iterFn = getIteratorMethod(iterable);
- if (typeof iterFn != "function")
- throw TypeError("Target is not iterable");
- // optimisation for array iterators
- if (isArrayIteratorMethod(iterFn)) {
- for (
- index = 0, length = toLength(iterable.length);
- length > index;
- index++
- ) {
- result = AS_ENTRIES
- ? boundFunction(anObject((step = iterable[index]))[0], step[1])
- : boundFunction(iterable[index]);
- if (result && result instanceof Result) return result;
- }
- return new Result(false);
- }
- iterator = iterFn.call(iterable);
- }
- next = iterator.next;
- while (!(step = next.call(iterator)).done) {
- result = callWithSafeIterationClosing(
- iterator,
- boundFunction,
- step.value,
- AS_ENTRIES
- );
- if (typeof result == "object" && result && result instanceof Result)
- return result;
- }
- return new Result(false);
- });
- iterate.stop = function (result) {
- return new Result(true, result);
- };
- /***/
- },
- /***/ 3383: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var getPrototypeOf = __webpack_require__(9518);
- var createNonEnumerableProperty = __webpack_require__(8880);
- var has = __webpack_require__(6656);
- var wellKnownSymbol = __webpack_require__(5112);
- var IS_PURE = __webpack_require__(1913);
- var ITERATOR = wellKnownSymbol("iterator");
- var BUGGY_SAFARI_ITERATORS = false;
- var returnThis = function () {
- return this;
- };
- // `%IteratorPrototype%` object
- // https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
- var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
- if ([].keys) {
- arrayIterator = [].keys();
- // Safari 8 has buggy iterators w/o `next`
- if (!("next" in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
- else {
- PrototypeOfArrayIteratorPrototype = getPrototypeOf(
- getPrototypeOf(arrayIterator)
- );
- if (PrototypeOfArrayIteratorPrototype !== Object.prototype)
- IteratorPrototype = PrototypeOfArrayIteratorPrototype;
- }
- }
- if (IteratorPrototype == undefined) IteratorPrototype = {};
- // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
- if (!IS_PURE && !has(IteratorPrototype, ITERATOR)) {
- createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);
- }
- module.exports = {
- IteratorPrototype: IteratorPrototype,
- BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
- };
- /***/
- },
- /***/ 7497: /***/ function (module) {
- module.exports = {};
- /***/
- },
- /***/ 5948: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var global = __webpack_require__(7854);
- var getOwnPropertyDescriptor = __webpack_require__(1236).f;
- var classof = __webpack_require__(4326);
- var macrotask = __webpack_require__(261).set;
- var IS_IOS = __webpack_require__(6833);
- var MutationObserver =
- global.MutationObserver || global.WebKitMutationObserver;
- var process = global.process;
- var Promise = global.Promise;
- var IS_NODE = classof(process) == "process";
- // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
- var queueMicrotaskDescriptor = getOwnPropertyDescriptor(
- global,
- "queueMicrotask"
- );
- var queueMicrotask =
- queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
- var flush, head, last, notify, toggle, node, promise, then;
- // modern engines have queueMicrotask method
- if (!queueMicrotask) {
- flush = function () {
- var parent, fn;
- if (IS_NODE && (parent = process.domain)) parent.exit();
- while (head) {
- fn = head.fn;
- head = head.next;
- try {
- fn();
- } catch (error) {
- if (head) notify();
- else last = undefined;
- throw error;
- }
- }
- last = undefined;
- if (parent) parent.enter();
- };
- // Node.js
- if (IS_NODE) {
- notify = function () {
- process.nextTick(flush);
- };
- // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
- } else if (MutationObserver && !IS_IOS) {
- toggle = true;
- node = document.createTextNode("");
- new MutationObserver(flush).observe(node, { characterData: true });
- notify = function () {
- node.data = toggle = !toggle;
- };
- // environments with maybe non-completely correct, but existent Promise
- } else if (Promise && Promise.resolve) {
- // Promise.resolve without an argument throws an error in LG WebOS 2
- promise = Promise.resolve(undefined);
- then = promise.then;
- notify = function () {
- then.call(promise, flush);
- };
- // for other environments - macrotask based on:
- // - setImmediate
- // - MessageChannel
- // - window.postMessag
- // - onreadystatechange
- // - setTimeout
- } else {
- notify = function () {
- // strange IE + webpack dev server bug - use .call(global)
- macrotask.call(global, flush);
- };
- }
- }
- module.exports =
- queueMicrotask ||
- function (fn) {
- var task = { fn: fn, next: undefined };
- if (last) last.next = task;
- if (!head) {
- head = task;
- notify();
- }
- last = task;
- };
- /***/
- },
- /***/ 3366: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var global = __webpack_require__(7854);
- module.exports = global.Promise;
- /***/
- },
- /***/ 133: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var fails = __webpack_require__(7293);
- module.exports =
- !!Object.getOwnPropertySymbols &&
- !fails(function () {
- // Chrome 38 Symbol has incorrect toString conversion
- // eslint-disable-next-line no-undef
- return !String(Symbol());
- });
- /***/
- },
- /***/ 8536: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var global = __webpack_require__(7854);
- var inspectSource = __webpack_require__(2788);
- var WeakMap = global.WeakMap;
- module.exports =
- typeof WeakMap === "function" &&
- /native code/.test(inspectSource(WeakMap));
- /***/
- },
- /***/ 8523: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var aFunction = __webpack_require__(3099);
- var PromiseCapability = function (C) {
- var resolve, reject;
- this.promise = new C(function ($$resolve, $$reject) {
- if (resolve !== undefined || reject !== undefined)
- throw TypeError("Bad Promise constructor");
- resolve = $$resolve;
- reject = $$reject;
- });
- this.resolve = aFunction(resolve);
- this.reject = aFunction(reject);
- };
- // 25.4.1.5 NewPromiseCapability(C)
- module.exports.f = function (C) {
- return new PromiseCapability(C);
- };
- /***/
- },
- /***/ 30: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var anObject = __webpack_require__(9670);
- var defineProperties = __webpack_require__(6048);
- var enumBugKeys = __webpack_require__(748);
- var hiddenKeys = __webpack_require__(3501);
- var html = __webpack_require__(490);
- var documentCreateElement = __webpack_require__(317);
- var sharedKey = __webpack_require__(6200);
- var GT = ">";
- var LT = "<";
- var PROTOTYPE = "prototype";
- var SCRIPT = "script";
- var IE_PROTO = sharedKey("IE_PROTO");
- var EmptyConstructor = function () {
- /* empty */
- };
- var scriptTag = function (content) {
- return LT + SCRIPT + GT + content + LT + "/" + SCRIPT + GT;
- };
- // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
- var NullProtoObjectViaActiveX = function (activeXDocument) {
- activeXDocument.write(scriptTag(""));
- activeXDocument.close();
- var temp = activeXDocument.parentWindow.Object;
- activeXDocument = null; // avoid memory leak
- return temp;
- };
- // Create object with fake `null` prototype: use iframe Object with cleared prototype
- var NullProtoObjectViaIFrame = function () {
- // Thrash, waste and sodomy: IE GC bug
- var iframe = documentCreateElement("iframe");
- var JS = "java" + SCRIPT + ":";
- var iframeDocument;
- iframe.style.display = "none";
- html.appendChild(iframe);
- // https://github.com/zloirock/core-js/issues/475
- iframe.src = String(JS);
- iframeDocument = iframe.contentWindow.document;
- iframeDocument.open();
- iframeDocument.write(scriptTag("document.F=Object"));
- iframeDocument.close();
- return iframeDocument.F;
- };
- // Check for document.domain and active x support
- // No need to use active x approach when document.domain is not set
- // see https://github.com/es-shims/es5-shim/issues/150
- // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
- // avoid IE GC bug
- var activeXDocument;
- var NullProtoObject = function () {
- try {
- /* global ActiveXObject */
- activeXDocument = document.domain && new ActiveXObject("htmlfile");
- } catch (error) {
- /* ignore */
- }
- NullProtoObject = activeXDocument
- ? NullProtoObjectViaActiveX(activeXDocument)
- : NullProtoObjectViaIFrame();
- var length = enumBugKeys.length;
- while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
- return NullProtoObject();
- };
- hiddenKeys[IE_PROTO] = true;
- // `Object.create` method
- // https://tc39.github.io/ecma262/#sec-object.create
- module.exports =
- Object.create ||
- function create(O, Properties) {
- var result;
- if (O !== null) {
- EmptyConstructor[PROTOTYPE] = anObject(O);
- result = new EmptyConstructor();
- EmptyConstructor[PROTOTYPE] = null;
- // add "__proto__" for Object.getPrototypeOf polyfill
- result[IE_PROTO] = O;
- } else result = NullProtoObject();
- return Properties === undefined
- ? result
- : defineProperties(result, Properties);
- };
- /***/
- },
- /***/ 6048: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var DESCRIPTORS = __webpack_require__(9781);
- var definePropertyModule = __webpack_require__(3070);
- var anObject = __webpack_require__(9670);
- var objectKeys = __webpack_require__(1956);
- // `Object.defineProperties` method
- // https://tc39.github.io/ecma262/#sec-object.defineproperties
- module.exports = DESCRIPTORS
- ? Object.defineProperties
- : function defineProperties(O, Properties) {
- anObject(O);
- var keys = objectKeys(Properties);
- var length = keys.length;
- var index = 0;
- var key;
- while (length > index)
- definePropertyModule.f(O, (key = keys[index++]), Properties[key]);
- return O;
- };
- /***/
- },
- /***/ 3070: /***/ function (
- __unused_webpack_module,
- exports,
- __webpack_require__
- ) {
- var DESCRIPTORS = __webpack_require__(9781);
- var IE8_DOM_DEFINE = __webpack_require__(4664);
- var anObject = __webpack_require__(9670);
- var toPrimitive = __webpack_require__(7593);
- var nativeDefineProperty = Object.defineProperty;
- // `Object.defineProperty` method
- // https://tc39.github.io/ecma262/#sec-object.defineproperty
- exports.f = DESCRIPTORS
- ? nativeDefineProperty
- : function defineProperty(O, P, Attributes) {
- anObject(O);
- P = toPrimitive(P, true);
- anObject(Attributes);
- if (IE8_DOM_DEFINE)
- try {
- return nativeDefineProperty(O, P, Attributes);
- } catch (error) {
- /* empty */
- }
- if ("get" in Attributes || "set" in Attributes)
- throw TypeError("Accessors not supported");
- if ("value" in Attributes) O[P] = Attributes.value;
- return O;
- };
- /***/
- },
- /***/ 1236: /***/ function (
- __unused_webpack_module,
- exports,
- __webpack_require__
- ) {
- var DESCRIPTORS = __webpack_require__(9781);
- var propertyIsEnumerableModule = __webpack_require__(5296);
- var createPropertyDescriptor = __webpack_require__(9114);
- var toIndexedObject = __webpack_require__(5656);
- var toPrimitive = __webpack_require__(7593);
- var has = __webpack_require__(6656);
- var IE8_DOM_DEFINE = __webpack_require__(4664);
- var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- // `Object.getOwnPropertyDescriptor` method
- // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
- exports.f = DESCRIPTORS
- ? nativeGetOwnPropertyDescriptor
- : function getOwnPropertyDescriptor(O, P) {
- O = toIndexedObject(O);
- P = toPrimitive(P, true);
- if (IE8_DOM_DEFINE)
- try {
- return nativeGetOwnPropertyDescriptor(O, P);
- } catch (error) {
- /* empty */
- }
- if (has(O, P))
- return createPropertyDescriptor(
- !propertyIsEnumerableModule.f.call(O, P),
- O[P]
- );
- };
- /***/
- },
- /***/ 8006: /***/ function (
- __unused_webpack_module,
- exports,
- __webpack_require__
- ) {
- var internalObjectKeys = __webpack_require__(6324);
- var enumBugKeys = __webpack_require__(748);
- var hiddenKeys = enumBugKeys.concat("length", "prototype");
- // `Object.getOwnPropertyNames` method
- // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
- exports.f =
- Object.getOwnPropertyNames ||
- function getOwnPropertyNames(O) {
- return internalObjectKeys(O, hiddenKeys);
- };
- /***/
- },
- /***/ 5181: /***/ function (__unused_webpack_module, exports) {
- exports.f = Object.getOwnPropertySymbols;
- /***/
- },
- /***/ 9518: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var has = __webpack_require__(6656);
- var toObject = __webpack_require__(7908);
- var sharedKey = __webpack_require__(6200);
- var CORRECT_PROTOTYPE_GETTER = __webpack_require__(8544);
- var IE_PROTO = sharedKey("IE_PROTO");
- var ObjectPrototype = Object.prototype;
- // `Object.getPrototypeOf` method
- // https://tc39.github.io/ecma262/#sec-object.getprototypeof
- module.exports = CORRECT_PROTOTYPE_GETTER
- ? Object.getPrototypeOf
- : function (O) {
- O = toObject(O);
- if (has(O, IE_PROTO)) return O[IE_PROTO];
- if (
- typeof O.constructor == "function" &&
- O instanceof O.constructor
- ) {
- return O.constructor.prototype;
- }
- return O instanceof Object ? ObjectPrototype : null;
- };
- /***/
- },
- /***/ 6324: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var has = __webpack_require__(6656);
- var toIndexedObject = __webpack_require__(5656);
- var indexOf = __webpack_require__(1318).indexOf;
- var hiddenKeys = __webpack_require__(3501);
- module.exports = function (object, names) {
- var O = toIndexedObject(object);
- var i = 0;
- var result = [];
- var key;
- for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
- // Don't enum bug & hidden keys
- while (names.length > i)
- if (has(O, (key = names[i++]))) {
- ~indexOf(result, key) || result.push(key);
- }
- return result;
- };
- /***/
- },
- /***/ 1956: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var internalObjectKeys = __webpack_require__(6324);
- var enumBugKeys = __webpack_require__(748);
- // `Object.keys` method
- // https://tc39.github.io/ecma262/#sec-object.keys
- module.exports =
- Object.keys ||
- function keys(O) {
- return internalObjectKeys(O, enumBugKeys);
- };
- /***/
- },
- /***/ 5296: /***/ function (__unused_webpack_module, exports) {
- "use strict";
- var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
- var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- // Nashorn ~ JDK8 bug
- var NASHORN_BUG =
- getOwnPropertyDescriptor &&
- !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
- // `Object.prototype.propertyIsEnumerable` method implementation
- // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
- exports.f = NASHORN_BUG
- ? function propertyIsEnumerable(V) {
- var descriptor = getOwnPropertyDescriptor(this, V);
- return !!descriptor && descriptor.enumerable;
- }
- : nativePropertyIsEnumerable;
- /***/
- },
- /***/ 7674: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var anObject = __webpack_require__(9670);
- var aPossiblePrototype = __webpack_require__(6077);
- // `Object.setPrototypeOf` method
- // https://tc39.github.io/ecma262/#sec-object.setprototypeof
- // Works with __proto__ only. Old v8 can't work with null proto objects.
- /* eslint-disable no-proto */
- module.exports =
- Object.setPrototypeOf ||
- ("__proto__" in {}
- ? (function () {
- var CORRECT_SETTER = false;
- var test = {};
- var setter;
- try {
- setter = Object.getOwnPropertyDescriptor(
- Object.prototype,
- "__proto__"
- ).set;
- setter.call(test, []);
- CORRECT_SETTER = test instanceof Array;
- } catch (error) {
- /* empty */
- }
- return function setPrototypeOf(O, proto) {
- anObject(O);
- aPossiblePrototype(proto);
- if (CORRECT_SETTER) setter.call(O, proto);
- else O.__proto__ = proto;
- return O;
- };
- })()
- : undefined);
- /***/
- },
- /***/ 3887: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var getBuiltIn = __webpack_require__(5005);
- var getOwnPropertyNamesModule = __webpack_require__(8006);
- var getOwnPropertySymbolsModule = __webpack_require__(5181);
- var anObject = __webpack_require__(9670);
- // all object keys, includes non-enumerable and symbols
- module.exports =
- getBuiltIn("Reflect", "ownKeys") ||
- function ownKeys(it) {
- var keys = getOwnPropertyNamesModule.f(anObject(it));
- var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
- return getOwnPropertySymbols
- ? keys.concat(getOwnPropertySymbols(it))
- : keys;
- };
- /***/
- },
- /***/ 857: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var global = __webpack_require__(7854);
- module.exports = global;
- /***/
- },
- /***/ 2534: /***/ function (module) {
- module.exports = function (exec) {
- try {
- return { error: false, value: exec() };
- } catch (error) {
- return { error: true, value: error };
- }
- };
- /***/
- },
- /***/ 9478: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var anObject = __webpack_require__(9670);
- var isObject = __webpack_require__(111);
- var newPromiseCapability = __webpack_require__(8523);
- module.exports = function (C, x) {
- anObject(C);
- if (isObject(x) && x.constructor === C) return x;
- var promiseCapability = newPromiseCapability.f(C);
- var resolve = promiseCapability.resolve;
- resolve(x);
- return promiseCapability.promise;
- };
- /***/
- },
- /***/ 2248: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var redefine = __webpack_require__(1320);
- module.exports = function (target, src, options) {
- for (var key in src) redefine(target, key, src[key], options);
- return target;
- };
- /***/
- },
- /***/ 1320: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var global = __webpack_require__(7854);
- var createNonEnumerableProperty = __webpack_require__(8880);
- var has = __webpack_require__(6656);
- var setGlobal = __webpack_require__(3505);
- var inspectSource = __webpack_require__(2788);
- var InternalStateModule = __webpack_require__(9909);
- var getInternalState = InternalStateModule.get;
- var enforceInternalState = InternalStateModule.enforce;
- var TEMPLATE = String(String).split("String");
- (module.exports = function (O, key, value, options) {
- var unsafe = options ? !!options.unsafe : false;
- var simple = options ? !!options.enumerable : false;
- var noTargetGet = options ? !!options.noTargetGet : false;
- if (typeof value == "function") {
- if (typeof key == "string" && !has(value, "name"))
- createNonEnumerableProperty(value, "name", key);
- enforceInternalState(value).source = TEMPLATE.join(
- typeof key == "string" ? key : ""
- );
- }
- if (O === global) {
- if (simple) O[key] = value;
- else setGlobal(key, value);
- return;
- } else if (!unsafe) {
- delete O[key];
- } else if (!noTargetGet && O[key]) {
- simple = true;
- }
- if (simple) O[key] = value;
- else createNonEnumerableProperty(O, key, value);
- // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
- })(Function.prototype, "toString", function toString() {
- return (
- (typeof this == "function" && getInternalState(this).source) ||
- inspectSource(this)
- );
- });
- /***/
- },
- /***/ 7066: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var anObject = __webpack_require__(9670);
- // `RegExp.prototype.flags` getter implementation
- // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
- module.exports = function () {
- var that = anObject(this);
- var result = "";
- if (that.global) result += "g";
- if (that.ignoreCase) result += "i";
- if (that.multiline) result += "m";
- if (that.dotAll) result += "s";
- if (that.unicode) result += "u";
- if (that.sticky) result += "y";
- return result;
- };
- /***/
- },
- /***/ 4488: /***/ function (module) {
- // `RequireObjectCoercible` abstract operation
- // https://tc39.github.io/ecma262/#sec-requireobjectcoercible
- module.exports = function (it) {
- if (it == undefined) throw TypeError("Can't call method on " + it);
- return it;
- };
- /***/
- },
- /***/ 3505: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var global = __webpack_require__(7854);
- var createNonEnumerableProperty = __webpack_require__(8880);
- module.exports = function (key, value) {
- try {
- createNonEnumerableProperty(global, key, value);
- } catch (error) {
- global[key] = value;
- }
- return value;
- };
- /***/
- },
- /***/ 6340: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var getBuiltIn = __webpack_require__(5005);
- var definePropertyModule = __webpack_require__(3070);
- var wellKnownSymbol = __webpack_require__(5112);
- var DESCRIPTORS = __webpack_require__(9781);
- var SPECIES = wellKnownSymbol("species");
- module.exports = function (CONSTRUCTOR_NAME) {
- var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
- var defineProperty = definePropertyModule.f;
- if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
- defineProperty(Constructor, SPECIES, {
- configurable: true,
- get: function () {
- return this;
- }
- });
- }
- };
- /***/
- },
- /***/ 8003: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var defineProperty = __webpack_require__(3070).f;
- var has = __webpack_require__(6656);
- var wellKnownSymbol = __webpack_require__(5112);
- var TO_STRING_TAG = wellKnownSymbol("toStringTag");
- module.exports = function (it, TAG, STATIC) {
- if (it && !has((it = STATIC ? it : it.prototype), TO_STRING_TAG)) {
- defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG });
- }
- };
- /***/
- },
- /***/ 6200: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var shared = __webpack_require__(2309);
- var uid = __webpack_require__(9711);
- var keys = shared("keys");
- module.exports = function (key) {
- return keys[key] || (keys[key] = uid(key));
- };
- /***/
- },
- /***/ 5465: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var global = __webpack_require__(7854);
- var setGlobal = __webpack_require__(3505);
- var SHARED = "__core-js_shared__";
- var store = global[SHARED] || setGlobal(SHARED, {});
- module.exports = store;
- /***/
- },
- /***/ 2309: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var IS_PURE = __webpack_require__(1913);
- var store = __webpack_require__(5465);
- (module.exports = function (key, value) {
- return store[key] || (store[key] = value !== undefined ? value : {});
- })("versions", []).push({
- version: "3.6.5",
- mode: IS_PURE ? "pure" : "global",
- copyright: "© 2020 Denis Pushkarev (zloirock.ru)"
- });
- /***/
- },
- /***/ 6707: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var anObject = __webpack_require__(9670);
- var aFunction = __webpack_require__(3099);
- var wellKnownSymbol = __webpack_require__(5112);
- var SPECIES = wellKnownSymbol("species");
- // `SpeciesConstructor` abstract operation
- // https://tc39.github.io/ecma262/#sec-speciesconstructor
- module.exports = function (O, defaultConstructor) {
- var C = anObject(O).constructor;
- var S;
- return C === undefined || (S = anObject(C)[SPECIES]) == undefined
- ? defaultConstructor
- : aFunction(S);
- };
- /***/
- },
- /***/ 261: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var global = __webpack_require__(7854);
- var fails = __webpack_require__(7293);
- var classof = __webpack_require__(4326);
- var bind = __webpack_require__(9974);
- var html = __webpack_require__(490);
- var createElement = __webpack_require__(317);
- var IS_IOS = __webpack_require__(6833);
- var location = global.location;
- var set = global.setImmediate;
- var clear = global.clearImmediate;
- var process = global.process;
- var MessageChannel = global.MessageChannel;
- var Dispatch = global.Dispatch;
- var counter = 0;
- var queue = {};
- var ONREADYSTATECHANGE = "onreadystatechange";
- var defer, channel, port;
- var run = function (id) {
- // eslint-disable-next-line no-prototype-builtins
- if (queue.hasOwnProperty(id)) {
- var fn = queue[id];
- delete queue[id];
- fn();
- }
- };
- var runner = function (id) {
- return function () {
- run(id);
- };
- };
- var listener = function (event) {
- run(event.data);
- };
- var post = function (id) {
- // old engines have not location.origin
- global.postMessage(id + "", location.protocol + "//" + location.host);
- };
- // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
- if (!set || !clear) {
- set = function setImmediate(fn) {
- var args = [];
- var i = 1;
- while (arguments.length > i) args.push(arguments[i++]);
- queue[++counter] = function () {
- // eslint-disable-next-line no-new-func
- (typeof fn == "function" ? fn : Function(fn)).apply(
- undefined,
- args
- );
- };
- defer(counter);
- return counter;
- };
- clear = function clearImmediate(id) {
- delete queue[id];
- };
- // Node.js 0.8-
- if (classof(process) == "process") {
- defer = function (id) {
- process.nextTick(runner(id));
- };
- // Sphere (JS game engine) Dispatch API
- } else if (Dispatch && Dispatch.now) {
- defer = function (id) {
- Dispatch.now(runner(id));
- };
- // Browsers with MessageChannel, includes WebWorkers
- // except iOS - https://github.com/zloirock/core-js/issues/624
- } else if (MessageChannel && !IS_IOS) {
- channel = new MessageChannel();
- port = channel.port2;
- channel.port1.onmessage = listener;
- defer = bind(port.postMessage, port, 1);
- // Browsers with postMessage, skip WebWorkers
- // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
- } else if (
- global.addEventListener &&
- typeof postMessage == "function" &&
- !global.importScripts &&
- !fails(post) &&
- location.protocol !== "file:"
- ) {
- defer = post;
- global.addEventListener("message", listener, false);
- // IE8-
- } else if (ONREADYSTATECHANGE in createElement("script")) {
- defer = function (id) {
- html.appendChild(createElement("script"))[ONREADYSTATECHANGE] =
- function () {
- html.removeChild(this);
- run(id);
- };
- };
- // Rest old browsers
- } else {
- defer = function (id) {
- setTimeout(runner(id), 0);
- };
- }
- }
- module.exports = {
- set: set,
- clear: clear
- };
- /***/
- },
- /***/ 1400: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var toInteger = __webpack_require__(9958);
- var max = Math.max;
- var min = Math.min;
- // Helper for a popular repeating case of the spec:
- // Let integer be ? ToInteger(index).
- // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
- module.exports = function (index, length) {
- var integer = toInteger(index);
- return integer < 0 ? max(integer + length, 0) : min(integer, length);
- };
- /***/
- },
- /***/ 7067: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var toInteger = __webpack_require__(9958);
- var toLength = __webpack_require__(7466);
- // `ToIndex` abstract operation
- // https://tc39.github.io/ecma262/#sec-toindex
- module.exports = function (it) {
- if (it === undefined) return 0;
- var number = toInteger(it);
- var length = toLength(number);
- if (number !== length) throw RangeError("Wrong length or index");
- return length;
- };
- /***/
- },
- /***/ 5656: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- // toObject with fallback for non-array-like ES3 strings
- var IndexedObject = __webpack_require__(8361);
- var requireObjectCoercible = __webpack_require__(4488);
- module.exports = function (it) {
- return IndexedObject(requireObjectCoercible(it));
- };
- /***/
- },
- /***/ 9958: /***/ function (module) {
- var ceil = Math.ceil;
- var floor = Math.floor;
- // `ToInteger` abstract operation
- // https://tc39.github.io/ecma262/#sec-tointeger
- module.exports = function (argument) {
- return isNaN((argument = +argument))
- ? 0
- : (argument > 0 ? floor : ceil)(argument);
- };
- /***/
- },
- /***/ 7466: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var toInteger = __webpack_require__(9958);
- var min = Math.min;
- // `ToLength` abstract operation
- // https://tc39.github.io/ecma262/#sec-tolength
- module.exports = function (argument) {
- return argument > 0 ? min(toInteger(argument), 0x1fffffffffffff) : 0; // 2 ** 53 - 1 == 9007199254740991
- };
- /***/
- },
- /***/ 7908: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var requireObjectCoercible = __webpack_require__(4488);
- // `ToObject` abstract operation
- // https://tc39.github.io/ecma262/#sec-toobject
- module.exports = function (argument) {
- return Object(requireObjectCoercible(argument));
- };
- /***/
- },
- /***/ 4590: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var toPositiveInteger = __webpack_require__(3002);
- module.exports = function (it, BYTES) {
- var offset = toPositiveInteger(it);
- if (offset % BYTES) throw RangeError("Wrong offset");
- return offset;
- };
- /***/
- },
- /***/ 3002: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var toInteger = __webpack_require__(9958);
- module.exports = function (it) {
- var result = toInteger(it);
- if (result < 0) throw RangeError("The argument can't be less than 0");
- return result;
- };
- /***/
- },
- /***/ 7593: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var isObject = __webpack_require__(111);
- // `ToPrimitive` abstract operation
- // https://tc39.github.io/ecma262/#sec-toprimitive
- // instead of the ES6 spec version, we didn't implement @@toPrimitive case
- // and the second argument - flag - preferred type is a string
- module.exports = function (input, PREFERRED_STRING) {
- if (!isObject(input)) return input;
- var fn, val;
- if (
- PREFERRED_STRING &&
- typeof (fn = input.toString) == "function" &&
- !isObject((val = fn.call(input)))
- )
- return val;
- if (
- typeof (fn = input.valueOf) == "function" &&
- !isObject((val = fn.call(input)))
- )
- return val;
- if (
- !PREFERRED_STRING &&
- typeof (fn = input.toString) == "function" &&
- !isObject((val = fn.call(input)))
- )
- return val;
- throw TypeError("Can't convert object to primitive value");
- };
- /***/
- },
- /***/ 1694: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var wellKnownSymbol = __webpack_require__(5112);
- var TO_STRING_TAG = wellKnownSymbol("toStringTag");
- var test = {};
- test[TO_STRING_TAG] = "z";
- module.exports = String(test) === "[object z]";
- /***/
- },
- /***/ 9843: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var $ = __webpack_require__(2109);
- var global = __webpack_require__(7854);
- var DESCRIPTORS = __webpack_require__(9781);
- var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS =
- __webpack_require__(3832);
- var ArrayBufferViewCore = __webpack_require__(260);
- var ArrayBufferModule = __webpack_require__(3331);
- var anInstance = __webpack_require__(5787);
- var createPropertyDescriptor = __webpack_require__(9114);
- var createNonEnumerableProperty = __webpack_require__(8880);
- var toLength = __webpack_require__(7466);
- var toIndex = __webpack_require__(7067);
- var toOffset = __webpack_require__(4590);
- var toPrimitive = __webpack_require__(7593);
- var has = __webpack_require__(6656);
- var classof = __webpack_require__(648);
- var isObject = __webpack_require__(111);
- var create = __webpack_require__(30);
- var setPrototypeOf = __webpack_require__(7674);
- var getOwnPropertyNames = __webpack_require__(8006).f;
- var typedArrayFrom = __webpack_require__(7321);
- var forEach = __webpack_require__(2092).forEach;
- var setSpecies = __webpack_require__(6340);
- var definePropertyModule = __webpack_require__(3070);
- var getOwnPropertyDescriptorModule = __webpack_require__(1236);
- var InternalStateModule = __webpack_require__(9909);
- var inheritIfRequired = __webpack_require__(9587);
- var getInternalState = InternalStateModule.get;
- var setInternalState = InternalStateModule.set;
- var nativeDefineProperty = definePropertyModule.f;
- var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
- var round = Math.round;
- var RangeError = global.RangeError;
- var ArrayBuffer = ArrayBufferModule.ArrayBuffer;
- var DataView = ArrayBufferModule.DataView;
- var NATIVE_ARRAY_BUFFER_VIEWS =
- ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS;
- var TYPED_ARRAY_TAG = ArrayBufferViewCore.TYPED_ARRAY_TAG;
- var TypedArray = ArrayBufferViewCore.TypedArray;
- var TypedArrayPrototype = ArrayBufferViewCore.TypedArrayPrototype;
- var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
- var isTypedArray = ArrayBufferViewCore.isTypedArray;
- var BYTES_PER_ELEMENT = "BYTES_PER_ELEMENT";
- var WRONG_LENGTH = "Wrong length";
- var fromList = function (C, list) {
- var index = 0;
- var length = list.length;
- var result = new (aTypedArrayConstructor(C))(length);
- while (length > index) result[index] = list[index++];
- return result;
- };
- var addGetter = function (it, key) {
- nativeDefineProperty(it, key, {
- get: function () {
- return getInternalState(this)[key];
- }
- });
- };
- var isArrayBuffer = function (it) {
- var klass;
- return (
- it instanceof ArrayBuffer ||
- (klass = classof(it)) == "ArrayBuffer" ||
- klass == "SharedArrayBuffer"
- );
- };
- var isTypedArrayIndex = function (target, key) {
- return (
- isTypedArray(target) &&
- typeof key != "symbol" &&
- key in target &&
- String(+key) == String(key)
- );
- };
- var wrappedGetOwnPropertyDescriptor = function getOwnPropertyDescriptor(
- target,
- key
- ) {
- return isTypedArrayIndex(target, (key = toPrimitive(key, true)))
- ? createPropertyDescriptor(2, target[key])
- : nativeGetOwnPropertyDescriptor(target, key);
- };
- var wrappedDefineProperty = function defineProperty(
- target,
- key,
- descriptor
- ) {
- if (
- isTypedArrayIndex(target, (key = toPrimitive(key, true))) &&
- isObject(descriptor) &&
- has(descriptor, "value") &&
- !has(descriptor, "get") &&
- !has(descriptor, "set") &&
- // TODO: add validation descriptor w/o calling accessors
- !descriptor.configurable &&
- (!has(descriptor, "writable") || descriptor.writable) &&
- (!has(descriptor, "enumerable") || descriptor.enumerable)
- ) {
- target[key] = descriptor.value;
- return target;
- }
- return nativeDefineProperty(target, key, descriptor);
- };
- if (DESCRIPTORS) {
- if (!NATIVE_ARRAY_BUFFER_VIEWS) {
- getOwnPropertyDescriptorModule.f = wrappedGetOwnPropertyDescriptor;
- definePropertyModule.f = wrappedDefineProperty;
- addGetter(TypedArrayPrototype, "buffer");
- addGetter(TypedArrayPrototype, "byteOffset");
- addGetter(TypedArrayPrototype, "byteLength");
- addGetter(TypedArrayPrototype, "length");
- }
- $(
- { target: "Object", stat: true, forced: !NATIVE_ARRAY_BUFFER_VIEWS },
- {
- getOwnPropertyDescriptor: wrappedGetOwnPropertyDescriptor,
- defineProperty: wrappedDefineProperty
- }
- );
- module.exports = function (TYPE, wrapper, CLAMPED) {
- var BYTES = TYPE.match(/\d+$/)[0] / 8;
- var CONSTRUCTOR_NAME = TYPE + (CLAMPED ? "Clamped" : "") + "Array";
- var GETTER = "get" + TYPE;
- var SETTER = "set" + TYPE;
- var NativeTypedArrayConstructor = global[CONSTRUCTOR_NAME];
- var TypedArrayConstructor = NativeTypedArrayConstructor;
- var TypedArrayConstructorPrototype =
- TypedArrayConstructor && TypedArrayConstructor.prototype;
- var exported = {};
- var getter = function (that, index) {
- var data = getInternalState(that);
- return data.view[GETTER](index * BYTES + data.byteOffset, true);
- };
- var setter = function (that, index, value) {
- var data = getInternalState(that);
- if (CLAMPED)
- value =
- (value = round(value)) < 0
- ? 0
- : value > 0xff
- ? 0xff
- : value & 0xff;
- data.view[SETTER](index * BYTES + data.byteOffset, value, true);
- };
- var addElement = function (that, index) {
- nativeDefineProperty(that, index, {
- get: function () {
- return getter(this, index);
- },
- set: function (value) {
- return setter(this, index, value);
- },
- enumerable: true
- });
- };
- if (!NATIVE_ARRAY_BUFFER_VIEWS) {
- TypedArrayConstructor = wrapper(function (
- that,
- data,
- offset,
- $length
- ) {
- anInstance(that, TypedArrayConstructor, CONSTRUCTOR_NAME);
- var index = 0;
- var byteOffset = 0;
- var buffer, byteLength, length;
- if (!isObject(data)) {
- length = toIndex(data);
- byteLength = length * BYTES;
- buffer = new ArrayBuffer(byteLength);
- } else if (isArrayBuffer(data)) {
- buffer = data;
- byteOffset = toOffset(offset, BYTES);
- var $len = data.byteLength;
- if ($length === undefined) {
- if ($len % BYTES) throw RangeError(WRONG_LENGTH);
- byteLength = $len - byteOffset;
- if (byteLength < 0) throw RangeError(WRONG_LENGTH);
- } else {
- byteLength = toLength($length) * BYTES;
- if (byteLength + byteOffset > $len)
- throw RangeError(WRONG_LENGTH);
- }
- length = byteLength / BYTES;
- } else if (isTypedArray(data)) {
- return fromList(TypedArrayConstructor, data);
- } else {
- return typedArrayFrom.call(TypedArrayConstructor, data);
- }
- setInternalState(that, {
- buffer: buffer,
- byteOffset: byteOffset,
- byteLength: byteLength,
- length: length,
- view: new DataView(buffer)
- });
- while (index < length) addElement(that, index++);
- });
- if (setPrototypeOf)
- setPrototypeOf(TypedArrayConstructor, TypedArray);
- TypedArrayConstructorPrototype = TypedArrayConstructor.prototype =
- create(TypedArrayPrototype);
- } else if (TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS) {
- TypedArrayConstructor = wrapper(function (
- dummy,
- data,
- typedArrayOffset,
- $length
- ) {
- anInstance(dummy, TypedArrayConstructor, CONSTRUCTOR_NAME);
- return inheritIfRequired(
- (function () {
- if (!isObject(data))
- return new NativeTypedArrayConstructor(toIndex(data));
- if (isArrayBuffer(data))
- return $length !== undefined
- ? new NativeTypedArrayConstructor(
- data,
- toOffset(typedArrayOffset, BYTES),
- $length
- )
- : typedArrayOffset !== undefined
- ? new NativeTypedArrayConstructor(
- data,
- toOffset(typedArrayOffset, BYTES)
- )
- : new NativeTypedArrayConstructor(data);
- if (isTypedArray(data))
- return fromList(TypedArrayConstructor, data);
- return typedArrayFrom.call(TypedArrayConstructor, data);
- })(),
- dummy,
- TypedArrayConstructor
- );
- });
- if (setPrototypeOf)
- setPrototypeOf(TypedArrayConstructor, TypedArray);
- forEach(
- getOwnPropertyNames(NativeTypedArrayConstructor),
- function (key) {
- if (!(key in TypedArrayConstructor)) {
- createNonEnumerableProperty(
- TypedArrayConstructor,
- key,
- NativeTypedArrayConstructor[key]
- );
- }
- }
- );
- TypedArrayConstructor.prototype = TypedArrayConstructorPrototype;
- }
- if (
- TypedArrayConstructorPrototype.constructor !== TypedArrayConstructor
- ) {
- createNonEnumerableProperty(
- TypedArrayConstructorPrototype,
- "constructor",
- TypedArrayConstructor
- );
- }
- if (TYPED_ARRAY_TAG) {
- createNonEnumerableProperty(
- TypedArrayConstructorPrototype,
- TYPED_ARRAY_TAG,
- CONSTRUCTOR_NAME
- );
- }
- exported[CONSTRUCTOR_NAME] = TypedArrayConstructor;
- $(
- {
- global: true,
- forced: TypedArrayConstructor != NativeTypedArrayConstructor,
- sham: !NATIVE_ARRAY_BUFFER_VIEWS
- },
- exported
- );
- if (!(BYTES_PER_ELEMENT in TypedArrayConstructor)) {
- createNonEnumerableProperty(
- TypedArrayConstructor,
- BYTES_PER_ELEMENT,
- BYTES
- );
- }
- if (!(BYTES_PER_ELEMENT in TypedArrayConstructorPrototype)) {
- createNonEnumerableProperty(
- TypedArrayConstructorPrototype,
- BYTES_PER_ELEMENT,
- BYTES
- );
- }
- setSpecies(CONSTRUCTOR_NAME);
- };
- } else
- module.exports = function () {
- /* empty */
- };
- /***/
- },
- /***/ 3832: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- /* eslint-disable no-new */
- var global = __webpack_require__(7854);
- var fails = __webpack_require__(7293);
- var checkCorrectnessOfIteration = __webpack_require__(7072);
- var NATIVE_ARRAY_BUFFER_VIEWS =
- __webpack_require__(260).NATIVE_ARRAY_BUFFER_VIEWS;
- var ArrayBuffer = global.ArrayBuffer;
- var Int8Array = global.Int8Array;
- module.exports =
- !NATIVE_ARRAY_BUFFER_VIEWS ||
- !fails(function () {
- Int8Array(1);
- }) ||
- !fails(function () {
- new Int8Array(-1);
- }) ||
- !checkCorrectnessOfIteration(function (iterable) {
- new Int8Array();
- new Int8Array(null);
- new Int8Array(1.5);
- new Int8Array(iterable);
- }, true) ||
- fails(function () {
- // Safari (11+) bug - a reason why even Safari 13 should load a typed array polyfill
- return new Int8Array(new ArrayBuffer(2), 1, undefined).length !== 1;
- });
- /***/
- },
- /***/ 7321: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var toObject = __webpack_require__(7908);
- var toLength = __webpack_require__(7466);
- var getIteratorMethod = __webpack_require__(1246);
- var isArrayIteratorMethod = __webpack_require__(7659);
- var bind = __webpack_require__(9974);
- var aTypedArrayConstructor =
- __webpack_require__(260).aTypedArrayConstructor;
- module.exports = function from(source /* , mapfn, thisArg */) {
- var O = toObject(source);
- var argumentsLength = arguments.length;
- var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
- var mapping = mapfn !== undefined;
- var iteratorMethod = getIteratorMethod(O);
- var i, length, result, step, iterator, next;
- if (
- iteratorMethod != undefined &&
- !isArrayIteratorMethod(iteratorMethod)
- ) {
- iterator = iteratorMethod.call(O);
- next = iterator.next;
- O = [];
- while (!(step = next.call(iterator)).done) {
- O.push(step.value);
- }
- }
- if (mapping && argumentsLength > 2) {
- mapfn = bind(mapfn, arguments[2], 2);
- }
- length = toLength(O.length);
- result = new (aTypedArrayConstructor(this))(length);
- for (i = 0; length > i; i++) {
- result[i] = mapping ? mapfn(O[i], i) : O[i];
- }
- return result;
- };
- /***/
- },
- /***/ 9711: /***/ function (module) {
- var id = 0;
- var postfix = Math.random();
- module.exports = function (key) {
- return (
- "Symbol(" +
- String(key === undefined ? "" : key) +
- ")_" +
- (++id + postfix).toString(36)
- );
- };
- /***/
- },
- /***/ 3307: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var NATIVE_SYMBOL = __webpack_require__(133);
- module.exports =
- NATIVE_SYMBOL &&
- // eslint-disable-next-line no-undef
- !Symbol.sham &&
- // eslint-disable-next-line no-undef
- typeof Symbol.iterator == "symbol";
- /***/
- },
- /***/ 6061: /***/ function (
- __unused_webpack_module,
- exports,
- __webpack_require__
- ) {
- var wellKnownSymbol = __webpack_require__(5112);
- exports.f = wellKnownSymbol;
- /***/
- },
- /***/ 5112: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var global = __webpack_require__(7854);
- var shared = __webpack_require__(2309);
- var has = __webpack_require__(6656);
- var uid = __webpack_require__(9711);
- var NATIVE_SYMBOL = __webpack_require__(133);
- var USE_SYMBOL_AS_UID = __webpack_require__(3307);
- var WellKnownSymbolsStore = shared("wks");
- var Symbol = global.Symbol;
- var createWellKnownSymbol = USE_SYMBOL_AS_UID
- ? Symbol
- : (Symbol && Symbol.withoutSetter) || uid;
- module.exports = function (name) {
- if (!has(WellKnownSymbolsStore, name)) {
- if (NATIVE_SYMBOL && has(Symbol, name))
- WellKnownSymbolsStore[name] = Symbol[name];
- else
- WellKnownSymbolsStore[name] = createWellKnownSymbol(
- "Symbol." + name
- );
- }
- return WellKnownSymbolsStore[name];
- };
- /***/
- },
- /***/ 7327: /***/ function (
- __unused_webpack_module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var $ = __webpack_require__(2109);
- var $filter = __webpack_require__(2092).filter;
- var arrayMethodHasSpeciesSupport = __webpack_require__(1194);
- var arrayMethodUsesToLength = __webpack_require__(9207);
- var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport("filter");
- // Edge 14- issue
- var USES_TO_LENGTH = arrayMethodUsesToLength("filter");
- // `Array.prototype.filter` method
- // https://tc39.github.io/ecma262/#sec-array.prototype.filter
- // with adding support of @@species
- $(
- {
- target: "Array",
- proto: true,
- forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH
- },
- {
- filter: function filter(callbackfn /* , thisArg */) {
- return $filter(
- this,
- callbackfn,
- arguments.length > 1 ? arguments[1] : undefined
- );
- }
- }
- );
- /***/
- },
- /***/ 6992: /***/ function (
- module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var toIndexedObject = __webpack_require__(5656);
- var addToUnscopables = __webpack_require__(1223);
- var Iterators = __webpack_require__(7497);
- var InternalStateModule = __webpack_require__(9909);
- var defineIterator = __webpack_require__(654);
- var ARRAY_ITERATOR = "Array Iterator";
- var setInternalState = InternalStateModule.set;
- var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
- // `Array.prototype.entries` method
- // https://tc39.github.io/ecma262/#sec-array.prototype.entries
- // `Array.prototype.keys` method
- // https://tc39.github.io/ecma262/#sec-array.prototype.keys
- // `Array.prototype.values` method
- // https://tc39.github.io/ecma262/#sec-array.prototype.values
- // `Array.prototype[@@iterator]` method
- // https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator
- // `CreateArrayIterator` internal method
- // https://tc39.github.io/ecma262/#sec-createarrayiterator
- module.exports = defineIterator(
- Array,
- "Array",
- function (iterated, kind) {
- setInternalState(this, {
- type: ARRAY_ITERATOR,
- target: toIndexedObject(iterated), // target
- index: 0, // next index
- kind: kind // kind
- });
- // `%ArrayIteratorPrototype%.next` method
- // https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next
- },
- function () {
- var state = getInternalState(this);
- var target = state.target;
- var kind = state.kind;
- var index = state.index++;
- if (!target || index >= target.length) {
- state.target = undefined;
- return { value: undefined, done: true };
- }
- if (kind == "keys") return { value: index, done: false };
- if (kind == "values") return { value: target[index], done: false };
- return { value: [index, target[index]], done: false };
- },
- "values"
- );
- // argumentsList[@@iterator] is %ArrayProto_values%
- // https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject
- // https://tc39.github.io/ecma262/#sec-createmappedargumentsobject
- Iterators.Arguments = Iterators.Array;
- // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
- addToUnscopables("keys");
- addToUnscopables("values");
- addToUnscopables("entries");
- /***/
- },
- /***/ 7042: /***/ function (
- __unused_webpack_module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var $ = __webpack_require__(2109);
- var isObject = __webpack_require__(111);
- var isArray = __webpack_require__(3157);
- var toAbsoluteIndex = __webpack_require__(1400);
- var toLength = __webpack_require__(7466);
- var toIndexedObject = __webpack_require__(5656);
- var createProperty = __webpack_require__(6135);
- var wellKnownSymbol = __webpack_require__(5112);
- var arrayMethodHasSpeciesSupport = __webpack_require__(1194);
- var arrayMethodUsesToLength = __webpack_require__(9207);
- var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport("slice");
- var USES_TO_LENGTH = arrayMethodUsesToLength("slice", {
- ACCESSORS: true,
- 0: 0,
- 1: 2
- });
- var SPECIES = wellKnownSymbol("species");
- var nativeSlice = [].slice;
- var max = Math.max;
- // `Array.prototype.slice` method
- // https://tc39.github.io/ecma262/#sec-array.prototype.slice
- // fallback for not array-like ES3 strings and DOM objects
- $(
- {
- target: "Array",
- proto: true,
- forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH
- },
- {
- slice: function slice(start, end) {
- var O = toIndexedObject(this);
- var length = toLength(O.length);
- var k = toAbsoluteIndex(start, length);
- var fin = toAbsoluteIndex(end === undefined ? length : end, length);
- // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
- var Constructor, result, n;
- if (isArray(O)) {
- Constructor = O.constructor;
- // cross-realm fallback
- if (
- typeof Constructor == "function" &&
- (Constructor === Array || isArray(Constructor.prototype))
- ) {
- Constructor = undefined;
- } else if (isObject(Constructor)) {
- Constructor = Constructor[SPECIES];
- if (Constructor === null) Constructor = undefined;
- }
- if (Constructor === Array || Constructor === undefined) {
- return nativeSlice.call(O, k, fin);
- }
- }
- result = new (Constructor === undefined ? Array : Constructor)(
- max(fin - k, 0)
- );
- for (n = 0; k < fin; k++, n++)
- if (k in O) createProperty(result, n, O[k]);
- result.length = n;
- return result;
- }
- }
- );
- /***/
- },
- /***/ 3706: /***/ function (
- __unused_webpack_module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var global = __webpack_require__(7854);
- var setToStringTag = __webpack_require__(8003);
- // JSON[@@toStringTag] property
- // https://tc39.github.io/ecma262/#sec-json-@@tostringtag
- setToStringTag(global.JSON, "JSON", true);
- /***/
- },
- /***/ 2703: /***/ function (
- __unused_webpack_module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var setToStringTag = __webpack_require__(8003);
- // Math[@@toStringTag] property
- // https://tc39.github.io/ecma262/#sec-math-@@tostringtag
- setToStringTag(Math, "Math", true);
- /***/
- },
- /***/ 9337: /***/ function (
- __unused_webpack_module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var $ = __webpack_require__(2109);
- var DESCRIPTORS = __webpack_require__(9781);
- var ownKeys = __webpack_require__(3887);
- var toIndexedObject = __webpack_require__(5656);
- var getOwnPropertyDescriptorModule = __webpack_require__(1236);
- var createProperty = __webpack_require__(6135);
- // `Object.getOwnPropertyDescriptors` method
- // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
- $(
- { target: "Object", stat: true, sham: !DESCRIPTORS },
- {
- getOwnPropertyDescriptors: function getOwnPropertyDescriptors(
- object
- ) {
- var O = toIndexedObject(object);
- var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
- var keys = ownKeys(O);
- var result = {};
- var index = 0;
- var key, descriptor;
- while (keys.length > index) {
- descriptor = getOwnPropertyDescriptor(O, (key = keys[index++]));
- if (descriptor !== undefined)
- createProperty(result, key, descriptor);
- }
- return result;
- }
- }
- );
- /***/
- },
- /***/ 8674: /***/ function (
- __unused_webpack_module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var $ = __webpack_require__(2109);
- var IS_PURE = __webpack_require__(1913);
- var global = __webpack_require__(7854);
- var getBuiltIn = __webpack_require__(5005);
- var NativePromise = __webpack_require__(3366);
- var redefine = __webpack_require__(1320);
- var redefineAll = __webpack_require__(2248);
- var setToStringTag = __webpack_require__(8003);
- var setSpecies = __webpack_require__(6340);
- var isObject = __webpack_require__(111);
- var aFunction = __webpack_require__(3099);
- var anInstance = __webpack_require__(5787);
- var classof = __webpack_require__(4326);
- var inspectSource = __webpack_require__(2788);
- var iterate = __webpack_require__(408);
- var checkCorrectnessOfIteration = __webpack_require__(7072);
- var speciesConstructor = __webpack_require__(6707);
- var task = __webpack_require__(261).set;
- var microtask = __webpack_require__(5948);
- var promiseResolve = __webpack_require__(9478);
- var hostReportErrors = __webpack_require__(842);
- var newPromiseCapabilityModule = __webpack_require__(8523);
- var perform = __webpack_require__(2534);
- var InternalStateModule = __webpack_require__(9909);
- var isForced = __webpack_require__(4705);
- var wellKnownSymbol = __webpack_require__(5112);
- var V8_VERSION = __webpack_require__(7392);
- var SPECIES = wellKnownSymbol("species");
- var PROMISE = "Promise";
- var getInternalState = InternalStateModule.get;
- var setInternalState = InternalStateModule.set;
- var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
- var PromiseConstructor = NativePromise;
- var TypeError = global.TypeError;
- var document = global.document;
- var process = global.process;
- var $fetch = getBuiltIn("fetch");
- var newPromiseCapability = newPromiseCapabilityModule.f;
- var newGenericPromiseCapability = newPromiseCapability;
- var IS_NODE = classof(process) == "process";
- var DISPATCH_EVENT = !!(
- document &&
- document.createEvent &&
- global.dispatchEvent
- );
- var UNHANDLED_REJECTION = "unhandledrejection";
- var REJECTION_HANDLED = "rejectionhandled";
- var PENDING = 0;
- var FULFILLED = 1;
- var REJECTED = 2;
- var HANDLED = 1;
- var UNHANDLED = 2;
- var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
- var FORCED = isForced(PROMISE, function () {
- var GLOBAL_CORE_JS_PROMISE =
- inspectSource(PromiseConstructor) !== String(PromiseConstructor);
- if (!GLOBAL_CORE_JS_PROMISE) {
- // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
- // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
- // We can't detect it synchronously, so just check versions
- if (V8_VERSION === 66) return true;
- // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
- if (!IS_NODE && typeof PromiseRejectionEvent != "function")
- return true;
- }
- // We need Promise#finally in the pure version for preventing prototype pollution
- if (IS_PURE && !PromiseConstructor.prototype["finally"]) return true;
- // We can't use @@species feature detection in V8 since it causes
- // deoptimization and performance degradation
- // https://github.com/zloirock/core-js/issues/679
- if (V8_VERSION >= 51 && /native code/.test(PromiseConstructor))
- return false;
- // Detect correctness of subclassing with @@species support
- var promise = PromiseConstructor.resolve(1);
- var FakePromise = function (exec) {
- exec(
- function () {
- /* empty */
- },
- function () {
- /* empty */
- }
- );
- };
- var constructor = (promise.constructor = {});
- constructor[SPECIES] = FakePromise;
- return !(
- promise.then(function () {
- /* empty */
- }) instanceof FakePromise
- );
- });
- var INCORRECT_ITERATION =
- FORCED ||
- !checkCorrectnessOfIteration(function (iterable) {
- PromiseConstructor.all(iterable)["catch"](function () {
- /* empty */
- });
- });
- // helpers
- var isThenable = function (it) {
- var then;
- return isObject(it) && typeof (then = it.then) == "function"
- ? then
- : false;
- };
- var notify = function (promise, state, isReject) {
- if (state.notified) return;
- state.notified = true;
- var chain = state.reactions;
- microtask(function () {
- var value = state.value;
- var ok = state.state == FULFILLED;
- var index = 0;
- // variable length - can't use forEach
- while (chain.length > index) {
- var reaction = chain[index++];
- var handler = ok ? reaction.ok : reaction.fail;
- var resolve = reaction.resolve;
- var reject = reaction.reject;
- var domain = reaction.domain;
- var result, then, exited;
- try {
- if (handler) {
- if (!ok) {
- if (state.rejection === UNHANDLED)
- onHandleUnhandled(promise, state);
- state.rejection = HANDLED;
- }
- if (handler === true) result = value;
- else {
- if (domain) domain.enter();
- result = handler(value); // can throw
- if (domain) {
- domain.exit();
- exited = true;
- }
- }
- if (result === reaction.promise) {
- reject(TypeError("Promise-chain cycle"));
- } else if ((then = isThenable(result))) {
- then.call(result, resolve, reject);
- } else resolve(result);
- } else reject(value);
- } catch (error) {
- if (domain && !exited) domain.exit();
- reject(error);
- }
- }
- state.reactions = [];
- state.notified = false;
- if (isReject && !state.rejection) onUnhandled(promise, state);
- });
- };
- var dispatchEvent = function (name, promise, reason) {
- var event, handler;
- if (DISPATCH_EVENT) {
- event = document.createEvent("Event");
- event.promise = promise;
- event.reason = reason;
- event.initEvent(name, false, true);
- global.dispatchEvent(event);
- } else event = { promise: promise, reason: reason };
- if ((handler = global["on" + name])) handler(event);
- else if (name === UNHANDLED_REJECTION)
- hostReportErrors("Unhandled promise rejection", reason);
- };
- var onUnhandled = function (promise, state) {
- task.call(global, function () {
- var value = state.value;
- var IS_UNHANDLED = isUnhandled(state);
- var result;
- if (IS_UNHANDLED) {
- result = perform(function () {
- if (IS_NODE) {
- process.emit("unhandledRejection", value, promise);
- } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
- });
- // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
- state.rejection =
- IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
- if (result.error) throw result.value;
- }
- });
- };
- var isUnhandled = function (state) {
- return state.rejection !== HANDLED && !state.parent;
- };
- var onHandleUnhandled = function (promise, state) {
- task.call(global, function () {
- if (IS_NODE) {
- process.emit("rejectionHandled", promise);
- } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
- });
- };
- var bind = function (fn, promise, state, unwrap) {
- return function (value) {
- fn(promise, state, value, unwrap);
- };
- };
- var internalReject = function (promise, state, value, unwrap) {
- if (state.done) return;
- state.done = true;
- if (unwrap) state = unwrap;
- state.value = value;
- state.state = REJECTED;
- notify(promise, state, true);
- };
- var internalResolve = function (promise, state, value, unwrap) {
- if (state.done) return;
- state.done = true;
- if (unwrap) state = unwrap;
- try {
- if (promise === value)
- throw TypeError("Promise can't be resolved itself");
- var then = isThenable(value);
- if (then) {
- microtask(function () {
- var wrapper = { done: false };
- try {
- then.call(
- value,
- bind(internalResolve, promise, wrapper, state),
- bind(internalReject, promise, wrapper, state)
- );
- } catch (error) {
- internalReject(promise, wrapper, error, state);
- }
- });
- } else {
- state.value = value;
- state.state = FULFILLED;
- notify(promise, state, false);
- }
- } catch (error) {
- internalReject(promise, { done: false }, error, state);
- }
- };
- // constructor polyfill
- if (FORCED) {
- // 25.4.3.1 Promise(executor)
- PromiseConstructor = function Promise(executor) {
- anInstance(this, PromiseConstructor, PROMISE);
- aFunction(executor);
- Internal.call(this);
- var state = getInternalState(this);
- try {
- executor(
- bind(internalResolve, this, state),
- bind(internalReject, this, state)
- );
- } catch (error) {
- internalReject(this, state, error);
- }
- };
- // eslint-disable-next-line no-unused-vars
- Internal = function Promise(executor) {
- setInternalState(this, {
- type: PROMISE,
- done: false,
- notified: false,
- parent: false,
- reactions: [],
- rejection: false,
- state: PENDING,
- value: undefined
- });
- };
- Internal.prototype = redefineAll(PromiseConstructor.prototype, {
- // `Promise.prototype.then` method
- // https://tc39.github.io/ecma262/#sec-promise.prototype.then
- then: function then(onFulfilled, onRejected) {
- var state = getInternalPromiseState(this);
- var reaction = newPromiseCapability(
- speciesConstructor(this, PromiseConstructor)
- );
- reaction.ok = typeof onFulfilled == "function" ? onFulfilled : true;
- reaction.fail = typeof onRejected == "function" && onRejected;
- reaction.domain = IS_NODE ? process.domain : undefined;
- state.parent = true;
- state.reactions.push(reaction);
- if (state.state != PENDING) notify(this, state, false);
- return reaction.promise;
- },
- // `Promise.prototype.catch` method
- // https://tc39.github.io/ecma262/#sec-promise.prototype.catch
- catch: function (onRejected) {
- return this.then(undefined, onRejected);
- }
- });
- OwnPromiseCapability = function () {
- var promise = new Internal();
- var state = getInternalState(promise);
- this.promise = promise;
- this.resolve = bind(internalResolve, promise, state);
- this.reject = bind(internalReject, promise, state);
- };
- newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
- return C === PromiseConstructor || C === PromiseWrapper
- ? new OwnPromiseCapability(C)
- : newGenericPromiseCapability(C);
- };
- if (!IS_PURE && typeof NativePromise == "function") {
- nativeThen = NativePromise.prototype.then;
- // wrap native Promise#then for native async functions
- redefine(
- NativePromise.prototype,
- "then",
- function then(onFulfilled, onRejected) {
- var that = this;
- return new PromiseConstructor(function (resolve, reject) {
- nativeThen.call(that, resolve, reject);
- }).then(onFulfilled, onRejected);
- // https://github.com/zloirock/core-js/issues/640
- },
- { unsafe: true }
- );
- // wrap fetch result
- if (typeof $fetch == "function")
- $(
- { global: true, enumerable: true, forced: true },
- {
- // eslint-disable-next-line no-unused-vars
- fetch: function fetch(input /* , init */) {
- return promiseResolve(
- PromiseConstructor,
- $fetch.apply(global, arguments)
- );
- }
- }
- );
- }
- }
- $(
- { global: true, wrap: true, forced: FORCED },
- {
- Promise: PromiseConstructor
- }
- );
- setToStringTag(PromiseConstructor, PROMISE, false, true);
- setSpecies(PROMISE);
- PromiseWrapper = getBuiltIn(PROMISE);
- // statics
- $(
- { target: PROMISE, stat: true, forced: FORCED },
- {
- // `Promise.reject` method
- // https://tc39.github.io/ecma262/#sec-promise.reject
- reject: function reject(r) {
- var capability = newPromiseCapability(this);
- capability.reject.call(undefined, r);
- return capability.promise;
- }
- }
- );
- $(
- { target: PROMISE, stat: true, forced: IS_PURE || FORCED },
- {
- // `Promise.resolve` method
- // https://tc39.github.io/ecma262/#sec-promise.resolve
- resolve: function resolve(x) {
- return promiseResolve(
- IS_PURE && this === PromiseWrapper ? PromiseConstructor : this,
- x
- );
- }
- }
- );
- $(
- { target: PROMISE, stat: true, forced: INCORRECT_ITERATION },
- {
- // `Promise.all` method
- // https://tc39.github.io/ecma262/#sec-promise.all
- all: function all(iterable) {
- var C = this;
- var capability = newPromiseCapability(C);
- var resolve = capability.resolve;
- var reject = capability.reject;
- var result = perform(function () {
- var $promiseResolve = aFunction(C.resolve);
- var values = [];
- var counter = 0;
- var remaining = 1;
- iterate(iterable, function (promise) {
- var index = counter++;
- var alreadyCalled = false;
- values.push(undefined);
- remaining++;
- $promiseResolve.call(C, promise).then(function (value) {
- if (alreadyCalled) return;
- alreadyCalled = true;
- values[index] = value;
- --remaining || resolve(values);
- }, reject);
- });
- --remaining || resolve(values);
- });
- if (result.error) reject(result.value);
- return capability.promise;
- },
- // `Promise.race` method
- // https://tc39.github.io/ecma262/#sec-promise.race
- race: function race(iterable) {
- var C = this;
- var capability = newPromiseCapability(C);
- var reject = capability.reject;
- var result = perform(function () {
- var $promiseResolve = aFunction(C.resolve);
- iterate(iterable, function (promise) {
- $promiseResolve
- .call(C, promise)
- .then(capability.resolve, reject);
- });
- });
- if (result.error) reject(result.value);
- return capability.promise;
- }
- }
- );
- /***/
- },
- /***/ 9714: /***/ function (
- __unused_webpack_module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var redefine = __webpack_require__(1320);
- var anObject = __webpack_require__(9670);
- var fails = __webpack_require__(7293);
- var flags = __webpack_require__(7066);
- var TO_STRING = "toString";
- var RegExpPrototype = RegExp.prototype;
- var nativeToString = RegExpPrototype[TO_STRING];
- var NOT_GENERIC = fails(function () {
- return nativeToString.call({ source: "a", flags: "b" }) != "/a/b";
- });
- // FF44- RegExp#toString has a wrong name
- var INCORRECT_NAME = nativeToString.name != TO_STRING;
- // `RegExp.prototype.toString` method
- // https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring
- if (NOT_GENERIC || INCORRECT_NAME) {
- redefine(
- RegExp.prototype,
- TO_STRING,
- function toString() {
- var R = anObject(this);
- var p = String(R.source);
- var rf = R.flags;
- var f = String(
- rf === undefined &&
- R instanceof RegExp &&
- !("flags" in RegExpPrototype)
- ? flags.call(R)
- : rf
- );
- return "/" + p + "/" + f;
- },
- { unsafe: true }
- );
- }
- /***/
- },
- /***/ 2443: /***/ function (
- __unused_webpack_module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var defineWellKnownSymbol = __webpack_require__(7235);
- // `Symbol.asyncIterator` well-known symbol
- // https://tc39.github.io/ecma262/#sec-symbol.asynciterator
- defineWellKnownSymbol("asyncIterator");
- /***/
- },
- /***/ 1817: /***/ function (
- __unused_webpack_module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- // `Symbol.prototype.description` getter
- // https://tc39.github.io/ecma262/#sec-symbol.prototype.description
- var $ = __webpack_require__(2109);
- var DESCRIPTORS = __webpack_require__(9781);
- var global = __webpack_require__(7854);
- var has = __webpack_require__(6656);
- var isObject = __webpack_require__(111);
- var defineProperty = __webpack_require__(3070).f;
- var copyConstructorProperties = __webpack_require__(9920);
- var NativeSymbol = global.Symbol;
- if (
- DESCRIPTORS &&
- typeof NativeSymbol == "function" &&
- (!("description" in NativeSymbol.prototype) ||
- // Safari 12 bug
- NativeSymbol().description !== undefined)
- ) {
- var EmptyStringDescriptionStore = {};
- // wrap Symbol constructor for correct work with undefined description
- var SymbolWrapper = function Symbol() {
- var description =
- arguments.length < 1 || arguments[0] === undefined
- ? undefined
- : String(arguments[0]);
- var result =
- this instanceof SymbolWrapper
- ? new NativeSymbol(description)
- : // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
- description === undefined
- ? NativeSymbol()
- : NativeSymbol(description);
- if (description === "") EmptyStringDescriptionStore[result] = true;
- return result;
- };
- copyConstructorProperties(SymbolWrapper, NativeSymbol);
- var symbolPrototype = (SymbolWrapper.prototype =
- NativeSymbol.prototype);
- symbolPrototype.constructor = SymbolWrapper;
- var symbolToString = symbolPrototype.toString;
- var native = String(NativeSymbol("test")) == "Symbol(test)";
- var regexp = /^Symbol\((.*)\)[^)]+$/;
- defineProperty(symbolPrototype, "description", {
- configurable: true,
- get: function description() {
- var symbol = isObject(this) ? this.valueOf() : this;
- var string = symbolToString.call(symbol);
- if (has(EmptyStringDescriptionStore, symbol)) return "";
- var desc = native
- ? string.slice(7, -1)
- : string.replace(regexp, "$1");
- return desc === "" ? undefined : desc;
- }
- });
- $(
- { global: true, forced: true },
- {
- Symbol: SymbolWrapper
- }
- );
- }
- /***/
- },
- /***/ 3105: /***/ function (
- __unused_webpack_module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var ArrayBufferViewCore = __webpack_require__(260);
- var $fill = __webpack_require__(1285);
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- // `%TypedArray%.prototype.fill` method
- // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.fill
- // eslint-disable-next-line no-unused-vars
- exportTypedArrayMethod("fill", function fill(value /* , start, end */) {
- return $fill.apply(aTypedArray(this), arguments);
- });
- /***/
- },
- /***/ 6319: /***/ function (
- __unused_webpack_module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var global = __webpack_require__(7854);
- var ArrayBufferViewCore = __webpack_require__(260);
- var ArrayIterators = __webpack_require__(6992);
- var wellKnownSymbol = __webpack_require__(5112);
- var ITERATOR = wellKnownSymbol("iterator");
- var Uint8Array = global.Uint8Array;
- var arrayValues = ArrayIterators.values;
- var arrayKeys = ArrayIterators.keys;
- var arrayEntries = ArrayIterators.entries;
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- var nativeTypedArrayIterator =
- Uint8Array && Uint8Array.prototype[ITERATOR];
- var CORRECT_ITER_NAME =
- !!nativeTypedArrayIterator &&
- (nativeTypedArrayIterator.name == "values" ||
- nativeTypedArrayIterator.name == undefined);
- var typedArrayValues = function values() {
- return arrayValues.call(aTypedArray(this));
- };
- // `%TypedArray%.prototype.entries` method
- // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.entries
- exportTypedArrayMethod("entries", function entries() {
- return arrayEntries.call(aTypedArray(this));
- });
- // `%TypedArray%.prototype.keys` method
- // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.keys
- exportTypedArrayMethod("keys", function keys() {
- return arrayKeys.call(aTypedArray(this));
- });
- // `%TypedArray%.prototype.values` method
- // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.values
- exportTypedArrayMethod("values", typedArrayValues, !CORRECT_ITER_NAME);
- // `%TypedArray%.prototype[@@iterator]` method
- // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype-@@iterator
- exportTypedArrayMethod(ITERATOR, typedArrayValues, !CORRECT_ITER_NAME);
- /***/
- },
- /***/ 3462: /***/ function (
- __unused_webpack_module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var ArrayBufferViewCore = __webpack_require__(260);
- var toLength = __webpack_require__(7466);
- var toOffset = __webpack_require__(4590);
- var toObject = __webpack_require__(7908);
- var fails = __webpack_require__(7293);
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- var FORCED = fails(function () {
- // eslint-disable-next-line no-undef
- new Int8Array(1).set({});
- });
- // `%TypedArray%.prototype.set` method
- // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.set
- exportTypedArrayMethod(
- "set",
- function set(arrayLike /* , offset */) {
- aTypedArray(this);
- var offset = toOffset(
- arguments.length > 1 ? arguments[1] : undefined,
- 1
- );
- var length = this.length;
- var src = toObject(arrayLike);
- var len = toLength(src.length);
- var index = 0;
- if (len + offset > length) throw RangeError("Wrong length");
- while (index < len) this[offset + index] = src[index++];
- },
- FORCED
- );
- /***/
- },
- /***/ 3824: /***/ function (
- __unused_webpack_module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var ArrayBufferViewCore = __webpack_require__(260);
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- var $sort = [].sort;
- // `%TypedArray%.prototype.sort` method
- // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.sort
- exportTypedArrayMethod("sort", function sort(comparefn) {
- return $sort.call(aTypedArray(this), comparefn);
- });
- /***/
- },
- /***/ 5016: /***/ function (
- __unused_webpack_module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- "use strict";
- var exportTypedArrayMethod =
- __webpack_require__(260).exportTypedArrayMethod;
- var fails = __webpack_require__(7293);
- var global = __webpack_require__(7854);
- var Uint8Array = global.Uint8Array;
- var Uint8ArrayPrototype = (Uint8Array && Uint8Array.prototype) || {};
- var arrayToString = [].toString;
- var arrayJoin = [].join;
- if (
- fails(function () {
- arrayToString.call({});
- })
- ) {
- arrayToString = function toString() {
- return arrayJoin.call(this);
- };
- }
- var IS_NOT_ARRAY_METHOD = Uint8ArrayPrototype.toString != arrayToString;
- // `%TypedArray%.prototype.toString` method
- // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.tostring
- exportTypedArrayMethod("toString", arrayToString, IS_NOT_ARRAY_METHOD);
- /***/
- },
- /***/ 9743: /***/ function (
- __unused_webpack_module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var createTypedArrayConstructor = __webpack_require__(9843);
- // `Uint8ClampedArray` constructor
- // https://tc39.github.io/ecma262/#sec-typedarray-objects
- createTypedArrayConstructor(
- "Uint8",
- function (init) {
- return function Uint8ClampedArray(data, byteOffset, length) {
- return init(this, data, byteOffset, length);
- };
- },
- true
- );
- /***/
- },
- /***/ 4747: /***/ function (
- __unused_webpack_module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var global = __webpack_require__(7854);
- var DOMIterables = __webpack_require__(8324);
- var forEach = __webpack_require__(8533);
- var createNonEnumerableProperty = __webpack_require__(8880);
- for (var COLLECTION_NAME in DOMIterables) {
- var Collection = global[COLLECTION_NAME];
- var CollectionPrototype = Collection && Collection.prototype;
- // some Chrome versions have non-configurable methods on DOMTokenList
- if (CollectionPrototype && CollectionPrototype.forEach !== forEach)
- try {
- createNonEnumerableProperty(
- CollectionPrototype,
- "forEach",
- forEach
- );
- } catch (error) {
- CollectionPrototype.forEach = forEach;
- }
- }
- /***/
- },
- /***/ 3948: /***/ function (
- __unused_webpack_module,
- __unused_webpack_exports,
- __webpack_require__
- ) {
- var global = __webpack_require__(7854);
- var DOMIterables = __webpack_require__(8324);
- var ArrayIteratorMethods = __webpack_require__(6992);
- var createNonEnumerableProperty = __webpack_require__(8880);
- var wellKnownSymbol = __webpack_require__(5112);
- var ITERATOR = wellKnownSymbol("iterator");
- var TO_STRING_TAG = wellKnownSymbol("toStringTag");
- var ArrayValues = ArrayIteratorMethods.values;
- for (var COLLECTION_NAME in DOMIterables) {
- var Collection = global[COLLECTION_NAME];
- var CollectionPrototype = Collection && Collection.prototype;
- if (CollectionPrototype) {
- // some Chrome versions have non-configurable methods on DOMTokenList
- if (CollectionPrototype[ITERATOR] !== ArrayValues)
- try {
- createNonEnumerableProperty(
- CollectionPrototype,
- ITERATOR,
- ArrayValues
- );
- } catch (error) {
- CollectionPrototype[ITERATOR] = ArrayValues;
- }
- if (!CollectionPrototype[TO_STRING_TAG]) {
- createNonEnumerableProperty(
- CollectionPrototype,
- TO_STRING_TAG,
- COLLECTION_NAME
- );
- }
- if (DOMIterables[COLLECTION_NAME])
- for (var METHOD_NAME in ArrayIteratorMethods) {
- // some Chrome versions have non-configurable methods on DOMTokenList
- if (
- CollectionPrototype[METHOD_NAME] !==
- ArrayIteratorMethods[METHOD_NAME]
- )
- try {
- createNonEnumerableProperty(
- CollectionPrototype,
- METHOD_NAME,
- ArrayIteratorMethods[METHOD_NAME]
- );
- } catch (error) {
- CollectionPrototype[METHOD_NAME] =
- ArrayIteratorMethods[METHOD_NAME];
- }
- }
- }
- }
- /***/
- }
- /******/
- };
- /************************************************************************/
- /******/ // The module cache
- /******/ var __webpack_module_cache__ = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/ // Check if module is in cache
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
- /******/ if (cachedModule !== undefined) {
- /******/ return cachedModule.exports;
- /******/
- }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = (__webpack_module_cache__[moduleId] = {
- /******/ // no module.id needed
- /******/ // no module.loaded needed
- /******/ exports: {}
- /******/
- });
- /******/
- /******/ // Execute the module function
- /******/ __webpack_modules__[moduleId](
- module,
- module.exports,
- __webpack_require__
- );
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/
- }
- /******/
- /************************************************************************/
- /******/ /* webpack/runtime/compat get default export */
- /******/ !(function () {
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = function (module) {
- /******/ var getter =
- module && module.__esModule
- ? /******/ function () {
- return module["default"];
- }
- : /******/ function () {
- return module;
- };
- /******/ __webpack_require__.d(getter, { a: getter });
- /******/ return getter;
- /******/
- };
- /******/
- })();
- /******/
- /******/ /* webpack/runtime/define property getters */
- /******/ !(function () {
- /******/ // define getter functions for harmony exports
- /******/ __webpack_require__.d = function (exports, definition) {
- /******/ for (var key in definition) {
- /******/ if (
- __webpack_require__.o(definition, key) &&
- !__webpack_require__.o(exports, key)
- ) {
- /******/ Object.defineProperty(exports, key, {
- enumerable: true,
- get: definition[key]
- });
- /******/
- }
- /******/
- }
- /******/
- };
- /******/
- })();
- /******/
- /******/ /* webpack/runtime/global */
- /******/ !(function () {
- /******/ __webpack_require__.g = (function () {
- /******/ if (typeof globalThis === "object") return globalThis;
- /******/ try {
- /******/ return this || new Function("return this")();
- /******/
- } catch (e) {
- /******/ if (typeof window === "object") return window;
- /******/
- }
- /******/
- })();
- /******/
- })();
- /******/
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
- /******/ !(function () {
- /******/ __webpack_require__.o = function (obj, prop) {
- return Object.prototype.hasOwnProperty.call(obj, prop);
- };
- /******/
- })();
- /******/
- /************************************************************************/
- var __webpack_exports__ = {};
- // This entry need to be wrapped in an IIFE because it need to be in strict mode.
- !(function () {
- "use strict";
- /* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_0__ =
- __webpack_require__(7042);
- /* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_0___default =
- /*#__PURE__*/ __webpack_require__.n(
- core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_0__
- );
- /* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_1__ =
- __webpack_require__(6992);
- /* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_1___default =
- /*#__PURE__*/ __webpack_require__.n(
- core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_1__
- );
- /* harmony import */ var core_js_modules_es_typed_array_uint8_clamped_array_js__WEBPACK_IMPORTED_MODULE_2__ =
- __webpack_require__(9743);
- /* harmony import */ var core_js_modules_es_typed_array_uint8_clamped_array_js__WEBPACK_IMPORTED_MODULE_2___default =
- /*#__PURE__*/ __webpack_require__.n(
- core_js_modules_es_typed_array_uint8_clamped_array_js__WEBPACK_IMPORTED_MODULE_2__
- );
- /* harmony import */ var core_js_modules_es_typed_array_fill_js__WEBPACK_IMPORTED_MODULE_3__ =
- __webpack_require__(3105);
- /* harmony import */ var core_js_modules_es_typed_array_fill_js__WEBPACK_IMPORTED_MODULE_3___default =
- /*#__PURE__*/ __webpack_require__.n(
- core_js_modules_es_typed_array_fill_js__WEBPACK_IMPORTED_MODULE_3__
- );
- /* harmony import */ var core_js_modules_es_typed_array_iterator_js__WEBPACK_IMPORTED_MODULE_4__ =
- __webpack_require__(6319);
- /* harmony import */ var core_js_modules_es_typed_array_iterator_js__WEBPACK_IMPORTED_MODULE_4___default =
- /*#__PURE__*/ __webpack_require__.n(
- core_js_modules_es_typed_array_iterator_js__WEBPACK_IMPORTED_MODULE_4__
- );
- /* harmony import */ var core_js_modules_es_typed_array_set_js__WEBPACK_IMPORTED_MODULE_5__ =
- __webpack_require__(3462);
- /* harmony import */ var core_js_modules_es_typed_array_set_js__WEBPACK_IMPORTED_MODULE_5___default =
- /*#__PURE__*/ __webpack_require__.n(
- core_js_modules_es_typed_array_set_js__WEBPACK_IMPORTED_MODULE_5__
- );
- /* harmony import */ var core_js_modules_es_typed_array_sort_js__WEBPACK_IMPORTED_MODULE_6__ =
- __webpack_require__(3824);
- /* harmony import */ var core_js_modules_es_typed_array_sort_js__WEBPACK_IMPORTED_MODULE_6___default =
- /*#__PURE__*/ __webpack_require__.n(
- core_js_modules_es_typed_array_sort_js__WEBPACK_IMPORTED_MODULE_6__
- );
- /* harmony import */ var core_js_modules_es_typed_array_to_string_js__WEBPACK_IMPORTED_MODULE_7__ =
- __webpack_require__(5016);
- /* harmony import */ var core_js_modules_es_typed_array_to_string_js__WEBPACK_IMPORTED_MODULE_7___default =
- /*#__PURE__*/ __webpack_require__.n(
- core_js_modules_es_typed_array_to_string_js__WEBPACK_IMPORTED_MODULE_7__
- );
- /* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_8__ =
- __webpack_require__(4747);
- /* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_8___default =
- /*#__PURE__*/ __webpack_require__.n(
- core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_8__
- );
- /* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_9__ =
- __webpack_require__(9714);
- /* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_9___default =
- /*#__PURE__*/ __webpack_require__.n(
- core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_9__
- );
- /* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_10__ =
- __webpack_require__(1817);
- /* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_10___default =
- /*#__PURE__*/ __webpack_require__.n(
- core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_10__
- );
- /* harmony import */ var core_js_modules_es_promise_js__WEBPACK_IMPORTED_MODULE_11__ =
- __webpack_require__(8674);
- /* harmony import */ var core_js_modules_es_promise_js__WEBPACK_IMPORTED_MODULE_11___default =
- /*#__PURE__*/ __webpack_require__.n(
- core_js_modules_es_promise_js__WEBPACK_IMPORTED_MODULE_11__
- );
- /* harmony import */ var core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_12__ =
- __webpack_require__(7327);
- /* harmony import */ var core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_12___default =
- /*#__PURE__*/ __webpack_require__.n(
- core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_12__
- );
- /* harmony import */ var core_js_modules_es_object_get_own_property_descriptors_js__WEBPACK_IMPORTED_MODULE_13__ =
- __webpack_require__(9337);
- /* harmony import */ var core_js_modules_es_object_get_own_property_descriptors_js__WEBPACK_IMPORTED_MODULE_13___default =
- /*#__PURE__*/ __webpack_require__.n(
- core_js_modules_es_object_get_own_property_descriptors_js__WEBPACK_IMPORTED_MODULE_13__
- );
- /* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_14__ =
- __webpack_require__(3948);
- /* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_14___default =
- /*#__PURE__*/ __webpack_require__.n(
- core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_14__
- );
- /* harmony import */ var core_js_modules_es_symbol_async_iterator_js__WEBPACK_IMPORTED_MODULE_15__ =
- __webpack_require__(2443);
- /* harmony import */ var core_js_modules_es_symbol_async_iterator_js__WEBPACK_IMPORTED_MODULE_15___default =
- /*#__PURE__*/ __webpack_require__.n(
- core_js_modules_es_symbol_async_iterator_js__WEBPACK_IMPORTED_MODULE_15__
- );
- /* harmony import */ var core_js_modules_es_json_to_string_tag_js__WEBPACK_IMPORTED_MODULE_16__ =
- __webpack_require__(3706);
- /* harmony import */ var core_js_modules_es_json_to_string_tag_js__WEBPACK_IMPORTED_MODULE_16___default =
- /*#__PURE__*/ __webpack_require__.n(
- core_js_modules_es_json_to_string_tag_js__WEBPACK_IMPORTED_MODULE_16__
- );
- /* harmony import */ var core_js_modules_es_math_to_string_tag_js__WEBPACK_IMPORTED_MODULE_17__ =
- __webpack_require__(2703);
- /* harmony import */ var core_js_modules_es_math_to_string_tag_js__WEBPACK_IMPORTED_MODULE_17___default =
- /*#__PURE__*/ __webpack_require__.n(
- core_js_modules_es_math_to_string_tag_js__WEBPACK_IMPORTED_MODULE_17__
- );
- function _regeneratorRuntime() {
- "use strict";
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime =
- function _regeneratorRuntime() {
- return exports;
- };
- var exports = {},
- Op = Object.prototype,
- hasOwn = Op.hasOwnProperty,
- defineProperty =
- Object.defineProperty ||
- function (obj, key, desc) {
- obj[key] = desc.value;
- },
- $Symbol = "function" == typeof Symbol ? Symbol : {},
- iteratorSymbol = $Symbol.iterator || "@@iterator",
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
- function define(obj, key, value) {
- return (
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: !0,
- configurable: !0,
- writable: !0
- }),
- obj[key]
- );
- }
- try {
- define({}, "");
- } catch (err) {
- define = function define(obj, key, value) {
- return (obj[key] = value);
- };
- }
- function wrap(innerFn, outerFn, self, tryLocsList) {
- var protoGenerator =
- outerFn && outerFn.prototype instanceof Generator
- ? outerFn
- : Generator,
- generator = Object.create(protoGenerator.prototype),
- context = new Context(tryLocsList || []);
- return (
- defineProperty(generator, "_invoke", {
- value: makeInvokeMethod(innerFn, self, context)
- }),
- generator
- );
- }
- function tryCatch(fn, obj, arg) {
- try {
- return { type: "normal", arg: fn.call(obj, arg) };
- } catch (err) {
- return { type: "throw", arg: err };
- }
- }
- exports.wrap = wrap;
- var ContinueSentinel = {};
- function Generator() {}
- function GeneratorFunction() {}
- function GeneratorFunctionPrototype() {}
- var IteratorPrototype = {};
- define(IteratorPrototype, iteratorSymbol, function () {
- return this;
- });
- var getProto = Object.getPrototypeOf,
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
- NativeIteratorPrototype &&
- NativeIteratorPrototype !== Op &&
- hasOwn.call(NativeIteratorPrototype, iteratorSymbol) &&
- (IteratorPrototype = NativeIteratorPrototype);
- var Gp =
- (GeneratorFunctionPrototype.prototype =
- Generator.prototype =
- Object.create(IteratorPrototype));
- function defineIteratorMethods(prototype) {
- ["next", "throw", "return"].forEach(function (method) {
- define(prototype, method, function (arg) {
- return this._invoke(method, arg);
- });
- });
- }
- function AsyncIterator(generator, PromiseImpl) {
- function invoke(method, arg, resolve, reject) {
- var record = tryCatch(generator[method], generator, arg);
- if ("throw" !== record.type) {
- var result = record.arg,
- value = result.value;
- return value &&
- "object" == typeof value &&
- hasOwn.call(value, "__await")
- ? PromiseImpl.resolve(value.__await).then(
- function (value) {
- invoke("next", value, resolve, reject);
- },
- function (err) {
- invoke("throw", err, resolve, reject);
- }
- )
- : PromiseImpl.resolve(value).then(
- function (unwrapped) {
- (result.value = unwrapped), resolve(result);
- },
- function (error) {
- return invoke("throw", error, resolve, reject);
- }
- );
- }
- reject(record.arg);
- }
- var previousPromise;
- defineProperty(this, "_invoke", {
- value: function value(method, arg) {
- function callInvokeWithMethodAndArg() {
- return new PromiseImpl(function (resolve, reject) {
- invoke(method, arg, resolve, reject);
- });
- }
- return (previousPromise = previousPromise
- ? previousPromise.then(
- callInvokeWithMethodAndArg,
- callInvokeWithMethodAndArg
- )
- : callInvokeWithMethodAndArg());
- }
- });
- }
- function makeInvokeMethod(innerFn, self, context) {
- var state = "suspendedStart";
- return function (method, arg) {
- if ("executing" === state)
- throw new Error("Generator is already running");
- if ("completed" === state) {
- if ("throw" === method) throw arg;
- return doneResult();
- }
- for (context.method = method, context.arg = arg; ; ) {
- var delegate = context.delegate;
- if (delegate) {
- var delegateResult = maybeInvokeDelegate(delegate, context);
- if (delegateResult) {
- if (delegateResult === ContinueSentinel) continue;
- return delegateResult;
- }
- }
- if ("next" === context.method)
- context.sent = context._sent = context.arg;
- else if ("throw" === context.method) {
- if ("suspendedStart" === state)
- throw ((state = "completed"), context.arg);
- context.dispatchException(context.arg);
- } else
- "return" === context.method &&
- context.abrupt("return", context.arg);
- state = "executing";
- var record = tryCatch(innerFn, self, context);
- if ("normal" === record.type) {
- if (
- ((state = context.done ? "completed" : "suspendedYield"),
- record.arg === ContinueSentinel)
- )
- continue;
- return { value: record.arg, done: context.done };
- }
- "throw" === record.type &&
- ((state = "completed"),
- (context.method = "throw"),
- (context.arg = record.arg));
- }
- };
- }
- function maybeInvokeDelegate(delegate, context) {
- var method = delegate.iterator[context.method];
- if (undefined === method) {
- if (((context.delegate = null), "throw" === context.method)) {
- if (
- delegate.iterator.return &&
- ((context.method = "return"),
- (context.arg = undefined),
- maybeInvokeDelegate(delegate, context),
- "throw" === context.method)
- )
- return ContinueSentinel;
- (context.method = "throw"),
- (context.arg = new TypeError(
- "The iterator does not provide a 'throw' method"
- ));
- }
- return ContinueSentinel;
- }
- var record = tryCatch(method, delegate.iterator, context.arg);
- if ("throw" === record.type)
- return (
- (context.method = "throw"),
- (context.arg = record.arg),
- (context.delegate = null),
- ContinueSentinel
- );
- var info = record.arg;
- return info
- ? info.done
- ? ((context[delegate.resultName] = info.value),
- (context.next = delegate.nextLoc),
- "return" !== context.method &&
- ((context.method = "next"), (context.arg = undefined)),
- (context.delegate = null),
- ContinueSentinel)
- : info
- : ((context.method = "throw"),
- (context.arg = new TypeError("iterator result is not an object")),
- (context.delegate = null),
- ContinueSentinel);
- }
- function pushTryEntry(locs) {
- var entry = { tryLoc: locs[0] };
- 1 in locs && (entry.catchLoc = locs[1]),
- 2 in locs &&
- ((entry.finallyLoc = locs[2]), (entry.afterLoc = locs[3])),
- this.tryEntries.push(entry);
- }
- function resetTryEntry(entry) {
- var record = entry.completion || {};
- (record.type = "normal"),
- delete record.arg,
- (entry.completion = record);
- }
- function Context(tryLocsList) {
- (this.tryEntries = [{ tryLoc: "root" }]),
- tryLocsList.forEach(pushTryEntry, this),
- this.reset(!0);
- }
- function values(iterable) {
- if (iterable) {
- var iteratorMethod = iterable[iteratorSymbol];
- if (iteratorMethod) return iteratorMethod.call(iterable);
- if ("function" == typeof iterable.next) return iterable;
- if (!isNaN(iterable.length)) {
- var i = -1,
- next = function next() {
- for (; ++i < iterable.length; )
- if (hasOwn.call(iterable, i))
- return (next.value = iterable[i]), (next.done = !1), next;
- return (next.value = undefined), (next.done = !0), next;
- };
- return (next.next = next);
- }
- }
- return { next: doneResult };
- }
- function doneResult() {
- return { value: undefined, done: !0 };
- }
- return (
- (GeneratorFunction.prototype = GeneratorFunctionPrototype),
- defineProperty(Gp, "constructor", {
- value: GeneratorFunctionPrototype,
- configurable: !0
- }),
- defineProperty(GeneratorFunctionPrototype, "constructor", {
- value: GeneratorFunction,
- configurable: !0
- }),
- (GeneratorFunction.displayName = define(
- GeneratorFunctionPrototype,
- toStringTagSymbol,
- "GeneratorFunction"
- )),
- (exports.isGeneratorFunction = function (genFun) {
- var ctor = "function" == typeof genFun && genFun.constructor;
- return (
- !!ctor &&
- (ctor === GeneratorFunction ||
- "GeneratorFunction" === (ctor.displayName || ctor.name))
- );
- }),
- (exports.mark = function (genFun) {
- return (
- Object.setPrototypeOf
- ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype)
- : ((genFun.__proto__ = GeneratorFunctionPrototype),
- define(genFun, toStringTagSymbol, "GeneratorFunction")),
- (genFun.prototype = Object.create(Gp)),
- genFun
- );
- }),
- (exports.awrap = function (arg) {
- return { __await: arg };
- }),
- defineIteratorMethods(AsyncIterator.prototype),
- define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
- return this;
- }),
- (exports.AsyncIterator = AsyncIterator),
- (exports.async = function (
- innerFn,
- outerFn,
- self,
- tryLocsList,
- PromiseImpl
- ) {
- void 0 === PromiseImpl && (PromiseImpl = Promise);
- var iter = new AsyncIterator(
- wrap(innerFn, outerFn, self, tryLocsList),
- PromiseImpl
- );
- return exports.isGeneratorFunction(outerFn)
- ? iter
- : iter.next().then(function (result) {
- return result.done ? result.value : iter.next();
- });
- }),
- defineIteratorMethods(Gp),
- define(Gp, toStringTagSymbol, "Generator"),
- define(Gp, iteratorSymbol, function () {
- return this;
- }),
- define(Gp, "toString", function () {
- return "[object Generator]";
- }),
- (exports.keys = function (val) {
- var object = Object(val),
- keys = [];
- for (var key in object) keys.push(key);
- return (
- keys.reverse(),
- function next() {
- for (; keys.length; ) {
- var key = keys.pop();
- if (key in object)
- return (next.value = key), (next.done = !1), next;
- }
- return (next.done = !0), next;
- }
- );
- }),
- (exports.values = values),
- (Context.prototype = {
- constructor: Context,
- reset: function reset(skipTempReset) {
- if (
- ((this.prev = 0),
- (this.next = 0),
- (this.sent = this._sent = undefined),
- (this.done = !1),
- (this.delegate = null),
- (this.method = "next"),
- (this.arg = undefined),
- this.tryEntries.forEach(resetTryEntry),
- !skipTempReset)
- )
- for (var name in this)
- "t" === name.charAt(0) &&
- hasOwn.call(this, name) &&
- !isNaN(+name.slice(1)) &&
- (this[name] = undefined);
- },
- stop: function stop() {
- this.done = !0;
- var rootRecord = this.tryEntries[0].completion;
- if ("throw" === rootRecord.type) throw rootRecord.arg;
- return this.rval;
- },
- dispatchException: function dispatchException(exception) {
- if (this.done) throw exception;
- var context = this;
- function handle(loc, caught) {
- return (
- (record.type = "throw"),
- (record.arg = exception),
- (context.next = loc),
- caught &&
- ((context.method = "next"), (context.arg = undefined)),
- !!caught
- );
- }
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i],
- record = entry.completion;
- if ("root" === entry.tryLoc) return handle("end");
- if (entry.tryLoc <= this.prev) {
- var hasCatch = hasOwn.call(entry, "catchLoc"),
- hasFinally = hasOwn.call(entry, "finallyLoc");
- if (hasCatch && hasFinally) {
- if (this.prev < entry.catchLoc)
- return handle(entry.catchLoc, !0);
- if (this.prev < entry.finallyLoc)
- return handle(entry.finallyLoc);
- } else if (hasCatch) {
- if (this.prev < entry.catchLoc)
- return handle(entry.catchLoc, !0);
- } else {
- if (!hasFinally)
- throw new Error("try statement without catch or finally");
- if (this.prev < entry.finallyLoc)
- return handle(entry.finallyLoc);
- }
- }
- }
- },
- abrupt: function abrupt(type, arg) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (
- entry.tryLoc <= this.prev &&
- hasOwn.call(entry, "finallyLoc") &&
- this.prev < entry.finallyLoc
- ) {
- var finallyEntry = entry;
- break;
- }
- }
- finallyEntry &&
- ("break" === type || "continue" === type) &&
- finallyEntry.tryLoc <= arg &&
- arg <= finallyEntry.finallyLoc &&
- (finallyEntry = null);
- var record = finallyEntry ? finallyEntry.completion : {};
- return (
- (record.type = type),
- (record.arg = arg),
- finallyEntry
- ? ((this.method = "next"),
- (this.next = finallyEntry.finallyLoc),
- ContinueSentinel)
- : this.complete(record)
- );
- },
- complete: function complete(record, afterLoc) {
- if ("throw" === record.type) throw record.arg;
- return (
- "break" === record.type || "continue" === record.type
- ? (this.next = record.arg)
- : "return" === record.type
- ? ((this.rval = this.arg = record.arg),
- (this.method = "return"),
- (this.next = "end"))
- : "normal" === record.type &&
- afterLoc &&
- (this.next = afterLoc),
- ContinueSentinel
- );
- },
- finish: function finish(finallyLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.finallyLoc === finallyLoc)
- return (
- this.complete(entry.completion, entry.afterLoc),
- resetTryEntry(entry),
- ContinueSentinel
- );
- }
- },
- catch: function _catch(tryLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc === tryLoc) {
- var record = entry.completion;
- if ("throw" === record.type) {
- var thrown = record.arg;
- resetTryEntry(entry);
- }
- return thrown;
- }
- }
- throw new Error("illegal catch attempt");
- },
- delegateYield: function delegateYield(iterable, resultName, nextLoc) {
- return (
- (this.delegate = {
- iterator: values(iterable),
- resultName: resultName,
- nextLoc: nextLoc
- }),
- "next" === this.method && (this.arg = undefined),
- ContinueSentinel
- );
- }
- }),
- exports
- );
- }
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
- try {
- var info = gen[key](arg);
- var value = info.value;
- } catch (error) {
- reject(error);
- return;
- }
- if (info.done) {
- resolve(value);
- } else {
- Promise.resolve(value).then(_next, _throw);
- }
- }
- function _asyncToGenerator(fn) {
- return function () {
- var self = this,
- args = arguments;
- return new Promise(function (resolve, reject) {
- var gen = fn.apply(self, args);
- function _next(value) {
- asyncGeneratorStep(
- gen,
- resolve,
- reject,
- _next,
- _throw,
- "next",
- value
- );
- }
- function _throw(err) {
- asyncGeneratorStep(
- gen,
- resolve,
- reject,
- _next,
- _throw,
- "throw",
- err
- );
- }
- _next(undefined);
- });
- };
- }
- function ownKeys(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- enumerableOnly &&
- (symbols = symbols.filter(function (sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- })),
- keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = null != arguments[i] ? arguments[i] : {};
- i % 2
- ? ownKeys(Object(source), !0).forEach(function (key) {
- _defineProperty(target, key, source[key]);
- })
- : Object.getOwnPropertyDescriptors
- ? Object.defineProperties(
- target,
- Object.getOwnPropertyDescriptors(source)
- )
- : ownKeys(Object(source)).forEach(function (key) {
- Object.defineProperty(
- target,
- key,
- Object.getOwnPropertyDescriptor(source, key)
- );
- });
- }
- return target;
- }
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- class ImageCapture {
- constructor() {
- this.isMKDIR = false;
- this.cCaptureByCount = null;
- this.cCaptureByMs = null; // c的方法
- this.imageList = {};
- this.captureInfo = {};
- this.imgDataPtrList = [];
- this.imgBufferPtrList = [];
- }
- getImageInfo(imgDataPtr) {
- const width = Module.HEAPU32[imgDataPtr];
- const height = Module.HEAPU32[imgDataPtr + 1];
- const duration = Module.HEAPU32[imgDataPtr + 2];
- const imageBufferPtr = Module.HEAPU32[imgDataPtr + 3];
- const imageBuffer = Module.HEAPU8.slice(
- imageBufferPtr,
- imageBufferPtr + width * height * 3
- );
- // Module._free(imgDataPtr);
- // Module._free(imageBufferPtr);
- this.imgDataPtrList.push(imgDataPtr);
- this.imgBufferPtrList.push(imageBufferPtr);
- const imageDataBuffer = new Uint8ClampedArray(width * height * 4);
- let j = 0;
- for (let i = 0; i < imageBuffer.length; i++) {
- if (i && i % 3 === 0) {
- imageDataBuffer[j] = 255;
- j += 1;
- }
- imageDataBuffer[j] = imageBuffer[i];
- j += 1;
- }
- return {
- width,
- height,
- duration,
- imageDataBuffer
- };
- }
- _singleImage(imgDataPtr) {
- const width = Module.HEAPU32[imgDataPtr];
- const height = Module.HEAPU32[imgDataPtr + 1];
- const duration = Module.HEAPU32[imgDataPtr + 2];
- const imageBufferPtr = Module.HEAPU32[imgDataPtr + 3];
- const imageBuffer = Module.HEAPU8.slice(
- imageBufferPtr,
- imageBufferPtr + width * height * 3
- );
- Module._free(imgDataPtr);
- Module._free(imageBufferPtr);
- const imageDataBuffer = new Uint8ClampedArray(width * height * 4);
- let j = 0;
- for (let i = 0; i < imageBuffer.length; i++) {
- if (i && i % 3 === 0) {
- imageDataBuffer[j] = 255;
- j += 1;
- }
- imageDataBuffer[j] = imageBuffer[i];
- j += 1;
- }
- return {
- width,
- height,
- duration,
- imageDataBuffer
- };
- }
- getImgList(imgDataPtr, count) {
- const dataArr = [];
- for (let i = 0; i < count; i++) {
- dataArr.push(this._singleImage(imgDataPtr / 4 + i * 4));
- }
- return dataArr;
- }
- // 加载文件
- mountFile(file, MOUNT_DIR, id) {
- if (!this.isMKDIR) {
- FS.mkdir(MOUNT_DIR);
- this.isMKDIR = true;
- }
- const data = {};
- let name = "";
- // 判断类型 如果是blob转file
- if (file instanceof File) {
- data.files = [file];
- name = file.name;
- } else {
- name = `${id}.mp4`;
- data.blobs = [
- {
- name,
- data: file
- }
- ];
- }
- // @ts-ignore
- FS.mount(WORKERFS, data, MOUNT_DIR);
- return name;
- }
- free() {
- // 释放指针内存
- this.imgDataPtrList.forEach(ptr => {
- Module._free(ptr);
- });
- this.imgDataPtrList = [];
- this.imgBufferPtrList.forEach(ptr => {
- Module._free(ptr);
- });
- this.imgBufferPtrList = [];
- }
- capture(_ref) {
- let id = _ref.id,
- info = _ref.info,
- _ref$path = _ref.path,
- path = _ref$path === void 0 ? "/working" : _ref$path,
- file = _ref.file;
- try {
- const name = this.mountFile(file, path, id);
- let retData = 0;
- this.imageList[id] = [];
- if (info instanceof Array) {
- // 说明是按照时间抽
- this.captureInfo[id] = info.length;
- if (!this.cCaptureByMs) {
- this.cCaptureByMs = Module.cwrap("captureByMs", "number", [
- "string",
- "string",
- "number"
- ]);
- }
- // const imgDataPtr =
- retData = this.cCaptureByMs(info.join(","), `${path}/${name}`, id);
- this.free();
- } else {
- this.captureInfo[id] = info;
- if (!this.cCaptureByCount) {
- this.cCaptureByCount = Module.cwrap("captureByCount", "number", [
- "number",
- "string",
- "number"
- ]);
- }
- retData = this.cCaptureByCount(info, `${path}/${name}`, id);
- this.free();
- FS.unmount(path);
- // 完善信息 这里需要一种模式 是否只一次性postmsg 不一张张读取
- if (retData === 0) {
- throw new Error("Frame draw exception!");
- }
- }
- } catch (e) {
- console.log("Error occurred", e);
- // 如果发生错误 通知
- self.postMessage({
- type: "receiveError",
- errmsg: e.toString(),
- id
- });
- }
- }
- }
- // importScripts('./capture.js');
- const imageCapture = new ImageCapture();
- let isInit = false;
- const metaDataMap = {};
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- function transpostFrame(ptr, id) {
- const data = imageCapture.getImageInfo(ptr / 4);
- // push到数组列表
- imageCapture.imageList[id].push(_objectSpread({}, data));
- self.postMessage(
- _objectSpread(
- _objectSpread(
- {
- type: "receiveImageOnchange"
- },
- data
- ),
- {},
- {
- id,
- meta: metaDataMap[id] || {}
- }
- )
- );
- // console.log('transpostFrame==>', id, imageCapture.captureInfo);
- if (imageCapture.imageList[id].length >= imageCapture.captureInfo[id]) {
- // 说明已经到了数目 可以postonfinish事件
- self.postMessage({
- type: "receiveImageOnSuccess",
- id,
- meta: metaDataMap[id] || {}
- // ...imageCapture.imageList[id], //TODO: 这个是否post未确定
- });
- }
- }
- function setAngle(a, id) {
- metaDataMap[id].angle = +a;
- }
- function setDescription(a, id) {
- metaDataMap[id].description = a;
- }
- self.transpostFrame = transpostFrame;
- self.setAngle = setAngle;
- self.setDescription = setDescription;
- const initPromise = new Promise(res => {
- self.goOnInit = res;
- });
- self.addEventListener("message", e => {
- // console.log('receivemessage', e.data);
- const _e$data = e.data,
- type = _e$data.type,
- id = _e$data.id,
- info = _e$data.info,
- path = _e$data.path,
- file = _e$data.file;
- if (type === "initPath") {
- self.goOnInit(info);
- }
- if (isInit && type === "startCapture") {
- metaDataMap[id] = {};
- imageCapture.capture({
- id,
- info,
- path,
- file
- });
- }
- });
- self.Module = {
- instantiateWasm: (function () {
- var _instantiateWasm = _asyncToGenerator(
- /*#__PURE__*/ _regeneratorRuntime().mark(function _callee(
- info,
- receiveInstance
- ) {
- var url;
- return _regeneratorRuntime().wrap(function _callee$(_context) {
- while (1)
- switch ((_context.prev = _context.next)) {
- case 0:
- _context.next = 2;
- return initPromise;
- case 2:
- url = _context.sent;
- fetch(url || "./capture.worker.wasm")
- .then(response => response.arrayBuffer())
- .then(bytes => WebAssembly.instantiate(bytes, info))
- .then(instance => receiveInstance(instance.instance));
- // WebAssembly.instantiate(bytes, info).then(result => {
- // receiveInstance(result.instance);
- // });
- case 4:
- case "end":
- return _context.stop();
- }
- }, _callee);
- })
- );
- function instantiateWasm(_x, _x2) {
- return _instantiateWasm.apply(this, arguments);
- }
- return instantiateWasm;
- })(),
- onRuntimeInitialized: () => {
- isInit = true;
- self.postMessage({
- type: "init",
- data: {}
- });
- }
- };
- })();
- /******/
- })();
- // Sometimes an existing Module object exists with properties
- // meant to overwrite the default module functionality. Here
- // we collect those properties and reapply _after_ we configure
- // the current environment's defaults to avoid having to be so
- // defensive during initialization.
- var moduleOverrides = Object.assign({}, Module);
- var arguments_ = [];
- var thisProgram = "./this.program";
- var quit_ = (status, toThrow) => {
- throw toThrow;
- };
- // Determine the runtime environment we are in. You can customize this by
- // setting the ENVIRONMENT setting at compile time (see settings.js).
- // Attempt to auto-detect the environment
- var ENVIRONMENT_IS_WEB = typeof window == "object";
- var ENVIRONMENT_IS_WORKER = typeof importScripts == "function";
- // N.b. Electron.js environment is simultaneously a NODE-environment, but
- // also a web environment.
- var ENVIRONMENT_IS_NODE =
- typeof process == "object" &&
- typeof process.versions == "object" &&
- typeof process.versions.node == "string";
- var ENVIRONMENT_IS_SHELL =
- !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
- // `/` should be present at the end if `scriptDirectory` is not empty
- var scriptDirectory = "";
- function locateFile(path) {
- if (Module["locateFile"]) {
- return Module["locateFile"](path, scriptDirectory);
- }
- return scriptDirectory + path;
- }
- // Hooks that are implemented differently in different runtime environments.
- var read_, readAsync, readBinary, setWindowTitle;
- if (ENVIRONMENT_IS_NODE) {
- // `require()` is no-op in an ESM module, use `createRequire()` to construct
- // the require()` function. This is only necessary for multi-environment
- // builds, `-sENVIRONMENT=node` emits a static import declaration instead.
- // TODO: Swap all `require()`'s with `import()`'s?
- // These modules will usually be used on Node.js. Load them eagerly to avoid
- // the complexity of lazy-loading.
- var fs = require("fs");
- var nodePath = require("path");
- if (ENVIRONMENT_IS_WORKER) {
- scriptDirectory = nodePath.dirname(scriptDirectory) + "/";
- } else {
- scriptDirectory = __dirname + "/";
- }
- // include: node_shell_read.js
- read_ = (filename, binary) => {
- // We need to re-wrap `file://` strings to URLs. Normalizing isn't
- // necessary in that case, the path should already be absolute.
- filename = isFileURI(filename)
- ? new URL(filename)
- : nodePath.normalize(filename);
- return fs.readFileSync(filename, binary ? undefined : "utf8");
- };
- readBinary = filename => {
- var ret = read_(filename, true);
- if (!ret.buffer) {
- ret = new Uint8Array(ret);
- }
- return ret;
- };
- readAsync = (filename, onload, onerror, binary = true) => {
- // See the comment in the `read_` function.
- filename = isFileURI(filename)
- ? new URL(filename)
- : nodePath.normalize(filename);
- fs.readFile(filename, binary ? undefined : "utf8", (err, data) => {
- if (err) onerror(err);
- else onload(binary ? data.buffer : data);
- });
- };
- // end include: node_shell_read.js
- if (!Module["thisProgram"] && process.argv.length > 1) {
- thisProgram = process.argv[1].replace(/\\/g, "/");
- }
- arguments_ = process.argv.slice(2);
- if (typeof module != "undefined") {
- module["exports"] = Module;
- }
- process.on("uncaughtException", ex => {
- // suppress ExitStatus exceptions from showing an error
- if (
- ex !== "unwind" &&
- !(ex instanceof ExitStatus) &&
- !(ex.context instanceof ExitStatus)
- ) {
- throw ex;
- }
- });
- quit_ = (status, toThrow) => {
- process.exitCode = status;
- throw toThrow;
- };
- Module["inspect"] = () => "[Emscripten Module object]";
- }
- // Note that this includes Node.js workers when relevant (pthreads is enabled).
- // Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and
- // ENVIRONMENT_IS_NODE.
- else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
- if (ENVIRONMENT_IS_WORKER) {
- // Check worker, not web, since window could be polyfilled
- scriptDirectory = self.location.href;
- } else if (typeof document != "undefined" && document.currentScript) {
- // web
- scriptDirectory = document.currentScript.src;
- }
- // blob urls look like blob:http://site.com/etc/etc and we cannot infer anything from them.
- // otherwise, slice off the final part of the url to find the script directory.
- // if scriptDirectory does not contain a slash, lastIndexOf will return -1,
- // and scriptDirectory will correctly be replaced with an empty string.
- // If scriptDirectory contains a query (starting with ?) or a fragment (starting with #),
- // they are removed because they could contain a slash.
- if (scriptDirectory.indexOf("blob:") !== 0) {
- scriptDirectory = scriptDirectory.substr(
- 0,
- scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1
- );
- } else {
- scriptDirectory = "";
- }
- // Differentiate the Web Worker from the Node Worker case, as reading must
- // be done differently.
- {
- // include: web_or_worker_shell_read.js
- read_ = url => {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", url, false);
- xhr.send(null);
- return xhr.responseText;
- };
- if (ENVIRONMENT_IS_WORKER) {
- readBinary = url => {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", url, false);
- xhr.responseType = "arraybuffer";
- xhr.send(null);
- return new Uint8Array(/** @type{!ArrayBuffer} */ (xhr.response));
- };
- }
- readAsync = (url, onload, onerror) => {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", url, true);
- xhr.responseType = "arraybuffer";
- xhr.onload = () => {
- if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) {
- // file URLs can return 0
- onload(xhr.response);
- return;
- }
- onerror();
- };
- xhr.onerror = onerror;
- xhr.send(null);
- };
- // end include: web_or_worker_shell_read.js
- }
- setWindowTitle = title => (document.title = title);
- } else {
- }
- var out = Module["print"] || (() => {});
- var err = Module["printErr"] || console.error.bind(console);
- // Merge back in the overrides
- Object.assign(Module, moduleOverrides);
- // Free the object hierarchy contained in the overrides, this lets the GC
- // reclaim data used e.g. in memoryInitializerRequest, which is a large typed array.
- moduleOverrides = null;
- // Emit code to handle expected values on the Module object. This applies Module.x
- // to the proper local x. This has two benefits: first, we only emit it if it is
- // expected to arrive, and second, by using a local everywhere else that can be
- // minified.
- if (Module["arguments"]) arguments_ = Module["arguments"];
- if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
- if (Module["quit"]) quit_ = Module["quit"];
- // perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message
- // end include: shell.js
- // include: preamble.js
- // === Preamble library stuff ===
- // Documentation for the public APIs defined in this file must be updated in:
- // site/source/docs/api_reference/preamble.js.rst
- // A prebuilt local version of the documentation is available at:
- // site/build/text/docs/api_reference/preamble.js.txt
- // You can also build docs locally as HTML or other formats in site/
- // An online HTML version (which may be of a different version of Emscripten)
- // is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html
- var wasmBinary;
- if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];
- var noExitRuntime = Module["noExitRuntime"] || true;
- if (typeof WebAssembly != "object") {
- abort("no native wasm support detected");
- }
- // Wasm globals
- var wasmMemory;
- //========================================
- // Runtime essentials
- //========================================
- // whether we are quitting the application. no code should run after this.
- // set in exit() and abort()
- var ABORT = false;
- // set by exit() and abort(). Passed to 'onExit' handler.
- // NOTE: This is also used as the process return code code in shell environments
- // but only when noExitRuntime is false.
- var EXITSTATUS;
- /** @type {function(*, string=)} */
- function assert(condition, text) {
- if (!condition) {
- // This build was created without ASSERTIONS defined. `assert()` should not
- // ever be called in this configuration but in case there are callers in
- // the wild leave this simple abort() implemenation here for now.
- abort(text);
- }
- }
- // Memory management
- var HEAP,
- /** @type {!Int8Array} */
- HEAP8,
- /** @type {!Uint8Array} */
- HEAPU8,
- /** @type {!Int16Array} */
- HEAP16,
- /** @type {!Uint16Array} */
- HEAPU16,
- /** @type {!Int32Array} */
- HEAP32,
- /** @type {!Uint32Array} */
- HEAPU32,
- /** @type {!Float32Array} */
- HEAPF32,
- /** @type {!Float64Array} */
- HEAPF64;
- function updateMemoryViews() {
- var b = wasmMemory.buffer;
- Module["HEAP8"] = HEAP8 = new Int8Array(b);
- Module["HEAP16"] = HEAP16 = new Int16Array(b);
- Module["HEAP32"] = HEAP32 = new Int32Array(b);
- Module["HEAPU8"] = HEAPU8 = new Uint8Array(b);
- Module["HEAPU16"] = HEAPU16 = new Uint16Array(b);
- Module["HEAPU32"] = HEAPU32 = new Uint32Array(b);
- Module["HEAPF32"] = HEAPF32 = new Float32Array(b);
- Module["HEAPF64"] = HEAPF64 = new Float64Array(b);
- }
- // include: runtime_init_table.js
- // In regular non-RELOCATABLE mode the table is exported
- // from the wasm module and this will be assigned once
- // the exports are available.
- var wasmTable;
- // end include: runtime_init_table.js
- // include: runtime_stack_check.js
- // end include: runtime_stack_check.js
- // include: runtime_assertions.js
- // end include: runtime_assertions.js
- var __ATPRERUN__ = []; // functions called before the runtime is initialized
- var __ATINIT__ = []; // functions called during startup
- var __ATMAIN__ = []; // functions called when main() is to be run
- var __ATEXIT__ = []; // functions called during shutdown
- var __ATPOSTRUN__ = []; // functions called after the main() is called
- var runtimeInitialized = false;
- var runtimeKeepaliveCounter = 0;
- function keepRuntimeAlive() {
- return noExitRuntime || runtimeKeepaliveCounter > 0;
- }
- function preRun() {
- if (Module["preRun"]) {
- if (typeof Module["preRun"] == "function")
- Module["preRun"] = [Module["preRun"]];
- while (Module["preRun"].length) {
- addOnPreRun(Module["preRun"].shift());
- }
- }
- callRuntimeCallbacks(__ATPRERUN__);
- }
- function initRuntime() {
- runtimeInitialized = true;
- if (!Module["noFSInit"] && !FS.init.initialized) FS.init();
- FS.ignorePermissions = false;
- TTY.init();
- callRuntimeCallbacks(__ATINIT__);
- }
- function preMain() {
- callRuntimeCallbacks(__ATMAIN__);
- }
- function postRun() {
- if (Module["postRun"]) {
- if (typeof Module["postRun"] == "function")
- Module["postRun"] = [Module["postRun"]];
- while (Module["postRun"].length) {
- addOnPostRun(Module["postRun"].shift());
- }
- }
- callRuntimeCallbacks(__ATPOSTRUN__);
- }
- function addOnPreRun(cb) {
- __ATPRERUN__.unshift(cb);
- }
- function addOnInit(cb) {
- __ATINIT__.unshift(cb);
- }
- function addOnPreMain(cb) {
- __ATMAIN__.unshift(cb);
- }
- function addOnExit(cb) {}
- function addOnPostRun(cb) {
- __ATPOSTRUN__.unshift(cb);
- }
- // include: runtime_math.js
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/fround
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc
- // end include: runtime_math.js
- // A counter of dependencies for calling run(). If we need to
- // do asynchronous work before running, increment this and
- // decrement it. Incrementing must happen in a place like
- // Module.preRun (used by emcc to add file preloading).
- // Note that you can add dependencies in preRun, even though
- // it happens right before run - run will be postponed until
- // the dependencies are met.
- var runDependencies = 0;
- var runDependencyWatcher = null;
- var dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled
- function getUniqueRunDependency(id) {
- return id;
- }
- function addRunDependency(id) {
- runDependencies++;
- if (Module["monitorRunDependencies"]) {
- Module["monitorRunDependencies"](runDependencies);
- }
- }
- function removeRunDependency(id) {
- runDependencies--;
- if (Module["monitorRunDependencies"]) {
- Module["monitorRunDependencies"](runDependencies);
- }
- if (runDependencies == 0) {
- if (runDependencyWatcher !== null) {
- clearInterval(runDependencyWatcher);
- runDependencyWatcher = null;
- }
- if (dependenciesFulfilled) {
- var callback = dependenciesFulfilled;
- dependenciesFulfilled = null;
- callback(); // can add another dependenciesFulfilled
- }
- }
- }
- /** @param {string|number=} what */
- function abort(what) {
- if (Module["onAbort"]) {
- Module["onAbort"](what);
- }
- what = "Aborted(" + what + ")";
- // TODO(sbc): Should we remove printing and leave it up to whoever
- // catches the exception?
- err(what);
- ABORT = true;
- EXITSTATUS = 1;
- what += ". Build with -sASSERTIONS for more info.";
- // Use a wasm runtime error, because a JS error might be seen as a foreign
- // exception, which means we'd run destructors on it. We need the error to
- // simply make the program stop.
- // FIXME This approach does not work in Wasm EH because it currently does not assume
- // all RuntimeErrors are from traps; it decides whether a RuntimeError is from
- // a trap or not based on a hidden field within the object. So at the moment
- // we don't have a way of throwing a wasm trap from JS. TODO Make a JS API that
- // allows this in the wasm spec.
- // Suppress closure compiler warning here. Closure compiler's builtin extern
- // defintion for WebAssembly.RuntimeError claims it takes no arguments even
- // though it can.
- // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed.
- /** @suppress {checkTypes} */
- var e = new WebAssembly.RuntimeError(what);
- // Throw the error whether or not MODULARIZE is set because abort is used
- // in code paths apart from instantiation where an exception is expected
- // to be thrown when abort is called.
- throw e;
- }
- // include: memoryprofiler.js
- // end include: memoryprofiler.js
- // include: URIUtils.js
- // Prefix of data URIs emitted by SINGLE_FILE and related options.
- var dataURIPrefix = "data:application/octet-stream;base64,";
- // Indicates whether filename is a base64 data URI.
- function isDataURI(filename) {
- // Prefix of data URIs emitted by SINGLE_FILE and related options.
- return filename.startsWith(dataURIPrefix);
- }
- // Indicates whether filename is delivered via file protocol (as opposed to http/https)
- function isFileURI(filename) {
- return filename.startsWith("file://");
- }
- // end include: URIUtils.js
- // include: runtime_exceptions.js
- // end include: runtime_exceptions.js
- var wasmBinaryFile;
- wasmBinaryFile = "capture.worker.wasm";
- if (!isDataURI(wasmBinaryFile)) {
- wasmBinaryFile = locateFile(wasmBinaryFile);
- }
- function getBinarySync(file) {
- if (file == wasmBinaryFile && wasmBinary) {
- return new Uint8Array(wasmBinary);
- }
- if (readBinary) {
- return readBinary(file);
- }
- throw "both async and sync fetching of the wasm failed";
- }
- function getBinaryPromise(binaryFile) {
- // If we don't have the binary yet, try to load it asynchronously.
- // Fetch has some additional restrictions over XHR, like it can't be used on a file:// url.
- // See https://github.com/github/fetch/pull/92#issuecomment-140665932
- // Cordova or Electron apps are typically loaded from a file:// url.
- // So use fetch if it is available and the url is not a file, otherwise fall back to XHR.
- if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) {
- if (typeof fetch == "function" && !isFileURI(binaryFile)) {
- return fetch(binaryFile, { credentials: "same-origin" })
- .then(response => {
- if (!response["ok"]) {
- throw "failed to load wasm binary file at '" + binaryFile + "'";
- }
- return response["arrayBuffer"]();
- })
- .catch(() => getBinarySync(binaryFile));
- } else if (readAsync) {
- // fetch is not available or url is file => try XHR (readAsync uses XHR internally)
- return new Promise((resolve, reject) => {
- readAsync(
- binaryFile,
- response =>
- resolve(new Uint8Array(/** @type{!ArrayBuffer} */ (response))),
- reject
- );
- });
- }
- }
- // Otherwise, getBinarySync should be able to get it synchronously
- return Promise.resolve().then(() => getBinarySync(binaryFile));
- }
- function instantiateArrayBuffer(binaryFile, imports, receiver) {
- return getBinaryPromise(binaryFile)
- .then(binary => {
- return WebAssembly.instantiate(binary, imports);
- })
- .then(instance => {
- return instance;
- })
- .then(receiver, reason => {
- err("failed to asynchronously prepare wasm: " + reason);
- abort(reason);
- });
- }
- function instantiateAsync(binary, binaryFile, imports, callback) {
- if (
- !binary &&
- typeof WebAssembly.instantiateStreaming == "function" &&
- !isDataURI(binaryFile) &&
- // Don't use streaming for file:// delivered objects in a webview, fetch them synchronously.
- !isFileURI(binaryFile) &&
- // Avoid instantiateStreaming() on Node.js environment for now, as while
- // Node.js v18.1.0 implements it, it does not have a full fetch()
- // implementation yet.
- //
- // Reference:
- // https://github.com/emscripten-core/emscripten/pull/16917
- !ENVIRONMENT_IS_NODE &&
- typeof fetch == "function"
- ) {
- return fetch(binaryFile, { credentials: "same-origin" }).then(response => {
- // Suppress closure warning here since the upstream definition for
- // instantiateStreaming only allows Promise<Repsponse> rather than
- // an actual Response.
- // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure is fixed.
- /** @suppress {checkTypes} */
- var result = WebAssembly.instantiateStreaming(response, imports);
- return result.then(callback, function (reason) {
- // We expect the most common failure cause to be a bad MIME type for the binary,
- // in which case falling back to ArrayBuffer instantiation should work.
- err("wasm streaming compile failed: " + reason);
- err("falling back to ArrayBuffer instantiation");
- return instantiateArrayBuffer(binaryFile, imports, callback);
- });
- });
- }
- return instantiateArrayBuffer(binaryFile, imports, callback);
- }
- // Create the wasm instance.
- // Receives the wasm imports, returns the exports.
- function createWasm() {
- // prepare imports
- var info = {
- env: wasmImports,
- wasi_snapshot_preview1: wasmImports
- };
- // Load the wasm module and create an instance of using native support in the JS engine.
- // handle a generated wasm instance, receiving its exports and
- // performing other necessary setup
- /** @param {WebAssembly.Module=} module*/
- function receiveInstance(instance, module) {
- var exports = instance.exports;
- Module["asm"] = exports;
- wasmMemory = Module["asm"]["memory"];
- updateMemoryViews();
- wasmTable = Module["asm"]["__indirect_function_table"];
- addOnInit(Module["asm"]["__wasm_call_ctors"]);
- removeRunDependency("wasm-instantiate");
- return exports;
- }
- // wait for the pthread pool (if any)
- addRunDependency("wasm-instantiate");
- // Prefer streaming instantiation if available.
- function receiveInstantiationResult(result) {
- // 'result' is a ResultObject object which has both the module and instance.
- // receiveInstance() will swap in the exports (to Module.asm) so they can be called
- // TODO: Due to Closure regression https://github.com/google/closure-compiler/issues/3193, the above line no longer optimizes out down to the following line.
- // When the regression is fixed, can restore the above PTHREADS-enabled path.
- receiveInstance(result["instance"]);
- }
- // User shell pages can write their own Module.instantiateWasm = function(imports, successCallback) callback
- // to manually instantiate the Wasm module themselves. This allows pages to
- // run the instantiation parallel to any other async startup actions they are
- // performing.
- // Also pthreads and wasm workers initialize the wasm instance through this
- // path.
- if (Module["instantiateWasm"]) {
- try {
- return Module["instantiateWasm"](info, receiveInstance);
- } catch (e) {
- err("Module.instantiateWasm callback failed with error: " + e);
- return false;
- }
- }
- instantiateAsync(
- wasmBinary,
- wasmBinaryFile,
- info,
- receiveInstantiationResult
- );
- return {}; // no exports yet; we'll fill them in later
- }
- // Globals used by JS i64 conversions (see makeSetValue)
- var tempDouble;
- var tempI64;
- // include: runtime_debug.js
- // end include: runtime_debug.js
- // === Body ===
- // end include: preamble.js
- /** @constructor */
- function ExitStatus(status) {
- this.name = "ExitStatus";
- this.message = `Program terminated with exit(${status})`;
- this.status = status;
- }
- var callRuntimeCallbacks = callbacks => {
- while (callbacks.length > 0) {
- // Pass the module as the first argument.
- callbacks.shift()(Module);
- }
- };
- /**
- * @param {number} ptr
- * @param {string} type
- */
- function getValue(ptr, type = "i8") {
- if (type.endsWith("*")) type = "*";
- switch (type) {
- case "i1":
- return HEAP8[ptr >> 0];
- case "i8":
- return HEAP8[ptr >> 0];
- case "i16":
- return HEAP16[ptr >> 1];
- case "i32":
- return HEAP32[ptr >> 2];
- case "i64":
- abort("to do getValue(i64) use WASM_BIGINT");
- case "float":
- return HEAPF32[ptr >> 2];
- case "double":
- return HEAPF64[ptr >> 3];
- case "*":
- return HEAPU32[ptr >> 2];
- default:
- abort(`invalid type for getValue: ${type}`);
- }
- }
- /**
- * @param {number} ptr
- * @param {number} value
- * @param {string} type
- */
- function setValue(ptr, value, type = "i8") {
- if (type.endsWith("*")) type = "*";
- switch (type) {
- case "i1":
- HEAP8[ptr >> 0] = value;
- break;
- case "i8":
- HEAP8[ptr >> 0] = value;
- break;
- case "i16":
- HEAP16[ptr >> 1] = value;
- break;
- case "i32":
- HEAP32[ptr >> 2] = value;
- break;
- case "i64":
- abort("to do setValue(i64) use WASM_BIGINT");
- case "float":
- HEAPF32[ptr >> 2] = value;
- break;
- case "double":
- HEAPF64[ptr >> 3] = value;
- break;
- case "*":
- HEAPU32[ptr >> 2] = value;
- break;
- default:
- abort(`invalid type for setValue: ${type}`);
- }
- }
- var PATH = {
- isAbs: path => path.charAt(0) === "/",
- splitPath: filename => {
- var splitPathRe =
- /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
- return splitPathRe.exec(filename).slice(1);
- },
- normalizeArray: (parts, allowAboveRoot) => {
- // if the path tries to go above the root, `up` ends up > 0
- var up = 0;
- for (var i = parts.length - 1; i >= 0; i--) {
- var last = parts[i];
- if (last === ".") {
- parts.splice(i, 1);
- } else if (last === "..") {
- parts.splice(i, 1);
- up++;
- } else if (up) {
- parts.splice(i, 1);
- up--;
- }
- }
- // if the path is allowed to go above the root, restore leading ..s
- if (allowAboveRoot) {
- for (; up; up--) {
- parts.unshift("..");
- }
- }
- return parts;
- },
- normalize: path => {
- var isAbsolute = PATH.isAbs(path),
- trailingSlash = path.substr(-1) === "/";
- // Normalize the path
- path = PATH.normalizeArray(
- path.split("/").filter(p => !!p),
- !isAbsolute
- ).join("/");
- if (!path && !isAbsolute) {
- path = ".";
- }
- if (path && trailingSlash) {
- path += "/";
- }
- return (isAbsolute ? "/" : "") + path;
- },
- dirname: path => {
- var result = PATH.splitPath(path),
- root = result[0],
- dir = result[1];
- if (!root && !dir) {
- // No dirname whatsoever
- return ".";
- }
- if (dir) {
- // It has a dirname, strip trailing slash
- dir = dir.substr(0, dir.length - 1);
- }
- return root + dir;
- },
- basename: path => {
- // EMSCRIPTEN return '/'' for '/', not an empty string
- if (path === "/") return "/";
- path = PATH.normalize(path);
- path = path.replace(/\/$/, "");
- var lastSlash = path.lastIndexOf("/");
- if (lastSlash === -1) return path;
- return path.substr(lastSlash + 1);
- },
- join: function () {
- var paths = Array.prototype.slice.call(arguments);
- return PATH.normalize(paths.join("/"));
- },
- join2: (l, r) => {
- return PATH.normalize(l + "/" + r);
- }
- };
- var initRandomFill = () => {
- if (
- typeof crypto == "object" &&
- typeof crypto["getRandomValues"] == "function"
- ) {
- // for modern web browsers
- return view => crypto.getRandomValues(view);
- } else if (ENVIRONMENT_IS_NODE) {
- // for nodejs with or without crypto support included
- try {
- var crypto_module = require("crypto");
- var randomFillSync = crypto_module["randomFillSync"];
- if (randomFillSync) {
- // nodejs with LTS crypto support
- return view => crypto_module["randomFillSync"](view);
- }
- // very old nodejs with the original crypto API
- var randomBytes = crypto_module["randomBytes"];
- return view => (
- view.set(randomBytes(view.byteLength)),
- // Return the original view to match modern native implementations.
- view
- );
- } catch (e) {
- // nodejs doesn't have crypto support
- }
- }
- // we couldn't find a proper implementation, as Math.random() is not suitable for /dev/random, see emscripten-core/emscripten/pull/7096
- abort("initRandomDevice");
- };
- var randomFill = view => {
- // Lazily init on the first invocation.
- return (randomFill = initRandomFill())(view);
- };
- var PATH_FS = {
- resolve: function () {
- var resolvedPath = "",
- resolvedAbsolute = false;
- for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
- var path = i >= 0 ? arguments[i] : FS.cwd();
- // Skip empty and invalid entries
- if (typeof path != "string") {
- throw new TypeError("Arguments to path.resolve must be strings");
- } else if (!path) {
- return ""; // an invalid portion invalidates the whole thing
- }
- resolvedPath = path + "/" + resolvedPath;
- resolvedAbsolute = PATH.isAbs(path);
- }
- // At this point the path should be resolved to a full absolute path, but
- // handle relative paths to be safe (might happen when process.cwd() fails)
- resolvedPath = PATH.normalizeArray(
- resolvedPath.split("/").filter(p => !!p),
- !resolvedAbsolute
- ).join("/");
- return (resolvedAbsolute ? "/" : "") + resolvedPath || ".";
- },
- relative: (from, to) => {
- from = PATH_FS.resolve(from).substr(1);
- to = PATH_FS.resolve(to).substr(1);
- function trim(arr) {
- var start = 0;
- for (; start < arr.length; start++) {
- if (arr[start] !== "") break;
- }
- var end = arr.length - 1;
- for (; end >= 0; end--) {
- if (arr[end] !== "") break;
- }
- if (start > end) return [];
- return arr.slice(start, end - start + 1);
- }
- var fromParts = trim(from.split("/"));
- var toParts = trim(to.split("/"));
- var length = Math.min(fromParts.length, toParts.length);
- var samePartsLength = length;
- for (var i = 0; i < length; i++) {
- if (fromParts[i] !== toParts[i]) {
- samePartsLength = i;
- break;
- }
- }
- var outputParts = [];
- for (var i = samePartsLength; i < fromParts.length; i++) {
- outputParts.push("..");
- }
- outputParts = outputParts.concat(toParts.slice(samePartsLength));
- return outputParts.join("/");
- }
- };
- var UTF8Decoder =
- typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : undefined;
- /**
- * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given
- * array that contains uint8 values, returns a copy of that string as a
- * Javascript String object.
- * heapOrArray is either a regular array, or a JavaScript typed array view.
- * @param {number} idx
- * @param {number=} maxBytesToRead
- * @return {string}
- */
- var UTF8ArrayToString = (heapOrArray, idx, maxBytesToRead) => {
- var endIdx = idx + maxBytesToRead;
- var endPtr = idx;
- // TextDecoder needs to know the byte length in advance, it doesn't stop on
- // null terminator by itself. Also, use the length info to avoid running tiny
- // strings through TextDecoder, since .subarray() allocates garbage.
- // (As a tiny code save trick, compare endPtr against endIdx using a negation,
- // so that undefined means Infinity)
- while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr;
- if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
- return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
- }
- var str = "";
- // If building with TextDecoder, we have already computed the string length
- // above, so test loop end condition against that
- while (idx < endPtr) {
- // For UTF8 byte structure, see:
- // http://en.wikipedia.org/wiki/UTF-8#Description
- // https://www.ietf.org/rfc/rfc2279.txt
- // https://tools.ietf.org/html/rfc3629
- var u0 = heapOrArray[idx++];
- if (!(u0 & 0x80)) {
- str += String.fromCharCode(u0);
- continue;
- }
- var u1 = heapOrArray[idx++] & 63;
- if ((u0 & 0xe0) == 0xc0) {
- str += String.fromCharCode(((u0 & 31) << 6) | u1);
- continue;
- }
- var u2 = heapOrArray[idx++] & 63;
- if ((u0 & 0xf0) == 0xe0) {
- u0 = ((u0 & 15) << 12) | (u1 << 6) | u2;
- } else {
- u0 =
- ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63);
- }
- if (u0 < 0x10000) {
- str += String.fromCharCode(u0);
- } else {
- var ch = u0 - 0x10000;
- str += String.fromCharCode(0xd800 | (ch >> 10), 0xdc00 | (ch & 0x3ff));
- }
- }
- return str;
- };
- var FS_stdin_getChar_buffer = [];
- var lengthBytesUTF8 = str => {
- var len = 0;
- for (var i = 0; i < str.length; ++i) {
- // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code
- // unit, not a Unicode code point of the character! So decode
- // UTF16->UTF32->UTF8.
- // See http://unicode.org/faq/utf_bom.html#utf16-3
- var c = str.charCodeAt(i); // possibly a lead surrogate
- if (c <= 0x7f) {
- len++;
- } else if (c <= 0x7ff) {
- len += 2;
- } else if (c >= 0xd800 && c <= 0xdfff) {
- len += 4;
- ++i;
- } else {
- len += 3;
- }
- }
- return len;
- };
- var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
- // Parameter maxBytesToWrite is not optional. Negative values, 0, null,
- // undefined and false each don't write out any bytes.
- if (!(maxBytesToWrite > 0)) return 0;
- var startIdx = outIdx;
- var endIdx = outIdx + maxBytesToWrite - 1; // -1 for string null terminator.
- for (var i = 0; i < str.length; ++i) {
- // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code
- // unit, not a Unicode code point of the character! So decode
- // UTF16->UTF32->UTF8.
- // See http://unicode.org/faq/utf_bom.html#utf16-3
- // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description
- // and https://www.ietf.org/rfc/rfc2279.txt
- // and https://tools.ietf.org/html/rfc3629
- var u = str.charCodeAt(i); // possibly a lead surrogate
- if (u >= 0xd800 && u <= 0xdfff) {
- var u1 = str.charCodeAt(++i);
- u = (0x10000 + ((u & 0x3ff) << 10)) | (u1 & 0x3ff);
- }
- if (u <= 0x7f) {
- if (outIdx >= endIdx) break;
- heap[outIdx++] = u;
- } else if (u <= 0x7ff) {
- if (outIdx + 1 >= endIdx) break;
- heap[outIdx++] = 0xc0 | (u >> 6);
- heap[outIdx++] = 0x80 | (u & 63);
- } else if (u <= 0xffff) {
- if (outIdx + 2 >= endIdx) break;
- heap[outIdx++] = 0xe0 | (u >> 12);
- heap[outIdx++] = 0x80 | ((u >> 6) & 63);
- heap[outIdx++] = 0x80 | (u & 63);
- } else {
- if (outIdx + 3 >= endIdx) break;
- heap[outIdx++] = 0xf0 | (u >> 18);
- heap[outIdx++] = 0x80 | ((u >> 12) & 63);
- heap[outIdx++] = 0x80 | ((u >> 6) & 63);
- heap[outIdx++] = 0x80 | (u & 63);
- }
- }
- // Null-terminate the pointer to the buffer.
- heap[outIdx] = 0;
- return outIdx - startIdx;
- };
- /** @type {function(string, boolean=, number=)} */
- function intArrayFromString(stringy, dontAddNull, length) {
- var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1;
- var u8array = new Array(len);
- var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length);
- if (dontAddNull) u8array.length = numBytesWritten;
- return u8array;
- }
- var FS_stdin_getChar = () => {
- if (!FS_stdin_getChar_buffer.length) {
- var result = null;
- if (ENVIRONMENT_IS_NODE) {
- // we will read data by chunks of BUFSIZE
- var BUFSIZE = 256;
- var buf = Buffer.alloc(BUFSIZE);
- var bytesRead = 0;
- // For some reason we must suppress a closure warning here, even though
- // fd definitely exists on process.stdin, and is even the proper way to
- // get the fd of stdin,
- // https://github.com/nodejs/help/issues/2136#issuecomment-523649904
- // This started to happen after moving this logic out of library_tty.js,
- // so it is related to the surrounding code in some unclear manner.
- /** @suppress {missingProperties} */
- var fd = process.stdin.fd;
- try {
- bytesRead = fs.readSync(fd, buf, 0, BUFSIZE, -1);
- } catch (e) {
- // Cross-platform differences: on Windows, reading EOF throws an exception, but on other OSes,
- // reading EOF returns 0. Uniformize behavior by treating the EOF exception to return 0.
- if (e.toString().includes("EOF")) bytesRead = 0;
- else throw e;
- }
- if (bytesRead > 0) {
- result = buf.slice(0, bytesRead).toString("utf-8");
- } else {
- result = null;
- }
- } else if (
- typeof window != "undefined" &&
- typeof window.prompt == "function"
- ) {
- // Browser.
- result = window.prompt("Input: "); // returns null on cancel
- if (result !== null) {
- result += "\n";
- }
- } else if (typeof readline == "function") {
- // Command line.
- result = readline();
- if (result !== null) {
- result += "\n";
- }
- }
- if (!result) {
- return null;
- }
- FS_stdin_getChar_buffer = intArrayFromString(result, true);
- }
- return FS_stdin_getChar_buffer.shift();
- };
- var TTY = {
- ttys: [],
- init: function () {
- // https://github.com/emscripten-core/emscripten/pull/1555
- // if (ENVIRONMENT_IS_NODE) {
- // // currently, FS.init does not distinguish if process.stdin is a file or TTY
- // // device, it always assumes it's a TTY device. because of this, we're forcing
- // // process.stdin to UTF8 encoding to at least make stdin reading compatible
- // // with text files until FS.init can be refactored.
- // process.stdin.setEncoding('utf8');
- // }
- },
- shutdown: function () {
- // https://github.com/emscripten-core/emscripten/pull/1555
- // if (ENVIRONMENT_IS_NODE) {
- // // inolen: any idea as to why node -e 'process.stdin.read()' wouldn't exit immediately (with process.stdin being a tty)?
- // // isaacs: because now it's reading from the stream, you've expressed interest in it, so that read() kicks off a _read() which creates a ReadReq operation
- // // inolen: I thought read() in that case was a synchronous operation that just grabbed some amount of buffered data if it exists?
- // // isaacs: it is. but it also triggers a _read() call, which calls readStart() on the handle
- // // isaacs: do process.stdin.pause() and i'd think it'd probably close the pending call
- // process.stdin.pause();
- // }
- },
- register: function (dev, ops) {
- TTY.ttys[dev] = { input: [], output: [], ops: ops };
- FS.registerDevice(dev, TTY.stream_ops);
- },
- stream_ops: {
- open: function (stream) {
- var tty = TTY.ttys[stream.node.rdev];
- if (!tty) {
- throw new FS.ErrnoError(43);
- }
- stream.tty = tty;
- stream.seekable = false;
- },
- close: function (stream) {
- // flush any pending line data
- stream.tty.ops.fsync(stream.tty);
- },
- fsync: function (stream) {
- stream.tty.ops.fsync(stream.tty);
- },
- read: function (stream, buffer, offset, length, pos /* ignored */) {
- if (!stream.tty || !stream.tty.ops.get_char) {
- throw new FS.ErrnoError(60);
- }
- var bytesRead = 0;
- for (var i = 0; i < length; i++) {
- var result;
- try {
- result = stream.tty.ops.get_char(stream.tty);
- } catch (e) {
- throw new FS.ErrnoError(29);
- }
- if (result === undefined && bytesRead === 0) {
- throw new FS.ErrnoError(6);
- }
- if (result === null || result === undefined) break;
- bytesRead++;
- buffer[offset + i] = result;
- }
- if (bytesRead) {
- stream.node.timestamp = Date.now();
- }
- return bytesRead;
- },
- write: function (stream, buffer, offset, length, pos) {
- if (!stream.tty || !stream.tty.ops.put_char) {
- throw new FS.ErrnoError(60);
- }
- try {
- for (var i = 0; i < length; i++) {
- stream.tty.ops.put_char(stream.tty, buffer[offset + i]);
- }
- } catch (e) {
- throw new FS.ErrnoError(29);
- }
- if (length) {
- stream.node.timestamp = Date.now();
- }
- return i;
- }
- },
- default_tty_ops: {
- get_char: function (tty) {
- return FS_stdin_getChar();
- },
- put_char: function (tty, val) {
- if (val === null || val === 10) {
- out(UTF8ArrayToString(tty.output, 0));
- tty.output = [];
- } else {
- if (val != 0) tty.output.push(val); // val == 0 would cut text output off in the middle.
- }
- },
- fsync: function (tty) {
- if (tty.output && tty.output.length > 0) {
- out(UTF8ArrayToString(tty.output, 0));
- tty.output = [];
- }
- },
- ioctl_tcgets: function (tty) {
- // typical setting
- return {
- c_iflag: 25856,
- c_oflag: 5,
- c_cflag: 191,
- c_lflag: 35387,
- c_cc: [
- 0x03, 0x1c, 0x7f, 0x15, 0x04, 0x00, 0x01, 0x00, 0x11, 0x13, 0x1a,
- 0x00, 0x12, 0x0f, 0x17, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- ]
- };
- },
- ioctl_tcsets: function (tty, optional_actions, data) {
- // currently just ignore
- return 0;
- },
- ioctl_tiocgwinsz: function (tty) {
- return [24, 80];
- }
- },
- default_tty1_ops: {
- put_char: function (tty, val) {
- if (val === null || val === 10) {
- err(UTF8ArrayToString(tty.output, 0));
- tty.output = [];
- } else {
- if (val != 0) tty.output.push(val);
- }
- },
- fsync: function (tty) {
- if (tty.output && tty.output.length > 0) {
- err(UTF8ArrayToString(tty.output, 0));
- tty.output = [];
- }
- }
- }
- };
- var zeroMemory = (address, size) => {
- HEAPU8.fill(0, address, address + size);
- return address;
- };
- var alignMemory = (size, alignment) => {
- return Math.ceil(size / alignment) * alignment;
- };
- var mmapAlloc = size => {
- abort();
- };
- var MEMFS = {
- ops_table: null,
- mount(mount) {
- return MEMFS.createNode(null, "/", 16384 | 511 /* 0777 */, 0);
- },
- createNode(parent, name, mode, dev) {
- if (FS.isBlkdev(mode) || FS.isFIFO(mode)) {
- // no supported
- throw new FS.ErrnoError(63);
- }
- if (!MEMFS.ops_table) {
- MEMFS.ops_table = {
- dir: {
- node: {
- getattr: MEMFS.node_ops.getattr,
- setattr: MEMFS.node_ops.setattr,
- lookup: MEMFS.node_ops.lookup,
- mknod: MEMFS.node_ops.mknod,
- rename: MEMFS.node_ops.rename,
- unlink: MEMFS.node_ops.unlink,
- rmdir: MEMFS.node_ops.rmdir,
- readdir: MEMFS.node_ops.readdir,
- symlink: MEMFS.node_ops.symlink
- },
- stream: {
- llseek: MEMFS.stream_ops.llseek
- }
- },
- file: {
- node: {
- getattr: MEMFS.node_ops.getattr,
- setattr: MEMFS.node_ops.setattr
- },
- stream: {
- llseek: MEMFS.stream_ops.llseek,
- read: MEMFS.stream_ops.read,
- write: MEMFS.stream_ops.write,
- allocate: MEMFS.stream_ops.allocate,
- mmap: MEMFS.stream_ops.mmap,
- msync: MEMFS.stream_ops.msync
- }
- },
- link: {
- node: {
- getattr: MEMFS.node_ops.getattr,
- setattr: MEMFS.node_ops.setattr,
- readlink: MEMFS.node_ops.readlink
- },
- stream: {}
- },
- chrdev: {
- node: {
- getattr: MEMFS.node_ops.getattr,
- setattr: MEMFS.node_ops.setattr
- },
- stream: FS.chrdev_stream_ops
- }
- };
- }
- var node = FS.createNode(parent, name, mode, dev);
- if (FS.isDir(node.mode)) {
- node.node_ops = MEMFS.ops_table.dir.node;
- node.stream_ops = MEMFS.ops_table.dir.stream;
- node.contents = {};
- } else if (FS.isFile(node.mode)) {
- node.node_ops = MEMFS.ops_table.file.node;
- node.stream_ops = MEMFS.ops_table.file.stream;
- node.usedBytes = 0; // The actual number of bytes used in the typed array, as opposed to contents.length which gives the whole capacity.
- // When the byte data of the file is populated, this will point to either a typed array, or a normal JS array. Typed arrays are preferred
- // for performance, and used by default. However, typed arrays are not resizable like normal JS arrays are, so there is a small disk size
- // penalty involved for appending file writes that continuously grow a file similar to std::vector capacity vs used -scheme.
- node.contents = null;
- } else if (FS.isLink(node.mode)) {
- node.node_ops = MEMFS.ops_table.link.node;
- node.stream_ops = MEMFS.ops_table.link.stream;
- } else if (FS.isChrdev(node.mode)) {
- node.node_ops = MEMFS.ops_table.chrdev.node;
- node.stream_ops = MEMFS.ops_table.chrdev.stream;
- }
- node.timestamp = Date.now();
- // add the new node to the parent
- if (parent) {
- parent.contents[name] = node;
- parent.timestamp = node.timestamp;
- }
- return node;
- },
- getFileDataAsTypedArray(node) {
- if (!node.contents) return new Uint8Array(0);
- if (node.contents.subarray)
- return node.contents.subarray(0, node.usedBytes); // Make sure to not return excess unused bytes.
- return new Uint8Array(node.contents);
- },
- expandFileStorage(node, newCapacity) {
- var prevCapacity = node.contents ? node.contents.length : 0;
- if (prevCapacity >= newCapacity) return; // No need to expand, the storage was already large enough.
- // Don't expand strictly to the given requested limit if it's only a very small increase, but instead geometrically grow capacity.
- // For small filesizes (<1MB), perform size*2 geometric increase, but for large sizes, do a much more conservative size*1.125 increase to
- // avoid overshooting the allocation cap by a very large margin.
- var CAPACITY_DOUBLING_MAX = 1024 * 1024;
- newCapacity = Math.max(
- newCapacity,
- (prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2.0 : 1.125)) >>>
- 0
- );
- if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); // At minimum allocate 256b for each file when expanding.
- var oldContents = node.contents;
- node.contents = new Uint8Array(newCapacity); // Allocate new storage.
- if (node.usedBytes > 0)
- node.contents.set(oldContents.subarray(0, node.usedBytes), 0); // Copy old data over to the new storage.
- },
- resizeFileStorage(node, newSize) {
- if (node.usedBytes == newSize) return;
- if (newSize == 0) {
- node.contents = null; // Fully decommit when requesting a resize to zero.
- node.usedBytes = 0;
- } else {
- var oldContents = node.contents;
- node.contents = new Uint8Array(newSize); // Allocate new storage.
- if (oldContents) {
- node.contents.set(
- oldContents.subarray(0, Math.min(newSize, node.usedBytes))
- ); // Copy old data over to the new storage.
- }
- node.usedBytes = newSize;
- }
- },
- node_ops: {
- getattr(node) {
- var attr = {};
- // device numbers reuse inode numbers.
- attr.dev = FS.isChrdev(node.mode) ? node.id : 1;
- attr.ino = node.id;
- attr.mode = node.mode;
- attr.nlink = 1;
- attr.uid = 0;
- attr.gid = 0;
- attr.rdev = node.rdev;
- if (FS.isDir(node.mode)) {
- attr.size = 4096;
- } else if (FS.isFile(node.mode)) {
- attr.size = node.usedBytes;
- } else if (FS.isLink(node.mode)) {
- attr.size = node.link.length;
- } else {
- attr.size = 0;
- }
- attr.atime = new Date(node.timestamp);
- attr.mtime = new Date(node.timestamp);
- attr.ctime = new Date(node.timestamp);
- // NOTE: In our implementation, st_blocks = Math.ceil(st_size/st_blksize),
- // but this is not required by the standard.
- attr.blksize = 4096;
- attr.blocks = Math.ceil(attr.size / attr.blksize);
- return attr;
- },
- setattr(node, attr) {
- if (attr.mode !== undefined) {
- node.mode = attr.mode;
- }
- if (attr.timestamp !== undefined) {
- node.timestamp = attr.timestamp;
- }
- if (attr.size !== undefined) {
- MEMFS.resizeFileStorage(node, attr.size);
- }
- },
- lookup(parent, name) {
- throw FS.genericErrors[44];
- },
- mknod(parent, name, mode, dev) {
- return MEMFS.createNode(parent, name, mode, dev);
- },
- rename(old_node, new_dir, new_name) {
- // if we're overwriting a directory at new_name, make sure it's empty.
- if (FS.isDir(old_node.mode)) {
- var new_node;
- try {
- new_node = FS.lookupNode(new_dir, new_name);
- } catch (e) {}
- if (new_node) {
- for (var i in new_node.contents) {
- throw new FS.ErrnoError(55);
- }
- }
- }
- // do the internal rewiring
- delete old_node.parent.contents[old_node.name];
- old_node.parent.timestamp = Date.now();
- old_node.name = new_name;
- new_dir.contents[new_name] = old_node;
- new_dir.timestamp = old_node.parent.timestamp;
- old_node.parent = new_dir;
- },
- unlink(parent, name) {
- delete parent.contents[name];
- parent.timestamp = Date.now();
- },
- rmdir(parent, name) {
- var node = FS.lookupNode(parent, name);
- for (var i in node.contents) {
- throw new FS.ErrnoError(55);
- }
- delete parent.contents[name];
- parent.timestamp = Date.now();
- },
- readdir(node) {
- var entries = [".", ".."];
- for (var key in node.contents) {
- if (!node.contents.hasOwnProperty(key)) {
- continue;
- }
- entries.push(key);
- }
- return entries;
- },
- symlink(parent, newname, oldpath) {
- var node = MEMFS.createNode(parent, newname, 511 /* 0777 */ | 40960, 0);
- node.link = oldpath;
- return node;
- },
- readlink(node) {
- if (!FS.isLink(node.mode)) {
- throw new FS.ErrnoError(28);
- }
- return node.link;
- }
- },
- stream_ops: {
- read(stream, buffer, offset, length, position) {
- var contents = stream.node.contents;
- if (position >= stream.node.usedBytes) return 0;
- var size = Math.min(stream.node.usedBytes - position, length);
- if (size > 8 && contents.subarray) {
- // non-trivial, and typed array
- buffer.set(contents.subarray(position, position + size), offset);
- } else {
- for (var i = 0; i < size; i++)
- buffer[offset + i] = contents[position + i];
- }
- return size;
- },
- write(stream, buffer, offset, length, position, canOwn) {
- // If the buffer is located in main memory (HEAP), and if
- // memory can grow, we can't hold on to references of the
- // memory buffer, as they may get invalidated. That means we
- // need to do copy its contents.
- if (buffer.buffer === HEAP8.buffer) {
- canOwn = false;
- }
- if (!length) return 0;
- var node = stream.node;
- node.timestamp = Date.now();
- if (buffer.subarray && (!node.contents || node.contents.subarray)) {
- // This write is from a typed array to a typed array?
- if (canOwn) {
- node.contents = buffer.subarray(offset, offset + length);
- node.usedBytes = length;
- return length;
- } else if (node.usedBytes === 0 && position === 0) {
- // If this is a simple first write to an empty file, do a fast set since we don't need to care about old data.
- node.contents = buffer.slice(offset, offset + length);
- node.usedBytes = length;
- return length;
- } else if (position + length <= node.usedBytes) {
- // Writing to an already allocated and used subrange of the file?
- node.contents.set(buffer.subarray(offset, offset + length), position);
- return length;
- }
- }
- // Appending to an existing file and we need to reallocate, or source data did not come as a typed array.
- MEMFS.expandFileStorage(node, position + length);
- if (node.contents.subarray && buffer.subarray) {
- // Use typed array write which is available.
- node.contents.set(buffer.subarray(offset, offset + length), position);
- } else {
- for (var i = 0; i < length; i++) {
- node.contents[position + i] = buffer[offset + i]; // Or fall back to manual write if not.
- }
- }
- node.usedBytes = Math.max(node.usedBytes, position + length);
- return length;
- },
- llseek(stream, offset, whence) {
- var position = offset;
- if (whence === 1) {
- position += stream.position;
- } else if (whence === 2) {
- if (FS.isFile(stream.node.mode)) {
- position += stream.node.usedBytes;
- }
- }
- if (position < 0) {
- throw new FS.ErrnoError(28);
- }
- return position;
- },
- allocate(stream, offset, length) {
- MEMFS.expandFileStorage(stream.node, offset + length);
- stream.node.usedBytes = Math.max(stream.node.usedBytes, offset + length);
- },
- mmap(stream, length, position, prot, flags) {
- if (!FS.isFile(stream.node.mode)) {
- throw new FS.ErrnoError(43);
- }
- var ptr;
- var allocated;
- var contents = stream.node.contents;
- // Only make a new copy when MAP_PRIVATE is specified.
- if (!(flags & 2) && contents.buffer === HEAP8.buffer) {
- // We can't emulate MAP_SHARED when the file is not backed by the
- // buffer we're mapping to (e.g. the HEAP buffer).
- allocated = false;
- ptr = contents.byteOffset;
- } else {
- // Try to avoid unnecessary slices.
- if (position > 0 || position + length < contents.length) {
- if (contents.subarray) {
- contents = contents.subarray(position, position + length);
- } else {
- contents = Array.prototype.slice.call(
- contents,
- position,
- position + length
- );
- }
- }
- allocated = true;
- ptr = mmapAlloc(length);
- if (!ptr) {
- throw new FS.ErrnoError(48);
- }
- HEAP8.set(contents, ptr);
- }
- return { ptr, allocated };
- },
- msync(stream, buffer, offset, length, mmapFlags) {
- MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false);
- // should we check if bytesWritten and length are the same?
- return 0;
- }
- }
- };
- /** @param {boolean=} noRunDep */
- var asyncLoad = (url, onload, onerror, noRunDep) => {
- var dep = !noRunDep ? getUniqueRunDependency(`al ${url}`) : "";
- readAsync(
- url,
- arrayBuffer => {
- assert(
- arrayBuffer,
- `Loading data file "${url}" failed (no arrayBuffer).`
- );
- onload(new Uint8Array(arrayBuffer));
- if (dep) removeRunDependency(dep);
- },
- event => {
- if (onerror) {
- onerror();
- } else {
- throw `Loading data file "${url}" failed.`;
- }
- }
- );
- if (dep) addRunDependency(dep);
- };
- var preloadPlugins = Module["preloadPlugins"] || [];
- function FS_handledByPreloadPlugin(byteArray, fullname, finish, onerror) {
- // Ensure plugins are ready.
- if (typeof Browser != "undefined") Browser.init();
- var handled = false;
- preloadPlugins.forEach(function (plugin) {
- if (handled) return;
- if (plugin["canHandle"](fullname)) {
- plugin["handle"](byteArray, fullname, finish, onerror);
- handled = true;
- }
- });
- return handled;
- }
- function FS_createPreloadedFile(
- parent,
- name,
- url,
- canRead,
- canWrite,
- onload,
- onerror,
- dontCreateFile,
- canOwn,
- preFinish
- ) {
- // TODO we should allow people to just pass in a complete filename instead
- // of parent and name being that we just join them anyways
- var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent;
- var dep = getUniqueRunDependency(`cp ${fullname}`); // might have several active requests for the same fullname
- function processData(byteArray) {
- function finish(byteArray) {
- if (preFinish) preFinish();
- if (!dontCreateFile) {
- FS.createDataFile(parent, name, byteArray, canRead, canWrite, canOwn);
- }
- if (onload) onload();
- removeRunDependency(dep);
- }
- if (
- FS_handledByPreloadPlugin(byteArray, fullname, finish, () => {
- if (onerror) onerror();
- removeRunDependency(dep);
- })
- ) {
- return;
- }
- finish(byteArray);
- }
- addRunDependency(dep);
- if (typeof url == "string") {
- asyncLoad(url, byteArray => processData(byteArray), onerror);
- } else {
- processData(url);
- }
- }
- function FS_modeStringToFlags(str) {
- var flagModes = {
- r: 0,
- "r+": 2,
- w: 512 | 64 | 1,
- "w+": 512 | 64 | 2,
- a: 1024 | 64 | 1,
- "a+": 1024 | 64 | 2
- };
- var flags = flagModes[str];
- if (typeof flags == "undefined") {
- throw new Error(`Unknown file open mode: ${str}`);
- }
- return flags;
- }
- function FS_getMode(canRead, canWrite) {
- var mode = 0;
- if (canRead) mode |= 292 | 73;
- if (canWrite) mode |= 146;
- return mode;
- }
- var WORKERFS = {
- DIR_MODE: 16895,
- FILE_MODE: 33279,
- reader: null,
- mount(mount) {
- assert(ENVIRONMENT_IS_WORKER);
- if (!WORKERFS.reader) WORKERFS.reader = new FileReaderSync();
- var root = WORKERFS.createNode(null, "/", WORKERFS.DIR_MODE, 0);
- var createdParents = {};
- function ensureParent(path) {
- // return the parent node, creating subdirs as necessary
- var parts = path.split("/");
- var parent = root;
- for (var i = 0; i < parts.length - 1; i++) {
- var curr = parts.slice(0, i + 1).join("/");
- // Issue 4254: Using curr as a node name will prevent the node
- // from being found in FS.nameTable when FS.open is called on
- // a path which holds a child of this node,
- // given that all FS functions assume node names
- // are just their corresponding parts within their given path,
- // rather than incremental aggregates which include their parent's
- // directories.
- if (!createdParents[curr]) {
- createdParents[curr] = WORKERFS.createNode(
- parent,
- parts[i],
- WORKERFS.DIR_MODE,
- 0
- );
- }
- parent = createdParents[curr];
- }
- return parent;
- }
- function base(path) {
- var parts = path.split("/");
- return parts[parts.length - 1];
- }
- // We also accept FileList here, by using Array.prototype
- Array.prototype.forEach.call(mount.opts["files"] || [], function (file) {
- WORKERFS.createNode(
- ensureParent(file.name),
- base(file.name),
- WORKERFS.FILE_MODE,
- 0,
- file,
- file.lastModifiedDate
- );
- });
- (mount.opts["blobs"] || []).forEach(function (obj) {
- WORKERFS.createNode(
- ensureParent(obj["name"]),
- base(obj["name"]),
- WORKERFS.FILE_MODE,
- 0,
- obj["data"]
- );
- });
- (mount.opts["packages"] || []).forEach(function (pack) {
- pack["metadata"].files.forEach(function (file) {
- var name = file.filename.substr(1); // remove initial slash
- WORKERFS.createNode(
- ensureParent(name),
- base(name),
- WORKERFS.FILE_MODE,
- 0,
- pack["blob"].slice(file.start, file.end)
- );
- });
- });
- return root;
- },
- createNode(parent, name, mode, dev, contents, mtime) {
- var node = FS.createNode(parent, name, mode);
- node.mode = mode;
- node.node_ops = WORKERFS.node_ops;
- node.stream_ops = WORKERFS.stream_ops;
- node.timestamp = (mtime || new Date()).getTime();
- assert(WORKERFS.FILE_MODE !== WORKERFS.DIR_MODE);
- if (mode === WORKERFS.FILE_MODE) {
- node.size = contents.size;
- node.contents = contents;
- } else {
- node.size = 4096;
- node.contents = {};
- }
- if (parent) {
- parent.contents[name] = node;
- }
- return node;
- },
- node_ops: {
- getattr(node) {
- return {
- dev: 1,
- ino: node.id,
- mode: node.mode,
- nlink: 1,
- uid: 0,
- gid: 0,
- rdev: 0,
- size: node.size,
- atime: new Date(node.timestamp),
- mtime: new Date(node.timestamp),
- ctime: new Date(node.timestamp),
- blksize: 4096,
- blocks: Math.ceil(node.size / 4096)
- };
- },
- setattr(node, attr) {
- if (attr.mode !== undefined) {
- node.mode = attr.mode;
- }
- if (attr.timestamp !== undefined) {
- node.timestamp = attr.timestamp;
- }
- },
- lookup(parent, name) {
- throw new FS.ErrnoError(44);
- },
- mknod(parent, name, mode, dev) {
- throw new FS.ErrnoError(63);
- },
- rename(oldNode, newDir, newName) {
- throw new FS.ErrnoError(63);
- },
- unlink(parent, name) {
- throw new FS.ErrnoError(63);
- },
- rmdir(parent, name) {
- throw new FS.ErrnoError(63);
- },
- readdir(node) {
- var entries = [".", ".."];
- for (var key in node.contents) {
- if (!node.contents.hasOwnProperty(key)) {
- continue;
- }
- entries.push(key);
- }
- return entries;
- },
- symlink(parent, newName, oldPath) {
- throw new FS.ErrnoError(63);
- }
- },
- stream_ops: {
- read(stream, buffer, offset, length, position) {
- if (position >= stream.node.size) return 0;
- var chunk = stream.node.contents.slice(position, position + length);
- var ab = WORKERFS.reader.readAsArrayBuffer(chunk);
- buffer.set(new Uint8Array(ab), offset);
- return chunk.size;
- },
- write(stream, buffer, offset, length, position) {
- throw new FS.ErrnoError(29);
- },
- llseek(stream, offset, whence) {
- var position = offset;
- if (whence === 1) {
- position += stream.position;
- } else if (whence === 2) {
- if (FS.isFile(stream.node.mode)) {
- position += stream.node.size;
- }
- }
- if (position < 0) {
- throw new FS.ErrnoError(28);
- }
- return position;
- }
- }
- };
- var FS = {
- root: null,
- mounts: [],
- devices: {},
- streams: [],
- nextInode: 1,
- nameTable: null,
- currentPath: "/",
- initialized: false,
- ignorePermissions: true,
- ErrnoError: null,
- genericErrors: {},
- filesystems: null,
- syncFSRequests: 0,
- lookupPath: (path, opts = {}) => {
- path = PATH_FS.resolve(path);
- if (!path) return { path: "", node: null };
- var defaults = {
- follow_mount: true,
- recurse_count: 0
- };
- opts = Object.assign(defaults, opts);
- if (opts.recurse_count > 8) {
- // max recursive lookup of 8
- throw new FS.ErrnoError(32);
- }
- // split the absolute path
- var parts = path.split("/").filter(p => !!p);
- // start at the root
- var current = FS.root;
- var current_path = "/";
- for (var i = 0; i < parts.length; i++) {
- var islast = i === parts.length - 1;
- if (islast && opts.parent) {
- // stop resolving
- break;
- }
- current = FS.lookupNode(current, parts[i]);
- current_path = PATH.join2(current_path, parts[i]);
- // jump to the mount's root node if this is a mountpoint
- if (FS.isMountpoint(current)) {
- if (!islast || (islast && opts.follow_mount)) {
- current = current.mounted.root;
- }
- }
- // by default, lookupPath will not follow a symlink if it is the final path component.
- // setting opts.follow = true will override this behavior.
- if (!islast || opts.follow) {
- var count = 0;
- while (FS.isLink(current.mode)) {
- var link = FS.readlink(current_path);
- current_path = PATH_FS.resolve(PATH.dirname(current_path), link);
- var lookup = FS.lookupPath(current_path, {
- recurse_count: opts.recurse_count + 1
- });
- current = lookup.node;
- if (count++ > 40) {
- // limit max consecutive symlinks to 40 (SYMLOOP_MAX).
- throw new FS.ErrnoError(32);
- }
- }
- }
- }
- return { path: current_path, node: current };
- },
- getPath: node => {
- var path;
- while (true) {
- if (FS.isRoot(node)) {
- var mount = node.mount.mountpoint;
- if (!path) return mount;
- return mount[mount.length - 1] !== "/"
- ? `${mount}/${path}`
- : mount + path;
- }
- path = path ? `${node.name}/${path}` : node.name;
- node = node.parent;
- }
- },
- hashName: (parentid, name) => {
- var hash = 0;
- for (var i = 0; i < name.length; i++) {
- hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0;
- }
- return ((parentid + hash) >>> 0) % FS.nameTable.length;
- },
- hashAddNode: node => {
- var hash = FS.hashName(node.parent.id, node.name);
- node.name_next = FS.nameTable[hash];
- FS.nameTable[hash] = node;
- },
- hashRemoveNode: node => {
- var hash = FS.hashName(node.parent.id, node.name);
- if (FS.nameTable[hash] === node) {
- FS.nameTable[hash] = node.name_next;
- } else {
- var current = FS.nameTable[hash];
- while (current) {
- if (current.name_next === node) {
- current.name_next = node.name_next;
- break;
- }
- current = current.name_next;
- }
- }
- },
- lookupNode: (parent, name) => {
- var errCode = FS.mayLookup(parent);
- if (errCode) {
- throw new FS.ErrnoError(errCode, parent);
- }
- var hash = FS.hashName(parent.id, name);
- for (var node = FS.nameTable[hash]; node; node = node.name_next) {
- var nodeName = node.name;
- if (node.parent.id === parent.id && nodeName === name) {
- return node;
- }
- }
- // if we failed to find it in the cache, call into the VFS
- return FS.lookup(parent, name);
- },
- createNode: (parent, name, mode, rdev) => {
- var node = new FS.FSNode(parent, name, mode, rdev);
- FS.hashAddNode(node);
- return node;
- },
- destroyNode: node => {
- FS.hashRemoveNode(node);
- },
- isRoot: node => {
- return node === node.parent;
- },
- isMountpoint: node => {
- return !!node.mounted;
- },
- isFile: mode => {
- return (mode & 61440) === 32768;
- },
- isDir: mode => {
- return (mode & 61440) === 16384;
- },
- isLink: mode => {
- return (mode & 61440) === 40960;
- },
- isChrdev: mode => {
- return (mode & 61440) === 8192;
- },
- isBlkdev: mode => {
- return (mode & 61440) === 24576;
- },
- isFIFO: mode => {
- return (mode & 61440) === 4096;
- },
- isSocket: mode => {
- return (mode & 49152) === 49152;
- },
- flagsToPermissionString: flag => {
- var perms = ["r", "w", "rw"][flag & 3];
- if (flag & 512) {
- perms += "w";
- }
- return perms;
- },
- nodePermissions: (node, perms) => {
- if (FS.ignorePermissions) {
- return 0;
- }
- // return 0 if any user, group or owner bits are set.
- if (perms.includes("r") && !(node.mode & 292)) {
- return 2;
- } else if (perms.includes("w") && !(node.mode & 146)) {
- return 2;
- } else if (perms.includes("x") && !(node.mode & 73)) {
- return 2;
- }
- return 0;
- },
- mayLookup: dir => {
- var errCode = FS.nodePermissions(dir, "x");
- if (errCode) return errCode;
- if (!dir.node_ops.lookup) return 2;
- return 0;
- },
- mayCreate: (dir, name) => {
- try {
- var node = FS.lookupNode(dir, name);
- return 20;
- } catch (e) {}
- return FS.nodePermissions(dir, "wx");
- },
- mayDelete: (dir, name, isdir) => {
- var node;
- try {
- node = FS.lookupNode(dir, name);
- } catch (e) {
- return e.errno;
- }
- var errCode = FS.nodePermissions(dir, "wx");
- if (errCode) {
- return errCode;
- }
- if (isdir) {
- if (!FS.isDir(node.mode)) {
- return 54;
- }
- if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) {
- return 10;
- }
- } else {
- if (FS.isDir(node.mode)) {
- return 31;
- }
- }
- return 0;
- },
- mayOpen: (node, flags) => {
- if (!node) {
- return 44;
- }
- if (FS.isLink(node.mode)) {
- return 32;
- } else if (FS.isDir(node.mode)) {
- if (
- FS.flagsToPermissionString(flags) !== "r" || // opening for write
- flags & 512
- ) {
- // TODO: check for O_SEARCH? (== search for dir only)
- return 31;
- }
- }
- return FS.nodePermissions(node, FS.flagsToPermissionString(flags));
- },
- MAX_OPEN_FDS: 4096,
- nextfd: () => {
- for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) {
- if (!FS.streams[fd]) {
- return fd;
- }
- }
- throw new FS.ErrnoError(33);
- },
- getStreamChecked: fd => {
- var stream = FS.getStream(fd);
- if (!stream) {
- throw new FS.ErrnoError(8);
- }
- return stream;
- },
- getStream: fd => FS.streams[fd],
- createStream: (stream, fd = -1) => {
- if (!FS.FSStream) {
- FS.FSStream = /** @constructor */ function () {
- this.shared = {};
- };
- FS.FSStream.prototype = {};
- Object.defineProperties(FS.FSStream.prototype, {
- object: {
- /** @this {FS.FSStream} */
- get() {
- return this.node;
- },
- /** @this {FS.FSStream} */
- set(val) {
- this.node = val;
- }
- },
- isRead: {
- /** @this {FS.FSStream} */
- get() {
- return (this.flags & 2097155) !== 1;
- }
- },
- isWrite: {
- /** @this {FS.FSStream} */
- get() {
- return (this.flags & 2097155) !== 0;
- }
- },
- isAppend: {
- /** @this {FS.FSStream} */
- get() {
- return this.flags & 1024;
- }
- },
- flags: {
- /** @this {FS.FSStream} */
- get() {
- return this.shared.flags;
- },
- /** @this {FS.FSStream} */
- set(val) {
- this.shared.flags = val;
- }
- },
- position: {
- /** @this {FS.FSStream} */
- get() {
- return this.shared.position;
- },
- /** @this {FS.FSStream} */
- set(val) {
- this.shared.position = val;
- }
- }
- });
- }
- // clone it, so we can return an instance of FSStream
- stream = Object.assign(new FS.FSStream(), stream);
- if (fd == -1) {
- fd = FS.nextfd();
- }
- stream.fd = fd;
- FS.streams[fd] = stream;
- return stream;
- },
- closeStream: fd => {
- FS.streams[fd] = null;
- },
- chrdev_stream_ops: {
- open: stream => {
- var device = FS.getDevice(stream.node.rdev);
- // override node's stream ops with the device's
- stream.stream_ops = device.stream_ops;
- // forward the open call
- if (stream.stream_ops.open) {
- stream.stream_ops.open(stream);
- }
- },
- llseek: () => {
- throw new FS.ErrnoError(70);
- }
- },
- major: dev => dev >> 8,
- minor: dev => dev & 0xff,
- makedev: (ma, mi) => (ma << 8) | mi,
- registerDevice: (dev, ops) => {
- FS.devices[dev] = { stream_ops: ops };
- },
- getDevice: dev => FS.devices[dev],
- getMounts: mount => {
- var mounts = [];
- var check = [mount];
- while (check.length) {
- var m = check.pop();
- mounts.push(m);
- check.push.apply(check, m.mounts);
- }
- return mounts;
- },
- syncfs: (populate, callback) => {
- if (typeof populate == "function") {
- callback = populate;
- populate = false;
- }
- FS.syncFSRequests++;
- if (FS.syncFSRequests > 1) {
- err(
- `warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`
- );
- }
- var mounts = FS.getMounts(FS.root.mount);
- var completed = 0;
- function doCallback(errCode) {
- FS.syncFSRequests--;
- return callback(errCode);
- }
- function done(errCode) {
- if (errCode) {
- if (!done.errored) {
- done.errored = true;
- return doCallback(errCode);
- }
- return;
- }
- if (++completed >= mounts.length) {
- doCallback(null);
- }
- }
- // sync all mounts
- mounts.forEach(mount => {
- if (!mount.type.syncfs) {
- return done(null);
- }
- mount.type.syncfs(mount, populate, done);
- });
- },
- mount: (type, opts, mountpoint) => {
- var root = mountpoint === "/";
- var pseudo = !mountpoint;
- var node;
- if (root && FS.root) {
- throw new FS.ErrnoError(10);
- } else if (!root && !pseudo) {
- var lookup = FS.lookupPath(mountpoint, { follow_mount: false });
- mountpoint = lookup.path; // use the absolute path
- node = lookup.node;
- if (FS.isMountpoint(node)) {
- throw new FS.ErrnoError(10);
- }
- if (!FS.isDir(node.mode)) {
- throw new FS.ErrnoError(54);
- }
- }
- var mount = {
- type,
- opts,
- mountpoint,
- mounts: []
- };
- // create a root node for the fs
- var mountRoot = type.mount(mount);
- mountRoot.mount = mount;
- mount.root = mountRoot;
- if (root) {
- FS.root = mountRoot;
- } else if (node) {
- // set as a mountpoint
- node.mounted = mount;
- // add the new mount to the current mount's children
- if (node.mount) {
- node.mount.mounts.push(mount);
- }
- }
- return mountRoot;
- },
- unmount: mountpoint => {
- var lookup = FS.lookupPath(mountpoint, { follow_mount: false });
- if (!FS.isMountpoint(lookup.node)) {
- throw new FS.ErrnoError(28);
- }
- // destroy the nodes for this mount, and all its child mounts
- var node = lookup.node;
- var mount = node.mounted;
- var mounts = FS.getMounts(mount);
- Object.keys(FS.nameTable).forEach(hash => {
- var current = FS.nameTable[hash];
- while (current) {
- var next = current.name_next;
- if (mounts.includes(current.mount)) {
- FS.destroyNode(current);
- }
- current = next;
- }
- });
- // no longer a mountpoint
- node.mounted = null;
- // remove this mount from the child mounts
- var idx = node.mount.mounts.indexOf(mount);
- node.mount.mounts.splice(idx, 1);
- },
- lookup: (parent, name) => {
- return parent.node_ops.lookup(parent, name);
- },
- mknod: (path, mode, dev) => {
- var lookup = FS.lookupPath(path, { parent: true });
- var parent = lookup.node;
- var name = PATH.basename(path);
- if (!name || name === "." || name === "..") {
- throw new FS.ErrnoError(28);
- }
- var errCode = FS.mayCreate(parent, name);
- if (errCode) {
- throw new FS.ErrnoError(errCode);
- }
- if (!parent.node_ops.mknod) {
- throw new FS.ErrnoError(63);
- }
- return parent.node_ops.mknod(parent, name, mode, dev);
- },
- create: (path, mode) => {
- mode = mode !== undefined ? mode : 438 /* 0666 */;
- mode &= 4095;
- mode |= 32768;
- return FS.mknod(path, mode, 0);
- },
- mkdir: (path, mode) => {
- mode = mode !== undefined ? mode : 511 /* 0777 */;
- mode &= 511 | 512;
- mode |= 16384;
- return FS.mknod(path, mode, 0);
- },
- mkdirTree: (path, mode) => {
- var dirs = path.split("/");
- var d = "";
- for (var i = 0; i < dirs.length; ++i) {
- if (!dirs[i]) continue;
- d += "/" + dirs[i];
- try {
- FS.mkdir(d, mode);
- } catch (e) {
- if (e.errno != 20) throw e;
- }
- }
- },
- mkdev: (path, mode, dev) => {
- if (typeof dev == "undefined") {
- dev = mode;
- mode = 438 /* 0666 */;
- }
- mode |= 8192;
- return FS.mknod(path, mode, dev);
- },
- symlink: (oldpath, newpath) => {
- if (!PATH_FS.resolve(oldpath)) {
- throw new FS.ErrnoError(44);
- }
- var lookup = FS.lookupPath(newpath, { parent: true });
- var parent = lookup.node;
- if (!parent) {
- throw new FS.ErrnoError(44);
- }
- var newname = PATH.basename(newpath);
- var errCode = FS.mayCreate(parent, newname);
- if (errCode) {
- throw new FS.ErrnoError(errCode);
- }
- if (!parent.node_ops.symlink) {
- throw new FS.ErrnoError(63);
- }
- return parent.node_ops.symlink(parent, newname, oldpath);
- },
- rename: (old_path, new_path) => {
- var old_dirname = PATH.dirname(old_path);
- var new_dirname = PATH.dirname(new_path);
- var old_name = PATH.basename(old_path);
- var new_name = PATH.basename(new_path);
- // parents must exist
- var lookup, old_dir, new_dir;
- // let the errors from non existant directories percolate up
- lookup = FS.lookupPath(old_path, { parent: true });
- old_dir = lookup.node;
- lookup = FS.lookupPath(new_path, { parent: true });
- new_dir = lookup.node;
- if (!old_dir || !new_dir) throw new FS.ErrnoError(44);
- // need to be part of the same mount
- if (old_dir.mount !== new_dir.mount) {
- throw new FS.ErrnoError(75);
- }
- // source must exist
- var old_node = FS.lookupNode(old_dir, old_name);
- // old path should not be an ancestor of the new path
- var relative = PATH_FS.relative(old_path, new_dirname);
- if (relative.charAt(0) !== ".") {
- throw new FS.ErrnoError(28);
- }
- // new path should not be an ancestor of the old path
- relative = PATH_FS.relative(new_path, old_dirname);
- if (relative.charAt(0) !== ".") {
- throw new FS.ErrnoError(55);
- }
- // see if the new path already exists
- var new_node;
- try {
- new_node = FS.lookupNode(new_dir, new_name);
- } catch (e) {
- // not fatal
- }
- // early out if nothing needs to change
- if (old_node === new_node) {
- return;
- }
- // we'll need to delete the old entry
- var isdir = FS.isDir(old_node.mode);
- var errCode = FS.mayDelete(old_dir, old_name, isdir);
- if (errCode) {
- throw new FS.ErrnoError(errCode);
- }
- // need delete permissions if we'll be overwriting.
- // need create permissions if new doesn't already exist.
- errCode = new_node
- ? FS.mayDelete(new_dir, new_name, isdir)
- : FS.mayCreate(new_dir, new_name);
- if (errCode) {
- throw new FS.ErrnoError(errCode);
- }
- if (!old_dir.node_ops.rename) {
- throw new FS.ErrnoError(63);
- }
- if (FS.isMountpoint(old_node) || (new_node && FS.isMountpoint(new_node))) {
- throw new FS.ErrnoError(10);
- }
- // if we are going to change the parent, check write permissions
- if (new_dir !== old_dir) {
- errCode = FS.nodePermissions(old_dir, "w");
- if (errCode) {
- throw new FS.ErrnoError(errCode);
- }
- }
- // remove the node from the lookup hash
- FS.hashRemoveNode(old_node);
- // do the underlying fs rename
- try {
- old_dir.node_ops.rename(old_node, new_dir, new_name);
- } catch (e) {
- throw e;
- } finally {
- // add the node back to the hash (in case node_ops.rename
- // changed its name)
- FS.hashAddNode(old_node);
- }
- },
- rmdir: path => {
- var lookup = FS.lookupPath(path, { parent: true });
- var parent = lookup.node;
- var name = PATH.basename(path);
- var node = FS.lookupNode(parent, name);
- var errCode = FS.mayDelete(parent, name, true);
- if (errCode) {
- throw new FS.ErrnoError(errCode);
- }
- if (!parent.node_ops.rmdir) {
- throw new FS.ErrnoError(63);
- }
- if (FS.isMountpoint(node)) {
- throw new FS.ErrnoError(10);
- }
- parent.node_ops.rmdir(parent, name);
- FS.destroyNode(node);
- },
- readdir: path => {
- var lookup = FS.lookupPath(path, { follow: true });
- var node = lookup.node;
- if (!node.node_ops.readdir) {
- throw new FS.ErrnoError(54);
- }
- return node.node_ops.readdir(node);
- },
- unlink: path => {
- var lookup = FS.lookupPath(path, { parent: true });
- var parent = lookup.node;
- if (!parent) {
- throw new FS.ErrnoError(44);
- }
- var name = PATH.basename(path);
- var node = FS.lookupNode(parent, name);
- var errCode = FS.mayDelete(parent, name, false);
- if (errCode) {
- // According to POSIX, we should map EISDIR to EPERM, but
- // we instead do what Linux does (and we must, as we use
- // the musl linux libc).
- throw new FS.ErrnoError(errCode);
- }
- if (!parent.node_ops.unlink) {
- throw new FS.ErrnoError(63);
- }
- if (FS.isMountpoint(node)) {
- throw new FS.ErrnoError(10);
- }
- parent.node_ops.unlink(parent, name);
- FS.destroyNode(node);
- },
- readlink: path => {
- var lookup = FS.lookupPath(path);
- var link = lookup.node;
- if (!link) {
- throw new FS.ErrnoError(44);
- }
- if (!link.node_ops.readlink) {
- throw new FS.ErrnoError(28);
- }
- return PATH_FS.resolve(
- FS.getPath(link.parent),
- link.node_ops.readlink(link)
- );
- },
- stat: (path, dontFollow) => {
- var lookup = FS.lookupPath(path, { follow: !dontFollow });
- var node = lookup.node;
- if (!node) {
- throw new FS.ErrnoError(44);
- }
- if (!node.node_ops.getattr) {
- throw new FS.ErrnoError(63);
- }
- return node.node_ops.getattr(node);
- },
- lstat: path => {
- return FS.stat(path, true);
- },
- chmod: (path, mode, dontFollow) => {
- var node;
- if (typeof path == "string") {
- var lookup = FS.lookupPath(path, { follow: !dontFollow });
- node = lookup.node;
- } else {
- node = path;
- }
- if (!node.node_ops.setattr) {
- throw new FS.ErrnoError(63);
- }
- node.node_ops.setattr(node, {
- mode: (mode & 4095) | (node.mode & ~4095),
- timestamp: Date.now()
- });
- },
- lchmod: (path, mode) => {
- FS.chmod(path, mode, true);
- },
- fchmod: (fd, mode) => {
- var stream = FS.getStreamChecked(fd);
- FS.chmod(stream.node, mode);
- },
- chown: (path, uid, gid, dontFollow) => {
- var node;
- if (typeof path == "string") {
- var lookup = FS.lookupPath(path, { follow: !dontFollow });
- node = lookup.node;
- } else {
- node = path;
- }
- if (!node.node_ops.setattr) {
- throw new FS.ErrnoError(63);
- }
- node.node_ops.setattr(node, {
- timestamp: Date.now()
- // we ignore the uid / gid for now
- });
- },
- lchown: (path, uid, gid) => {
- FS.chown(path, uid, gid, true);
- },
- fchown: (fd, uid, gid) => {
- var stream = FS.getStreamChecked(fd);
- FS.chown(stream.node, uid, gid);
- },
- truncate: (path, len) => {
- if (len < 0) {
- throw new FS.ErrnoError(28);
- }
- var node;
- if (typeof path == "string") {
- var lookup = FS.lookupPath(path, { follow: true });
- node = lookup.node;
- } else {
- node = path;
- }
- if (!node.node_ops.setattr) {
- throw new FS.ErrnoError(63);
- }
- if (FS.isDir(node.mode)) {
- throw new FS.ErrnoError(31);
- }
- if (!FS.isFile(node.mode)) {
- throw new FS.ErrnoError(28);
- }
- var errCode = FS.nodePermissions(node, "w");
- if (errCode) {
- throw new FS.ErrnoError(errCode);
- }
- node.node_ops.setattr(node, {
- size: len,
- timestamp: Date.now()
- });
- },
- ftruncate: (fd, len) => {
- var stream = FS.getStreamChecked(fd);
- if ((stream.flags & 2097155) === 0) {
- throw new FS.ErrnoError(28);
- }
- FS.truncate(stream.node, len);
- },
- utime: (path, atime, mtime) => {
- var lookup = FS.lookupPath(path, { follow: true });
- var node = lookup.node;
- node.node_ops.setattr(node, {
- timestamp: Math.max(atime, mtime)
- });
- },
- open: (path, flags, mode) => {
- if (path === "") {
- throw new FS.ErrnoError(44);
- }
- flags = typeof flags == "string" ? FS_modeStringToFlags(flags) : flags;
- mode = typeof mode == "undefined" ? 438 /* 0666 */ : mode;
- if (flags & 64) {
- mode = (mode & 4095) | 32768;
- } else {
- mode = 0;
- }
- var node;
- if (typeof path == "object") {
- node = path;
- } else {
- path = PATH.normalize(path);
- try {
- var lookup = FS.lookupPath(path, {
- follow: !(flags & 131072)
- });
- node = lookup.node;
- } catch (e) {
- // ignore
- }
- }
- // perhaps we need to create the node
- var created = false;
- if (flags & 64) {
- if (node) {
- // if O_CREAT and O_EXCL are set, error out if the node already exists
- if (flags & 128) {
- throw new FS.ErrnoError(20);
- }
- } else {
- // node doesn't exist, try to create it
- node = FS.mknod(path, mode, 0);
- created = true;
- }
- }
- if (!node) {
- throw new FS.ErrnoError(44);
- }
- // can't truncate a device
- if (FS.isChrdev(node.mode)) {
- flags &= ~512;
- }
- // if asked only for a directory, then this must be one
- if (flags & 65536 && !FS.isDir(node.mode)) {
- throw new FS.ErrnoError(54);
- }
- // check permissions, if this is not a file we just created now (it is ok to
- // create and write to a file with read-only permissions; it is read-only
- // for later use)
- if (!created) {
- var errCode = FS.mayOpen(node, flags);
- if (errCode) {
- throw new FS.ErrnoError(errCode);
- }
- }
- // do truncation if necessary
- if (flags & 512 && !created) {
- FS.truncate(node, 0);
- }
- // we've already handled these, don't pass down to the underlying vfs
- flags &= ~(128 | 512 | 131072);
- // register the stream with the filesystem
- var stream = FS.createStream({
- node,
- path: FS.getPath(node), // we want the absolute path to the node
- flags,
- seekable: true,
- position: 0,
- stream_ops: node.stream_ops,
- // used by the file family libc calls (fopen, fwrite, ferror, etc.)
- ungotten: [],
- error: false
- });
- // call the new stream's open function
- if (stream.stream_ops.open) {
- stream.stream_ops.open(stream);
- }
- if (Module["logReadFiles"] && !(flags & 1)) {
- if (!FS.readFiles) FS.readFiles = {};
- if (!(path in FS.readFiles)) {
- FS.readFiles[path] = 1;
- }
- }
- return stream;
- },
- close: stream => {
- if (FS.isClosed(stream)) {
- throw new FS.ErrnoError(8);
- }
- if (stream.getdents) stream.getdents = null; // free readdir state
- try {
- if (stream.stream_ops.close) {
- stream.stream_ops.close(stream);
- }
- } catch (e) {
- throw e;
- } finally {
- FS.closeStream(stream.fd);
- }
- stream.fd = null;
- },
- isClosed: stream => {
- return stream.fd === null;
- },
- llseek: (stream, offset, whence) => {
- if (FS.isClosed(stream)) {
- throw new FS.ErrnoError(8);
- }
- if (!stream.seekable || !stream.stream_ops.llseek) {
- throw new FS.ErrnoError(70);
- }
- if (whence != 0 && whence != 1 && whence != 2) {
- throw new FS.ErrnoError(28);
- }
- stream.position = stream.stream_ops.llseek(stream, offset, whence);
- stream.ungotten = [];
- return stream.position;
- },
- read: (stream, buffer, offset, length, position) => {
- if (length < 0 || position < 0) {
- throw new FS.ErrnoError(28);
- }
- if (FS.isClosed(stream)) {
- throw new FS.ErrnoError(8);
- }
- if ((stream.flags & 2097155) === 1) {
- throw new FS.ErrnoError(8);
- }
- if (FS.isDir(stream.node.mode)) {
- throw new FS.ErrnoError(31);
- }
- if (!stream.stream_ops.read) {
- throw new FS.ErrnoError(28);
- }
- var seeking = typeof position != "undefined";
- if (!seeking) {
- position = stream.position;
- } else if (!stream.seekable) {
- throw new FS.ErrnoError(70);
- }
- var bytesRead = stream.stream_ops.read(
- stream,
- buffer,
- offset,
- length,
- position
- );
- if (!seeking) stream.position += bytesRead;
- return bytesRead;
- },
- write: (stream, buffer, offset, length, position, canOwn) => {
- if (length < 0 || position < 0) {
- throw new FS.ErrnoError(28);
- }
- if (FS.isClosed(stream)) {
- throw new FS.ErrnoError(8);
- }
- if ((stream.flags & 2097155) === 0) {
- throw new FS.ErrnoError(8);
- }
- if (FS.isDir(stream.node.mode)) {
- throw new FS.ErrnoError(31);
- }
- if (!stream.stream_ops.write) {
- throw new FS.ErrnoError(28);
- }
- if (stream.seekable && stream.flags & 1024) {
- // seek to the end before writing in append mode
- FS.llseek(stream, 0, 2);
- }
- var seeking = typeof position != "undefined";
- if (!seeking) {
- position = stream.position;
- } else if (!stream.seekable) {
- throw new FS.ErrnoError(70);
- }
- var bytesWritten = stream.stream_ops.write(
- stream,
- buffer,
- offset,
- length,
- position,
- canOwn
- );
- if (!seeking) stream.position += bytesWritten;
- return bytesWritten;
- },
- allocate: (stream, offset, length) => {
- if (FS.isClosed(stream)) {
- throw new FS.ErrnoError(8);
- }
- if (offset < 0 || length <= 0) {
- throw new FS.ErrnoError(28);
- }
- if ((stream.flags & 2097155) === 0) {
- throw new FS.ErrnoError(8);
- }
- if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) {
- throw new FS.ErrnoError(43);
- }
- if (!stream.stream_ops.allocate) {
- throw new FS.ErrnoError(138);
- }
- stream.stream_ops.allocate(stream, offset, length);
- },
- mmap: (stream, length, position, prot, flags) => {
- // User requests writing to file (prot & PROT_WRITE != 0).
- // Checking if we have permissions to write to the file unless
- // MAP_PRIVATE flag is set. According to POSIX spec it is possible
- // to write to file opened in read-only mode with MAP_PRIVATE flag,
- // as all modifications will be visible only in the memory of
- // the current process.
- if (
- (prot & 2) !== 0 &&
- (flags & 2) === 0 &&
- (stream.flags & 2097155) !== 2
- ) {
- throw new FS.ErrnoError(2);
- }
- if ((stream.flags & 2097155) === 1) {
- throw new FS.ErrnoError(2);
- }
- if (!stream.stream_ops.mmap) {
- throw new FS.ErrnoError(43);
- }
- return stream.stream_ops.mmap(stream, length, position, prot, flags);
- },
- msync: (stream, buffer, offset, length, mmapFlags) => {
- if (!stream.stream_ops.msync) {
- return 0;
- }
- return stream.stream_ops.msync(stream, buffer, offset, length, mmapFlags);
- },
- munmap: stream => 0,
- ioctl: (stream, cmd, arg) => {
- if (!stream.stream_ops.ioctl) {
- throw new FS.ErrnoError(59);
- }
- return stream.stream_ops.ioctl(stream, cmd, arg);
- },
- readFile: (path, opts = {}) => {
- opts.flags = opts.flags || 0;
- opts.encoding = opts.encoding || "binary";
- if (opts.encoding !== "utf8" && opts.encoding !== "binary") {
- throw new Error(`Invalid encoding type "${opts.encoding}"`);
- }
- var ret;
- var stream = FS.open(path, opts.flags);
- var stat = FS.stat(path);
- var length = stat.size;
- var buf = new Uint8Array(length);
- FS.read(stream, buf, 0, length, 0);
- if (opts.encoding === "utf8") {
- ret = UTF8ArrayToString(buf, 0);
- } else if (opts.encoding === "binary") {
- ret = buf;
- }
- FS.close(stream);
- return ret;
- },
- writeFile: (path, data, opts = {}) => {
- opts.flags = opts.flags || 577;
- var stream = FS.open(path, opts.flags, opts.mode);
- if (typeof data == "string") {
- var buf = new Uint8Array(lengthBytesUTF8(data) + 1);
- var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length);
- FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn);
- } else if (ArrayBuffer.isView(data)) {
- FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn);
- } else {
- throw new Error("Unsupported data type");
- }
- FS.close(stream);
- },
- cwd: () => FS.currentPath,
- chdir: path => {
- var lookup = FS.lookupPath(path, { follow: true });
- if (lookup.node === null) {
- throw new FS.ErrnoError(44);
- }
- if (!FS.isDir(lookup.node.mode)) {
- throw new FS.ErrnoError(54);
- }
- var errCode = FS.nodePermissions(lookup.node, "x");
- if (errCode) {
- throw new FS.ErrnoError(errCode);
- }
- FS.currentPath = lookup.path;
- },
- createDefaultDirectories: () => {
- FS.mkdir("/tmp");
- FS.mkdir("/home");
- FS.mkdir("/home/web_user");
- },
- createDefaultDevices: () => {
- // create /dev
- FS.mkdir("/dev");
- // setup /dev/null
- FS.registerDevice(FS.makedev(1, 3), {
- read: () => 0,
- write: (stream, buffer, offset, length, pos) => length
- });
- FS.mkdev("/dev/null", FS.makedev(1, 3));
- // setup /dev/tty and /dev/tty1
- // stderr needs to print output using err() rather than out()
- // so we register a second tty just for it.
- TTY.register(FS.makedev(5, 0), TTY.default_tty_ops);
- TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops);
- FS.mkdev("/dev/tty", FS.makedev(5, 0));
- FS.mkdev("/dev/tty1", FS.makedev(6, 0));
- // setup /dev/[u]random
- // use a buffer to avoid overhead of individual crypto calls per byte
- var randomBuffer = new Uint8Array(1024),
- randomLeft = 0;
- var randomByte = () => {
- if (randomLeft === 0) {
- randomLeft = randomFill(randomBuffer).byteLength;
- }
- return randomBuffer[--randomLeft];
- };
- FS.createDevice("/dev", "random", randomByte);
- FS.createDevice("/dev", "urandom", randomByte);
- // we're not going to emulate the actual shm device,
- // just create the tmp dirs that reside in it commonly
- FS.mkdir("/dev/shm");
- FS.mkdir("/dev/shm/tmp");
- },
- createSpecialDirectories: () => {
- // create /proc/self/fd which allows /proc/self/fd/6 => readlink gives the
- // name of the stream for fd 6 (see test_unistd_ttyname)
- FS.mkdir("/proc");
- var proc_self = FS.mkdir("/proc/self");
- FS.mkdir("/proc/self/fd");
- FS.mount(
- {
- mount: () => {
- var node = FS.createNode(proc_self, "fd", 16384 | 511 /* 0777 */, 73);
- node.node_ops = {
- lookup: (parent, name) => {
- var fd = +name;
- var stream = FS.getStreamChecked(fd);
- var ret = {
- parent: null,
- mount: { mountpoint: "fake" },
- node_ops: { readlink: () => stream.path }
- };
- ret.parent = ret; // make it look like a simple root node
- return ret;
- }
- };
- return node;
- }
- },
- {},
- "/proc/self/fd"
- );
- },
- createStandardStreams: () => {
- // TODO deprecate the old functionality of a single
- // input / output callback and that utilizes FS.createDevice
- // and instead require a unique set of stream ops
- // by default, we symlink the standard streams to the
- // default tty devices. however, if the standard streams
- // have been overwritten we create a unique device for
- // them instead.
- if (Module["stdin"]) {
- FS.createDevice("/dev", "stdin", Module["stdin"]);
- } else {
- FS.symlink("/dev/tty", "/dev/stdin");
- }
- if (Module["stdout"]) {
- FS.createDevice("/dev", "stdout", null, Module["stdout"]);
- } else {
- FS.symlink("/dev/tty", "/dev/stdout");
- }
- if (Module["stderr"]) {
- FS.createDevice("/dev", "stderr", null, Module["stderr"]);
- } else {
- FS.symlink("/dev/tty1", "/dev/stderr");
- }
- // open default streams for the stdin, stdout and stderr devices
- var stdin = FS.open("/dev/stdin", 0);
- var stdout = FS.open("/dev/stdout", 1);
- var stderr = FS.open("/dev/stderr", 1);
- },
- ensureErrnoError: () => {
- if (FS.ErrnoError) return;
- FS.ErrnoError = /** @this{Object} */ function ErrnoError(errno, node) {
- // We set the `name` property to be able to identify `FS.ErrnoError`
- // - the `name` is a standard ECMA-262 property of error objects. Kind of good to have it anyway.
- // - when using PROXYFS, an error can come from an underlying FS
- // as different FS objects have their own FS.ErrnoError each,
- // the test `err instanceof FS.ErrnoError` won't detect an error coming from another filesystem, causing bugs.
- // we'll use the reliable test `err.name == "ErrnoError"` instead
- this.name = "ErrnoError";
- this.node = node;
- this.setErrno = /** @this{Object} */ function (errno) {
- this.errno = errno;
- };
- this.setErrno(errno);
- this.message = "FS error";
- };
- FS.ErrnoError.prototype = new Error();
- FS.ErrnoError.prototype.constructor = FS.ErrnoError;
- // Some errors may happen quite a bit, to avoid overhead we reuse them (and suffer a lack of stack info)
- [44].forEach(code => {
- FS.genericErrors[code] = new FS.ErrnoError(code);
- FS.genericErrors[code].stack = "<generic error, no stack>";
- });
- },
- staticInit: () => {
- FS.ensureErrnoError();
- FS.nameTable = new Array(4096);
- FS.mount(MEMFS, {}, "/");
- FS.createDefaultDirectories();
- FS.createDefaultDevices();
- FS.createSpecialDirectories();
- FS.filesystems = {
- MEMFS: MEMFS,
- WORKERFS: WORKERFS
- };
- },
- init: (input, output, error) => {
- FS.init.initialized = true;
- FS.ensureErrnoError();
- // Allow Module.stdin etc. to provide defaults, if none explicitly passed to us here
- Module["stdin"] = input || Module["stdin"];
- Module["stdout"] = output || Module["stdout"];
- Module["stderr"] = error || Module["stderr"];
- FS.createStandardStreams();
- },
- quit: () => {
- FS.init.initialized = false;
- // force-flush all streams, so we get musl std streams printed out
- // close all of our streams
- for (var i = 0; i < FS.streams.length; i++) {
- var stream = FS.streams[i];
- if (!stream) {
- continue;
- }
- FS.close(stream);
- }
- },
- findObject: (path, dontResolveLastLink) => {
- var ret = FS.analyzePath(path, dontResolveLastLink);
- if (!ret.exists) {
- return null;
- }
- return ret.object;
- },
- analyzePath: (path, dontResolveLastLink) => {
- // operate from within the context of the symlink's target
- try {
- var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
- path = lookup.path;
- } catch (e) {}
- var ret = {
- isRoot: false,
- exists: false,
- error: 0,
- name: null,
- path: null,
- object: null,
- parentExists: false,
- parentPath: null,
- parentObject: null
- };
- try {
- var lookup = FS.lookupPath(path, { parent: true });
- ret.parentExists = true;
- ret.parentPath = lookup.path;
- ret.parentObject = lookup.node;
- ret.name = PATH.basename(path);
- lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
- ret.exists = true;
- ret.path = lookup.path;
- ret.object = lookup.node;
- ret.name = lookup.node.name;
- ret.isRoot = lookup.path === "/";
- } catch (e) {
- ret.error = e.errno;
- }
- return ret;
- },
- createPath: (parent, path, canRead, canWrite) => {
- parent = typeof parent == "string" ? parent : FS.getPath(parent);
- var parts = path.split("/").reverse();
- while (parts.length) {
- var part = parts.pop();
- if (!part) continue;
- var current = PATH.join2(parent, part);
- try {
- FS.mkdir(current);
- } catch (e) {
- // ignore EEXIST
- }
- parent = current;
- }
- return current;
- },
- createFile: (parent, name, properties, canRead, canWrite) => {
- var path = PATH.join2(
- typeof parent == "string" ? parent : FS.getPath(parent),
- name
- );
- var mode = FS_getMode(canRead, canWrite);
- return FS.create(path, mode);
- },
- createDataFile: (parent, name, data, canRead, canWrite, canOwn) => {
- var path = name;
- if (parent) {
- parent = typeof parent == "string" ? parent : FS.getPath(parent);
- path = name ? PATH.join2(parent, name) : parent;
- }
- var mode = FS_getMode(canRead, canWrite);
- var node = FS.create(path, mode);
- if (data) {
- if (typeof data == "string") {
- var arr = new Array(data.length);
- for (var i = 0, len = data.length; i < len; ++i)
- arr[i] = data.charCodeAt(i);
- data = arr;
- }
- // make sure we can write to the file
- FS.chmod(node, mode | 146);
- var stream = FS.open(node, 577);
- FS.write(stream, data, 0, data.length, 0, canOwn);
- FS.close(stream);
- FS.chmod(node, mode);
- }
- return node;
- },
- createDevice: (parent, name, input, output) => {
- var path = PATH.join2(
- typeof parent == "string" ? parent : FS.getPath(parent),
- name
- );
- var mode = FS_getMode(!!input, !!output);
- if (!FS.createDevice.major) FS.createDevice.major = 64;
- var dev = FS.makedev(FS.createDevice.major++, 0);
- // Create a fake device that a set of stream ops to emulate
- // the old behavior.
- FS.registerDevice(dev, {
- open: stream => {
- stream.seekable = false;
- },
- close: stream => {
- // flush any pending line data
- if (output && output.buffer && output.buffer.length) {
- output(10);
- }
- },
- read: (stream, buffer, offset, length, pos /* ignored */) => {
- var bytesRead = 0;
- for (var i = 0; i < length; i++) {
- var result;
- try {
- result = input();
- } catch (e) {
- throw new FS.ErrnoError(29);
- }
- if (result === undefined && bytesRead === 0) {
- throw new FS.ErrnoError(6);
- }
- if (result === null || result === undefined) break;
- bytesRead++;
- buffer[offset + i] = result;
- }
- if (bytesRead) {
- stream.node.timestamp = Date.now();
- }
- return bytesRead;
- },
- write: (stream, buffer, offset, length, pos) => {
- for (var i = 0; i < length; i++) {
- try {
- output(buffer[offset + i]);
- } catch (e) {
- throw new FS.ErrnoError(29);
- }
- }
- if (length) {
- stream.node.timestamp = Date.now();
- }
- return i;
- }
- });
- return FS.mkdev(path, mode, dev);
- },
- forceLoadFile: obj => {
- if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true;
- if (typeof XMLHttpRequest != "undefined") {
- throw new Error(
- "Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread."
- );
- } else if (read_) {
- // Command-line.
- try {
- // WARNING: Can't read binary files in V8's d8 or tracemonkey's js, as
- // read() will try to parse UTF8.
- obj.contents = intArrayFromString(read_(obj.url), true);
- obj.usedBytes = obj.contents.length;
- } catch (e) {
- throw new FS.ErrnoError(29);
- }
- } else {
- throw new Error("Cannot load without read() or XMLHttpRequest.");
- }
- },
- createLazyFile: (parent, name, url, canRead, canWrite) => {
- // Lazy chunked Uint8Array (implements get and length from Uint8Array). Actual getting is abstracted away for eventual reuse.
- /** @constructor */
- function LazyUint8Array() {
- this.lengthKnown = false;
- this.chunks = []; // Loaded chunks. Index is the chunk number
- }
- LazyUint8Array.prototype.get =
- /** @this{Object} */ function LazyUint8Array_get(idx) {
- if (idx > this.length - 1 || idx < 0) {
- return undefined;
- }
- var chunkOffset = idx % this.chunkSize;
- var chunkNum = (idx / this.chunkSize) | 0;
- return this.getter(chunkNum)[chunkOffset];
- };
- LazyUint8Array.prototype.setDataGetter =
- function LazyUint8Array_setDataGetter(getter) {
- this.getter = getter;
- };
- LazyUint8Array.prototype.cacheLength =
- function LazyUint8Array_cacheLength() {
- // Find length
- var xhr = new XMLHttpRequest();
- xhr.open("HEAD", url, false);
- xhr.send(null);
- if (!((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304))
- throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
- var datalength = Number(xhr.getResponseHeader("Content-length"));
- var header;
- var hasByteServing =
- (header = xhr.getResponseHeader("Accept-Ranges")) &&
- header === "bytes";
- var usesGzip =
- (header = xhr.getResponseHeader("Content-Encoding")) &&
- header === "gzip";
- var chunkSize = 1024 * 1024; // Chunk size in bytes
- if (!hasByteServing) chunkSize = datalength;
- // Function to get a range from the remote URL.
- var doXHR = (from, to) => {
- if (from > to)
- throw new Error(
- "invalid range (" + from + ", " + to + ") or no bytes requested!"
- );
- if (to > datalength - 1)
- throw new Error(
- "only " + datalength + " bytes available! programmer error!"
- );
- // TODO: Use mozResponseArrayBuffer, responseStream, etc. if available.
- var xhr = new XMLHttpRequest();
- xhr.open("GET", url, false);
- if (datalength !== chunkSize)
- xhr.setRequestHeader("Range", "bytes=" + from + "-" + to);
- // Some hints to the browser that we want binary data.
- xhr.responseType = "arraybuffer";
- if (xhr.overrideMimeType) {
- xhr.overrideMimeType("text/plain; charset=x-user-defined");
- }
- xhr.send(null);
- if (!((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304))
- throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
- if (xhr.response !== undefined) {
- return new Uint8Array(
- /** @type{Array<number>} */ (xhr.response || [])
- );
- }
- return intArrayFromString(xhr.responseText || "", true);
- };
- var lazyArray = this;
- lazyArray.setDataGetter(chunkNum => {
- var start = chunkNum * chunkSize;
- var end = (chunkNum + 1) * chunkSize - 1; // including this byte
- end = Math.min(end, datalength - 1); // if datalength-1 is selected, this is the last block
- if (typeof lazyArray.chunks[chunkNum] == "undefined") {
- lazyArray.chunks[chunkNum] = doXHR(start, end);
- }
- if (typeof lazyArray.chunks[chunkNum] == "undefined")
- throw new Error("doXHR failed!");
- return lazyArray.chunks[chunkNum];
- });
- if (usesGzip || !datalength) {
- // if the server uses gzip or doesn't supply the length, we have to download the whole file to get the (uncompressed) length
- chunkSize = datalength = 1; // this will force getter(0)/doXHR do download the whole file
- datalength = this.getter(0).length;
- chunkSize = datalength;
- out(
- "LazyFiles on gzip forces download of the whole file when length is accessed"
- );
- }
- this._length = datalength;
- this._chunkSize = chunkSize;
- this.lengthKnown = true;
- };
- if (typeof XMLHttpRequest != "undefined") {
- if (!ENVIRONMENT_IS_WORKER)
- throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";
- var lazyArray = new LazyUint8Array();
- Object.defineProperties(lazyArray, {
- length: {
- get: /** @this{Object} */ function () {
- if (!this.lengthKnown) {
- this.cacheLength();
- }
- return this._length;
- }
- },
- chunkSize: {
- get: /** @this{Object} */ function () {
- if (!this.lengthKnown) {
- this.cacheLength();
- }
- return this._chunkSize;
- }
- }
- });
- var properties = { isDevice: false, contents: lazyArray };
- } else {
- var properties = { isDevice: false, url: url };
- }
- var node = FS.createFile(parent, name, properties, canRead, canWrite);
- // This is a total hack, but I want to get this lazy file code out of the
- // core of MEMFS. If we want to keep this lazy file concept I feel it should
- // be its own thin LAZYFS proxying calls to MEMFS.
- if (properties.contents) {
- node.contents = properties.contents;
- } else if (properties.url) {
- node.contents = null;
- node.url = properties.url;
- }
- // Add a function that defers querying the file size until it is asked the first time.
- Object.defineProperties(node, {
- usedBytes: {
- get: /** @this {FSNode} */ function () {
- return this.contents.length;
- }
- }
- });
- // override each stream op with one that tries to force load the lazy file first
- var stream_ops = {};
- var keys = Object.keys(node.stream_ops);
- keys.forEach(key => {
- var fn = node.stream_ops[key];
- stream_ops[key] = function forceLoadLazyFile() {
- FS.forceLoadFile(node);
- return fn.apply(null, arguments);
- };
- });
- function writeChunks(stream, buffer, offset, length, position) {
- var contents = stream.node.contents;
- if (position >= contents.length) return 0;
- var size = Math.min(contents.length - position, length);
- if (contents.slice) {
- // normal array
- for (var i = 0; i < size; i++) {
- buffer[offset + i] = contents[position + i];
- }
- } else {
- for (var i = 0; i < size; i++) {
- // LazyUint8Array from sync binary XHR
- buffer[offset + i] = contents.get(position + i);
- }
- }
- return size;
- }
- // use a custom read function
- stream_ops.read = (stream, buffer, offset, length, position) => {
- FS.forceLoadFile(node);
- return writeChunks(stream, buffer, offset, length, position);
- };
- // use a custom mmap function
- stream_ops.mmap = (stream, length, position, prot, flags) => {
- FS.forceLoadFile(node);
- var ptr = mmapAlloc(length);
- if (!ptr) {
- throw new FS.ErrnoError(48);
- }
- writeChunks(stream, HEAP8, ptr, length, position);
- return { ptr, allocated: true };
- };
- node.stream_ops = stream_ops;
- return node;
- }
- };
- /**
- * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the
- * emscripten HEAP, returns a copy of that string as a Javascript String object.
- *
- * @param {number} ptr
- * @param {number=} maxBytesToRead - An optional length that specifies the
- * maximum number of bytes to read. You can omit this parameter to scan the
- * string until the first 0 byte. If maxBytesToRead is passed, and the string
- * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the
- * string will cut short at that byte index (i.e. maxBytesToRead will not
- * produce a string of exact length [ptr, ptr+maxBytesToRead[) N.B. mixing
- * frequent uses of UTF8ToString() with and without maxBytesToRead may throw
- * JS JIT optimizations off, so it is worth to consider consistently using one
- * @return {string}
- */
- var UTF8ToString = (ptr, maxBytesToRead) => {
- return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
- };
- var SYSCALLS = {
- DEFAULT_POLLMASK: 5,
- calculateAt: function (dirfd, path, allowEmpty) {
- if (PATH.isAbs(path)) {
- return path;
- }
- // relative path
- var dir;
- if (dirfd === -100) {
- dir = FS.cwd();
- } else {
- var dirstream = SYSCALLS.getStreamFromFD(dirfd);
- dir = dirstream.path;
- }
- if (path.length == 0) {
- if (!allowEmpty) {
- throw new FS.ErrnoError(44);
- }
- return dir;
- }
- return PATH.join2(dir, path);
- },
- doStat: function (func, path, buf) {
- try {
- var stat = func(path);
- } catch (e) {
- if (
- e &&
- e.node &&
- PATH.normalize(path) !== PATH.normalize(FS.getPath(e.node))
- ) {
- // an error occurred while trying to look up the path; we should just report ENOTDIR
- return -54;
- }
- throw e;
- }
- HEAP32[buf >> 2] = stat.dev;
- HEAP32[(buf + 4) >> 2] = stat.mode;
- HEAPU32[(buf + 8) >> 2] = stat.nlink;
- HEAP32[(buf + 12) >> 2] = stat.uid;
- HEAP32[(buf + 16) >> 2] = stat.gid;
- HEAP32[(buf + 20) >> 2] = stat.rdev;
- (tempI64 = [
- stat.size >>> 0,
- ((tempDouble = stat.size),
- +Math.abs(tempDouble) >= 1.0
- ? tempDouble > 0.0
- ? +Math.floor(tempDouble / 4294967296.0) >>> 0
- : ~~+Math.ceil(
- (tempDouble - +(~~tempDouble >>> 0)) / 4294967296.0
- ) >>> 0
- : 0)
- ]),
- (HEAP32[(buf + 24) >> 2] = tempI64[0]),
- (HEAP32[(buf + 28) >> 2] = tempI64[1]);
- HEAP32[(buf + 32) >> 2] = 4096;
- HEAP32[(buf + 36) >> 2] = stat.blocks;
- var atime = stat.atime.getTime();
- var mtime = stat.mtime.getTime();
- var ctime = stat.ctime.getTime();
- (tempI64 = [
- Math.floor(atime / 1000) >>> 0,
- ((tempDouble = Math.floor(atime / 1000)),
- +Math.abs(tempDouble) >= 1.0
- ? tempDouble > 0.0
- ? +Math.floor(tempDouble / 4294967296.0) >>> 0
- : ~~+Math.ceil(
- (tempDouble - +(~~tempDouble >>> 0)) / 4294967296.0
- ) >>> 0
- : 0)
- ]),
- (HEAP32[(buf + 40) >> 2] = tempI64[0]),
- (HEAP32[(buf + 44) >> 2] = tempI64[1]);
- HEAPU32[(buf + 48) >> 2] = (atime % 1000) * 1000;
- (tempI64 = [
- Math.floor(mtime / 1000) >>> 0,
- ((tempDouble = Math.floor(mtime / 1000)),
- +Math.abs(tempDouble) >= 1.0
- ? tempDouble > 0.0
- ? +Math.floor(tempDouble / 4294967296.0) >>> 0
- : ~~+Math.ceil(
- (tempDouble - +(~~tempDouble >>> 0)) / 4294967296.0
- ) >>> 0
- : 0)
- ]),
- (HEAP32[(buf + 56) >> 2] = tempI64[0]),
- (HEAP32[(buf + 60) >> 2] = tempI64[1]);
- HEAPU32[(buf + 64) >> 2] = (mtime % 1000) * 1000;
- (tempI64 = [
- Math.floor(ctime / 1000) >>> 0,
- ((tempDouble = Math.floor(ctime / 1000)),
- +Math.abs(tempDouble) >= 1.0
- ? tempDouble > 0.0
- ? +Math.floor(tempDouble / 4294967296.0) >>> 0
- : ~~+Math.ceil(
- (tempDouble - +(~~tempDouble >>> 0)) / 4294967296.0
- ) >>> 0
- : 0)
- ]),
- (HEAP32[(buf + 72) >> 2] = tempI64[0]),
- (HEAP32[(buf + 76) >> 2] = tempI64[1]);
- HEAPU32[(buf + 80) >> 2] = (ctime % 1000) * 1000;
- (tempI64 = [
- stat.ino >>> 0,
- ((tempDouble = stat.ino),
- +Math.abs(tempDouble) >= 1.0
- ? tempDouble > 0.0
- ? +Math.floor(tempDouble / 4294967296.0) >>> 0
- : ~~+Math.ceil(
- (tempDouble - +(~~tempDouble >>> 0)) / 4294967296.0
- ) >>> 0
- : 0)
- ]),
- (HEAP32[(buf + 88) >> 2] = tempI64[0]),
- (HEAP32[(buf + 92) >> 2] = tempI64[1]);
- return 0;
- },
- doMsync: function (addr, stream, len, flags, offset) {
- if (!FS.isFile(stream.node.mode)) {
- throw new FS.ErrnoError(43);
- }
- if (flags & 2) {
- // MAP_PRIVATE calls need not to be synced back to underlying fs
- return 0;
- }
- var buffer = HEAPU8.slice(addr, addr + len);
- FS.msync(stream, buffer, offset, len, flags);
- },
- varargs: undefined,
- get() {
- SYSCALLS.varargs += 4;
- var ret = HEAP32[(SYSCALLS.varargs - 4) >> 2];
- return ret;
- },
- getStr(ptr) {
- var ret = UTF8ToString(ptr);
- return ret;
- },
- getStreamFromFD: function (fd) {
- var stream = FS.getStreamChecked(fd);
- return stream;
- }
- };
- function ___syscall_faccessat(dirfd, path, amode, flags) {
- try {
- path = SYSCALLS.getStr(path);
- path = SYSCALLS.calculateAt(dirfd, path);
- if (amode & ~7) {
- // need a valid mode
- return -28;
- }
- var lookup = FS.lookupPath(path, { follow: true });
- var node = lookup.node;
- if (!node) {
- return -44;
- }
- var perms = "";
- if (amode & 4) perms += "r";
- if (amode & 2) perms += "w";
- if (amode & 1) perms += "x";
- if (
- perms /* otherwise, they've just passed F_OK */ &&
- FS.nodePermissions(node, perms)
- ) {
- return -2;
- }
- return 0;
- } catch (e) {
- if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
- return -e.errno;
- }
- }
- var setErrNo = value => {
- HEAP32[___errno_location() >> 2] = value;
- return value;
- };
- function ___syscall_fcntl64(fd, cmd, varargs) {
- SYSCALLS.varargs = varargs;
- try {
- var stream = SYSCALLS.getStreamFromFD(fd);
- switch (cmd) {
- case 0: {
- var arg = SYSCALLS.get();
- if (arg < 0) {
- return -28;
- }
- var newStream;
- newStream = FS.createStream(stream, arg);
- return newStream.fd;
- }
- case 1:
- case 2:
- return 0; // FD_CLOEXEC makes no sense for a single process.
- case 3:
- return stream.flags;
- case 4: {
- var arg = SYSCALLS.get();
- stream.flags |= arg;
- return 0;
- }
- case 5: /* case 5: Currently in musl F_GETLK64 has same value as F_GETLK, so omitted to avoid duplicate case blocks. If that changes, uncomment this */ {
- var arg = SYSCALLS.get();
- var offset = 0;
- // We're always unlocked.
- HEAP16[(arg + offset) >> 1] = 2;
- return 0;
- }
- case 6:
- case 7:
- /* case 6: Currently in musl F_SETLK64 has same value as F_SETLK, so omitted to avoid duplicate case blocks. If that changes, uncomment this */
- /* case 7: Currently in musl F_SETLKW64 has same value as F_SETLKW, so omitted to avoid duplicate case blocks. If that changes, uncomment this */
- return 0; // Pretend that the locking is successful.
- case 16:
- case 8:
- return -28; // These are for sockets. We don't have them fully implemented yet.
- case 9:
- // musl trusts getown return values, due to a bug where they must be, as they overlap with errors. just return -1 here, so fcntl() returns that, and we set errno ourselves.
- setErrNo(28);
- return -1;
- default: {
- return -28;
- }
- }
- } catch (e) {
- if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
- return -e.errno;
- }
- }
- function ___syscall_fstat64(fd, buf) {
- try {
- var stream = SYSCALLS.getStreamFromFD(fd);
- return SYSCALLS.doStat(FS.stat, stream.path, buf);
- } catch (e) {
- if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
- return -e.errno;
- }
- }
- var stringToUTF8 = (str, outPtr, maxBytesToWrite) => {
- return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
- };
- function ___syscall_getdents64(fd, dirp, count) {
- try {
- var stream = SYSCALLS.getStreamFromFD(fd);
- if (!stream.getdents) {
- stream.getdents = FS.readdir(stream.path);
- }
- var struct_size = 280;
- var pos = 0;
- var off = FS.llseek(stream, 0, 1);
- var idx = Math.floor(off / struct_size);
- while (idx < stream.getdents.length && pos + struct_size <= count) {
- var id;
- var type;
- var name = stream.getdents[idx];
- if (name === ".") {
- id = stream.node.id;
- type = 4; // DT_DIR
- } else if (name === "..") {
- var lookup = FS.lookupPath(stream.path, { parent: true });
- id = lookup.node.id;
- type = 4; // DT_DIR
- } else {
- var child = FS.lookupNode(stream.node, name);
- id = child.id;
- type = FS.isChrdev(child.mode)
- ? 2 // DT_CHR, character device.
- : FS.isDir(child.mode)
- ? 4 // DT_DIR, directory.
- : FS.isLink(child.mode)
- ? 10 // DT_LNK, symbolic link.
- : 8; // DT_REG, regular file.
- }
- (tempI64 = [
- id >>> 0,
- ((tempDouble = id),
- +Math.abs(tempDouble) >= 1.0
- ? tempDouble > 0.0
- ? +Math.floor(tempDouble / 4294967296.0) >>> 0
- : ~~+Math.ceil(
- (tempDouble - +(~~tempDouble >>> 0)) / 4294967296.0
- ) >>> 0
- : 0)
- ]),
- (HEAP32[(dirp + pos) >> 2] = tempI64[0]),
- (HEAP32[(dirp + pos + 4) >> 2] = tempI64[1]);
- (tempI64 = [
- ((idx + 1) * struct_size) >>> 0,
- ((tempDouble = (idx + 1) * struct_size),
- +Math.abs(tempDouble) >= 1.0
- ? tempDouble > 0.0
- ? +Math.floor(tempDouble / 4294967296.0) >>> 0
- : ~~+Math.ceil(
- (tempDouble - +(~~tempDouble >>> 0)) / 4294967296.0
- ) >>> 0
- : 0)
- ]),
- (HEAP32[(dirp + pos + 8) >> 2] = tempI64[0]),
- (HEAP32[(dirp + pos + 12) >> 2] = tempI64[1]);
- HEAP16[(dirp + pos + 16) >> 1] = 280;
- HEAP8[(dirp + pos + 18) >> 0] = type;
- stringToUTF8(name, dirp + pos + 19, 256);
- pos += struct_size;
- idx += 1;
- }
- FS.llseek(stream, idx * struct_size, 0);
- return pos;
- } catch (e) {
- if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
- return -e.errno;
- }
- }
- function ___syscall_lstat64(path, buf) {
- try {
- path = SYSCALLS.getStr(path);
- return SYSCALLS.doStat(FS.lstat, path, buf);
- } catch (e) {
- if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
- return -e.errno;
- }
- }
- function ___syscall_newfstatat(dirfd, path, buf, flags) {
- try {
- path = SYSCALLS.getStr(path);
- var nofollow = flags & 256;
- var allowEmpty = flags & 4096;
- flags = flags & ~6400;
- path = SYSCALLS.calculateAt(dirfd, path, allowEmpty);
- return SYSCALLS.doStat(nofollow ? FS.lstat : FS.stat, path, buf);
- } catch (e) {
- if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
- return -e.errno;
- }
- }
- function ___syscall_openat(dirfd, path, flags, varargs) {
- SYSCALLS.varargs = varargs;
- try {
- path = SYSCALLS.getStr(path);
- path = SYSCALLS.calculateAt(dirfd, path);
- var mode = varargs ? SYSCALLS.get() : 0;
- return FS.open(path, flags, mode).fd;
- } catch (e) {
- if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
- return -e.errno;
- }
- }
- function ___syscall_renameat(olddirfd, oldpath, newdirfd, newpath) {
- try {
- oldpath = SYSCALLS.getStr(oldpath);
- newpath = SYSCALLS.getStr(newpath);
- oldpath = SYSCALLS.calculateAt(olddirfd, oldpath);
- newpath = SYSCALLS.calculateAt(newdirfd, newpath);
- FS.rename(oldpath, newpath);
- return 0;
- } catch (e) {
- if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
- return -e.errno;
- }
- }
- function ___syscall_rmdir(path) {
- try {
- path = SYSCALLS.getStr(path);
- FS.rmdir(path);
- return 0;
- } catch (e) {
- if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
- return -e.errno;
- }
- }
- function ___syscall_stat64(path, buf) {
- try {
- path = SYSCALLS.getStr(path);
- return SYSCALLS.doStat(FS.stat, path, buf);
- } catch (e) {
- if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
- return -e.errno;
- }
- }
- function ___syscall_unlinkat(dirfd, path, flags) {
- try {
- path = SYSCALLS.getStr(path);
- path = SYSCALLS.calculateAt(dirfd, path);
- if (flags === 0) {
- FS.unlink(path);
- } else if (flags === 512) {
- FS.rmdir(path);
- } else {
- abort("Invalid flags passed to unlinkat");
- }
- return 0;
- } catch (e) {
- if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
- return -e.errno;
- }
- }
- var nowIsMonotonic = true;
- var __emscripten_get_now_is_monotonic = () => nowIsMonotonic;
- function convertI32PairToI53Checked(lo, hi) {
- return (hi + 0x200000) >>> 0 < 0x400001 - !!lo
- ? (lo >>> 0) + hi * 4294967296
- : NaN;
- }
- function __gmtime_js(time_low, time_high, tmPtr) {
- var time = convertI32PairToI53Checked(time_low, time_high);
- var date = new Date(time * 1000);
- HEAP32[tmPtr >> 2] = date.getUTCSeconds();
- HEAP32[(tmPtr + 4) >> 2] = date.getUTCMinutes();
- HEAP32[(tmPtr + 8) >> 2] = date.getUTCHours();
- HEAP32[(tmPtr + 12) >> 2] = date.getUTCDate();
- HEAP32[(tmPtr + 16) >> 2] = date.getUTCMonth();
- HEAP32[(tmPtr + 20) >> 2] = date.getUTCFullYear() - 1900;
- HEAP32[(tmPtr + 24) >> 2] = date.getUTCDay();
- var start = Date.UTC(date.getUTCFullYear(), 0, 1, 0, 0, 0, 0);
- var yday = ((date.getTime() - start) / (1000 * 60 * 60 * 24)) | 0;
- HEAP32[(tmPtr + 28) >> 2] = yday;
- }
- var isLeapYear = year => {
- return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
- };
- var MONTH_DAYS_LEAP_CUMULATIVE = [
- 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335
- ];
- var MONTH_DAYS_REGULAR_CUMULATIVE = [
- 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
- ];
- var ydayFromDate = date => {
- var leap = isLeapYear(date.getFullYear());
- var monthDaysCumulative = leap
- ? MONTH_DAYS_LEAP_CUMULATIVE
- : MONTH_DAYS_REGULAR_CUMULATIVE;
- var yday = monthDaysCumulative[date.getMonth()] + date.getDate() - 1; // -1 since it's days since Jan 1
- return yday;
- };
- function __localtime_js(time_low, time_high, tmPtr) {
- var time = convertI32PairToI53Checked(time_low, time_high);
- var date = new Date(time * 1000);
- HEAP32[tmPtr >> 2] = date.getSeconds();
- HEAP32[(tmPtr + 4) >> 2] = date.getMinutes();
- HEAP32[(tmPtr + 8) >> 2] = date.getHours();
- HEAP32[(tmPtr + 12) >> 2] = date.getDate();
- HEAP32[(tmPtr + 16) >> 2] = date.getMonth();
- HEAP32[(tmPtr + 20) >> 2] = date.getFullYear() - 1900;
- HEAP32[(tmPtr + 24) >> 2] = date.getDay();
- var yday = ydayFromDate(date) | 0;
- HEAP32[(tmPtr + 28) >> 2] = yday;
- HEAP32[(tmPtr + 36) >> 2] = -(date.getTimezoneOffset() * 60);
- // Attention: DST is in December in South, and some regions don't have DST at all.
- var start = new Date(date.getFullYear(), 0, 1);
- var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset();
- var winterOffset = start.getTimezoneOffset();
- var dst =
- (summerOffset != winterOffset &&
- date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0;
- HEAP32[(tmPtr + 32) >> 2] = dst;
- }
- var __mktime_js = function (tmPtr) {
- var ret = (() => {
- var date = new Date(
- HEAP32[(tmPtr + 20) >> 2] + 1900,
- HEAP32[(tmPtr + 16) >> 2],
- HEAP32[(tmPtr + 12) >> 2],
- HEAP32[(tmPtr + 8) >> 2],
- HEAP32[(tmPtr + 4) >> 2],
- HEAP32[tmPtr >> 2],
- 0
- );
- // There's an ambiguous hour when the time goes back; the tm_isdst field is
- // used to disambiguate it. Date() basically guesses, so we fix it up if it
- // guessed wrong, or fill in tm_isdst with the guess if it's -1.
- var dst = HEAP32[(tmPtr + 32) >> 2];
- var guessedOffset = date.getTimezoneOffset();
- var start = new Date(date.getFullYear(), 0, 1);
- var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset();
- var winterOffset = start.getTimezoneOffset();
- var dstOffset = Math.min(winterOffset, summerOffset); // DST is in December in South
- if (dst < 0) {
- // Attention: some regions don't have DST at all.
- HEAP32[(tmPtr + 32) >> 2] = Number(
- summerOffset != winterOffset && dstOffset == guessedOffset
- );
- } else if (dst > 0 != (dstOffset == guessedOffset)) {
- var nonDstOffset = Math.max(winterOffset, summerOffset);
- var trueOffset = dst > 0 ? dstOffset : nonDstOffset;
- // Don't try setMinutes(date.getMinutes() + ...) -- it's messed up.
- date.setTime(date.getTime() + (trueOffset - guessedOffset) * 60000);
- }
- HEAP32[(tmPtr + 24) >> 2] = date.getDay();
- var yday = ydayFromDate(date) | 0;
- HEAP32[(tmPtr + 28) >> 2] = yday;
- // To match expected behavior, update fields from date
- HEAP32[tmPtr >> 2] = date.getSeconds();
- HEAP32[(tmPtr + 4) >> 2] = date.getMinutes();
- HEAP32[(tmPtr + 8) >> 2] = date.getHours();
- HEAP32[(tmPtr + 12) >> 2] = date.getDate();
- HEAP32[(tmPtr + 16) >> 2] = date.getMonth();
- HEAP32[(tmPtr + 20) >> 2] = date.getYear();
- return date.getTime() / 1000;
- })();
- return (
- setTempRet0(
- ((tempDouble = ret),
- +Math.abs(tempDouble) >= 1.0
- ? tempDouble > 0.0
- ? +Math.floor(tempDouble / 4294967296.0) >>> 0
- : ~~+Math.ceil(
- (tempDouble - +(~~tempDouble >>> 0)) / 4294967296.0
- ) >>> 0
- : 0)
- ),
- ret >>> 0
- );
- };
- var stringToNewUTF8 = str => {
- var size = lengthBytesUTF8(str) + 1;
- var ret = _malloc(size);
- if (ret) stringToUTF8(str, ret, size);
- return ret;
- };
- var __tzset_js = (timezone, daylight, tzname) => {
- // TODO: Use (malleable) environment variables instead of system settings.
- var currentYear = new Date().getFullYear();
- var winter = new Date(currentYear, 0, 1);
- var summer = new Date(currentYear, 6, 1);
- var winterOffset = winter.getTimezoneOffset();
- var summerOffset = summer.getTimezoneOffset();
- // Local standard timezone offset. Local standard time is not adjusted for daylight savings.
- // This code uses the fact that getTimezoneOffset returns a greater value during Standard Time versus Daylight Saving Time (DST).
- // Thus it determines the expected output during Standard Time, and it compares whether the output of the given date the same (Standard) or less (DST).
- var stdTimezoneOffset = Math.max(winterOffset, summerOffset);
- // timezone is specified as seconds west of UTC ("The external variable
- // `timezone` shall be set to the difference, in seconds, between
- // Coordinated Universal Time (UTC) and local standard time."), the same
- // as returned by stdTimezoneOffset.
- // See http://pubs.opengroup.org/onlinepubs/009695399/functions/tzset.html
- HEAPU32[timezone >> 2] = stdTimezoneOffset * 60;
- HEAP32[daylight >> 2] = Number(winterOffset != summerOffset);
- function extractZone(date) {
- var match = date.toTimeString().match(/\(([A-Za-z ]+)\)$/);
- return match ? match[1] : "GMT";
- }
- var winterName = extractZone(winter);
- var summerName = extractZone(summer);
- var winterNamePtr = stringToNewUTF8(winterName);
- var summerNamePtr = stringToNewUTF8(summerName);
- if (summerOffset < winterOffset) {
- // Northern hemisphere
- HEAPU32[tzname >> 2] = winterNamePtr;
- HEAPU32[(tzname + 4) >> 2] = summerNamePtr;
- } else {
- HEAPU32[tzname >> 2] = summerNamePtr;
- HEAPU32[(tzname + 4) >> 2] = winterNamePtr;
- }
- };
- var _abort = () => {
- abort("");
- };
- function _emscripten_date_now() {
- return Date.now();
- }
- var _emscripten_get_now;
- // Modern environment where performance.now() is supported:
- // N.B. a shorter form "_emscripten_get_now = performance.now;" is
- // unfortunately not allowed even in current browsers (e.g. FF Nightly 75).
- _emscripten_get_now = () => performance.now();
- var _emscripten_memcpy_big = (dest, src, num) =>
- HEAPU8.copyWithin(dest, src, src + num);
- var getHeapMax = () =>
- // Stay one Wasm page short of 4GB: while e.g. Chrome is able to allocate
- // full 4GB Wasm memories, the size will wrap back to 0 bytes in Wasm side
- // for any code that deals with heap sizes, which would require special
- // casing all heap size related code to treat 0 specially.
- 2147483648;
- var growMemory = size => {
- var b = wasmMemory.buffer;
- var pages = (size - b.byteLength + 65535) >>> 16;
- try {
- // round size grow request up to wasm page size (fixed 64KB per spec)
- wasmMemory.grow(pages); // .grow() takes a delta compared to the previous size
- updateMemoryViews();
- return 1 /*success*/;
- } catch (e) {}
- // implicit 0 return to save code size (caller will cast "undefined" into 0
- // anyhow)
- };
- var _emscripten_resize_heap = requestedSize => {
- var oldSize = HEAPU8.length;
- // With CAN_ADDRESS_2GB or MEMORY64, pointers are already unsigned.
- requestedSize >>>= 0;
- // With multithreaded builds, races can happen (another thread might increase the size
- // in between), so return a failure, and let the caller retry.
- // Memory resize rules:
- // 1. Always increase heap size to at least the requested size, rounded up
- // to next page multiple.
- // 2a. If MEMORY_GROWTH_LINEAR_STEP == -1, excessively resize the heap
- // geometrically: increase the heap size according to
- // MEMORY_GROWTH_GEOMETRIC_STEP factor (default +20%), At most
- // overreserve by MEMORY_GROWTH_GEOMETRIC_CAP bytes (default 96MB).
- // 2b. If MEMORY_GROWTH_LINEAR_STEP != -1, excessively resize the heap
- // linearly: increase the heap size by at least
- // MEMORY_GROWTH_LINEAR_STEP bytes.
- // 3. Max size for the heap is capped at 2048MB-WASM_PAGE_SIZE, or by
- // MAXIMUM_MEMORY, or by ASAN limit, depending on which is smallest
- // 4. If we were unable to allocate as much memory, it may be due to
- // over-eager decision to excessively reserve due to (3) above.
- // Hence if an allocation fails, cut down on the amount of excess
- // growth, in an attempt to succeed to perform a smaller allocation.
- // A limit is set for how much we can grow. We should not exceed that
- // (the wasm binary specifies it, so if we tried, we'd fail anyhow).
- var maxHeapSize = getHeapMax();
- if (requestedSize > maxHeapSize) {
- return false;
- }
- var alignUp = (x, multiple) => x + ((multiple - (x % multiple)) % multiple);
- // Loop through potential heap size increases. If we attempt a too eager
- // reservation that fails, cut down on the attempted size and reserve a
- // smaller bump instead. (max 3 times, chosen somewhat arbitrarily)
- for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
- var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown); // ensure geometric growth
- // but limit overreserving (default to capping at +96MB overgrowth at most)
- overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);
- var newSize = Math.min(
- maxHeapSize,
- alignUp(Math.max(requestedSize, overGrownHeapSize), 65536)
- );
- var replacement = growMemory(newSize);
- if (replacement) {
- return true;
- }
- }
- return false;
- };
- var _emscripten_run_script = ptr => {
- eval(UTF8ToString(ptr));
- };
- var ENV = {};
- var getExecutableName = () => {
- return thisProgram || "./this.program";
- };
- var getEnvStrings = () => {
- if (!getEnvStrings.strings) {
- // Default values.
- // Browser language detection #8751
- var lang =
- (
- (typeof navigator == "object" &&
- navigator.languages &&
- navigator.languages[0]) ||
- "C"
- ).replace("-", "_") + ".UTF-8";
- var env = {
- USER: "web_user",
- LOGNAME: "web_user",
- PATH: "/",
- PWD: "/",
- HOME: "/home/web_user",
- LANG: lang,
- _: getExecutableName()
- };
- // Apply the user-provided values, if any.
- for (var x in ENV) {
- // x is a key in ENV; if ENV[x] is undefined, that means it was
- // explicitly set to be so. We allow user code to do that to
- // force variables with default values to remain unset.
- if (ENV[x] === undefined) delete env[x];
- else env[x] = ENV[x];
- }
- var strings = [];
- for (var x in env) {
- strings.push(`${x}=${env[x]}`);
- }
- getEnvStrings.strings = strings;
- }
- return getEnvStrings.strings;
- };
- var stringToAscii = (str, buffer) => {
- for (var i = 0; i < str.length; ++i) {
- HEAP8[buffer++ >> 0] = str.charCodeAt(i);
- }
- // Null-terminate the string
- HEAP8[buffer >> 0] = 0;
- };
- var _environ_get = (__environ, environ_buf) => {
- var bufSize = 0;
- getEnvStrings().forEach(function (string, i) {
- var ptr = environ_buf + bufSize;
- HEAPU32[(__environ + i * 4) >> 2] = ptr;
- stringToAscii(string, ptr);
- bufSize += string.length + 1;
- });
- return 0;
- };
- var _environ_sizes_get = (penviron_count, penviron_buf_size) => {
- var strings = getEnvStrings();
- HEAPU32[penviron_count >> 2] = strings.length;
- var bufSize = 0;
- strings.forEach(function (string) {
- bufSize += string.length + 1;
- });
- HEAPU32[penviron_buf_size >> 2] = bufSize;
- return 0;
- };
- function _fd_close(fd) {
- try {
- var stream = SYSCALLS.getStreamFromFD(fd);
- FS.close(stream);
- return 0;
- } catch (e) {
- if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
- return e.errno;
- }
- }
- function _fd_fdstat_get(fd, pbuf) {
- try {
- var rightsBase = 0;
- var rightsInheriting = 0;
- var flags = 0;
- {
- var stream = SYSCALLS.getStreamFromFD(fd);
- // All character devices are terminals (other things a Linux system would
- // assume is a character device, like the mouse, we have special APIs for).
- var type = stream.tty
- ? 2
- : FS.isDir(stream.mode)
- ? 3
- : FS.isLink(stream.mode)
- ? 7
- : 4;
- }
- HEAP8[pbuf >> 0] = type;
- HEAP16[(pbuf + 2) >> 1] = flags;
- (tempI64 = [
- rightsBase >>> 0,
- ((tempDouble = rightsBase),
- +Math.abs(tempDouble) >= 1.0
- ? tempDouble > 0.0
- ? +Math.floor(tempDouble / 4294967296.0) >>> 0
- : ~~+Math.ceil(
- (tempDouble - +(~~tempDouble >>> 0)) / 4294967296.0
- ) >>> 0
- : 0)
- ]),
- (HEAP32[(pbuf + 8) >> 2] = tempI64[0]),
- (HEAP32[(pbuf + 12) >> 2] = tempI64[1]);
- (tempI64 = [
- rightsInheriting >>> 0,
- ((tempDouble = rightsInheriting),
- +Math.abs(tempDouble) >= 1.0
- ? tempDouble > 0.0
- ? +Math.floor(tempDouble / 4294967296.0) >>> 0
- : ~~+Math.ceil(
- (tempDouble - +(~~tempDouble >>> 0)) / 4294967296.0
- ) >>> 0
- : 0)
- ]),
- (HEAP32[(pbuf + 16) >> 2] = tempI64[0]),
- (HEAP32[(pbuf + 20) >> 2] = tempI64[1]);
- return 0;
- } catch (e) {
- if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
- return e.errno;
- }
- }
- /** @param {number=} offset */
- var doReadv = (stream, iov, iovcnt, offset) => {
- var ret = 0;
- for (var i = 0; i < iovcnt; i++) {
- var ptr = HEAPU32[iov >> 2];
- var len = HEAPU32[(iov + 4) >> 2];
- iov += 8;
- var curr = FS.read(stream, HEAP8, ptr, len, offset);
- if (curr < 0) return -1;
- ret += curr;
- if (curr < len) break; // nothing more to read
- if (typeof offset !== "undefined") {
- offset += curr;
- }
- }
- return ret;
- };
- function _fd_read(fd, iov, iovcnt, pnum) {
- try {
- var stream = SYSCALLS.getStreamFromFD(fd);
- var num = doReadv(stream, iov, iovcnt);
- HEAPU32[pnum >> 2] = num;
- return 0;
- } catch (e) {
- if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
- return e.errno;
- }
- }
- function _fd_seek(fd, offset_low, offset_high, whence, newOffset) {
- var offset = convertI32PairToI53Checked(offset_low, offset_high);
- try {
- if (isNaN(offset)) return 61;
- var stream = SYSCALLS.getStreamFromFD(fd);
- FS.llseek(stream, offset, whence);
- (tempI64 = [
- stream.position >>> 0,
- ((tempDouble = stream.position),
- +Math.abs(tempDouble) >= 1.0
- ? tempDouble > 0.0
- ? +Math.floor(tempDouble / 4294967296.0) >>> 0
- : ~~+Math.ceil(
- (tempDouble - +(~~tempDouble >>> 0)) / 4294967296.0
- ) >>> 0
- : 0)
- ]),
- (HEAP32[newOffset >> 2] = tempI64[0]),
- (HEAP32[(newOffset + 4) >> 2] = tempI64[1]);
- if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null; // reset readdir state
- return 0;
- } catch (e) {
- if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
- return e.errno;
- }
- }
- /** @param {number=} offset */
- var doWritev = (stream, iov, iovcnt, offset) => {
- var ret = 0;
- for (var i = 0; i < iovcnt; i++) {
- var ptr = HEAPU32[iov >> 2];
- var len = HEAPU32[(iov + 4) >> 2];
- iov += 8;
- var curr = FS.write(stream, HEAP8, ptr, len, offset);
- if (curr < 0) return -1;
- ret += curr;
- if (typeof offset !== "undefined") {
- offset += curr;
- }
- }
- return ret;
- };
- function _fd_write(fd, iov, iovcnt, pnum) {
- try {
- var stream = SYSCALLS.getStreamFromFD(fd);
- var num = doWritev(stream, iov, iovcnt);
- HEAPU32[pnum >> 2] = num;
- return 0;
- } catch (e) {
- if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
- return e.errno;
- }
- }
- var arraySum = (array, index) => {
- var sum = 0;
- for (var i = 0; i <= index; sum += array[i++]) {
- // no-op
- }
- return sum;
- };
- var MONTH_DAYS_LEAP = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
- var MONTH_DAYS_REGULAR = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
- var addDays = (date, days) => {
- var newDate = new Date(date.getTime());
- while (days > 0) {
- var leap = isLeapYear(newDate.getFullYear());
- var currentMonth = newDate.getMonth();
- var daysInCurrentMonth = (leap ? MONTH_DAYS_LEAP : MONTH_DAYS_REGULAR)[
- currentMonth
- ];
- if (days > daysInCurrentMonth - newDate.getDate()) {
- // we spill over to next month
- days -= daysInCurrentMonth - newDate.getDate() + 1;
- newDate.setDate(1);
- if (currentMonth < 11) {
- newDate.setMonth(currentMonth + 1);
- } else {
- newDate.setMonth(0);
- newDate.setFullYear(newDate.getFullYear() + 1);
- }
- } else {
- // we stay in current month
- newDate.setDate(newDate.getDate() + days);
- return newDate;
- }
- }
- return newDate;
- };
- var writeArrayToMemory = (array, buffer) => {
- HEAP8.set(array, buffer);
- };
- var _strftime = (s, maxsize, format, tm) => {
- // size_t strftime(char *restrict s, size_t maxsize, const char *restrict format, const struct tm *restrict timeptr);
- // http://pubs.opengroup.org/onlinepubs/009695399/functions/strftime.html
- var tm_zone = HEAP32[(tm + 40) >> 2];
- var date = {
- tm_sec: HEAP32[tm >> 2],
- tm_min: HEAP32[(tm + 4) >> 2],
- tm_hour: HEAP32[(tm + 8) >> 2],
- tm_mday: HEAP32[(tm + 12) >> 2],
- tm_mon: HEAP32[(tm + 16) >> 2],
- tm_year: HEAP32[(tm + 20) >> 2],
- tm_wday: HEAP32[(tm + 24) >> 2],
- tm_yday: HEAP32[(tm + 28) >> 2],
- tm_isdst: HEAP32[(tm + 32) >> 2],
- tm_gmtoff: HEAP32[(tm + 36) >> 2],
- tm_zone: tm_zone ? UTF8ToString(tm_zone) : ""
- };
- var pattern = UTF8ToString(format);
- // expand format
- var EXPANSION_RULES_1 = {
- "%c": "%a %b %d %H:%M:%S %Y", // Replaced by the locale's appropriate date and time representation - e.g., Mon Aug 3 14:02:01 2013
- "%D": "%m/%d/%y", // Equivalent to %m / %d / %y
- "%F": "%Y-%m-%d", // Equivalent to %Y - %m - %d
- "%h": "%b", // Equivalent to %b
- "%r": "%I:%M:%S %p", // Replaced by the time in a.m. and p.m. notation
- "%R": "%H:%M", // Replaced by the time in 24-hour notation
- "%T": "%H:%M:%S", // Replaced by the time
- "%x": "%m/%d/%y", // Replaced by the locale's appropriate date representation
- "%X": "%H:%M:%S", // Replaced by the locale's appropriate time representation
- // Modified Conversion Specifiers
- "%Ec": "%c", // Replaced by the locale's alternative appropriate date and time representation.
- "%EC": "%C", // Replaced by the name of the base year (period) in the locale's alternative representation.
- "%Ex": "%m/%d/%y", // Replaced by the locale's alternative date representation.
- "%EX": "%H:%M:%S", // Replaced by the locale's alternative time representation.
- "%Ey": "%y", // Replaced by the offset from %EC (year only) in the locale's alternative representation.
- "%EY": "%Y", // Replaced by the full alternative year representation.
- "%Od": "%d", // Replaced by the day of the month, using the locale's alternative numeric symbols, filled as needed with leading zeros if there is any alternative symbol for zero; otherwise, with leading <space> characters.
- "%Oe": "%e", // Replaced by the day of the month, using the locale's alternative numeric symbols, filled as needed with leading <space> characters.
- "%OH": "%H", // Replaced by the hour (24-hour clock) using the locale's alternative numeric symbols.
- "%OI": "%I", // Replaced by the hour (12-hour clock) using the locale's alternative numeric symbols.
- "%Om": "%m", // Replaced by the month using the locale's alternative numeric symbols.
- "%OM": "%M", // Replaced by the minutes using the locale's alternative numeric symbols.
- "%OS": "%S", // Replaced by the seconds using the locale's alternative numeric symbols.
- "%Ou": "%u", // Replaced by the weekday as a number in the locale's alternative representation (Monday=1).
- "%OU": "%U", // Replaced by the week number of the year (Sunday as the first day of the week, rules corresponding to %U ) using the locale's alternative numeric symbols.
- "%OV": "%V", // Replaced by the week number of the year (Monday as the first day of the week, rules corresponding to %V ) using the locale's alternative numeric symbols.
- "%Ow": "%w", // Replaced by the number of the weekday (Sunday=0) using the locale's alternative numeric symbols.
- "%OW": "%W", // Replaced by the week number of the year (Monday as the first day of the week) using the locale's alternative numeric symbols.
- "%Oy": "%y" // Replaced by the year (offset from %C ) using the locale's alternative numeric symbols.
- };
- for (var rule in EXPANSION_RULES_1) {
- pattern = pattern.replace(new RegExp(rule, "g"), EXPANSION_RULES_1[rule]);
- }
- var WEEKDAYS = [
- "Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday"
- ];
- var MONTHS = [
- "January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December"
- ];
- function leadingSomething(value, digits, character) {
- var str = typeof value == "number" ? value.toString() : value || "";
- while (str.length < digits) {
- str = character[0] + str;
- }
- return str;
- }
- function leadingNulls(value, digits) {
- return leadingSomething(value, digits, "0");
- }
- function compareByDay(date1, date2) {
- function sgn(value) {
- return value < 0 ? -1 : value > 0 ? 1 : 0;
- }
- var compare;
- if ((compare = sgn(date1.getFullYear() - date2.getFullYear())) === 0) {
- if ((compare = sgn(date1.getMonth() - date2.getMonth())) === 0) {
- compare = sgn(date1.getDate() - date2.getDate());
- }
- }
- return compare;
- }
- function getFirstWeekStartDate(janFourth) {
- switch (janFourth.getDay()) {
- case 0: // Sunday
- return new Date(janFourth.getFullYear() - 1, 11, 29);
- case 1: // Monday
- return janFourth;
- case 2: // Tuesday
- return new Date(janFourth.getFullYear(), 0, 3);
- case 3: // Wednesday
- return new Date(janFourth.getFullYear(), 0, 2);
- case 4: // Thursday
- return new Date(janFourth.getFullYear(), 0, 1);
- case 5: // Friday
- return new Date(janFourth.getFullYear() - 1, 11, 31);
- case 6: // Saturday
- return new Date(janFourth.getFullYear() - 1, 11, 30);
- }
- }
- function getWeekBasedYear(date) {
- var thisDate = addDays(new Date(date.tm_year + 1900, 0, 1), date.tm_yday);
- var janFourthThisYear = new Date(thisDate.getFullYear(), 0, 4);
- var janFourthNextYear = new Date(thisDate.getFullYear() + 1, 0, 4);
- var firstWeekStartThisYear = getFirstWeekStartDate(janFourthThisYear);
- var firstWeekStartNextYear = getFirstWeekStartDate(janFourthNextYear);
- if (compareByDay(firstWeekStartThisYear, thisDate) <= 0) {
- // this date is after the start of the first week of this year
- if (compareByDay(firstWeekStartNextYear, thisDate) <= 0) {
- return thisDate.getFullYear() + 1;
- }
- return thisDate.getFullYear();
- }
- return thisDate.getFullYear() - 1;
- }
- var EXPANSION_RULES_2 = {
- "%a": date => WEEKDAYS[date.tm_wday].substring(0, 3),
- "%A": date => WEEKDAYS[date.tm_wday],
- "%b": date => MONTHS[date.tm_mon].substring(0, 3),
- "%B": date => MONTHS[date.tm_mon],
- "%C": date => {
- var year = date.tm_year + 1900;
- return leadingNulls((year / 100) | 0, 2);
- },
- "%d": date => leadingNulls(date.tm_mday, 2),
- "%e": date => leadingSomething(date.tm_mday, 2, " "),
- "%g": date => {
- // %g, %G, and %V give values according to the ISO 8601:2000 standard week-based year.
- // In this system, weeks begin on a Monday and week 1 of the year is the week that includes
- // January 4th, which is also the week that includes the first Thursday of the year, and
- // is also the first week that contains at least four days in the year.
- // If the first Monday of January is the 2nd, 3rd, or 4th, the preceding days are part of
- // the last week of the preceding year; thus, for Saturday 2nd January 1999,
- // %G is replaced by 1998 and %V is replaced by 53. If December 29th, 30th,
- // or 31st is a Monday, it and any following days are part of week 1 of the following year.
- // Thus, for Tuesday 30th December 1997, %G is replaced by 1998 and %V is replaced by 01.
- return getWeekBasedYear(date).toString().substring(2);
- },
- "%G": date => getWeekBasedYear(date),
- "%H": date => leadingNulls(date.tm_hour, 2),
- "%I": date => {
- var twelveHour = date.tm_hour;
- if (twelveHour == 0) twelveHour = 12;
- else if (twelveHour > 12) twelveHour -= 12;
- return leadingNulls(twelveHour, 2);
- },
- "%j": date => {
- // Day of the year (001-366)
- return leadingNulls(
- date.tm_mday +
- arraySum(
- isLeapYear(date.tm_year + 1900)
- ? MONTH_DAYS_LEAP
- : MONTH_DAYS_REGULAR,
- date.tm_mon - 1
- ),
- 3
- );
- },
- "%m": date => leadingNulls(date.tm_mon + 1, 2),
- "%M": date => leadingNulls(date.tm_min, 2),
- "%n": () => "\n",
- "%p": date => {
- if (date.tm_hour >= 0 && date.tm_hour < 12) {
- return "AM";
- }
- return "PM";
- },
- "%S": date => leadingNulls(date.tm_sec, 2),
- "%t": () => "\t",
- "%u": date => date.tm_wday || 7,
- "%U": date => {
- var days = date.tm_yday + 7 - date.tm_wday;
- return leadingNulls(Math.floor(days / 7), 2);
- },
- "%V": date => {
- // Replaced by the week number of the year (Monday as the first day of the week)
- // as a decimal number [01,53]. If the week containing 1 January has four
- // or more days in the new year, then it is considered week 1.
- // Otherwise, it is the last week of the previous year, and the next week is week 1.
- // Both January 4th and the first Thursday of January are always in week 1. [ tm_year, tm_wday, tm_yday]
- var val = Math.floor((date.tm_yday + 7 - ((date.tm_wday + 6) % 7)) / 7);
- // If 1 Jan is just 1-3 days past Monday, the previous week
- // is also in this year.
- if ((date.tm_wday + 371 - date.tm_yday - 2) % 7 <= 2) {
- val++;
- }
- if (!val) {
- val = 52;
- // If 31 December of prev year a Thursday, or Friday of a
- // leap year, then the prev year has 53 weeks.
- var dec31 = (date.tm_wday + 7 - date.tm_yday - 1) % 7;
- if (
- dec31 == 4 ||
- (dec31 == 5 && isLeapYear((date.tm_year % 400) - 1))
- ) {
- val++;
- }
- } else if (val == 53) {
- // If 1 January is not a Thursday, and not a Wednesday of a
- // leap year, then this year has only 52 weeks.
- var jan1 = (date.tm_wday + 371 - date.tm_yday) % 7;
- if (jan1 != 4 && (jan1 != 3 || !isLeapYear(date.tm_year))) val = 1;
- }
- return leadingNulls(val, 2);
- },
- "%w": date => date.tm_wday,
- "%W": date => {
- var days = date.tm_yday + 7 - ((date.tm_wday + 6) % 7);
- return leadingNulls(Math.floor(days / 7), 2);
- },
- "%y": date => {
- // Replaced by the last two digits of the year as a decimal number [00,99]. [ tm_year]
- return (date.tm_year + 1900).toString().substring(2);
- },
- // Replaced by the year as a decimal number (for example, 1997). [ tm_year]
- "%Y": date => date.tm_year + 1900,
- "%z": date => {
- // Replaced by the offset from UTC in the ISO 8601:2000 standard format ( +hhmm or -hhmm ).
- // For example, "-0430" means 4 hours 30 minutes behind UTC (west of Greenwich).
- var off = date.tm_gmtoff;
- var ahead = off >= 0;
- off = Math.abs(off) / 60;
- // convert from minutes into hhmm format (which means 60 minutes = 100 units)
- off = (off / 60) * 100 + (off % 60);
- return (ahead ? "+" : "-") + String("0000" + off).slice(-4);
- },
- "%Z": date => date.tm_zone,
- "%%": () => "%"
- };
- // Replace %% with a pair of NULLs (which cannot occur in a C string), then
- // re-inject them after processing.
- pattern = pattern.replace(/%%/g, "\0\0");
- for (var rule in EXPANSION_RULES_2) {
- if (pattern.includes(rule)) {
- pattern = pattern.replace(
- new RegExp(rule, "g"),
- EXPANSION_RULES_2[rule](date)
- );
- }
- }
- pattern = pattern.replace(/\0\0/g, "%");
- var bytes = intArrayFromString(pattern, false);
- if (bytes.length > maxsize) {
- return 0;
- }
- writeArrayToMemory(bytes, s);
- return bytes.length - 1;
- };
- var _proc_exit = code => {
- EXITSTATUS = code;
- if (!keepRuntimeAlive()) {
- if (Module["onExit"]) Module["onExit"](code);
- ABORT = true;
- }
- quit_(code, new ExitStatus(code));
- };
- /** @param {boolean|number=} implicit */
- var exitJS = (status, implicit) => {
- EXITSTATUS = status;
- _proc_exit(status);
- };
- var handleException = e => {
- // Certain exception types we do not treat as errors since they are used for
- // internal control flow.
- // 1. ExitStatus, which is thrown by exit()
- // 2. "unwind", which is thrown by emscripten_unwind_to_js_event_loop() and others
- // that wish to return to JS event loop.
- if (e instanceof ExitStatus || e == "unwind") {
- return EXITSTATUS;
- }
- quit_(1, e);
- };
- var stringToUTF8OnStack = str => {
- var size = lengthBytesUTF8(str) + 1;
- var ret = stackAlloc(size);
- stringToUTF8(str, ret, size);
- return ret;
- };
- function getCFunc(ident) {
- var func = Module["_" + ident]; // closure exported function
- return func;
- }
- /**
- * @param {string|null=} returnType
- * @param {Array=} argTypes
- * @param {Arguments|Array=} args
- * @param {Object=} opts
- */
- var ccall = function (ident, returnType, argTypes, args, opts) {
- // For fast lookup of conversion functions
- var toC = {
- string: str => {
- var ret = 0;
- if (str !== null && str !== undefined && str !== 0) {
- // null string
- // at most 4 bytes per UTF-8 code point, +1 for the trailing '\0'
- ret = stringToUTF8OnStack(str);
- }
- return ret;
- },
- array: arr => {
- var ret = stackAlloc(arr.length);
- writeArrayToMemory(arr, ret);
- return ret;
- }
- };
- function convertReturnValue(ret) {
- if (returnType === "string") {
- return UTF8ToString(ret);
- }
- if (returnType === "boolean") return Boolean(ret);
- return ret;
- }
- var func = getCFunc(ident);
- var cArgs = [];
- var stack = 0;
- if (args) {
- for (var i = 0; i < args.length; i++) {
- var converter = toC[argTypes[i]];
- if (converter) {
- if (stack === 0) stack = stackSave();
- cArgs[i] = converter(args[i]);
- } else {
- cArgs[i] = args[i];
- }
- }
- }
- var ret = func.apply(null, cArgs);
- function onDone(ret) {
- if (stack !== 0) stackRestore(stack);
- return convertReturnValue(ret);
- }
- ret = onDone(ret);
- return ret;
- };
- /**
- * @param {string=} returnType
- * @param {Array=} argTypes
- * @param {Object=} opts
- */
- var cwrap = function (ident, returnType, argTypes, opts) {
- // When the function takes numbers and returns a number, we can just return
- // the original function
- var numericArgs =
- !argTypes ||
- argTypes.every(type => type === "number" || type === "boolean");
- var numericRet = returnType !== "string";
- if (numericRet && numericArgs && !opts) {
- return getCFunc(ident);
- }
- return function () {
- return ccall(ident, returnType, argTypes, arguments, opts);
- };
- };
- var FSNode = /** @constructor */ function (parent, name, mode, rdev) {
- if (!parent) {
- parent = this; // root node sets parent to itself
- }
- this.parent = parent;
- this.mount = parent.mount;
- this.mounted = null;
- this.id = FS.nextInode++;
- this.name = name;
- this.mode = mode;
- this.node_ops = {};
- this.stream_ops = {};
- this.rdev = rdev;
- };
- var readMode = 292 /*292*/ | 73; /*73*/
- var writeMode = 146; /*146*/
- Object.defineProperties(FSNode.prototype, {
- read: {
- get: /** @this{FSNode} */ function () {
- return (this.mode & readMode) === readMode;
- },
- set: /** @this{FSNode} */ function (val) {
- val ? (this.mode |= readMode) : (this.mode &= ~readMode);
- }
- },
- write: {
- get: /** @this{FSNode} */ function () {
- return (this.mode & writeMode) === writeMode;
- },
- set: /** @this{FSNode} */ function (val) {
- val ? (this.mode |= writeMode) : (this.mode &= ~writeMode);
- }
- },
- isFolder: {
- get: /** @this{FSNode} */ function () {
- return FS.isDir(this.mode);
- }
- },
- isDevice: {
- get: /** @this{FSNode} */ function () {
- return FS.isChrdev(this.mode);
- }
- }
- });
- FS.FSNode = FSNode;
- FS.createPreloadedFile = FS_createPreloadedFile;
- FS.staticInit();
- var wasmImports = {
- __syscall_faccessat: ___syscall_faccessat,
- __syscall_fcntl64: ___syscall_fcntl64,
- __syscall_fstat64: ___syscall_fstat64,
- __syscall_getdents64: ___syscall_getdents64,
- __syscall_lstat64: ___syscall_lstat64,
- __syscall_newfstatat: ___syscall_newfstatat,
- __syscall_openat: ___syscall_openat,
- __syscall_renameat: ___syscall_renameat,
- __syscall_rmdir: ___syscall_rmdir,
- __syscall_stat64: ___syscall_stat64,
- __syscall_unlinkat: ___syscall_unlinkat,
- _emscripten_get_now_is_monotonic: __emscripten_get_now_is_monotonic,
- _gmtime_js: __gmtime_js,
- _localtime_js: __localtime_js,
- _mktime_js: __mktime_js,
- _tzset_js: __tzset_js,
- abort: _abort,
- emscripten_date_now: _emscripten_date_now,
- emscripten_get_now: _emscripten_get_now,
- emscripten_memcpy_big: _emscripten_memcpy_big,
- emscripten_resize_heap: _emscripten_resize_heap,
- emscripten_run_script: _emscripten_run_script,
- environ_get: _environ_get,
- environ_sizes_get: _environ_sizes_get,
- fd_close: _fd_close,
- fd_fdstat_get: _fd_fdstat_get,
- fd_read: _fd_read,
- fd_seek: _fd_seek,
- fd_write: _fd_write,
- strftime: _strftime
- };
- var asm = createWasm();
- /** @type {function(...*):?} */
- var ___wasm_call_ctors = function () {
- return (___wasm_call_ctors = Module["asm"]["__wasm_call_ctors"]).apply(
- null,
- arguments
- );
- };
- /** @type {function(...*):?} */
- var _malloc = function () {
- return (_malloc = Module["asm"]["malloc"]).apply(null, arguments);
- };
- /** @type {function(...*):?} */
- var _captureByCount = (Module["_captureByCount"] = function () {
- return (_captureByCount = Module["_captureByCount"] =
- Module["asm"]["captureByCount"]).apply(null, arguments);
- });
- /** @type {function(...*):?} */
- var _captureByMs = (Module["_captureByMs"] = function () {
- return (_captureByMs = Module["_captureByMs"] =
- Module["asm"]["captureByMs"]).apply(null, arguments);
- });
- /** @type {function(...*):?} */
- var _main = (Module["_main"] = function () {
- return (_main = Module["_main"] = Module["asm"]["__main_argc_argv"]).apply(
- null,
- arguments
- );
- });
- /** @type {function(...*):?} */
- var ___errno_location = function () {
- return (___errno_location = Module["asm"]["__errno_location"]).apply(
- null,
- arguments
- );
- };
- /** @type {function(...*):?} */
- var _free = (Module["_free"] = function () {
- return (_free = Module["_free"] = Module["asm"]["free"]).apply(
- null,
- arguments
- );
- });
- /** @type {function(...*):?} */
- var setTempRet0 = function () {
- return (setTempRet0 = Module["asm"]["setTempRet0"]).apply(null, arguments);
- };
- /** @type {function(...*):?} */
- var stackSave = function () {
- return (stackSave = Module["asm"]["stackSave"]).apply(null, arguments);
- };
- /** @type {function(...*):?} */
- var stackRestore = function () {
- return (stackRestore = Module["asm"]["stackRestore"]).apply(null, arguments);
- };
- /** @type {function(...*):?} */
- var stackAlloc = function () {
- return (stackAlloc = Module["asm"]["stackAlloc"]).apply(null, arguments);
- };
- /** @type {function(...*):?} */
- var dynCall_iiiji = (Module["dynCall_iiiji"] = function () {
- return (dynCall_iiiji = Module["dynCall_iiiji"] =
- Module["asm"]["dynCall_iiiji"]).apply(null, arguments);
- });
- /** @type {function(...*):?} */
- var dynCall_jiji = (Module["dynCall_jiji"] = function () {
- return (dynCall_jiji = Module["dynCall_jiji"] =
- Module["asm"]["dynCall_jiji"]).apply(null, arguments);
- });
- /** @type {function(...*):?} */
- var dynCall_jiiji = (Module["dynCall_jiiji"] = function () {
- return (dynCall_jiiji = Module["dynCall_jiiji"] =
- Module["asm"]["dynCall_jiiji"]).apply(null, arguments);
- });
- // include: postamble.js
- // === Auto-generated postamble setup entry stuff ===
- Module["ccall"] = ccall;
- Module["cwrap"] = cwrap;
- var calledRun;
- dependenciesFulfilled = function runCaller() {
- // If run has never been called, and we should call run (INVOKE_RUN is true, and Module.noInitialRun is not false)
- if (!calledRun) run();
- if (!calledRun) dependenciesFulfilled = runCaller; // try this again later, after new deps are fulfilled
- };
- function callMain(args = []) {
- var entryFunction = _main;
- args.unshift(thisProgram);
- var argc = args.length;
- var argv = stackAlloc((argc + 1) * 4);
- var argv_ptr = argv >> 2;
- args.forEach(arg => {
- HEAP32[argv_ptr++] = stringToUTF8OnStack(arg);
- });
- HEAP32[argv_ptr] = 0;
- try {
- var ret = entryFunction(argc, argv);
- // if we're not running an evented main loop, it's time to exit
- exitJS(ret, /* implicit = */ true);
- return ret;
- } catch (e) {
- return handleException(e);
- }
- }
- function run(args = arguments_) {
- if (runDependencies > 0) {
- return;
- }
- preRun();
- // a preRun added a dependency, run will be called later
- if (runDependencies > 0) {
- return;
- }
- function doRun() {
- // run may have just been called through dependencies being fulfilled just in this very frame,
- // or while the async setStatus time below was happening
- if (calledRun) return;
- calledRun = true;
- Module["calledRun"] = true;
- if (ABORT) return;
- initRuntime();
- preMain();
- if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"]();
- if (shouldRunNow) callMain(args);
- postRun();
- }
- if (Module["setStatus"]) {
- Module["setStatus"]("Running...");
- setTimeout(function () {
- setTimeout(function () {
- Module["setStatus"]("");
- }, 1);
- doRun();
- }, 1);
- } else {
- doRun();
- }
- }
- if (Module["preInit"]) {
- if (typeof Module["preInit"] == "function")
- Module["preInit"] = [Module["preInit"]];
- while (Module["preInit"].length > 0) {
- Module["preInit"].pop()();
- }
- }
- // shouldRunNow refers to calling main(), not run().
- var shouldRunNow = true;
- if (Module["noInitialRun"]) shouldRunNow = false;
- run();
- // end include: postamble.js
|